@yartsun/hypershadow-widget 0.1.3 → 0.1.5
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/README.md +89 -2
- package/dist/static/widget/v1/chat/assets/{ChatWrapper.vue_vue_type_style_index_0_lang-D7Rtytcf.js → ChatWrapper.vue_vue_type_style_index_0_lang-DixkyFkr.js} +1 -1
- package/dist/static/widget/v1/chat/assets/{federation-expose-Chat-EHTYIY79.js → federation-expose-Chat-Bm8Hs5nl.js} +1 -1
- package/dist/static/widget/v1/chat/assets/{index-BGCrU3AK.js → index-DzIXELKk.js} +1 -1
- package/dist/static/widget/v1/chat/assets/remoteChat.js +1 -1
- package/dist/static/widget/v1/chat/index.html +2 -2
- package/package.json +7 -2
- package/types/index.ts +2 -0
- package/types/message.types.ts +17 -0
- package/types/snippet.types.ts +36 -0
- package/types/standalone.d.ts +34 -0
package/README.md
CHANGED
|
@@ -12,11 +12,98 @@ Chat widget for Hypershadow platform with WebSocket communication.
|
|
|
12
12
|
# Install dependencies
|
|
13
13
|
npm i
|
|
14
14
|
|
|
15
|
-
# Build the
|
|
15
|
+
# Build the main demo app (for local development)
|
|
16
16
|
npm run build
|
|
17
|
+
|
|
18
|
+
# Build library bundle (used as npm package entry)
|
|
19
|
+
npm run build:lib
|
|
20
|
+
|
|
21
|
+
# Build standalone bundle (for script tag / external embedding)
|
|
22
|
+
npm run build:vanilla
|
|
23
|
+
|
|
24
|
+
# Build everything
|
|
25
|
+
npm run build:all
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Build output will be located in the `/dist` directory:
|
|
29
|
+
|
|
30
|
+
- `dist/lib` – library build used by `@yartsun/hypershadow-widget`
|
|
31
|
+
- `dist/standalone` – standalone build (IIFE + ES module)
|
|
32
|
+
|
|
33
|
+
## Library usage (ESM / TypeScript)
|
|
34
|
+
|
|
35
|
+
Install the package:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm i @yartsun/hypershadow-widget
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Use the library entry (components/helpers from `dist/lib`), for example:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { /* your exports */ } from '@yartsun/hypershadow-widget';
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Standalone entry (ESM)
|
|
48
|
+
|
|
49
|
+
For embedding the widget into any host app (Nuxt, React, vanilla, etc.) you can use the
|
|
50
|
+
standalone entry that is now exported via package `exports`:
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
import { mount } from '@yartsun/hypershadow-widget/standalone';
|
|
54
|
+
|
|
55
|
+
mount({
|
|
56
|
+
target: '#chat-widget',
|
|
57
|
+
props: {
|
|
58
|
+
isEmbedded: true,
|
|
59
|
+
isPreview: true,
|
|
60
|
+
// link: 'wss://your-websocket-server.com/chat',
|
|
61
|
+
// configWidget: { ... }
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This entry is backed by:
|
|
67
|
+
|
|
68
|
+
- JS: `dist/standalone/hs-widget.es.js`
|
|
69
|
+
- Types: `types/standalone.d.ts`
|
|
70
|
+
|
|
71
|
+
### ESM usage examples
|
|
72
|
+
|
|
73
|
+
**Nuxt / Vue (client-only mount)**:
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
// Any client-only hook (e.g. onMounted in a component)
|
|
77
|
+
import { mount } from '@yartsun/hypershadow-widget/standalone';
|
|
78
|
+
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
mount({
|
|
81
|
+
target: '#chat-widget',
|
|
82
|
+
props: {
|
|
83
|
+
isEmbedded: true,
|
|
84
|
+
isPreview: true,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Plain ESM/TypeScript app**:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
import { mount } from '@yartsun/hypershadow-widget/standalone';
|
|
94
|
+
|
|
95
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
96
|
+
mount({
|
|
97
|
+
target: '#chat-widget',
|
|
98
|
+
props: {
|
|
99
|
+
link: 'wss://your-websocket-server.com/chat',
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
});
|
|
17
103
|
```
|
|
18
104
|
|
|
19
|
-
|
|
105
|
+
For `<script>`/IIFE-based usage and more advanced configuration examples,
|
|
106
|
+
see `STANDALONE.md`.
|
|
20
107
|
|
|
21
108
|
## Module Federation Usage
|
|
22
109
|
|
|
@@ -23,4 +23,4 @@ How can I help?`,widgetTitle:"HyperShadow",launchIssueTitle:"There was a glitch"
|
|
|
23
23
|
<path d="M4 4.02667C3.06667 5.08667 2.5 6.48 2.5 8C2.5 11.3133 5.18667 14 8.5 14C11.8133 14 14.5 11.3133 14.5 8C14.5 4.68667 11.8133 2 8.5 2C8.02667 2 7.56667 2.05333 7.12667 2.16" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
24
24
|
</svg>`,color:"#FFF",size:16}}},disableInputIssue:{warningStyle:"gradient",content:{bgColor:"#8A7045",color:"#fff",icon:{showIcon:!0,src:`<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
25
25
|
<path d="M4 4.02667C3.06667 5.08667 2.5 6.48 2.5 8C2.5 11.3133 5.18667 14 8.5 14C11.8133 14 14.5 11.3133 14.5 8C14.5 4.68667 11.8133 2 8.5 2C8.02667 2 7.56667 2.05333 7.12667 2.16" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
26
|
-
</svg>`,color:"#FFF"}}}},loader:{typingLoader:{color:"#8E8E8F",bgColor:"#2F2F31"},completeStep:{verticalSpacing:8,fontSize:12,color:"#8E8E8F",icon:{showIcon:!0,src:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M7.99967 14.6666C11.6816 14.6666 14.6663 11.6818 14.6663 7.99992C14.6663 4.31802 11.6816 1.33325 7.99967 1.33325C4.31778 1.33325 1.33301 4.31802 1.33301 7.99992C1.33301 11.6818 4.31778 14.6666 7.99967 14.6666Z" fill="currentColor"></path><path d="M7.05297 10.3867C6.91964 10.3867 6.79297 10.3334 6.69964 10.2401L4.81297 8.3534C4.61964 8.16007 4.61964 7.84007 4.81297 7.64673C5.0063 7.4534 5.3263 7.4534 5.51964 7.64673L7.05297 9.18007L10.4796 5.7534C10.673 5.56007 10.993 5.56007 11.1863 5.7534C11.3796 5.94673 11.3796 6.26673 11.1863 6.46006L7.4063 10.2401C7.31297 10.3334 7.1863 10.3867 7.05297 10.3867Z" fill="currentColor"></path></svg>',color:"#8E8E8F",size:16}},activeStep:{fontSize:12,color:"#FFF",icon:{showIcon:!0,src:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 4.02667C2.56667 5.08667 2 6.48 2 8C2 11.3133 4.68667 14 8 14C11.3133 14 14 11.3133 14 8C14 4.68667 11.3133 2 8 2C7.52667 2 7.06667 2.05333 6.62667 2.16" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>',color:"#fff",size:16}}},top:{params:{size:"md",bgColor:"#5E4AC6",bgStyle:"gradient",paddingVertical:8,paddingHorizontal:8,chipStyle:"filled",buttonStyle:"filled"},chipWidgetTitle:{color:"#fff",bgColor:"#5E4AC6",borderRadius:12,showType:"both"},buttons:{color:"#BBBBBD",bgColor:"#2F2F31",borderRadius:12,showType:"both"}},inside:{params:{size:"md",sidePadding:8,verticalPadding:8},welcomeMessage:{color:"#fff",bgType:"gradient",fontSize:14,size:"md",borderRadius:12,borderWidth:1,bgColor:"#595959"},messageUser:{color:"#F9F8F8",bgColor:"#F8F8F933",bgType:"bubble",borderRadius:12,fontSize:14,size:"md",borderWidth:1,borderColor:"#595959"},messageBot:{color:"#fff",bgColor:"#5E4AC6",bgType:"plain",borderRadius:12,fontSize:14,size:"md",borderWidth:1,borderColor:"#595959"},activeSnippet:{params:{buttonType:"both",buttonStyle:"filled",size:"md"},element:{color:"#fff",bgColor:"#373739",borderRadius:12,borderWidth:1,borderColor:"#595959",verticalSpacing:8,sidePadding:8,fontSize:12},headerChip:{color:"#fff",bgColor:"#69696A",borderRadius:12,size:"md",fontSize:12,bgType:"filled"},propertyColor:"rgba(255, 255, 255, 0.30)",valueColor:"#fff",yesButton:{color:"#fff",bgColor:"#12A150",borderRadius:12,fontSize:12},noButton:{color:"#fff",bgColor:"#C20E4D",borderRadius:12,fontSize:12}}},bottom:{params:{size:"md",disclaimerShow:!1},inputSend:{size:"md",color:"#EEECEC",bgColor:"#373739",borderColor:"#595959",borderWidth:1,inputStyle:"inside",bgType:"plain",paddingVertical:8,paddingHorizontal:8,sidePadding:8,fontSize:12,borderRadius:8},btnSend:{color:"#1E1E1E",bgColor:"rgba(255, 255, 255, 0.50)",showType:"both",borderWidth:1,borderColor:"#595959",borderRadius:50,size:"md",fontSize:12,icon:{showIcon:!0,src:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 2.56445C9.01973 2.56449 9.03453 2.57164 9.04395 2.58105L13.5967 7.13379C13.606 7.14324 13.6133 7.15811 13.6133 7.17773C13.6132 7.19738 13.606 7.21226 13.5967 7.22168L13.5898 7.22754L13.584 7.23438C13.5865 7.23164 13.5864 7.23284 13.5801 7.23535C13.5732 7.23801 13.5633 7.24018 13.5527 7.24023C13.5431 7.24023 13.5351 7.23862 13.5293 7.23633C13.524 7.23419 13.5171 7.22992 13.5088 7.22168L9 2.71289L4.49121 7.22168C4.48176 7.23107 4.46699 7.23828 4.44727 7.23828C4.42752 7.23826 4.41275 7.23109 4.40332 7.22168C4.3939 7.21226 4.38676 7.19747 4.38672 7.17773C4.38672 7.15801 4.39393 7.14324 4.40332 7.13379L8.95605 2.58105C8.9655 2.57167 8.98027 2.56445 9 2.56445Z" stroke="currentColor"/><path d="M9 2.68994C9.01306 2.68994 9.02868 2.69518 9.04297 2.70947C9.05726 2.72376 9.0625 2.73938 9.0625 2.75244V15.3745C9.0625 15.3875 9.0571 15.4032 9.04297 15.4175C9.02868 15.4318 9.01306 15.437 9 15.437C8.98694 15.437 8.97132 15.4318 8.95703 15.4175C8.9429 15.4032 8.9375 15.3875 8.9375 15.3745V2.75244C8.9375 2.73938 8.94274 2.72376 8.95703 2.70947C8.97132 2.69518 8.98694 2.68994 9 2.68994Z" fill="currentColor" stroke="currentColor"/></svg>',color:"#fff",size:18}},disclaimer:{color:"#fff",bgColor:"#FF0000",height:20,fontSize:12}}}};class Zt{canApply(e){return e.fromVersion===this.appliesTo.from&&e.toVersion===this.appliesTo.to}rollback(e){return{success:!1,errors:[`Rollback not implemented for strategy: ${this.name}`],warnings:[],modified:!1}}createSuccessResult(e,t=[]){return{success:!0,data:e,errors:[],warnings:t,modified:!0}}createErrorResult(e,t){return{success:!1,data:t,errors:e,warnings:[],modified:!1}}}class Rl extends Zt{constructor(){super(...arguments),this.name="AddSettingsFieldsV1toV2",this.description="Добавляет новые поля loader, buttonStyle, buttonType в settings",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[],i={...t.settings,loader:Pe.settings.loader};return s.push(`Добавлены поля loader: '${i.loader}'`),this.createSuccessResult({...t,settings:i},s)}catch(t){return this.createErrorResult([`Ошибка при добавлении полей settings: ${t}`])}}}class Ml extends Zt{constructor(){super(...arguments),this.name="AddChipStyleV1toV2",this.description="Добавляет поле chipStyle в sections.top.params",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.top.params={...t.sections.top.params,chipStyle:Pe.sections.top.params.chipStyle},s.push(`Добавлено поле chipStyle: '${Pe.sections.top.params.chipStyle}' в sections.top.params`),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении chipStyle: ${t}`])}}}class zl extends Zt{constructor(){super(...arguments),this.name="AddMessageBgTypeV1toV2",this.description="Добавляет поле bgType в messageUser и messageBot",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.inside.messageUser={...t.sections.inside.messageUser,bgType:Pe.sections.inside.messageUser.bgType},t.sections.inside.messageBot={...t.sections.inside.messageBot,bgType:Pe.sections.inside.messageBot.bgType},s.push("Добавлены поля bgType для messageUser и messageBot"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении bgType для сообщений: ${t}`])}}}class Bl extends Zt{constructor(){super(...arguments),this.name="AddActionButtonsV1toV2",this.description="Добавляет кнопки aprooveButton и rejectButton в inside секцию",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.inside={...t.sections.inside},s.push("Добавлены кнопки aprooveButton и rejectButton"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении кнопок действий: ${t}`])}}}class Pl extends Zt{constructor(){super(...arguments),this.name="EnhanceInputSendV1toV2",this.description="Добавляет borderStyle, inputStyle, bgType в inputSend",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.bottom.inputSend={...t.sections.bottom.inputSend,borderStyle:{borderColor:Pe.sections.bottom.inputSend.borderColor,borderWidth:Pe.sections.bottom.inputSend.borderWidth},inputStyle:Pe.sections.bottom.inputSend.inputStyle,bgType:Pe.sections.bottom.inputSend.bgType},s.push("Расширен inputSend с новыми полями borderStyle, inputStyle, bgType"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при расширении inputSend: ${t}`])}}}class El extends Zt{constructor(){super(...arguments),this.name="AddBottomElementsV1toV2",this.description="Добавляет warningAlert и disclaimer в bottom секцию",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.bottom={...t.sections.bottom},s.push("Добавлены warningAlert и disclaimer в bottom секцию"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении элементов bottom: ${t}`])}}}new Rl,new Ml,new zl,new Bl,new Pl,new El;const Le=o=>typeof o=="string"&&o.length>=0,On=o=>typeof o=="number"&&!Number.isNaN(o),es=(o,e)=>typeof o=="string"&&e.includes(o);function $l(o){const e=[];if(!o||typeof o!="object")return{isValid:!1,errors:["config: must be an object"]};const t=o.settings||{};On(t.letterSpacing)||t.letterSpacing===void 0||e.push("settings.letterSpacing: number"),Le(t.bgChat)||t.bgChat===void 0||e.push("settings.bgChat: string"),Le(t.fontFamily)||t.fontFamily===void 0||e.push("settings.fontFamily: string"),On(t.fontWeight)||t.fontWeight===void 0||e.push("settings.fontWeight: number"),t.logo===void 0||Le(t.logo)||e.push("settings.logo: string (svg or url)"),t.widgetTitle===void 0||Le(t.widgetTitle)||e.push("settings.widgetTitle: string"),t.position===void 0&&e.push("settings.position: undefined");const s=o.texts||{};s.launchIssueTitle===void 0||Le(s.launchIssueTitle)||e.push("texts.launchIssueTitle: string"),s.issueText===void 0||Le(s.issueText)||e.push("texts.issueText: string"),s.widgetTitle===void 0||Le(s.widgetTitle)||e.push("texts.widgetTitle: string"),s.hideText===void 0||Le(s.hideText)||e.push("texts.hideText: string");const i=o.sections?.top||{},n=i.params||{};n.size===void 0||es(n.size,["sm","md","lg"])||e.push("sections.top.params.size: sm|md|lg"),n.chipStyle===void 0||es(n.chipStyle,["filled","outlined","invisible"])||e.push("sections.top.params.chipStyle: filled|outlined|invisible"),n.buttonStyle===void 0||es(n.buttonStyle,["filled","outlined","invisible"])||e.push("sections.top.params.buttonStyle: filled|outlined|invisible"),n.buttonType===void 0||es(n.buttonType,["icon","text","both"])||e.push("sections.top.params.buttonType: icon|text|both"),i?.chipWidgetTitle?.color===void 0||Le(i?.chipWidgetTitle?.color)||e.push("sections.top.chipWidgetTitle.color: string"),i?.chipWidgetTitle?.bgColor===void 0||Le(i?.chipWidgetTitle?.bgColor)||e.push("sections.top.chipWidgetTitle.bgColor: string"),i?.btnClose===void 0||typeof i?.btnClose=="object"||e.push("sections.top.btnClose: object");const a=(o.sections?.bottom||{}).params||{};a.size===void 0||es(a.size,["sm","md","lg"])||e.push("sections.bottom.params.size: sm|md|lg");const l=o.sections?.warnings||{};return l.launchIssue===void 0||typeof l.launchIssue=="object"||e.push("sections.warnings.launchIssue: object"),l.connectionIssue===void 0||typeof l.connectionIssue=="object"||e.push("sections.warnings.connectionIssue: object"),{isValid:e.length===0,errors:e}}class Ll{config;constructor(e){this.config=e}getFlatRecursiveConfig(e,t="",s={}){for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const n=e[i],r=t?`${t}.${i}`:i;n!==null&&typeof n=="object"&&!Array.isArray(n)?this.getFlatRecursiveConfig(n,r,s):s[r]=n}return s}get configFlat(){return this.getFlatRecursiveConfig(this.config)}getConfig(){return this.config}getKey(e){return this.configFlat[e]??void 0}getKeyObject(e){return e.split(".").reduce((t,s)=>t&&t[s]!==void 0?t[s]:"undefined",this.config)}}const Vi={sm:"tw:h-[20px] tw:px-1.5 tw:py-0 tw:[font-size:10px] [&_svg]:tw:size-4",md:"tw:h-[24px] tw:px-2 tw:py-1 tw:text-xs [&_svg]:tw:size-4.5",lg:"tw:h-[28px] tw:px-3 tw:py-1 tw:text-sm [&_svg]:tw:size-5"};function Fi(o){return o==="sm"||o==="md"||o==="lg"?Vi[o]:Vi.md}function an(o,e){try{const s={top:"sections.top.params.size",inside:"sections.inside.params.size",bottom:"sections.bottom.params.size"}[e],i=o?.getKey(s);return Fi(i)}catch{return Vi.md}}const{defineComponent:Ol}=await z("vue"),{normalizeClass:ts,openBlock:We,createElementBlock:Ue,createCommentVNode:ft,toDisplayString:Kn,unref:ui,normalizeStyle:xs,withCtx:di,createVNode:fi,createElementVNode:An,withModifiers:In}=await z("vue"),Kl=["aria-expanded"],Al=["innerHTML"],Il=["src","alt"],Vl={key:2},Fl={key:0,class:"tw:flex tw:items-center tw:w-full tw:justify-end tw:gap-1.5 header-buttons"},Wl=["width","height"],Ul={key:1},Nl=["width","height"],Hl={key:1},{computed:pe}=await z("vue"),jl=Ol({__name:"ChatHeader",props:{isChatOpen:{type:Boolean},toggleChat:{type:Function},configDesignClass:{},sectionBorderRadius:{},mainBorderRadius:{},isPreview:{type:Boolean},isEmbedded:{type:Boolean},restartChat:{type:Function}},setup(o){const e=o,t=pe(()=>e.configDesignClass.getKeyObject("sections.top.params")),s=pe(()=>an(e.configDesignClass,"top")),i=pe(()=>{let d="";switch(t.value.bgStyle){case"gradient":d=`linear-gradient(180deg, ${t.value.bgColor} 0%, ${e.configDesignClass.getKey("settings.bgChat")} 100%)`;break;case"filled":d=t.value.bgColor;break;case"invisible":d="transparent";break;default:d="transparent";break}return{borderTopLeftRadius:`${e.mainBorderRadius}px`,borderTopRightRadius:`${e.mainBorderRadius}px`,background:d,padding:`${t.value.paddingVertical}px ${t.value.paddingHorizontal}px`}}),n=pe(()=>{const d=e.configDesignClass.getKey("texts.widgetTitle"),m=e.configDesignClass.getKey("settings.widgetTitle");return d&&d!=="undefined"?d:m&&m!=="undefined"?m:""}),r=pe(()=>e.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")),a=pe(()=>{const d=e.configDesignClass.getKey("sections.top.params.chipStyle"),m=e.configDesignClass.getKey("sections.top.chipWidgetTitle.color"),w=e.configDesignClass.getKey("sections.top.chipWidgetTitle.bgColor"),_=d==="outlined",y=d==="filled",S=d==="invisible";return{borderRadius:e.configDesignClass.getKey("settings.globalRoundingRadius")?e.sectionBorderRadius.borderRadius:e.configDesignClass.getKey("sections.top.chipWidgetTitle.borderRadius")+"px",color:m,border:_?`1px solid ${w}`:"none",padding:S?"0px":null,"background-color":y?w:"transparent"}}),l=pe(()=>e.configDesignClass.getKey("sections.top.buttons.showType")),c=pe(()=>{const d=e.configDesignClass.getKey("sections.top.buttons.showType");return d&&d!=="undefined"?d:"icon"}),u=pe(()=>{const d=e.configDesignClass.getKeyObject("sections.top.buttons");return{color:d?.color??"#fff",bgColor:d?.bgColor??"#000"}}),g=pe(()=>{const d=e.configDesignClass.getKey("sections.top.params.buttonStyle"),m=d==="outlined",w=d==="invisible",_=u.value;return{borderRadius:e.configDesignClass.getKey("settings.globalRoundingRadius")?e.sectionBorderRadius.borderRadius:e.configDesignClass.getKey("sections.top.buttons.borderRadius")+"px",color:_.color,border:m?`1px solid ${_.bgColor}`:"none",padding:w?"0px":null,"background-color":w?"transparent":d==="filled"?_.bgColor:"transparent"}}),h=pe(()=>{const d=e.configDesignClass.getKey("texts.hideText");return d&&d!=="undefined"?d:"Hide"}),p=pe(()=>e.configDesignClass.getKey("settings.logo").includes("<svg")),f=pe(()=>e.configDesignClass.getKey("settings.logo"));return(d,m)=>(We(),Ue("div",{onClick:m[0]||(m[0]=(...w)=>d.toggleChat&&d.toggleChat(...w)),class:"chat-action tw:cursor-pointer tw:flex tw:items-center tw:w-full tw:justify-start tw:overflow-hidden",style:xs(i.value),role:"button","aria-expanded":d.isChatOpen},[fi(ui(st),{class:ts(["tw:flex tw:items-center tw:shadow-none header-title",s.value]),variant:r.value,size:d.configDesignClass.getKey("sections.top.params.size"),style:xs(a.value),type:"button","aria-label":n.value,title:n.value},{default:di(()=>[p.value&&d.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")!=="text"?(We(),Ue("div",{key:0,class:ts(["header-logo",d.configDesignClass.getKey("sections.top.params.size")]),innerHTML:f.value},null,10,Al)):f.value&&d.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")!=="text"?(We(),Ue("img",{key:1,src:f.value,alt:d.configDesignClass.getKey("sections.top.iconWidget.alt"),class:ts(d.configDesignClass.getKey("sections.top.params.size")==="sm"?"tw:w-3 tw:h-3":"tw:w-4 tw:h-4")},null,10,Il)):ft("",!0),d.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")!=="icon"?(We(),Ue("span",Vl,Kn(n.value),1)):ft("",!0)]),_:1},8,["class","variant","size","style","aria-label","title"]),d.isChatOpen?(We(),Ue("div",Fl,[fi(ui(st),{variant:l.value,class:ts([s.value]),size:d.configDesignClass.getKey("sections.top.params.size"),style:xs(g.value),type:"button","aria-label":h.value,title:h.value,onClick:In(d.restartChat,["stop"])},{default:di(()=>[c.value!=="text"?(We(),Ue("svg",{key:0,width:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",height:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m[1]||(m[1]=[An("path",{d:"M10.7935 1.33333H5.20683C2.78016 1.33333 1.3335 2.77999 1.3335 5.20666V10.7867C1.3335 13.22 2.78016 14.6667 5.20683 14.6667H10.7868C13.2135 14.6667 14.6602 13.22 14.6602 10.7933V5.20666C14.6668 2.77999 13.2202 1.33333 10.7935 1.33333ZM8.00016 12.1667C6.80683 12.1667 5.8735 11.5733 5.24016 10.9867V11.46C5.24016 11.7333 5.0135 11.96 4.74016 11.96C4.46683 11.96 4.24016 11.7333 4.24016 11.46V9.62666C4.24016 9.35333 4.46683 9.12666 4.74016 9.12666H6.3935C6.66683 9.12666 6.8935 9.35333 6.8935 9.62666C6.8935 9.89999 6.66683 10.1267 6.3935 10.1267H5.7935C6.28683 10.62 7.0535 11.1667 8.00016 11.1667C9.74683 11.1667 11.1668 9.74666 11.1668 8C11.1668 7.72666 11.3935 7.5 11.6668 7.5C11.9402 7.5 12.1668 7.72666 12.1668 8C12.1668 10.3 10.3002 12.1667 8.00016 12.1667ZM12.1668 6.35999C12.1668 6.37999 12.1668 6.39999 12.1668 6.41333C12.1602 6.48666 12.1402 6.55333 12.1068 6.61333C12.0735 6.67333 12.0268 6.72666 11.9668 6.77333C11.9202 6.80666 11.8668 6.83333 11.8068 6.85333C11.7602 6.86666 11.7135 6.87333 11.6668 6.87333H10.0468C9.7735 6.87333 9.54683 6.64666 9.54683 6.37333C9.54683 6.1 9.7735 5.87333 10.0468 5.87333H10.6002C10.0668 5.38 9.20683 4.83333 8.0135 4.83333C6.26683 4.83333 4.84683 6.25333 4.84683 8C4.84683 8.27333 4.62016 8.5 4.34683 8.5C4.0735 8.5 3.8335 8.27333 3.8335 8C3.8335 5.7 5.70016 3.83333 8.00016 3.83333C9.4335 3.83333 10.4868 4.45333 11.1668 5.04666V4.53999C11.1668 4.26666 11.3935 4.03999 11.6668 4.03999C11.9402 4.03999 12.1668 4.26666 12.1668 4.53999V6.35999Z",fill:"currentColor"},null,-1)]),8,Wl)):ft("",!0),c.value!=="icon"?(We(),Ue("span",Ul," Restart ")):ft("",!0)]),_:1},8,["variant","class","size","style","aria-label","title","onClick"]),fi(ui(st),{variant:l.value,class:ts([s.value]),size:d.configDesignClass.getKey("sections.top.params.size"),style:xs(g.value),type:"button","aria-label":h.value,title:h.value,onClick:In(d.toggleChat,["stop"])},{default:di(()=>[c.value!=="text"?(We(),Ue("svg",{key:0,width:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",height:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m[2]||(m[2]=[An("path",{d:"M10.7935 1.33337H5.20683C2.78016 1.33337 1.3335 2.78004 1.3335 5.20671V10.7867C1.3335 13.22 2.78016 14.6667 5.20683 14.6667H10.7868C13.2135 14.6667 14.6602 13.22 14.6602 10.7934V5.20671C14.6668 2.78004 13.2202 1.33337 10.7935 1.33337ZM12.3335 10.9334C12.3335 11.9334 11.9335 12.3334 10.9335 12.3334H8.40016C7.40016 12.3334 7.00016 11.9334 7.00016 10.9334V9.73337C7.00016 8.73337 7.40016 8.33337 8.40016 8.33337H10.9335C11.9335 8.33337 12.3335 8.73337 12.3335 9.73337V10.9334Z",fill:"currentColor"},null,-1)]),8,Nl)):ft("",!0),c.value!=="icon"?(We(),Ue("span",Hl,Kn(h.value),1)):ft("",!0)]),_:1},8,["variant","class","size","style","aria-label","title","onClick"])])):ft("",!0)],12,Kl))}}),{shallowRef:Gu,watchEffect:Yu,readonly:Xu,watch:Qu,customRef:Ju,getCurrentScope:e1,onScopeDispose:t1,effectScope:s1,getCurrentInstance:i1,hasInjectionContext:n1,inject:r1,provide:o1,ref:a1,isRef:l1,unref:c1,toValue:u1,computed:d1,reactive:f1,toRefs:g1,toRef:h1,shallowReadonly:p1,onBeforeMount:m1,nextTick:_1,onBeforeUnmount:y1,onMounted:w1,onUnmounted:C1,isReactive:v1}=await z("vue");typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Zl=o=>typeof o<"u",{isRef:b1,shallowRef:S1,ref:ql,watchEffect:x1,computed:Gl,inject:T1,defineComponent:k1,h:D1,TransitionGroup:R1,Fragment:M1,shallowReactive:z1,toValue:B1,unref:P1,getCurrentInstance:Yl,onMounted:E1,watch:Vn,customRef:$1,onUpdated:L1,readonly:O1,reactive:K1,hasInjectionContext:A1,toRaw:I1,nextTick:Xl,markRaw:V1,getCurrentScope:F1,isReadonly:W1,onBeforeUpdate:U1}=await z("vue");function Ql(o){return JSON.parse(JSON.stringify(o))}function yo(o,e,t,s={}){var i,n,r;const{clone:a=!1,passive:l=!1,eventName:c,deep:u=!1,defaultValue:g,shouldEmit:h}=s,p=Yl(),f=t||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((r=(n=p?.proxy)==null?void 0:n.$emit)==null?void 0:r.bind(p?.proxy));let d=c;e||(e="modelValue"),d=d||`update:${e.toString()}`;const m=y=>a?typeof a=="function"?a(y):Ql(y):y,w=()=>Zl(o[e])?m(o[e]):g,_=y=>{h?h(y)&&f(d,y):f(d,y)};if(l){const y=w(),S=ql(y);let C=!1;return Vn(()=>o[e],T=>{C||(C=!0,S.value=m(T),Xl(()=>C=!1))}),Vn(S,T=>{!C&&(T!==o[e]||u)&&_(T)},{deep:u}),S}else return Gl({get(){return w()},set(y){_(y)}})}const{defineComponent:Jl}=await z("vue"),{unref:Fn,isRef:ec,vModelText:tc,normalizeClass:sc,withDirectives:ic,openBlock:nc,createElementBlock:rc}=await z("vue"),oc=Jl({__name:"Textarea",props:{class:{},defaultValue:{},modelValue:{}},emits:["update:modelValue"],setup(o,{emit:e}){const t=o,i=yo(t,"modelValue",e,{passive:!0,defaultValue:t.defaultValue});return(n,r)=>ic((nc(),rc("textarea",{"onUpdate:modelValue":r[0]||(r[0]=a=>ec(i)?i.value=a:null),style:{resize:"none"},"data-slot":"textarea",class:sc(Fn(fr)("tw:md:text-sm",t.class))},null,2)),[[tc,Fn(i)]])}}),{defineComponent:ac}=await z("vue"),{createElementVNode:me,openBlock:Ge,createElementBlock:gt,createTextVNode:Wn,unref:Pt,withModifiers:gi,normalizeStyle:Be,withCtx:hi,createVNode:Ts,createCommentVNode:Et,isRef:lc,withKeys:cc,normalizeClass:ks,createBlock:uc,toDisplayString:pi}=await z("vue"),dc={key:0,class:"tw:w-full"},fc={key:0,class:"svg-icon"},gc=["innerHTML"],hc={key:1},{computed:Ye}=await z("vue"),pc=ac({__name:"ChatBottom",props:{isProduction:{type:Boolean},configDesignClass:{},messageText:{},sendMessage:{type:Function},sectionBorderRadius:{},classSize:{},isInputDisabled:{type:Boolean},showReconnectNotice:{type:Boolean},restartChat:{type:Function},isStreaming:{type:Boolean}},emits:["update:messageText","trace"],setup(o,{emit:e}){const t=o,s=()=>{t.isStreaming||t.sendMessage()},n=yo(t,"messageText",e,{passive:!0}),r=Ye(()=>t.configDesignClass?.getKey("sections.bottom.inputSend.inputStyle")==="stacked"),a=Ye(()=>an(t.configDesignClass,"bottom")),l=Ye(()=>{const f=t.configDesignClass.getKey("texts.topWarningText");return f&&f!=="undefined"?f:""}),c=Ye(()=>{const f=t.configDesignClass.getKey("texts.disableInputText");return f&&f!=="undefined"?f:""}),u=Ye(()=>t.configDesignClass.getKey("sections.bottom.inputSend.size")),g=Ye(()=>t.isInputDisabled&&c.value?c.value:l.value||t.configDesignClass.getKey("texts.reconnectText")||"Reconnecting..."),h=Ye(()=>t.configDesignClass.getKey("sections.bottom.btnSend.icon.showIcon")?t.configDesignClass.getKey("sections.bottom.btnSend.icon.src"):null),p=Ye(()=>{const f=t.configDesignClass.getKey("texts.disclaimerText"),d=t.configDesignClass.getKey("texts.disclaimer"),m=f&&f!=="undefined"?f:d,_=!!t.configDesignClass.getKey("sections.bottom.params.disclaimerShow");return m&&m!=="undefined"&&_?m:""});return(f,d)=>(Ge(),gt("div",null,[f.isProduction?Et("",!0):(Ge(),gt("div",{key:0,class:"tw:flex tw:flex-row tw:gap-2",style:Be({padding:r.value?"0":"0 "+f.configDesignClass.getKey("sections.bottom.inputSend.sidePadding")+"px"})},[Ts(Pt(st),{type:"button",style:Be({backgroundColor:"#27272A",borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px"}),class:"tw:flex-shrink-1 tw:flex-grow-1","aria-label":"Copy last message",title:"Copy last message",onClick:d[0]||(d[0]=gi(m=>f.$emit("trace",{action:"copyLast"}),["stop"]))},{default:hi(()=>d[3]||(d[3]=[me("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[me("path",{opacity:"0.4",d:"M17.5 5.83464V14.168C17.5 16.668 16.25 18.3346 13.3333 18.3346H7.5C8.50833 17.5763 9.16667 16.3596 9.16667 15.0013C9.16667 12.7013 7.3 10.8346 5 10.8346C4.05833 10.8346 3.19167 11.143 2.5 11.668V5.83464C2.5 3.33464 3.75 1.66797 6.66667 1.66797H13.3333C16.25 1.66797 17.5 3.33464 17.5 5.83464Z",fill:"white"}),me("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.084 3.125C12.4292 3.125 12.709 3.40482 12.709 3.75V5.41667C12.709 5.98816 13.1792 6.45833 13.7507 6.45833H15.4173C15.7625 6.45833 16.0423 6.73816 16.0423 7.08333C16.0423 7.42851 15.7625 7.70833 15.4173 7.70833H13.7507C12.4888 7.70833 11.459 6.67851 11.459 5.41667V3.75C11.459 3.40482 11.7388 3.125 12.084 3.125Z",fill:"white"}),me("path",{d:"M5.00065 10.832C2.70065 10.832 0.833984 12.6987 0.833984 14.9987C0.833984 17.2987 2.70065 19.1654 5.00065 19.1654C7.30065 19.1654 9.16732 17.2987 9.16732 14.9987C9.16732 12.6987 7.30065 10.832 5.00065 10.832ZM4.30065 16.057C4.50899 16.2654 4.50899 16.607 4.30065 16.8237C4.19232 16.932 4.05899 16.982 3.91733 16.982C3.77566 16.982 3.64231 16.932 3.53398 16.8237L2.09233 15.382C1.88399 15.1737 1.88399 14.832 2.09233 14.6153L3.53398 13.1737C3.74231 12.9654 4.08399 12.9654 4.30065 13.1737C4.50899 13.382 4.50899 13.7237 4.30065 13.9403L3.24233 14.9987L4.30065 16.057ZM7.90066 15.382L6.45898 16.8237C6.35065 16.932 6.21733 16.982 6.07566 16.982C5.93399 16.982 5.80064 16.932 5.69231 16.8237C5.48397 16.6154 5.48397 16.2737 5.69231 16.057L6.75066 14.9987L5.69231 13.9403C5.48397 13.732 5.48397 13.3904 5.69231 13.1737C5.90064 12.9654 6.24232 12.9654 6.45898 13.1737L7.90066 14.6153C8.10899 14.832 8.10899 15.1654 7.90066 15.382Z",fill:"white"})],-1),Wn(" Log last function call ")])),_:1,__:[3]},8,["style"]),Ts(Pt(st),{type:"button",class:"tw:flex-shrink-1 tw:flex-grow-1",style:Be({backgroundColor:"#27272A",borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px"}),"aria-label":"Copy all",title:"Copy all",onClick:d[1]||(d[1]=gi(m=>f.$emit("trace",{action:"copyAll"}),["stop"]))},{default:hi(()=>d[4]||(d[4]=[me("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[me("path",{opacity:"0.4",d:"M17.5 5.83464V14.168C17.5 16.668 16.25 18.3346 13.3333 18.3346H6.66667C3.75 18.3346 2.5 16.668 2.5 14.168V5.83464C2.5 3.33464 3.75 1.66797 6.66667 1.66797H13.3333C16.25 1.66797 17.5 3.33464 17.5 5.83464Z",fill:"white"}),me("path",{d:"M15.4173 7.70833H13.7507C12.484 7.70833 11.459 6.68333 11.459 5.41667V3.75C11.459 3.40833 11.7423 3.125 12.084 3.125C12.4257 3.125 12.709 3.40833 12.709 3.75V5.41667C12.709 5.99167 13.1757 6.45833 13.7507 6.45833H15.4173C15.759 6.45833 16.0423 6.74167 16.0423 7.08333C16.0423 7.425 15.759 7.70833 15.4173 7.70833Z",fill:"white"}),me("path",{d:"M8.33255 14.7922C8.17422 14.7922 8.01589 14.7339 7.89089 14.6089L6.22422 12.9422C5.98255 12.7006 5.98255 12.3005 6.22422 12.0589L7.89089 10.3922C8.13255 10.1505 8.53255 10.1505 8.77422 10.3922C9.01588 10.6339 9.01588 11.0339 8.77422 11.2756L7.54922 12.5005L8.77422 13.7255C9.01588 13.9672 9.01588 14.3672 8.77422 14.6089C8.64922 14.7339 8.49088 14.7922 8.33255 14.7922Z",fill:"white"}),me("path",{d:"M11.6659 14.7922C11.5076 14.7922 11.3492 14.7339 11.2242 14.6089C10.9826 14.3672 10.9826 13.9672 11.2242 13.7255L12.4492 12.5005L11.2242 11.2756C10.9826 11.0339 10.9826 10.6339 11.2242 10.3922C11.4659 10.1505 11.8659 10.1505 12.1076 10.3922L13.7742 12.0589C14.0159 12.3005 14.0159 12.7006 13.7742 12.9422L12.1076 14.6089C11.9826 14.7339 11.8242 14.7922 11.6659 14.7922Z",fill:"white"})],-1),Wn(" Log all function calls ")])),_:1,__:[4]},8,["style"])],4)),me("div",{class:"tw:flex tw:flex-col tw:items-center tw:relative tw:mt-2",style:Be({padding:r.value?"0":"0 "+f.configDesignClass.getKey("sections.bottom.inputSend.sidePadding")+"px"})},[f.showReconnectNotice||l.value||f.isInputDisabled?(Ge(),gt("div",dc,[Ts(xi,{class:"tw:rounded-b-none tw:mx-0 tw:flex tw:justify-center tw:item s-center tw:px-2 tw:py-2",type:"reconnecting",configDesignClass:f.configDesignClass,headlineText:g.value,restartChat:f.restartChat,warningElement:f.isInputDisabled?f.configDesignClass.getKeyObject("sections.warnings.disableInputIssue"):f.configDesignClass.getKeyObject("sections.warnings.reconnectIssue")},null,8,["configDesignClass","headlineText","restartChat","warningElement"])])):Et("",!0),me("div",{class:ks(["message-input tw:flex-1 tw:w-full tw:p-0 tw:gap-[10px] tw:flex",[f.classSize,r.value?"tw:flex-col tw:items-stretch tw:justify-between":" tw:items-end",u.value==="sm"?"tw:items-center":""]]),style:Be({...r.value?{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}:{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px"},"background-color":f.configDesignClass.getKey("sections.bottom.inputSend.bgColor"),"margin-bottom":r.value?"0px":f.configDesignClass.getKey("sections.bottom.inputSend.sidePadding")+"px",border:r.value?"none":`${f.configDesignClass.getKey("sections.bottom.inputSend.borderWidth")}px solid ${f.configDesignClass.getKey("sections.bottom.inputSend.borderColor")}`})},[(Ge(),uc(Pt(oc),{placeholder:f.configDesignClass.getKey("texts.inputPlaceholder")||"Type question",rows:u.value==="sm"?1:u.value==="md"?2:3,key:f.configDesignClass.getKey("sections.bottom.inputSend.color"),modelValue:Pt(n),"onUpdate:modelValue":d[2]||(d[2]=m=>lc(n)?n.value=m:null),onKeyup:cc(gi(s,["exact"]),["enter"]),class:ks(["tw:w-full tw:outline-none tw:border-0 focus:tw:outline-none",r.value?"tw:h-auto rounded-none":"h-full"]),style:Be({color:f.configDesignClass.getKey("sections.bottom.inputSend.color"),fontSize:f.configDesignClass.getKey("sections.bottom.inputSend.fontSize")+"px",lineHeight:f.configDesignClass.getKey("settings.lineHeight"),padding:f.configDesignClass.getKey("sections.bottom.inputSend.paddingVertical")+"px "+f.configDesignClass.getKey("sections.bottom.inputSend.paddingHorizontal")+"px",height:f.configDesignClass.getKey("sections.bottom.inputSend.height")+"px"})},null,8,["placeholder","rows","modelValue","onKeyup","class","style"])),me("div",{class:ks(r.value?"tw:flex tw:flex-row-reverse tw:justify-between tw:items-center tw:gap-2 tw:pl-3":"tw:flex tw:ml-auto"),style:Be({marginBottom:f.configDesignClass.getKey("sections.bottom.inputSend.paddingVertical")+"px",marginRight:f.configDesignClass.getKey("sections.bottom.inputSend.paddingHorizontal")+"px"})},[Ts(Pt(st),{size:f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="icon"?"icon":f.configDesignClass.getKey("sections.bottom.params.size"),class:ks(["btn-send tw:bg-transparent tw:shadow-none tw:flex-shrink-0 tw:items-center tw:gap-1",f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="icon"?"tw:rounded-full":a.value,r.value?"tw:self-end":"tw:ml-auto",{"tw:opacity-50":Pt(n).trim()===""||f.isInputDisabled},{"tw:px-3 tw:py-2":f.configDesignClass.getKey("sections.bottom.btnSend.size")==="md"},{"tw:px-2 tw:py-1":f.configDesignClass.getKey("sections.bottom.btnSend.size")==="sm"},{"tw:px-4 tw:py-3":f.configDesignClass.getKey("sections.bottom.btnSend.size")==="lg"}]),onClick:s,style:Be({...f.configDesignClass.getKey("sections.bottom.btnSend.type")==="icon"?{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.btnSend.borderRadius")+"px"}:{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.btnSend.borderRadius")+"px"},color:f.configDesignClass.getKey("sections.bottom.btnSend.color"),"background-color":f.configDesignClass.getKey("sections.bottom.btnSend.bgColor"),fontSize:f.configDesignClass.getKey("sections.bottom.btnSend.fontSize")+"px",border:f.configDesignClass.getKey("sections.bottom.btnSend.borderWidth")+"px solid "+f.configDesignClass.getKey("sections.bottom.btnSend.borderColor")}),disabled:f.isInputDisabled},{default:hi(()=>[h.value?(Ge(),gt("div",fc,[me("div",{innerHTML:h.value,style:Be({color:f.configDesignClass.getKey("sections.bottom.btnSend.color"),width:f.configDesignClass.getKey("sections.bottom.btnSend.icon.size")+"px",height:f.configDesignClass.getKey("sections.bottom.btnSend.icon.size")+"px"})},null,12,gc)])):Et("",!0),f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="text"||f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="both"?(Ge(),gt("span",hc,pi(f.configDesignClass.getKey("texts.sendButton")),1)):Et("",!0)]),_:1},8,["size","class","style","disabled"]),r.value&&p.value?(Ge(),gt("div",{key:0,class:"tw:text-[11px] tw:text-white/50 tw:flex tw:items-center",style:Be({...f.sectionBorderRadius,fontSize:f.configDesignClass.getKey("sections.bottom.disclaimer.fontSize")+"px",height:f.configDesignClass.getKey("sections.bottom.disclaimer.height")+"px",color:f.configDesignClass.getKey("sections.bottom.disclaimer.color")})},pi(p.value),5)):Et("",!0)],6)],6),!r.value&&p.value?(Ge(),gt("div",{key:1,class:"tw:px-2 tw:text-white/50 tw:mb-2 tw:flex tw:items-center tw:justify-center",style:Be({...f.sectionBorderRadius,fontSize:f.configDesignClass.getKey("sections.bottom.disclaimer.fontSize")+"px",height:f.configDesignClass.getKey("sections.bottom.disclaimer.height")+"px",color:f.configDesignClass.getKey("sections.bottom.disclaimer.color")})},pi(p.value),5)):Et("",!0)],4)]))}});var U=(o=>(o.Collapsed="collapsed",o.EmptyChat="empty",o.Messages="messages",o.ActionSnippet="action_snippet",o.LaunchIssue="launch_issue",o.ConnectionIssue="connection_issue",o.ReconnectingAttempt="reconnecting_attempt",o.InputBlocked="input_blocked",o.ActionLoader="action_loader",o.TracesMessage="traces_message",o.TracesWithMeta="traces_with_meta",o))(U||{}),wo=(o=>(o.UserMessage="Give me some action",o))(wo||{});class Ee{base(e){return{isChatOpen:!0,isChatActive:!0,messages:[],isConnectionError:!1,isProcessError:!1,isReconnectError:!1,isInputDisabled:!1,showWelcome:!1,blockSocket:!0,traceLastShown:!1,...e}}}class mc extends Ee{type=U.Collapsed;getState(){return this.base({isChatOpen:!1})}}class Un extends Ee{type=U.EmptyChat;getState(){return this.base({showWelcome:!0,messages:[]})}}class _c extends Ee{type=U.Messages;getState(e,t){const s=t?.userMessageText??"Give me some action",i=t?.botMessageText??"What sort of action do you want?";return this.base({showWelcome:!0,messages:[{text:s,isUser:!0},{text:i,isUser:!1},{text:"Sort of action",isUser:!0}]})}}class yc extends Ee{type=U.ActionSnippet;getState(e,t){const s=t?.userMessageText??"Give me some action";return this.base({showWelcome:!1,messages:[{text:s,isUser:!0},{snippet:{sequence:"38952101547613990",id:"38496103561174822",data:{actionCancel:{text:"Cancel"},actionConfirm:{text:"Confirm"},title:{text:"Do you really want to get the available contacts list?"}}},isUser:!1}]})}}class wc extends Ee{type=U.LaunchIssue;getState(){return this.base({isConnectionError:!0})}}class Cc extends Ee{type=U.ConnectionIssue;getState(e,t){const s=t?.userMessageText??"Give me some action",i=!0,n=t?.traceSteps??["Step One","Step Two","Step three"];return this.base({isProcessError:!0,showWelcome:i,messages:[{text:s,isUser:!0},{text:n[0],isUser:!1,isSystem:!0,type:"trace"},{text:n[1],isUser:!1,isSystem:!0,type:"trace"},{text:n[2],isUser:!1,isSystem:!0,type:"trace"}]})}}class vc extends Ee{type=U.ReconnectingAttempt;getState(e,t){const s=t?.userMessageText??"Give me some action",i=!0,n=t?.traceSteps??["Step One","Step Two","Step three"];return this.base({isReconnectError:!0,showReconnectNotice:!0,showWelcome:i,messages:[{text:s,isUser:!0},{text:n[0],isUser:!1,isSystem:!0,type:"trace"},{text:n[1],isUser:!1,isSystem:!0,type:"trace"},{text:n[2],isUser:!1,isSystem:!0,type:"trace"}]})}}class bc extends Ee{type=U.InputBlocked;getState(e,t){const s=t?.userMessageText??"Give me some action",i=!0,n=t?.traceSteps??["Step One","Step Two","Step three"];return this.base({isReconnectError:!0,showReconnectNotice:!0,isInputDisabled:!0,showWelcome:i,messages:[{text:s,isUser:!0},{text:n[0],isUser:!1,isSystem:!0,type:"trace"},{text:n[1],isUser:!1,isSystem:!0,type:"trace"},{text:n[2],isUser:!1,isSystem:!0,type:"trace"}]})}}class Sc extends Ee{type=U.ActionLoader;getState(e,t){const s=t?.userMessageText??"Give me some action";return this.base({showWelcome:!0,messages:[{text:s,isUser:!0}]})}}class xc extends Ee{type=U.TracesMessage;getState(e,t){const s=t?.userMessageText??"Give me some action",i=t?.traceSteps??["Step One","Step Two","Step three"],n=[{text:s,isUser:!0},{text:i[0],isUser:!1,isSystem:!0,type:"trace"},{text:i[1],isUser:!1,isSystem:!0,type:"trace"},{text:i[2],isUser:!1,isSystem:!0,type:"trace"}];return this.base({showWelcome:!0,messages:n})}}class Tc extends Ee{type=U.TracesWithMeta;getState(e,t){const s=t?.userMessageText??"Give me some action",i=t?.traceSteps??["Step One","API Schema Requested","API Call Conducted","API Call Conducted"],n=[{text:s,isUser:!0},{text:i[0],isUser:!1,isSystem:!0,type:"trace",meta:{step:1}},{text:i[1],isUser:!1,isSystem:!0,type:"trace",meta:{step:2,json:{status:"requested",endpoint:"/v1/schema"}}},{text:i[2],isUser:!1,isSystem:!0,type:"trace",meta:{step:3,json:{status:"ok",code:200}}},{text:i[3],isUser:!1,isSystem:!0,type:"trace"}];return this.base({showWelcome:!0,messages:n})}}class kc{static create(e){switch(e){case U.Collapsed:case"collapsed":return new mc;case U.EmptyChat:case"empty":return new Un;case U.Messages:case"messages":return new _c;case U.ActionSnippet:case"action_snippet":return new yc;case U.LaunchIssue:case"launch_issue":return new wc;case U.ConnectionIssue:case"connection_issue":return new Cc;case U.ReconnectingAttempt:case"reconnecting_attempt":return new vc;case U.InputBlocked:case"input_blocked":return new bc;case U.ActionLoader:case"action_loader":return new Sc;case U.TracesMessage:case"traces_message":return new xc;case U.TracesWithMeta:case"traces_with_meta":return new Tc;default:return new Un}}}class Nn{static getScenarioFromUrl(){try{return new URLSearchParams(window.location.search).get("scenario")??void 0}catch{return}}static getState(e,t,s){return{...kc.create(e).getState(t,s),...s??{}}}}const{defineComponent:Dc}=await z("vue"),{toDisplayString:Rc,createElementVNode:Mc,normalizeClass:zc,normalizeStyle:Bc,openBlock:Pc,createElementBlock:Ec}=await z("vue"),$c={key:"message",class:"message-text"},{computed:Lc}=await z("vue"),Oc=Dc({__name:"MessageBot",props:{message:{},welcomeColor:{},color:{},bgColor:{},size:{},bgType:{},fontSize:{},borderWidth:{},borderColor:{},configDesignClass:{}},setup(o){const e=o,t=Lc(()=>{switch(e.size){case"sm":return e.bgType==="bubble"?" tw:min-h-[25px] tw:py-1 tw:px-2 ":"";case"md":return e.bgType==="bubble"?" tw:min-h-[33px] tw:py-2 tw:px-3":"";case"lg":return e.bgType==="bubble"?" tw:min-h-[40px] tw:py-3 tw:px-4":""}});return(s,i)=>(Pc(),Ec("li",{class:zc(["message-item tw:text-white tw:w-fit tw:whitespace-break-spaces tw:transition-colors tw:duration-[250ms] tw:ease-[ease]",[t.value,{"item-primary":!s.message.chunk?.start}]]),style:Bc({color:s.message.chunk?.start?"#2F2F31":s.color,"background-color":s.message.chunk?.start?"transparent":s.bgType==="bubble"?s.bgColor:"transparent","font-size":s.fontSize+"px",border:s.bgType==="bubble"?s.borderWidth+"px solid "+s.borderColor:"none"})},[Mc("div",$c,Rc(s.message.text),1)],6))}}),Co=(o,e)=>{const t=o.__vccOpts||o;for(const[s,i]of e)t[s]=i;return t},Kc=Co(Oc,[["__scopeId","data-v-53770389"]]),{defineComponent:Ac}=await z("vue"),{toDisplayString:Ic,normalizeClass:Vc,normalizeStyle:Fc,openBlock:Wc,createElementBlock:Uc}=await z("vue"),{computed:Hn}=await z("vue"),Nc=Ac({__name:"MessageUser",props:{message:{},isFirst:{type:Boolean},color:{},bgColor:{},borderWidth:{},borderColor:{},fontSize:{},size:{},bgType:{},configDesignClass:{}},setup(o){const e=o,t=Hn(()=>{switch(e.size){case"sm":return e.bgType==="bubble"?" tw:min-h-[25px] tw:py-1 tw:px-2 ":"";case"md":return e.bgType==="bubble"?" tw:min-h-[33px] tw:py-2 tw:px-3":"";case"lg":return e.bgType==="bubble"?" tw:min-h-[40px] tw:py-3 tw:px-4":""}}),s=Hn(()=>e.bgType==="bubble"?e.borderWidth+"px solid "+e.borderColor:"none");return(i,n)=>(Wc(),Uc("li",{class:Vc(["message-item tw:w-fit tw:whitespace-break-spaces item-secondary tw:ml-auto",[t.value,{"tw:mt-[5px] !tw:bg-transparent":i.isFirst}]]),style:Fc({color:i.color,"background-color":i.bgType==="bubble"?i.bgColor:"transparent",border:s.value,"font-size":i.fontSize+"px"})},Ic(i.message.text),7))}}),{defineComponent:Hc}=await z("vue"),{normalizeStyle:jn,openBlock:ht,createElementBlock:pt,createCommentVNode:jc,createElementVNode:ke,Transition:Zn,withCtx:qn,createVNode:Gn,toDisplayString:Zc,normalizeClass:qc}=await z("vue"),Gc=["innerHTML"],Yc={key:"dots",class:"tw:flex tw:items-center tw:justify-start tw:gap-1 tw:h-4"},Xc={key:"dots-pulse",class:"tw:flex tw:items-center tw:justify-start tw:gap-1 tw:h-4"},Qc={key:"circle-pulse",class:"circle-pulse"},Jc={key:"circle-pulse-1",class:"circle-pulse-1"},eu=["data-text"],{ref:Yn,computed:tu,onMounted:su,onBeforeUnmount:iu,watch:nu,nextTick:Xn}=await z("vue"),ru=Hc({__name:"LoadingMessage",props:{loader:{},text:{},message:{},configDesignClass:{},paused:{type:Boolean}},setup(o){const e=o,t=Yn(null),s=Yn(!1);let i=null;const n=()=>{const a=t.value;if(!a)return;const l=a.closest("li");if(!l)return;const c=l.nextElementSibling;if(!c){s.value=!1;return}const u=c.getAttribute("data-component")==="MessageBot"||typeof c.matches=="function"&&c.matches('[data-component="MessageBot"]')||!!c.querySelector('[data-component="MessageBot"]');s.value=u};su(()=>{Xn(n);const l=t.value?.closest("ul");l&&(i=new MutationObserver(()=>n()),i.observe(l,{childList:!0,subtree:!0}))}),iu(()=>{i&&i.disconnect()}),nu(()=>e.text,()=>Xn(n));const r=tu(()=>!!e.paused||s.value);return(a,l)=>(ht(),pt("li",{key:"loading",ref_key:"rootRef",ref:t,class:"message-text-loading tw:flex tw:items-center tw:justify-start tw:gap-3"},[Gn(Zn,{name:"fade",mode:"out-in"},{default:qn(()=>[r.value?(ht(),pt("div",{key:"complete-step-icon",innerHTML:a.configDesignClass.getKey("sections.loader.completeStep.icon.src"),class:"svg-inherit",style:jn({color:a.configDesignClass.getKey("sections.loader.completeStep.icon.color"),height:a.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px",width:a.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px"})},null,12,Gc)):!a.loader||a.loader==="dots"?(ht(),pt("div",Yc,l[0]||(l[0]=[ke("div",{class:"loading-dot tw:rounded-full"},null,-1),ke("div",{class:"loading-dot loading-dot-delay-1 tw:rounded-full"},null,-1),ke("div",{class:"loading-dot loading-dot-delay-2 tw:rounded-full"},null,-1),ke("div",{class:"loading-dot loading-dot-delay-3 tw:rounded-full"},null,-1)]))):a.loader==="dots-pulse"?(ht(),pt("div",Xc,l[1]||(l[1]=[ke("span",{class:"dot-pulse dot-1"},null,-1),ke("span",{class:"dot-pulse dot-2"},null,-1),ke("span",{class:"dot-pulse dot-3"},null,-1)]))):a.loader==="circle-pulse"?(ht(),pt("div",Qc,l[2]||(l[2]=[ke("span",{class:"ring ring-1"},null,-1),ke("span",{class:"ring ring-2"},null,-1)]))):a.loader==="circle-pulse-1"?(ht(),pt("div",Jc,l[3]||(l[3]=[ke("span",{class:"ripple r1"},null,-1),ke("span",{class:"ripple r2"},null,-1),ke("span",{class:"center"},null,-1)]))):jc("",!0)]),_:1}),Gn(Zn,{name:"fade-text",mode:"out-in"},{default:qn(()=>[(ht(),pt("span",{class:qc(["tw:text-sm",{"typing-shimmer":!r.value}]),key:a.text,"data-text":a.message?.text?a.message?.text:a.text,style:jn({color:a.configDesignClass.getKey("sections.loader.typingLoader.color")})},Zc(r.value?"Thinking completed":a.message?.text?a.message?.text:a.text),15,eu))]),_:1})],512))}}),Qn=Co(ru,[["__scopeId","data-v-98cb9df4"]]),{defineComponent:ou}=await z("vue"),{normalizeStyle:ss,createElementVNode:Xe,normalizeClass:Ds,toDisplayString:Jn,openBlock:mi,createElementBlock:er,createCommentVNode:tr,unref:au,withCtx:lu,createBlock:cu}=await z("vue"),uu=["data-height"],du={class:"tw:flex tw:flex-col tw:items-center tw:gap-1 tw:px-1"},fu=["innerHTML"],gu={class:"tw:flex tw:items-center tw:gap-2"},{computed:Qe}=await z("vue"),hu=ou({__name:"MessageSystem",props:{message:{},welcomeColor:{},color:{},bgColor:{},size:{},configDesignClass:{},activeMessage:{type:Boolean},bgType:{},isLast:{type:Boolean},traceLastShown:{type:Boolean},index:{}},setup(o){const e=o,t=Qe(()=>e.index===3&&e.traceLastShown||e.isLast),s=Qe(()=>{switch(e.size){case"sm":return"tw:text-xs";case"md":return"tw:text-xs";case"lg":return"tw:text-base"}}),i=Qe(()=>t.value?e.configDesignClass.getKey("sections.loader.activeStep.icon.src"):e.configDesignClass.getKey("sections.loader.completeStep.icon.src")),n=Qe(()=>e.configDesignClass.getKey("sections.loader.activeStep.color")),r=Qe(()=>e.configDesignClass.getKey("sections.loader.completeStep.color")),a=Qe(()=>t.value?n.value:r.value),l=Qe(()=>t.value?e.configDesignClass.getKey("sections.loader.activeStep.icon.color"):e.configDesignClass.getKey("sections.loader.completeStep.icon.color")),c=Qe(()=>an(e.configDesignClass,"inside"));return(u,g)=>(mi(),er("li",{class:Ds(["message-system tw:text-left tw:relative tw:w-full tw:text-white tw:w-fit tw:whitespace-break-spaces tw:transition-colors tw:duration-[250ms] tw:ease-[ease]",s.value]),"data-height":u.configDesignClass.getKey("sections.loader.completeStep.verticalSpacing"),style:ss({"padding-top":u.configDesignClass.getKey("sections.loader.completeStep.verticalSpacing")+"px"})},[Xe("hr",{class:"tw:w-[1px] tw:bg-white tw:opacity-20 tw:absolute",style:ss([{display:"none"},{height:u.configDesignClass.getKey("sections.loader.completeStep.verticalSpacing")-2+"px",left:u.configDesignClass.getKey("sections.loader.completeStep.icon.size")/2+4+"px",top:"0px"}])},null,4),Xe("div",{key:"message",class:Ds(["message-text flex tw:space-between tw:gap-3 tw:flex tw:items-center tw:align-center",{"tw:mb-0":u.isLast}])},[Xe("div",du,[Xe("div",{innerHTML:i.value,class:Ds(["svg-inherit",{"tw:animate-spin":t.value}]),style:ss({color:l.value,height:u.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px",width:u.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px"})},null,14,fu)]),Xe("div",gu,[u.message.meta?tr("",!0):(mi(),er("p",{key:0,style:ss({color:a.value,"font-size":u.configDesignClass.getKey("sections.loader.completeStep.fontSize")+"px"})},Jn(u.message.text),5)),u.message.meta?(mi(),cu(au(st),{key:1,style:ss({color:e.activeMessage?"rgba(255, 255, 255, 0.60)":"#3F3F46",background:e.activeMessage?"#2F2F31":"#ECEDEE",border:e.activeMessage?"none":"1px solid #fff"}),class:Ds(["tw:flex tw:items-center tw:gap-1 tw:rounded-md tw:shadow-xs",c.value])},{default:lu(()=>[g[0]||(g[0]=Xe("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Xe("path",{d:"M10.7935 1.33301H5.20683C2.78016 1.33301 1.3335 2.77967 1.3335 5.20634V10.7863C1.3335 13.2197 2.78016 14.6663 5.20683 14.6663H10.7868C13.2135 14.6663 14.6602 13.2197 14.6602 10.793V5.20634C14.6668 2.77967 13.2202 1.33301 10.7935 1.33301ZM6.62683 8.84634C6.1735 9.52634 5.54683 10.0797 4.8135 10.4463C4.74683 10.4797 4.66683 10.4997 4.5935 10.4997C4.40683 10.4997 4.2335 10.3997 4.14683 10.2263C4.02016 9.97967 4.12016 9.67967 4.3735 9.55301C4.9535 9.26634 5.44683 8.82634 5.80016 8.29301C5.92016 8.11301 5.92016 7.88634 5.80016 7.70634C5.44016 7.17301 4.94683 6.73301 4.3735 6.44634C4.12016 6.32634 4.02016 6.02634 4.14683 5.77301C4.26683 5.52634 4.56683 5.42634 4.8135 5.55301C5.54683 5.91967 6.1735 6.47301 6.62683 7.15301C6.9735 7.66634 6.9735 8.33301 6.62683 8.84634ZM11.3335 10.4997H8.66683C8.3935 10.4997 8.16683 10.273 8.16683 9.99967C8.16683 9.72634 8.3935 9.49967 8.66683 9.49967H11.3335C11.6068 9.49967 11.8335 9.72634 11.8335 9.99967C11.8335 10.273 11.6068 10.4997 11.3335 10.4997Z",fill:"currentColor"})],-1)),Xe("span",null,Jn(u.message.text),1)]),_:1,__:[0]},8,["style","class"])):tr("",!0)])],2)],14,uu))}});class pu{structure;options;html="";constructor(e,t){this.structure=e,this.options={escape:t?.escape??!0,whitelistStyles:t?.whitelistStyles??["color","background","borderColor","borderRadius"]}}build(e){return this.html=this.renderLayout(this.structure.layout,this.structure.bindings||{},e),this}buildStyle(e){return Object.entries(e).forEach(([t,s])=>{const i=new RegExp(`data-visual="${this.escapeRegExp(t)}"`,"g"),n=Object.entries(s.style).map(([r,a])=>`${r}: ${a};`).join("");this.html=this.html.replace(i,`class="${s.class}" style="${n}"`)}),this}result(){return this.html}renderLayout(e,t,s){let i=e;return t&&(Object.entries(t).forEach(([n,r])=>{const a=new RegExp(`\\{${this.escapeRegExp(n)}\\}`,"g");if(r.type==="text"){const l=s?.[n]?.text;i=i.replace(a,this.safeText(typeof l=="string"||typeof l=="number"?String(l):""));return}if(r.type==="button"){const l=s?.[n]?.text;i=i.replace(a,this.safeText(typeof l=="string"||typeof l=="number"?String(l):""));return}if(r.type==="repeater"){const l=Array.isArray(s?.[n])?s[n]:[],c=r.layout||"",u=r.bindings||{},g=l.map(h=>this.renderLayout(c,u,h)).join("");i=i.replace(a,g);return}}),i=i.replace(/style=\"([^\"]*)\"/g,(n,r)=>{const a=r.split(";").map(l=>l.trim()).filter(Boolean).filter(l=>{const[c]=l.split(":");return this.options.whitelistStyles.includes((c||"").trim())}).join("; ");return`style="${this.safeAttr(a)}"`})),i}safeText(e){return this.options.escape?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\"/g,""").replace(/'/g,"'"):e}safeAttr(e){return this.safeText(e)}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}const mu={layout:'<div class="tw:flex tw:flex-col" data-visual="container"><div><span data-visual="headerChip">Action</span></div><div class="tw:flex tw:mb-2 tw:mt-2 tw:text-xs"><div data-visual="title">{title}</div></div><div class="tw:flex tw:gap-1"><button data-cb="confirm" data-visual="actionConfirm" class="tw:flex-1">{actionConfirm}</button><button data-cb="cancel" data-visual="actionCancel" class="tw:flex-1">{actionCancel}</button></div></div>',bindings:{title:{type:"text"},actionConfirm:{type:"button"},actionCancel:{type:"button"}}},{computed:ie}=await z("vue");function _u(o){const e=ie(()=>{const y=o?.getKeyObject("sections.inside.activeSnippet"),S=o?.getKeyObject("sections.activeSnippet"),C=y&&y!=="undefined"?y:S;return C&&C!=="undefined"?C:{}}),t=(y,S)=>{if(!S)return y;switch(S){case"outlined":return{color:y.background,background:"transparent",border:`1px solid ${y.borderColor||y.background}`};case"invisible":return{color:y.background,background:"transparent"};default:return y}},s=ie(()=>o?.getKey("sections.inside.activeSnippet.element.bgColor")),i=ie(()=>o?.getKey("sections.inside.activeSnippet.element.color")),n=ie(()=>o?.getKey("sections.inside.activeSnippet.element.sidePadding")),r=ie(()=>o?.getKey("sections.inside.activeSnippet.element.verticalSpacing")),a=ie(()=>o?.getKey("sections.inside.activeSnippet.element.borderWidth")+"px solid "+o?.getKey("sections.inside.activeSnippet.element.borderColor")),l=ie(()=>({color:e.value?.headerChip?.color,background:e.value?.headerChip?.bgColor,borderColor:e.value?.headerChip?.borderColor,bgColor:e.value?.headerChip?.bgColor})),c=ie(()=>t(l.value,e.value?.headerChip?.bgType)),u=ie(()=>({...c.value,"border-radius":o?.getKey("settings.globalRoundingRadius")?us(o,2).borderRadius:e.value?.headerChip?.borderRadius+"px","font-size":e.value?.headerChip?.fontSize+"px"})),g=ie(()=>e.value?.propertyColor),h=ie(()=>e.value?.valueColor),p=ie(()=>({color:e.value?.yesButton?.color,background:e.value?.yesButton?.bgColor})),f=ie(()=>({color:e.value?.noButton?.color,background:e.value?.noButton?.bgColor})),d=ie(()=>{const y=o?.getKey("sections.inside.activeSnippet.params.size"),S=o?.getKey("sections.inside.params.size");return Fi(y!=="undefined"?y:S)}),m=ie(()=>{const y=o?.getKey("sections.inside.activeSnippet.headerChip.size");return Fi(y)}),w=y=>{const S=(y.id||"").toLowerCase(),T=S==="confirm"||S==="yes"?p.value:f.value,k=o?.getKey("sections.inside.activeSnippet.params.buttonStyle");return t(T,k)},_=ie(()=>o?.getKey("settings.globalRoundingRadius")?us(o,8):{borderRadius:o?.getKey("sections.inside.activeSnippet.element.borderRadius")+"px"});return{containerBg:s,containerColor:i,sidePadding:n,verticalSpacing:r,headerChip:u,propertyColor:g,border:a,valueColor:h,yesButton:p,noButton:f,buttonStyle:w,getButtonStyle:t,actionBtnSizeClass:d,buttonRadiusStyle:_,chipSizeClass:m}}const{defineComponent:yu}=await z("vue"),{openBlock:wu,createElementBlock:Cu}=await z("vue"),vu=["innerHTML"],{computed:Rs}=await z("vue"),bu=yu({__name:"DynamicSnippet",props:{structure:{},data:{},message:{},configDesignClass:{}},emits:["action"],setup(o,{emit:e}){const t=o,{containerBg:s,containerColor:i,headerChip:n,yesButton:r,noButton:a,actionBtnSizeClass:l,buttonRadiusStyle:c,verticalSpacing:u,sidePadding:g,valueColor:h,getButtonStyle:p,border:f,chipSizeClass:d}=_u(t.configDesignClass),m=Rs(()=>t.configDesignClass?.getKey("sections.inside.activeSnippet.params.buttonStyle")),w=Rs(()=>({background:s.value,color:i.value,"border-radius":t.configDesignClass?.getKey("settings.globalRoundingRadius")?c.value.borderRadius:t.configDesignClass?.getKey("sections.inside.activeSnippet.element.borderRadius")+"px",border:f.value,padding:`${g.value}px`,gap:`${u.value}px`})),_=Rs(()=>({container:{style:w.value},headerChip:{style:n.value,class:d.value},actionConfirm:{class:l.value,style:{...p(r.value,m.value),flex:"1","line-height":"1","border-radius":t.configDesignClass?.getKey("settings.globalRoundingRadius")?c.value.borderRadius:t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.borderRadius")+"px","font-size":t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.fontSize")+"px"}},title:{style:{color:h.value,"font-size":t.configDesignClass?.getKey("sections.inside.activeSnippet.element.fontSize")+"px"}},actionCancel:{class:l.value,style:{...p(a.value,m.value),flex:"1","line-height":"1","border-radius":t.configDesignClass?.getKey("settings.globalRoundingRadius")?c.value.borderRadius:t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.borderRadius")+"px","font-size":t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.fontSize")+"px"}}})),y=e,S=Rs(()=>new pu(t.structure).build(t.data).buildStyle(_.value).result()),C=T=>{const k=T.target;if(!k)return;const x=k.closest("[data-cb]")?.getAttribute("data-cb");x&&t.message.snippet?.sequence&&y("action",x,t.message.snippet.sequence)};return(T,k)=>(wu(),Cu("div",{class:"tw:mt-1 tw:mb-1 tw:max-w-[65%]",onClick:C,innerHTML:S.value},null,8,vu))}}),{defineComponent:Su}=await z("vue"),{unref:sr,createElementVNode:ir,normalizeClass:_i,normalizeStyle:yi,openBlock:mt,createElementBlock:Ms,createCommentVNode:nr,renderList:xu,Fragment:rr,createBlock:wi,resolveDynamicComponent:Tu,renderSlot:ku}=await z("vue"),Du=["innerHTML"],{ref:Ru,watch:Mu,nextTick:zu,computed:Ci}=await z("vue"),Bu=Su({__name:"MessageList",props:{messages:{},isPreview:{type:Boolean},isEmbedded:{type:Boolean},showWelcome:{type:Boolean},sectionBorderRadius:{},isLoading:{type:Boolean},isStreaming:{type:Boolean},configDesignClass:{},activeMessage:{},traceLastShown:{type:Boolean},isProduction:{type:Boolean}},emits:["handleClickMessage","handleSnippetAction"],setup(o,{emit:e}){const t=Ru(null),s=o,i=e,n=f=>{f.meta&&i("handleClickMessage",f)},r=Ci(()=>s.messages.filter((f,d,m)=>s.isProduction?!(f.type==="usageTokensByAI"||f.isSystem&&m[d+1]?.isSystem):!0));Mu(s.messages,()=>{l()&&a()},{deep:!0});const a=()=>{zu(()=>{t.value&&(t.value.scrollTop=t.value.scrollHeight)})},l=()=>{if(!t.value)return!0;const f=t.value;return f.scrollHeight-f.scrollTop-f.clientHeight<=24},c=()=>{},u=f=>{const d=f.replace("#",""),m=parseInt(d.substr(0,2),16),w=parseInt(d.substr(2,2),16),_=parseInt(d.substr(4,2),16),y=Math.max(0,m-12),S=Math.max(0,w-12),C=Math.max(0,_-12);return`linear-gradient(180deg, rgba(${y}, ${S}, ${C}, 0.95) 0%, rgba(0,0,0, 0) 100%)`},g=Ci(()=>{switch(s.configDesignClass.getKey("sections.inside.welcomeMessage.size")){case"sm":return"tw:px-1.5 tw:py-2.5";case"md":return"tw:px-3 tw:py-4";case"lg":return"tw:px-4.5 tw:py-5.5"}}),h=Ci(()=>s.configDesignClass.getKey("sections.inside.welcomeMessage.bgType")==="gradient"?u(s.configDesignClass.getKey("sections.inside.welcomeMessage.bgColor")):s.configDesignClass.getKey("sections.inside.welcomeMessage.bgType")==="bubble"?s.configDesignClass.getKey("sections.inside.welcomeMessage.bgColor"):"transparent"),p=f=>s.configDesignClass.getKey("settings.globalRoundingRadius")?s.sectionBorderRadius.borderRadius:s.configDesignClass.getKey(f?"sections.inside.messageUser.borderRadius":"sections.inside.messageBot.borderRadius")+"px";return(f,d)=>(mt(),Ms("ul",{class:"message-list tw:overflow-y-scroll tw:flex-1 tw:list-none tw:pb-4",ref_key:"messageListRef",ref:t,onScroll:c},[f.showWelcome?(mt(),Ms("li",{key:0,class:_i(["tw:text-"+(f.configDesignClass.getKey("sections.inside.params.size")==="sm"?"xs":f.configDesignClass.getKey("sections.inside.params.size")==="md"?"sm":"base")]),style:yi({color:f.configDesignClass.getKey("sections.inside.messageUser.color"),"margin-bottom":`${f.configDesignClass.getKey("settings.gapMessageLine")}px`})},[ir("div",{key:"message",class:_i(g.value),style:yi({borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.inside.welcomeMessage.borderRadius")+"px",color:f.configDesignClass.getKey("sections.inside.welcomeMessage.color"),background:h.value,lineHeight:f.configDesignClass.getKey("settings.lineHeight"),fontSize:f.configDesignClass.getKey("sections.inside.welcomeMessage.fontSize")+"px",letterSpacing:f.configDesignClass.getKey("settings.letterSpacing")+"px"})},[ir("div",{innerHTML:sr(Si)(f.configDesignClass.getKey("texts.welcomeMessage"))},null,8,Du)],6)],6)):nr("",!0),(mt(!0),Ms(rr,null,xu(r.value,(m,w)=>(mt(),Ms(rr,{key:w},[m.snippet?(mt(),wi(bu,{key:0,structure:sr(mu),data:m.snippet.data,message:m,configDesignClass:f.configDesignClass,onAction:d[0]||(d[0]=(_,y)=>i("handleSnippetAction",_,y))},null,8,["structure","data","message","configDesignClass"])):(mt(),wi(Tu(m.isUser?Nc:m.isSystem?f.isProduction?Qn:hu:Kc),{key:1,message:m,"data-component":m.isSystem?f.isProduction?"LoadingMessage":"MessageSystem":"MessageBot",style:yi({borderRadius:p(m.isUser),"margin-top":`${r.value[w-1]?.isSystem&&!m.isSystem?"12px":"0px"}`,"margin-bottom":`${m.isSystem?"2px":f.configDesignClass.getKey("settings.gapMessageLine")+"px"}`,lineHeight:f.configDesignClass.getKey("settings.lineHeight"),letterSpacing:f.configDesignClass.getKey("settings.letterSpacing")+"px"}),loader:f.configDesignClass.getKey("settings.loader"),color:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.color"):f.configDesignClass.getKey("sections.inside.messageBot.color"),welcomeColor:f.configDesignClass.getKey("sections.inside.messageUser.color"),bgType:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.bgType"):f.configDesignClass.getKey("sections.inside.messageBot.bgType"),bgColor:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.bgColor"):f.configDesignClass.getKey("sections.inside.messageBot.bgColor"),size:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.size"):f.configDesignClass.getKey("sections.inside.messageBot.size"),fontSize:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.fontSize"):f.configDesignClass.getKey("sections.inside.messageBot.fontSize"),borderWidth:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.borderWidth"):f.configDesignClass.getKey("sections.inside.messageBot.borderWidth"),borderColor:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.borderColor"):f.configDesignClass.getKey("sections.inside.messageBot.borderColor"),index:w,traceLastShown:f.traceLastShown,configDesignClass:f.configDesignClass,activeMessage:f.activeMessage===m,isLast:w===r.value.length-1,onClick:_=>n(m)},null,8,["message","data-component","style","loader","color","welcomeColor","bgType","bgColor","size","fontSize","borderWidth","borderColor","index","traceLastShown","configDesignClass","activeMessage","isLast","onClick"]))],64))),128)),f.isLoading?(mt(),wi(Qn,{key:1,class:_i({"tw:mt-8":f.traceLastShown}),loader:f.configDesignClass.getKey("settings.loader"),configDesignClass:f.configDesignClass,text:f.configDesignClass.getKey("texts.typingLoader")},null,8,["class","loader","configDesignClass","text"])):nr("",!0),ku(f.$slots,"footer")],544))}}),{defineComponent:Pu}=await z("vue"),{createVNode:Eu,normalizeStyle:$u,openBlock:Lu,createElementBlock:Ou}=await z("vue"),{computed:Ku}=await z("vue"),Au=Pu({__name:"ChatMessagesContainer",props:{messages:{},isPreview:{type:Boolean},isEmbedded:{type:Boolean},sectionBorderRadius:{},isLoading:{type:Boolean},isStreaming:{type:Boolean},configDesignClass:{},activeMessage:{},showWelcome:{type:Boolean},isProcessError:{type:Boolean},restartChat:{type:Function},traceLastShown:{type:Boolean},isProduction:{type:Boolean}},emits:["handleClickMessage","update:activeMessage","handleSnippetAction"],setup(o,{emit:e}){const t=o,s=e,i=Ku({get:()=>t.activeMessage,set:n=>s("update:activeMessage",n)});return(n,r)=>(Lu(),Ou("div",{class:"tw:flex tw:flex-col tw:justify-between tw:w-full tw:min-h-0",style:$u([{flex:"1 1 0"},{paddingLeft:(n.configDesignClass.getKey("sections.inside.params.sidePadding")??8)+"px",paddingRight:(n.configDesignClass.getKey("sections.inside.params.sidePadding")??8)+"px",paddingTop:(n.configDesignClass.getKey("sections.inside.params.verticalPadding")??8)/2+"px"}])},[Eu(Bu,{messages:n.messages,isPreview:n.isPreview,isEmbedded:n.isEmbedded,configDesignClass:n.configDesignClass,isLoading:n.isLoading,isStreaming:n.isStreaming,isProduction:n.isProduction,sectionBorderRadius:n.sectionBorderRadius,showWelcome:n.showWelcome,activeMessage:i.value,"onUpdate:activeMessage":r[0]||(r[0]=a=>i.value=a),traceLastShown:n.traceLastShown,onHandleClickMessage:r[1]||(r[1]=a=>n.$emit("handleClickMessage",a)),onHandleSnippetAction:r[2]||(r[2]=(a,l)=>s("handleSnippetAction",a,l))},null,8,["messages","isPreview","isEmbedded","configDesignClass","isLoading","isStreaming","isProduction","sectionBorderRadius","showWelcome","activeMessage","traceLastShown"])],4))}}),{defineComponent:Iu}=await z("vue"),{vShow:or,createVNode:$t,withDirectives:ar,normalizeStyle:is,createElementVNode:lr,openBlock:_t,createElementBlock:Lt,createCommentVNode:vi,createBlock:Vu,Transition:Fu,withCtx:Wu,normalizeClass:cr}=await z("vue"),Uu={key:0,class:"chat tw:w-full tw:h-full tw:flex tw:pt-0 tw:relative",style:{overflow:"hidden"}},Nu={key:0,class:"tw:w-full tw:h-full"},Hu={key:1,class:"messages tw:flex tw:flex-col tw:justify-between tw:w-full"},{ref:V,onMounted:ur,onUnmounted:dr,watch:zs,computed:yt,nextTick:bi}=await z("vue"),ns=0,N1=Iu({__name:"ChatWrapper",props:{link:{},isEmbedded:{type:Boolean},isPreview:{type:Boolean},configWidget:{},configLink:{},scenario:{},scenarioOptions:{},widgetId:{},isProduction:{type:Boolean}},emits:["trace"],setup(o,{expose:e,emit:t}){const s=t,i=V(!1),n=V(!1),r=V(null),a=V(!1),l=V(!1),c=V(!1),u=V(!1),g=V(!0),h=V(!1),p=V(!1),f=V(!1),d=V(0),m=V(!1),w=V(null),_=o,y=async()=>{if(!(_.isPreview||_.scenario))try{xo(),await ws()}catch(v){console.error("Failed to restart chat connection",v)}},S=yt(()=>{const v=M.value.getKey("settings.position"),b=M.value.getKey("settings.offset.x"),R=M.value.getKey("settings.offset.y"),K=$.value?M.value.getKey("settings.size.width"):M.value.getKey("sections.colapsed.width"),se=$.value?M.value.getKey("settings.size.height"):M.value.getKey("sections.colapsed.height");return{...{...v==="topLeft"?{top:R+"px",left:b+"px"}:{},...v==="topRight"?{top:R+"px",right:b+"px"}:{},...v==="bottomLeft"?{bottom:R+"px",left:b+"px"}:{},...v==="bottomRight"?{bottom:R+"px",right:b+"px"}:{},...v==="top"?{top:R+"px",left:"50%",transform:"translateX(-50%)"}:{},...v==="bottom"?{bottom:R+"px",left:"50%",transform:"translateX(-50%)"}:{},...v==="left"?{left:b+"px",top:"50%",transform:"translateY(-50%)"}:{},...v==="right"?{right:b+"px",top:"50%",transform:"translateY(-50%)"}:{}},width:$.value&&!Se.value?K+"px":void 0,height:$.value||Se.value?se+"px":void 0}}),C=()=>{if(_.configLink)return _.configLink;const b=new URLSearchParams(window.location.search).get("config");if(b)return b},T=V(null),k=V(null),D=()=>C()?k.value:_.configWidget?_.configWidget:Pe,x=yt(()=>{const v=D(),{isValid:b,errors:R}=$l(v);return b?v:(console.warn("[HSW] Invalid widget config, falling back to DEFAULT_CONFIG:",R),Pe)}),P=v=>{T.value=v,s("trace",{action:v.type,messages:[v]})},I=async()=>{s("trace",{action:"copyAll",messages:Z.value})},L=async()=>{if(Z.value.length===0){s("trace",{action:"copyLast",messages:[]});return}let v=-1;for(let R=Z.value.length-1;R>=0;R--)if(Z.value[R].isUser){v=R;break}const b=v>=0?v:0;s("trace",{action:"copyLast",messages:Z.value.slice(b)})},O=async v=>{switch(v.action){case"copyLast":await L();break;case"copyIteration":await L();break;case"copyAll":await I();break}},M=yt(()=>new Ll(x.value)),j=yt(()=>hr(M.value)),F=yt(()=>us(M.value,8)),Y=yt(()=>{switch(M.value.getKey("sections.bottom.params.size")){case"sm":return"tw:min-h-[25px]";case"md":return"tw:min-h-[45px]";case"lg":return"tw:min-h-[60px]"}}),$=V(!0),Dt=()=>{const v=r.value;if(!v)return{width:56,height:56};const b=v.querySelector(".chat-action");if(!b)return{width:56,height:56};const R=b.getBoundingClientRect();return{width:Math.max(1,R.width),height:Math.max(1,R.height)}},$e=V(!1),lt=async v=>{if($e.value)return;$e.value=!0;const b=r.value;if(!b||v===$.value)return;const R=b.querySelector(".chatWrapper"),K=R?.querySelector(".chat");if(v){const se=b.querySelector(".chat-collapsed");se&&(E.killTweensOf(se),E.to(se,{opacity:0,duration:.15,ease:"power2.in"}));const{height:Fe,width:qs}=Dt();await new Promise(Mo=>setTimeout(Mo,150)),$.value=!0,await bi();const Gt=Math.max(Fe||0,qs||0)||56;E.killTweensOf(b),K&&E.killTweensOf(K),R&&E.killTweensOf(R),Se.value&&E.set(b,{position:"absolute",left:"50%",top:"50%",xPercent:-50,yPercent:-50}),E.set(b,{width:Gt,height:Gt,overflow:"hidden",opacity:0,willChange:"width, height, opacity"}),R&&E.set(R,{opacity:0,willChange:"opacity"}),K&&E.set(K,{opacity:0,willChange:"opacity"}),E.to(b,{width:M.value.getKey("settings.size.width"),height:M.value.getKey("settings.size.height"),opacity:1,duration:.4,ease:"power2.out",onComplete:()=>{E.set(b,{clearProps:"overflow,position,left,top,xPercent,yPercent,marginTop,willChange,opacity"}),$e.value=!1}}),R&&E.to(R,{opacity:1,duration:.3,delay:.1,ease:"power2.out",onComplete:()=>{E.set(R,{clearProps:"willChange,opacity"})}}),K&&E.to(K,{opacity:1,duration:.3,delay:.15,ease:"power2.out",onComplete:()=>{E.set(K,{clearProps:"willChange"})}})}else{const se=M.value.getKey("sections.colapsed.height")+M.value.getKey("sections.colapsed.borderWidth")*2;E.killTweensOf(b),K&&E.killTweensOf(K),R&&E.killTweensOf(R),Se.value&&E.set(b,{position:"absolute",left:"50%",top:"50%",xPercent:-50,yPercent:-50}),E.set(b,{width:M.value.getKey("settings.size.width"),height:M.value.getKey("settings.size.height"),overflow:"hidden",willChange:"width, height, opacity"}),R&&(E.set(R,{willChange:"opacity"}),E.to(R,{opacity:0,duration:.5,ease:"power3.inOut",onComplete:()=>{E.set(R,{clearProps:"willChange,opacity"})}})),K&&(E.set(K,{willChange:"opacity"}),E.to(K,{opacity:0,duration:.2,ease:"power2.in",onComplete:()=>{E.set(K,{clearProps:"willChange"})}})),E.to(b,{width:se,height:se,opacity:0,duration:.35,marginTop:0,ease:"power2.inOut",onComplete:()=>{$.value=!1,bi().then(()=>{const Fe=b.querySelector(".chat-collapsed");Fe&&(E.set(Fe,{opacity:0}),E.to(Fe,{opacity:1,duration:.25,ease:"power2.out"})),E.set(b,{opacity:1})}),E.set(b,{clearProps:"overflow,position,left,top,xPercent,yPercent,marginTop,willChange"}),$e.value=!1}})}},ae=V(_.isPreview||!1),Se=V(_.isEmbedded||!1);zs(()=>_.isEmbedded,v=>{Se.value=v});const ze=V(!!_.isPreview),ce=V(_.widgetId||`hsw-${Math.random().toString(36).slice(2,10)}`),Z=V([]),Rt=V("");let J=null,ct=0;const vo=yt(()=>Z.value.length>0&&Z.value[Z.value.length-1].isUser===!0||l.value),Ns=V(null),bo=(v,b)=>{console.log("handleSnippetAction",v,b),un({action:{sequence:b,command:v,data:{}}})},xe=v=>{if(v.chunkId&&v.text){const b=Z.value[Z.value.length-1];b.chunkId===v.chunkId?(v.chunk?.start?b.text="":b.text+=v.text,b.chunk.start=!1):Z.value.push(v)}else Z.value.push(v)},qt=(()=>{if(_.link)return _.link;const b=new URLSearchParams(window.location.search).get("link");if(b)return b;const K=new URLSearchParams(window.location.hash.substring(1)).get("link");if(K)return K;try{const se="ws://localhost:8080/client/widget-chat/v1/ws/?token=E5CPOfNv0veaiK5AlBXl_jGfOZDkhqnf1NaAUjqw5fNpArKMjlIO1QOUbm7iOzmAvr5QulcBeyr_ke3Neyy1EqhkOeOzdnAaKUvKEqFgTKhW11vePCl9oxoAlsMIknbuAbDdQ93Zg5vjU5ippynFWF6o";if(se)return se}catch(se){console.warn("Environment variables not available:",se)}return console.log("Using fallback link: ws://localhost:3000"),"ws://localhost:3000"})(),ln=()=>{if(ct>=ns){xe({text:`Failed to connect after ${ns} attempts. Please check your connection.`,isUser:!1});return}ct++,console.log(`Reconnection attempt ${ct}/${ns}`),setTimeout(()=>{Hs()},2e3*ct)},So=()=>{xe({text:wo.UserMessage,isUser:!0}),xe({text:"{Agent response message}",isUser:!1})},Hs=()=>{try{if(!qt||typeof qt!="string"){console.error("Invalid WebSocket link:",qt),xe({text:"Error: Invalid WebSocket URL",isUser:!1});return}if(console.log("Attempting to connect to:",qt),J=new WebSocket(qt),!J){console.error("Failed to create WebSocket instance");return}J.onmessage=v=>{try{const b=JSON.parse(v.data);if(b.snippet)return xe({snippet:{...b.snippet,data:JSON.parse(b.snippet.data||"{}")},isUser:!1,isSystem:!0,isError:!1});if(b.error)return xe({text:b.error.message,isUser:!1,isSystem:!0,isError:!0});if(b?.textChunk?.start&&(m.value=!0,w.value=b?.textChunk?.start,xe({text:"",isUser:!1,chunkId:b?.textChunk?.start,chunk:b?.textChunk})),b?.textChunk?.end||b?.textChunk?.start){b?.textChunk?.end&&w.value&&b?.textChunk?.end===w.value&&(m.value=!1,w.value=null);return}b?.textChunk?.text&&xe({text:b.textChunk.text,isUser:!1,chunkId:b?.textChunk?.id}),b?.trace&&xe({text:b.trace.message,isUser:!1,isSystem:!0,meta:b.trace.meta,time:b.trace.time,type:b.trace.type}),b?.trace?.meta&&!_.isProduction&&s("trace",{action:b.trace.type,messages:[b.trace]})}catch(b){console.error("Error parsing WebSocket message:",b),xe({text:"Error: Failed to parse server response",isUser:!1})}},J.onopen=()=>{ct=0},J.onclose=v=>{console.log("Connection closed",v);let b=`Connection closed (${v.code})`;switch(v.code){case 1e3:b="Connection closed normally";break;case 1001:b="Connection closed: going away";break;case 1006:if(u.value=!0,ct<ns&&!ae.value){ln();return}break;case 1011:b="Connection closed: server error";break;default:c.value=!0}console.log(b)},J.onerror=v=>{console.error("WebSocket connection error:",v),a.value=!0,xe({text:"Connection error: Unable to connect to chat server",isUser:!1,isSystem:!0,isError:!0}),ct<ns&&!ae.value&&ln()}}catch(v){console.error("Error connecting to socket server:",v),xe({text:`Connection error: ${v instanceof Error?v.message:"Unknown error"}`,isUser:!1,isSystem:!0,isError:!0})}},xo=()=>{J&&J.close(),J=null};dr(()=>{J&&J.close()});const cn=()=>{_.isPreview||_.scenario||lt(!$.value)},To=()=>{if(!(_.isPreview||_.scenario)&&Rt.value.trim()!==""){if(_.isProduction&&Z.value.length>0){const v=Z.value[Z.value.length-1];v.isSystem===!0&&!v.isError&&!v.snippet&&Z.value.pop()}Z.value.push({text:Rt.value,isUser:!0}),m.value=!0,un({message:Rt.value}),Rt.value=""}},un=v=>{J&&J.send(JSON.stringify(v))},dn=()=>{try{const v=M.value.getKey("settings.fontFamily")||"MacPaw Fixel",b=`https://fonts.googleapis.com/css2?family=${v.replace(/\s+/g,"+")}:wght@300;400;500;600;700&display=swap`,R=document.createElement("link");R.rel="preload",R.as="style",R.href=b,document.head.appendChild(R);const K=document.createElement("link");K.rel="stylesheet",K.href=b,K.setAttribute("data-google-font","true"),document.head.appendChild(K),r.value&&(r.value.style.fontFamily=`"${v}", sans-serif`)}catch(v){console.error("Error loading font:",v)}},fn=()=>{const v=M.value.getKey("settings.fontWeight")||400;r.value&&(r.value.style.fontWeight=v)};n.value=!0,zs(()=>M.value.getKey("settings.fontFamily"),()=>{dn()}),zs(()=>M.value.getKey("settings.fontWeight"),()=>{fn()});const ko=async()=>{if(C()){const b=await(await fetch(C()+"config")).json();k.value=b,i.value=!0}else i.value=!0},js=(v,b,R)=>new Promise(K=>{const se=performance.now(),Fe=qs=>{const Gt=Math.min(1,(qs-se)/R);d.value=v+(b-v)*Gt,Gt<1?requestAnimationFrame(Fe):K()};requestAnimationFrame(Fe)}),gn=async v=>{f.value=!0,d.value=0,await bi(),await js(0,.3,500),v(),await js(.3,.6,200),d.value=.6,await new Promise(b=>setTimeout(b,100)),await js(.6,0,500),f.value=!1},Zs=async(v,b)=>{await gn(()=>{const R=Nn.getState(v,M.value,b||_.scenarioOptions);if($.value=R.isChatOpen,Z.value=R.messages,l.value=R.traceLastShown,a.value=R.isConnectionError,c.value=R.isProcessError,u.value=R.isReconnectError,h.value=R.isInputDisabled,g.value=R.showWelcome,p.value=R.showReconnectNotice??!1,Ns.value=R.snippet??null,ae.value=!0,J){try{J.close()}catch{}J=null}})},ws=async()=>{await gn(()=>{ae.value=ze.value,g.value=!0,h.value=!1,p.value=!1,a.value=!1,c.value=!1,u.value=!1,Z.value=[],ae.value||(!J||J.readyState!==1)&&Hs()})};ur(async()=>{await ko(),dn(),fn();const v=_.scenario??Nn.getScenarioFromUrl();if(v){await Zs(v);return}if(_.isPreview){So();return}Hs()}),zs(()=>_.scenario,async v=>{v?await Zs(v):await ws()});const Te={id:ce,setScenario:async(v,b)=>{await Zs(v,b)},clearScenario:async()=>{await ws()},setOpen:v=>{$.value=v},setActive:v=>{v&&!$.value&&($.value=!0)},setInputDisabled:v=>{h.value=v},setShowReconnectNotice:v=>{p.value=v},setMessages:v=>{Z.value=Array.isArray(v)?v:[]},pushMessage:v=>{Z.value.push(v)},setSnippet:v=>{Ns.value=v??null},resetToLive:async()=>{await ws()}},Do=()=>{const v=window;v.hswWidgets=v.hswWidgets||{},v.hswWidgets[ce.value]=Te,window.dispatchEvent(new CustomEvent("hsw:ready",{detail:{widgetId:ce.value}}))},Ro=()=>{const v=window;v.hswWidgets&&v.hswWidgets[ce.value]&&delete v.hswWidgets[ce.value]},hn=async v=>{const b=v,R=b.detail?.widgetId;if(R&&R!==ce.value)return;const{action:K}=b.detail;switch(K){case"setScenario":await Te.setScenario(b.detail.payload.type,b.detail.payload.options);break;case"clearScenario":await Te.clearScenario();break;case"setOpen":Te.setOpen(b.detail.payload);break;case"setActive":Te.setActive(b.detail.payload);break;case"setInputDisabled":Te.setInputDisabled(b.detail.payload);break;case"setShowReconnectNotice":Te.setShowReconnectNotice(b.detail.payload);break;case"setMessages":Te.setMessages(b.detail.payload);break;case"pushMessage":Te.pushMessage(b.detail.payload);break;case"setSnippet":Te.setSnippet(b.detail.payload);break;case"resetToLive":await Te.resetToLive();break}};return ur(()=>{Do(),window.addEventListener("hsw:control",hn)}),dr(()=>{Ro(),window.removeEventListener("hsw:control",hn)}),e(Te),(v,b)=>i.value?(_t(),Lt("div",{key:0,class:cr(["tw:z-[999] tw:flex tw:justify-end component-isolator",{"tw:fixed":!Se.value,"tw:w-full":$.value}]),style:is({letterSpacing:M.value.getKey("settings.letterSpacing")+"px",...S.value}),ref_key:"chatWrapperRef",ref:r},[ar($t(Dl,{toggleChat:cn,element:M.value.getKeyObject("sections.colapsed")},null,8,["element"]),[[or,!$.value]]),ar(lr("div",{class:cr(["chatWrapper tw:w-full tw:backdrop-blur-[22px] tw:flex tw:items-center tw:border-0 tw:flex-col",[{"tw:h-auto tw:shadow-2xl chat-active":$.value,"tw:shadow-lg tw:w-fit":!$.value,"chat-embedded tw:w-full tw:h-full tw:static tw:top-0 tw:left-0":Se.value}]]),style:is({background:M.value.getKey("settings.bgChat"),borderRadius:`${String(j.value)}px`})},[$t(jl,{isChatOpen:$.value,toggleChat:cn,configDesignClass:M.value,sectionBorderRadius:F.value,mainBorderRadius:j.value,isPreview:ae.value,isEmbedded:Se.value,isProduction:v.isProduction||!1,restartChat:y},null,8,["isChatOpen","configDesignClass","sectionBorderRadius","mainBorderRadius","isPreview","isEmbedded","isProduction"]),$.value?(_t(),Lt("div",Uu,[a.value?(_t(),Lt("div",Nu,[lr("div",{class:"tw:absolute tw:left-0 tw:top-0 tw:w-full tw:h-full",style:is({padding:M.value.getKey("sections.warnings.launchIssue.content.sidePadding")+"px"})},[$t(xi,{type:"launchIssue",class:"tw:h-full",headlineText:M.value.getKey("texts.launchIssueTitle"),descriptionText:M.value.getKeyObject("texts.launchIssueText"),warningElement:M.value.getKeyObject("sections.warnings.launchIssue"),configDesignClass:M.value,isProcessError:c.value,restartChat:y},null,8,["headlineText","descriptionText","warningElement","configDesignClass","isProcessError"])],4)])):(_t(),Lt("div",Hu,[$t(Au,{messages:Z.value,isPreview:ae.value,isEmbedded:Se.value,configDesignClass:M.value,isLoading:vo.value,isStreaming:m.value,isProduction:v.isProduction,sectionBorderRadius:F.value,showWelcome:g.value,activeMessage:T.value,"onUpdate:activeMessage":b[0]||(b[0]=R=>T.value=R),isProcessError:c.value,snippet:Ns.value,traceLastShown:l.value,onHandleClickMessage:P,onHandleSnippetAction:bo,restartChat:y},null,8,["messages","isPreview","isEmbedded","configDesignClass","isLoading","isStreaming","isProduction","sectionBorderRadius","showWelcome","activeMessage","isProcessError","snippet","traceLastShown"]),c.value?(_t(),Lt("div",{key:0,style:is({padding:M.value.getKey("sections.warnings.connectionIssue.content.sidePadding")+"px"})},[$t(xi,{type:"connectionIssue",headlineText:M.value.getKey("texts.issueText"),configDesignClass:M.value,warningElement:M.value.getKeyObject("sections.warnings.connectionIssue"),restartChat:y},null,8,["headlineText","configDesignClass","warningElement"])],4)):(_t(),Vu(pc,{key:1,messageText:Rt.value,"onUpdate:messageText":b[1]||(b[1]=R=>Rt.value=R),isProduction:v.isProduction||!1,configDesignClass:M.value,sectionBorderRadius:F.value,classSize:Y.value,sendMessage:To,isInputDisabled:h.value,showReconnectNotice:p.value,restartChat:y,isStreaming:m.value,onTrace:O},null,8,["messageText","isProduction","configDesignClass","sectionBorderRadius","classSize","isInputDisabled","showReconnectNotice","isStreaming"]))]))])):vi("",!0),$t(Fu,{name:"fade"},{default:Wu(()=>[f.value?(_t(),Lt("div",{key:0,class:"tw:absolute tw:inset-0 tw:backdrop-blur-[40px] tw:z-[1000]",style:is({borderRadius:`${String(j.value)}px`,backgroundColor:`rgba(0,0,0, ${d.value})`})},null,4)):vi("",!0)]),_:1})],6),[[or,n.value&&$.value]])],6)):vi("",!0)}});export{Pe as D,N1 as _};
|
|
26
|
+
</svg>`,color:"#FFF"}}}},loader:{typingLoader:{color:"#8E8E8F",bgColor:"#2F2F31"},completeStep:{verticalSpacing:8,fontSize:12,color:"#8E8E8F",icon:{showIcon:!0,src:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path opacity="0.4" d="M7.99967 14.6666C11.6816 14.6666 14.6663 11.6818 14.6663 7.99992C14.6663 4.31802 11.6816 1.33325 7.99967 1.33325C4.31778 1.33325 1.33301 4.31802 1.33301 7.99992C1.33301 11.6818 4.31778 14.6666 7.99967 14.6666Z" fill="currentColor"></path><path d="M7.05297 10.3867C6.91964 10.3867 6.79297 10.3334 6.69964 10.2401L4.81297 8.3534C4.61964 8.16007 4.61964 7.84007 4.81297 7.64673C5.0063 7.4534 5.3263 7.4534 5.51964 7.64673L7.05297 9.18007L10.4796 5.7534C10.673 5.56007 10.993 5.56007 11.1863 5.7534C11.3796 5.94673 11.3796 6.26673 11.1863 6.46006L7.4063 10.2401C7.31297 10.3334 7.1863 10.3867 7.05297 10.3867Z" fill="currentColor"></path></svg>',color:"#8E8E8F",size:16}},activeStep:{fontSize:12,color:"#FFF",icon:{showIcon:!0,src:'<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3.5 4.02667C2.56667 5.08667 2 6.48 2 8C2 11.3133 4.68667 14 8 14C11.3133 14 14 11.3133 14 8C14 4.68667 11.3133 2 8 2C7.52667 2 7.06667 2.05333 6.62667 2.16" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/></svg>',color:"#fff",size:16}}},top:{params:{size:"md",bgColor:"#5E4AC6",bgStyle:"gradient",paddingVertical:8,paddingHorizontal:8,chipStyle:"filled",buttonStyle:"filled"},chipWidgetTitle:{color:"#fff",bgColor:"#5E4AC6",borderRadius:12,showType:"both"},buttons:{color:"#BBBBBD",bgColor:"#2F2F31",borderRadius:12,showType:"both"}},inside:{params:{size:"md",sidePadding:8,verticalPadding:8},welcomeMessage:{color:"#fff",bgType:"gradient",fontSize:14,size:"md",borderRadius:12,borderWidth:1,bgColor:"#595959"},messageUser:{color:"#F9F8F8",bgColor:"#F8F8F933",bgType:"bubble",borderRadius:12,fontSize:14,size:"md",borderWidth:1,borderColor:"#595959"},messageBot:{color:"#fff",bgColor:"#5E4AC6",bgType:"plain",borderRadius:12,fontSize:14,size:"md",borderWidth:1,borderColor:"#595959"},activeSnippet:{params:{buttonType:"both",buttonStyle:"filled",size:"md"},element:{color:"#fff",bgColor:"#373739",borderRadius:12,borderWidth:1,borderColor:"#595959",verticalSpacing:8,sidePadding:8,fontSize:12},headerChip:{color:"#fff",bgColor:"#69696A",borderRadius:12,size:"md",fontSize:12,bgType:"filled"},propertyColor:"rgba(255, 255, 255, 0.30)",valueColor:"#fff",yesButton:{color:"#fff",bgColor:"#12A150",borderRadius:12,fontSize:12},noButton:{color:"#fff",bgColor:"#C20E4D",borderRadius:12,fontSize:12}}},bottom:{params:{size:"md",disclaimerShow:!1},inputSend:{size:"md",color:"#EEECEC",bgColor:"#373739",borderColor:"#595959",borderWidth:1,inputStyle:"inside",bgType:"plain",paddingVertical:8,paddingHorizontal:8,sidePadding:8,fontSize:12,borderRadius:8},btnSend:{color:"#1E1E1E",bgColor:"rgba(255, 255, 255, 0.50)",showType:"both",borderWidth:1,borderColor:"#595959",borderRadius:50,size:"md",fontSize:12,icon:{showIcon:!0,src:'<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 2.56445C9.01973 2.56449 9.03453 2.57164 9.04395 2.58105L13.5967 7.13379C13.606 7.14324 13.6133 7.15811 13.6133 7.17773C13.6132 7.19738 13.606 7.21226 13.5967 7.22168L13.5898 7.22754L13.584 7.23438C13.5865 7.23164 13.5864 7.23284 13.5801 7.23535C13.5732 7.23801 13.5633 7.24018 13.5527 7.24023C13.5431 7.24023 13.5351 7.23862 13.5293 7.23633C13.524 7.23419 13.5171 7.22992 13.5088 7.22168L9 2.71289L4.49121 7.22168C4.48176 7.23107 4.46699 7.23828 4.44727 7.23828C4.42752 7.23826 4.41275 7.23109 4.40332 7.22168C4.3939 7.21226 4.38676 7.19747 4.38672 7.17773C4.38672 7.15801 4.39393 7.14324 4.40332 7.13379L8.95605 2.58105C8.9655 2.57167 8.98027 2.56445 9 2.56445Z" stroke="currentColor"/><path d="M9 2.68994C9.01306 2.68994 9.02868 2.69518 9.04297 2.70947C9.05726 2.72376 9.0625 2.73938 9.0625 2.75244V15.3745C9.0625 15.3875 9.0571 15.4032 9.04297 15.4175C9.02868 15.4318 9.01306 15.437 9 15.437C8.98694 15.437 8.97132 15.4318 8.95703 15.4175C8.9429 15.4032 8.9375 15.3875 8.9375 15.3745V2.75244C8.9375 2.73938 8.94274 2.72376 8.95703 2.70947C8.97132 2.69518 8.98694 2.68994 9 2.68994Z" fill="currentColor" stroke="currentColor"/></svg>',color:"#fff",size:18}},disclaimer:{color:"#fff",bgColor:"#FF0000",height:20,fontSize:12}}}};class Zt{canApply(e){return e.fromVersion===this.appliesTo.from&&e.toVersion===this.appliesTo.to}rollback(e){return{success:!1,errors:[`Rollback not implemented for strategy: ${this.name}`],warnings:[],modified:!1}}createSuccessResult(e,t=[]){return{success:!0,data:e,errors:[],warnings:t,modified:!0}}createErrorResult(e,t){return{success:!1,data:t,errors:e,warnings:[],modified:!1}}}class Rl extends Zt{constructor(){super(...arguments),this.name="AddSettingsFieldsV1toV2",this.description="Добавляет новые поля loader, buttonStyle, buttonType в settings",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[],i={...t.settings,loader:Pe.settings.loader};return s.push(`Добавлены поля loader: '${i.loader}'`),this.createSuccessResult({...t,settings:i},s)}catch(t){return this.createErrorResult([`Ошибка при добавлении полей settings: ${t}`])}}}class Ml extends Zt{constructor(){super(...arguments),this.name="AddChipStyleV1toV2",this.description="Добавляет поле chipStyle в sections.top.params",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.top.params={...t.sections.top.params,chipStyle:Pe.sections.top.params.chipStyle},s.push(`Добавлено поле chipStyle: '${Pe.sections.top.params.chipStyle}' в sections.top.params`),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении chipStyle: ${t}`])}}}class zl extends Zt{constructor(){super(...arguments),this.name="AddMessageBgTypeV1toV2",this.description="Добавляет поле bgType в messageUser и messageBot",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.inside.messageUser={...t.sections.inside.messageUser,bgType:Pe.sections.inside.messageUser.bgType},t.sections.inside.messageBot={...t.sections.inside.messageBot,bgType:Pe.sections.inside.messageBot.bgType},s.push("Добавлены поля bgType для messageUser и messageBot"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении bgType для сообщений: ${t}`])}}}class Bl extends Zt{constructor(){super(...arguments),this.name="AddActionButtonsV1toV2",this.description="Добавляет кнопки aprooveButton и rejectButton в inside секцию",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.inside={...t.sections.inside},s.push("Добавлены кнопки aprooveButton и rejectButton"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении кнопок действий: ${t}`])}}}class Pl extends Zt{constructor(){super(...arguments),this.name="EnhanceInputSendV1toV2",this.description="Добавляет borderStyle, inputStyle, bgType в inputSend",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.bottom.inputSend={...t.sections.bottom.inputSend,borderStyle:{borderColor:Pe.sections.bottom.inputSend.borderColor,borderWidth:Pe.sections.bottom.inputSend.borderWidth},inputStyle:Pe.sections.bottom.inputSend.inputStyle,bgType:Pe.sections.bottom.inputSend.bgType},s.push("Расширен inputSend с новыми полями borderStyle, inputStyle, bgType"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при расширении inputSend: ${t}`])}}}class El extends Zt{constructor(){super(...arguments),this.name="AddBottomElementsV1toV2",this.description="Добавляет warningAlert и disclaimer в bottom секцию",this.appliesTo={from:"1.0",to:"2.0"}}apply(e){try{const t={...e.config},s=[];return t.sections.bottom={...t.sections.bottom},s.push("Добавлены warningAlert и disclaimer в bottom секцию"),this.createSuccessResult(t,s)}catch(t){return this.createErrorResult([`Ошибка при добавлении элементов bottom: ${t}`])}}}new Rl,new Ml,new zl,new Bl,new Pl,new El;const Le=o=>typeof o=="string"&&o.length>=0,On=o=>typeof o=="number"&&!Number.isNaN(o),es=(o,e)=>typeof o=="string"&&e.includes(o);function $l(o){const e=[];if(!o||typeof o!="object")return{isValid:!1,errors:["config: must be an object"]};const t=o.settings||{};On(t.letterSpacing)||t.letterSpacing===void 0||e.push("settings.letterSpacing: number"),Le(t.bgChat)||t.bgChat===void 0||e.push("settings.bgChat: string"),Le(t.fontFamily)||t.fontFamily===void 0||e.push("settings.fontFamily: string"),On(t.fontWeight)||t.fontWeight===void 0||e.push("settings.fontWeight: number"),t.logo===void 0||Le(t.logo)||e.push("settings.logo: string (svg or url)"),t.widgetTitle===void 0||Le(t.widgetTitle)||e.push("settings.widgetTitle: string"),t.position===void 0&&e.push("settings.position: undefined");const s=o.texts||{};s.launchIssueTitle===void 0||Le(s.launchIssueTitle)||e.push("texts.launchIssueTitle: string"),s.issueText===void 0||Le(s.issueText)||e.push("texts.issueText: string"),s.widgetTitle===void 0||Le(s.widgetTitle)||e.push("texts.widgetTitle: string"),s.hideText===void 0||Le(s.hideText)||e.push("texts.hideText: string");const i=o.sections?.top||{},n=i.params||{};n.size===void 0||es(n.size,["sm","md","lg"])||e.push("sections.top.params.size: sm|md|lg"),n.chipStyle===void 0||es(n.chipStyle,["filled","outlined","invisible"])||e.push("sections.top.params.chipStyle: filled|outlined|invisible"),n.buttonStyle===void 0||es(n.buttonStyle,["filled","outlined","invisible"])||e.push("sections.top.params.buttonStyle: filled|outlined|invisible"),n.buttonType===void 0||es(n.buttonType,["icon","text","both"])||e.push("sections.top.params.buttonType: icon|text|both"),i?.chipWidgetTitle?.color===void 0||Le(i?.chipWidgetTitle?.color)||e.push("sections.top.chipWidgetTitle.color: string"),i?.chipWidgetTitle?.bgColor===void 0||Le(i?.chipWidgetTitle?.bgColor)||e.push("sections.top.chipWidgetTitle.bgColor: string"),i?.btnClose===void 0||typeof i?.btnClose=="object"||e.push("sections.top.btnClose: object");const a=(o.sections?.bottom||{}).params||{};a.size===void 0||es(a.size,["sm","md","lg"])||e.push("sections.bottom.params.size: sm|md|lg");const l=o.sections?.warnings||{};return l.launchIssue===void 0||typeof l.launchIssue=="object"||e.push("sections.warnings.launchIssue: object"),l.connectionIssue===void 0||typeof l.connectionIssue=="object"||e.push("sections.warnings.connectionIssue: object"),{isValid:e.length===0,errors:e}}class Ll{config;constructor(e){this.config=e}getFlatRecursiveConfig(e,t="",s={}){for(const i in e){if(!Object.prototype.hasOwnProperty.call(e,i))continue;const n=e[i],r=t?`${t}.${i}`:i;n!==null&&typeof n=="object"&&!Array.isArray(n)?this.getFlatRecursiveConfig(n,r,s):s[r]=n}return s}get configFlat(){return this.getFlatRecursiveConfig(this.config)}getConfig(){return this.config}getKey(e){return this.configFlat[e]??void 0}getKeyObject(e){return e.split(".").reduce((t,s)=>t&&t[s]!==void 0?t[s]:"undefined",this.config)}}const Vi={sm:"tw:h-[20px] tw:px-1.5 tw:py-0 tw:[font-size:10px] [&_svg]:tw:size-4",md:"tw:h-[24px] tw:px-2 tw:py-1 tw:text-xs [&_svg]:tw:size-4.5",lg:"tw:h-[28px] tw:px-3 tw:py-1 tw:text-sm [&_svg]:tw:size-5"};function Fi(o){return o==="sm"||o==="md"||o==="lg"?Vi[o]:Vi.md}function an(o,e){try{const s={top:"sections.top.params.size",inside:"sections.inside.params.size",bottom:"sections.bottom.params.size"}[e],i=o?.getKey(s);return Fi(i)}catch{return Vi.md}}const{defineComponent:Ol}=await z("vue"),{normalizeClass:ts,openBlock:We,createElementBlock:Ue,createCommentVNode:ft,toDisplayString:Kn,unref:ui,normalizeStyle:xs,withCtx:di,createVNode:fi,createElementVNode:An,withModifiers:In}=await z("vue"),Kl=["aria-expanded"],Al=["innerHTML"],Il=["src","alt"],Vl={key:2},Fl={key:0,class:"tw:flex tw:items-center tw:w-full tw:justify-end tw:gap-1.5 header-buttons"},Wl=["width","height"],Ul={key:1},Nl=["width","height"],Hl={key:1},{computed:pe}=await z("vue"),jl=Ol({__name:"ChatHeader",props:{isChatOpen:{type:Boolean},toggleChat:{type:Function},configDesignClass:{},sectionBorderRadius:{},mainBorderRadius:{},isPreview:{type:Boolean},isEmbedded:{type:Boolean},restartChat:{type:Function}},setup(o){const e=o,t=pe(()=>e.configDesignClass.getKeyObject("sections.top.params")),s=pe(()=>an(e.configDesignClass,"top")),i=pe(()=>{let d="";switch(t.value.bgStyle){case"gradient":d=`linear-gradient(180deg, ${t.value.bgColor} 0%, ${e.configDesignClass.getKey("settings.bgChat")} 100%)`;break;case"filled":d=t.value.bgColor;break;case"invisible":d="transparent";break;default:d="transparent";break}return{borderTopLeftRadius:`${e.mainBorderRadius}px`,borderTopRightRadius:`${e.mainBorderRadius}px`,background:d,padding:`${t.value.paddingVertical}px ${t.value.paddingHorizontal}px`}}),n=pe(()=>{const d=e.configDesignClass.getKey("texts.widgetTitle"),m=e.configDesignClass.getKey("settings.widgetTitle");return d&&d!=="undefined"?d:m&&m!=="undefined"?m:""}),r=pe(()=>e.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")),a=pe(()=>{const d=e.configDesignClass.getKey("sections.top.params.chipStyle"),m=e.configDesignClass.getKey("sections.top.chipWidgetTitle.color"),w=e.configDesignClass.getKey("sections.top.chipWidgetTitle.bgColor"),_=d==="outlined",y=d==="filled",S=d==="invisible";return{borderRadius:e.configDesignClass.getKey("settings.globalRoundingRadius")?e.sectionBorderRadius.borderRadius:e.configDesignClass.getKey("sections.top.chipWidgetTitle.borderRadius")+"px",color:m,border:_?`1px solid ${w}`:"none",padding:S?"0px":null,"background-color":y?w:"transparent"}}),l=pe(()=>e.configDesignClass.getKey("sections.top.buttons.showType")),c=pe(()=>{const d=e.configDesignClass.getKey("sections.top.buttons.showType");return d&&d!=="undefined"?d:"icon"}),u=pe(()=>{const d=e.configDesignClass.getKeyObject("sections.top.buttons");return{color:d?.color??"#fff",bgColor:d?.bgColor??"#000"}}),g=pe(()=>{const d=e.configDesignClass.getKey("sections.top.params.buttonStyle"),m=d==="outlined",w=d==="invisible",_=u.value;return{borderRadius:e.configDesignClass.getKey("settings.globalRoundingRadius")?e.sectionBorderRadius.borderRadius:e.configDesignClass.getKey("sections.top.buttons.borderRadius")+"px",color:_.color,border:m?`1px solid ${_.bgColor}`:"none",padding:w?"0px":null,"background-color":w?"transparent":d==="filled"?_.bgColor:"transparent"}}),h=pe(()=>{const d=e.configDesignClass.getKey("texts.hideText");return d&&d!=="undefined"?d:"Hide"}),p=pe(()=>e.configDesignClass.getKey("settings.logo").includes("<svg")),f=pe(()=>e.configDesignClass.getKey("settings.logo"));return(d,m)=>(We(),Ue("div",{onClick:m[0]||(m[0]=(...w)=>d.toggleChat&&d.toggleChat(...w)),class:"chat-action tw:cursor-pointer tw:flex tw:items-center tw:w-full tw:justify-start tw:overflow-hidden",style:xs(i.value),role:"button","aria-expanded":d.isChatOpen},[fi(ui(st),{class:ts(["tw:flex tw:items-center tw:shadow-none header-title",s.value]),variant:r.value,size:d.configDesignClass.getKey("sections.top.params.size"),style:xs(a.value),type:"button","aria-label":n.value,title:n.value},{default:di(()=>[p.value&&d.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")!=="text"?(We(),Ue("div",{key:0,class:ts(["header-logo",d.configDesignClass.getKey("sections.top.params.size")]),innerHTML:f.value},null,10,Al)):f.value&&d.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")!=="text"?(We(),Ue("img",{key:1,src:f.value,alt:d.configDesignClass.getKey("sections.top.iconWidget.alt"),class:ts(d.configDesignClass.getKey("sections.top.params.size")==="sm"?"tw:w-3 tw:h-3":"tw:w-4 tw:h-4")},null,10,Il)):ft("",!0),d.configDesignClass.getKey("sections.top.chipWidgetTitle.showType")!=="icon"?(We(),Ue("span",Vl,Kn(n.value),1)):ft("",!0)]),_:1},8,["class","variant","size","style","aria-label","title"]),d.isChatOpen?(We(),Ue("div",Fl,[fi(ui(st),{variant:l.value,class:ts([s.value]),size:d.configDesignClass.getKey("sections.top.params.size"),style:xs(g.value),type:"button","aria-label":h.value,title:h.value,onClick:In(d.restartChat,["stop"])},{default:di(()=>[c.value!=="text"?(We(),Ue("svg",{key:0,width:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",height:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m[1]||(m[1]=[An("path",{d:"M10.7935 1.33333H5.20683C2.78016 1.33333 1.3335 2.77999 1.3335 5.20666V10.7867C1.3335 13.22 2.78016 14.6667 5.20683 14.6667H10.7868C13.2135 14.6667 14.6602 13.22 14.6602 10.7933V5.20666C14.6668 2.77999 13.2202 1.33333 10.7935 1.33333ZM8.00016 12.1667C6.80683 12.1667 5.8735 11.5733 5.24016 10.9867V11.46C5.24016 11.7333 5.0135 11.96 4.74016 11.96C4.46683 11.96 4.24016 11.7333 4.24016 11.46V9.62666C4.24016 9.35333 4.46683 9.12666 4.74016 9.12666H6.3935C6.66683 9.12666 6.8935 9.35333 6.8935 9.62666C6.8935 9.89999 6.66683 10.1267 6.3935 10.1267H5.7935C6.28683 10.62 7.0535 11.1667 8.00016 11.1667C9.74683 11.1667 11.1668 9.74666 11.1668 8C11.1668 7.72666 11.3935 7.5 11.6668 7.5C11.9402 7.5 12.1668 7.72666 12.1668 8C12.1668 10.3 10.3002 12.1667 8.00016 12.1667ZM12.1668 6.35999C12.1668 6.37999 12.1668 6.39999 12.1668 6.41333C12.1602 6.48666 12.1402 6.55333 12.1068 6.61333C12.0735 6.67333 12.0268 6.72666 11.9668 6.77333C11.9202 6.80666 11.8668 6.83333 11.8068 6.85333C11.7602 6.86666 11.7135 6.87333 11.6668 6.87333H10.0468C9.7735 6.87333 9.54683 6.64666 9.54683 6.37333C9.54683 6.1 9.7735 5.87333 10.0468 5.87333H10.6002C10.0668 5.38 9.20683 4.83333 8.0135 4.83333C6.26683 4.83333 4.84683 6.25333 4.84683 8C4.84683 8.27333 4.62016 8.5 4.34683 8.5C4.0735 8.5 3.8335 8.27333 3.8335 8C3.8335 5.7 5.70016 3.83333 8.00016 3.83333C9.4335 3.83333 10.4868 4.45333 11.1668 5.04666V4.53999C11.1668 4.26666 11.3935 4.03999 11.6668 4.03999C11.9402 4.03999 12.1668 4.26666 12.1668 4.53999V6.35999Z",fill:"currentColor"},null,-1)]),8,Wl)):ft("",!0),c.value!=="icon"?(We(),Ue("span",Ul," Restart ")):ft("",!0)]),_:1},8,["variant","class","size","style","aria-label","title","onClick"]),fi(ui(st),{variant:l.value,class:ts([s.value]),size:d.configDesignClass.getKey("sections.top.params.size"),style:xs(g.value),type:"button","aria-label":h.value,title:h.value,onClick:In(d.toggleChat,["stop"])},{default:di(()=>[c.value!=="text"?(We(),Ue("svg",{key:0,width:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",height:d.configDesignClass.getKey("sections.top.params.size")==="sm"?"12":"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},m[2]||(m[2]=[An("path",{d:"M10.7935 1.33337H5.20683C2.78016 1.33337 1.3335 2.78004 1.3335 5.20671V10.7867C1.3335 13.22 2.78016 14.6667 5.20683 14.6667H10.7868C13.2135 14.6667 14.6602 13.22 14.6602 10.7934V5.20671C14.6668 2.78004 13.2202 1.33337 10.7935 1.33337ZM12.3335 10.9334C12.3335 11.9334 11.9335 12.3334 10.9335 12.3334H8.40016C7.40016 12.3334 7.00016 11.9334 7.00016 10.9334V9.73337C7.00016 8.73337 7.40016 8.33337 8.40016 8.33337H10.9335C11.9335 8.33337 12.3335 8.73337 12.3335 9.73337V10.9334Z",fill:"currentColor"},null,-1)]),8,Nl)):ft("",!0),c.value!=="icon"?(We(),Ue("span",Hl,Kn(h.value),1)):ft("",!0)]),_:1},8,["variant","class","size","style","aria-label","title","onClick"])])):ft("",!0)],12,Kl))}}),{shallowRef:Gu,watchEffect:Yu,readonly:Xu,watch:Qu,customRef:Ju,getCurrentScope:e1,onScopeDispose:t1,effectScope:s1,getCurrentInstance:i1,hasInjectionContext:n1,inject:r1,provide:o1,ref:a1,isRef:l1,unref:c1,toValue:u1,computed:d1,reactive:f1,toRefs:g1,toRef:h1,shallowReadonly:p1,onBeforeMount:m1,nextTick:_1,onBeforeUnmount:y1,onMounted:w1,onUnmounted:C1,isReactive:v1}=await z("vue");typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Zl=o=>typeof o<"u",{isRef:b1,shallowRef:S1,ref:ql,watchEffect:x1,computed:Gl,inject:T1,defineComponent:k1,h:D1,TransitionGroup:R1,Fragment:M1,shallowReactive:z1,toValue:B1,unref:P1,getCurrentInstance:Yl,onMounted:E1,watch:Vn,customRef:$1,onUpdated:L1,readonly:O1,reactive:K1,hasInjectionContext:A1,toRaw:I1,nextTick:Xl,markRaw:V1,getCurrentScope:F1,isReadonly:W1,onBeforeUpdate:U1}=await z("vue");function Ql(o){return JSON.parse(JSON.stringify(o))}function yo(o,e,t,s={}){var i,n,r;const{clone:a=!1,passive:l=!1,eventName:c,deep:u=!1,defaultValue:g,shouldEmit:h}=s,p=Yl(),f=t||p?.emit||((i=p?.$emit)==null?void 0:i.bind(p))||((r=(n=p?.proxy)==null?void 0:n.$emit)==null?void 0:r.bind(p?.proxy));let d=c;e||(e="modelValue"),d=d||`update:${e.toString()}`;const m=y=>a?typeof a=="function"?a(y):Ql(y):y,w=()=>Zl(o[e])?m(o[e]):g,_=y=>{h?h(y)&&f(d,y):f(d,y)};if(l){const y=w(),S=ql(y);let C=!1;return Vn(()=>o[e],T=>{C||(C=!0,S.value=m(T),Xl(()=>C=!1))}),Vn(S,T=>{!C&&(T!==o[e]||u)&&_(T)},{deep:u}),S}else return Gl({get(){return w()},set(y){_(y)}})}const{defineComponent:Jl}=await z("vue"),{unref:Fn,isRef:ec,vModelText:tc,normalizeClass:sc,withDirectives:ic,openBlock:nc,createElementBlock:rc}=await z("vue"),oc=Jl({__name:"Textarea",props:{class:{},defaultValue:{},modelValue:{}},emits:["update:modelValue"],setup(o,{emit:e}){const t=o,i=yo(t,"modelValue",e,{passive:!0,defaultValue:t.defaultValue});return(n,r)=>ic((nc(),rc("textarea",{"onUpdate:modelValue":r[0]||(r[0]=a=>ec(i)?i.value=a:null),style:{resize:"none"},"data-slot":"textarea",class:sc(Fn(fr)("tw:md:text-sm",t.class))},null,2)),[[tc,Fn(i)]])}}),{defineComponent:ac}=await z("vue"),{createElementVNode:me,openBlock:Ge,createElementBlock:gt,createTextVNode:Wn,unref:Pt,withModifiers:gi,normalizeStyle:Be,withCtx:hi,createVNode:Ts,createCommentVNode:Et,isRef:lc,withKeys:cc,normalizeClass:ks,createBlock:uc,toDisplayString:pi}=await z("vue"),dc={key:0,class:"tw:w-full"},fc={key:0,class:"svg-icon"},gc=["innerHTML"],hc={key:1},{computed:Ye}=await z("vue"),pc=ac({__name:"ChatBottom",props:{isProduction:{type:Boolean},configDesignClass:{},messageText:{},sendMessage:{type:Function},sectionBorderRadius:{},classSize:{},isInputDisabled:{type:Boolean},showReconnectNotice:{type:Boolean},restartChat:{type:Function},isStreaming:{type:Boolean}},emits:["update:messageText","trace"],setup(o,{emit:e}){const t=o,s=()=>{t.sendMessage()},n=yo(t,"messageText",e,{passive:!0}),r=Ye(()=>t.configDesignClass?.getKey("sections.bottom.inputSend.inputStyle")==="stacked"),a=Ye(()=>an(t.configDesignClass,"bottom")),l=Ye(()=>{const f=t.configDesignClass.getKey("texts.topWarningText");return f&&f!=="undefined"?f:""}),c=Ye(()=>{const f=t.configDesignClass.getKey("texts.disableInputText");return f&&f!=="undefined"?f:""}),u=Ye(()=>t.configDesignClass.getKey("sections.bottom.inputSend.size")),g=Ye(()=>t.isInputDisabled&&c.value?c.value:l.value||t.configDesignClass.getKey("texts.reconnectText")||"Reconnecting..."),h=Ye(()=>t.configDesignClass.getKey("sections.bottom.btnSend.icon.showIcon")?t.configDesignClass.getKey("sections.bottom.btnSend.icon.src"):null),p=Ye(()=>{const f=t.configDesignClass.getKey("texts.disclaimerText"),d=t.configDesignClass.getKey("texts.disclaimer"),m=f&&f!=="undefined"?f:d,_=!!t.configDesignClass.getKey("sections.bottom.params.disclaimerShow");return m&&m!=="undefined"&&_?m:""});return(f,d)=>(Ge(),gt("div",null,[f.isProduction?Et("",!0):(Ge(),gt("div",{key:0,class:"tw:flex tw:flex-row tw:gap-2",style:Be({padding:r.value?"0":"0 "+f.configDesignClass.getKey("sections.bottom.inputSend.sidePadding")+"px"})},[Ts(Pt(st),{type:"button",style:Be({backgroundColor:"#27272A",borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px"}),class:"tw:flex-shrink-1 tw:flex-grow-1","aria-label":"Copy last message",title:"Copy last message",onClick:d[0]||(d[0]=gi(m=>f.$emit("trace",{action:"copyLast"}),["stop"]))},{default:hi(()=>d[3]||(d[3]=[me("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[me("path",{opacity:"0.4",d:"M17.5 5.83464V14.168C17.5 16.668 16.25 18.3346 13.3333 18.3346H7.5C8.50833 17.5763 9.16667 16.3596 9.16667 15.0013C9.16667 12.7013 7.3 10.8346 5 10.8346C4.05833 10.8346 3.19167 11.143 2.5 11.668V5.83464C2.5 3.33464 3.75 1.66797 6.66667 1.66797H13.3333C16.25 1.66797 17.5 3.33464 17.5 5.83464Z",fill:"white"}),me("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.084 3.125C12.4292 3.125 12.709 3.40482 12.709 3.75V5.41667C12.709 5.98816 13.1792 6.45833 13.7507 6.45833H15.4173C15.7625 6.45833 16.0423 6.73816 16.0423 7.08333C16.0423 7.42851 15.7625 7.70833 15.4173 7.70833H13.7507C12.4888 7.70833 11.459 6.67851 11.459 5.41667V3.75C11.459 3.40482 11.7388 3.125 12.084 3.125Z",fill:"white"}),me("path",{d:"M5.00065 10.832C2.70065 10.832 0.833984 12.6987 0.833984 14.9987C0.833984 17.2987 2.70065 19.1654 5.00065 19.1654C7.30065 19.1654 9.16732 17.2987 9.16732 14.9987C9.16732 12.6987 7.30065 10.832 5.00065 10.832ZM4.30065 16.057C4.50899 16.2654 4.50899 16.607 4.30065 16.8237C4.19232 16.932 4.05899 16.982 3.91733 16.982C3.77566 16.982 3.64231 16.932 3.53398 16.8237L2.09233 15.382C1.88399 15.1737 1.88399 14.832 2.09233 14.6153L3.53398 13.1737C3.74231 12.9654 4.08399 12.9654 4.30065 13.1737C4.50899 13.382 4.50899 13.7237 4.30065 13.9403L3.24233 14.9987L4.30065 16.057ZM7.90066 15.382L6.45898 16.8237C6.35065 16.932 6.21733 16.982 6.07566 16.982C5.93399 16.982 5.80064 16.932 5.69231 16.8237C5.48397 16.6154 5.48397 16.2737 5.69231 16.057L6.75066 14.9987L5.69231 13.9403C5.48397 13.732 5.48397 13.3904 5.69231 13.1737C5.90064 12.9654 6.24232 12.9654 6.45898 13.1737L7.90066 14.6153C8.10899 14.832 8.10899 15.1654 7.90066 15.382Z",fill:"white"})],-1),Wn(" Log last function call ")])),_:1,__:[3]},8,["style"]),Ts(Pt(st),{type:"button",class:"tw:flex-shrink-1 tw:flex-grow-1",style:Be({backgroundColor:"#27272A",borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px"}),"aria-label":"Copy all",title:"Copy all",onClick:d[1]||(d[1]=gi(m=>f.$emit("trace",{action:"copyAll"}),["stop"]))},{default:hi(()=>d[4]||(d[4]=[me("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[me("path",{opacity:"0.4",d:"M17.5 5.83464V14.168C17.5 16.668 16.25 18.3346 13.3333 18.3346H6.66667C3.75 18.3346 2.5 16.668 2.5 14.168V5.83464C2.5 3.33464 3.75 1.66797 6.66667 1.66797H13.3333C16.25 1.66797 17.5 3.33464 17.5 5.83464Z",fill:"white"}),me("path",{d:"M15.4173 7.70833H13.7507C12.484 7.70833 11.459 6.68333 11.459 5.41667V3.75C11.459 3.40833 11.7423 3.125 12.084 3.125C12.4257 3.125 12.709 3.40833 12.709 3.75V5.41667C12.709 5.99167 13.1757 6.45833 13.7507 6.45833H15.4173C15.759 6.45833 16.0423 6.74167 16.0423 7.08333C16.0423 7.425 15.759 7.70833 15.4173 7.70833Z",fill:"white"}),me("path",{d:"M8.33255 14.7922C8.17422 14.7922 8.01589 14.7339 7.89089 14.6089L6.22422 12.9422C5.98255 12.7006 5.98255 12.3005 6.22422 12.0589L7.89089 10.3922C8.13255 10.1505 8.53255 10.1505 8.77422 10.3922C9.01588 10.6339 9.01588 11.0339 8.77422 11.2756L7.54922 12.5005L8.77422 13.7255C9.01588 13.9672 9.01588 14.3672 8.77422 14.6089C8.64922 14.7339 8.49088 14.7922 8.33255 14.7922Z",fill:"white"}),me("path",{d:"M11.6659 14.7922C11.5076 14.7922 11.3492 14.7339 11.2242 14.6089C10.9826 14.3672 10.9826 13.9672 11.2242 13.7255L12.4492 12.5005L11.2242 11.2756C10.9826 11.0339 10.9826 10.6339 11.2242 10.3922C11.4659 10.1505 11.8659 10.1505 12.1076 10.3922L13.7742 12.0589C14.0159 12.3005 14.0159 12.7006 13.7742 12.9422L12.1076 14.6089C11.9826 14.7339 11.8242 14.7922 11.6659 14.7922Z",fill:"white"})],-1),Wn(" Log all function calls ")])),_:1,__:[4]},8,["style"])],4)),me("div",{class:"tw:flex tw:flex-col tw:items-center tw:relative tw:mt-2",style:Be({padding:r.value?"0":"0 "+f.configDesignClass.getKey("sections.bottom.inputSend.sidePadding")+"px"})},[f.showReconnectNotice||l.value||f.isInputDisabled?(Ge(),gt("div",dc,[Ts(xi,{class:"tw:rounded-b-none tw:mx-0 tw:flex tw:justify-center tw:item s-center tw:px-2 tw:py-2",type:"reconnecting",configDesignClass:f.configDesignClass,headlineText:g.value,restartChat:f.restartChat,warningElement:f.isInputDisabled?f.configDesignClass.getKeyObject("sections.warnings.disableInputIssue"):f.configDesignClass.getKeyObject("sections.warnings.reconnectIssue")},null,8,["configDesignClass","headlineText","restartChat","warningElement"])])):Et("",!0),me("div",{class:ks(["message-input tw:flex-1 tw:w-full tw:p-0 tw:gap-[10px] tw:flex",[f.classSize,r.value?"tw:flex-col tw:items-stretch tw:justify-between":" tw:items-end",u.value==="sm"?"tw:items-center":""]]),style:Be({...r.value?{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px",borderTopLeftRadius:"0px",borderTopRightRadius:"0px"}:{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.inputSend.borderRadius")+"px"},"background-color":f.configDesignClass.getKey("sections.bottom.inputSend.bgColor"),"margin-bottom":r.value?"0px":f.configDesignClass.getKey("sections.bottom.inputSend.sidePadding")+"px",border:r.value?"none":`${f.configDesignClass.getKey("sections.bottom.inputSend.borderWidth")}px solid ${f.configDesignClass.getKey("sections.bottom.inputSend.borderColor")}`})},[(Ge(),uc(Pt(oc),{placeholder:f.configDesignClass.getKey("texts.inputPlaceholder")||"Type question",rows:u.value==="sm"?1:u.value==="md"?2:3,key:f.configDesignClass.getKey("sections.bottom.inputSend.color"),modelValue:Pt(n),"onUpdate:modelValue":d[2]||(d[2]=m=>lc(n)?n.value=m:null),onKeyup:cc(gi(s,["exact"]),["enter"]),class:ks(["tw:w-full tw:outline-none tw:border-0 focus:tw:outline-none",r.value?"tw:h-auto rounded-none":"h-full"]),style:Be({color:f.configDesignClass.getKey("sections.bottom.inputSend.color"),fontSize:f.configDesignClass.getKey("sections.bottom.inputSend.fontSize")+"px",lineHeight:f.configDesignClass.getKey("settings.lineHeight"),padding:f.configDesignClass.getKey("sections.bottom.inputSend.paddingVertical")+"px "+f.configDesignClass.getKey("sections.bottom.inputSend.paddingHorizontal")+"px",height:f.configDesignClass.getKey("sections.bottom.inputSend.height")+"px"})},null,8,["placeholder","rows","modelValue","onKeyup","class","style"])),me("div",{class:ks(r.value?"tw:flex tw:flex-row-reverse tw:justify-between tw:items-center tw:gap-2 tw:pl-3":"tw:flex tw:ml-auto"),style:Be({marginBottom:f.configDesignClass.getKey("sections.bottom.inputSend.paddingVertical")+"px",marginRight:f.configDesignClass.getKey("sections.bottom.inputSend.paddingHorizontal")+"px"})},[Ts(Pt(st),{size:f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="icon"?"icon":f.configDesignClass.getKey("sections.bottom.params.size"),class:ks(["btn-send tw:bg-transparent tw:shadow-none tw:flex-shrink-0 tw:items-center tw:gap-1",f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="icon"?"tw:rounded-full":a.value,r.value?"tw:self-end":"tw:ml-auto",{"tw:opacity-50":Pt(n).trim()===""||f.isInputDisabled},{"tw:px-3 tw:py-2":f.configDesignClass.getKey("sections.bottom.btnSend.size")==="md"},{"tw:px-2 tw:py-1":f.configDesignClass.getKey("sections.bottom.btnSend.size")==="sm"},{"tw:px-4 tw:py-3":f.configDesignClass.getKey("sections.bottom.btnSend.size")==="lg"}]),onClick:s,style:Be({...f.configDesignClass.getKey("sections.bottom.btnSend.type")==="icon"?{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.btnSend.borderRadius")+"px"}:{borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.bottom.btnSend.borderRadius")+"px"},color:f.configDesignClass.getKey("sections.bottom.btnSend.color"),"background-color":f.configDesignClass.getKey("sections.bottom.btnSend.bgColor"),fontSize:f.configDesignClass.getKey("sections.bottom.btnSend.fontSize")+"px",border:f.configDesignClass.getKey("sections.bottom.btnSend.borderWidth")+"px solid "+f.configDesignClass.getKey("sections.bottom.btnSend.borderColor")}),disabled:f.isInputDisabled},{default:hi(()=>[h.value?(Ge(),gt("div",fc,[me("div",{innerHTML:h.value,style:Be({color:f.configDesignClass.getKey("sections.bottom.btnSend.color"),width:f.configDesignClass.getKey("sections.bottom.btnSend.icon.size")+"px",height:f.configDesignClass.getKey("sections.bottom.btnSend.icon.size")+"px"})},null,12,gc)])):Et("",!0),f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="text"||f.configDesignClass.getKey("sections.bottom.btnSend.showType")==="both"?(Ge(),gt("span",hc,pi(f.configDesignClass.getKey("texts.sendButton")),1)):Et("",!0)]),_:1},8,["size","class","style","disabled"]),r.value&&p.value?(Ge(),gt("div",{key:0,class:"tw:text-[11px] tw:text-white/50 tw:flex tw:items-center",style:Be({...f.sectionBorderRadius,fontSize:f.configDesignClass.getKey("sections.bottom.disclaimer.fontSize")+"px",height:f.configDesignClass.getKey("sections.bottom.disclaimer.height")+"px",color:f.configDesignClass.getKey("sections.bottom.disclaimer.color")})},pi(p.value),5)):Et("",!0)],6)],6),!r.value&&p.value?(Ge(),gt("div",{key:1,class:"tw:px-2 tw:text-white/50 tw:mb-2 tw:flex tw:items-center tw:justify-center",style:Be({...f.sectionBorderRadius,fontSize:f.configDesignClass.getKey("sections.bottom.disclaimer.fontSize")+"px",height:f.configDesignClass.getKey("sections.bottom.disclaimer.height")+"px",color:f.configDesignClass.getKey("sections.bottom.disclaimer.color")})},pi(p.value),5)):Et("",!0)],4)]))}});var U=(o=>(o.Collapsed="collapsed",o.EmptyChat="empty",o.Messages="messages",o.ActionSnippet="action_snippet",o.LaunchIssue="launch_issue",o.ConnectionIssue="connection_issue",o.ReconnectingAttempt="reconnecting_attempt",o.InputBlocked="input_blocked",o.ActionLoader="action_loader",o.TracesMessage="traces_message",o.TracesWithMeta="traces_with_meta",o))(U||{}),wo=(o=>(o.UserMessage="Give me some action",o))(wo||{});class Ee{base(e){return{isChatOpen:!0,isChatActive:!0,messages:[],isConnectionError:!1,isProcessError:!1,isReconnectError:!1,isInputDisabled:!1,showWelcome:!1,blockSocket:!0,traceLastShown:!1,...e}}}class mc extends Ee{type=U.Collapsed;getState(){return this.base({isChatOpen:!1})}}class Un extends Ee{type=U.EmptyChat;getState(){return this.base({showWelcome:!0,messages:[]})}}class _c extends Ee{type=U.Messages;getState(e,t){const s=t?.userMessageText??"Give me some action",i=t?.botMessageText??"What sort of action do you want?";return this.base({showWelcome:!0,messages:[{text:s,isUser:!0},{text:i,isUser:!1},{text:"Sort of action",isUser:!0}]})}}class yc extends Ee{type=U.ActionSnippet;getState(e,t){const s=t?.userMessageText??"Give me some action";return this.base({showWelcome:!1,messages:[{text:s,isUser:!0},{snippet:{sequence:"38952101547613990",id:"38496103561174822",data:{actionCancel:{text:"Cancel"},actionConfirm:{text:"Confirm"},title:{text:"Do you really want to get the available contacts list?"}}},isUser:!1}]})}}class wc extends Ee{type=U.LaunchIssue;getState(){return this.base({isConnectionError:!0})}}class Cc extends Ee{type=U.ConnectionIssue;getState(e,t){const s=t?.userMessageText??"Give me some action",i=!0,n=t?.traceSteps??["Step One","Step Two","Step three"];return this.base({isProcessError:!0,showWelcome:i,messages:[{text:s,isUser:!0},{text:n[0],isUser:!1,isSystem:!0,type:"trace"},{text:n[1],isUser:!1,isSystem:!0,type:"trace"},{text:n[2],isUser:!1,isSystem:!0,type:"trace"}]})}}class vc extends Ee{type=U.ReconnectingAttempt;getState(e,t){const s=t?.userMessageText??"Give me some action",i=!0,n=t?.traceSteps??["Step One","Step Two","Step three"];return this.base({isReconnectError:!0,showReconnectNotice:!0,showWelcome:i,messages:[{text:s,isUser:!0},{text:n[0],isUser:!1,isSystem:!0,type:"trace"},{text:n[1],isUser:!1,isSystem:!0,type:"trace"},{text:n[2],isUser:!1,isSystem:!0,type:"trace"}]})}}class bc extends Ee{type=U.InputBlocked;getState(e,t){const s=t?.userMessageText??"Give me some action",i=!0,n=t?.traceSteps??["Step One","Step Two","Step three"];return this.base({isReconnectError:!0,showReconnectNotice:!0,isInputDisabled:!0,showWelcome:i,messages:[{text:s,isUser:!0},{text:n[0],isUser:!1,isSystem:!0,type:"trace"},{text:n[1],isUser:!1,isSystem:!0,type:"trace"},{text:n[2],isUser:!1,isSystem:!0,type:"trace"}]})}}class Sc extends Ee{type=U.ActionLoader;getState(e,t){const s=t?.userMessageText??"Give me some action";return this.base({showWelcome:!0,messages:[{text:s,isUser:!0}]})}}class xc extends Ee{type=U.TracesMessage;getState(e,t){const s=t?.userMessageText??"Give me some action",i=t?.traceSteps??["Step One","Step Two","Step three"],n=[{text:s,isUser:!0},{text:i[0],isUser:!1,isSystem:!0,type:"trace"},{text:i[1],isUser:!1,isSystem:!0,type:"trace"},{text:i[2],isUser:!1,isSystem:!0,type:"trace"}];return this.base({showWelcome:!0,messages:n})}}class Tc extends Ee{type=U.TracesWithMeta;getState(e,t){const s=t?.userMessageText??"Give me some action",i=t?.traceSteps??["Step One","API Schema Requested","API Call Conducted","API Call Conducted"],n=[{text:s,isUser:!0},{text:i[0],isUser:!1,isSystem:!0,type:"trace",meta:{step:1}},{text:i[1],isUser:!1,isSystem:!0,type:"trace",meta:{step:2,json:{status:"requested",endpoint:"/v1/schema"}}},{text:i[2],isUser:!1,isSystem:!0,type:"trace",meta:{step:3,json:{status:"ok",code:200}}},{text:i[3],isUser:!1,isSystem:!0,type:"trace"}];return this.base({showWelcome:!0,messages:n})}}class kc{static create(e){switch(e){case U.Collapsed:case"collapsed":return new mc;case U.EmptyChat:case"empty":return new Un;case U.Messages:case"messages":return new _c;case U.ActionSnippet:case"action_snippet":return new yc;case U.LaunchIssue:case"launch_issue":return new wc;case U.ConnectionIssue:case"connection_issue":return new Cc;case U.ReconnectingAttempt:case"reconnecting_attempt":return new vc;case U.InputBlocked:case"input_blocked":return new bc;case U.ActionLoader:case"action_loader":return new Sc;case U.TracesMessage:case"traces_message":return new xc;case U.TracesWithMeta:case"traces_with_meta":return new Tc;default:return new Un}}}class Nn{static getScenarioFromUrl(){try{return new URLSearchParams(window.location.search).get("scenario")??void 0}catch{return}}static getState(e,t,s){return{...kc.create(e).getState(t,s),...s??{}}}}const{defineComponent:Dc}=await z("vue"),{toDisplayString:Rc,createElementVNode:Mc,normalizeClass:zc,normalizeStyle:Bc,openBlock:Pc,createElementBlock:Ec}=await z("vue"),$c={key:"message",class:"message-text"},{computed:Lc}=await z("vue"),Oc=Dc({__name:"MessageBot",props:{message:{},welcomeColor:{},color:{},bgColor:{},size:{},bgType:{},fontSize:{},borderWidth:{},borderColor:{},configDesignClass:{}},setup(o){const e=o,t=Lc(()=>{switch(e.size){case"sm":return e.bgType==="bubble"?" tw:min-h-[25px] tw:py-1 tw:px-2 ":"";case"md":return e.bgType==="bubble"?" tw:min-h-[33px] tw:py-2 tw:px-3":"";case"lg":return e.bgType==="bubble"?" tw:min-h-[40px] tw:py-3 tw:px-4":""}});return(s,i)=>(Pc(),Ec("li",{class:zc(["message-item tw:text-white tw:w-fit tw:whitespace-break-spaces tw:transition-colors tw:duration-[250ms] tw:ease-[ease]",[t.value,{"item-primary":!s.message.chunk?.start}]]),style:Bc({color:s.message.chunk?.start?"#2F2F31":s.color,"background-color":s.message.chunk?.start?"transparent":s.bgType==="bubble"?s.bgColor:"transparent","font-size":s.fontSize+"px",border:s.bgType==="bubble"?s.borderWidth+"px solid "+s.borderColor:"none"})},[Mc("div",$c,Rc(s.message.text),1)],6))}}),Co=(o,e)=>{const t=o.__vccOpts||o;for(const[s,i]of e)t[s]=i;return t},Kc=Co(Oc,[["__scopeId","data-v-53770389"]]),{defineComponent:Ac}=await z("vue"),{toDisplayString:Ic,normalizeClass:Vc,normalizeStyle:Fc,openBlock:Wc,createElementBlock:Uc}=await z("vue"),{computed:Hn}=await z("vue"),Nc=Ac({__name:"MessageUser",props:{message:{},isFirst:{type:Boolean},color:{},bgColor:{},borderWidth:{},borderColor:{},fontSize:{},size:{},bgType:{},configDesignClass:{}},setup(o){const e=o,t=Hn(()=>{switch(e.size){case"sm":return e.bgType==="bubble"?" tw:min-h-[25px] tw:py-1 tw:px-2 ":"";case"md":return e.bgType==="bubble"?" tw:min-h-[33px] tw:py-2 tw:px-3":"";case"lg":return e.bgType==="bubble"?" tw:min-h-[40px] tw:py-3 tw:px-4":""}}),s=Hn(()=>e.bgType==="bubble"?e.borderWidth+"px solid "+e.borderColor:"none");return(i,n)=>(Wc(),Uc("li",{class:Vc(["message-item tw:w-fit tw:whitespace-break-spaces item-secondary tw:ml-auto",[t.value,{"tw:mt-[5px] !tw:bg-transparent":i.isFirst}]]),style:Fc({color:i.color,"background-color":i.bgType==="bubble"?i.bgColor:"transparent",border:s.value,"font-size":i.fontSize+"px"})},Ic(i.message.text),7))}}),{defineComponent:Hc}=await z("vue"),{normalizeStyle:jn,openBlock:ht,createElementBlock:pt,createCommentVNode:jc,createElementVNode:ke,Transition:Zn,withCtx:qn,createVNode:Gn,toDisplayString:Zc,normalizeClass:qc}=await z("vue"),Gc=["innerHTML"],Yc={key:"dots",class:"tw:flex tw:items-center tw:justify-start tw:gap-1 tw:h-4"},Xc={key:"dots-pulse",class:"tw:flex tw:items-center tw:justify-start tw:gap-1 tw:h-4"},Qc={key:"circle-pulse",class:"circle-pulse"},Jc={key:"circle-pulse-1",class:"circle-pulse-1"},eu=["data-text"],{ref:Yn,computed:tu,onMounted:su,onBeforeUnmount:iu,watch:nu,nextTick:Xn}=await z("vue"),ru=Hc({__name:"LoadingMessage",props:{loader:{},text:{},message:{},configDesignClass:{},paused:{type:Boolean}},setup(o){const e=o,t=Yn(null),s=Yn(!1);let i=null;const n=()=>{const a=t.value;if(!a)return;const l=a.closest("li");if(!l)return;const c=l.nextElementSibling;if(!c){s.value=!1;return}const u=c.getAttribute("data-component")==="MessageBot"||typeof c.matches=="function"&&c.matches('[data-component="MessageBot"]')||!!c.querySelector('[data-component="MessageBot"]');s.value=u};su(()=>{Xn(n);const l=t.value?.closest("ul");l&&(i=new MutationObserver(()=>n()),i.observe(l,{childList:!0,subtree:!0}))}),iu(()=>{i&&i.disconnect()}),nu(()=>e.text,()=>Xn(n));const r=tu(()=>!!e.paused||s.value);return(a,l)=>(ht(),pt("li",{key:"loading",ref_key:"rootRef",ref:t,class:"message-text-loading tw:flex tw:items-center tw:justify-start tw:gap-3"},[Gn(Zn,{name:"fade",mode:"out-in"},{default:qn(()=>[r.value?(ht(),pt("div",{key:"complete-step-icon",innerHTML:a.configDesignClass.getKey("sections.loader.completeStep.icon.src"),class:"svg-inherit",style:jn({color:a.configDesignClass.getKey("sections.loader.completeStep.icon.color"),height:a.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px",width:a.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px"})},null,12,Gc)):!a.loader||a.loader==="dots"?(ht(),pt("div",Yc,l[0]||(l[0]=[ke("div",{class:"loading-dot tw:rounded-full"},null,-1),ke("div",{class:"loading-dot loading-dot-delay-1 tw:rounded-full"},null,-1),ke("div",{class:"loading-dot loading-dot-delay-2 tw:rounded-full"},null,-1),ke("div",{class:"loading-dot loading-dot-delay-3 tw:rounded-full"},null,-1)]))):a.loader==="dots-pulse"?(ht(),pt("div",Xc,l[1]||(l[1]=[ke("span",{class:"dot-pulse dot-1"},null,-1),ke("span",{class:"dot-pulse dot-2"},null,-1),ke("span",{class:"dot-pulse dot-3"},null,-1)]))):a.loader==="circle-pulse"?(ht(),pt("div",Qc,l[2]||(l[2]=[ke("span",{class:"ring ring-1"},null,-1),ke("span",{class:"ring ring-2"},null,-1)]))):a.loader==="circle-pulse-1"?(ht(),pt("div",Jc,l[3]||(l[3]=[ke("span",{class:"ripple r1"},null,-1),ke("span",{class:"ripple r2"},null,-1),ke("span",{class:"center"},null,-1)]))):jc("",!0)]),_:1}),Gn(Zn,{name:"fade-text",mode:"out-in"},{default:qn(()=>[(ht(),pt("span",{class:qc(["tw:text-sm",{"typing-shimmer":!r.value}]),key:a.text,"data-text":a.message?.text?a.message?.text:a.text,style:jn({color:a.configDesignClass.getKey("sections.loader.typingLoader.color")})},Zc(r.value?"Thinking completed":a.message?.text?a.message?.text:a.text),15,eu))]),_:1})],512))}}),Qn=Co(ru,[["__scopeId","data-v-98cb9df4"]]),{defineComponent:ou}=await z("vue"),{normalizeStyle:ss,createElementVNode:Xe,normalizeClass:Ds,toDisplayString:Jn,openBlock:mi,createElementBlock:er,createCommentVNode:tr,unref:au,withCtx:lu,createBlock:cu}=await z("vue"),uu=["data-height"],du={class:"tw:flex tw:flex-col tw:items-center tw:gap-1 tw:px-1"},fu=["innerHTML"],gu={class:"tw:flex tw:items-center tw:gap-2"},{computed:Qe}=await z("vue"),hu=ou({__name:"MessageSystem",props:{message:{},welcomeColor:{},color:{},bgColor:{},size:{},configDesignClass:{},activeMessage:{type:Boolean},bgType:{},isLast:{type:Boolean},traceLastShown:{type:Boolean},index:{}},setup(o){const e=o,t=Qe(()=>e.index===3&&e.traceLastShown||e.isLast),s=Qe(()=>{switch(e.size){case"sm":return"tw:text-xs";case"md":return"tw:text-xs";case"lg":return"tw:text-base"}}),i=Qe(()=>t.value?e.configDesignClass.getKey("sections.loader.activeStep.icon.src"):e.configDesignClass.getKey("sections.loader.completeStep.icon.src")),n=Qe(()=>e.configDesignClass.getKey("sections.loader.activeStep.color")),r=Qe(()=>e.configDesignClass.getKey("sections.loader.completeStep.color")),a=Qe(()=>t.value?n.value:r.value),l=Qe(()=>t.value?e.configDesignClass.getKey("sections.loader.activeStep.icon.color"):e.configDesignClass.getKey("sections.loader.completeStep.icon.color")),c=Qe(()=>an(e.configDesignClass,"inside"));return(u,g)=>(mi(),er("li",{class:Ds(["message-system tw:text-left tw:relative tw:w-full tw:text-white tw:w-fit tw:whitespace-break-spaces tw:transition-colors tw:duration-[250ms] tw:ease-[ease]",s.value]),"data-height":u.configDesignClass.getKey("sections.loader.completeStep.verticalSpacing"),style:ss({"padding-top":u.configDesignClass.getKey("sections.loader.completeStep.verticalSpacing")+"px"})},[Xe("hr",{class:"tw:w-[1px] tw:bg-white tw:opacity-20 tw:absolute",style:ss([{display:"none"},{height:u.configDesignClass.getKey("sections.loader.completeStep.verticalSpacing")-2+"px",left:u.configDesignClass.getKey("sections.loader.completeStep.icon.size")/2+4+"px",top:"0px"}])},null,4),Xe("div",{key:"message",class:Ds(["message-text flex tw:space-between tw:gap-3 tw:flex tw:items-center tw:align-center",{"tw:mb-0":u.isLast}])},[Xe("div",du,[Xe("div",{innerHTML:i.value,class:Ds(["svg-inherit",{"tw:animate-spin":t.value}]),style:ss({color:l.value,height:u.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px",width:u.configDesignClass.getKey("sections.loader.completeStep.icon.size")+"px"})},null,14,fu)]),Xe("div",gu,[u.message.meta?tr("",!0):(mi(),er("p",{key:0,style:ss({color:a.value,"font-size":u.configDesignClass.getKey("sections.loader.completeStep.fontSize")+"px"})},Jn(u.message.text),5)),u.message.meta?(mi(),cu(au(st),{key:1,style:ss({color:e.activeMessage?"rgba(255, 255, 255, 0.60)":"#3F3F46",background:e.activeMessage?"#2F2F31":"#ECEDEE",border:e.activeMessage?"none":"1px solid #fff"}),class:Ds(["tw:flex tw:items-center tw:gap-1 tw:rounded-md tw:shadow-xs",c.value])},{default:lu(()=>[g[0]||(g[0]=Xe("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[Xe("path",{d:"M10.7935 1.33301H5.20683C2.78016 1.33301 1.3335 2.77967 1.3335 5.20634V10.7863C1.3335 13.2197 2.78016 14.6663 5.20683 14.6663H10.7868C13.2135 14.6663 14.6602 13.2197 14.6602 10.793V5.20634C14.6668 2.77967 13.2202 1.33301 10.7935 1.33301ZM6.62683 8.84634C6.1735 9.52634 5.54683 10.0797 4.8135 10.4463C4.74683 10.4797 4.66683 10.4997 4.5935 10.4997C4.40683 10.4997 4.2335 10.3997 4.14683 10.2263C4.02016 9.97967 4.12016 9.67967 4.3735 9.55301C4.9535 9.26634 5.44683 8.82634 5.80016 8.29301C5.92016 8.11301 5.92016 7.88634 5.80016 7.70634C5.44016 7.17301 4.94683 6.73301 4.3735 6.44634C4.12016 6.32634 4.02016 6.02634 4.14683 5.77301C4.26683 5.52634 4.56683 5.42634 4.8135 5.55301C5.54683 5.91967 6.1735 6.47301 6.62683 7.15301C6.9735 7.66634 6.9735 8.33301 6.62683 8.84634ZM11.3335 10.4997H8.66683C8.3935 10.4997 8.16683 10.273 8.16683 9.99967C8.16683 9.72634 8.3935 9.49967 8.66683 9.49967H11.3335C11.6068 9.49967 11.8335 9.72634 11.8335 9.99967C11.8335 10.273 11.6068 10.4997 11.3335 10.4997Z",fill:"currentColor"})],-1)),Xe("span",null,Jn(u.message.text),1)]),_:1,__:[0]},8,["style","class"])):tr("",!0)])],2)],14,uu))}});class pu{structure;options;html="";constructor(e,t){this.structure=e,this.options={escape:t?.escape??!0,whitelistStyles:t?.whitelistStyles??["color","background","borderColor","borderRadius"]}}build(e){return this.html=this.renderLayout(this.structure.layout,this.structure.bindings||{},e),this}buildStyle(e){return Object.entries(e).forEach(([t,s])=>{const i=new RegExp(`data-visual="${this.escapeRegExp(t)}"`,"g"),n=Object.entries(s.style).map(([r,a])=>`${r}: ${a};`).join("");this.html=this.html.replace(i,`class="${s.class}" style="${n}"`)}),this}result(){return this.html}renderLayout(e,t,s){let i=e;return t&&(Object.entries(t).forEach(([n,r])=>{const a=new RegExp(`\\{${this.escapeRegExp(n)}\\}`,"g");if(r.type==="text"){const l=s?.[n]?.text;i=i.replace(a,this.safeText(typeof l=="string"||typeof l=="number"?String(l):""));return}if(r.type==="button"){const l=s?.[n]?.text;i=i.replace(a,this.safeText(typeof l=="string"||typeof l=="number"?String(l):""));return}if(r.type==="repeater"){const l=Array.isArray(s?.[n])?s[n]:[],c=r.layout||"",u=r.bindings||{},g=l.map(h=>this.renderLayout(c,u,h)).join("");i=i.replace(a,g);return}}),i=i.replace(/style=\"([^\"]*)\"/g,(n,r)=>{const a=r.split(";").map(l=>l.trim()).filter(Boolean).filter(l=>{const[c]=l.split(":");return this.options.whitelistStyles.includes((c||"").trim())}).join("; ");return`style="${this.safeAttr(a)}"`})),i}safeText(e){return this.options.escape?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\"/g,""").replace(/'/g,"'"):e}safeAttr(e){return this.safeText(e)}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}const mu={layout:'<div class="tw:flex tw:flex-col" data-visual="container"><div><span data-visual="headerChip">Action</span></div><div class="tw:flex tw:mb-2 tw:mt-2 tw:text-xs"><div data-visual="title">{title}</div></div><div class="tw:flex tw:gap-1"><button data-cb="confirm" data-visual="actionConfirm" class="tw:flex-1">{actionConfirm}</button><button data-cb="cancel" data-visual="actionCancel" class="tw:flex-1">{actionCancel}</button></div></div>',bindings:{title:{type:"text"},actionConfirm:{type:"button"},actionCancel:{type:"button"}}},{computed:ie}=await z("vue");function _u(o){const e=ie(()=>{const y=o?.getKeyObject("sections.inside.activeSnippet"),S=o?.getKeyObject("sections.activeSnippet"),C=y&&y!=="undefined"?y:S;return C&&C!=="undefined"?C:{}}),t=(y,S)=>{if(!S)return y;switch(S){case"outlined":return{color:y.background,background:"transparent",border:`1px solid ${y.borderColor||y.background}`};case"invisible":return{color:y.background,background:"transparent"};default:return y}},s=ie(()=>o?.getKey("sections.inside.activeSnippet.element.bgColor")),i=ie(()=>o?.getKey("sections.inside.activeSnippet.element.color")),n=ie(()=>o?.getKey("sections.inside.activeSnippet.element.sidePadding")),r=ie(()=>o?.getKey("sections.inside.activeSnippet.element.verticalSpacing")),a=ie(()=>o?.getKey("sections.inside.activeSnippet.element.borderWidth")+"px solid "+o?.getKey("sections.inside.activeSnippet.element.borderColor")),l=ie(()=>({color:e.value?.headerChip?.color,background:e.value?.headerChip?.bgColor,borderColor:e.value?.headerChip?.borderColor,bgColor:e.value?.headerChip?.bgColor})),c=ie(()=>t(l.value,e.value?.headerChip?.bgType)),u=ie(()=>({...c.value,"border-radius":o?.getKey("settings.globalRoundingRadius")?us(o,2).borderRadius:e.value?.headerChip?.borderRadius+"px","font-size":e.value?.headerChip?.fontSize+"px"})),g=ie(()=>e.value?.propertyColor),h=ie(()=>e.value?.valueColor),p=ie(()=>({color:e.value?.yesButton?.color,background:e.value?.yesButton?.bgColor})),f=ie(()=>({color:e.value?.noButton?.color,background:e.value?.noButton?.bgColor})),d=ie(()=>{const y=o?.getKey("sections.inside.activeSnippet.params.size"),S=o?.getKey("sections.inside.params.size");return Fi(y!=="undefined"?y:S)}),m=ie(()=>{const y=o?.getKey("sections.inside.activeSnippet.headerChip.size");return Fi(y)}),w=y=>{const S=(y.id||"").toLowerCase(),T=S==="confirm"||S==="yes"?p.value:f.value,k=o?.getKey("sections.inside.activeSnippet.params.buttonStyle");return t(T,k)},_=ie(()=>o?.getKey("settings.globalRoundingRadius")?us(o,8):{borderRadius:o?.getKey("sections.inside.activeSnippet.element.borderRadius")+"px"});return{containerBg:s,containerColor:i,sidePadding:n,verticalSpacing:r,headerChip:u,propertyColor:g,border:a,valueColor:h,yesButton:p,noButton:f,buttonStyle:w,getButtonStyle:t,actionBtnSizeClass:d,buttonRadiusStyle:_,chipSizeClass:m}}const{defineComponent:yu}=await z("vue"),{openBlock:wu,createElementBlock:Cu}=await z("vue"),vu=["innerHTML"],{computed:Rs}=await z("vue"),bu=yu({__name:"DynamicSnippet",props:{structure:{},data:{},message:{},configDesignClass:{}},emits:["action"],setup(o,{emit:e}){const t=o,{containerBg:s,containerColor:i,headerChip:n,yesButton:r,noButton:a,actionBtnSizeClass:l,buttonRadiusStyle:c,verticalSpacing:u,sidePadding:g,valueColor:h,getButtonStyle:p,border:f,chipSizeClass:d}=_u(t.configDesignClass),m=Rs(()=>t.configDesignClass?.getKey("sections.inside.activeSnippet.params.buttonStyle")),w=Rs(()=>({background:s.value,color:i.value,"border-radius":t.configDesignClass?.getKey("settings.globalRoundingRadius")?c.value.borderRadius:t.configDesignClass?.getKey("sections.inside.activeSnippet.element.borderRadius")+"px",border:f.value,padding:`${g.value}px`,gap:`${u.value}px`})),_=Rs(()=>({container:{style:w.value},headerChip:{style:n.value,class:d.value},actionConfirm:{class:l.value,style:{...p(r.value,m.value),flex:"1","line-height":"1","border-radius":t.configDesignClass?.getKey("settings.globalRoundingRadius")?c.value.borderRadius:t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.borderRadius")+"px","font-size":t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.fontSize")+"px"}},title:{style:{color:h.value,"font-size":t.configDesignClass?.getKey("sections.inside.activeSnippet.element.fontSize")+"px"}},actionCancel:{class:l.value,style:{...p(a.value,m.value),flex:"1","line-height":"1","border-radius":t.configDesignClass?.getKey("settings.globalRoundingRadius")?c.value.borderRadius:t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.borderRadius")+"px","font-size":t.configDesignClass?.getKey("sections.inside.activeSnippet.yesButton.fontSize")+"px"}}})),y=e,S=Rs(()=>new pu(t.structure).build(t.data).buildStyle(_.value).result()),C=T=>{const k=T.target;if(!k)return;const x=k.closest("[data-cb]")?.getAttribute("data-cb");x&&t.message.snippet?.sequence&&y("action",x,t.message.snippet.sequence)};return(T,k)=>(wu(),Cu("div",{class:"tw:mt-1 tw:mb-1 tw:max-w-[65%]",onClick:C,innerHTML:S.value},null,8,vu))}}),{defineComponent:Su}=await z("vue"),{unref:sr,createElementVNode:ir,normalizeClass:_i,normalizeStyle:yi,openBlock:mt,createElementBlock:Ms,createCommentVNode:nr,renderList:xu,Fragment:rr,createBlock:wi,resolveDynamicComponent:Tu,renderSlot:ku}=await z("vue"),Du=["innerHTML"],{ref:Ru,watch:Mu,nextTick:zu,computed:Ci}=await z("vue"),Bu=Su({__name:"MessageList",props:{messages:{},isPreview:{type:Boolean},isEmbedded:{type:Boolean},showWelcome:{type:Boolean},sectionBorderRadius:{},isLoading:{type:Boolean},isStreaming:{type:Boolean},configDesignClass:{},activeMessage:{},traceLastShown:{type:Boolean},isProduction:{type:Boolean}},emits:["handleClickMessage","handleSnippetAction"],setup(o,{emit:e}){const t=Ru(null),s=o,i=e,n=f=>{f.meta&&i("handleClickMessage",f)},r=Ci(()=>s.messages.filter((f,d,m)=>s.isProduction?!(f.type==="usageTokensByAI"||f.isSystem&&m[d+1]?.isSystem):!0));Mu(s.messages,()=>{l()&&a()},{deep:!0});const a=()=>{zu(()=>{t.value&&(t.value.scrollTop=t.value.scrollHeight)})},l=()=>{if(!t.value)return!0;const f=t.value;return f.scrollHeight-f.scrollTop-f.clientHeight<=24},c=()=>{},u=f=>{const d=f.replace("#",""),m=parseInt(d.substr(0,2),16),w=parseInt(d.substr(2,2),16),_=parseInt(d.substr(4,2),16),y=Math.max(0,m-12),S=Math.max(0,w-12),C=Math.max(0,_-12);return`linear-gradient(180deg, rgba(${y}, ${S}, ${C}, 0.95) 0%, rgba(0,0,0, 0) 100%)`},g=Ci(()=>{switch(s.configDesignClass.getKey("sections.inside.welcomeMessage.size")){case"sm":return"tw:px-1.5 tw:py-2.5";case"md":return"tw:px-3 tw:py-4";case"lg":return"tw:px-4.5 tw:py-5.5"}}),h=Ci(()=>s.configDesignClass.getKey("sections.inside.welcomeMessage.bgType")==="gradient"?u(s.configDesignClass.getKey("sections.inside.welcomeMessage.bgColor")):s.configDesignClass.getKey("sections.inside.welcomeMessage.bgType")==="bubble"?s.configDesignClass.getKey("sections.inside.welcomeMessage.bgColor"):"transparent"),p=f=>s.configDesignClass.getKey("settings.globalRoundingRadius")?s.sectionBorderRadius.borderRadius:s.configDesignClass.getKey(f?"sections.inside.messageUser.borderRadius":"sections.inside.messageBot.borderRadius")+"px";return(f,d)=>(mt(),Ms("ul",{class:"message-list tw:overflow-y-scroll tw:flex-1 tw:list-none tw:pb-4",ref_key:"messageListRef",ref:t,onScroll:c},[f.showWelcome?(mt(),Ms("li",{key:0,class:_i(["tw:text-"+(f.configDesignClass.getKey("sections.inside.params.size")==="sm"?"xs":f.configDesignClass.getKey("sections.inside.params.size")==="md"?"sm":"base")]),style:yi({color:f.configDesignClass.getKey("sections.inside.messageUser.color"),"margin-bottom":`${f.configDesignClass.getKey("settings.gapMessageLine")}px`})},[ir("div",{key:"message",class:_i(g.value),style:yi({borderRadius:f.configDesignClass.getKey("settings.globalRoundingRadius")?f.sectionBorderRadius.borderRadius:f.configDesignClass.getKey("sections.inside.welcomeMessage.borderRadius")+"px",color:f.configDesignClass.getKey("sections.inside.welcomeMessage.color"),background:h.value,lineHeight:f.configDesignClass.getKey("settings.lineHeight"),fontSize:f.configDesignClass.getKey("sections.inside.welcomeMessage.fontSize")+"px",letterSpacing:f.configDesignClass.getKey("settings.letterSpacing")+"px"})},[ir("div",{innerHTML:sr(Si)(f.configDesignClass.getKey("texts.welcomeMessage"))},null,8,Du)],6)],6)):nr("",!0),(mt(!0),Ms(rr,null,xu(r.value,(m,w)=>(mt(),Ms(rr,{key:w},[m.snippet?(mt(),wi(bu,{key:0,structure:sr(mu),data:m.snippet.data,message:m,configDesignClass:f.configDesignClass,onAction:d[0]||(d[0]=(_,y)=>i("handleSnippetAction",_,y))},null,8,["structure","data","message","configDesignClass"])):(mt(),wi(Tu(m.isUser?Nc:m.isSystem?f.isProduction?Qn:hu:Kc),{key:1,message:m,"data-component":m.isSystem?f.isProduction?"LoadingMessage":"MessageSystem":"MessageBot",style:yi({borderRadius:p(m.isUser),"margin-top":`${r.value[w-1]?.isSystem&&!m.isSystem?"12px":"0px"}`,"margin-bottom":`${m.isSystem?"2px":f.configDesignClass.getKey("settings.gapMessageLine")+"px"}`,lineHeight:f.configDesignClass.getKey("settings.lineHeight"),letterSpacing:f.configDesignClass.getKey("settings.letterSpacing")+"px"}),loader:f.configDesignClass.getKey("settings.loader"),color:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.color"):f.configDesignClass.getKey("sections.inside.messageBot.color"),welcomeColor:f.configDesignClass.getKey("sections.inside.messageUser.color"),bgType:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.bgType"):f.configDesignClass.getKey("sections.inside.messageBot.bgType"),bgColor:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.bgColor"):f.configDesignClass.getKey("sections.inside.messageBot.bgColor"),size:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.size"):f.configDesignClass.getKey("sections.inside.messageBot.size"),fontSize:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.fontSize"):f.configDesignClass.getKey("sections.inside.messageBot.fontSize"),borderWidth:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.borderWidth"):f.configDesignClass.getKey("sections.inside.messageBot.borderWidth"),borderColor:m.isUser?f.configDesignClass.getKey("sections.inside.messageUser.borderColor"):f.configDesignClass.getKey("sections.inside.messageBot.borderColor"),index:w,traceLastShown:f.traceLastShown,configDesignClass:f.configDesignClass,activeMessage:f.activeMessage===m,isLast:w===r.value.length-1,onClick:_=>n(m)},null,8,["message","data-component","style","loader","color","welcomeColor","bgType","bgColor","size","fontSize","borderWidth","borderColor","index","traceLastShown","configDesignClass","activeMessage","isLast","onClick"]))],64))),128)),f.isLoading?(mt(),wi(Qn,{key:1,class:_i({"tw:mt-8":f.traceLastShown}),loader:f.configDesignClass.getKey("settings.loader"),configDesignClass:f.configDesignClass,text:f.configDesignClass.getKey("texts.typingLoader")},null,8,["class","loader","configDesignClass","text"])):nr("",!0),ku(f.$slots,"footer")],544))}}),{defineComponent:Pu}=await z("vue"),{createVNode:Eu,normalizeStyle:$u,openBlock:Lu,createElementBlock:Ou}=await z("vue"),{computed:Ku}=await z("vue"),Au=Pu({__name:"ChatMessagesContainer",props:{messages:{},isPreview:{type:Boolean},isEmbedded:{type:Boolean},sectionBorderRadius:{},isLoading:{type:Boolean},isStreaming:{type:Boolean},configDesignClass:{},activeMessage:{},showWelcome:{type:Boolean},isProcessError:{type:Boolean},restartChat:{type:Function},traceLastShown:{type:Boolean},isProduction:{type:Boolean}},emits:["handleClickMessage","update:activeMessage","handleSnippetAction"],setup(o,{emit:e}){const t=o,s=e,i=Ku({get:()=>t.activeMessage,set:n=>s("update:activeMessage",n)});return(n,r)=>(Lu(),Ou("div",{class:"tw:flex tw:flex-col tw:justify-between tw:w-full tw:min-h-0",style:$u([{flex:"1 1 0"},{paddingLeft:(n.configDesignClass.getKey("sections.inside.params.sidePadding")??8)+"px",paddingRight:(n.configDesignClass.getKey("sections.inside.params.sidePadding")??8)+"px",paddingTop:(n.configDesignClass.getKey("sections.inside.params.verticalPadding")??8)/2+"px"}])},[Eu(Bu,{messages:n.messages,isPreview:n.isPreview,isEmbedded:n.isEmbedded,configDesignClass:n.configDesignClass,isLoading:n.isLoading,isStreaming:n.isStreaming,isProduction:n.isProduction,sectionBorderRadius:n.sectionBorderRadius,showWelcome:n.showWelcome,activeMessage:i.value,"onUpdate:activeMessage":r[0]||(r[0]=a=>i.value=a),traceLastShown:n.traceLastShown,onHandleClickMessage:r[1]||(r[1]=a=>n.$emit("handleClickMessage",a)),onHandleSnippetAction:r[2]||(r[2]=(a,l)=>s("handleSnippetAction",a,l))},null,8,["messages","isPreview","isEmbedded","configDesignClass","isLoading","isStreaming","isProduction","sectionBorderRadius","showWelcome","activeMessage","traceLastShown"])],4))}}),{defineComponent:Iu}=await z("vue"),{vShow:or,createVNode:$t,withDirectives:ar,normalizeStyle:is,createElementVNode:lr,openBlock:_t,createElementBlock:Lt,createCommentVNode:vi,createBlock:Vu,Transition:Fu,withCtx:Wu,normalizeClass:cr}=await z("vue"),Uu={key:0,class:"chat tw:w-full tw:h-full tw:flex tw:pt-0 tw:relative",style:{overflow:"hidden"}},Nu={key:0,class:"tw:w-full tw:h-full"},Hu={key:1,class:"messages tw:flex tw:flex-col tw:justify-between tw:w-full"},{ref:V,onMounted:ur,onUnmounted:dr,watch:zs,computed:yt,nextTick:bi}=await z("vue"),ns=0,N1=Iu({__name:"ChatWrapper",props:{link:{},isEmbedded:{type:Boolean},isPreview:{type:Boolean},configWidget:{},configLink:{},scenario:{},scenarioOptions:{},widgetId:{},isProduction:{type:Boolean}},emits:["trace","choose-trace"],setup(o,{expose:e,emit:t}){const s=t,i=V(!1),n=V(!1),r=V(null),a=V(!1),l=V(!1),c=V(!1),u=V(!1),g=V(!0),h=V(!1),p=V(!1),f=V(!1),d=V(0),m=V(!1),w=V(null),_=o,y=async()=>{if(!(_.isPreview||_.scenario))try{xo(),await ws()}catch(v){console.error("Failed to restart chat connection",v)}},S=yt(()=>{const v=M.value.getKey("settings.position"),b=M.value.getKey("settings.offset.x"),R=M.value.getKey("settings.offset.y"),K=$.value?M.value.getKey("settings.size.width"):M.value.getKey("sections.colapsed.width"),se=$.value?M.value.getKey("settings.size.height"):M.value.getKey("sections.colapsed.height");return{...{...v==="topLeft"?{top:R+"px",left:b+"px"}:{},...v==="topRight"?{top:R+"px",right:b+"px"}:{},...v==="bottomLeft"?{bottom:R+"px",left:b+"px"}:{},...v==="bottomRight"?{bottom:R+"px",right:b+"px"}:{},...v==="top"?{top:R+"px",left:"50%",transform:"translateX(-50%)"}:{},...v==="bottom"?{bottom:R+"px",left:"50%",transform:"translateX(-50%)"}:{},...v==="left"?{left:b+"px",top:"50%",transform:"translateY(-50%)"}:{},...v==="right"?{right:b+"px",top:"50%",transform:"translateY(-50%)"}:{}},width:$.value&&!Se.value?K+"px":void 0,height:$.value||Se.value?se+"px":void 0}}),C=()=>{if(_.configLink)return _.configLink;const b=new URLSearchParams(window.location.search).get("config");if(b)return b},T=V(null),k=V(null),D=()=>C()?k.value:_.configWidget?_.configWidget:Pe,x=yt(()=>{const v=D(),{isValid:b,errors:R}=$l(v);return b?v:(console.warn("[HSW] Invalid widget config, falling back to DEFAULT_CONFIG:",R),Pe)}),P=v=>{T.value=v,s("choose-trace",{action:v.type,messages:[v]})},I=async()=>{s("choose-trace",{action:"copyAll",messages:Z.value})},L=async()=>{if(Z.value.length===0){s("choose-trace",{action:"copyLast",messages:[]});return}let v=-1;for(let R=Z.value.length-1;R>=0;R--)if(Z.value[R].isUser){v=R;break}const b=v>=0?v:0;s("choose-trace",{action:"copyLast",messages:Z.value.slice(b)})},O=async v=>{switch(v.action){case"copyLast":await L();break;case"copyIteration":await L();break;case"copyAll":await I();break}},M=yt(()=>new Ll(x.value)),j=yt(()=>hr(M.value)),F=yt(()=>us(M.value,8)),Y=yt(()=>{switch(M.value.getKey("sections.bottom.params.size")){case"sm":return"tw:min-h-[25px]";case"md":return"tw:min-h-[45px]";case"lg":return"tw:min-h-[60px]"}}),$=V(!0),Dt=()=>{const v=r.value;if(!v)return{width:56,height:56};const b=v.querySelector(".chat-action");if(!b)return{width:56,height:56};const R=b.getBoundingClientRect();return{width:Math.max(1,R.width),height:Math.max(1,R.height)}},$e=V(!1),lt=async v=>{if($e.value)return;$e.value=!0;const b=r.value;if(!b||v===$.value)return;const R=b.querySelector(".chatWrapper"),K=R?.querySelector(".chat");if(v){const se=b.querySelector(".chat-collapsed");se&&(E.killTweensOf(se),E.to(se,{opacity:0,duration:.15,ease:"power2.in"}));const{height:Fe,width:qs}=Dt();await new Promise(Mo=>setTimeout(Mo,150)),$.value=!0,await bi();const Gt=Math.max(Fe||0,qs||0)||56;E.killTweensOf(b),K&&E.killTweensOf(K),R&&E.killTweensOf(R),Se.value&&E.set(b,{position:"absolute",left:"50%",top:"50%",xPercent:-50,yPercent:-50}),E.set(b,{width:Gt,height:Gt,overflow:"hidden",opacity:0,willChange:"width, height, opacity"}),R&&E.set(R,{opacity:0,willChange:"opacity"}),K&&E.set(K,{opacity:0,willChange:"opacity"}),E.to(b,{width:M.value.getKey("settings.size.width"),height:M.value.getKey("settings.size.height"),opacity:1,duration:.4,ease:"power2.out",onComplete:()=>{E.set(b,{clearProps:"overflow,position,left,top,xPercent,yPercent,marginTop,willChange,opacity"}),$e.value=!1}}),R&&E.to(R,{opacity:1,duration:.3,delay:.1,ease:"power2.out",onComplete:()=>{E.set(R,{clearProps:"willChange,opacity"})}}),K&&E.to(K,{opacity:1,duration:.3,delay:.15,ease:"power2.out",onComplete:()=>{E.set(K,{clearProps:"willChange"})}})}else{const se=M.value.getKey("sections.colapsed.height")+M.value.getKey("sections.colapsed.borderWidth")*2;E.killTweensOf(b),K&&E.killTweensOf(K),R&&E.killTweensOf(R),Se.value&&E.set(b,{position:"absolute",left:"50%",top:"50%",xPercent:-50,yPercent:-50}),E.set(b,{width:M.value.getKey("settings.size.width"),height:M.value.getKey("settings.size.height"),overflow:"hidden",willChange:"width, height, opacity"}),R&&(E.set(R,{willChange:"opacity"}),E.to(R,{opacity:0,duration:.5,ease:"power3.inOut",onComplete:()=>{E.set(R,{clearProps:"willChange,opacity"})}})),K&&(E.set(K,{willChange:"opacity"}),E.to(K,{opacity:0,duration:.2,ease:"power2.in",onComplete:()=>{E.set(K,{clearProps:"willChange"})}})),E.to(b,{width:se,height:se,opacity:0,duration:.35,marginTop:0,ease:"power2.inOut",onComplete:()=>{$.value=!1,bi().then(()=>{const Fe=b.querySelector(".chat-collapsed");Fe&&(E.set(Fe,{opacity:0}),E.to(Fe,{opacity:1,duration:.25,ease:"power2.out"})),E.set(b,{opacity:1})}),E.set(b,{clearProps:"overflow,position,left,top,xPercent,yPercent,marginTop,willChange"}),$e.value=!1}})}},ae=V(_.isPreview||!1),Se=V(_.isEmbedded||!1);zs(()=>_.isEmbedded,v=>{Se.value=v});const ze=V(!!_.isPreview),ce=V(_.widgetId||`hsw-${Math.random().toString(36).slice(2,10)}`),Z=V([]),Rt=V("");let J=null,ct=0;const vo=yt(()=>Z.value.length>0&&Z.value[Z.value.length-1].isUser===!0||l.value),Ns=V(null),bo=(v,b)=>{console.log("handleSnippetAction",v,b),un({action:{sequence:b,command:v,data:{}}})},xe=v=>{if(v.chunkId&&v.text){const b=Z.value[Z.value.length-1];b.chunkId===v.chunkId?(v.chunk?.start?b.text="":b.text+=v.text,b.chunk.start=!1):Z.value.push(v)}else Z.value.push(v)},qt=(()=>{if(_.link)return _.link;const b=new URLSearchParams(window.location.search).get("link");if(b)return b;const K=new URLSearchParams(window.location.hash.substring(1)).get("link");if(K)return K;try{const se="ws://localhost:8080/client/widget-chat/v1/ws/?token=E5CPOfNv0veaiK5AlBXl_jGfOZDkhqnf1NaAUjqw5fNpArKMjlIO1QOUbm7iOzmAvr5QulcBeyr_ke3Neyy1EqhkOeOzdnAaKUvKEqFgTKhW11vePCl9oxoAlsMIknbuAbDdQ93Zg5vjU5ippynFWF6o";if(se)return se}catch(se){console.warn("Environment variables not available:",se)}return console.log("Using fallback link: ws://localhost:3000"),"ws://localhost:3000"})(),ln=()=>{if(ct>=ns){xe({text:`Failed to connect after ${ns} attempts. Please check your connection.`,isUser:!1});return}ct++,console.log(`Reconnection attempt ${ct}/${ns}`),setTimeout(()=>{Hs()},2e3*ct)},So=()=>{xe({text:wo.UserMessage,isUser:!0}),xe({text:"{Agent response message}",isUser:!1})},Hs=()=>{try{if(!qt||typeof qt!="string"){console.error("Invalid WebSocket link:",qt),xe({text:"Error: Invalid WebSocket URL",isUser:!1});return}if(console.log("Attempting to connect to:",qt),J=new WebSocket(qt),!J){console.error("Failed to create WebSocket instance");return}J.onmessage=v=>{try{const b=JSON.parse(v.data);if(b.snippet)return xe({snippet:{...b.snippet,data:JSON.parse(b.snippet.data||"{}")},isUser:!1,isSystem:!0,isError:!1});if(b.error)return xe({text:b.error.message,isUser:!1,isSystem:!0,isError:!0});if(b?.textChunk?.start&&(m.value=!0,w.value=b?.textChunk?.start,xe({text:"",isUser:!1,chunkId:b?.textChunk?.start,chunk:b?.textChunk})),b?.textChunk?.end||b?.textChunk?.start){b?.textChunk?.end&&w.value&&b?.textChunk?.end===w.value&&(m.value=!1,w.value=null);return}b?.textChunk?.text&&xe({text:b.textChunk.text,isUser:!1,chunkId:b?.textChunk?.id}),b?.trace&&xe({text:b.trace.message,isUser:!1,isSystem:!0,meta:b.trace.meta,time:b.trace.time,type:b.trace.type}),b?.trace?.meta&&!_.isProduction&&s("trace",{action:b.trace.type,messages:[b.trace]})}catch(b){console.error("Error parsing WebSocket message:",b),xe({text:"Error: Failed to parse server response",isUser:!1})}},J.onopen=()=>{ct=0},J.onclose=v=>{console.log("Connection closed",v);let b=`Connection closed (${v.code})`;switch(v.code){case 1e3:b="Connection closed normally";break;case 1001:b="Connection closed: going away";break;case 1006:if(u.value=!0,ct<ns&&!ae.value){ln();return}break;case 1011:b="Connection closed: server error";break;default:c.value=!0}console.log(b)},J.onerror=v=>{console.error("WebSocket connection error:",v),a.value=!0,xe({text:"Connection error: Unable to connect to chat server",isUser:!1,isSystem:!0,isError:!0}),ct<ns&&!ae.value&&ln()}}catch(v){console.error("Error connecting to socket server:",v),xe({text:`Connection error: ${v instanceof Error?v.message:"Unknown error"}`,isUser:!1,isSystem:!0,isError:!0})}},xo=()=>{J&&J.close(),J=null};dr(()=>{J&&J.close()});const cn=()=>{_.isPreview||_.scenario||lt(!$.value)},To=()=>{if(!(_.isPreview||_.scenario)&&Rt.value.trim()!==""){if(_.isProduction&&Z.value.length>0){const v=Z.value[Z.value.length-1];v.isSystem===!0&&!v.isError&&!v.snippet&&Z.value.pop()}Z.value.push({text:Rt.value,isUser:!0}),m.value=!0,un({message:Rt.value}),Rt.value=""}},un=v=>{J&&J.send(JSON.stringify(v))},dn=()=>{try{const v=M.value.getKey("settings.fontFamily")||"MacPaw Fixel",b=`https://fonts.googleapis.com/css2?family=${v.replace(/\s+/g,"+")}:wght@300;400;500;600;700&display=swap`,R=document.createElement("link");R.rel="preload",R.as="style",R.href=b,document.head.appendChild(R);const K=document.createElement("link");K.rel="stylesheet",K.href=b,K.setAttribute("data-google-font","true"),document.head.appendChild(K),r.value&&(r.value.style.fontFamily=`"${v}", sans-serif`)}catch(v){console.error("Error loading font:",v)}},fn=()=>{const v=M.value.getKey("settings.fontWeight")||400;r.value&&(r.value.style.fontWeight=v)};n.value=!0,zs(()=>M.value.getKey("settings.fontFamily"),()=>{dn()}),zs(()=>M.value.getKey("settings.fontWeight"),()=>{fn()});const ko=async()=>{if(C()){const b=await(await fetch(C()+"config")).json();k.value=b,i.value=!0}else i.value=!0},js=(v,b,R)=>new Promise(K=>{const se=performance.now(),Fe=qs=>{const Gt=Math.min(1,(qs-se)/R);d.value=v+(b-v)*Gt,Gt<1?requestAnimationFrame(Fe):K()};requestAnimationFrame(Fe)}),gn=async v=>{f.value=!0,d.value=0,await bi(),await js(0,.3,500),v(),await js(.3,.6,200),d.value=.6,await new Promise(b=>setTimeout(b,100)),await js(.6,0,500),f.value=!1},Zs=async(v,b)=>{await gn(()=>{const R=Nn.getState(v,M.value,b||_.scenarioOptions);if($.value=R.isChatOpen,Z.value=R.messages,l.value=R.traceLastShown,a.value=R.isConnectionError,c.value=R.isProcessError,u.value=R.isReconnectError,h.value=R.isInputDisabled,g.value=R.showWelcome,p.value=R.showReconnectNotice??!1,Ns.value=R.snippet??null,ae.value=!0,J){try{J.close()}catch{}J=null}})},ws=async()=>{await gn(()=>{ae.value=ze.value,g.value=!0,h.value=!1,p.value=!1,a.value=!1,c.value=!1,u.value=!1,Z.value=[],ae.value||(!J||J.readyState!==1)&&Hs()})};ur(async()=>{await ko(),dn(),fn();const v=_.scenario??Nn.getScenarioFromUrl();if(v){await Zs(v);return}if(_.isPreview){So();return}Hs()}),zs(()=>_.scenario,async v=>{v?await Zs(v):await ws()});const Te={id:ce,setScenario:async(v,b)=>{await Zs(v,b)},clearScenario:async()=>{await ws()},setOpen:v=>{$.value=v},setActive:v=>{v&&!$.value&&($.value=!0)},setInputDisabled:v=>{h.value=v},setShowReconnectNotice:v=>{p.value=v},setMessages:v=>{Z.value=Array.isArray(v)?v:[]},pushMessage:v=>{Z.value.push(v)},setSnippet:v=>{Ns.value=v??null},resetToLive:async()=>{await ws()}},Do=()=>{const v=window;v.hswWidgets=v.hswWidgets||{},v.hswWidgets[ce.value]=Te,window.dispatchEvent(new CustomEvent("hsw:ready",{detail:{widgetId:ce.value}}))},Ro=()=>{const v=window;v.hswWidgets&&v.hswWidgets[ce.value]&&delete v.hswWidgets[ce.value]},hn=async v=>{const b=v,R=b.detail?.widgetId;if(R&&R!==ce.value)return;const{action:K}=b.detail;switch(K){case"setScenario":await Te.setScenario(b.detail.payload.type,b.detail.payload.options);break;case"clearScenario":await Te.clearScenario();break;case"setOpen":Te.setOpen(b.detail.payload);break;case"setActive":Te.setActive(b.detail.payload);break;case"setInputDisabled":Te.setInputDisabled(b.detail.payload);break;case"setShowReconnectNotice":Te.setShowReconnectNotice(b.detail.payload);break;case"setMessages":Te.setMessages(b.detail.payload);break;case"pushMessage":Te.pushMessage(b.detail.payload);break;case"setSnippet":Te.setSnippet(b.detail.payload);break;case"resetToLive":await Te.resetToLive();break}};return ur(()=>{Do(),window.addEventListener("hsw:control",hn)}),dr(()=>{Ro(),window.removeEventListener("hsw:control",hn)}),e(Te),(v,b)=>i.value?(_t(),Lt("div",{key:0,class:cr(["tw:z-[999] tw:flex tw:justify-end component-isolator",{"tw:fixed":!Se.value,"tw:w-full":$.value}]),style:is({letterSpacing:M.value.getKey("settings.letterSpacing")+"px",...S.value}),ref_key:"chatWrapperRef",ref:r},[ar($t(Dl,{toggleChat:cn,element:M.value.getKeyObject("sections.colapsed")},null,8,["element"]),[[or,!$.value]]),ar(lr("div",{class:cr(["chatWrapper tw:w-full tw:backdrop-blur-[22px] tw:flex tw:items-center tw:border-0 tw:flex-col",[{"tw:h-auto tw:shadow-2xl chat-active":$.value,"tw:shadow-lg tw:w-fit":!$.value,"chat-embedded tw:w-full tw:h-full tw:static tw:top-0 tw:left-0":Se.value}]]),style:is({background:M.value.getKey("settings.bgChat"),borderRadius:`${String(j.value)}px`})},[$t(jl,{isChatOpen:$.value,toggleChat:cn,configDesignClass:M.value,sectionBorderRadius:F.value,mainBorderRadius:j.value,isPreview:ae.value,isEmbedded:Se.value,isProduction:v.isProduction||!1,restartChat:y},null,8,["isChatOpen","configDesignClass","sectionBorderRadius","mainBorderRadius","isPreview","isEmbedded","isProduction"]),$.value?(_t(),Lt("div",Uu,[a.value?(_t(),Lt("div",Nu,[lr("div",{class:"tw:absolute tw:left-0 tw:top-0 tw:w-full tw:h-full",style:is({padding:M.value.getKey("sections.warnings.launchIssue.content.sidePadding")+"px"})},[$t(xi,{type:"launchIssue",class:"tw:h-full",headlineText:M.value.getKey("texts.launchIssueTitle"),descriptionText:M.value.getKeyObject("texts.launchIssueText"),warningElement:M.value.getKeyObject("sections.warnings.launchIssue"),configDesignClass:M.value,isProcessError:c.value,restartChat:y},null,8,["headlineText","descriptionText","warningElement","configDesignClass","isProcessError"])],4)])):(_t(),Lt("div",Hu,[$t(Au,{messages:Z.value,isPreview:ae.value,isEmbedded:Se.value,configDesignClass:M.value,isLoading:vo.value,isStreaming:m.value,isProduction:v.isProduction,sectionBorderRadius:F.value,showWelcome:g.value,activeMessage:T.value,"onUpdate:activeMessage":b[0]||(b[0]=R=>T.value=R),isProcessError:c.value,snippet:Ns.value,traceLastShown:l.value,onHandleClickMessage:P,onHandleSnippetAction:bo,restartChat:y},null,8,["messages","isPreview","isEmbedded","configDesignClass","isLoading","isStreaming","isProduction","sectionBorderRadius","showWelcome","activeMessage","isProcessError","snippet","traceLastShown"]),c.value?(_t(),Lt("div",{key:0,style:is({padding:M.value.getKey("sections.warnings.connectionIssue.content.sidePadding")+"px"})},[$t(xi,{type:"connectionIssue",headlineText:M.value.getKey("texts.issueText"),configDesignClass:M.value,warningElement:M.value.getKeyObject("sections.warnings.connectionIssue"),restartChat:y},null,8,["headlineText","configDesignClass","warningElement"])],4)):(_t(),Vu(pc,{key:1,messageText:Rt.value,"onUpdate:messageText":b[1]||(b[1]=R=>Rt.value=R),isProduction:v.isProduction||!1,configDesignClass:M.value,sectionBorderRadius:F.value,classSize:Y.value,sendMessage:To,isInputDisabled:h.value,showReconnectNotice:p.value,restartChat:y,isStreaming:m.value,onTrace:O},null,8,["messageText","isProduction","configDesignClass","sectionBorderRadius","classSize","isInputDisabled","showReconnectNotice","isStreaming"]))]))])):vi("",!0),$t(Fu,{name:"fade"},{default:Wu(()=>[f.value?(_t(),Lt("div",{key:0,class:"tw:absolute tw:inset-0 tw:backdrop-blur-[40px] tw:z-[1000]",style:is({borderRadius:`${String(j.value)}px`,backgroundColor:`rgba(0,0,0, ${d.value})`})},null,4)):vi("",!0)]),_:1})],6),[[or,n.value&&$.value]])],6)):vi("",!0)}});export{Pe as D,N1 as _};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as f}from"./ChatWrapper.vue_vue_type_style_index_0_lang-
|
|
1
|
+
import{_ as f}from"./ChatWrapper.vue_vue_type_style_index_0_lang-DixkyFkr.js";export{f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{importShared as s}from"./federation-import-CxlH6xnb.js";import{D as u,_ as p}from"./ChatWrapper.vue_vue_type_style_index_0_lang-
|
|
1
|
+
import{importShared as s}from"./federation-import-CxlH6xnb.js";import{D as u,_ as p}from"./ChatWrapper.vue_vue_type_style_index_0_lang-DixkyFkr.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const e of document.querySelectorAll('link[rel="modulepreload"]'))c(e);new MutationObserver(e=>{for(const t of e)if(t.type==="childList")for(const i of t.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&c(i)}).observe(document,{childList:!0,subtree:!0});function r(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin==="use-credentials"?t.credentials="include":e.crossOrigin==="anonymous"?t.credentials="omit":t.credentials="same-origin",t}function c(e){if(e.ep)return;e.ep=!0;const t=r(e);fetch(e.href,t)}})();const{defineComponent:f}=await s("vue"),{createVNode:d,createElementVNode:m,openBlock:_,createElementBlock:h}=await s("vue"),v={class:"tw:p-3 tw:space-y-3"},w={class:"tw:relative tw:items-center tw:justify-center tw:flex tw:w-[405px]"},{computed:g,ref:a}=await s("vue"),y=f({__name:"App",setup(o){const n=a(u),r=a(""),c=a({userMessageText:"Give me some action",blockSocket:!0});console.log(u);const e=g(()=>r.value||void 0);return(t,i)=>(_(),h("div",v,[m("div",w,[d(p,{"config-widget":n.value,scenario:e.value,"is-production":!0,"scenario-options":c.value},null,8,["config-widget","scenario","scenario-options"])])]))}});/*!
|
|
2
2
|
* pinia v3.0.3
|
|
3
3
|
* (c) 2025 Eduardo San Martin Morote
|
|
4
4
|
* @license MIT
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const p={},g=new Set(["Module","__esModule","default","_export_sfc"]);let b={"./chat":()=>(y(["style-BAqCilbD.css"],!1,"./chat"),E("/static/widget/v1/chat/assets/federation-expose-Chat-
|
|
1
|
+
const p={},g=new Set(["Module","__esModule","default","_export_sfc"]);let b={"./chat":()=>(y(["style-BAqCilbD.css"],!1,"./chat"),E("/static/widget/v1/chat/assets/federation-expose-Chat-Bm8Hs5nl.js").then(e=>Object.keys(e).every(s=>g.has(s))?()=>e.default:()=>e)),"./utils":()=>(y(["style-BAqCilbD.css"],!1,"./utils"),E("/static/widget/v1/chat/assets/federation-expose-Utils-BmSDJTj0.js").then(e=>Object.keys(e).every(s=>g.has(s))?()=>e.default:()=>e))};const w={},y=(e,s,l)=>{const o=import.meta.url;if(typeof o>"u"){console.warn('The remote style takes effect only when the build.target option in the vite.config.ts file is higher than that of "es2020".');return}const i=o.substring(0,o.lastIndexOf("remoteChat.js")),_='/static/widget/v1/chat/';'assets',e.forEach(a=>{let n="";const c=_||i;if(c){const r={trailing:t=>t.endsWith("/")?t.slice(0,-1):t,leading:t=>t.startsWith("/")?t.slice(1):t},m=t=>t.startsWith("http")||t.startsWith("//"),f=r.trailing(c),d=r.leading(a),u=r.trailing(i);m(c)?n=[f,d].filter(Boolean).join("/"):u.includes(f)?n=[u,d].filter(Boolean).join("/"):n=[u+f,d].filter(Boolean).join("/")}else n=a;if(s){const r="css__chat__"+l;window[r]=window[r]||[],window[r].push(n);return}if(n in w)return;w[n]=!0;const h=document.createElement("link");h.rel="stylesheet",h.href=n,document.head.appendChild(h)})};async function E(e){return p[e]??=import(e),p[e]}const C=e=>{if(!b[e])throw new Error("Can not find remote module "+e);return b[e]()},T=e=>{globalThis.__federation_shared__=globalThis.__federation_shared__||{},Object.entries(e).forEach(([s,l])=>{for(const[o,i]of Object.entries(l)){const _=i.scope||"default";globalThis.__federation_shared__[_]=globalThis.__federation_shared__[_]||{};const a=globalThis.__federation_shared__[_];(a[s]=a[s]||{})[o]=i}})};export{y as dynamicLoadingCss,C as get,T as init};
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
background-color: transparent;
|
|
11
11
|
}
|
|
12
12
|
</style>
|
|
13
|
-
<script type="module" crossorigin src="/static/widget/v1/chat/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/static/widget/v1/chat/assets/index-DzIXELKk.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/static/widget/v1/chat/assets/federation-utils-DDIHa9Ih.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/static/widget/v1/chat/assets/federation-import-CxlH6xnb.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/static/widget/v1/chat/assets/federation-expose-Utils-BmSDJTj0.js">
|
|
17
|
-
<link rel="modulepreload" crossorigin href="/static/widget/v1/chat/assets/ChatWrapper.vue_vue_type_style_index_0_lang-
|
|
17
|
+
<link rel="modulepreload" crossorigin href="/static/widget/v1/chat/assets/ChatWrapper.vue_vue_type_style_index_0_lang-DixkyFkr.js">
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/static/widget/v1/chat/assets/style-BAqCilbD.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yartsun/hypershadow-widget",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"prepare": "husky"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
|
-
"dist/**"
|
|
16
|
+
"dist/**",
|
|
17
|
+
"types/**"
|
|
17
18
|
],
|
|
18
19
|
"main": "dist/lib/index.cjs.js",
|
|
19
20
|
"module": "dist/lib/index.es.js",
|
|
@@ -23,6 +24,10 @@
|
|
|
23
24
|
"types": "./dist/lib/index.d.ts",
|
|
24
25
|
"import": "./dist/lib/index.es.js",
|
|
25
26
|
"require": "./dist/lib/index.cjs.js"
|
|
27
|
+
},
|
|
28
|
+
"./standalone": {
|
|
29
|
+
"types": "./types/standalone.d.ts",
|
|
30
|
+
"import": "./dist/standalone/hs-widget.es.js"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"sideEffects": [
|
package/types/index.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SnippetInput } from "./snippet.types";
|
|
2
|
+
|
|
3
|
+
export interface Message {
|
|
4
|
+
text?: string;
|
|
5
|
+
snippet?: SnippetInput;
|
|
6
|
+
isUser: boolean;
|
|
7
|
+
isSystem?: boolean;
|
|
8
|
+
chunkId?: number;
|
|
9
|
+
chunk?: {
|
|
10
|
+
id: number;
|
|
11
|
+
start: boolean;
|
|
12
|
+
};
|
|
13
|
+
meta?: any;
|
|
14
|
+
type?: string;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
time?: number;
|
|
17
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type SnippetElement = "text" | "button" | "chip" | 'repeater';
|
|
2
|
+
|
|
3
|
+
export interface SnippetInput<T = SnippetData> {
|
|
4
|
+
sequence: string;
|
|
5
|
+
id: string;
|
|
6
|
+
data: T extends SnippetData ? T : string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export interface SnippetData {
|
|
10
|
+
[key: string]: {
|
|
11
|
+
text: string;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ActionSend {
|
|
16
|
+
sequence: string,
|
|
17
|
+
command: string,
|
|
18
|
+
data: SnippetData,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface SnippetStructureElement {
|
|
22
|
+
type: SnippetElement,
|
|
23
|
+
layout?: string,
|
|
24
|
+
bindings?: {
|
|
25
|
+
[key: string]: {
|
|
26
|
+
type: SnippetElement
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface SnippetStructure {
|
|
32
|
+
layout: string;
|
|
33
|
+
bindings: {
|
|
34
|
+
[key: string]: SnippetStructureElement
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Public types for the standalone widget entry.
|
|
2
|
+
// This file is shipped with the npm package and is used for ESM/TS imports like:
|
|
3
|
+
// import { mount } from '@yartsun/hypershadow-widget/standalone';
|
|
4
|
+
|
|
5
|
+
export type StandaloneMountOptions = {
|
|
6
|
+
target: string | HTMLElement;
|
|
7
|
+
props?: Record<string, any>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export interface StandaloneWidgetApi {
|
|
11
|
+
id: string | any;
|
|
12
|
+
setScenario: (type: string, options?: any) => Promise<void>;
|
|
13
|
+
clearScenario: () => Promise<void>;
|
|
14
|
+
setOpen: (open: boolean) => void;
|
|
15
|
+
setActive: (active: boolean) => void;
|
|
16
|
+
setInputDisabled: (disabled: boolean) => void;
|
|
17
|
+
setShowReconnectNotice: (show: boolean) => void;
|
|
18
|
+
setMessages: (list: any[]) => void;
|
|
19
|
+
pushMessage: (msg: any) => void;
|
|
20
|
+
setSnippet: (data: any | null) => void;
|
|
21
|
+
resetToLive: () => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Mounts the chat widget into the given DOM target and returns the same control API
|
|
25
|
+
// object that is registered in window.hswWidgets[widgetId].
|
|
26
|
+
export declare function mount(options: StandaloneMountOptions): StandaloneWidgetApi;
|
|
27
|
+
|
|
28
|
+
declare const _default: {
|
|
29
|
+
mount: typeof mount;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default _default;
|
|
33
|
+
|
|
34
|
+
|