@doclessai/sdk 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@ Plug-and-play AI assistants infrastructure as a service. Seamlessly integrate in
6
6
  [![MIT License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
7
7
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
8
8
 
9
- **Homepage:** [doclessai.com](https://doclessai.vercel.app)
9
+ **Homepage:** [doclessai](https://doclessai.vercel.app)
10
10
 
11
11
  ## 🚀 Features
12
12
 
@@ -40,7 +40,7 @@ export default function App() {
40
40
  return (
41
41
  <div>
42
42
  <h1>My App</h1>
43
- <ChatWidget appKey="your-app-key-here" />
43
+ <ChatWidget appKey="your-app-key-here" name="YOUR_ASSISTANT_NAME" />
44
44
  </div>
45
45
  );
46
46
  }
@@ -53,24 +53,28 @@ For more control, use the client directly:
53
53
  ```typescript
54
54
  import { DoclessClient } from '@doclessai/sdk';
55
55
 
56
- const client = new DoclessClient({
56
+ const ai = new DoclessClient({
57
57
  appKey: 'your-app-key-here'
58
58
  });
59
-
60
- // Ask a question
61
- const response = await client.ask('user-query');
62
- console.log(response.res);
63
-
64
- // Ask with image attachment
65
- const response = await client.ask('user-query',image);
66
- console.log(response.res); // text response
67
- console.log(response.image); // image url if returned
59
+
60
+ // Send only query
61
+ const res = await ai.ask(userQuery);
62
+ // Send query with user Image
63
+ const res = await ai.ask(userQuery, ImageFile);
64
+
65
+ // Response format
66
+ {
67
+ res: string, // AI response
68
+ image: string|null, // image URL if relevant
69
+ route: string|null, // app route for navigation
70
+ elementId: string|null // UI element to highlight
71
+ }
68
72
 
69
73
  ```
70
74
 
71
75
  ## 🔗 Resources
72
76
 
73
- - **Homepage:** [doclessai.com](https://doclessai.vercel.app)
77
+ - **Homepage:** [doclessai](https://doclessai.vercel.app)
74
78
  - **GitHub:** [github.com/Dattatray8/doclessai-sdk](https://github.com/Dattatray8/doclessai-sdk)
75
79
  - **NPM Package:** [@doclessai/sdk](https://www.npmjs.com/package/@doclessai/sdk)
76
80
 
@@ -87,4 +91,4 @@ If you encounter any issues or have questions, please:
87
91
 
88
92
  ---
89
93
 
90
- Built with ❤️ by the DoclessAI team.
94
+ Built with ❤️
@@ -0,0 +1,39 @@
1
+ var u=class{appKey;baseUrl;constructor(n){this.appKey=n.appKey,this.baseUrl=n.baseUrl||"https://doclessai.vercel.app/api/v1"}async ask(n,c){let x=new AbortController;try{let i=new FormData;i.append("appKey",this.appKey),i.append("query",n),c&&i.append("image",c);let l=await fetch(`${this.baseUrl}/chat`,{method:"POST",signal:x.signal,headers:{"X-SDK-Name":"@doclessai/sdk","X-SDK-Version":"0.3.5"},body:i});if(!l.ok){let g=await l.json().catch(()=>({}));throw new Error(g.message||`DoclessAI Request failed with status ${l.status}`)}return await l.json()}catch(i){throw i instanceof Error&&i.name==="AbortError"?new Error("DoclessAI Error: Request timed out."):new Error(`DoclessAI Error: ${i instanceof Error?i.message:"Unknown error"}`)}}};import{useState as p,useRef as z,useEffect as A,useMemo as F}from"react";import{toast as E,Toaster as H}from"react-hot-toast";import B from"react-markdown";import{jsx as e,jsxs as r}from"react/jsx-runtime";var T=s=>{if(!s)return;let n=document.getElementById(s);n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),n.classList.add("docless-highlight"),setTimeout(()=>{n.classList.remove("docless-highlight")},3e3))},M=(s,n)=>{s&&window.location.pathname!==s?(window.location.href=s,setTimeout(()=>{T(n)},700)):T(n)};function K({name:s="Assistant",appKey:n}){let[c,x]=p(!1),[i,l]=p(""),[g,b]=p([{role:"assistant",content:"Hello! How can I help you today?"}]),[a,m]=p(!1),[h,w]=p(null),[v,k]=p(null),C=z(null),f=z(null),L=F(()=>new u({appKey:n}),[n]);A(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:"smooth"})},[g,a]);let S=async()=>{if(!i.trim()||a)return;let o=i.trim(),d=h;l(""),b(t=>[...t,{role:"user",content:o}]),m(!0);try{let t=await L.ask(o,d||void 0);w(null),b(y=>[...y,{role:"assistant",content:t.res,image:t.image,route:t.route,elementId:t.elementId}])}catch(t){E.error(t?.message||"Something went wrong"),l(o)}finally{m(!1)}},D={backgroundColor:"#4f46e5",color:"white",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"none",cursor:"pointer"},W={backgroundColor:"#eef2ff",color:"#4338ca",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"1px solid #c7d2fe",cursor:"pointer"};return r("div",{style:{fontFamily:"Inter, system-ui, sans-serif"},children:[e(H,{position:"top-center",reverseOrder:!1}),e("style",{children:`
2
+ @keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } }
3
+ @keyframes blink { 0%, 90%, 100% { opacity: 1; } 95% { opacity: 0.3; } }
4
+ @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
5
+
6
+ .chat-bubble { animation: float 2s ease-in-out infinite; }
7
+ .robot-eye { animation: blink 3s ease-in-out infinite; }
8
+
9
+ .markdown-container {
10
+ word-break: break-word;
11
+ }
12
+
13
+ .markdown-container strong {
14
+ font-weight: 700;
15
+ color: #111827;
16
+ }
17
+
18
+ .markdown-container a {
19
+ color: #4f46e5;
20
+ text-decoration: underline;
21
+ }
22
+
23
+ .markdown-container pre {
24
+ white-space: pre-wrap;
25
+ word-wrap: break-word;
26
+ }
27
+
28
+ @keyframes pulseHighlight {
29
+ 0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.6); }
30
+ 70% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
31
+ 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
32
+ }
33
+
34
+ .docless-highlight {
35
+ animation: pulseHighlight 1.5s ease-out 2;
36
+ outline: 3px solid #6366f1;
37
+ border-radius: 8px;
38
+ }
39
+ `}),v&&r("div",{onClick:()=>k(null),style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(5px)",zIndex:2e4,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out",padding:"20px"},children:[e("button",{style:{position:"absolute",top:"20px",right:"20px",background:"#fff",border:"none",borderRadius:"50%",width:"40px",height:"40px",cursor:"pointer",fontSize:"20px"},children:"\u2715"}),e("img",{src:v,style:{maxWidth:"100%",maxHeight:"90vh",borderRadius:"8px",boxShadow:"0 0 30px rgba(0,0,0,0.5)"},alt:"Zoomed reference"})]}),!c&&e("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",style:{cursor:"pointer",position:"fixed",bottom:"20px",right:"20px",zIndex:9999,filter:"drop-shadow(0px 4px 12px rgba(0, 0, 0, 0.15))"},onClick:()=>x(!0),children:r("g",{className:"chat-bubble",children:[e("ellipse",{cx:"30",cy:"52",rx:"15",ry:"3",fill:"#000",opacity:"0.1"}),e("path",{d:"M45 15C45 8.37258 39.6274 3 33 3H15C8.37258 3 3 8.37258 3 15V33C3 39.6274 8.37258 45 15 45H18V52L26 45H33C39.6274 45 45 39.6274 45 33V15Z",fill:"#4F46E5"}),r("g",{transform:"translate(12, 14)",children:[e("line",{x1:"12",y1:"0",x2:"12",y2:"3",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),e("circle",{cx:"12",cy:"0",r:"1.5",fill:"white"}),e("rect",{x:"6",y:"3",width:"12",height:"10",rx:"2",fill:"white"}),e("circle",{className:"robot-eye",cx:"9.5",cy:"8",r:"1.5",fill:"#4F46E5"}),e("circle",{className:"robot-eye",cx:"14.5",cy:"8",r:"1.5",fill:"#4F46E5"}),e("line",{x1:"9",y1:"11",x2:"15",y2:"11",stroke:"#4F46E5",strokeWidth:"1",strokeLinecap:"round"}),e("rect",{x:"7",y:"14",width:"10",height:"6",rx:"1",fill:"white"}),e("rect",{x:"4",y:"15",width:"2",height:"4",rx:"1",fill:"white"}),e("rect",{x:"18",y:"15",width:"2",height:"4",rx:"1",fill:"white"})]})]})}),c&&r("div",{style:{position:"fixed",bottom:"20px",right:"20px",width:"min(400px, 90vw)",height:"min(600px, 85vh)",backgroundColor:"#fff",boxShadow:"0 12px 40px rgba(79, 70, 229, 0.25)",borderRadius:"16px",display:"flex",flexDirection:"column",zIndex:1e4,overflow:"hidden",border:"1px solid #e5e7eb",animation:"fadeIn 0.2s ease-out"},children:[r("div",{style:{backgroundColor:"#4f46e5",padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#fff"},children:[r("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[e("div",{style:{width:"8px",height:"8px",backgroundColor:"#22c55e",borderRadius:"50%",boxShadow:"0 0 8px #22c55e"}}),e("span",{style:{fontWeight:600,fontSize:"15px"},children:s})]}),e("span",{style:{cursor:"pointer",fontSize:"18px",opacity:.8},onClick:()=>x(!1),children:"\u2715"})]}),r("div",{ref:f,style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#f9fafb"},children:[g.map((o,d)=>e("div",{style:{alignSelf:o.role==="user"?"flex-end":"flex-start",maxWidth:"85%",display:"flex",flexDirection:"column",gap:"4px"},children:r("div",{style:{backgroundColor:o.role==="user"?"#4f46e5":"#fff",color:o.role==="user"?"#fff":"#374151",padding:"12px 16px",borderRadius:"12px",fontSize:"14px",border:o.role==="user"?"none":"1px solid #e5e7eb",boxShadow:o.role==="user"?"0 2px 4px rgba(79,70,229,0.2)":"0 1px 2px rgba(0,0,0,0.05)"},children:[o.image&&e("div",{style:{marginBottom:"10px"},children:e("img",{src:o.image,onClick:()=>k(o.image),style:{width:"100%",borderRadius:"8px",cursor:"zoom-in"},alt:"Reference"})}),o.role==="assistant"?r("div",{className:"markdown-container",children:[e(B,{components:{p:({children:t})=>e("p",{style:{marginBottom:"12px",lineHeight:"1.6"},children:t}),ul:({children:t})=>e("ul",{style:{listStyleType:"disc",marginLeft:"20px",marginBottom:"12px"},children:t}),ol:({children:t})=>e("ol",{style:{listStyleType:"decimal",marginLeft:"20px",marginBottom:"12px"},children:t}),li:({children:t})=>e("li",{style:{marginBottom:"4px"},children:t}),h1:({children:t})=>e("h1",{style:{fontSize:"1.25rem",fontWeight:"bold",margin:"16px 0 8px"},children:t}),h2:({children:t})=>e("h2",{style:{fontSize:"1.1rem",fontWeight:"bold",margin:"14px 0 7px"},children:t}),h3:({children:t})=>e("h3",{style:{fontSize:"1rem",fontWeight:"bold",margin:"12px 0 6px"},children:t}),code:({node:t,inline:y,className:U,children:I,...R})=>y?e("code",{style:{backgroundColor:"#f3f4f6",padding:"2px 5px",borderRadius:"4px",fontSize:"13px",color:"#e03e2d",fontFamily:"monospace"},...R,children:I}):e("div",{style:{backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",margin:"12px 0",overflowX:"auto"},children:e("code",{style:{fontSize:"13px",color:"#1e293b",fontFamily:"monospace",whiteSpace:"pre"},...R,children:I})}),blockquote:({children:t})=>e("blockquote",{style:{borderLeft:"4px solid #4f46e5",paddingLeft:"12px",color:"#4b5563",fontStyle:"italic",margin:"12px 0"},children:t}),table:({children:t})=>e("div",{style:{overflowX:"auto",margin:"12px 0"},children:e("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:t})}),th:({children:t})=>e("th",{style:{border:"1px solid #e5e7eb",padding:"8px",backgroundColor:"#f9fafb",textAlign:"left"},children:t}),td:({children:t})=>e("td",{style:{border:"1px solid #e5e7eb",padding:"8px"},children:t})},children:o.content}),(o.route||o.elementId)&&r("div",{style:{marginTop:"12px",borderTop:"1px solid #f3f4f6",paddingTop:"10px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[o.route&&e("button",{onClick:()=>window.location.href=o.route,style:D,children:"Explore Page"}),o.elementId&&e("button",{onClick:()=>M(o.route,o.elementId),style:W,children:"View"})]})]}):e("div",{style:{whiteSpace:"pre-wrap"},children:o.content})]})},d)),e("div",{ref:f}),a&&r("div",{style:{fontSize:"12px",color:"#6b7280",marginLeft:"4px"},children:[s," is thinking..."]})]}),r("div",{style:{padding:"16px",borderTop:"1px solid #e5e7eb",backgroundColor:"#fff"},children:[r("div",{style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:"#f3f4f6",padding:"6px 14px",borderRadius:"28px"},children:[r("button",{style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex"},onClick:()=>C.current?.click(),children:[r("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e("polyline",{points:"21 15 16 10 5 21"})]}),e("input",{type:"file",accept:"image/*",ref:C,style:{display:"none"},onChange:o=>{let d=o.target.files?.[0];d&&(w(d),E.success(`Attached: ${d.name}`))}})]}),h&&r("div",{style:{fontSize:"11px",color:"#4f46e5",maxWidth:"80px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["\u{1F4CE} ",h.name]}),e("input",{type:"text",value:i,onChange:o=>l(o.target.value),onKeyDown:o=>o.key==="Enter"&&S(),placeholder:"Type a message...",style:{flex:1,border:"none",background:"none",padding:"10px 0",outline:"none",fontSize:"14px",color:"#1f2937"}}),e("button",{onClick:S,disabled:!i.trim()||a,style:{background:i.trim()&&!a?"#4f46e5":"transparent",border:"none",borderRadius:"50%",width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",cursor:i.trim()&&!a?"pointer":"default",transition:"all 0.2s"},children:r("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:i.trim()&&!a?"#fff":"#9ca3af",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),e("polyline",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),r("div",{style:{textAlign:"center",fontSize:"11px",color:"#9ca3af",marginTop:"10px"},children:["Powered by ",e("strong",{children:"DoclessAI"})]})]})]})]})}export{u as a,K as b};
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var W=Object.create;var y=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var M=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var H=(n,i)=>{for(var s in i)y(n,s,{get:i[s],enumerable:!0})},E=(n,i,s,d)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of F(i))!B.call(n,o)&&o!==s&&y(n,o,{get:()=>i[o],enumerable:!(d=A(i,o))||d.enumerable});return n};var K=(n,i,s)=>(s=n!=null?W(M(n)):{},E(i||!n||!n.__esModule?y(s,"default",{value:n,enumerable:!0}):s,n)),j=n=>E(y({},"__esModule",{value:!0}),n);var U={};H(U,{ChatWidget:()=>m,DoclessClient:()=>x});module.exports=j(U);var x=class{appKey;baseUrl;constructor(i){this.appKey=i.appKey,this.baseUrl=i.baseUrl||"https://doclessai.vercel.app/api/v1"}async ask(i,s){let d=new AbortController;try{let o=new FormData;o.append("appKey",this.appKey),o.append("query",i),s&&o.append("image",s);let l=await fetch(`${this.baseUrl}/chat`,{method:"POST",signal:d.signal,headers:{"X-SDK-Name":"@doclessai/sdk","X-SDK-Version":"0.3.3"},body:o});if(!l.ok){let u=await l.json().catch(()=>({}));throw new Error(u.message||`DoclessAI Request failed with status ${l.status}`)}return await l.json()}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error("DoclessAI Error: Request timed out."):new Error(`DoclessAI Error: ${o instanceof Error?o.message:"Unknown error"}`)}}};var a=require("react");var g=require("react-hot-toast"),L=K(require("react-markdown"),1),e=require("react/jsx-runtime");function m({name:n="Assistant",appKey:i}){let[s,d]=(0,a.useState)(!1),[o,l]=(0,a.useState)(""),[u,w]=(0,a.useState)([{role:"assistant",content:"Hello! How can I help you today?"}]),[p,k]=(0,a.useState)(!1),[h,v]=(0,a.useState)(null),[C,S]=(0,a.useState)(null),I=(0,a.useRef)(null),f=(0,a.useRef)(null),D=(0,a.useMemo)(()=>new x({appKey:i}),[i]);(0,a.useEffect)(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:"smooth"})},[u,p]);let R=async()=>{if(!o.trim()||p)return;let r=o.trim(),c=h;l(""),w(t=>[...t,{role:"user",content:r}]),k(!0);try{let t=await D.ask(r,c||void 0);v(null),w(b=>[...b,{role:"assistant",content:t.res,image:t.image,route:t.route,elementId:t.elementId}])}catch(t){g.toast.error(t?.message||"Something went wrong"),l(r)}finally{k(!1)}};return(0,e.jsxs)("div",{style:{fontFamily:"Inter, system-ui, sans-serif"},children:[(0,e.jsx)(g.Toaster,{position:"top-center",reverseOrder:!1}),(0,e.jsx)("style",{children:`
1
+ "use strict";var H=Object.create;var h=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,U=Object.prototype.hasOwnProperty;var j=(i,r)=>{for(var s in r)h(i,s,{get:r[s],enumerable:!0})},T=(i,r,s,d)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of M(r))!U.call(i,n)&&n!==s&&h(i,n,{get:()=>r[n],enumerable:!(d=B(r,n))||d.enumerable});return i};var q=(i,r,s)=>(s=i!=null?H(K(i)):{},T(r||!i||!i.__esModule?h(s,"default",{value:i,enumerable:!0}):s,i)),N=i=>T(h({},"__esModule",{value:!0}),i);var P={};j(P,{ChatWidget:()=>m,DoclessClient:()=>x});module.exports=N(P);var x=class{appKey;baseUrl;constructor(r){this.appKey=r.appKey,this.baseUrl=r.baseUrl||"https://doclessai.vercel.app/api/v1"}async ask(r,s){let d=new AbortController;try{let n=new FormData;n.append("appKey",this.appKey),n.append("query",r),s&&n.append("image",s);let a=await fetch(`${this.baseUrl}/chat`,{method:"POST",signal:d.signal,headers:{"X-SDK-Name":"@doclessai/sdk","X-SDK-Version":"0.3.5"},body:n});if(!a.ok){let u=await a.json().catch(()=>({}));throw new Error(u.message||`DoclessAI Request failed with status ${a.status}`)}return await a.json()}catch(n){throw n instanceof Error&&n.name==="AbortError"?new Error("DoclessAI Error: Request timed out."):new Error(`DoclessAI Error: ${n instanceof Error?n.message:"Unknown error"}`)}}};var l=require("react");var g=require("react-hot-toast"),W=q(require("react-markdown"),1),e=require("react/jsx-runtime"),L=i=>{if(!i)return;let r=document.getElementById(i);r&&(r.scrollIntoView({behavior:"smooth",block:"center"}),r.classList.add("docless-highlight"),setTimeout(()=>{r.classList.remove("docless-highlight")},3e3))},V=(i,r)=>{i&&window.location.pathname!==i?(window.location.href=i,setTimeout(()=>{L(r)},700)):L(r)};function m({name:i="Assistant",appKey:r}){let[s,d]=(0,l.useState)(!1),[n,a]=(0,l.useState)(""),[u,w]=(0,l.useState)([{role:"assistant",content:"Hello! How can I help you today?"}]),[p,v]=(0,l.useState)(!1),[y,k]=(0,l.useState)(null),[C,S]=(0,l.useState)(null),I=(0,l.useRef)(null),f=(0,l.useRef)(null),D=(0,l.useMemo)(()=>new x({appKey:r}),[r]);(0,l.useEffect)(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:"smooth"})},[u,p]);let R=async()=>{if(!n.trim()||p)return;let o=n.trim(),c=y;a(""),w(t=>[...t,{role:"user",content:o}]),v(!0);try{let t=await D.ask(o,c||void 0);k(null),w(b=>[...b,{role:"assistant",content:t.res,image:t.image,route:t.route,elementId:t.elementId}])}catch(t){g.toast.error(t?.message||"Something went wrong"),a(o)}finally{v(!1)}},A={backgroundColor:"#4f46e5",color:"white",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"none",cursor:"pointer"},F={backgroundColor:"#eef2ff",color:"#4338ca",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"1px solid #c7d2fe",cursor:"pointer"};return(0,e.jsxs)("div",{style:{fontFamily:"Inter, system-ui, sans-serif"},children:[(0,e.jsx)(g.Toaster,{position:"top-center",reverseOrder:!1}),(0,e.jsx)("style",{children:`
2
2
  @keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } }
3
3
  @keyframes blink { 0%, 90%, 100% { opacity: 1; } 95% { opacity: 0.3; } }
4
4
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@@ -24,4 +24,16 @@
24
24
  white-space: pre-wrap;
25
25
  word-wrap: break-word;
26
26
  }
27
- `}),C&&(0,e.jsxs)("div",{onClick:()=>S(null),style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(5px)",zIndex:2e4,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out",padding:"20px"},children:[(0,e.jsx)("button",{style:{position:"absolute",top:"20px",right:"20px",background:"#fff",border:"none",borderRadius:"50%",width:"40px",height:"40px",cursor:"pointer",fontSize:"20px"},children:"\u2715"}),(0,e.jsx)("img",{src:C,style:{maxWidth:"100%",maxHeight:"90vh",borderRadius:"8px",boxShadow:"0 0 30px rgba(0,0,0,0.5)"},alt:"Zoomed reference"})]}),!s&&(0,e.jsx)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",style:{cursor:"pointer",position:"fixed",bottom:"20px",right:"20px",zIndex:9999,filter:"drop-shadow(0px 4px 12px rgba(0, 0, 0, 0.15))"},onClick:()=>d(!0),children:(0,e.jsxs)("g",{className:"chat-bubble",children:[(0,e.jsx)("ellipse",{cx:"30",cy:"52",rx:"15",ry:"3",fill:"#000",opacity:"0.1"}),(0,e.jsx)("path",{d:"M45 15C45 8.37258 39.6274 3 33 3H15C8.37258 3 3 8.37258 3 15V33C3 39.6274 8.37258 45 15 45H18V52L26 45H33C39.6274 45 45 39.6274 45 33V15Z",fill:"#4F46E5"}),(0,e.jsxs)("g",{transform:"translate(12, 14)",children:[(0,e.jsx)("line",{x1:"12",y1:"0",x2:"12",y2:"3",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"0",r:"1.5",fill:"white"}),(0,e.jsx)("rect",{x:"6",y:"3",width:"12",height:"10",rx:"2",fill:"white"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"9.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"14.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("line",{x1:"9",y1:"11",x2:"15",y2:"11",stroke:"#4F46E5",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("rect",{x:"7",y:"14",width:"10",height:"6",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"4",y:"15",width:"2",height:"4",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"18",y:"15",width:"2",height:"4",rx:"1",fill:"white"})]})]})}),s&&(0,e.jsxs)("div",{style:{position:"fixed",bottom:"20px",right:"20px",width:"min(400px, 90vw)",height:"min(600px, 85vh)",backgroundColor:"#fff",boxShadow:"0 12px 40px rgba(79, 70, 229, 0.25)",borderRadius:"16px",display:"flex",flexDirection:"column",zIndex:1e4,overflow:"hidden",border:"1px solid #e5e7eb",animation:"fadeIn 0.2s ease-out"},children:[(0,e.jsxs)("div",{style:{backgroundColor:"#4f46e5",padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,e.jsx)("div",{style:{width:"8px",height:"8px",backgroundColor:"#22c55e",borderRadius:"50%",boxShadow:"0 0 8px #22c55e"}}),(0,e.jsx)("span",{style:{fontWeight:600,fontSize:"15px"},children:n})]}),(0,e.jsx)("span",{style:{cursor:"pointer",fontSize:"18px",opacity:.8},onClick:()=>d(!1),children:"\u2715"})]}),(0,e.jsxs)("div",{ref:f,style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#f9fafb"},children:[u.map((r,c)=>(0,e.jsx)("div",{style:{alignSelf:r.role==="user"?"flex-end":"flex-start",maxWidth:"85%",display:"flex",flexDirection:"column",gap:"4px"},children:(0,e.jsxs)("div",{style:{backgroundColor:r.role==="user"?"#4f46e5":"#fff",color:r.role==="user"?"#fff":"#374151",padding:"12px 16px",borderRadius:"12px",fontSize:"14px",border:r.role==="user"?"none":"1px solid #e5e7eb",boxShadow:r.role==="user"?"0 2px 4px rgba(79,70,229,0.2)":"0 1px 2px rgba(0,0,0,0.05)"},children:[r.image&&(0,e.jsx)("div",{style:{marginBottom:"10px"},children:(0,e.jsx)("img",{src:r.image,onClick:()=>S(r.image),style:{width:"100%",borderRadius:"8px",cursor:"zoom-in"},alt:"Reference"})}),r.role==="assistant"?(0,e.jsxs)("div",{className:"markdown-container",children:[(0,e.jsx)(L.default,{components:{p:({children:t})=>(0,e.jsx)("p",{style:{marginBottom:"12px",lineHeight:"1.6"},children:t}),ul:({children:t})=>(0,e.jsx)("ul",{style:{listStyleType:"disc",marginLeft:"20px",marginBottom:"12px"},children:t}),ol:({children:t})=>(0,e.jsx)("ol",{style:{listStyleType:"decimal",marginLeft:"20px",marginBottom:"12px"},children:t}),li:({children:t})=>(0,e.jsx)("li",{style:{marginBottom:"4px"},children:t}),h1:({children:t})=>(0,e.jsx)("h1",{style:{fontSize:"1.25rem",fontWeight:"bold",margin:"16px 0 8px"},children:t}),h2:({children:t})=>(0,e.jsx)("h2",{style:{fontSize:"1.1rem",fontWeight:"bold",margin:"14px 0 7px"},children:t}),h3:({children:t})=>(0,e.jsx)("h3",{style:{fontSize:"1rem",fontWeight:"bold",margin:"12px 0 6px"},children:t}),code:({node:t,inline:b,className:q,children:z,...T})=>b?(0,e.jsx)("code",{style:{backgroundColor:"#f3f4f6",padding:"2px 5px",borderRadius:"4px",fontSize:"13px",color:"#e03e2d",fontFamily:"monospace"},...T,children:z}):(0,e.jsx)("div",{style:{backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",margin:"12px 0",overflowX:"auto"},children:(0,e.jsx)("code",{style:{fontSize:"13px",color:"#1e293b",fontFamily:"monospace",whiteSpace:"pre"},...T,children:z})}),blockquote:({children:t})=>(0,e.jsx)("blockquote",{style:{borderLeft:"4px solid #4f46e5",paddingLeft:"12px",color:"#4b5563",fontStyle:"italic",margin:"12px 0"},children:t}),table:({children:t})=>(0,e.jsx)("div",{style:{overflowX:"auto",margin:"12px 0"},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:t})}),th:({children:t})=>(0,e.jsx)("th",{style:{border:"1px solid #e5e7eb",padding:"8px",backgroundColor:"#f9fafb",textAlign:"left"},children:t}),td:({children:t})=>(0,e.jsx)("td",{style:{border:"1px solid #e5e7eb",padding:"8px"},children:t})},children:r.content}),r.route&&(0,e.jsx)("div",{style:{marginTop:"12px",borderTop:"1px solid #f3f4f6",paddingTop:"10px"},children:(0,e.jsxs)("button",{onClick:()=>{window.location.href=r.route},style:{display:"inline-flex",alignItems:"center",gap:"6px",backgroundColor:"#4f46e5",color:"white",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"none",cursor:"pointer",transition:"background 0.2s"},onMouseOver:t=>t.currentTarget.style.backgroundColor="#4338ca",onMouseOut:t=>t.currentTarget.style.backgroundColor="#4f46e5",children:["Explore Page",(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("line",{x1:"7",y1:"17",x2:"17",y2:"7"}),(0,e.jsx)("polyline",{points:"7 7 17 7 17 17"})]})]})})]}):(0,e.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:r.content})]})},c)),(0,e.jsx)("div",{ref:f}),p&&(0,e.jsxs)("div",{style:{fontSize:"12px",color:"#6b7280",marginLeft:"4px"},children:[n," is thinking..."]})]}),(0,e.jsxs)("div",{style:{padding:"16px",borderTop:"1px solid #e5e7eb",backgroundColor:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:"#f3f4f6",padding:"6px 14px",borderRadius:"28px"},children:[(0,e.jsxs)("button",{style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex"},onClick:()=>I.current?.click(),children:[(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,e.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,e.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,e.jsx)("input",{type:"file",accept:"image/*",ref:I,style:{display:"none"},onChange:r=>{let c=r.target.files?.[0];c&&(v(c),g.toast.success(`Attached: ${c.name}`))}})]}),h&&(0,e.jsxs)("div",{style:{fontSize:"11px",color:"#4f46e5",maxWidth:"80px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["\u{1F4CE} ",h.name]}),(0,e.jsx)("input",{type:"text",value:o,onChange:r=>l(r.target.value),onKeyDown:r=>r.key==="Enter"&&R(),placeholder:"Type a message...",style:{flex:1,border:"none",background:"none",padding:"10px 0",outline:"none",fontSize:"14px",color:"#1f2937"}}),(0,e.jsx)("button",{onClick:R,disabled:!o.trim()||p,style:{background:o.trim()&&!p?"#4f46e5":"transparent",border:"none",borderRadius:"50%",width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",cursor:o.trim()&&!p?"pointer":"default",transition:"all 0.2s"},children:(0,e.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:o.trim()&&!p?"#fff":"#9ca3af",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,e.jsx)("polyline",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(0,e.jsxs)("div",{style:{textAlign:"center",fontSize:"11px",color:"#9ca3af",marginTop:"10px"},children:["Powered by ",(0,e.jsx)("strong",{children:"DoclessAI"})]})]})]})]})}0&&(module.exports={ChatWidget,DoclessClient});
27
+
28
+ @keyframes pulseHighlight {
29
+ 0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.6); }
30
+ 70% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
31
+ 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
32
+ }
33
+
34
+ .docless-highlight {
35
+ animation: pulseHighlight 1.5s ease-out 2;
36
+ outline: 3px solid #6366f1;
37
+ border-radius: 8px;
38
+ }
39
+ `}),C&&(0,e.jsxs)("div",{onClick:()=>S(null),style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(5px)",zIndex:2e4,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out",padding:"20px"},children:[(0,e.jsx)("button",{style:{position:"absolute",top:"20px",right:"20px",background:"#fff",border:"none",borderRadius:"50%",width:"40px",height:"40px",cursor:"pointer",fontSize:"20px"},children:"\u2715"}),(0,e.jsx)("img",{src:C,style:{maxWidth:"100%",maxHeight:"90vh",borderRadius:"8px",boxShadow:"0 0 30px rgba(0,0,0,0.5)"},alt:"Zoomed reference"})]}),!s&&(0,e.jsx)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",style:{cursor:"pointer",position:"fixed",bottom:"20px",right:"20px",zIndex:9999,filter:"drop-shadow(0px 4px 12px rgba(0, 0, 0, 0.15))"},onClick:()=>d(!0),children:(0,e.jsxs)("g",{className:"chat-bubble",children:[(0,e.jsx)("ellipse",{cx:"30",cy:"52",rx:"15",ry:"3",fill:"#000",opacity:"0.1"}),(0,e.jsx)("path",{d:"M45 15C45 8.37258 39.6274 3 33 3H15C8.37258 3 3 8.37258 3 15V33C3 39.6274 8.37258 45 15 45H18V52L26 45H33C39.6274 45 45 39.6274 45 33V15Z",fill:"#4F46E5"}),(0,e.jsxs)("g",{transform:"translate(12, 14)",children:[(0,e.jsx)("line",{x1:"12",y1:"0",x2:"12",y2:"3",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"0",r:"1.5",fill:"white"}),(0,e.jsx)("rect",{x:"6",y:"3",width:"12",height:"10",rx:"2",fill:"white"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"9.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"14.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("line",{x1:"9",y1:"11",x2:"15",y2:"11",stroke:"#4F46E5",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("rect",{x:"7",y:"14",width:"10",height:"6",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"4",y:"15",width:"2",height:"4",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"18",y:"15",width:"2",height:"4",rx:"1",fill:"white"})]})]})}),s&&(0,e.jsxs)("div",{style:{position:"fixed",bottom:"20px",right:"20px",width:"min(400px, 90vw)",height:"min(600px, 85vh)",backgroundColor:"#fff",boxShadow:"0 12px 40px rgba(79, 70, 229, 0.25)",borderRadius:"16px",display:"flex",flexDirection:"column",zIndex:1e4,overflow:"hidden",border:"1px solid #e5e7eb",animation:"fadeIn 0.2s ease-out"},children:[(0,e.jsxs)("div",{style:{backgroundColor:"#4f46e5",padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,e.jsx)("div",{style:{width:"8px",height:"8px",backgroundColor:"#22c55e",borderRadius:"50%",boxShadow:"0 0 8px #22c55e"}}),(0,e.jsx)("span",{style:{fontWeight:600,fontSize:"15px"},children:i})]}),(0,e.jsx)("span",{style:{cursor:"pointer",fontSize:"18px",opacity:.8},onClick:()=>d(!1),children:"\u2715"})]}),(0,e.jsxs)("div",{ref:f,style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#f9fafb"},children:[u.map((o,c)=>(0,e.jsx)("div",{style:{alignSelf:o.role==="user"?"flex-end":"flex-start",maxWidth:"85%",display:"flex",flexDirection:"column",gap:"4px"},children:(0,e.jsxs)("div",{style:{backgroundColor:o.role==="user"?"#4f46e5":"#fff",color:o.role==="user"?"#fff":"#374151",padding:"12px 16px",borderRadius:"12px",fontSize:"14px",border:o.role==="user"?"none":"1px solid #e5e7eb",boxShadow:o.role==="user"?"0 2px 4px rgba(79,70,229,0.2)":"0 1px 2px rgba(0,0,0,0.05)"},children:[o.image&&(0,e.jsx)("div",{style:{marginBottom:"10px"},children:(0,e.jsx)("img",{src:o.image,onClick:()=>S(o.image),style:{width:"100%",borderRadius:"8px",cursor:"zoom-in"},alt:"Reference"})}),o.role==="assistant"?(0,e.jsxs)("div",{className:"markdown-container",children:[(0,e.jsx)(W.default,{components:{p:({children:t})=>(0,e.jsx)("p",{style:{marginBottom:"12px",lineHeight:"1.6"},children:t}),ul:({children:t})=>(0,e.jsx)("ul",{style:{listStyleType:"disc",marginLeft:"20px",marginBottom:"12px"},children:t}),ol:({children:t})=>(0,e.jsx)("ol",{style:{listStyleType:"decimal",marginLeft:"20px",marginBottom:"12px"},children:t}),li:({children:t})=>(0,e.jsx)("li",{style:{marginBottom:"4px"},children:t}),h1:({children:t})=>(0,e.jsx)("h1",{style:{fontSize:"1.25rem",fontWeight:"bold",margin:"16px 0 8px"},children:t}),h2:({children:t})=>(0,e.jsx)("h2",{style:{fontSize:"1.1rem",fontWeight:"bold",margin:"14px 0 7px"},children:t}),h3:({children:t})=>(0,e.jsx)("h3",{style:{fontSize:"1rem",fontWeight:"bold",margin:"12px 0 6px"},children:t}),code:({node:t,inline:b,className:Y,children:z,...E})=>b?(0,e.jsx)("code",{style:{backgroundColor:"#f3f4f6",padding:"2px 5px",borderRadius:"4px",fontSize:"13px",color:"#e03e2d",fontFamily:"monospace"},...E,children:z}):(0,e.jsx)("div",{style:{backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",margin:"12px 0",overflowX:"auto"},children:(0,e.jsx)("code",{style:{fontSize:"13px",color:"#1e293b",fontFamily:"monospace",whiteSpace:"pre"},...E,children:z})}),blockquote:({children:t})=>(0,e.jsx)("blockquote",{style:{borderLeft:"4px solid #4f46e5",paddingLeft:"12px",color:"#4b5563",fontStyle:"italic",margin:"12px 0"},children:t}),table:({children:t})=>(0,e.jsx)("div",{style:{overflowX:"auto",margin:"12px 0"},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:t})}),th:({children:t})=>(0,e.jsx)("th",{style:{border:"1px solid #e5e7eb",padding:"8px",backgroundColor:"#f9fafb",textAlign:"left"},children:t}),td:({children:t})=>(0,e.jsx)("td",{style:{border:"1px solid #e5e7eb",padding:"8px"},children:t})},children:o.content}),(o.route||o.elementId)&&(0,e.jsxs)("div",{style:{marginTop:"12px",borderTop:"1px solid #f3f4f6",paddingTop:"10px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[o.route&&(0,e.jsx)("button",{onClick:()=>window.location.href=o.route,style:A,children:"Explore Page"}),o.elementId&&(0,e.jsx)("button",{onClick:()=>V(o.route,o.elementId),style:F,children:"View"})]})]}):(0,e.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:o.content})]})},c)),(0,e.jsx)("div",{ref:f}),p&&(0,e.jsxs)("div",{style:{fontSize:"12px",color:"#6b7280",marginLeft:"4px"},children:[i," is thinking..."]})]}),(0,e.jsxs)("div",{style:{padding:"16px",borderTop:"1px solid #e5e7eb",backgroundColor:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:"#f3f4f6",padding:"6px 14px",borderRadius:"28px"},children:[(0,e.jsxs)("button",{style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex"},onClick:()=>I.current?.click(),children:[(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,e.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,e.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,e.jsx)("input",{type:"file",accept:"image/*",ref:I,style:{display:"none"},onChange:o=>{let c=o.target.files?.[0];c&&(k(c),g.toast.success(`Attached: ${c.name}`))}})]}),y&&(0,e.jsxs)("div",{style:{fontSize:"11px",color:"#4f46e5",maxWidth:"80px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["\u{1F4CE} ",y.name]}),(0,e.jsx)("input",{type:"text",value:n,onChange:o=>a(o.target.value),onKeyDown:o=>o.key==="Enter"&&R(),placeholder:"Type a message...",style:{flex:1,border:"none",background:"none",padding:"10px 0",outline:"none",fontSize:"14px",color:"#1f2937"}}),(0,e.jsx)("button",{onClick:R,disabled:!n.trim()||p,style:{background:n.trim()&&!p?"#4f46e5":"transparent",border:"none",borderRadius:"50%",width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",cursor:n.trim()&&!p?"pointer":"default",transition:"all 0.2s"},children:(0,e.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:n.trim()&&!p?"#fff":"#9ca3af",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,e.jsx)("polyline",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(0,e.jsxs)("div",{style:{textAlign:"center",fontSize:"11px",color:"#9ca3af",marginTop:"10px"},children:["Powered by ",(0,e.jsx)("strong",{children:"DoclessAI"})]})]})]})]})}0&&(module.exports={ChatWidget,DoclessClient});
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as e,b as t}from"./chunk-QBXANVZR.js";export{t as ChatWidget,e as DoclessClient};
1
+ import{a as e,b as t}from"./chunk-IRSYXS5O.js";export{t as ChatWidget,e as DoclessClient};
package/dist/loader.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var F=Object.create;var L=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,O=Object.prototype.hasOwnProperty;var j=(i,n,s,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of H(n))!O.call(i,o)&&o!==s&&L(i,o,{get:()=>n[o],enumerable:!(l=B(n,o))||l.enumerable});return i};var h=(i,n,s)=>(s=i!=null?F(K(i)):{},j(n||!i||!i.__esModule?L(s,"default",{value:i,enumerable:!0}):s,i));var M=h(require("react"),1),W=h(require("react-dom/client"),1);var a=require("react");var g=class{appKey;baseUrl;constructor(n){this.appKey=n.appKey,this.baseUrl=n.baseUrl||"https://doclessai.vercel.app/api/v1"}async ask(n,s){let l=new AbortController;try{let o=new FormData;o.append("appKey",this.appKey),o.append("query",n),s&&o.append("image",s);let d=await fetch(`${this.baseUrl}/chat`,{method:"POST",signal:l.signal,headers:{"X-SDK-Name":"@doclessai/sdk","X-SDK-Version":"0.3.3"},body:o});if(!d.ok){let u=await d.json().catch(()=>({}));throw new Error(u.message||`DoclessAI Request failed with status ${d.status}`)}return await d.json()}catch(o){throw o instanceof Error&&o.name==="AbortError"?new Error("DoclessAI Error: Request timed out."):new Error(`DoclessAI Error: ${o instanceof Error?o.message:"Unknown error"}`)}}};var x=require("react-hot-toast"),T=h(require("react-markdown"),1),e=require("react/jsx-runtime");function b({name:i="Assistant",appKey:n}){let[s,l]=(0,a.useState)(!1),[o,d]=(0,a.useState)(""),[u,w]=(0,a.useState)([{role:"assistant",content:"Hello! How can I help you today?"}]),[p,v]=(0,a.useState)(!1),[y,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(null),I=(0,a.useRef)(null),f=(0,a.useRef)(null),A=(0,a.useMemo)(()=>new g({appKey:n}),[n]);(0,a.useEffect)(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:"smooth"})},[u,p]);let R=async()=>{if(!o.trim()||p)return;let r=o.trim(),c=y;d(""),w(t=>[...t,{role:"user",content:r}]),v(!0);try{let t=await A.ask(r,c||void 0);k(null),w(m=>[...m,{role:"assistant",content:t.res,image:t.image,route:t.route,elementId:t.elementId}])}catch(t){x.toast.error(t?.message||"Something went wrong"),d(r)}finally{v(!1)}};return(0,e.jsxs)("div",{style:{fontFamily:"Inter, system-ui, sans-serif"},children:[(0,e.jsx)(x.Toaster,{position:"top-center",reverseOrder:!1}),(0,e.jsx)("style",{children:`
1
+ "use strict";var K=Object.create;var A=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var O=(n,r,s,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of U(r))!N.call(n,i)&&i!==s&&A(n,i,{get:()=>r[i],enumerable:!(l=q(r,i))||l.enumerable});return n};var m=(n,r,s)=>(s=n!=null?K(j(n)):{},O(r||!n||!n.__esModule?A(s,"default",{value:n,enumerable:!0}):s,n));var W=m(require("react"),1),F=m(require("react-dom/client"),1);var a=require("react");var u=class{appKey;baseUrl;constructor(r){this.appKey=r.appKey,this.baseUrl=r.baseUrl||"https://doclessai.vercel.app/api/v1"}async ask(r,s){let l=new AbortController;try{let i=new FormData;i.append("appKey",this.appKey),i.append("query",r),s&&i.append("image",s);let d=await fetch(`${this.baseUrl}/chat`,{method:"POST",signal:l.signal,headers:{"X-SDK-Name":"@doclessai/sdk","X-SDK-Version":"0.3.5"},body:i});if(!d.ok){let g=await d.json().catch(()=>({}));throw new Error(g.message||`DoclessAI Request failed with status ${d.status}`)}return await d.json()}catch(i){throw i instanceof Error&&i.name==="AbortError"?new Error("DoclessAI Error: Request timed out."):new Error(`DoclessAI Error: ${i instanceof Error?i.message:"Unknown error"}`)}}};var x=require("react-hot-toast"),T=m(require("react-markdown"),1),e=require("react/jsx-runtime"),L=n=>{if(!n)return;let r=document.getElementById(n);r&&(r.scrollIntoView({behavior:"smooth",block:"center"}),r.classList.add("docless-highlight"),setTimeout(()=>{r.classList.remove("docless-highlight")},3e3))},V=(n,r)=>{n&&window.location.pathname!==n?(window.location.href=n,setTimeout(()=>{L(r)},700)):L(r)};function b({name:n="Assistant",appKey:r}){let[s,l]=(0,a.useState)(!1),[i,d]=(0,a.useState)(""),[g,w]=(0,a.useState)([{role:"assistant",content:"Hello! How can I help you today?"}]),[p,v]=(0,a.useState)(!1),[h,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(null),I=(0,a.useRef)(null),f=(0,a.useRef)(null),H=(0,a.useMemo)(()=>new u({appKey:r}),[r]);(0,a.useEffect)(()=>{f.current&&f.current.scrollTo({top:f.current.scrollHeight,behavior:"smooth"})},[g,p]);let R=async()=>{if(!i.trim()||p)return;let o=i.trim(),c=h;d(""),w(t=>[...t,{role:"user",content:o}]),v(!0);try{let t=await H.ask(o,c||void 0);k(null),w(y=>[...y,{role:"assistant",content:t.res,image:t.image,route:t.route,elementId:t.elementId}])}catch(t){x.toast.error(t?.message||"Something went wrong"),d(o)}finally{v(!1)}},M={backgroundColor:"#4f46e5",color:"white",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"none",cursor:"pointer"},B={backgroundColor:"#eef2ff",color:"#4338ca",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"1px solid #c7d2fe",cursor:"pointer"};return(0,e.jsxs)("div",{style:{fontFamily:"Inter, system-ui, sans-serif"},children:[(0,e.jsx)(x.Toaster,{position:"top-center",reverseOrder:!1}),(0,e.jsx)("style",{children:`
2
2
  @keyframes float { 0%, 100% { transform: translateY(0px); } 50% { transform: translateY(-5px); } }
3
3
  @keyframes blink { 0%, 90%, 100% { opacity: 1; } 95% { opacity: 0.3; } }
4
4
  @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@@ -24,4 +24,16 @@
24
24
  white-space: pre-wrap;
25
25
  word-wrap: break-word;
26
26
  }
27
- `}),C&&(0,e.jsxs)("div",{onClick:()=>S(null),style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(5px)",zIndex:2e4,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out",padding:"20px"},children:[(0,e.jsx)("button",{style:{position:"absolute",top:"20px",right:"20px",background:"#fff",border:"none",borderRadius:"50%",width:"40px",height:"40px",cursor:"pointer",fontSize:"20px"},children:"\u2715"}),(0,e.jsx)("img",{src:C,style:{maxWidth:"100%",maxHeight:"90vh",borderRadius:"8px",boxShadow:"0 0 30px rgba(0,0,0,0.5)"},alt:"Zoomed reference"})]}),!s&&(0,e.jsx)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",style:{cursor:"pointer",position:"fixed",bottom:"20px",right:"20px",zIndex:9999,filter:"drop-shadow(0px 4px 12px rgba(0, 0, 0, 0.15))"},onClick:()=>l(!0),children:(0,e.jsxs)("g",{className:"chat-bubble",children:[(0,e.jsx)("ellipse",{cx:"30",cy:"52",rx:"15",ry:"3",fill:"#000",opacity:"0.1"}),(0,e.jsx)("path",{d:"M45 15C45 8.37258 39.6274 3 33 3H15C8.37258 3 3 8.37258 3 15V33C3 39.6274 8.37258 45 15 45H18V52L26 45H33C39.6274 45 45 39.6274 45 33V15Z",fill:"#4F46E5"}),(0,e.jsxs)("g",{transform:"translate(12, 14)",children:[(0,e.jsx)("line",{x1:"12",y1:"0",x2:"12",y2:"3",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"0",r:"1.5",fill:"white"}),(0,e.jsx)("rect",{x:"6",y:"3",width:"12",height:"10",rx:"2",fill:"white"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"9.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"14.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("line",{x1:"9",y1:"11",x2:"15",y2:"11",stroke:"#4F46E5",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("rect",{x:"7",y:"14",width:"10",height:"6",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"4",y:"15",width:"2",height:"4",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"18",y:"15",width:"2",height:"4",rx:"1",fill:"white"})]})]})}),s&&(0,e.jsxs)("div",{style:{position:"fixed",bottom:"20px",right:"20px",width:"min(400px, 90vw)",height:"min(600px, 85vh)",backgroundColor:"#fff",boxShadow:"0 12px 40px rgba(79, 70, 229, 0.25)",borderRadius:"16px",display:"flex",flexDirection:"column",zIndex:1e4,overflow:"hidden",border:"1px solid #e5e7eb",animation:"fadeIn 0.2s ease-out"},children:[(0,e.jsxs)("div",{style:{backgroundColor:"#4f46e5",padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,e.jsx)("div",{style:{width:"8px",height:"8px",backgroundColor:"#22c55e",borderRadius:"50%",boxShadow:"0 0 8px #22c55e"}}),(0,e.jsx)("span",{style:{fontWeight:600,fontSize:"15px"},children:i})]}),(0,e.jsx)("span",{style:{cursor:"pointer",fontSize:"18px",opacity:.8},onClick:()=>l(!1),children:"\u2715"})]}),(0,e.jsxs)("div",{ref:f,style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#f9fafb"},children:[u.map((r,c)=>(0,e.jsx)("div",{style:{alignSelf:r.role==="user"?"flex-end":"flex-start",maxWidth:"85%",display:"flex",flexDirection:"column",gap:"4px"},children:(0,e.jsxs)("div",{style:{backgroundColor:r.role==="user"?"#4f46e5":"#fff",color:r.role==="user"?"#fff":"#374151",padding:"12px 16px",borderRadius:"12px",fontSize:"14px",border:r.role==="user"?"none":"1px solid #e5e7eb",boxShadow:r.role==="user"?"0 2px 4px rgba(79,70,229,0.2)":"0 1px 2px rgba(0,0,0,0.05)"},children:[r.image&&(0,e.jsx)("div",{style:{marginBottom:"10px"},children:(0,e.jsx)("img",{src:r.image,onClick:()=>S(r.image),style:{width:"100%",borderRadius:"8px",cursor:"zoom-in"},alt:"Reference"})}),r.role==="assistant"?(0,e.jsxs)("div",{className:"markdown-container",children:[(0,e.jsx)(T.default,{components:{p:({children:t})=>(0,e.jsx)("p",{style:{marginBottom:"12px",lineHeight:"1.6"},children:t}),ul:({children:t})=>(0,e.jsx)("ul",{style:{listStyleType:"disc",marginLeft:"20px",marginBottom:"12px"},children:t}),ol:({children:t})=>(0,e.jsx)("ol",{style:{listStyleType:"decimal",marginLeft:"20px",marginBottom:"12px"},children:t}),li:({children:t})=>(0,e.jsx)("li",{style:{marginBottom:"4px"},children:t}),h1:({children:t})=>(0,e.jsx)("h1",{style:{fontSize:"1.25rem",fontWeight:"bold",margin:"16px 0 8px"},children:t}),h2:({children:t})=>(0,e.jsx)("h2",{style:{fontSize:"1.1rem",fontWeight:"bold",margin:"14px 0 7px"},children:t}),h3:({children:t})=>(0,e.jsx)("h3",{style:{fontSize:"1rem",fontWeight:"bold",margin:"12px 0 6px"},children:t}),code:({node:t,inline:m,className:U,children:z,...E})=>m?(0,e.jsx)("code",{style:{backgroundColor:"#f3f4f6",padding:"2px 5px",borderRadius:"4px",fontSize:"13px",color:"#e03e2d",fontFamily:"monospace"},...E,children:z}):(0,e.jsx)("div",{style:{backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",margin:"12px 0",overflowX:"auto"},children:(0,e.jsx)("code",{style:{fontSize:"13px",color:"#1e293b",fontFamily:"monospace",whiteSpace:"pre"},...E,children:z})}),blockquote:({children:t})=>(0,e.jsx)("blockquote",{style:{borderLeft:"4px solid #4f46e5",paddingLeft:"12px",color:"#4b5563",fontStyle:"italic",margin:"12px 0"},children:t}),table:({children:t})=>(0,e.jsx)("div",{style:{overflowX:"auto",margin:"12px 0"},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:t})}),th:({children:t})=>(0,e.jsx)("th",{style:{border:"1px solid #e5e7eb",padding:"8px",backgroundColor:"#f9fafb",textAlign:"left"},children:t}),td:({children:t})=>(0,e.jsx)("td",{style:{border:"1px solid #e5e7eb",padding:"8px"},children:t})},children:r.content}),r.route&&(0,e.jsx)("div",{style:{marginTop:"12px",borderTop:"1px solid #f3f4f6",paddingTop:"10px"},children:(0,e.jsxs)("button",{onClick:()=>{window.location.href=r.route},style:{display:"inline-flex",alignItems:"center",gap:"6px",backgroundColor:"#4f46e5",color:"white",padding:"8px 14px",borderRadius:"8px",fontSize:"13px",fontWeight:500,border:"none",cursor:"pointer",transition:"background 0.2s"},onMouseOver:t=>t.currentTarget.style.backgroundColor="#4338ca",onMouseOut:t=>t.currentTarget.style.backgroundColor="#4f46e5",children:["Explore Page",(0,e.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("line",{x1:"7",y1:"17",x2:"17",y2:"7"}),(0,e.jsx)("polyline",{points:"7 7 17 7 17 17"})]})]})})]}):(0,e.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:r.content})]})},c)),(0,e.jsx)("div",{ref:f}),p&&(0,e.jsxs)("div",{style:{fontSize:"12px",color:"#6b7280",marginLeft:"4px"},children:[i," is thinking..."]})]}),(0,e.jsxs)("div",{style:{padding:"16px",borderTop:"1px solid #e5e7eb",backgroundColor:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:"#f3f4f6",padding:"6px 14px",borderRadius:"28px"},children:[(0,e.jsxs)("button",{style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex"},onClick:()=>I.current?.click(),children:[(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,e.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,e.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,e.jsx)("input",{type:"file",accept:"image/*",ref:I,style:{display:"none"},onChange:r=>{let c=r.target.files?.[0];c&&(k(c),x.toast.success(`Attached: ${c.name}`))}})]}),y&&(0,e.jsxs)("div",{style:{fontSize:"11px",color:"#4f46e5",maxWidth:"80px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["\u{1F4CE} ",y.name]}),(0,e.jsx)("input",{type:"text",value:o,onChange:r=>d(r.target.value),onKeyDown:r=>r.key==="Enter"&&R(),placeholder:"Type a message...",style:{flex:1,border:"none",background:"none",padding:"10px 0",outline:"none",fontSize:"14px",color:"#1f2937"}}),(0,e.jsx)("button",{onClick:R,disabled:!o.trim()||p,style:{background:o.trim()&&!p?"#4f46e5":"transparent",border:"none",borderRadius:"50%",width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",cursor:o.trim()&&!p?"pointer":"default",transition:"all 0.2s"},children:(0,e.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:o.trim()&&!p?"#fff":"#9ca3af",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,e.jsx)("polyline",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(0,e.jsxs)("div",{style:{textAlign:"center",fontSize:"11px",color:"#9ca3af",marginTop:"10px"},children:["Powered by ",(0,e.jsx)("strong",{children:"DoclessAI"})]})]})]})]})}var D=()=>{let n=document.currentScript?.getAttribute("data-app-key")||"";if(!n)return;let s=document.createElement("div");s.id="docless-ai-root",document.body.appendChild(s),W.default.createRoot(s).render(M.default.createElement(b,{appKey:n}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",D):D();
27
+
28
+ @keyframes pulseHighlight {
29
+ 0% { box-shadow: 0 0 0 0 rgba(99,102,241,0.6); }
30
+ 70% { box-shadow: 0 0 0 12px rgba(99,102,241,0); }
31
+ 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0); }
32
+ }
33
+
34
+ .docless-highlight {
35
+ animation: pulseHighlight 1.5s ease-out 2;
36
+ outline: 3px solid #6366f1;
37
+ border-radius: 8px;
38
+ }
39
+ `}),C&&(0,e.jsxs)("div",{onClick:()=>S(null),style:{position:"fixed",inset:0,backgroundColor:"rgba(0,0,0,0.8)",backdropFilter:"blur(5px)",zIndex:2e4,display:"flex",alignItems:"center",justifyContent:"center",cursor:"zoom-out",padding:"20px"},children:[(0,e.jsx)("button",{style:{position:"absolute",top:"20px",right:"20px",background:"#fff",border:"none",borderRadius:"50%",width:"40px",height:"40px",cursor:"pointer",fontSize:"20px"},children:"\u2715"}),(0,e.jsx)("img",{src:C,style:{maxWidth:"100%",maxHeight:"90vh",borderRadius:"8px",boxShadow:"0 0 30px rgba(0,0,0,0.5)"},alt:"Zoomed reference"})]}),!s&&(0,e.jsx)("svg",{width:"60",height:"60",viewBox:"0 0 60 60",fill:"none",style:{cursor:"pointer",position:"fixed",bottom:"20px",right:"20px",zIndex:9999,filter:"drop-shadow(0px 4px 12px rgba(0, 0, 0, 0.15))"},onClick:()=>l(!0),children:(0,e.jsxs)("g",{className:"chat-bubble",children:[(0,e.jsx)("ellipse",{cx:"30",cy:"52",rx:"15",ry:"3",fill:"#000",opacity:"0.1"}),(0,e.jsx)("path",{d:"M45 15C45 8.37258 39.6274 3 33 3H15C8.37258 3 3 8.37258 3 15V33C3 39.6274 8.37258 45 15 45H18V52L26 45H33C39.6274 45 45 39.6274 45 33V15Z",fill:"#4F46E5"}),(0,e.jsxs)("g",{transform:"translate(12, 14)",children:[(0,e.jsx)("line",{x1:"12",y1:"0",x2:"12",y2:"3",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12",cy:"0",r:"1.5",fill:"white"}),(0,e.jsx)("rect",{x:"6",y:"3",width:"12",height:"10",rx:"2",fill:"white"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"9.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("circle",{className:"robot-eye",cx:"14.5",cy:"8",r:"1.5",fill:"#4F46E5"}),(0,e.jsx)("line",{x1:"9",y1:"11",x2:"15",y2:"11",stroke:"#4F46E5",strokeWidth:"1",strokeLinecap:"round"}),(0,e.jsx)("rect",{x:"7",y:"14",width:"10",height:"6",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"4",y:"15",width:"2",height:"4",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"18",y:"15",width:"2",height:"4",rx:"1",fill:"white"})]})]})}),s&&(0,e.jsxs)("div",{style:{position:"fixed",bottom:"20px",right:"20px",width:"min(400px, 90vw)",height:"min(600px, 85vh)",backgroundColor:"#fff",boxShadow:"0 12px 40px rgba(79, 70, 229, 0.25)",borderRadius:"16px",display:"flex",flexDirection:"column",zIndex:1e4,overflow:"hidden",border:"1px solid #e5e7eb",animation:"fadeIn 0.2s ease-out"},children:[(0,e.jsxs)("div",{style:{backgroundColor:"#4f46e5",padding:"14px 18px",display:"flex",alignItems:"center",justifyContent:"space-between",color:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px"},children:[(0,e.jsx)("div",{style:{width:"8px",height:"8px",backgroundColor:"#22c55e",borderRadius:"50%",boxShadow:"0 0 8px #22c55e"}}),(0,e.jsx)("span",{style:{fontWeight:600,fontSize:"15px"},children:n})]}),(0,e.jsx)("span",{style:{cursor:"pointer",fontSize:"18px",opacity:.8},onClick:()=>l(!1),children:"\u2715"})]}),(0,e.jsxs)("div",{ref:f,style:{flex:1,overflowY:"auto",padding:"16px",display:"flex",flexDirection:"column",gap:"12px",backgroundColor:"#f9fafb"},children:[g.map((o,c)=>(0,e.jsx)("div",{style:{alignSelf:o.role==="user"?"flex-end":"flex-start",maxWidth:"85%",display:"flex",flexDirection:"column",gap:"4px"},children:(0,e.jsxs)("div",{style:{backgroundColor:o.role==="user"?"#4f46e5":"#fff",color:o.role==="user"?"#fff":"#374151",padding:"12px 16px",borderRadius:"12px",fontSize:"14px",border:o.role==="user"?"none":"1px solid #e5e7eb",boxShadow:o.role==="user"?"0 2px 4px rgba(79,70,229,0.2)":"0 1px 2px rgba(0,0,0,0.05)"},children:[o.image&&(0,e.jsx)("div",{style:{marginBottom:"10px"},children:(0,e.jsx)("img",{src:o.image,onClick:()=>S(o.image),style:{width:"100%",borderRadius:"8px",cursor:"zoom-in"},alt:"Reference"})}),o.role==="assistant"?(0,e.jsxs)("div",{className:"markdown-container",children:[(0,e.jsx)(T.default,{components:{p:({children:t})=>(0,e.jsx)("p",{style:{marginBottom:"12px",lineHeight:"1.6"},children:t}),ul:({children:t})=>(0,e.jsx)("ul",{style:{listStyleType:"disc",marginLeft:"20px",marginBottom:"12px"},children:t}),ol:({children:t})=>(0,e.jsx)("ol",{style:{listStyleType:"decimal",marginLeft:"20px",marginBottom:"12px"},children:t}),li:({children:t})=>(0,e.jsx)("li",{style:{marginBottom:"4px"},children:t}),h1:({children:t})=>(0,e.jsx)("h1",{style:{fontSize:"1.25rem",fontWeight:"bold",margin:"16px 0 8px"},children:t}),h2:({children:t})=>(0,e.jsx)("h2",{style:{fontSize:"1.1rem",fontWeight:"bold",margin:"14px 0 7px"},children:t}),h3:({children:t})=>(0,e.jsx)("h3",{style:{fontSize:"1rem",fontWeight:"bold",margin:"12px 0 6px"},children:t}),code:({node:t,inline:y,className:P,children:z,...E})=>y?(0,e.jsx)("code",{style:{backgroundColor:"#f3f4f6",padding:"2px 5px",borderRadius:"4px",fontSize:"13px",color:"#e03e2d",fontFamily:"monospace"},...E,children:z}):(0,e.jsx)("div",{style:{backgroundColor:"#f8fafc",border:"1px solid #e2e8f0",borderRadius:"8px",padding:"12px",margin:"12px 0",overflowX:"auto"},children:(0,e.jsx)("code",{style:{fontSize:"13px",color:"#1e293b",fontFamily:"monospace",whiteSpace:"pre"},...E,children:z})}),blockquote:({children:t})=>(0,e.jsx)("blockquote",{style:{borderLeft:"4px solid #4f46e5",paddingLeft:"12px",color:"#4b5563",fontStyle:"italic",margin:"12px 0"},children:t}),table:({children:t})=>(0,e.jsx)("div",{style:{overflowX:"auto",margin:"12px 0"},children:(0,e.jsx)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:t})}),th:({children:t})=>(0,e.jsx)("th",{style:{border:"1px solid #e5e7eb",padding:"8px",backgroundColor:"#f9fafb",textAlign:"left"},children:t}),td:({children:t})=>(0,e.jsx)("td",{style:{border:"1px solid #e5e7eb",padding:"8px"},children:t})},children:o.content}),(o.route||o.elementId)&&(0,e.jsxs)("div",{style:{marginTop:"12px",borderTop:"1px solid #f3f4f6",paddingTop:"10px",display:"flex",gap:"8px",flexWrap:"wrap"},children:[o.route&&(0,e.jsx)("button",{onClick:()=>window.location.href=o.route,style:M,children:"Explore Page"}),o.elementId&&(0,e.jsx)("button",{onClick:()=>V(o.route,o.elementId),style:B,children:"View"})]})]}):(0,e.jsx)("div",{style:{whiteSpace:"pre-wrap"},children:o.content})]})},c)),(0,e.jsx)("div",{ref:f}),p&&(0,e.jsxs)("div",{style:{fontSize:"12px",color:"#6b7280",marginLeft:"4px"},children:[n," is thinking..."]})]}),(0,e.jsxs)("div",{style:{padding:"16px",borderTop:"1px solid #e5e7eb",backgroundColor:"#fff"},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"10px",backgroundColor:"#f3f4f6",padding:"6px 14px",borderRadius:"28px"},children:[(0,e.jsxs)("button",{style:{background:"none",border:"none",cursor:"pointer",padding:"4px",display:"flex"},onClick:()=>I.current?.click(),children:[(0,e.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#9ca3af",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,e.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,e.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,e.jsx)("input",{type:"file",accept:"image/*",ref:I,style:{display:"none"},onChange:o=>{let c=o.target.files?.[0];c&&(k(c),x.toast.success(`Attached: ${c.name}`))}})]}),h&&(0,e.jsxs)("div",{style:{fontSize:"11px",color:"#4f46e5",maxWidth:"80px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:["\u{1F4CE} ",h.name]}),(0,e.jsx)("input",{type:"text",value:i,onChange:o=>d(o.target.value),onKeyDown:o=>o.key==="Enter"&&R(),placeholder:"Type a message...",style:{flex:1,border:"none",background:"none",padding:"10px 0",outline:"none",fontSize:"14px",color:"#1f2937"}}),(0,e.jsx)("button",{onClick:R,disabled:!i.trim()||p,style:{background:i.trim()&&!p?"#4f46e5":"transparent",border:"none",borderRadius:"50%",width:"34px",height:"34px",display:"flex",alignItems:"center",justifyContent:"center",cursor:i.trim()&&!p?"pointer":"default",transition:"all 0.2s"},children:(0,e.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:i.trim()&&!p?"#fff":"#9ca3af",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),(0,e.jsx)("polyline",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(0,e.jsxs)("div",{style:{textAlign:"center",fontSize:"11px",color:"#9ca3af",marginTop:"10px"},children:["Powered by ",(0,e.jsx)("strong",{children:"DoclessAI"})]})]})]})]})}var D=()=>{let n=document.querySelectorAll("script[data-app-key]"),r=n[n.length-1],s=r?.getAttribute("data-app-key")||"",l=r?.getAttribute("data-name")||"Assistant";if(!s)return;let i=document.createElement("div");i.id="docless-ai-root",document.body.appendChild(i),F.default.createRoot(i).render(W.default.createElement(b,{appKey:s,name:l}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",D):D();
package/dist/loader.js CHANGED
@@ -1 +1 @@
1
- import{b as o}from"./chunk-QBXANVZR.js";import n from"react";import d from"react-dom/client";var r=()=>{let e=document.currentScript?.getAttribute("data-app-key")||"";if(!e)return;let t=document.createElement("div");t.id="docless-ai-root",document.body.appendChild(t),d.createRoot(t).render(n.createElement(o,{appKey:e}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();
1
+ import{b as a}from"./chunk-IRSYXS5O.js";import c from"react";import i from"react-dom/client";var r=()=>{let e=document.querySelectorAll("script[data-app-key]"),o=e[e.length-1],n=o?.getAttribute("data-app-key")||"",d=o?.getAttribute("data-name")||"Assistant";if(!n)return;let t=document.createElement("div");t.id="docless-ai-root",document.body.appendChild(t),i.createRoot(t).render(c.createElement(a,{appKey:n,name:d}))};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r):r();