react-aichatbot-widget 1.4.2 → 1.4.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/LICENSE +20 -20
- package/README.md +71 -71
- package/dist/index.cjs +6 -6
- package/dist/index.js +373 -357
- package/package.json +41 -41
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
*** Copyright (c) 2025 Prashanta Pandit ***
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
*** Copyright (c) 2025 Prashanta Pandit ***
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
21
|
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
# React AI Chatbot Widget
|
|
2
|
-
|
|
3
|
-
A React chatbot widget using **React**, **TailwindCSS**, **Axios**, and **Lucide Icons**.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Installation
|
|
8
|
-
|
|
9
|
-
### Step 1: Install the Widget
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
npm install react-aichatbot-widget
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
> `axios` is included with the widget and does not need to be installed separately.
|
|
16
|
-
|
|
17
|
-
### Step 2: Install Peer Dependencies
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install react react-dom tailwindcss lucide-react
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
> Ensure versions match your project.
|
|
24
|
-
|
|
25
|
-
| Package | Version | | |
|
|
26
|
-
| -------------- | -------- | - | ------- |
|
|
27
|
-
| `react` | ^18.0.0 | | ^19.0.0 |
|
|
28
|
-
| `react-dom` | ^18.0.0 | | ^19.0.0 |
|
|
29
|
-
| `tailwindcss` | ^4.1.17 | | |
|
|
30
|
-
| `lucide-react` | ^0.554.0 | | |
|
|
31
|
-
| `axios` | ^1.6.0 | | |
|
|
32
|
-
| `uuid` | ^13.0.0 | | |
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## Usage Example
|
|
37
|
-
|
|
38
|
-
```jsx
|
|
39
|
-
import React from "react";
|
|
40
|
-
import ChatBotWidget from "react-aichatbot-widget";
|
|
41
|
-
|
|
42
|
-
function App() {
|
|
43
|
-
return (
|
|
44
|
-
<div className="App">
|
|
45
|
-
{/*add a namespace for chatbot and chatbot url*/}
|
|
46
|
-
<ChatBotWidget
|
|
47
|
-
pineconeNamespace=''
|
|
48
|
-
url=''
|
|
49
|
-
primaryColor="" // hex color code
|
|
50
|
-
secondaryColor="" // hex color code
|
|
51
|
-
fontColor="" // hex color code
|
|
52
|
-
backgroundColor="" // hex color code
|
|
53
|
-
position="" // left or right
|
|
54
|
-
name="" // any name
|
|
55
|
-
subTitle="" // any subtitle
|
|
56
|
-
welcomeText="" // any welcome text
|
|
57
|
-
/>
|
|
58
|
-
</div>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export default App;
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
## Notes
|
|
68
|
-
|
|
69
|
-
* `axios` & `uuid` is bundled; no extra installation required.
|
|
70
|
-
* TailwindCSS is required if you want to customize styles.
|
|
71
|
-
* React and ReactDOM must match the versions listed above.
|
|
1
|
+
# React AI Chatbot Widget
|
|
2
|
+
|
|
3
|
+
A React chatbot widget using **React**, **TailwindCSS**, **Axios**, and **Lucide Icons**.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
### Step 1: Install the Widget
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install react-aichatbot-widget
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
> `axios` is included with the widget and does not need to be installed separately.
|
|
16
|
+
|
|
17
|
+
### Step 2: Install Peer Dependencies
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install react react-dom tailwindcss lucide-react
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
> Ensure versions match your project.
|
|
24
|
+
|
|
25
|
+
| Package | Version | | |
|
|
26
|
+
| -------------- | -------- | - | ------- |
|
|
27
|
+
| `react` | ^18.0.0 | | ^19.0.0 |
|
|
28
|
+
| `react-dom` | ^18.0.0 | | ^19.0.0 |
|
|
29
|
+
| `tailwindcss` | ^4.1.17 | | |
|
|
30
|
+
| `lucide-react` | ^0.554.0 | | |
|
|
31
|
+
| `axios` | ^1.6.0 | | |
|
|
32
|
+
| `uuid` | ^13.0.0 | | |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Usage Example
|
|
37
|
+
|
|
38
|
+
```jsx
|
|
39
|
+
import React from "react";
|
|
40
|
+
import ChatBotWidget from "react-aichatbot-widget";
|
|
41
|
+
|
|
42
|
+
function App() {
|
|
43
|
+
return (
|
|
44
|
+
<div className="App">
|
|
45
|
+
{/*add a namespace for chatbot and chatbot url*/}
|
|
46
|
+
<ChatBotWidget
|
|
47
|
+
pineconeNamespace=''
|
|
48
|
+
url=''
|
|
49
|
+
primaryColor="" // hex color code
|
|
50
|
+
secondaryColor="" // hex color code
|
|
51
|
+
fontColor="" // hex color code
|
|
52
|
+
backgroundColor="" // hex color code
|
|
53
|
+
position="" // left or right
|
|
54
|
+
name="" // any name
|
|
55
|
+
subTitle="" // any subtitle
|
|
56
|
+
welcomeText="" // any welcome text
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default App;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
|
|
69
|
+
* `axios` & `uuid` is bundled; no extra installation required.
|
|
70
|
+
* TailwindCSS is required if you want to customize styles.
|
|
71
|
+
* React and ReactDOM must match the versions listed above.
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const h=require("react/jsx-runtime"),F=require("react"),D=require("lucide-react"),xt=require("uuid"),gt=({onClick:e,isOpen:t,theme:n,chatBotData:r})=>{const s=r.position==="left",l={position:"fixed",bottom:"32px",left:s?"32px":"auto",right:s?"auto":"32px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,width:"64px",height:"64px",borderRadius:"50%",border:"none",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"auto",transition:"all 300ms ease",outline:"none"},p={transform:"scale(1.10)",boxShadow:"0 25px 35px -5px rgba(0,0,0,0.2)"},u={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return h.jsxs("button",{onClick:e,style:l,onMouseEnter:c=>Object.assign(c.currentTarget.style,p),onMouseLeave:c=>Object.keys(p).forEach(
|
|
1
|
+
"use strict";const h=require("react/jsx-runtime"),F=require("react"),D=require("lucide-react"),xt=require("uuid"),gt=({onClick:e,isOpen:t,theme:n,chatBotData:r})=>{const s=r.position==="left",l={position:"fixed",bottom:"32px",left:s?"32px":"auto",right:s?"auto":"32px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,width:"64px",height:"64px",borderRadius:"50%",border:"none",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",pointerEvents:"auto",transition:"all 300ms ease",outline:"none"},p={transform:"scale(1.10)",boxShadow:"0 25px 35px -5px rgba(0,0,0,0.2)"},u={position:"absolute",top:"-4px",right:"-4px",width:"16px",height:"16px",backgroundColor:"#34d399",borderRadius:"50%",border:"4px solid white",animation:"pulse 2s infinite"};return h.jsxs("button",{onClick:e,style:l,onMouseEnter:c=>Object.assign(c.currentTarget.style,p),onMouseLeave:c=>Object.keys(p).forEach(d=>c.currentTarget.style[d]=l[d]||""),onFocus:c=>Object.assign(c.currentTarget.style,p),onBlur:c=>Object.keys(p).forEach(d=>c.currentTarget.style[d]=l[d]||""),children:[t?h.jsx(D.X,{size:30,strokeWidth:2.5}):h.jsx(D.MessageCircle,{size:30,strokeWidth:2.5}),!t&&h.jsx("span",{style:u}),h.jsx("style",{jsx:!0,children:`
|
|
2
2
|
@keyframes pulse {
|
|
3
3
|
0% {
|
|
4
4
|
box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.7);
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`})]})},wt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=F.useState(""),i=()=>{!r.trim()||t||(e(r.trim()),s(""))},o=f=>{f.key==="Enter"&&!f.shiftKey&&(f.preventDefault(),i())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",borderColor:n.fontColor,background:n.backgroundColor,flexShrink:0},p={display:"flex",gap:"12px",alignItems:"center"},u={flex:1,padding:"12px 16px",background:n.inputBackgroundColor||n.backgroundColor,color:n.fontColor,border:`1px solid ${n.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:t?.5:1,cursor:t?"not-allowed":"text",boxShadow:"none"},c={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,border:"none",cursor:t||!r.trim()?"not-allowed":"pointer",opacity:t||!r.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"};return h.jsx("div",{style:l,children:h.jsxs("div",{style:p,children:[h.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:f=>s(f.target.value),onKeyDown:o,disabled:t,style:u,onFocus:f=>{f.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",f.target.style.borderColor="#60a5fa"},onBlur:f=>{f.target.style.boxShadow="none",f.target.style.borderColor=n.fontColor}}),h.jsx("button",{onClick:i,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:f=>{!t&&r.trim()&&(f.currentTarget.style.transform="translateY(-2px)",f.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:f=>{f.currentTarget.style.transform="translateY(0)",f.currentTarget.style.boxShadow="none"},children:h.jsx(D.Send,{size:18})})]})})},St=({messages:e,isLoading:t,theme:n})=>{const r=F.useRef(null),s=()=>{r.current?.scrollIntoView({behavior:"smooth"})};F.useEffect(()=>{s()},[e,t]);const i={flex:1,overflowY:"auto",padding:"20px",background:n.backgroundColor,color:n.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column",gap:"16px"},o=c=>({display:"flex",justifyContent:c==="user"?"flex-end":"flex-start",width:"100%"}),l={display:"flex",flexDirection:"column",maxWidth:"80%"},p=c=>({padding:"12px 16px",borderRadius:"16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid #e4e4e7",fontSize:"14px",lineHeight:"1.5",background:c==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),u={...p("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return h.jsxs("div",{style:i,children:[e.map((c,f)=>h.jsx("div",{style:o(c.type),children:h.jsxs("div",{style:l,children:[c.type==="bot"&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[h.jsx(D.Bot,{size:14,color:n.fontColor}),h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:c.response_timestamp})]}),c.type==="user"&&h.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),h.jsx("div",{style:p(c.type),children:c.text})]})},f)),t&&h.jsx("div",{style:o("bot"),children:h.jsxs("div",{style:{typingBubbleStyle:u,display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(D.Bot,{size:24}),h.jsx("span",{children:"Typing..."})]})}),h.jsx("div",{ref:r})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:Ee}=Object,{iterator:ce,toStringTag:Ve}=Symbol,ue=(e=>t=>{const n=Et.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),U=e=>(e=e.toLowerCase(),t=>ue(t)===e),de=e=>t=>typeof t===e,{isArray:K}=Array,V=de("undefined");function Z(e){return e!==null&&!V(e)&&e.constructor!==null&&!V(e.constructor)&&N(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=U("ArrayBuffer");function Rt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ke(e.buffer),t}const Ct=de("string"),N=de("function"),Xe=de("number"),ee=e=>e!==null&&typeof e=="object",Tt=e=>e===!0||e===!1,oe=e=>{if(ue(e)!=="object")return!1;const t=Ee(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ce in e)},Ot=e=>{if(!ee(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},At=U("Date"),jt=U("File"),kt=U("Blob"),Ft=U("FileList"),Nt=e=>ee(e)&&N(e.pipe),Pt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||N(e.append)&&((t=ue(e))==="formdata"||t==="object"&&N(e.toString)&&e.toString()==="[object FormData]"))},_t=U("URLSearchParams"),[Ut,Lt,Bt,Dt]=["ReadableStream","Request","Response","Headers"].map(U),It=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function te(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),K(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Z(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function Ye(e,t){if(Z(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ge=e=>!V(e)&&e!==q;function xe(){const{caseless:e,skipUndefined:t}=Ge(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ye(n,i)||i;oe(n[o])&&oe(s)?n[o]=xe(n[o],s):oe(s)?n[o]=xe({},s):K(s)?n[o]=s.slice():(!t||!V(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&te(arguments[s],r);return n}const vt=(e,t,n,{allOwnKeys:r}={})=>(te(t,(s,i)=>{n&&N(s)?e[i]=Je(s,n):e[i]=s},{allOwnKeys:r}),e),Mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},qt=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&Ee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ht=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},$t=e=>{if(!e)return null;if(K(e))return e;let t=e.length;if(!Xe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ee(Uint8Array)),Jt=(e,t)=>{const r=(e&&e[ce]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Vt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Kt=U("HTMLFormElement"),Xt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Fe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Yt=U("RegExp"),Qe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};te(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Gt=e=>{Qe(e,(t,n)=>{if(N(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(N(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Qt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return K(e)?r(e):r(String(e).split(t)),n},Zt=()=>{},en=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function tn(e){return!!(e&&N(e.append)&&e[Ve]==="FormData"&&e[ce])}const nn=e=>{const t=new Array(10),n=(r,s)=>{if(ee(r)){if(t.indexOf(r)>=0)return;if(Z(r))return r;if(!("toJSON"in r)){t[s]=r;const i=K(r)?[]:{};return te(r,(o,l)=>{const p=n(o,s+1);!V(p)&&(i[l]=p)}),t[s]=void 0,i}}return r};return n(e,0)},rn=U("AsyncFunction"),sn=e=>e&&(ee(e)||N(e))&&N(e.then)&&N(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(q.addEventListener("message",({source:s,data:i})=>{s===q&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),q.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N(q.postMessage)),on=typeof queueMicrotask<"u"?queueMicrotask.bind(q):typeof process<"u"&&process.nextTick||Ze,an=e=>e!=null&&N(e[ce]),a={isArray:K,isArrayBuffer:Ke,isBuffer:Z,isFormData:Pt,isArrayBufferView:Rt,isString:Ct,isNumber:Xe,isBoolean:Tt,isObject:ee,isPlainObject:oe,isEmptyObject:Ot,isReadableStream:Ut,isRequest:Lt,isResponse:Bt,isHeaders:Dt,isUndefined:V,isDate:At,isFile:jt,isBlob:kt,isRegExp:Yt,isFunction:N,isStream:Nt,isURLSearchParams:_t,isTypedArray:Wt,isFileList:Ft,forEach:te,merge:xe,extend:vt,trim:It,stripBOM:Mt,inherits:zt,toFlatObject:qt,kindOf:ue,kindOfTest:U,endsWith:Ht,toArray:$t,forEachEntry:Jt,matchAll:Vt,isHTMLForm:Kt,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:Qe,freezeMethods:Gt,toObjectSet:Qt,toCamelCase:Xt,noop:Zt,toFiniteNumber:en,findKey:Ye,global:q,isContextDefined:Ge,isSpecCompliantForm:tn,toJSONObject:nn,isAsyncFn:rn,isThenable:sn,setImmediate:Ze,asap:on,isIterable:an};function b(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(b,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const et=b.prototype,tt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{tt[e]={value:e}});Object.defineProperties(b,tt);Object.defineProperty(et,"isAxiosError",{value:!0});b.from=(e,t,n,r,s,i)=>{const o=Object.create(et);a.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return b.call(o,l,p,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const ln=null;function ge(e){return a.isPlainObject(e)||a.isArray(e)}function nt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ne(e,t,n){return e?e.concat(t).map(function(s,i){return s=nt(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function cn(e){return a.isArray(e)&&!e.some(ge)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function fe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,m){return!a.isUndefined(m[y])});const r=n.metaTokens,s=n.visitor||c,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(d){if(d===null)return"";if(a.isDate(d))return d.toISOString();if(a.isBoolean(d))return d.toString();if(!p&&a.isBlob(d))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(d)||a.isTypedArray(d)?p&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function c(d,y,m){let w=d;if(d&&!m&&typeof d=="object"){if(a.endsWith(y,"{}"))y=r?y:y.slice(0,-2),d=JSON.stringify(d);else if(a.isArray(d)&&cn(d)||(a.isFileList(d)||a.endsWith(y,"[]"))&&(w=a.toArray(d)))return y=nt(y),w.forEach(function(S,g){!(a.isUndefined(S)||S===null)&&t.append(o===!0?Ne([y],g,i):o===null?y:y+"[]",u(S))}),!1}return ge(d)?!0:(t.append(Ne(m,y,i),u(d)),!1)}const f=[],x=Object.assign(un,{defaultVisitor:c,convertValue:u,isVisitable:ge});function R(d,y){if(!a.isUndefined(d)){if(f.indexOf(d)!==-1)throw Error("Circular reference detected in "+y.join("."));f.push(d),a.forEach(d,function(w,T){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(T)?T.trim():T,y,x))===!0&&R(w,y?y.concat(T):[T])}),f.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return R(e),t}function Pe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Re(e,t){this._pairs=[],e&&fe(e,this,t)}const rt=Re.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Pe)}:Pe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function dn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function st(e,t,n){if(!t)return e;const r=n&&n.encode||dn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _e{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ot={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fn=typeof URLSearchParams<"u"?URLSearchParams:Re,pn=typeof FormData<"u"?FormData:null,hn=typeof Blob<"u"?Blob:null,mn={isBrowser:!0,classes:{URLSearchParams:fn,FormData:pn,Blob:hn},protocols:["http","https","file","blob","url","data"]},Ce=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,yn=Ce&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),bn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xn=Ce&&window.location.href||"http://localhost",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ce,hasStandardBrowserEnv:yn,hasStandardBrowserWebWorkerEnv:bn,navigator:we,origin:xn},Symbol.toStringTag,{value:"Module"})),j={...gn,...mn};function wn(e,t){return fe(e,new j.classes.URLSearchParams,{visitor:function(n,r,s,i){return j.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Sn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function En(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function it(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=En(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Sn(r),s,n,0)}),n}return null}function Rn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ne={transitional:ot,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(it(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return fe(l?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Rn(t)):t}],transformResponse:[function(t){const n=this.transitional||ne.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?b.from(l,b.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:j.classes.FormData,Blob:j.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ne.headers[e]={}});const Cn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Tn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
14
|
-
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Cn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ue=Symbol("internals");function Q(e){return e&&String(e).trim().toLowerCase()}function ie(e){return e===!1||e==null?e:a.isArray(e)?e.map(ie):String(e)}function On(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const An=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function me(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function jn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function kn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let P=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,p,u){const c=Q(p);if(!c)throw new Error("header name must be a non-empty string");const
|
|
15
|
-
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(kn(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};P.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(P.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(P);function ye(e,t){const n=this||ne,r=t||n,s=P.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function at(e){return!!(e&&e.__CANCEL__)}function X(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(X,b,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Fn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Nn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const u=Date.now(),c=r[i];o||(o=u),n[s]=p,r[s]=u;let f=i,x=0;for(;f!==s;)x+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const R=c&&u-c;return R?Math.round(x*1e3/R):void 0}}function Pn(e,t){let n=0,r=1e3/t,s,i;const o=(u,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),f=c-n;f>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const le=(e,t,n=3)=>{let r=0;const s=Nn(50,250);return Pn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,p=o-r,u=s(p),c=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:p,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},Le=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>a.asap(()=>e(...t)),_n=j.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,j.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(j.origin),j.navigator&&/(msie|trident)/i.test(j.navigator.userAgent)):()=>!0,Un=j.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),a.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ln(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Bn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!Ln(t);return e&&(r||n==!1)?Bn(e,t):t}const De=e=>e instanceof P?{...e}:e;function $(e,t){t=t||{};const n={};function r(u,c,f,x){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:x},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,f,x){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,f,x)}else return r(u,c,f,x)}function i(u,c){if(!a.isUndefined(c))return r(void 0,c)}function o(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function l(u,c,f){if(f in t)return r(u,c);if(f in e)return r(void 0,u)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c,f)=>s(De(u),De(c),f,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const f=p[c]||s,x=f(e[c],t[c],c);a.isUndefined(x)&&f!==l||(n[c]=x)}),n}const ut=e=>{const t=$({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=P.from(o),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(j.hasStandardBrowserEnv||j.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),u=["content-type","content-length"];Object.entries(p).forEach(([c,f])=>{u.includes(c.toLowerCase())&&o.set(c,f)})}}if(j.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&_n(t.url))){const p=s&&i&&Un.read(i);p&&o.set(s,p)}return t},Dn=typeof XMLHttpRequest<"u",In=Dn&&function(e){return new Promise(function(n,r){const s=ut(e);let i=s.data;const o=P.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:u}=s,c,f,x,R,d;function y(){R&&R(),d&&d(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function w(){if(!m)return;const S=P.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),A={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:S,config:e,request:m};lt(function(E){n(E),y()},function(E){r(E),y()},A),m=null}"onloadend"in m?m.onloadend=w:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(w)},m.onabort=function(){m&&(r(new b("Request aborted",b.ECONNABORTED,e,m)),m=null)},m.onerror=function(g){const A=g&&g.message?g.message:"Network Error",k=new b(A,b.ERR_NETWORK,e,m);k.event=g||null,r(k),m=null},m.ontimeout=function(){let g=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const A=s.transitional||ot;s.timeoutErrorMessage&&(g=s.timeoutErrorMessage),r(new b(g,A.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(g,A){m.setRequestHeader(A,g)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([x,d]=le(u,!0),m.addEventListener("progress",x)),p&&m.upload&&([f,R]=le(p),m.upload.addEventListener("progress",f),m.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(c=S=>{m&&(r(!S||S.type?new X(null,e,m):S),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const T=Fn(s.url);if(T&&j.protocols.indexOf(T)===-1){r(new b("Unsupported protocol "+T+":",b.ERR_BAD_REQUEST,e));return}m.send(i||null)})},vn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof b?c:new X(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},Mn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},zn=async function*(e,t){for await(const n of qn(e))yield*Mn(n,t)},qn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ie=(e,t,n,r)=>{const s=zn(e,t);let i=0,o,l=p=>{o||(o=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:u,value:c}=await s.next();if(u){l(),p.close();return}let f=c.byteLength;if(n){let x=i+=f;n(x)}p.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:se}=a,Hn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:ze}=a.global,qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$n=e=>{e=a.merge.call({skipUndefined:!0},Hn,e);const{fetch:t,Request:n,Response:r}=e,s=t?se(t):typeof fetch=="function",i=se(n),o=se(r);if(!s)return!1;const l=s&&se(Me),p=s&&(typeof ze=="function"?(d=>y=>d.encode(y))(new ze):async d=>new Uint8Array(await new n(d).arrayBuffer())),u=i&&l&&qe(()=>{let d=!1;const y=new n(j.origin,{body:new Me,method:"POST",get duplex(){return d=!0,"half"}}).headers.has("Content-Type");return d&&!y}),c=o&&l&&qe(()=>a.isReadableStream(new r("").body)),f={stream:c&&(d=>d.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(d=>{!f[d]&&(f[d]=(y,m)=>{let w=y&&y[d];if(w)return w.call(y);throw new b(`Response type '${d}' is not supported`,b.ERR_NOT_SUPPORT,m)})});const x=async d=>{if(d==null)return 0;if(a.isBlob(d))return d.size;if(a.isSpecCompliantForm(d))return(await new n(j.origin,{method:"POST",body:d}).arrayBuffer()).byteLength;if(a.isArrayBufferView(d)||a.isArrayBuffer(d))return d.byteLength;if(a.isURLSearchParams(d)&&(d=d+""),a.isString(d))return(await p(d)).byteLength},R=async(d,y)=>{const m=a.toFiniteNumber(d.getContentLength());return m??x(y)};return async d=>{let{url:y,method:m,data:w,signal:T,cancelToken:S,timeout:g,onDownloadProgress:A,onUploadProgress:k,responseType:E,headers:Y,withCredentials:W="same-origin",fetchOptions:O}=ut(d),_=t||fetch;E=E?(E+"").toLowerCase():"text";let I=vn([T,S&&S.toAbortSignal()],g),G=null;const z=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let Oe;try{if(k&&u&&m!=="get"&&m!=="head"&&(Oe=await R(Y,w))!==0){let M=new n(y,{method:"POST",body:w,duplex:"half"}),J;if(a.isFormData(w)&&(J=M.headers.get("content-type"))&&Y.setContentType(J),M.body){const[he,re]=Le(Oe,le(Be(k)));w=Ie(M.body,ve,he,re)}}a.isString(W)||(W=W?"include":"omit");const L=i&&"credentials"in n.prototype,Ae={...O,signal:I,method:m.toUpperCase(),headers:Y.normalize().toJSON(),body:w,duplex:"half",credentials:L?W:void 0};G=i&&new n(y,Ae);let v=await(i?_(G,O):_(y,Ae));const je=c&&(E==="stream"||E==="response");if(c&&(A||je&&z)){const M={};["status","statusText","headers"].forEach(ke=>{M[ke]=v[ke]});const J=a.toFiniteNumber(v.headers.get("content-length")),[he,re]=A&&Le(J,le(Be(A),!0))||[];v=new r(Ie(v.body,ve,he,()=>{re&&re(),z&&z()}),M)}E=E||"text";let bt=await f[a.findKey(f,E)||"text"](v,d);return!je&&z&&z(),await new Promise((M,J)=>{lt(M,J,{data:bt,headers:P.from(v.headers),status:v.status,statusText:v.statusText,config:d,request:G})})}catch(L){throw z&&z(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,d,G),{cause:L.cause||L}):b.from(L,L&&L.code,d,G)}}},Wn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,p,u,c=Wn;for(;l--;)p=i[l],u=c.get(p),u===void 0&&c.set(p,u=l?new Map:$n(t)),c=u;return u};dt();const Te={http:ln,xhr:In,fetch:{get:dt}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,Jn=e=>a.isFunction(e)||e===null||e===!1;function Vn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!Jn(r)&&(s=Te[(l=String(r)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([p,u])=>`adapter ${p} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
|
|
13
|
+
`})]})},wt=({onSendMessage:e,isLoading:t,theme:n})=>{const[r,s]=F.useState(""),i=()=>{!r.trim()||t||(e(r.trim()),s(""))},o=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),i())},l={padding:"16px",borderTop:"1px solid rgba(255, 255, 255, 0.2)",borderColor:n.fontColor,background:n.backgroundColor,flexShrink:0},p={display:"flex",gap:"12px",alignItems:"center"},u={flex:1,padding:"12px 16px",background:n.inputBackgroundColor||n.backgroundColor,color:n.fontColor,border:`1px solid ${n.fontColor}`,borderRadius:"12px",fontSize:"14px",outline:"none",transition:"all 0.2s ease",opacity:t?.5:1,cursor:t?"not-allowed":"text",boxShadow:"none"},c={padding:"12px 20px",borderRadius:"12px",background:`linear-gradient(135deg, ${n.primaryColor}, ${n.secondaryColor})`,color:n.fontColor,border:"none",cursor:t||!r.trim()?"not-allowed":"pointer",opacity:t||!r.trim()?.5:1,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",fontWeight:"600",fontSize:"14px",transition:"all 0.2s ease",minWidth:"48px"};return h.jsx("div",{style:l,children:h.jsxs("div",{style:p,children:[h.jsx("input",{type:"text",placeholder:"Type a message...",value:r,onChange:d=>s(d.target.value),onKeyDown:o,disabled:t,style:u,onFocus:d=>{d.target.style.boxShadow="0 0 0 3px rgba(100, 150, 255, 0.3)",d.target.style.borderColor="#60a5fa"},onBlur:d=>{d.target.style.boxShadow="none",d.target.style.borderColor=n.fontColor}}),h.jsx("button",{onClick:i,disabled:t||!r.trim(),style:c,"aria-label":"Send message",onMouseEnter:d=>{!t&&r.trim()&&(d.currentTarget.style.transform="translateY(-2px)",d.currentTarget.style.boxShadow="0 8px 16px rgba(0,0,0,0.15)")},onMouseLeave:d=>{d.currentTarget.style.transform="translateY(0)",d.currentTarget.style.boxShadow="none"},children:h.jsx(D.Send,{size:18})})]})})},St=({messages:e,isLoading:t,theme:n})=>{const r=F.useRef(null),s=()=>{r.current?.scrollIntoView({behavior:"smooth"})};F.useEffect(()=>{s()},[e,t]);const i={flex:1,overflowY:"auto",padding:"20px",background:n.backgroundColor,color:n.fontColor,borderTop:"1px solid rgba(255, 255, 255, 0.2)",display:"flex",flexDirection:"column",gap:"16px"},o=c=>({display:"flex",justifyContent:c==="user"?"flex-end":"flex-start",width:"100%"}),l={display:"flex",flexDirection:"column",maxWidth:"80%"},p=c=>({padding:"12px 16px",borderRadius:"16px",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.1)",border:"1px solid #e4e4e7",fontSize:"14px",lineHeight:"1.5",background:c==="user"?n.primaryColor:n.backgroundColor,color:n.fontColor,wordWrap:"break-word"}),u={...p("bot"),animation:"fadeIn 0.3s ease-in-out, pulse 1.5s ease-in-out infinite",animationDelay:"0s, 0.3s"};return h.jsxs("div",{style:i,children:[e.map((c,d)=>h.jsx("div",{style:o(c.type),children:h.jsxs("div",{style:l,children:[c.type==="bot"&&h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-start",marginLeft:"4px",marginBottom:"2px"},children:[h.jsx(D.Bot,{size:14,color:n.fontColor}),h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:c.response_timestamp})]}),c.type==="user"&&h.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",justifyContent:"flex-end",marginRight:"4px",marginBottom:"2px"},children:h.jsx("span",{style:{fontSize:"10px",opacity:.55,color:n.fontColor},children:"You"})}),h.jsx("div",{style:p(c.type),children:c.text})]})},d)),t&&h.jsx("div",{style:o("bot"),children:h.jsxs("div",{style:{typingBubbleStyle:u,display:"flex",alignItems:"center",gap:"8px"},children:[h.jsx(D.Bot,{size:24}),h.jsx("span",{children:"Typing..."})]})}),h.jsx("div",{ref:r})]})};function Je(e,t){return function(){return e.apply(t,arguments)}}const{toString:Et}=Object.prototype,{getPrototypeOf:Ee}=Object,{iterator:ce,toStringTag:Ve}=Symbol,ue=(e=>t=>{const n=Et.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),U=e=>(e=e.toLowerCase(),t=>ue(t)===e),de=e=>t=>typeof t===e,{isArray:X}=Array,K=de("undefined");function Z(e){return e!==null&&!K(e)&&e.constructor!==null&&!K(e.constructor)&&N(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ke=U("ArrayBuffer");function Rt(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Ke(e.buffer),t}const Ct=de("string"),N=de("function"),Xe=de("number"),ee=e=>e!==null&&typeof e=="object",Tt=e=>e===!0||e===!1,oe=e=>{if(ue(e)!=="object")return!1;const t=Ee(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Ve in e)&&!(ce in e)},Ot=e=>{if(!ee(e)||Z(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},At=U("Date"),jt=U("File"),kt=U("Blob"),Ft=U("FileList"),Nt=e=>ee(e)&&N(e.pipe),Pt=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||N(e.append)&&((t=ue(e))==="formdata"||t==="object"&&N(e.toString)&&e.toString()==="[object FormData]"))},_t=U("URLSearchParams"),[Ut,Lt,Bt,Dt]=["ReadableStream","Request","Response","Headers"].map(U),It=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function te(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),X(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(Z(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let l;for(r=0;r<o;r++)l=i[r],t.call(null,e[l],l,e)}}function Ye(e,t){if(Z(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const H=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Ge=e=>!K(e)&&e!==H;function xe(){const{caseless:e,skipUndefined:t}=Ge(this)&&this||{},n={},r=(s,i)=>{const o=e&&Ye(n,i)||i;oe(n[o])&&oe(s)?n[o]=xe(n[o],s):oe(s)?n[o]=xe({},s):X(s)?n[o]=s.slice():(!t||!K(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&te(arguments[s],r);return n}const vt=(e,t,n,{allOwnKeys:r}={})=>(te(t,(s,i)=>{n&&N(s)?e[i]=Je(s,n):e[i]=s},{allOwnKeys:r}),e),Mt=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),zt=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},qt=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&Ee(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Ht=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},$t=e=>{if(!e)return null;if(X(e))return e;let t=e.length;if(!Xe(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Wt=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ee(Uint8Array)),Jt=(e,t)=>{const r=(e&&e[ce]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},Vt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Kt=U("HTMLFormElement"),Xt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),Fe=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Yt=U("RegExp"),Qe=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};te(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},Gt=e=>{Qe(e,(t,n)=>{if(N(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(N(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Qt=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return X(e)?r(e):r(String(e).split(t)),n},Zt=()=>{},en=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function tn(e){return!!(e&&N(e.append)&&e[Ve]==="FormData"&&e[ce])}const nn=e=>{const t=new Array(10),n=(r,s)=>{if(ee(r)){if(t.indexOf(r)>=0)return;if(Z(r))return r;if(!("toJSON"in r)){t[s]=r;const i=X(r)?[]:{};return te(r,(o,l)=>{const p=n(o,s+1);!K(p)&&(i[l]=p)}),t[s]=void 0,i}}return r};return n(e,0)},rn=U("AsyncFunction"),sn=e=>e&&(ee(e)||N(e))&&N(e.then)&&N(e.catch),Ze=((e,t)=>e?setImmediate:t?((n,r)=>(H.addEventListener("message",({source:s,data:i})=>{s===H&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),H.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",N(H.postMessage)),on=typeof queueMicrotask<"u"?queueMicrotask.bind(H):typeof process<"u"&&process.nextTick||Ze,an=e=>e!=null&&N(e[ce]),a={isArray:X,isArrayBuffer:Ke,isBuffer:Z,isFormData:Pt,isArrayBufferView:Rt,isString:Ct,isNumber:Xe,isBoolean:Tt,isObject:ee,isPlainObject:oe,isEmptyObject:Ot,isReadableStream:Ut,isRequest:Lt,isResponse:Bt,isHeaders:Dt,isUndefined:K,isDate:At,isFile:jt,isBlob:kt,isRegExp:Yt,isFunction:N,isStream:Nt,isURLSearchParams:_t,isTypedArray:Wt,isFileList:Ft,forEach:te,merge:xe,extend:vt,trim:It,stripBOM:Mt,inherits:zt,toFlatObject:qt,kindOf:ue,kindOfTest:U,endsWith:Ht,toArray:$t,forEachEntry:Jt,matchAll:Vt,isHTMLForm:Kt,hasOwnProperty:Fe,hasOwnProp:Fe,reduceDescriptors:Qe,freezeMethods:Gt,toObjectSet:Qt,toCamelCase:Xt,noop:Zt,toFiniteNumber:en,findKey:Ye,global:H,isContextDefined:Ge,isSpecCompliantForm:tn,toJSONObject:nn,isAsyncFn:rn,isThenable:sn,setImmediate:Ze,asap:on,isIterable:an};function b(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(b,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const et=b.prototype,tt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{tt[e]={value:e}});Object.defineProperties(b,tt);Object.defineProperty(et,"isAxiosError",{value:!0});b.from=(e,t,n,r,s,i)=>{const o=Object.create(et);a.toFlatObject(e,o,function(c){return c!==Error.prototype},u=>u!=="isAxiosError");const l=e&&e.message?e.message:"Error",p=t==null&&e?e.code:t;return b.call(o,l,p,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const ln=null;function ge(e){return a.isPlainObject(e)||a.isArray(e)}function nt(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ne(e,t,n){return e?e.concat(t).map(function(s,i){return s=nt(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function cn(e){return a.isArray(e)&&!e.some(ge)}const un=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function fe(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,m){return!a.isUndefined(m[y])});const r=n.metaTokens,s=n.visitor||c,i=n.dots,o=n.indexes,p=(n.Blob||typeof Blob<"u"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(f){if(f===null)return"";if(a.isDate(f))return f.toISOString();if(a.isBoolean(f))return f.toString();if(!p&&a.isBlob(f))throw new b("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(f)||a.isTypedArray(f)?p&&typeof Blob=="function"?new Blob([f]):Buffer.from(f):f}function c(f,y,m){let w=f;if(f&&!m&&typeof f=="object"){if(a.endsWith(y,"{}"))y=r?y:y.slice(0,-2),f=JSON.stringify(f);else if(a.isArray(f)&&cn(f)||(a.isFileList(f)||a.endsWith(y,"[]"))&&(w=a.toArray(f)))return y=nt(y),w.forEach(function(g,T){!(a.isUndefined(g)||g===null)&&t.append(o===!0?Ne([y],T,i):o===null?y:y+"[]",u(g))}),!1}return ge(f)?!0:(t.append(Ne(m,y,i),u(f)),!1)}const d=[],x=Object.assign(un,{defaultVisitor:c,convertValue:u,isVisitable:ge});function R(f,y){if(!a.isUndefined(f)){if(d.indexOf(f)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(f),a.forEach(f,function(w,C){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(C)?C.trim():C,y,x))===!0&&R(w,y?y.concat(C):[C])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return R(e),t}function Pe(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function Re(e,t){this._pairs=[],e&&fe(e,this,t)}const rt=Re.prototype;rt.append=function(t,n){this._pairs.push([t,n])};rt.toString=function(t){const n=t?function(r){return t.call(this,r,Pe)}:Pe;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function dn(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function st(e,t,n){if(!t)return e;const r=n&&n.encode||dn;a.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=a.isURLSearchParams(t)?t.toString():new Re(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class _e{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}const ot={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fn=typeof URLSearchParams<"u"?URLSearchParams:Re,pn=typeof FormData<"u"?FormData:null,hn=typeof Blob<"u"?Blob:null,mn={isBrowser:!0,classes:{URLSearchParams:fn,FormData:pn,Blob:hn},protocols:["http","https","file","blob","url","data"]},Ce=typeof window<"u"&&typeof document<"u",we=typeof navigator=="object"&&navigator||void 0,yn=Ce&&(!we||["ReactNative","NativeScript","NS"].indexOf(we.product)<0),bn=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",xn=Ce&&window.location.href||"http://localhost",gn=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Ce,hasStandardBrowserEnv:yn,hasStandardBrowserWebWorkerEnv:bn,navigator:we,origin:xn},Symbol.toStringTag,{value:"Module"})),k={...gn,...mn};function wn(e,t){return fe(e,new k.classes.URLSearchParams,{visitor:function(n,r,s,i){return k.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function Sn(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function En(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function it(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const l=Number.isFinite(+o),p=i>=n.length;return o=!o&&a.isArray(s)?s.length:o,p?(a.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!a.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&a.isArray(s[o])&&(s[o]=En(s[o])),!l)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(Sn(r),s,n,0)}),n}return null}function Rn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ne={transitional:ot,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=a.isObject(t);if(i&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify(it(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wn(t,this.formSerializer).toString();if((l=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=this.env&&this.env.FormData;return fe(l?{"files[]":t}:t,p&&new p,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Rn(t)):t}],transformResponse:[function(t){const n=this.transitional||ne.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(l){if(o)throw l.name==="SyntaxError"?b.from(l,b.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:k.classes.FormData,Blob:k.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{ne.headers[e]={}});const Cn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Tn=e=>{const t={};let n,r,s;return e&&e.split(`
|
|
14
|
+
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Cn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Ue=Symbol("internals");function Q(e){return e&&String(e).trim().toLowerCase()}function ie(e){return e===!1||e==null?e:a.isArray(e)?e.map(ie):String(e)}function On(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const An=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function me(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function jn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function kn(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let P=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,p,u){const c=Q(p);if(!c)throw new Error("header name must be a non-empty string");const d=a.findKey(s,c);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||p]=ie(l))}const o=(l,p)=>a.forEach(l,(u,c)=>i(u,c,p));if(a.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(a.isString(t)&&(t=t.trim())&&!An(t))o(Tn(t),n);else if(a.isObject(t)&&a.isIterable(t)){let l={},p,u;for(const c of t){if(!a.isArray(c))throw TypeError("Object iterator must return a key-value pair");l[u=c[0]]=(p=l[u])?a.isArray(p)?[...p,c[1]]:[p,c[1]]:c[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Q(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return On(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Q(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||me(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Q(o),o){const l=a.findKey(r,o);l&&(!n||me(r,r[l],l,n))&&(delete r[l],s=!0)}}return a.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||me(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,i)=>{const o=a.findKey(r,i);if(o){n[o]=ie(s),delete n[i];return}const l=t?jn(i):String(i).trim();l!==i&&delete n[i],n[l]=ie(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
|
|
15
|
+
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Ue]=this[Ue]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Q(o);r[l]||(kn(s,o),r[l]=!0)}return a.isArray(t)?t.forEach(i):i(t),this}};P.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(P.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(P);function ye(e,t){const n=this||ne,r=t||n,s=P.from(r.headers);let i=r.data;return a.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function at(e){return!!(e&&e.__CANCEL__)}function Y(e,t,n){b.call(this,e??"canceled",b.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(Y,b,{__CANCEL__:!0});function lt(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new b("Request failed with status code "+n.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Fn(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Nn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(p){const u=Date.now(),c=r[i];o||(o=u),n[s]=p,r[s]=u;let d=i,x=0;for(;d!==s;)x+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o<t)return;const R=c&&u-c;return R?Math.round(x*1e3/R):void 0}}function Pn(e,t){let n=0,r=1e3/t,s,i;const o=(u,c=Date.now())=>{n=c,s=null,i&&(clearTimeout(i),i=null),e(...u)};return[(...u)=>{const c=Date.now(),d=c-n;d>=r?o(u,c):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const le=(e,t,n=3)=>{let r=0;const s=Nn(50,250);return Pn(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,p=o-r,u=s(p),c=o<=l;r=o;const d={loaded:o,total:l,progress:l?o/l:void 0,bytes:p,rate:u||void 0,estimated:u&&l&&c?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(d)},n)},Le=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Be=e=>(...t)=>a.asap(()=>e(...t)),_n=k.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,k.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(k.origin),k.navigator&&/(msie|trident)/i.test(k.navigator.userAgent)):()=>!0,Un=k.hasStandardBrowserEnv?{write(e,t,n,r,s,i,o){if(typeof document>"u")return;const l=[`${e}=${encodeURIComponent(t)}`];a.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),a.isString(r)&&l.push(`path=${r}`),a.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),a.isString(o)&&l.push(`SameSite=${o}`),document.cookie=l.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function Ln(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Bn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function ct(e,t,n){let r=!Ln(t);return e&&(r||n==!1)?Bn(e,t):t}const De=e=>e instanceof P?{...e}:e;function W(e,t){t=t||{};const n={};function r(u,c,d,x){return a.isPlainObject(u)&&a.isPlainObject(c)?a.merge.call({caseless:x},u,c):a.isPlainObject(c)?a.merge({},c):a.isArray(c)?c.slice():c}function s(u,c,d,x){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u,d,x)}else return r(u,c,d,x)}function i(u,c){if(!a.isUndefined(c))return r(void 0,c)}function o(u,c){if(a.isUndefined(c)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,c)}function l(u,c,d){if(d in t)return r(u,c);if(d in e)return r(void 0,u)}const p={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,c,d)=>s(De(u),De(c),d,!0)};return a.forEach(Object.keys({...e,...t}),function(c){const d=p[c]||s,x=d(e[c],t[c],c);a.isUndefined(x)&&d!==l||(n[c]=x)}),n}const ut=e=>{const t=W({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;if(t.headers=o=P.from(o),t.url=st(ct(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),a.isFormData(n)){if(k.hasStandardBrowserEnv||k.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(a.isFunction(n.getHeaders)){const p=n.getHeaders(),u=["content-type","content-length"];Object.entries(p).forEach(([c,d])=>{u.includes(c.toLowerCase())&&o.set(c,d)})}}if(k.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&_n(t.url))){const p=s&&i&&Un.read(i);p&&o.set(s,p)}return t},Dn=typeof XMLHttpRequest<"u",In=Dn&&function(e){return new Promise(function(n,r){const s=ut(e);let i=s.data;const o=P.from(s.headers).normalize();let{responseType:l,onUploadProgress:p,onDownloadProgress:u}=s,c,d,x,R,f;function y(){R&&R(),f&&f(),s.cancelToken&&s.cancelToken.unsubscribe(c),s.signal&&s.signal.removeEventListener("abort",c)}let m=new XMLHttpRequest;m.open(s.method.toUpperCase(),s.url,!0),m.timeout=s.timeout;function w(){if(!m)return;const g=P.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders()),j={data:!l||l==="text"||l==="json"?m.responseText:m.response,status:m.status,statusText:m.statusText,headers:g,config:e,request:m};lt(function(E){n(E),y()},function(E){r(E),y()},j),m=null}"onloadend"in m?m.onloadend=w:m.onreadystatechange=function(){!m||m.readyState!==4||m.status===0&&!(m.responseURL&&m.responseURL.indexOf("file:")===0)||setTimeout(w)},m.onabort=function(){m&&(r(new b("Request aborted",b.ECONNABORTED,e,m)),m=null)},m.onerror=function(T){const j=T&&T.message?T.message:"Network Error",S=new b(j,b.ERR_NETWORK,e,m);S.event=T||null,r(S),m=null},m.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const j=s.transitional||ot;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new b(T,j.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,e,m)),m=null},i===void 0&&o.setContentType(null),"setRequestHeader"in m&&a.forEach(o.toJSON(),function(T,j){m.setRequestHeader(j,T)}),a.isUndefined(s.withCredentials)||(m.withCredentials=!!s.withCredentials),l&&l!=="json"&&(m.responseType=s.responseType),u&&([x,f]=le(u,!0),m.addEventListener("progress",x)),p&&m.upload&&([d,R]=le(p),m.upload.addEventListener("progress",d),m.upload.addEventListener("loadend",R)),(s.cancelToken||s.signal)&&(c=g=>{m&&(r(!g||g.type?new Y(null,e,m):g),m.abort(),m=null)},s.cancelToken&&s.cancelToken.subscribe(c),s.signal&&(s.signal.aborted?c():s.signal.addEventListener("abort",c)));const C=Fn(s.url);if(C&&k.protocols.indexOf(C)===-1){r(new b("Unsupported protocol "+C+":",b.ERR_BAD_REQUEST,e));return}m.send(i||null)})},vn=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const c=u instanceof Error?u:this.reason;r.abort(c instanceof b?c:new Y(c instanceof Error?c.message:c))}};let o=t&&setTimeout(()=>{o=null,i(new b(`timeout ${t} of ms exceeded`,b.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:p}=r;return p.unsubscribe=()=>a.asap(l),p}},Mn=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},zn=async function*(e,t){for await(const n of qn(e))yield*Mn(n,t)},qn=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Ie=(e,t,n,r)=>{const s=zn(e,t);let i=0,o,l=p=>{o||(o=!0,r&&r(p))};return new ReadableStream({async pull(p){try{const{done:u,value:c}=await s.next();if(u){l(),p.close();return}let d=c.byteLength;if(n){let x=i+=d;n(x)}p.enqueue(new Uint8Array(c))}catch(u){throw l(u),u}},cancel(p){return l(p),s.return()}},{highWaterMark:2})},ve=64*1024,{isFunction:se}=a,Hn=(({Request:e,Response:t})=>({Request:e,Response:t}))(a.global),{ReadableStream:Me,TextEncoder:ze}=a.global,qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},$n=e=>{e=a.merge.call({skipUndefined:!0},Hn,e);const{fetch:t,Request:n,Response:r}=e,s=t?se(t):typeof fetch=="function",i=se(n),o=se(r);if(!s)return!1;const l=s&&se(Me),p=s&&(typeof ze=="function"?(f=>y=>f.encode(y))(new ze):async f=>new Uint8Array(await new n(f).arrayBuffer())),u=i&&l&&qe(()=>{let f=!1;const y=new n(k.origin,{body:new Me,method:"POST",get duplex(){return f=!0,"half"}}).headers.has("Content-Type");return f&&!y}),c=o&&l&&qe(()=>a.isReadableStream(new r("").body)),d={stream:c&&(f=>f.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(f=>{!d[f]&&(d[f]=(y,m)=>{let w=y&&y[f];if(w)return w.call(y);throw new b(`Response type '${f}' is not supported`,b.ERR_NOT_SUPPORT,m)})});const x=async f=>{if(f==null)return 0;if(a.isBlob(f))return f.size;if(a.isSpecCompliantForm(f))return(await new n(k.origin,{method:"POST",body:f}).arrayBuffer()).byteLength;if(a.isArrayBufferView(f)||a.isArrayBuffer(f))return f.byteLength;if(a.isURLSearchParams(f)&&(f=f+""),a.isString(f))return(await p(f)).byteLength},R=async(f,y)=>{const m=a.toFiniteNumber(f.getContentLength());return m??x(y)};return async f=>{let{url:y,method:m,data:w,signal:C,cancelToken:g,timeout:T,onDownloadProgress:j,onUploadProgress:S,responseType:E,headers:z,withCredentials:J="same-origin",fetchOptions:A}=ut(f),_=t||fetch;E=E?(E+"").toLowerCase():"text";let I=vn([C,g&&g.toAbortSignal()],T),G=null;const q=I&&I.unsubscribe&&(()=>{I.unsubscribe()});let Oe;try{if(S&&u&&m!=="get"&&m!=="head"&&(Oe=await R(z,w))!==0){let M=new n(y,{method:"POST",body:w,duplex:"half"}),V;if(a.isFormData(w)&&(V=M.headers.get("content-type"))&&z.setContentType(V),M.body){const[he,re]=Le(Oe,le(Be(S)));w=Ie(M.body,ve,he,re)}}a.isString(J)||(J=J?"include":"omit");const L=i&&"credentials"in n.prototype,Ae={...A,signal:I,method:m.toUpperCase(),headers:z.normalize().toJSON(),body:w,duplex:"half",credentials:L?J:void 0};G=i&&new n(y,Ae);let v=await(i?_(G,A):_(y,Ae));const je=c&&(E==="stream"||E==="response");if(c&&(j||je&&q)){const M={};["status","statusText","headers"].forEach(ke=>{M[ke]=v[ke]});const V=a.toFiniteNumber(v.headers.get("content-length")),[he,re]=j&&Le(V,le(Be(j),!0))||[];v=new r(Ie(v.body,ve,he,()=>{re&&re(),q&&q()}),M)}E=E||"text";let bt=await d[a.findKey(d,E)||"text"](v,f);return!je&&q&&q(),await new Promise((M,V)=>{lt(M,V,{data:bt,headers:P.from(v.headers),status:v.status,statusText:v.statusText,config:f,request:G})})}catch(L){throw q&&q(),L&&L.name==="TypeError"&&/Load failed|fetch/i.test(L.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,f,G),{cause:L.cause||L}):b.from(L,L&&L.code,f,G)}}},Wn=new Map,dt=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,l=o,p,u,c=Wn;for(;l--;)p=i[l],u=c.get(p),u===void 0&&c.set(p,u=l?new Map:$n(t)),c=u;return u};dt();const Te={http:ln,xhr:In,fetch:{get:dt}};a.forEach(Te,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const He=e=>`- ${e}`,Jn=e=>a.isFunction(e)||e===null||e===!1;function Vn(e,t){e=a.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let l;if(s=r,!Jn(r)&&(s=Te[(l=String(r)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${l}'`);if(s&&(a.isFunction(s)||(s=s.get(t))))break;i[l||"#"+o]=s}if(!s){const o=Object.entries(i).map(([p,u])=>`adapter ${p} `+(u===!1?"is not supported by the environment":"is not available in the build"));let l=n?o.length>1?`since :
|
|
16
16
|
`+o.map(He).join(`
|
|
17
|
-
`):" "+He(o[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const ft={getAdapter:Vn,adapters:Te};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new
|
|
18
|
-
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=$(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],d=>{delete i[d]}),n.headers=P.concat(o,i);const l=[];let p=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(p=p&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let c,f=0,x;if(!p){const d=[$e.bind(this),void 0];for(d.unshift(...l),d.push(...u),x=d.length,c=Promise.resolve(n);f<x;)c=c.then(d[f++],d[f++]);return c}x=l.length;let R=n;for(;f<x;){const d=l[f++],y=l[f++];try{R=d(R)}catch(m){y.call(this,m);break}}try{c=$e.call(this,R)}catch(d){return Promise.reject(d)}for(f=0,x=u.length;f<x;)c=c.then(u[f++],u[f++]);return c}getUri(t){t=$(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){H.prototype[t]=function(n,r){return this.request($(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request($(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}H.prototype[t]=n(),H.prototype[t+"Form"]=n(!0)});let Xn=class ht{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new X(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ht(function(s){t=s}),cancel:t}}};function Yn(e){return function(n){return e.apply(null,n)}}function Gn(e){return a.isObject(e)&&e.isAxiosError===!0}const Se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Se).forEach(([e,t])=>{Se[t]=e});function mt(e){const t=new H(e),n=Je(H.prototype.request,t);return a.extend(n,H.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt($(e,s))},n}const C=mt(ne);C.Axios=H;C.CanceledError=X;C.CancelToken=Xn;C.isCancel=at;C.VERSION=pt;C.toFormData=fe;C.AxiosError=b;C.Cancel=C.CanceledError;C.all=function(t){return Promise.all(t)};C.spread=Yn;C.isAxiosError=Gn;C.mergeConfig=$;C.AxiosHeaders=P;C.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);C.getAdapter=ft.getAdapter;C.HttpStatusCode=Se;C.default=C;const{Axios:rr,AxiosError:sr,CanceledError:or,isCancel:ir,CancelToken:ar,VERSION:lr,all:cr,Cancel:ur,isAxiosError:dr,spread:fr,toFormData:pr,AxiosHeaders:hr,HttpStatusCode:mr,formToJSON:yr,getAdapter:br,mergeConfig:xr}=C,yt=async(e,t,n,r,s,i)=>{const o={chatInput:e,sessionId:t,metadata:{pinecone_namespace:n,name:s,email:i}};try{return(await C.post(r,o,{headers:{"Content-Type":"application/json"}})).data}catch(l){throw console.error("Error communicating with chat API:",l),l}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n})=>{const[r,s]=F.useState(""),[i,o]=F.useState(""),[l,p]=F.useState(""),[u,c]=F.useState(!1),f=async g=>{if(g.preventDefault(),c(!0),p(""),!r.trim()||!i.trim()){p("Name and email are required"),c(!1);return}const A=`Hi, I am ${r} and my email is ${i}`;try{const E=(await yt(A,n.sessionId,n.pineconeNamespace,n.url,r,i)).response;e([{type:"user",text:A},{type:"bot",text:E}])}catch(k){console.log("error sending user details",k),p("Failed to submit. Please try again.")}finally{c(!1)}s(""),o("")},x={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},R={display:"flex",flexDirection:"column",gap:"24px"},d={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},y={display:"flex",flexDirection:"column",gap:"20px"},m={fontSize:"14px",color:t.fontColor,fontWeight:"500"},w={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},T={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:r.trim()&&i.trim()&&!u?"pointer":"not-allowed",opacity:r.trim()&&i.trim()&&!u?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",marginTop:"80px",transition:"all 0.2s ease"},S={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:x,children:h.jsxs("form",{onSubmit:f,style:R,children:[l&&h.jsx("div",{style:S,role:"alert",children:l}),h.jsx("p",{style:d,children:n.welcomeText}),h.jsxs("div",{style:y,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:m,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:g=>{s(g.target.value),p("")},style:w,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:m,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:i,onChange:g=>{o(g.target.value),p("")},style:w,required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim()||u,style:T,onMouseEnter:g=>{r.trim()&&i.trim()&&!u&&(g.currentTarget.style.transform="translateY(-2px)",g.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:g=>{g.currentTarget.style.transform="translateY(0)",g.currentTarget.style.boxShadow="none"},children:u?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(D.Send,{size:18}),"Submit"]})})]})})},Zn=({onMinimise:e,theme:t,chatBotData:n})=>{const[r,s]=F.useState([]),[i,o]=F.useState(!1),[l,p]=F.useState(!1),[u,c]=F.useState(!1),x={position:"fixed",bottom:"112px",[n.position==="left"?"left":"right"]:"32px",zIndex:50,width:u?"584px":"384px",height:u?"720px":"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},R={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},d={position:"relative"},y={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},m={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},w={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},T={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},S={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},g={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},A={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},k={fontWeight:"600"},E=(O,_)=>{O.currentTarget.style.background=_?"rgba(255,255,255,0.2)":"transparent"},Y=O=>{s(O),p(!0)},W=async O=>{o(!0),s(_=>[..._,{type:"user",text:O}]);try{const _=await yt(O,n.sessionId,n.pineconeNamespace,n.url);s(I=>[...I,{type:"bot",text:_.response,response_timestamp:_.response_timestamp,suggested_prompts:_.suggested_prompt}])}catch(_){console.error("Chat error:",_),s(I=>[...I,{type:"bot",text:"Sorry, something went wrong."}])}finally{o(!1)}};return h.jsxs("div",{style:x,children:[h.jsxs("div",{style:R,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:d,children:[h.jsx("div",{style:y,children:h.jsx(D.MessageCircle,{size:22})}),h.jsx("span",{style:m})]}),h.jsxs("div",{children:[h.jsx("h3",{style:w,children:n.name}),h.jsx("p",{style:T,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>c(O=>!O),"aria-label":"expand chat",style:S,onMouseEnter:O=>E(O,!0),onMouseLeave:O=>E(O,!1),children:u?h.jsx(D.Minimize2,{size:20}):h.jsx(D.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"minimise chat",style:S,onMouseEnter:O=>E(O,!0),onMouseLeave:O=>E(O,!1),children:h.jsx(D.Minus,{size:20})})]})]}),l?h.jsxs(h.Fragment,{children:[h.jsx(St,{messages:r,isLoading:i,theme:t}),h.jsx(wt,{onSendMessage:W,isLoading:i,theme:t,messages:r})]}):h.jsx(Qn,{handleMessageFromForm:Y,theme:t,chatBotData:n}),h.jsx("div",{style:g,children:h.jsxs("p",{style:A,children:["powered by"," ",h.jsx("span",{style:k,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,url:t,primaryColor:n="#3b82f6",secondaryColor:r="#8b5cf6",backgroundColor:s="#ffffff",fontColor:i="#1f2937",placeholderColor:o="#9ca3af",position:l="right",name:p="Assistant",subTitle:u="Typically replies instantly",welcomeText:c="Hi! How can I help you today?"})=>{const[f,x]=F.useState(!1),[R,d]=F.useState("");F.useEffect(()=>{d(xt.v4())},[]);const y=()=>x(E=>!E),m=()=>x(E=>!E),w={primaryColor:n,secondaryColor:r,backgroundColor:s,fontColor:i,placeholderColor:o,inputBackgroundColor:s},T={name:p,subTitle:u,welcomeText:c,url:t,pineconeNamespace:e,position:l,sessionId:R},S=l==="left",g="32px",A={position:"fixed",bottom:"104px",[S?"left":"right"]:g,zIndex:9999,pointerEvents:"auto"},k={position:"fixed",bottom:"32px",[S?"left":"right"]:g,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[f&&h.jsx("div",{style:A,children:h.jsx(Zn,{onMinimise:m,theme:w,chatBotData:T})}),h.jsx("div",{style:k,children:h.jsx(gt,{onClick:y,isOpen:f,theme:w,chatBotData:T})})]})};module.exports=er;
|
|
17
|
+
`):" "+He(o[0]):"as no adapter specified";throw new b("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const ft={getAdapter:Vn,adapters:Te};function be(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Y(null,e)}function $e(e){return be(e),e.headers=P.from(e.headers),e.data=ye.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),ft.getAdapter(e.adapter||ne.adapter,e)(e).then(function(r){return be(e),r.data=ye.call(e,e.transformResponse,r),r.headers=P.from(r.headers),r},function(r){return at(r)||(be(e),r&&r.response&&(r.response.data=ye.call(e,e.transformResponse,r.response),r.response.headers=P.from(r.response.headers))),Promise.reject(r)})}const pt="1.13.2",pe={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{pe[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const We={};pe.transitional=function(t,n,r){function s(i,o){return"[Axios v"+pt+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new b(s(o," has been removed"+(n?" in "+n:"")),b.ERR_DEPRECATED);return n&&!We[o]&&(We[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};pe.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function Kn(e,t,n){if(typeof e!="object")throw new b("options must be an object",b.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],p=l===void 0||o(l,i,e);if(p!==!0)throw new b("option "+i+" must be "+p,b.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new b("Unknown option "+i,b.ERR_BAD_OPTION)}}const ae={assertOptions:Kn,validators:pe},B=ae.validators;let $=class{constructor(t){this.defaults=t||{},this.interceptors={request:new _e,response:new _e}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
18
|
+
`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=W(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:B.transitional(B.boolean),forcedJSONParsing:B.transitional(B.boolean),clarifyTimeoutError:B.transitional(B.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:B.function,serialize:B.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),ae.assertOptions(n,{baseUrl:B.spelling("baseURL"),withXsrfToken:B.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&a.merge(i.common,i[n.method]);i&&a.forEach(["delete","get","head","post","put","patch","common"],f=>{delete i[f]}),n.headers=P.concat(o,i);const l=[];let p=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(p=p&&y.synchronous,l.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let c,d=0,x;if(!p){const f=[$e.bind(this),void 0];for(f.unshift(...l),f.push(...u),x=f.length,c=Promise.resolve(n);d<x;)c=c.then(f[d++],f[d++]);return c}x=l.length;let R=n;for(;d<x;){const f=l[d++],y=l[d++];try{R=f(R)}catch(m){y.call(this,m);break}}try{c=$e.call(this,R)}catch(f){return Promise.reject(f)}for(d=0,x=u.length;d<x;)c=c.then(u[d++],u[d++]);return c}getUri(t){t=W(this.defaults,t);const n=ct(t.baseURL,t.url,t.allowAbsoluteUrls);return st(n,t.params,t.paramsSerializer)}};a.forEach(["delete","get","head","options"],function(t){$.prototype[t]=function(n,r){return this.request(W(r||{},{method:t,url:n,data:(r||{}).data}))}});a.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,l){return this.request(W(l||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}$.prototype[t]=n(),$.prototype[t+"Form"]=n(!0)});let Xn=class ht{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new Y(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new ht(function(s){t=s}),cancel:t}}};function Yn(e){return function(n){return e.apply(null,n)}}function Gn(e){return a.isObject(e)&&e.isAxiosError===!0}const Se={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Se).forEach(([e,t])=>{Se[t]=e});function mt(e){const t=new $(e),n=Je($.prototype.request,t);return a.extend(n,$.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return mt(W(e,s))},n}const O=mt(ne);O.Axios=$;O.CanceledError=Y;O.CancelToken=Xn;O.isCancel=at;O.VERSION=pt;O.toFormData=fe;O.AxiosError=b;O.Cancel=O.CanceledError;O.all=function(t){return Promise.all(t)};O.spread=Yn;O.isAxiosError=Gn;O.mergeConfig=W;O.AxiosHeaders=P;O.formToJSON=e=>it(a.isHTMLForm(e)?new FormData(e):e);O.getAdapter=ft.getAdapter;O.HttpStatusCode=Se;O.default=O;const{Axios:rr,AxiosError:sr,CanceledError:or,isCancel:ir,CancelToken:ar,VERSION:lr,all:cr,Cancel:ur,isAxiosError:dr,spread:fr,toFormData:pr,AxiosHeaders:hr,HttpStatusCode:mr,formToJSON:yr,getAdapter:br,mergeConfig:xr}=O,yt=async(e,t,n,r,s,i)=>{const o={chatInput:e,sessionId:t,metadata:{pinecone_namespace:n,name:s,email:i}};try{return(await O.post(r,o,{headers:{"Content-Type":"application/json"}})).data}catch(l){throw console.error("Error communicating with chat API:",l),l}},Qn=({handleMessageFromForm:e,theme:t,chatBotData:n})=>{const[r,s]=F.useState(""),[i,o]=F.useState(""),[l,p]=F.useState(""),[u,c]=F.useState(""),[d,x]=F.useState(!1),R=async S=>{if(S.preventDefault(),x(!0),c(""),!r.trim()||!i.trim()){c("Name and email are required"),x(!1);return}try{const z=(await yt(l,n.sessionId,n.pineconeNamespace,n.url,r,i)).response;e([{type:"user",text:l},{type:"bot",text:z}])}catch(E){console.log("error sending user details",E),c("Failed to submit. Please try again.")}finally{x(!1)}s(""),o(""),p("")},f={padding:"20px",flexShrink:0,background:t.backgroundColor,fontFamily:"system-ui, -apple-system, sans-serif"},y={display:"flex",flexDirection:"column",gap:"24px"},m={fontSize:"14px",fontWeight:"500",color:t.fontColor,margin:0,lineHeight:"1.4"},w={display:"flex",flexDirection:"column",gap:"20px"},C={fontSize:"14px",color:t.fontColor,fontWeight:"500"},g={width:"100%",padding:"12px 16px",background:t.backgroundColor,color:t.fontColor,border:"1px solid #a1a1aa",borderRadius:"12px",fontSize:"15px",outline:"none",boxSizing:"border-box"},T={padding:"12px 20px",borderRadius:"12px",fontWeight:"600",fontSize:"15px",border:"none",cursor:r.trim()&&i.trim()&&!d?"pointer":"not-allowed",opacity:r.trim()&&i.trim()&&!d?1:.5,background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",transition:"all 0.2s ease"},j={backgroundColor:"#fee2e2",color:"#713f12",padding:"8px 12px",borderRadius:"8px",fontSize:"13px",textAlign:"center",fontWeight:"500"};return h.jsx("div",{style:f,children:h.jsxs("form",{onSubmit:R,style:y,children:[u&&h.jsx("div",{style:j,role:"alert",children:u}),h.jsx("p",{style:m,children:n.welcomeText}),h.jsxs("div",{style:w,children:[h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:C,children:"Full Name"}),h.jsx("input",{type:"text",placeholder:"Enter your full name",value:r,onChange:S=>{s(S.target.value),c("")},style:g,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:C,children:"Email Address"}),h.jsx("input",{type:"email",placeholder:"Enter your email",value:i,onChange:S=>{o(S.target.value),c("")},style:g,required:!0})]}),h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px"},children:[h.jsx("label",{style:C,children:"Message"}),h.jsx("textarea",{placeholder:"Enter your message",value:l,onChange:S=>{p(S.target.value),c("")},style:{...g,minHeight:"60px",resize:"vertical"},required:!0})]})]}),h.jsx("button",{type:"submit",disabled:!r.trim()||!i.trim()||d,style:T,onMouseEnter:S=>{r.trim()&&i.trim()&&!d&&(S.currentTarget.style.transform="translateY(-2px)",S.currentTarget.style.boxShadow="0 10px 20px rgba(0,0,0,0.15)")},onMouseLeave:S=>{S.currentTarget.style.transform="translateY(0)",S.currentTarget.style.boxShadow="none"},children:d?"Submitting...":h.jsxs(h.Fragment,{children:[h.jsx(D.Send,{size:18}),"Submit"]})})]})})},Zn=({onMinimise:e,theme:t,chatBotData:n})=>{const[r,s]=F.useState([]),[i,o]=F.useState(!1),[l,p]=F.useState(!1),[u,c]=F.useState(!1),x={position:"fixed",bottom:"112px",[n.position==="left"?"left":"right"]:"32px",zIndex:50,width:u?"684px":"384px",height:u?"620px":"520px",background:`${t.backgroundColor}cc`,backdropFilter:"blur(16px)",WebkitBackdropFilter:"blur(16px)",borderRadius:"16px",border:"1px solid rgba(255, 255, 255, 0.3)",boxShadow:"0 20px 25px -5px rgba(0,0,0,0.15), 0 10px 10px -5px rgba(0,0,0,0.1)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"system-ui, -apple-system, sans-serif"},R={padding:"16px 20px",background:`linear-gradient(135deg, ${t.primaryColor}, ${t.secondaryColor})`,color:t.fontColor,borderRadius:"16px 16px 0 0",display:"flex",alignItems:"center",justifyContent:"space-between",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1)"},f={position:"relative"},y={width:"44px",height:"44px",borderRadius:"50%",background:"rgba(255,255,255,0.2)",display:"flex",alignItems:"center",justifyContent:"center"},m={position:"absolute",bottom:0,right:0,width:"14px",height:"14px",backgroundColor:"#34d399",borderRadius:"50%",border:"3px solid white"},w={fontSize:"18px",fontWeight:"600",margin:0,lineHeight:"1.2"},C={fontSize:"12px",opacity:.9,margin:0,lineHeight:"1.3"},g={padding:"8px",borderRadius:"50%",background:"transparent",border:"none",cursor:"pointer",transition:"background 0.2s"},T={padding:"12px 20px",borderTop:"1px solid rgba(255,255,255,0.2)",background:t.backgroundColor,textAlign:"center"},j={fontSize:"11px",color:t.fontColor,letterSpacing:"0.5px"},S={fontWeight:"600"},E=(A,_)=>{A.currentTarget.style.background=_?"rgba(255,255,255,0.2)":"transparent"},z=A=>{s(A),p(!0)},J=async A=>{o(!0),s(_=>[..._,{type:"user",text:A}]);try{const _=await yt(A,n.sessionId,n.pineconeNamespace,n.url);s(I=>[...I,{type:"bot",text:_.response,response_timestamp:_.response_timestamp,suggested_prompts:_.suggested_prompt}])}catch(_){console.error("Chat error:",_),s(I=>[...I,{type:"bot",text:"Sorry, something went wrong."}])}finally{o(!1)}};return h.jsxs("div",{style:x,children:[h.jsxs("div",{style:R,children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[h.jsxs("div",{style:f,children:[h.jsx("div",{style:y,children:h.jsx(D.MessageCircle,{size:22})}),h.jsx("span",{style:m})]}),h.jsxs("div",{children:[h.jsx("h3",{style:w,children:n.name}),h.jsx("p",{style:C,children:n.subTitle})]})]}),h.jsxs("div",{style:{display:"flex",alignItems:"left"},children:[h.jsx("button",{onClick:()=>c(A=>!A),"aria-label":"expand chat",style:g,onMouseEnter:A=>E(A,!0),onMouseLeave:A=>E(A,!1),children:u?h.jsx(D.Minimize2,{size:20}):h.jsx(D.Maximize2,{size:20})}),h.jsx("button",{onClick:e,"aria-label":"minimise chat",style:g,onMouseEnter:A=>E(A,!0),onMouseLeave:A=>E(A,!1),children:h.jsx(D.Minus,{size:20})})]})]}),l?h.jsxs(h.Fragment,{children:[h.jsx(St,{messages:r,isLoading:i,theme:t}),h.jsx(wt,{onSendMessage:J,isLoading:i,theme:t,messages:r})]}):h.jsx(Qn,{handleMessageFromForm:z,theme:t,chatBotData:n}),h.jsx("div",{style:T,children:h.jsxs("p",{style:j,children:["powered by"," ",h.jsx("span",{style:S,children:"clone67.com"})]})})]})},er=({pineconeNamespace:e,url:t,primaryColor:n="#3b82f6",secondaryColor:r="#8b5cf6",backgroundColor:s="#ffffff",fontColor:i="#1f2937",placeholderColor:o="#9ca3af",position:l="right",name:p="Assistant",subTitle:u="Typically replies instantly",welcomeText:c="Hi! How can I help you today?"})=>{const[d,x]=F.useState(!1),[R,f]=F.useState("");F.useEffect(()=>{f(xt.v4())},[]);const y=()=>x(E=>!E),m=()=>x(E=>!E),w={primaryColor:n,secondaryColor:r,backgroundColor:s,fontColor:i,placeholderColor:o,inputBackgroundColor:s},C={name:p,subTitle:u,welcomeText:c,url:t,pineconeNamespace:e,position:l,sessionId:R},g=l==="left",T="32px",j={position:"fixed",bottom:"104px",[g?"left":"right"]:T,zIndex:9999,pointerEvents:"auto"},S={position:"fixed",bottom:"32px",[g?"left":"right"]:T,zIndex:1e4,pointerEvents:"auto"};return h.jsxs(h.Fragment,{children:[d&&h.jsx("div",{style:j,children:h.jsx(Zn,{onMinimise:m,theme:w,chatBotData:C})}),h.jsx("div",{style:S,children:h.jsx(gt,{onClick:y,isOpen:d,theme:w,chatBotData:C})})]})};module.exports=er;
|