@nabeh/chat-widget 0.1.1 → 0.1.3
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 +57 -0
- package/dist/browser.cjs +644 -56
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.iife.js +644 -56
- package/dist/browser.iife.js.map +1 -1
- package/dist/browser.js +1 -1
- package/dist/chunk-LET2O6EB.js +1460 -0
- package/dist/chunk-LET2O6EB.js.map +1 -0
- package/dist/index.cjs +644 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.iife.js +644 -56
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-T4LQIVBI.js +0 -872
- package/dist/chunk-T4LQIVBI.js.map +0 -1
|
@@ -0,0 +1,1460 @@
|
|
|
1
|
+
function nt(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function ve(e,t){let a={...e};for(let n of Object.keys(t)){let i=t[n],l=a[n];if(nt(l)&&nt(i)){a[n]=ve(l,i);continue}i!==void 0&&(a[n]=i)}return a}function at(e){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error("Unexpected widget error")}function J(e,t){return`${e.replace(/\/$/,"")}/${t.replace(/^\//,"")}`}function D(e,t,a){return{"Content-Type":"application/json",...e.customHeaders,...a?{"X-Chat-User-Context":a}:{},...t?{Authorization:`Bearer ${t}`}:{}}}async function q(e){if(!e.getUserContext)return null;let t=await e.getUserContext();return t?JSON.stringify(t):null}function pe(e,t,a={}){let n=t.replace(/\{chatId\}/g,encodeURIComponent(a.chatId??"")).replace(/:chatId\b/g,encodeURIComponent(a.chatId??""));return J(e.apiBaseUrl,n)}async function ot(e,t){let a=e.getAccessToken?await e.getAccessToken():null,n=await q(e),i=pe(e,e.endpoints.ask,{chatId:t.chatId}),s=/(\{chatId\}|:chatId\b)/.test(e.endpoints.ask)?{message:t.message,knowledgeNames:t.knowledgeNames,editLastQa:t.editLastQa??!1,enableReferences:t.enableReferences??!0}:{query:t.message,chat_id:t.chatId,knowledge_names:t.knowledgeNames,edit_last_qa:t.editLastQa??!1,enable_references:t.enableReferences??!0},p=await fetch(i,{method:"POST",headers:D(e,a,n),body:JSON.stringify(s)});if(!p.ok)throw new Error(`Chat backend returned ${p.status}.`);let c=await p.json();if(!Array.isArray(c)){if(!c.answer||typeof c.answer!="string")throw new Error("Chat backend response is missing a valid answer.");return{chatId:c.chatId??t.chatId,answer:c.answer,suggestions:c.suggestions??[],citations:c.citations??[]}}let u=c[0];if(!u?.answer||typeof u.answer!="string")throw new Error("Chat backend response is missing a valid answer.");let g=u.content,f=g?.source_documents??[],h=g?.scores??[],w=g?.page_numbers??[],L=g?.sheet_names??[],b=g?.row_numbers??[],y=g?.knowledge_names??[],k=f.map((M,v)=>({sourceDocument:M,score:h[v]??null,pageNumber:w[v]??null,sheetName:L[v]??null,rowNumber:b[v]??null,knowledgeName:y[v]??null}));return{chatId:t.chatId,answer:u.answer,suggestions:[],citations:k}}async function st(e,t){if(!e.endpoints.history)return[];let a=e.getAccessToken?await e.getAccessToken():null,n=await q(e),l=/(\{chatId\}|:chatId\b)/.test(e.endpoints.history)?pe(e,e.endpoints.history,{chatId:t}):(()=>{let u=new URL(J(e.apiBaseUrl,e.endpoints.history));return u.searchParams.set("chat_id",t),u.toString()})(),s=await fetch(l,{method:"GET",headers:D(e,a,n)});if(!s.ok)throw new Error(`Chat history endpoint returned ${s.status}.`);let p=await s.json(),c=Array.isArray(p)?p:p&&typeof p=="object"?p.history??p.messages??p.data??[]:[];return Array.isArray(c)?c.map(u=>{if(!u||typeof u!="object")return null;let g=u;if(typeof g.question=="string"&&typeof g.answer=="string")return[{role:"user",text:g.question},{role:"assistant",text:g.answer}];let f=g.role??g.type??g.sender??g.author,h=g.text??g.message??g.content??g.answer;if(typeof h!="string")return null;let w=typeof f=="string"?f.toLowerCase():"assistant";return[{role:w==="user"||w==="human"?"user":"assistant",text:h}]}).flat().filter(u=>!!u):[]}async function rt(e){if(!e.endpoints.listChats)return[];let t=e.getAccessToken?await e.getAccessToken():null,a=await q(e),n=await fetch(J(e.apiBaseUrl,e.endpoints.listChats),{method:"GET",headers:D(e,t,a)});if(!n.ok)throw new Error(`Chat list endpoint returned ${n.status}.`);let i=await n.json(),l=Array.isArray(i)?i:i&&typeof i=="object"?i.chats??i.data??i.items??[]:[];return Array.isArray(l)?l.map(s=>{if(!s||typeof s!="object")return null;let p=s,c=p.chatId??p.chat_id??p.id,u=p.title??p.name??p.chatId;if(typeof c!="string"||typeof u!="string")return null;let g=typeof p.createdAt=="string"?p.createdAt:typeof p.created_at=="string"?p.created_at:null,f=typeof p.updatedAt=="string"?p.updatedAt:typeof p.updated_at=="string"?p.updated_at:null,h={chatId:c,title:u,pinned:typeof p.pinned=="boolean"?p.pinned:!1};return g&&(h.createdAt=g),f&&(h.updatedAt=f),h}).filter(s=>!!s):[]}async function it(e,t,a){let n=e.endpoints.createChat??e.endpoints.listChats;if(!n)return;let i=e.getAccessToken?await e.getAccessToken():null,l=await q(e),s=await fetch(J(e.apiBaseUrl,n),{method:"POST",headers:D(e,i,l),body:JSON.stringify({chatId:t,...a?{title:a}:{}})});if(!s.ok)throw new Error(`Create chat endpoint returned ${s.status}.`)}async function Ce(e,t,a){if(!e.endpoints.updateChat)return;let n=e.getAccessToken?await e.getAccessToken():null,i=await q(e),l=pe(e,e.endpoints.updateChat,{chatId:t}),s=await fetch(l,{method:"PATCH",headers:D(e,n,i),body:JSON.stringify(a)});if(!s.ok)throw new Error(`Update chat endpoint returned ${s.status}.`)}async function lt(e,t){if(!e.endpoints.deleteChat)return;let a=e.getAccessToken?await e.getAccessToken():null,n=await q(e),i=pe(e,e.endpoints.deleteChat,{chatId:t}),l=await fetch(i,{method:"DELETE",headers:D(e,a,n)});if(!l.ok)throw new Error(`Delete chat endpoint returned ${l.status}.`)}function B(e,t){let a=at(t);return e.onError?.(a),a}var Le={accent:"#0f766e",accentSoft:"#ecfeff",panelBackground:"#ffffff",surfaceBackground:"#f8fafc",text:"#1f2937",mutedText:"#64748b",borderColor:"#dbe4ee",shadow:"0 24px 64px rgba(15, 23, 42, 0.20)",zIndex:2147483e3,fontFamily:'"Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif'},x={displayMode:"widget",position:"bottom-right",title:"Knowledge Assistant",subtitle:"Answers are generated based on your access permissions",welcomeMessage:"How can I assist you today?",inputPlaceholder:"Ask your question...",launcherAriaLabel:"Open chat assistant",closeAriaLabel:"Close chat assistant",initialSuggestions:["Which indicators reflect the achievements of Vision KSA goals?","Case studies of real estate initiatives for economic growth","Study of UX for the ministry external portal"],sourceApp:"knowledge-platform",locale:"en",customHeaders:{},assistantPageUrl:"/knowledge-assistant",embedded:{showHeader:!1},rag:{knowledgeNames:[],enableReferences:!0,loadHistoryOnOpen:!1},theme:Le,getAccessToken:void 0,getUserContext:void 0,onOpen:void 0,onClose:void 0,onError:void 0,onOpenAssistantPage:void 0};function pt(e){if(!e.apiBaseUrl?.trim())throw new Error("Chat widget config requires a non-empty apiBaseUrl.");if(!e.endpoints?.ask?.trim())throw new Error("Chat widget config requires endpoints.ask to be provided.");let t=e.mount??document.body,a=ve(Le,e.theme??{});return{apiBaseUrl:e.apiBaseUrl,endpoints:{...e.endpoints},mount:t,displayMode:e.displayMode??x.displayMode,position:e.position??x.position,title:e.title??x.title,subtitle:e.subtitle??x.subtitle,welcomeMessage:e.welcomeMessage??x.welcomeMessage,inputPlaceholder:e.inputPlaceholder??x.inputPlaceholder,launcherAriaLabel:e.launcherAriaLabel??x.launcherAriaLabel,closeAriaLabel:e.closeAriaLabel??x.closeAriaLabel,initialSuggestions:e.initialSuggestions??x.initialSuggestions,sourceApp:e.sourceApp??x.sourceApp,locale:e.locale??x.locale,customHeaders:e.customHeaders??x.customHeaders,embedded:{...x.embedded,...e.embedded??{}},rag:{...x.rag,...e.rag??{}},assistantPageUrl:e.assistantPageUrl??x.assistantPageUrl,theme:a,getAccessToken:e.getAccessToken,getUserContext:e.getUserContext,onOpen:e.onOpen,onClose:e.onClose,onError:e.onError,onOpenAssistantPage:e.onOpenAssistantPage}}function o(e,t,a){let n=document.createElement(e);return t&&(n.className=t),a!==void 0&&(n.textContent=a),n}var ct="kp-chat-widget-styles";function dt(e,t){if(e.getElementById(ct))return;let a=document.createElement("style");a.id=ct,a.textContent=Ft(t),e.appendChild(a)}function Ft(e){return`
|
|
2
|
+
:host {
|
|
3
|
+
all: initial;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.kp-chat-widget {
|
|
7
|
+
--kp-accent: ${e.accent};
|
|
8
|
+
--kp-accent-soft: ${e.accentSoft};
|
|
9
|
+
--kp-panel-background: ${e.panelBackground};
|
|
10
|
+
--kp-surface-background: ${e.surfaceBackground};
|
|
11
|
+
--kp-text: ${e.text};
|
|
12
|
+
--kp-muted-text: ${e.mutedText};
|
|
13
|
+
--kp-border-color: ${e.borderColor};
|
|
14
|
+
--kp-shadow: ${e.shadow};
|
|
15
|
+
--kp-z-index: ${e.zIndex};
|
|
16
|
+
--kp-font-family: ${e.fontFamily};
|
|
17
|
+
--kp-card-background: rgba(255, 255, 255, 0.92);
|
|
18
|
+
--kp-soft-highlight: rgba(236, 254, 255, 0.82);
|
|
19
|
+
position: fixed;
|
|
20
|
+
bottom: 24px;
|
|
21
|
+
right: 24px;
|
|
22
|
+
z-index: var(--kp-z-index);
|
|
23
|
+
font-family: var(--kp-font-family);
|
|
24
|
+
color: var(--kp-text);
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.kp-chat-widget.kp-chat-widget-embedded {
|
|
29
|
+
position: relative;
|
|
30
|
+
inset: auto;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
min-height: 640px;
|
|
34
|
+
display: block;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
*,
|
|
38
|
+
*::before,
|
|
39
|
+
*::after {
|
|
40
|
+
box-sizing: border-box;
|
|
41
|
+
font-family: inherit;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.kp-chat-widget.bottom-left {
|
|
45
|
+
left: 24px;
|
|
46
|
+
right: auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.kp-chat-widget.kp-chat-widget-embedded.bottom-left {
|
|
50
|
+
left: auto;
|
|
51
|
+
right: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.kp-rtl .kp-dropdown-item,
|
|
55
|
+
.kp-rtl .kp-suggestion,
|
|
56
|
+
.kp-rtl .kp-input,
|
|
57
|
+
.kp-rtl .kp-full-page-search-input,
|
|
58
|
+
.kp-rtl .kp-bubble-content,
|
|
59
|
+
.kp-rtl .kp-source-card,
|
|
60
|
+
.kp-rtl .kp-source-panel {
|
|
61
|
+
text-align: right;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.kp-launcher {
|
|
65
|
+
width: 72px;
|
|
66
|
+
height: 72px;
|
|
67
|
+
border: none;
|
|
68
|
+
border-radius: 999px;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
background: radial-gradient(circle at 30% 30%, #f8fffe 0%, #ecfdf5 52%, #d6f4ef 100%);
|
|
71
|
+
box-shadow: 0 16px 32px rgba(15, 118, 110, 0.18);
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
|
|
76
|
+
color: var(--kp-accent);
|
|
77
|
+
position: relative;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.kp-launcher:hover {
|
|
82
|
+
transform: translateY(-1px);
|
|
83
|
+
box-shadow: 0 20px 36px rgba(15, 118, 110, 0.22);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.kp-launcher:focus-visible,
|
|
87
|
+
.kp-close:focus-visible,
|
|
88
|
+
.kp-send:focus-visible,
|
|
89
|
+
.kp-suggestion:focus-visible,
|
|
90
|
+
.kp-input:focus-visible,
|
|
91
|
+
.kp-full-page-new-chat:focus-visible,
|
|
92
|
+
.kp-full-page-close:focus-visible,
|
|
93
|
+
.kp-full-page-chat-item:focus-visible,
|
|
94
|
+
.kp-chat-pin:focus-visible,
|
|
95
|
+
.kp-message-action:focus-visible,
|
|
96
|
+
.kp-source-chip:focus-visible,
|
|
97
|
+
.kp-source-panel-close:focus-visible {
|
|
98
|
+
outline: 2px solid var(--kp-accent);
|
|
99
|
+
outline-offset: 2px;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.kp-launcher.hidden {
|
|
103
|
+
opacity: 0;
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
transform: translateY(8px) scale(0.96);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.kp-star-cluster {
|
|
109
|
+
position: relative;
|
|
110
|
+
width: 50px;
|
|
111
|
+
height: 50px;
|
|
112
|
+
animation: kp-cluster-rotate 8.5s linear infinite;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.kp-star {
|
|
116
|
+
position: absolute;
|
|
117
|
+
color: #08384c;
|
|
118
|
+
line-height: 1;
|
|
119
|
+
transform-origin: center;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.kp-star.main {
|
|
123
|
+
top: 50%;
|
|
124
|
+
left: 50%;
|
|
125
|
+
font-size: 30px;
|
|
126
|
+
transform: translate(-50%, -50%) scale(0.96);
|
|
127
|
+
animation: kp-main-pulse 3s ease-in-out infinite;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.kp-star.orbit-a {
|
|
131
|
+
top: -3px;
|
|
132
|
+
left: 50%;
|
|
133
|
+
font-size: 18px;
|
|
134
|
+
transform: translateX(-50%);
|
|
135
|
+
animation: kp-orbit-a 3s ease-in-out infinite;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.kp-star.orbit-b {
|
|
139
|
+
right: -3px;
|
|
140
|
+
bottom: 5px;
|
|
141
|
+
font-size: 18px;
|
|
142
|
+
animation: kp-orbit-b 3s ease-in-out infinite;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.kp-star.orbit-c {
|
|
146
|
+
left: -1px;
|
|
147
|
+
bottom: 5px;
|
|
148
|
+
font-size: 18px;
|
|
149
|
+
animation: kp-orbit-c 3s ease-in-out infinite;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.kp-overlay {
|
|
153
|
+
position: fixed;
|
|
154
|
+
inset: 0;
|
|
155
|
+
background: rgba(15, 23, 42, 0.18);
|
|
156
|
+
opacity: 0;
|
|
157
|
+
pointer-events: none;
|
|
158
|
+
transition: opacity 220ms ease;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.kp-overlay.visible {
|
|
162
|
+
opacity: 1;
|
|
163
|
+
pointer-events: auto;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.kp-panel {
|
|
167
|
+
position: fixed;
|
|
168
|
+
bottom: 88px;
|
|
169
|
+
right: 24px;
|
|
170
|
+
width: min(480px, calc(100vw - 48px));
|
|
171
|
+
height: min(730px, calc(100vh - 118px));
|
|
172
|
+
background: var(--kp-panel-background);
|
|
173
|
+
border: 1px solid rgba(255, 255, 255, 0.35);
|
|
174
|
+
border-radius: 24px;
|
|
175
|
+
box-shadow: var(--kp-shadow);
|
|
176
|
+
overflow: hidden;
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
opacity: 0;
|
|
180
|
+
transform: translateX(112px) scale(0.97);
|
|
181
|
+
transform-origin: bottom right;
|
|
182
|
+
pointer-events: none;
|
|
183
|
+
transition: opacity 420ms cubic-bezier(0.16, 1, 0.3, 1),
|
|
184
|
+
transform 620ms cubic-bezier(0.16, 1, 0.3, 1);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.kp-chat-widget.bottom-left .kp-panel {
|
|
188
|
+
left: 24px;
|
|
189
|
+
right: auto;
|
|
190
|
+
transform: translateX(-112px) scale(0.97);
|
|
191
|
+
transform-origin: bottom left;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.kp-panel.open {
|
|
195
|
+
opacity: 1;
|
|
196
|
+
transform: translateX(0) scale(1);
|
|
197
|
+
pointer-events: auto;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.kp-full-page {
|
|
201
|
+
position: fixed;
|
|
202
|
+
inset: 0;
|
|
203
|
+
background: #ffffff;
|
|
204
|
+
opacity: 0;
|
|
205
|
+
pointer-events: none;
|
|
206
|
+
transform: translateY(18px);
|
|
207
|
+
transition: opacity 260ms ease, transform 320ms ease;
|
|
208
|
+
z-index: calc(var(--kp-z-index) + 2);
|
|
209
|
+
overflow: hidden;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.kp-full-page.kp-full-page-embedded {
|
|
213
|
+
position: relative;
|
|
214
|
+
inset: auto;
|
|
215
|
+
opacity: 1;
|
|
216
|
+
pointer-events: auto;
|
|
217
|
+
transform: none;
|
|
218
|
+
min-height: 100%;
|
|
219
|
+
height: 100%;
|
|
220
|
+
z-index: auto;
|
|
221
|
+
background: transparent;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.kp-full-page.open {
|
|
225
|
+
opacity: 1;
|
|
226
|
+
pointer-events: auto;
|
|
227
|
+
transform: translateY(0);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.kp-full-page-shell {
|
|
231
|
+
height: 100vh;
|
|
232
|
+
display: flex;
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
padding: 22px 28px 26px;
|
|
235
|
+
gap: 16px;
|
|
236
|
+
overflow: hidden;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.kp-full-page-embedded .kp-full-page-shell {
|
|
240
|
+
height: 100%;
|
|
241
|
+
min-height: 100%;
|
|
242
|
+
padding: 0;
|
|
243
|
+
gap: 12px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.kp-full-page-header {
|
|
247
|
+
display: flex;
|
|
248
|
+
align-items: center;
|
|
249
|
+
justify-content: space-between;
|
|
250
|
+
gap: 16px;
|
|
251
|
+
padding: 8px 4px 0;
|
|
252
|
+
flex: none;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.kp-hidden {
|
|
256
|
+
display: none !important;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.kp-full-page-brand {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
gap: 12px;
|
|
263
|
+
color: #08384c;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.kp-full-page-brand-mark {
|
|
267
|
+
width: 44px;
|
|
268
|
+
height: 44px;
|
|
269
|
+
border-radius: 14px;
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
background: linear-gradient(135deg, rgba(37, 181, 192, 0.14), rgba(15, 118, 110, 0.08));
|
|
274
|
+
font-size: 26px;
|
|
275
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.kp-full-page-brand-text {
|
|
279
|
+
font-size: 20px;
|
|
280
|
+
font-weight: 700;
|
|
281
|
+
letter-spacing: -0.02em;
|
|
282
|
+
color: #16394b;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.kp-full-page-header-actions {
|
|
286
|
+
display: flex;
|
|
287
|
+
align-items: center;
|
|
288
|
+
gap: 12px;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.kp-full-page-badge {
|
|
292
|
+
padding: 10px 14px;
|
|
293
|
+
border-radius: 999px;
|
|
294
|
+
font-size: 13px;
|
|
295
|
+
line-height: 1;
|
|
296
|
+
color: #0b556c;
|
|
297
|
+
background: rgba(255, 255, 255, 0.82);
|
|
298
|
+
border: 1px solid rgba(15, 118, 110, 0.12);
|
|
299
|
+
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.kp-full-page-close,
|
|
303
|
+
.kp-source-panel-close {
|
|
304
|
+
width: 40px;
|
|
305
|
+
height: 40px;
|
|
306
|
+
border: none;
|
|
307
|
+
border-radius: 14px;
|
|
308
|
+
background: rgba(255, 255, 255, 0.82);
|
|
309
|
+
color: #61788a;
|
|
310
|
+
font-size: 24px;
|
|
311
|
+
line-height: 1;
|
|
312
|
+
cursor: pointer;
|
|
313
|
+
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.kp-full-page-content {
|
|
317
|
+
display: grid;
|
|
318
|
+
grid-template-columns: 290px minmax(0, 1fr) minmax(0, 0);
|
|
319
|
+
gap: 16px;
|
|
320
|
+
flex: 1;
|
|
321
|
+
min-height: 0;
|
|
322
|
+
overflow: hidden;
|
|
323
|
+
align-items: stretch;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
.kp-full-page-embedded .kp-full-page-content {
|
|
327
|
+
height: 100%;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.kp-full-page-sidebar,
|
|
331
|
+
.kp-full-page-panel,
|
|
332
|
+
.kp-source-panel {
|
|
333
|
+
border-radius: 24px;
|
|
334
|
+
border: 1px solid rgba(219, 228, 238, 0.9);
|
|
335
|
+
background: rgba(255, 255, 255, 0.88);
|
|
336
|
+
box-shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
|
|
337
|
+
backdrop-filter: blur(12px);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.kp-full-page-sidebar {
|
|
341
|
+
padding: 18px;
|
|
342
|
+
display: flex;
|
|
343
|
+
flex-direction: column;
|
|
344
|
+
gap: 16px;
|
|
345
|
+
min-height: 0;
|
|
346
|
+
overflow: auto;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.kp-full-page-new-chat {
|
|
350
|
+
width: 100%;
|
|
351
|
+
height: 48px;
|
|
352
|
+
border: none;
|
|
353
|
+
border-radius: 12px;
|
|
354
|
+
background: linear-gradient(135deg, #0a465d 0%, #0f6a75 100%);
|
|
355
|
+
color: #ffffff;
|
|
356
|
+
font-size: 16px;
|
|
357
|
+
font-weight: 600;
|
|
358
|
+
cursor: pointer;
|
|
359
|
+
box-shadow: 0 14px 30px rgba(10, 70, 93, 0.18);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.kp-full-page-search {
|
|
363
|
+
display: flex;
|
|
364
|
+
align-items: center;
|
|
365
|
+
gap: 8px;
|
|
366
|
+
height: 44px;
|
|
367
|
+
border-radius: 12px;
|
|
368
|
+
border: 1px solid rgba(203, 213, 225, 0.95);
|
|
369
|
+
background: #ffffff;
|
|
370
|
+
padding: 0 12px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.kp-full-page-search-input {
|
|
374
|
+
flex: 1;
|
|
375
|
+
border: none;
|
|
376
|
+
outline: none;
|
|
377
|
+
background: transparent;
|
|
378
|
+
color: #334155;
|
|
379
|
+
font-size: 14px;
|
|
380
|
+
min-width: 0;
|
|
381
|
+
box-shadow: none;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.kp-full-page-search-input:focus,
|
|
385
|
+
.kp-full-page-search-input:focus-visible,
|
|
386
|
+
.kp-full-page-search-input:active {
|
|
387
|
+
outline: none;
|
|
388
|
+
box-shadow: none;
|
|
389
|
+
border: none;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.kp-full-page-search-icon {
|
|
393
|
+
color: #607082;
|
|
394
|
+
font-size: 20px;
|
|
395
|
+
line-height: 1;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
.kp-full-page-section-label {
|
|
399
|
+
font-size: 12px;
|
|
400
|
+
line-height: 1.4;
|
|
401
|
+
text-transform: uppercase;
|
|
402
|
+
letter-spacing: 0.08em;
|
|
403
|
+
color: #8a98a6;
|
|
404
|
+
margin-top: 4px;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.kp-full-page-recent-list,
|
|
408
|
+
.kp-full-page-pinned-list {
|
|
409
|
+
display: flex;
|
|
410
|
+
flex-direction: column;
|
|
411
|
+
gap: 8px;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.kp-full-page-item {
|
|
415
|
+
padding: 12px 12px 13px;
|
|
416
|
+
border-radius: 14px;
|
|
417
|
+
color: #293845;
|
|
418
|
+
font-size: 15px;
|
|
419
|
+
line-height: 1.5;
|
|
420
|
+
background: rgba(247, 250, 252, 0.9);
|
|
421
|
+
border: 1px solid rgba(219, 228, 238, 0.88);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.kp-full-page-chat-item {
|
|
425
|
+
position: relative;
|
|
426
|
+
display: flex;
|
|
427
|
+
align-items: center;
|
|
428
|
+
justify-content: space-between;
|
|
429
|
+
gap: 10px;
|
|
430
|
+
cursor: pointer;
|
|
431
|
+
transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
|
|
432
|
+
overflow: visible;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.kp-full-page-chat-item:hover {
|
|
436
|
+
border-color: rgba(15, 118, 110, 0.34);
|
|
437
|
+
background: rgba(240, 253, 250, 0.95);
|
|
438
|
+
transform: translateY(-1px);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.kp-full-page-chat-item.active {
|
|
442
|
+
border-color: rgba(15, 118, 110, 0.5);
|
|
443
|
+
background: rgba(220, 252, 231, 0.72);
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.kp-full-page-chat-item.menu-open {
|
|
447
|
+
z-index: 4;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.kp-full-page-item-title {
|
|
451
|
+
min-width: 0;
|
|
452
|
+
overflow: hidden;
|
|
453
|
+
text-overflow: ellipsis;
|
|
454
|
+
white-space: nowrap;
|
|
455
|
+
flex: 1;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.kp-chat-pin {
|
|
459
|
+
flex: none;
|
|
460
|
+
border: none;
|
|
461
|
+
background: transparent;
|
|
462
|
+
color: #0f6a75;
|
|
463
|
+
font-size: 16px;
|
|
464
|
+
line-height: 1;
|
|
465
|
+
padding: 0;
|
|
466
|
+
cursor: pointer;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.kp-full-page-empty {
|
|
470
|
+
padding: 8px 4px 0;
|
|
471
|
+
color: #7a8a99;
|
|
472
|
+
font-size: 14px;
|
|
473
|
+
line-height: 1.5;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
.kp-full-page-main {
|
|
477
|
+
min-width: 0;
|
|
478
|
+
min-height: 0;
|
|
479
|
+
display: flex;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.kp-full-page-panel {
|
|
483
|
+
flex: 1;
|
|
484
|
+
display: flex;
|
|
485
|
+
flex-direction: column;
|
|
486
|
+
min-height: 0;
|
|
487
|
+
overflow: hidden;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
.kp-source-panel {
|
|
491
|
+
min-width: 0;
|
|
492
|
+
min-height: 0;
|
|
493
|
+
overflow: hidden;
|
|
494
|
+
display: none;
|
|
495
|
+
flex-direction: column;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.kp-source-panel.open {
|
|
499
|
+
display: flex;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.kp-full-page-content:has(.kp-source-panel.open) {
|
|
503
|
+
grid-template-columns: 290px minmax(0, 1fr) 320px;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.kp-source-panel-header {
|
|
507
|
+
display: flex;
|
|
508
|
+
align-items: flex-start;
|
|
509
|
+
justify-content: space-between;
|
|
510
|
+
gap: 12px;
|
|
511
|
+
padding: 18px 18px 12px;
|
|
512
|
+
border-bottom: 1px solid rgba(219, 228, 238, 0.7);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.kp-source-panel-title {
|
|
516
|
+
font-size: 17px;
|
|
517
|
+
font-weight: 700;
|
|
518
|
+
color: #16394b;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.kp-source-panel-subtitle {
|
|
522
|
+
margin-top: 4px;
|
|
523
|
+
font-size: 12px;
|
|
524
|
+
color: #7a8a99;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.kp-source-panel-list {
|
|
528
|
+
display: flex;
|
|
529
|
+
flex-direction: column;
|
|
530
|
+
gap: 12px;
|
|
531
|
+
padding: 16px;
|
|
532
|
+
overflow: auto;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.kp-source-panel-empty {
|
|
536
|
+
color: #7a8a99;
|
|
537
|
+
font-size: 14px;
|
|
538
|
+
line-height: 1.5;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.kp-source-card {
|
|
542
|
+
width: 100%;
|
|
543
|
+
text-align: left;
|
|
544
|
+
cursor: pointer;
|
|
545
|
+
appearance: none;
|
|
546
|
+
border: 1px solid rgba(219, 228, 238, 0.9);
|
|
547
|
+
border-radius: 16px;
|
|
548
|
+
background: #ffffff;
|
|
549
|
+
padding: 14px;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.kp-source-card-media {
|
|
553
|
+
display: flex;
|
|
554
|
+
align-items: center;
|
|
555
|
+
margin-bottom: 10px;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
.kp-source-thumb,
|
|
559
|
+
.kp-source-thumb-large {
|
|
560
|
+
flex: none;
|
|
561
|
+
width: 32px;
|
|
562
|
+
height: 32px;
|
|
563
|
+
border-radius: 999px;
|
|
564
|
+
display: inline-flex;
|
|
565
|
+
align-items: center;
|
|
566
|
+
justify-content: center;
|
|
567
|
+
background: linear-gradient(180deg, #eefcf8 0%, #dff7f2 100%);
|
|
568
|
+
border: 1px solid rgba(15, 118, 110, 0.18);
|
|
569
|
+
color: #0f6a75;
|
|
570
|
+
font-size: 14px;
|
|
571
|
+
line-height: 1;
|
|
572
|
+
box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.kp-source-thumb-large {
|
|
576
|
+
width: 42px;
|
|
577
|
+
height: 42px;
|
|
578
|
+
font-size: 18px;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.kp-source-card-title {
|
|
582
|
+
font-size: 14px;
|
|
583
|
+
font-weight: 700;
|
|
584
|
+
color: #16394b;
|
|
585
|
+
word-break: break-word;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.kp-source-card-meta {
|
|
589
|
+
margin-top: 8px;
|
|
590
|
+
font-size: 12px;
|
|
591
|
+
line-height: 1.5;
|
|
592
|
+
color: #667a8d;
|
|
593
|
+
word-break: break-word;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
.kp-full-page-body {
|
|
597
|
+
flex: 1;
|
|
598
|
+
overflow: auto;
|
|
599
|
+
display: flex;
|
|
600
|
+
flex-direction: column;
|
|
601
|
+
gap: 14px;
|
|
602
|
+
padding: 42px 28px 18px;
|
|
603
|
+
background: #ffffff;
|
|
604
|
+
scroll-behavior: smooth;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
.kp-full-page-body.kp-conversation-active {
|
|
608
|
+
padding-top: 24px;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
.kp-full-page-hero {
|
|
612
|
+
display: flex;
|
|
613
|
+
flex-direction: column;
|
|
614
|
+
align-items: center;
|
|
615
|
+
text-align: center;
|
|
616
|
+
gap: 22px;
|
|
617
|
+
padding: 18px 18px 12px;
|
|
618
|
+
max-width: 880px;
|
|
619
|
+
width: 100%;
|
|
620
|
+
margin: 0 auto;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.kp-full-page-hero-badge {
|
|
624
|
+
width: 140px;
|
|
625
|
+
height: 140px;
|
|
626
|
+
border-radius: 999px;
|
|
627
|
+
display: flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
justify-content: center;
|
|
630
|
+
background: radial-gradient(circle at 30% 30%, #f8fdff 0%, #edf8ff 50%, #e4eef8 100%);
|
|
631
|
+
box-shadow:
|
|
632
|
+
inset 0 2px 0 rgba(255, 255, 255, 0.9),
|
|
633
|
+
0 22px 40px rgba(15, 23, 42, 0.08);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.kp-star-cluster-static {
|
|
637
|
+
animation: none;
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
.kp-full-page-hero-text {
|
|
641
|
+
max-width: 760px;
|
|
642
|
+
font-size: 26px;
|
|
643
|
+
line-height: 1.5;
|
|
644
|
+
font-weight: 700;
|
|
645
|
+
letter-spacing: -0.03em;
|
|
646
|
+
color: #374151;
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
.kp-full-page-suggestions {
|
|
650
|
+
width: min(520px, 100%);
|
|
651
|
+
margin: auto auto 0;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
.kp-full-page-footer {
|
|
655
|
+
flex: none;
|
|
656
|
+
padding: 0 16px 18px;
|
|
657
|
+
background: rgba(255, 255, 255, 0.72);
|
|
658
|
+
border-top: 1px solid rgba(219, 228, 238, 0.75);
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
.kp-full-page-form {
|
|
662
|
+
max-width: none;
|
|
663
|
+
min-height: 56px;
|
|
664
|
+
border-radius: 16px;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
.kp-full-page-note {
|
|
668
|
+
font-size: 13px;
|
|
669
|
+
margin-top: 10px;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.kp-header {
|
|
673
|
+
display: flex;
|
|
674
|
+
justify-content: space-between;
|
|
675
|
+
align-items: center;
|
|
676
|
+
gap: 12px;
|
|
677
|
+
padding: 18px 18px 8px;
|
|
678
|
+
background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
.kp-toolbar {
|
|
682
|
+
position: relative;
|
|
683
|
+
display: flex;
|
|
684
|
+
align-items: center;
|
|
685
|
+
gap: 8px;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
.kp-tool-button {
|
|
689
|
+
width: 36px;
|
|
690
|
+
height: 36px;
|
|
691
|
+
border: none;
|
|
692
|
+
border-radius: 12px;
|
|
693
|
+
background: transparent;
|
|
694
|
+
color: #0f4f68;
|
|
695
|
+
cursor: pointer;
|
|
696
|
+
display: inline-flex;
|
|
697
|
+
align-items: center;
|
|
698
|
+
justify-content: center;
|
|
699
|
+
padding: 0;
|
|
700
|
+
transition: background 140ms ease;
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
.kp-tool-button:hover {
|
|
704
|
+
background: rgba(15, 118, 110, 0.08);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
.kp-pencil-icon {
|
|
708
|
+
width: 22px;
|
|
709
|
+
height: 22px;
|
|
710
|
+
position: relative;
|
|
711
|
+
display: inline-block;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
.kp-pencil-icon::before {
|
|
715
|
+
content: "";
|
|
716
|
+
position: absolute;
|
|
717
|
+
width: 14px;
|
|
718
|
+
height: 2.5px;
|
|
719
|
+
background: currentColor;
|
|
720
|
+
border-radius: 999px;
|
|
721
|
+
transform: rotate(-45deg);
|
|
722
|
+
top: 3px;
|
|
723
|
+
right: 1px;
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
.kp-pencil-icon::after {
|
|
727
|
+
content: "";
|
|
728
|
+
position: absolute;
|
|
729
|
+
left: 2px;
|
|
730
|
+
bottom: 2px;
|
|
731
|
+
width: 11px;
|
|
732
|
+
height: 11px;
|
|
733
|
+
border: 2px solid currentColor;
|
|
734
|
+
border-radius: 4px;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
.kp-chevron {
|
|
738
|
+
font-size: 13px;
|
|
739
|
+
color: #66839a;
|
|
740
|
+
transition: transform 160ms ease;
|
|
741
|
+
margin-left: -2px;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
.kp-menu-trigger.open .kp-chevron {
|
|
745
|
+
transform: rotate(180deg);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
.kp-dropdown {
|
|
749
|
+
position: absolute;
|
|
750
|
+
top: 44px;
|
|
751
|
+
left: 0;
|
|
752
|
+
width: 184px;
|
|
753
|
+
background: #ffffff;
|
|
754
|
+
border: 1px solid rgba(15, 79, 104, 0.12);
|
|
755
|
+
border-radius: 10px;
|
|
756
|
+
box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
|
|
757
|
+
padding: 8px;
|
|
758
|
+
opacity: 0;
|
|
759
|
+
transform: translateY(-6px);
|
|
760
|
+
pointer-events: none;
|
|
761
|
+
transition: opacity 180ms ease, transform 180ms ease;
|
|
762
|
+
z-index: 2;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
.kp-rtl .kp-dropdown {
|
|
766
|
+
left: auto;
|
|
767
|
+
right: 0;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
.kp-dropdown.open {
|
|
771
|
+
opacity: 1;
|
|
772
|
+
transform: translateY(0);
|
|
773
|
+
pointer-events: auto;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
.kp-dropdown-item {
|
|
777
|
+
width: 100%;
|
|
778
|
+
border: none;
|
|
779
|
+
background: transparent;
|
|
780
|
+
text-align: left;
|
|
781
|
+
padding: 10px 12px;
|
|
782
|
+
border-radius: 8px;
|
|
783
|
+
font-size: 14px;
|
|
784
|
+
color: var(--kp-text);
|
|
785
|
+
cursor: pointer;
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
.kp-dropdown-item:hover {
|
|
789
|
+
background: rgba(15, 118, 110, 0.08);
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
.kp-title-wrap {
|
|
793
|
+
display: none;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.kp-close {
|
|
797
|
+
border: none;
|
|
798
|
+
background: transparent;
|
|
799
|
+
font-size: 24px;
|
|
800
|
+
line-height: 1;
|
|
801
|
+
color: var(--kp-muted-text);
|
|
802
|
+
cursor: pointer;
|
|
803
|
+
padding: 0;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
.kp-body {
|
|
807
|
+
flex: 1;
|
|
808
|
+
overflow: auto;
|
|
809
|
+
display: flex;
|
|
810
|
+
flex-direction: column;
|
|
811
|
+
gap: 12px;
|
|
812
|
+
padding: 10px 16px 16px;
|
|
813
|
+
background: linear-gradient(180deg, #ffffff 0%, var(--kp-surface-background) 100%);
|
|
814
|
+
scroll-behavior: smooth;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
.kp-body.kp-conversation-active {
|
|
818
|
+
padding-top: 16px;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
.kp-panel.kp-sheet-open .kp-body,
|
|
822
|
+
.kp-panel.kp-sheet-open .kp-footer,
|
|
823
|
+
.kp-panel.kp-sheet-open .kp-header {
|
|
824
|
+
opacity: 0;
|
|
825
|
+
pointer-events: none;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
.kp-my-chats-sheet {
|
|
829
|
+
position: absolute;
|
|
830
|
+
inset: 0;
|
|
831
|
+
border-radius: inherit;
|
|
832
|
+
border: none;
|
|
833
|
+
background: #ffffff;
|
|
834
|
+
box-shadow: none;
|
|
835
|
+
display: none;
|
|
836
|
+
flex-direction: column;
|
|
837
|
+
z-index: 3;
|
|
838
|
+
overflow: hidden;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
.kp-my-chats-sheet.open {
|
|
842
|
+
display: flex;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
.kp-my-chats-header {
|
|
846
|
+
display: flex;
|
|
847
|
+
align-items: center;
|
|
848
|
+
justify-content: space-between;
|
|
849
|
+
padding: 18px 18px 10px;
|
|
850
|
+
flex: none;
|
|
851
|
+
background: #ffffff;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
.kp-my-chats-nav {
|
|
855
|
+
width: 36px;
|
|
856
|
+
height: 36px;
|
|
857
|
+
border: none;
|
|
858
|
+
border-radius: 999px;
|
|
859
|
+
background: transparent;
|
|
860
|
+
color: #61788a;
|
|
861
|
+
font-size: 22px;
|
|
862
|
+
line-height: 1;
|
|
863
|
+
cursor: pointer;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.kp-my-chats-body {
|
|
867
|
+
flex: 1;
|
|
868
|
+
overflow: auto;
|
|
869
|
+
padding: 8px 18px 18px;
|
|
870
|
+
background: #ffffff;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
.kp-my-chats-section-label {
|
|
874
|
+
font-size: 14px;
|
|
875
|
+
line-height: 1.5;
|
|
876
|
+
color: #7a8a99;
|
|
877
|
+
margin: 14px 0 10px;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
.kp-my-chats-list {
|
|
881
|
+
display: flex;
|
|
882
|
+
flex-direction: column;
|
|
883
|
+
gap: 10px;
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
.kp-chat-actions {
|
|
887
|
+
position: relative;
|
|
888
|
+
flex: none;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
.kp-chat-actions-trigger {
|
|
892
|
+
width: 28px;
|
|
893
|
+
height: 28px;
|
|
894
|
+
border: none;
|
|
895
|
+
border-radius: 999px;
|
|
896
|
+
background: transparent;
|
|
897
|
+
color: #526678;
|
|
898
|
+
font-size: 20px;
|
|
899
|
+
line-height: 1;
|
|
900
|
+
cursor: pointer;
|
|
901
|
+
display: inline-flex;
|
|
902
|
+
align-items: center;
|
|
903
|
+
justify-content: center;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
.kp-chat-actions-menu {
|
|
907
|
+
position: absolute;
|
|
908
|
+
top: 30px;
|
|
909
|
+
inset-inline-end: 0;
|
|
910
|
+
width: 120px;
|
|
911
|
+
padding: 8px;
|
|
912
|
+
border-radius: 10px;
|
|
913
|
+
border: 1px solid rgba(219, 228, 238, 0.95);
|
|
914
|
+
background: #ffffff;
|
|
915
|
+
box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
|
|
916
|
+
display: none;
|
|
917
|
+
flex-direction: column;
|
|
918
|
+
gap: 2px;
|
|
919
|
+
z-index: 20;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
.kp-chat-actions.open .kp-chat-actions-menu {
|
|
923
|
+
display: flex;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
.kp-chat-actions-item {
|
|
927
|
+
width: 100%;
|
|
928
|
+
border: none;
|
|
929
|
+
background: transparent;
|
|
930
|
+
color: #1f2937;
|
|
931
|
+
text-align: left;
|
|
932
|
+
padding: 10px 12px;
|
|
933
|
+
border-radius: 8px;
|
|
934
|
+
font-size: 14px;
|
|
935
|
+
cursor: pointer;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
.kp-chat-actions-item:hover {
|
|
939
|
+
background: rgba(241, 245, 249, 0.95);
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
.kp-hero {
|
|
943
|
+
display: flex;
|
|
944
|
+
gap: 10px;
|
|
945
|
+
padding: 4px 2px 8px;
|
|
946
|
+
align-items: flex-start;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
.kp-hero-icon {
|
|
950
|
+
color: #0ea5b7;
|
|
951
|
+
font-size: 28px;
|
|
952
|
+
line-height: 1;
|
|
953
|
+
margin-top: 2px;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
.kp-hero-text {
|
|
957
|
+
font-size: 20px;
|
|
958
|
+
line-height: 1.45;
|
|
959
|
+
font-weight: 700;
|
|
960
|
+
color: #374151;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.kp-message-row {
|
|
964
|
+
display: flex;
|
|
965
|
+
align-items: flex-start;
|
|
966
|
+
gap: 10px;
|
|
967
|
+
width: 100%;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.kp-message-row.user {
|
|
971
|
+
justify-content: flex-end;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.kp-avatar {
|
|
975
|
+
flex: none;
|
|
976
|
+
width: 36px;
|
|
977
|
+
height: 36px;
|
|
978
|
+
border-radius: 999px;
|
|
979
|
+
display: flex;
|
|
980
|
+
align-items: center;
|
|
981
|
+
justify-content: center;
|
|
982
|
+
font-size: 13px;
|
|
983
|
+
font-weight: 700;
|
|
984
|
+
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
.kp-avatar.bot {
|
|
988
|
+
background: linear-gradient(180deg, #e8fbff 0%, #dff7f2 100%);
|
|
989
|
+
color: #0f6a75;
|
|
990
|
+
border: 1px solid rgba(15, 118, 110, 0.16);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
.kp-avatar.user {
|
|
994
|
+
background: linear-gradient(180deg, #fff4ee 0%, #fbe3d5 100%);
|
|
995
|
+
color: #8c4b1f;
|
|
996
|
+
border: 1px solid rgba(180, 102, 43, 0.16);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
.kp-bubble {
|
|
1000
|
+
max-width: min(85%, 720px);
|
|
1001
|
+
padding: 14px 16px;
|
|
1002
|
+
border-radius: 20px;
|
|
1003
|
+
font-size: 14px;
|
|
1004
|
+
line-height: 1.65;
|
|
1005
|
+
border: 1px solid var(--kp-border-color);
|
|
1006
|
+
background: #ffffff;
|
|
1007
|
+
box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
.kp-bubble.user {
|
|
1011
|
+
background: linear-gradient(180deg, #fff8f3 0%, #fdf1e8 100%);
|
|
1012
|
+
border-color: rgba(222, 184, 135, 0.34);
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
.kp-bubble.bot {
|
|
1016
|
+
background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
.kp-bubble-content {
|
|
1020
|
+
color: var(--kp-text);
|
|
1021
|
+
white-space: normal;
|
|
1022
|
+
word-break: break-word;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
.kp-bubble-content p,
|
|
1026
|
+
.kp-bubble-content ul,
|
|
1027
|
+
.kp-bubble-content ol,
|
|
1028
|
+
.kp-bubble-content table,
|
|
1029
|
+
.kp-bubble-content blockquote {
|
|
1030
|
+
margin: 0;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.kp-bubble-content p + p,
|
|
1034
|
+
.kp-bubble-content p + ul,
|
|
1035
|
+
.kp-bubble-content p + ol,
|
|
1036
|
+
.kp-bubble-content ul + p,
|
|
1037
|
+
.kp-bubble-content ol + p,
|
|
1038
|
+
.kp-bubble-content .kp-table-wrap + p,
|
|
1039
|
+
.kp-bubble-content p + .kp-table-wrap,
|
|
1040
|
+
.kp-bubble-content h1 + p,
|
|
1041
|
+
.kp-bubble-content h2 + p,
|
|
1042
|
+
.kp-bubble-content h3 + p {
|
|
1043
|
+
margin-top: 12px;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
.kp-bubble-content h1,
|
|
1047
|
+
.kp-bubble-content h2,
|
|
1048
|
+
.kp-bubble-content h3,
|
|
1049
|
+
.kp-bubble-content h4,
|
|
1050
|
+
.kp-bubble-content h5,
|
|
1051
|
+
.kp-bubble-content h6 {
|
|
1052
|
+
margin: 0 0 10px;
|
|
1053
|
+
font-size: 16px;
|
|
1054
|
+
line-height: 1.4;
|
|
1055
|
+
color: #16394b;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
.kp-bubble-content ul,
|
|
1059
|
+
.kp-bubble-content ol {
|
|
1060
|
+
padding-inline-start: 20px;
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
.kp-bubble-content code {
|
|
1064
|
+
padding: 2px 6px;
|
|
1065
|
+
border-radius: 8px;
|
|
1066
|
+
background: rgba(226, 232, 240, 0.66);
|
|
1067
|
+
font-size: 0.92em;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
.kp-bubble-content a {
|
|
1071
|
+
color: #0f6a75;
|
|
1072
|
+
text-decoration: underline;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
.kp-table-wrap {
|
|
1076
|
+
overflow-x: auto;
|
|
1077
|
+
margin-top: 8px;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
.kp-bubble-content table {
|
|
1081
|
+
width: 100%;
|
|
1082
|
+
border-collapse: collapse;
|
|
1083
|
+
border: 1px solid rgba(203, 213, 225, 0.95);
|
|
1084
|
+
border-radius: 14px;
|
|
1085
|
+
overflow: hidden;
|
|
1086
|
+
background: #ffffff;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
.kp-bubble-content th,
|
|
1090
|
+
.kp-bubble-content td {
|
|
1091
|
+
padding: 10px 12px;
|
|
1092
|
+
border-bottom: 1px solid rgba(226, 232, 240, 0.95);
|
|
1093
|
+
border-inline-end: 1px solid rgba(226, 232, 240, 0.95);
|
|
1094
|
+
vertical-align: top;
|
|
1095
|
+
text-align: start;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
.kp-bubble-content tr:last-child td {
|
|
1099
|
+
border-bottom: none;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
.kp-bubble-content th:last-child,
|
|
1103
|
+
.kp-bubble-content td:last-child {
|
|
1104
|
+
border-inline-end: none;
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
.kp-bubble-content th {
|
|
1108
|
+
background: #f4fbfc;
|
|
1109
|
+
color: #16394b;
|
|
1110
|
+
font-weight: 700;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
.kp-meta {
|
|
1114
|
+
font-size: 11px;
|
|
1115
|
+
line-height: 1.4;
|
|
1116
|
+
color: var(--kp-muted-text);
|
|
1117
|
+
margin-top: 10px;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
.kp-source-preview {
|
|
1121
|
+
margin-top: 10px;
|
|
1122
|
+
padding: 12px;
|
|
1123
|
+
border-radius: 16px;
|
|
1124
|
+
border: 1px solid rgba(219, 228, 238, 0.88);
|
|
1125
|
+
background: #ffffff;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
.kp-source-preview-title {
|
|
1129
|
+
font-size: 12px;
|
|
1130
|
+
font-weight: 700;
|
|
1131
|
+
color: #16394b;
|
|
1132
|
+
margin-bottom: 8px;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
.kp-source-preview-list {
|
|
1136
|
+
display: flex;
|
|
1137
|
+
flex-wrap: nowrap;
|
|
1138
|
+
gap: 8px;
|
|
1139
|
+
overflow-x: auto;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
.kp-source-chip {
|
|
1143
|
+
display: inline-flex;
|
|
1144
|
+
align-items: center;
|
|
1145
|
+
gap: 10px;
|
|
1146
|
+
border: 1px solid rgba(15, 118, 110, 0.16);
|
|
1147
|
+
background: #ffffff;
|
|
1148
|
+
color: #0f4f68;
|
|
1149
|
+
border-radius: 999px;
|
|
1150
|
+
padding: 8px 12px;
|
|
1151
|
+
cursor: pointer;
|
|
1152
|
+
font-size: 12px;
|
|
1153
|
+
line-height: 1.3;
|
|
1154
|
+
max-width: 100%;
|
|
1155
|
+
min-width: 0;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
.kp-source-chip-more {
|
|
1159
|
+
background: rgba(236, 254, 255, 0.9);
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
.kp-source-chip-label {
|
|
1163
|
+
min-width: 0;
|
|
1164
|
+
overflow: hidden;
|
|
1165
|
+
text-overflow: ellipsis;
|
|
1166
|
+
white-space: nowrap;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
.kp-source-thumb-stack {
|
|
1170
|
+
display: inline-flex;
|
|
1171
|
+
align-items: center;
|
|
1172
|
+
margin-inline-end: 2px;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
.kp-source-thumb.stacked {
|
|
1176
|
+
margin-inline-end: -10px;
|
|
1177
|
+
background: #ffffff;
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
.kp-message-actions {
|
|
1181
|
+
display: flex;
|
|
1182
|
+
align-items: center;
|
|
1183
|
+
gap: 8px;
|
|
1184
|
+
margin-top: 10px;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
.kp-message-action {
|
|
1188
|
+
border: 1px solid rgba(219, 228, 238, 0.9);
|
|
1189
|
+
background: #ffffff;
|
|
1190
|
+
color: #4b6478;
|
|
1191
|
+
border-radius: 999px;
|
|
1192
|
+
padding: 7px 10px;
|
|
1193
|
+
cursor: pointer;
|
|
1194
|
+
font-size: 12px;
|
|
1195
|
+
line-height: 1;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
.kp-message-action.active {
|
|
1199
|
+
color: #0f6a75;
|
|
1200
|
+
border-color: rgba(15, 118, 110, 0.3);
|
|
1201
|
+
background: rgba(236, 254, 255, 0.92);
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
.kp-suggestions {
|
|
1205
|
+
display: flex;
|
|
1206
|
+
flex-direction: column;
|
|
1207
|
+
gap: 10px;
|
|
1208
|
+
margin-top: auto;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.kp-suggestion {
|
|
1212
|
+
border: 1px solid rgba(15, 118, 110, 0.18);
|
|
1213
|
+
background: rgba(247, 251, 255, 0.92);
|
|
1214
|
+
color: var(--kp-text);
|
|
1215
|
+
border-radius: 999px;
|
|
1216
|
+
padding: 11px 14px;
|
|
1217
|
+
cursor: pointer;
|
|
1218
|
+
text-align: left;
|
|
1219
|
+
font-size: 14px;
|
|
1220
|
+
line-height: 1.35;
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
.kp-footer {
|
|
1224
|
+
padding: 10px 16px 12px;
|
|
1225
|
+
border-top: 1px solid rgba(219, 228, 238, 0.85);
|
|
1226
|
+
background: #ffffff;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
.kp-form {
|
|
1230
|
+
display: flex;
|
|
1231
|
+
align-items: center;
|
|
1232
|
+
gap: 10px;
|
|
1233
|
+
border: 1px solid var(--kp-border-color);
|
|
1234
|
+
border-radius: 16px;
|
|
1235
|
+
padding: 10px 12px;
|
|
1236
|
+
background: #ffffff;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
.kp-rtl .kp-form {
|
|
1240
|
+
flex-direction: row-reverse;
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
.kp-input {
|
|
1244
|
+
flex: 1;
|
|
1245
|
+
border: none;
|
|
1246
|
+
outline: none;
|
|
1247
|
+
box-shadow: none;
|
|
1248
|
+
background: transparent;
|
|
1249
|
+
color: var(--kp-text);
|
|
1250
|
+
font-size: 14px;
|
|
1251
|
+
line-height: 1.5;
|
|
1252
|
+
min-width: 0;
|
|
1253
|
+
appearance: none;
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
.kp-input:focus,
|
|
1257
|
+
.kp-input:focus-visible,
|
|
1258
|
+
.kp-input:active {
|
|
1259
|
+
border: none;
|
|
1260
|
+
outline: none;
|
|
1261
|
+
box-shadow: none;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.kp-send {
|
|
1265
|
+
width: 40px;
|
|
1266
|
+
height: 40px;
|
|
1267
|
+
border: none;
|
|
1268
|
+
border-radius: 999px;
|
|
1269
|
+
background: #e4f1f8;
|
|
1270
|
+
color: var(--kp-accent);
|
|
1271
|
+
cursor: pointer;
|
|
1272
|
+
font-size: 20px;
|
|
1273
|
+
line-height: 1;
|
|
1274
|
+
display: flex;
|
|
1275
|
+
align-items: center;
|
|
1276
|
+
justify-content: center;
|
|
1277
|
+
flex: none;
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
.kp-rtl .kp-send {
|
|
1281
|
+
transform: scaleX(-1);
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
.kp-note {
|
|
1285
|
+
margin-top: 8px;
|
|
1286
|
+
text-align: center;
|
|
1287
|
+
font-size: 11px;
|
|
1288
|
+
line-height: 1.4;
|
|
1289
|
+
color: var(--kp-muted-text);
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
.kp-loading {
|
|
1293
|
+
font-size: 13px;
|
|
1294
|
+
line-height: 1.4;
|
|
1295
|
+
color: var(--kp-muted-text);
|
|
1296
|
+
padding: 4px 2px;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
@media (max-width: 1100px) {
|
|
1300
|
+
.kp-full-page-content:has(.kp-source-panel.open) {
|
|
1301
|
+
grid-template-columns: 260px minmax(0, 1fr);
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
.kp-source-panel.open {
|
|
1305
|
+
position: absolute;
|
|
1306
|
+
inset-inline-end: 28px;
|
|
1307
|
+
top: 92px;
|
|
1308
|
+
bottom: 26px;
|
|
1309
|
+
width: min(320px, calc(100vw - 56px));
|
|
1310
|
+
z-index: 3;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
@media (max-width: 860px) {
|
|
1315
|
+
.kp-full-page-content,
|
|
1316
|
+
.kp-full-page-content:has(.kp-source-panel.open) {
|
|
1317
|
+
grid-template-columns: 1fr;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.kp-full-page-sidebar {
|
|
1321
|
+
max-height: 260px;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
.kp-full-page-embedded .kp-full-page-sidebar {
|
|
1325
|
+
max-height: none;
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
.kp-source-panel.open {
|
|
1329
|
+
position: static;
|
|
1330
|
+
inset: auto;
|
|
1331
|
+
width: auto;
|
|
1332
|
+
max-height: 280px;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
@media (max-width: 640px) {
|
|
1337
|
+
.kp-chat-widget,
|
|
1338
|
+
.kp-chat-widget.bottom-left {
|
|
1339
|
+
left: auto;
|
|
1340
|
+
right: 16px;
|
|
1341
|
+
bottom: 16px;
|
|
1342
|
+
}
|
|
1343
|
+
|
|
1344
|
+
.kp-chat-widget.kp-chat-widget-embedded,
|
|
1345
|
+
.kp-chat-widget.kp-chat-widget-embedded.bottom-left {
|
|
1346
|
+
left: auto;
|
|
1347
|
+
right: auto;
|
|
1348
|
+
bottom: auto;
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
.kp-panel,
|
|
1352
|
+
.kp-chat-widget.bottom-left .kp-panel {
|
|
1353
|
+
inset: 0;
|
|
1354
|
+
width: 100vw;
|
|
1355
|
+
height: 100vh;
|
|
1356
|
+
border-radius: 0;
|
|
1357
|
+
transform: translateX(72px) scale(0.985);
|
|
1358
|
+
transform-origin: center right;
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
.kp-panel.open {
|
|
1362
|
+
transform: translateX(0) scale(1);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
.kp-full-page-shell {
|
|
1366
|
+
padding: 14px;
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
.kp-full-page-embedded .kp-full-page-shell {
|
|
1370
|
+
padding: 0;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
.kp-full-page-header {
|
|
1374
|
+
padding: 0;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
.kp-full-page-body {
|
|
1378
|
+
padding: 24px 16px 16px;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
.kp-full-page-hero-badge {
|
|
1382
|
+
width: 112px;
|
|
1383
|
+
height: 112px;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
.kp-full-page-hero-text {
|
|
1387
|
+
font-size: 22px;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
.kp-message-row {
|
|
1391
|
+
gap: 8px;
|
|
1392
|
+
}
|
|
1393
|
+
|
|
1394
|
+
.kp-avatar {
|
|
1395
|
+
width: 32px;
|
|
1396
|
+
height: 32px;
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1399
|
+
.kp-bubble {
|
|
1400
|
+
max-width: calc(100% - 40px);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
@keyframes kp-cluster-rotate {
|
|
1405
|
+
from { transform: rotate(0deg); }
|
|
1406
|
+
to { transform: rotate(360deg); }
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
@keyframes kp-main-pulse {
|
|
1410
|
+
0%, 100% { transform: translate(-50%, -50%) scale(0.82); opacity: 0.45; }
|
|
1411
|
+
38% { transform: translate(-50%, -50%) scale(1.04); opacity: 1; }
|
|
1412
|
+
60% { transform: translate(-50%, -50%) scale(0.94); opacity: 0.88; }
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
@keyframes kp-orbit-a {
|
|
1416
|
+
0%, 100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
|
|
1417
|
+
40% { transform: translate(-50%, 17px) scale(0.92); opacity: 0.96; }
|
|
1418
|
+
62% { transform: translate(-50%, 2px) scale(1); opacity: 0.98; }
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
@keyframes kp-orbit-b {
|
|
1422
|
+
0%, 100% { transform: translate(0, 0) scale(1); opacity: 1; }
|
|
1423
|
+
40% { transform: translate(-16px, -13px) scale(0.92); opacity: 0.96; }
|
|
1424
|
+
62% { transform: translate(-2px, -2px) scale(1); opacity: 0.98; }
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
@keyframes kp-orbit-c {
|
|
1428
|
+
0%, 100% { transform: translate(0, 0) scale(1); opacity: 1; }
|
|
1429
|
+
40% { transform: translate(16px, -13px) scale(0.92); opacity: 0.96; }
|
|
1430
|
+
62% { transform: translate(2px, -2px) scale(1); opacity: 0.98; }
|
|
1431
|
+
}
|
|
1432
|
+
`}var ut={en:{openChatActions:"Open chat actions",newChat:"New Chat",myChats:"My Chats",openAssistant:"Open Knowledge Assistant",back:"Back",close:"Close",assistantBadge:"Knowledge Assistant",closeAssistantPage:"Close knowledge assistant page",searchChat:"Search Chat",recentActivity:"Recent Activity",pinnedCollections:"Pinned Collections",answersBasedOnPermissions:"Answers are generated based on your access permissions",authTokenForwarded:"Auth token is forwarded from the host app when configured.",thinking:"Thinking...",unableToCreateChat:"Unable to create chat",requestFailed:"Request failed",noRecentChats:"No recent chats yet.",noPinnedChats:"No pinned chats yet.",noChats:"No chats yet.",loadingChats:"Loading chats...",pinChat:"Pin chat",unpinChat:"Unpin chat",renameChat:"Rename",deleteChat:"Delete",chatActions:"Chat actions",renamePrompt:"Enter a new chat name",citationsAttached:e=>`${e} citation${e>1?"s":""} attached`,sourcesUsed:"Sources Used",allSourcesUsed:"All Sources Used",documentsAndReferences:"AI documents and references",showAll:"Show All",noSources:"No sources were returned for this answer.",closeSourcesPanel:"Close sources panel",openSource:"Open source",sourceScore:"Score",sourcePage:"Page",sourceSheet:"Sheet",sourceRow:"Row",sourceKnowledge:"Knowledge Base",untitledSource:"Untitled Source",copy:"Copy",copied:"Copied",helpful:"Helpful",notHelpful:"Needs work",send:"Send message",assistantAvatar:"Assistant",userAvatar:"User"},ar:{openChatActions:"\u0641\u062A\u062D \u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",newChat:"\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",myChats:"\u0645\u062D\u0627\u062F\u062B\u0627\u062A\u064A",openAssistant:"\u0641\u062A\u062D \u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0645\u0639\u0631\u0641\u0629",back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",assistantBadge:"\u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0645\u0639\u0631\u0641\u0629",closeAssistantPage:"\u0625\u063A\u0644\u0627\u0642 \u0635\u0641\u062D\u0629 \u0645\u0633\u0627\u0639\u062F \u0627\u0644\u0645\u0639\u0631\u0641\u0629",searchChat:"\u0627\u0628\u062D\u062B \u0641\u064A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",recentActivity:"\u0627\u0644\u0646\u0634\u0627\u0637 \u0627\u0644\u0623\u062E\u064A\u0631",pinnedCollections:"\u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0627\u0644\u0645\u062B\u0628\u062A\u0629",answersBasedOnPermissions:"\u064A\u062A\u0645 \u0625\u0646\u0634\u0627\u0621 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A \u0628\u0646\u0627\u0621\u064B \u0639\u0644\u0649 \u0635\u0644\u0627\u062D\u064A\u0627\u062A \u0627\u0644\u0648\u0635\u0648\u0644 \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0643",authTokenForwarded:"\u064A\u062A\u0645 \u062A\u0645\u0631\u064A\u0631 \u0631\u0645\u0632 \u0627\u0644\u062A\u062D\u0642\u0642 \u0645\u0646 \u0627\u0644\u062A\u0637\u0628\u064A\u0642 \u0627\u0644\u0645\u0636\u064A\u0641 \u0639\u0646\u062F \u0627\u0644\u0625\u0639\u062F\u0627\u062F.",thinking:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0641\u0643\u064A\u0631...",unableToCreateChat:"\u062A\u0639\u0630\u0631 \u0625\u0646\u0634\u0627\u0621 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",requestFailed:"\u0641\u0634\u0644 \u0627\u0644\u0637\u0644\u0628",noRecentChats:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u062D\u062F\u064A\u062B\u0629 \u0628\u0639\u062F.",noPinnedChats:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0645\u062B\u0628\u062A\u0629 \u0628\u0639\u062F.",noChats:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0628\u0639\u062F.",loadingChats:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A...",pinChat:"\u062A\u062B\u0628\u064A\u062A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",unpinChat:"\u0625\u0644\u063A\u0627\u0621 \u062A\u062B\u0628\u064A\u062A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",renameChat:"\u0625\u0639\u0627\u062F\u0629 \u062A\u0633\u0645\u064A\u0629",deleteChat:"\u062D\u0630\u0641",chatActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",renamePrompt:"\u0623\u062F\u062E\u0644 \u0627\u0633\u0645\u064B\u0627 \u062C\u062F\u064A\u062F\u064B\u0627 \u0644\u0644\u0645\u062D\u0627\u062F\u062B\u0629",citationsAttached:e=>`\u062A\u0645 \u0625\u0631\u0641\u0627\u0642 ${e} \u0645\u0631\u062C\u0639${e>1?"\u0627\u062A":""}`,sourcesUsed:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645\u0629",allSourcesUsed:"\u0643\u0644 \u0627\u0644\u0645\u0635\u0627\u062F\u0631 \u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645\u0629",documentsAndReferences:"\u0645\u0633\u062A\u0646\u062F\u0627\u062A \u0648\u0645\u0631\u0627\u062C\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",showAll:"\u0639\u0631\u0636 \u0627\u0644\u0643\u0644",noSources:"\u0644\u0645 \u064A\u062A\u0645 \u0625\u0631\u062C\u0627\u0639 \u0645\u0635\u0627\u062F\u0631 \u0644\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629.",closeSourcesPanel:"\u0625\u063A\u0644\u0627\u0642 \u0644\u0648\u062D\u0629 \u0627\u0644\u0645\u0635\u0627\u062F\u0631",openSource:"\u0641\u062A\u062D \u0627\u0644\u0645\u0635\u062F\u0631",sourceScore:"\u0627\u0644\u062F\u0631\u062C\u0629",sourcePage:"\u0627\u0644\u0635\u0641\u062D\u0629",sourceSheet:"\u0627\u0644\u0648\u0631\u0642\u0629",sourceRow:"\u0627\u0644\u0635\u0641",sourceKnowledge:"\u0642\u0627\u0639\u062F\u0629 \u0627\u0644\u0645\u0639\u0631\u0641\u0629",untitledSource:"\u0645\u0635\u062F\u0631 \u0628\u062F\u0648\u0646 \u0639\u0646\u0648\u0627\u0646",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",helpful:"\u0645\u0641\u064A\u062F",notHelpful:"\u064A\u062D\u062A\u0627\u062C \u062A\u062D\u0633\u064A\u0646",send:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u0633\u0627\u0644\u0629",assistantAvatar:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F",userAvatar:"\u0627\u0644\u0645\u0633\u062A\u062E\u062F\u0645"}};function Rn(e){if(typeof document>"u")throw new Error("Chat widget can only be initialized in a browser.");let t=pt(e),a=Ae(t.locale),n=Zt(t.locale),i=en(a),l=t.displayMode==="embedded",s={chatId:ce(t),open:!1,fullPageOpen:l,myChatsOpen:!1,accessTokenProvider:t.getAccessToken,historyLoadedChatId:null,menuOpen:!1,chats:[],chatSearchTerm:"",loadingChats:!1,sourcePanelOpen:!1,sourcePanelTitle:null},p=document.createElement("div");p.dataset.chatWidgetHost="true",t.mount.appendChild(p);let c=p.attachShadow({mode:"open"});dt(c,t.theme);let u=o("div",`kp-chat-widget ${t.position}`);u.lang=a,u.dir=i?"rtl":"ltr",l&&(u.classList.add("kp-chat-widget-embedded"),mt(!0)),i&&u.classList.add("kp-rtl");let g=o("div","kp-overlay"),f=o("button","kp-launcher");f.type="button",f.setAttribute("aria-label",t.launcherAriaLabel),f.innerHTML=['<span class="kp-star-cluster" aria-hidden="true">','<span class="kp-star orbit-a">\u2726</span>','<span class="kp-star orbit-b">\u2726</span>','<span class="kp-star orbit-c">\u2726</span>','<span class="kp-star main">\u2726</span>',"</span>"].join("");let h=o("section","kp-panel");h.setAttribute("role","dialog"),h.setAttribute("aria-modal","true"),h.setAttribute("aria-label",t.title);let w=o("div","kp-header"),L=o("div","kp-toolbar"),b=o("button","kp-tool-button kp-menu-trigger");b.type="button",b.setAttribute("aria-label",n.openChatActions),b.innerHTML=['<span class="kp-pencil-icon" aria-hidden="true"></span>','<span class="kp-chevron" aria-hidden="true">\u2304</span>'].join("");let y=o("div","kp-dropdown"),k=o("button","kp-dropdown-item",n.newChat);k.type="button";let M=o("button","kp-dropdown-item",n.myChats);M.type="button";let v=o("button","kp-dropdown-item",n.openAssistant);v.type="button",y.append(k,M,v),L.append(b,y);let Pe=o("div","kp-title-wrap"),wt=o("h2","kp-title",t.title),vt=o("div","kp-subtitle",t.subtitle);Pe.append(wt,vt);let ee=o("button","kp-close","\xD7");ee.type="button",ee.setAttribute("aria-label",t.closeAriaLabel),w.append(L,Pe,ee);let te=o("div","kp-body"),de=o("div","kp-hero"),Ct=o("div","kp-hero-icon","\u2726"),Lt=o("div","kp-hero-text",t.welcomeMessage);de.append(Ct,Lt);let Se=o("div","kp-footer"),ue=o("form","kp-form"),E=o("input","kp-input");E.type="text",E.autocomplete="off",E.placeholder=t.inputPlaceholder,E.setAttribute("aria-label",t.inputPlaceholder);let ge=o("button","kp-send","\u279C");ge.type="submit",ge.setAttribute("aria-label",n.send);let At=o("div","kp-note",n.authTokenForwarded);ue.append(E,ge),Se.append(ue,At),h.append(w,te,Se),l||u.append(g,f,h),c.appendChild(u),te.appendChild(de);let Te=o("div","kp-suggestions");te.appendChild(Te);let ne=o("section","kp-my-chats-sheet"),Ee=o("div","kp-my-chats-header"),ae=o("button","kp-my-chats-nav","\u2190");ae.type="button",ae.setAttribute("aria-label",n.back);let oe=o("button","kp-my-chats-nav kp-my-chats-close","\xD7");oe.type="button",oe.setAttribute("aria-label",n.close),Ee.append(ae,oe);let Ie=o("div","kp-my-chats-body"),Pt=o("div","kp-my-chats-section-label",n.recentActivity),Re=o("div","kp-my-chats-list"),St=o("div","kp-my-chats-section-label",n.pinnedCollections),$e=o("div","kp-my-chats-list");Ie.append(Pt,Re,St,$e),ne.append(Ee,Ie),h.appendChild(ne);let S={body:te,input:E,suggestions:Te,hero:de,kind:"panel"},A=o("section","kp-full-page");l&&A.classList.add("kp-full-page-embedded","open"),A.setAttribute("role","dialog"),l||A.setAttribute("aria-modal","true"),A.setAttribute("aria-label",`${t.title} page`);let He=o("div","kp-full-page-shell"),fe=o("div","kp-full-page-header"),Me=o("div","kp-full-page-brand"),Tt=o("div","kp-full-page-brand-mark","\u2726"),Et=o("div","kp-full-page-brand-text",t.title);Me.append(Tt,Et);let ze=o("div","kp-full-page-header-actions"),It=o("div","kp-full-page-badge",n.assistantBadge),se=o("button","kp-full-page-close","\xD7");se.type="button",se.setAttribute("aria-label",n.closeAssistantPage),ze.append(It,se),fe.append(Me,ze),t.embedded.showHeader||fe.classList.add("kp-hidden");let Ne=o("div","kp-full-page-content"),Oe=o("aside","kp-full-page-sidebar"),he=o("button","kp-full-page-new-chat",`+ ${n.newChat}`);he.type="button";let Ue=o("div","kp-full-page-search"),F=o("input","kp-full-page-search-input");F.type="search",F.placeholder=n.searchChat;let Rt=o("span","kp-full-page-search-icon","\u2315");Ue.append(F,Rt);let $t=o("div","kp-full-page-section-label",n.recentActivity),Be=o("div","kp-full-page-recent-list"),Ht=o("div","kp-full-page-section-label",n.pinnedCollections),We=o("div","kp-full-page-pinned-list");Oe.append(he,Ue,$t,Be,Ht,We);let je=o("main","kp-full-page-main"),De=o("section","kp-full-page-panel"),me=o("div","kp-full-page-body"),be=o("div","kp-full-page-hero"),qe=o("div","kp-full-page-hero-badge");qe.innerHTML=['<span class="kp-star-cluster kp-star-cluster-static" aria-hidden="true">','<span class="kp-star orbit-a">\u2726</span>','<span class="kp-star orbit-b">\u2726</span>','<span class="kp-star orbit-c">\u2726</span>','<span class="kp-star main">\u2726</span>',"</span>"].join("");let Mt=o("div","kp-full-page-hero-text",t.welcomeMessage);be.append(qe,Mt);let Ve=o("div","kp-suggestions kp-full-page-suggestions");me.append(be,Ve);let _e=o("div","kp-full-page-footer"),ke=o("form","kp-form kp-full-page-form"),P=o("input","kp-input kp-full-page-input");P.type="text",P.autocomplete="off",P.placeholder=t.inputPlaceholder,P.setAttribute("aria-label",t.inputPlaceholder);let xe=o("button","kp-send kp-full-page-send","\u279C");xe.type="submit",xe.setAttribute("aria-label",n.send);let zt=o("div","kp-note kp-full-page-note",n.answersBasedOnPermissions);ke.append(P,xe),_e.append(ke,zt),De.append(me,_e),je.appendChild(De);let re=o("aside","kp-source-panel"),Fe=o("div","kp-source-panel-header"),Ke=o("div","kp-source-panel-title-wrap"),Xe=o("div","kp-source-panel-title",n.allSourcesUsed),Nt=o("div","kp-source-panel-subtitle",n.documentsAndReferences);Ke.append(Xe,Nt);let ie=o("button","kp-source-panel-close","\xD7");ie.type="button",ie.setAttribute("aria-label",n.closeSourcesPanel),Fe.append(Ke,ie);let K=o("div","kp-source-panel-list"),Ot=o("div","kp-source-panel-empty",n.noSources);K.appendChild(Ot),re.append(Fe,K),Ne.append(Oe,je,re),He.append(fe,Ne),A.appendChild(He),u.appendChild(A);let C={body:me,input:P,suggestions:Ve,hero:be,kind:"full-page"},z=()=>({...t,getAccessToken:s.accessTokenProvider}),Ye=async()=>{if(!t.getUserContext)return null;try{let r=await t.getUserContext();return r?.displayName?.trim()||r?.email?.trim()||r?.userId?.trim()||null}catch{return null}},X=(r,d)=>{if(s.sourcePanelOpen=!0,s.sourcePanelTitle=d??n.allSourcesUsed,Xe.textContent=s.sourcePanelTitle,re.classList.add("open"),K.textContent="",r.length===0){K.appendChild(o("div","kp-source-panel-empty",n.noSources));return}for(let m of r)K.appendChild(cn(m,n))},W=()=>{s.sourcePanelOpen=!1,s.sourcePanelTitle=null,re.classList.remove("open")};V(S,t.initialSuggestions,async r=>{await I(r,S)}),V(C,t.initialSuggestions,async r=>{await I(r,C)}),O(),le(),l&&(T(),t.rag.loadHistoryOnOpen&&j(C,s.chatId));function ye(){if(l){s.fullPageOpen=!0,A.classList.add("open");return}s.open||(s.open=!0,s.fullPageOpen=!1,$(),A.classList.remove("open"),f.classList.add("hidden"),g.classList.add("visible"),h.classList.add("open"),t.onOpen?.(),t.rag.loadHistoryOnOpen&&we.loadHistory(),queueMicrotask(()=>E.focus()))}function N(){if(l){W();return}s.open&&(R(),$(),s.open=!1,f.classList.remove("hidden"),g.classList.remove("visible"),h.classList.remove("open"),t.onClose?.())}async function I(r,d){let m=r.trim();if(!m)return;d.input.value="";try{await Dt(m)}catch(H){let Y=B(t,H);G(d.body,"bot",`${n.unableToCreateChat}: ${Y.message}`,{strings:n,view:d,userName:null,onShowSources:X});return}gt(d),G(d.body,"user",m,{strings:n,view:d,userName:await Ye(),onShowSources:X}),d.body.scrollTop=d.body.scrollHeight;let U=o("div","kp-loading",n.thinking);d.body.appendChild(U),d.body.scrollTop=d.body.scrollHeight;try{let H=await ot(z(),{message:m,chatId:s.chatId,knowledgeNames:await Kt(t),...t.rag.enableReferences!==void 0?{enableReferences:t.rag.enableReferences}:{}});U.isConnected&&U.remove(),G(d.body,"bot",H.answer,{strings:n,view:d,userName:null,citations:H.citations??[],onShowSources:X}),s.historyLoadedChatId=null,await T(),H.suggestions?.length&&V(d,H.suggestions,async Y=>{await I(Y,d)})}catch(H){let Y=B(t,H);U.isConnected&&U.remove(),G(d.body,"bot",`${n.requestFailed}: ${Y.message}`,{strings:n,view:d,userName:null,onShowSources:X})}}async function Je(r){let d=s.fullPageOpen?C:S;await I(r,d)}async function Ut(){if(l){s.fullPageOpen=!0,A.classList.add("open"),await T(),await j(C,s.chatId),queueMicrotask(()=>P.focus());return}s.fullPageOpen=!0,s.open=!1,R(),$(),h.classList.remove("open"),g.classList.remove("visible"),f.classList.add("hidden"),A.classList.add("open"),await T(),await j(C,s.chatId),queueMicrotask(()=>P.focus())}function Qe(){if(l){W();return}s.fullPageOpen&&(s.fullPageOpen=!1,A.classList.remove("open"),f.classList.remove("hidden"),W())}function Bt(){s.menuOpen=!0,b.classList.add("open"),y.classList.add("open")}function R(){s.menuOpen=!1,b.classList.remove("open"),y.classList.remove("open")}function Wt(){s.chatId=ce(t),s.historyLoadedChatId=null,$(),Q(S),V(S,t.initialSuggestions,async r=>{await I(r,S)}),R()}async function jt(){s.chatId=ce(t),s.historyLoadedChatId=null,Q(C),W(),V(C,t.initialSuggestions,async r=>{await I(r,C)}),O()}async function T(){if(!t.endpoints.listChats)return O(),le(),[];s.loadingChats=!0,O(),le();try{let r=await rt(z());return s.chats=r,r}catch(r){return B(t,r),s.chats}finally{s.loadingChats=!1,O(),le()}}async function Dt(r){!t.endpoints.listChats&&!t.endpoints.createChat||s.chats.some(d=>d.chatId===s.chatId)||await it(z(),s.chatId,r?Gt(r,n.newChat):void 0)}async function qt(r){s.chatId=r,s.historyLoadedChatId=null,await j(C,r),O()}async function Vt(r){s.chatId=r,s.historyLoadedChatId=null,await j(S,r),$()}async function _t(){R(),await T(),s.myChatsOpen=!0,h.classList.add("kp-sheet-open"),ne.classList.add("open")}function $(){s.myChatsOpen=!1,h.classList.remove("kp-sheet-open"),ne.classList.remove("open")}async function Ge(r){if(!t.endpoints.updateChat)return;let d=window.prompt(n.renamePrompt,r.title)?.trim();if(!(!d||d===r.title))try{await Ce(z(),r.chatId,{title:d}),await T()}catch(m){B(t,m)}}async function Ze(r){if(t.endpoints.deleteChat)try{await lt(z(),r.chatId),s.chatId===r.chatId&&(s.chatId=ce(t),s.historyLoadedChatId=null,Q(S),Q(C)),await T()}catch(d){B(t,d)}}function O(){ft(Be,We,s,n,async r=>{await qt(r.chatId)},async r=>{await et(r)},async r=>{await Ge(r)},async r=>{await Ze(r)})}function le(){ft(Re,$e,s,n,async r=>{await Vt(r.chatId)},async r=>{await et(r)},async r=>{await Ge(r)},async r=>{await Ze(r)})}async function et(r){if(t.endpoints.updateChat)try{await Ce(z(),r.chatId,{pinned:!r.pinned}),await T()}catch(d){B(t,d)}}async function j(r,d){Q(r),V(r,t.initialSuggestions,async U=>{await I(U,r)});let m=await st(z(),d);return m.length>0&&(gt(r),bt(r.body,r.hero,r.suggestions),Qt(r.body,m,{strings:n,view:r,userName:await Ye(),onShowSources:X})),s.historyLoadedChatId=d,m}let we={open:ye,close:N,toggle(){if(l){ye();return}if(s.open){N();return}ye()},destroy(){if(document.removeEventListener("keydown",tt),p.remove(),l){let r=!1;document.querySelectorAll("[data-chat-widget-host]").forEach(d=>{let m=d.shadowRoot;m&&m.querySelector(".kp-chat-widget-embedded")&&(r=!0)}),r||mt(!1)}},sendMessage:Je,setAccessTokenProvider(r){s.accessTokenProvider=r},getChatId(){return s.chatId},loadChats(){return T()},async loadHistory(){let r=s.fullPageOpen?C:S;return j(r,s.chatId)}};f.addEventListener("click",()=>we.toggle()),ee.addEventListener("click",N),g.addEventListener("click",N),ie.addEventListener("click",W),ae.addEventListener("click",$),oe.addEventListener("click",$),b.addEventListener("click",r=>{if(r.stopPropagation(),!s.menuOpen){Bt();return}R()}),k.addEventListener("click",Wt),M.addEventListener("click",async()=>{await _t()}),v.addEventListener("click",()=>{if(R(),t.onOpenAssistantPage){N(),t.onOpenAssistantPage();return}if(t.assistantPageUrl){N(),window.location.href=t.assistantPageUrl;return}Ut()}),se.addEventListener("click",Qe),he.addEventListener("click",()=>{jt(),queueMicrotask(()=>P.focus())}),F.addEventListener("input",()=>{s.chatSearchTerm=F.value.trim().toLowerCase(),O()}),h.addEventListener("click",r=>{let d=r.target;if(!(d instanceof Element)||!d.closest(".kp-chat-actions")){for(let m of Array.from(c.querySelectorAll(".kp-chat-actions.open")))m.classList.remove("open");for(let m of Array.from(c.querySelectorAll(".kp-full-page-chat-item.menu-open")))m.classList.remove("menu-open")}s.menuOpen&&!y.contains(d)&&!b.contains(d)&&R(),r.stopPropagation()}),c.addEventListener("click",r=>{let d=r.target;if(s.menuOpen&&d instanceof Node&&!y.contains(d)&&!b.contains(d)&&R(),d instanceof Element&&!d.closest(".kp-chat-actions")){for(let m of Array.from(c.querySelectorAll(".kp-chat-actions.open")))m.classList.remove("open");for(let m of Array.from(c.querySelectorAll(".kp-full-page-chat-item.menu-open")))m.classList.remove("menu-open")}}),ue.addEventListener("submit",async r=>{r.preventDefault(),await Je(E.value)}),ke.addEventListener("submit",async r=>{r.preventDefault(),await I(P.value,C)});function tt(r){if(r.key==="Escape"){if(s.sourcePanelOpen){W();return}if(s.myChatsOpen){$();return}if(s.fullPageOpen){if(l)return;Qe();return}s.open&&N()}}return document.addEventListener("keydown",tt),we}async function Kt(e){if(e.rag.getKnowledgeNames){let t=await e.rag.getKnowledgeNames();return Array.isArray(t)?t.filter(Boolean):[]}return(e.rag.knowledgeNames??[]).filter(Boolean)}function ce(e){return e.rag.chatId?.trim()?e.rag.chatId:e.rag.chatIdFactory?e.rag.chatIdFactory():typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`kp-chat-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function G(e,t,a,n){let i=t==="bot"?nn(a,n.citations??[]):{displayText:a,citations:n.citations??[]},l=o("div",`kp-message-row ${t}`),s=Yt(t==="bot"?n.strings.assistantAvatar:n.userName??n.strings.userAvatar,t),p=o("div",`kp-bubble ${t}`),c=o("div","kp-bubble-content");gn(c,i.displayText),p.appendChild(c);let u=i.citations;if(u.length){let g=o("div","kp-meta",n.strings.citationsAttached(u.length));p.appendChild(g);let f=o("div","kp-source-preview"),h=o("div","kp-source-preview-title",n.strings.sourcesUsed),w=o("div","kp-source-preview-list");for(let b of u.slice(0,2)){let y=ln(b,n.strings);y.addEventListener("click",async()=>{xt(b,n.strings)}),w.appendChild(y)}let L=pn(n.strings);L.addEventListener("click",async()=>{n.onShowSources(u,n.strings.allSourcesUsed)}),w.appendChild(L),f.append(h,w),p.appendChild(f)}return t==="bot"&&p.appendChild(Xt(i.displayText,n.strings)),t==="user"?l.append(p,s):l.append(s,p),e.appendChild(l),e.scrollTop=e.scrollHeight,l}function Xt(e,t){let a=o("div","kp-message-actions"),n=o("button","kp-message-action",t.copy);n.type="button",n.addEventListener("click",async()=>{try{await navigator.clipboard.writeText(e),n.textContent=t.copied,window.setTimeout(()=>{n.textContent=t.copy},1200)}catch{n.textContent=t.copy}});let i=o("button","kp-message-action","\u{1F44D}");i.type="button",i.setAttribute("aria-label",t.helpful),i.addEventListener("click",()=>{i.classList.toggle("active"),l.classList.remove("active")});let l=o("button","kp-message-action","\u{1F44E}");return l.type="button",l.setAttribute("aria-label",t.notHelpful),l.addEventListener("click",()=>{l.classList.toggle("active"),i.classList.remove("active")}),a.append(n,i,l),a}function Yt(e,t){let a=o("div",`kp-avatar ${t}`),n=t==="bot"?"\u2726":tn(e);return a.textContent=n,a.setAttribute("aria-hidden","true"),a}function Jt(e,t,a){e.textContent="";for(let n of t){let i=o("button","kp-suggestion",n);i.type="button",i.addEventListener("click",async()=>{await a(n)}),e.appendChild(i)}}function V(e,t,a){Jt(e.suggestions,t,async n=>{e.input.value=n,await a(n)})}function bt(e,t,a){let n=new Set([t,a]);for(let i of Array.from(e.children))n.has(i)||i.remove()}function gt(e){e.body.classList.add("kp-conversation-active"),e.hero.remove(),e.suggestions.remove()}function Q(e){e.body.classList.remove("kp-conversation-active"),e.hero.isConnected||e.body.prepend(e.hero),e.suggestions.isConnected||e.body.appendChild(e.suggestions),bt(e.body,e.hero,e.suggestions),e.input.value=""}function Qt(e,t,a){for(let n of t)G(e,n.role==="assistant"?"bot":"user",n.text,a)}function ft(e,t,a,n,i,l,s,p){if(e.textContent="",t.textContent="",a.loadingChats){e.appendChild(o("div","kp-full-page-empty",n.loadingChats));return}let c=a.chats.filter(u=>a.chatSearchTerm?u.title.toLowerCase().includes(a.chatSearchTerm):!0);if(c.length>0){let u=c.filter(f=>f.pinned),g=c.filter(f=>!f.pinned).slice(0,8);ht(e,g,a.chatId,n,i,l,s,p),ht(t,u,a.chatId,n,i,l,s,p),g.length===0&&e.appendChild(o("div","kp-full-page-empty",n.noRecentChats)),u.length===0&&t.appendChild(o("div","kp-full-page-empty",n.noPinnedChats));return}e.appendChild(o("div","kp-full-page-empty",n.noChats)),t.appendChild(o("div","kp-full-page-empty",n.noPinnedChats))}function ht(e,t,a,n,i,l,s,p){for(let c of t){let u=o("div",`kp-full-page-item kp-full-page-chat-item${c.chatId===a?" active":""}`),g=o("span","kp-full-page-item-title",c.title),f=o("div","kp-chat-actions"),h=o("button","kp-chat-actions-trigger","\u22EF");h.type="button",h.setAttribute("aria-label",n.chatActions);let w=o("div","kp-chat-actions-menu"),L=o("button","kp-chat-actions-item",c.pinned?n.unpinChat:n.pinChat);L.type="button",L.addEventListener("click",async k=>{k.stopPropagation(),await l(c)});let b=o("button","kp-chat-actions-item",n.renameChat);b.type="button",b.addEventListener("click",async k=>{k.stopPropagation(),await s(c)});let y=o("button","kp-chat-actions-item",n.deleteChat);y.type="button",y.addEventListener("click",async k=>{k.stopPropagation(),await p(c)}),w.append(L,b,y),f.append(h,w),h.addEventListener("click",k=>{k.stopPropagation();let M=f.classList.contains("open");for(let v of Array.from(e.querySelectorAll(".kp-chat-actions.open")))v.classList.remove("open");for(let v of Array.from(e.querySelectorAll(".kp-full-page-chat-item.menu-open")))v.classList.remove("menu-open");M||(f.classList.add("open"),u.classList.add("menu-open"))}),u.append(g,f),u.setAttribute("role","button"),u.tabIndex=0,u.addEventListener("click",async()=>{await i(c)}),u.addEventListener("keydown",async k=>{(k.key==="Enter"||k.key===" ")&&(k.preventDefault(),await i(c))}),u.addEventListener("blur",()=>{f.classList.remove("open"),u.classList.remove("menu-open")}),e.appendChild(u)}}function Gt(e,t){return e.trim().slice(0,60)||t}function Ae(e){return e.toLowerCase().split("-")[0]||"en"}function Zt(e){let t=ut.en;return ut[Ae(e)]??t}function en(e){return["ar","fa","he","ur"].includes(Ae(e))}function tn(e){let t=e.split(/\s+/).filter(Boolean).slice(0,2);return t.length===0?"U":t.map(a=>a[0]?.toUpperCase()??"").join("")}function kt(e){return e.knowledgeName?.trim()||e.sourceDocument?.trim()||null}function nn(e,t){let a=an(e);return{displayText:a.displayText,citations:t.length>0?rn(t,a.citations):a.citations}}function an(e){let a=yt(e).split(`
|
|
1433
|
+
`),n=-1;for(let c=0;c<a.length;c+=1)/^#{0,6}\s*References\s*$/i.test(a[c]?.trim()??"")&&(n=c);if(n===-1)return{displayText:e,citations:[]};let i=a.slice(0,n).join(`
|
|
1434
|
+
`).trimEnd(),l=a.slice(n+1).join(`
|
|
1435
|
+
`).trim(),p=on(l).map(c=>sn(c)).filter(c=>!!c);return{displayText:i,citations:p}}function on(e){let t=[],a="";for(let n of e.split(`
|
|
1436
|
+
`)){let i=n.trim();if(i){if(/^\d+\.\s+/.test(i)){a&&t.push(a.trim()),a=i.replace(/^\d+\.\s+/,"");continue}a&&(a=`${a} ${i}`)}}return a&&t.push(a.trim()),t}function sn(e){let t=e.match(/https?:\/\/\S+/i);if(!t)return null;let a=t[0],n=e.slice(0,t.index).replace(/[.\s]+$/,"").trim();return{sourceDocument:a,knowledgeName:n||a}}function rn(e,t){let a=[],n=new Set;for(let i of[...e,...t]){let l=`${i.knowledgeName??""}::${i.sourceDocument??""}`;n.has(l)||(n.add(l),a.push(i))}return a}function ln(e,t){let a=o("button","kp-source-chip");a.type="button",a.setAttribute("aria-label",t.openSource);let n=o("span","kp-source-thumb");n.textContent="\u2726";let i=o("span","kp-source-chip-label",kt(e)??t.untitledSource);return a.append(n,i),a}function pn(e){let t=o("button","kp-source-chip kp-source-chip-more");t.type="button";let a=o("span","kp-source-thumb-stack");for(let i=0;i<3;i+=1){let l=o("span","kp-source-thumb stacked");l.textContent="\u2726",a.appendChild(l)}let n=o("span","kp-source-chip-label",e.showAll);return t.append(a,n),t}function cn(e,t){let a=o("button","kp-source-card");a.type="button",a.setAttribute("aria-label",t.openSource),a.addEventListener("click",()=>{xt(e,t)});let n=o("div","kp-source-card-media"),i=o("span","kp-source-thumb kp-source-thumb-large");i.textContent="\u2726";let l=o("div","kp-source-card-title",kt(e)??t.untitledSource),s=o("div","kp-source-card-meta"),p=[];return typeof e.score=="number"&&p.push(`${t.sourceScore}: ${e.score.toFixed(2)}`),typeof e.pageNumber=="number"&&p.push(`${t.sourcePage}: ${e.pageNumber}`),e.sheetName&&p.push(`${t.sourceSheet}: ${e.sheetName}`),typeof e.rowNumber=="number"&&p.push(`${t.sourceRow}: ${e.rowNumber}`),e.knowledgeName&&p.push(`${t.sourceKnowledge}: ${e.knowledgeName}`),s.textContent=p.join(" \u2022 "),n.appendChild(i),a.append(n,l,s),a}function xt(e,t){let a=e.sourceDocument?.trim()||e.knowledgeName?.trim()||t.untitledSource,n=dn(e.sourceDocument);if(n){window.open(n,"_blank","noopener,noreferrer");return}let i=window.open("","_blank","noopener,noreferrer");if(!i)return;let l=Z(a),s=un(e,t).map(p=>`<li>${Z(p)}</li>`).join("");i.document.write(`<!doctype html>
|
|
1437
|
+
<html lang="en">
|
|
1438
|
+
<head>
|
|
1439
|
+
<meta charset="utf-8">
|
|
1440
|
+
<title>${l}</title>
|
|
1441
|
+
<style>
|
|
1442
|
+
body { font-family: Arial, sans-serif; margin: 32px; color: #1f2937; }
|
|
1443
|
+
.card { max-width: 720px; padding: 24px; border: 1px solid #dbe4ee; border-radius: 16px; background: #fff; }
|
|
1444
|
+
h1 { margin: 0 0 12px; font-size: 24px; }
|
|
1445
|
+
p { margin: 0 0 16px; color: #64748b; }
|
|
1446
|
+
ul { margin: 0; padding-left: 20px; }
|
|
1447
|
+
</style>
|
|
1448
|
+
</head>
|
|
1449
|
+
<body>
|
|
1450
|
+
<div class="card">
|
|
1451
|
+
<h1>${l}</h1>
|
|
1452
|
+
<p>${Z(t.documentsAndReferences)}</p>
|
|
1453
|
+
<ul>${s||`<li>${Z(t.noSources)}</li>`}</ul>
|
|
1454
|
+
</div>
|
|
1455
|
+
</body>
|
|
1456
|
+
</html>`),i.document.close()}function dn(e){if(!e)return null;let t=e.trim();return/^https?:\/\//i.test(t)?t:null}function un(e,t){let a=[];return e.sourceDocument&&a.push(e.sourceDocument),typeof e.score=="number"&&a.push(`${t.sourceScore}: ${e.score.toFixed(2)}`),typeof e.pageNumber=="number"&&a.push(`${t.sourcePage}: ${e.pageNumber}`),e.sheetName&&a.push(`${t.sourceSheet}: ${e.sheetName}`),typeof e.rowNumber=="number"&&a.push(`${t.sourceRow}: ${e.rowNumber}`),e.knowledgeName&&a.push(`${t.sourceKnowledge}: ${e.knowledgeName}`),a}function gn(e,t){e.innerHTML=fn(yt(t))}function yt(e){return e.replace(/\r\n/g,`
|
|
1457
|
+
`).replace(/<br\s*\/?>/gi,`
|
|
1458
|
+
`)}function fn(e){return e.split(/\n{2,}/).map(a=>a.trim()).filter(Boolean).map(hn).join("")}function hn(e){let t=e.split(`
|
|
1459
|
+
`).map(n=>n.trimEnd());if(t.every(n=>/^\s*\|.*\|\s*$/.test(n))&&t.length>=2)return mn(t);if(t.every(n=>/^\d+\.\s+/.test(n)))return`<ol>${t.map(n=>`<li>${_(n.replace(/^\d+\.\s+/,""))}</li>`).join("")}</ol>`;if(t.every(n=>/^[-*]\s+/.test(n)))return`<ul>${t.map(n=>`<li>${_(n.replace(/^[-*]\s+/,""))}</li>`).join("")}</ul>`;let a=t[0]?.match(/^(#{1,6})\s+(.*)$/);if(a){let n=a[1]??"#",i=a[2]??"",l=n.length;return`<h${l}>${_(i)}</h${l}>`}return`<p>${t.map(n=>_(n)).join("<br>")}</p>`}function mn(e){let t=e.filter((s,p)=>!(p===1&&/^\s*\|?(\s*:?-{3,}:?\s*\|)+\s*$/.test(s))).map(s=>bn(s));if(t.length===0)return"";let a=t[0]??[],n=t.slice(1),i=`<thead><tr>${a.map(s=>`<th>${_(s)}</th>`).join("")}</tr></thead>`,l=n.length?`<tbody>${n.map(s=>`<tr>${s.map(p=>`<td>${_(p)}</td>`).join("")}</tr>`).join("")}</tbody>`:"";return`<div class="kp-table-wrap"><table>${i}${l}</table></div>`}function bn(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>t.trim())}function _(e){let t=Z(e);return t=t.replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,'<a href="$2" target="_blank" rel="noreferrer">$1</a>'),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/\*([^*]+)\*/g,"<em>$1</em>"),t}function Z(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function mt(e){typeof document>"u"||document.querySelectorAll("[data-chat-widget-host]").forEach(t=>{let a=t.shadowRoot;if(a){let n=a.querySelector(".kp-chat-widget");n&&!n.classList.contains("kp-chat-widget-embedded")&&(t.style.display=e?"none":"")}})}export{Rn as a};
|
|
1460
|
+
//# sourceMappingURL=chunk-LET2O6EB.js.map
|