1import{r as i,j as e,H as _e,L as E,b as q}from"./app-DP13319Q.js";import{M as ee}from"./index-WruS1vxz.js";import{l as Wa}from"./react-stripe.esm-D6Ettci4.js";import{F as c,H as R,I as sa,a as pe,f as ve,J as ae,K as ia,L as be,k as we,M as ca,N as la,h as da,O as oa,B as ma,C as xa,x as ha,q as ye,d as Da,P as Ha}from"./index-CtyZ6W6U.js";import{M as Va}from"./react-tooltip.min-DW3XhwOj.js";import{M as Oa}from"./react-masonry-css.module-Bp4sH3TF.js";import{E as Ya}from"./EnhancedMDEditor-BhznaPPH.js";/* empty css *//* empty css */import"./markdown-editor-DgLOEOaX.js";const Ka={default:3,1024:2,640:1};Wa("pk_live_51IyCo8Dpr0bpQPac24tix9UpShzoMw1uWsW3JvzcMrKVFnvUsXAnvBknJSPYucZCYSLT4Z0UVBeKx49jlYakdjIw00coa3YVdn");const ua=m=>{if(typeof document>"u")return m;const v=document.createElement("div");return v.innerHTML=m,v.textContent||v.innerText||""},je=m=>{if(m===0)return"0 Bytes";const v=1024,Ne=["Bytes","KB","MB","GB"],te=Math.floor(Math.log(m)/Math.log(v));return parseFloat((m/Math.pow(v,te)).toFixed(2))+" "+Ne[te]},Xa=["image/jpeg","image/jpg","image/png","image/gif","image/webp","image/bmp","image/svg+xml","application/pdf","video/mp4","video/webm","video/ogg","video/quicktime","video/x-msvideo","audio/mpeg","audio/mp3","audio/wav","audio/ogg","audio/webm","audio/x-wav"],Ga=[".jpg",".jpeg",".png",".gif",".webp",".bmp",".svg",".pdf",".mp4",".webm",".ogg",".mov",".avi",".mp3",".wav",".ogg",".m4a"];function pt({search:m,conversation_messages:v,message_count:Ne,share_url:te,related_searches:ke,domains:Ja=[],checkDomainUrl:Qa="/check-handle-availability",checkStandardDomainUrl:Za="/ezai/check-ezpressstandard-domain",tooltips:a={},tokenInfo:et,promoprice:at=0,aiSettings:w,auth:ne={user:null},guestInteractionDisabled:$=!1,requiresLogin:C=!1}){const[Ce,Se]=i.useState(!1),[tt,nt]=i.useState(!1),[u,re]=i.useState(""),[W,Ae]=i.useState(!1),[se,ga]=i.useState(!1),[x,Y]=i.useState([]),[ie,rt]=i.useState(m.conversation_title),[ce,fa]=i.useState(m.conversation_cost),[le,_a]=i.useState(m.conversation_tokens),[K,Ee]=i.useState(!1),[Fe,Me]=i.useState(null),[st,Ie]=i.useState(null),[it,de]=i.useState(""),[oe,P]=i.useState(""),[D,L]=i.useState(!1),[pa,z]=i.useState(!0),[va,me]=i.useState(""),[_,ba]=i.useState("public"),[F,wa]=i.useState(!1),[ya,Te]=i.useState(null),[$e,Pe]=i.useState(!1),[xe,ja]=i.useState(!1),[he,X]=i.useState(""),[B,H]=i.useState("text"),[I,G]=i.useState(""),[Le,ze]=i.useState(!1),[b,ue]=i.useState(null),[Be,Ue]=i.useState(!1),[qe,j]=i.useState(null),[Re,ge]=i.useState(""),[We,ct]=i.useState(""),[V,De]=i.useState(""),[Na,O]=i.useState(!1),He=i.useRef(null),ka=i.useRef(null),Ca=i.useRef(null),fe=i.useRef(null),Ve=i.useRef(null),f=(ne==null?void 0:ne.user)||null,l=i.useMemo(()=>w?f?w.user_ai_enabled?w.user_char_limit:0:w.guest_ai_enabled?w.guest_char_limit:0:f?2e3:300,[f,w]),Oe=i.useMemo(()=>w?f?!w.user_ai_enabled:!w.guest_ai_enabled:!1,[f,w]);i.useEffect(()=>{(async()=>{var d;z(!0);const n=v.find(o=>!o.parent_id)||v[0],r=(n==null?void 0:n.status)||m.status||"public";ba(r),console.log("Conversation status:",r),console.log("Current user:",f),console.log("Guest interaction disabled:",$),console.log("Requires login:",C);let s=!1;if(f&&(s=v.some(o=>o.user_id===f.id)||((d=m.user)==null?void 0:d.id)===f.id),wa(s),r==="public"){if(!f&&$){L(!1),me((a==null?void 0:a.ai_search_view_guest_disabled)||"The owner of this conversation has disabled guest interaction. Please log in to continue."),z(!1);return}L(!0),z(!1);return}if(r==="hidden"){L(!1),me((a==null?void 0:a.ai_search_view_hidden_conversation)||"This conversation has been hidden and is not available for viewing."),z(!1);return}if(r==="private"){s?L(!0):(L(!1),me((a==null?void 0:a.ai_search_view_private_conversation)||"This is a private conversation. You do not have permission to view it."),f||O(!0)),z(!1);return}L(!0),z(!1)})()},[m,v,f,a,$,C]),i.useEffect(()=>{let t=v;F||(t=v.filter(n=>n.status!=="hidden")),Y(t)},[v,F]),i.useEffect(()=>{const t=v.filter(n=>n.content_type==="upload");t.length>0&&(console.log("Upload messages found:",t.length),t.forEach((n,r)=>{console.log(`Upload message ${r+1}:`,{id:n.id,slug:n.slug,query:n.query,file_data:n.file_data,file_data_type:typeof n.file_data,file_data_keys:n.file_data?Object.keys(n.file_data):null})}))},[v]),i.useEffect(()=>{J()},[x]),i.useEffect(()=>{xe&&fe.current&&fe.current.focus()},[xe]),i.useEffect(()=>{l===0?(de((a==null?void 0:a.ai_search_view_disabled)||"Ask AI is currently disabled"),P((a==null?void 0:a.ai_search_view_disabled)||"Ask AI is disabled. Please try again later.")):u.length>l?(de(`Character limit exceeded (${u.length}/${l})`),P(((a==null?void 0:a.ai_search_view_question_too_long)||"Maximum {max} characters allowed. You have {count} too many.").replace("{max}",l.toString()).replace("{count}",(u.length-l).toString()))):(de(""),P(""))},[u,l,a]);const[N,Ye]=i.useState(null),k=i.useRef(null),U=i.useRef(null),S=useCallback(()=>{k.current!==null&&(cancelAnimationFrame(k.current),k.current=null),U.current=null,Ye(null)},[]),Ke=useCallback(t=>{if(N===t){S();return}k.current!==null&&(cancelAnimationFrame(k.current),k.current=null),U.current=null,Ye(t);const n=240,r=s=>{U.current===null&&(U.current=s);const d=Math.min(s-U.current,50);U.current=s;const o=n*d/1e3,h=window.scrollY||document.documentElement.scrollTop,g=Math.max(0,document.documentElement.scrollHeight-window.innerHeight);if(t==="up"){if(h<=0){S();return}const y=Math.max(0,h-o);if(window.scrollTo(0,y),y<=0){S();return}}else{if(h>=g-1){S();return}const y=Math.min(g,h+o);if(window.scrollTo(0,y),y>=g-1){S();return}}k.current=requestAnimationFrame(r)};k.current=requestAnimationFrame(r)},[N,S]);i.useEffect(()=>{if(!N)return;const t=()=>{S()};return window.addEventListener("wheel",t,{passive:!0}),window.addEventListener("touchmove",t,{passive:!0}),window.addEventListener("keydown",t,{passive:!0}),()=>{window.removeEventListener("wheel",t),window.removeEventListener("touchmove",t),window.removeEventListener("keydown",t)}},[N,S]),i.useEffect(()=>()=>{k.current!==null&&cancelAnimationFrame(k.current)},[]);const J=()=>{var t;S(),(t=He.current)==null||t.scrollIntoView({behavior:"smooth"})},Xe=t=>{const n=document.getElementById(`message-${t}`);
1n&&(n.scrollIntoView({behavior:"smooth",block:"center"}),n.classList.add("bg-yellow-50","transition-colors","duration-1000"),setTimeout(()=>{n.classList.remove("bg-yellow-50")},2e3))},Q={backgroundColor:"transparent",color:"#1f2937",fontFamily:'Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',fontSize:"16px",lineHeight:"1.7",wordBreak:"break-word",overflowWrap:"break-word","& h1, & h2, & h3, & h4, & h5, & h6":{borderBottom:"none",marginTop:"1.5rem",marginBottom:"0.75rem",fontWeight:600,color:"#111827",wordBreak:"break-word"},"& h1":{fontSize:"1.75rem"},"& h2":{fontSize:"1.5rem"},"& h3":{fontSize:"1.25rem"},"& h4":{fontSize:"1.125rem"},"& p":{marginBottom:"1rem",wordBreak:"break-word"},"& a":{color:"#22c55e",textDecoration:"underline",wordBreak:"break-word"},"& code":{backgroundColor:"#f3f4f6",color:"#dc2626",padding:"0.2em 0.4em",borderRadius:"0.25rem",fontSize:"0.875em",wordBreak:"break-word"},"& pre":{backgroundColor:"#f3f4f6",borderRadius:"0.5rem",padding:"1rem",overflow:"auto",wordBreak:"break-word"},"& blockquote":{borderLeft:"4px solid #e5e7eb",paddingLeft:"1.5rem",color:"#6b7280",fontStyle:"italic",margin:"1.5rem 0",wordBreak:"break-word"},"& ul, & ol":{paddingLeft:"1.5rem",marginBottom:"1rem",wordBreak:"break-word"},"& li":{marginBottom:"0.5rem",wordBreak:"break-word"},"& table":{borderCollapse:"collapse",width:"100%",marginBottom:"1.5rem",wordBreak:"break-word"},"& th, & td":{border:"1px solid #e5e7eb",padding:"0.75rem",wordBreak:"break-word"},"& th":{backgroundColor:"#f9fafb",fontWeight:600}},Sa=()=>{navigator.clipboard.writeText(window.location.href),Se(!0),setTimeout(()=>{Se(!1)},2e3)},Ge=(t,n)=>{navigator.clipboard.writeText(n),Te(t),setTimeout(()=>{Te(null)},2e3)},Aa=()=>{const t=x.filter(n=>n.message_role!=="system").map(n=>{var y;const r=n.message_role==="user",s=r?"User":"AI Assistant",d=r?n.query:n.response,o=A(n.created_at);let h="";n.content_type==="upload"?h="[File Upload] ":n.content_type==="comment"&&(h="[Comment] ");const g=(y=n.file_metadata)!=null&&y.web_search?"[Web Search Enabled] ":"";return`${s} (${o})${h?" - "+h:""}${g}: 2${d} 3`}).join(` 4--- 5 6`);navigator.clipboard.writeText(t),Pe(!0),setTimeout(()=>{Pe(!1)},2e3)},Ea=t=>{const n=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return t?n.test(t)?"":"Please enter a valid email address":(a==null?void 0:a.ai_search_view_email_required)||"Email is required"},Z=()=>{ja(!1),De(""),X("")},Fa=async t=>{var r,s,d,o,h;t.preventDefault();const n=Ea(V);if(n){X(n);return}Ee(!0),X("");try{const g=await q.post("/theme/create",{slug:m.slug,url:window.location.href,title:ie,email:V},{headers:{"X-CSRF-TOKEN":((r=document.querySelector('meta[name="csrf-token"]'))==null?void 0:r.getAttribute("content"))||"",Accept:"application/json","Content-Type":"application/json"}});if(g.data.success){Z(),Ie(g.data.theme);const y=e.jsxs("span",{className:"flex items-center gap-4",children:["Theme saved successfully!"," ",e.jsxs("span",{className:"inline-flex items-center gap-2 bg-gray-900/70 border border-gray-700 rounded-xl px-3 py-2 hover:shadow-lg hover:border-yellow-400/50 transition-all",children:[e.jsx("span",{className:"text-white text-md font-medium",children:((s=g.data.theme)==null?void 0:s.title)||"Untitled Theme"}),e.jsxs("span",{className:"text-md text-gray-400",children:["ID: ",((d=g.data.theme)==null?void 0:d.unique_id)||"N/A"]}),e.jsxs("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-md font-medium bg-yellow-400/20 text-yellow-300",children:["EZ$ ",((o=g.data.theme)==null?void 0:o.price)||"0"]}),e.jsx("a",{href:`https://ez.wiki/${((h=g.data.theme)==null?void 0:h.unique_id)||"#"}`,target:"_blank",rel:"noopener noreferrer",className:"px-2 py-0.5 text-md bg-blue-600 text-white rounded-md hover:bg-blue-500 transition-colors",children:"Preview"})]})]});Me(y)}else alert(g.data.message||"Failed to save theme")}catch(g){console.error("Error saving theme:",g),q.isAxiosError(g)&&g.response?alert(g.response.data.message||"An error occurred while saving the theme"):alert("An error occurred. Please try again.")}finally{Ee(!1)}},Je=t=>{if(!Xa.includes(t.type))return{valid:!1,error:(a==null?void 0:a.ai_search_view_file_types)||"File type not allowed. Only images, PDF, video, and audio files are permitted."};const n=t.name.toLowerCase();return Ga.some(s=>n.endsWith(s))?{valid:!0}:{valid:!1,error:(a==null?void 0:a.ai_search_view_file_types)||"File extension not allowed. Only images, PDF, video, and audio files are permitted."}},Ma=async()=>{var r;if(!(b!=null&&b.file))return;j(null);const t=Je(b.file);if(!t.valid){j(t.error||"Invalid file type");return}Ue(!0);const n=new FormData;n.append("file",b.file),n.append("description",I),n.append("conversation_id",m.conversation_id),n.append("parent_slug",m.slug);try{const s=await q.post("/content/upload",n,{headers:{"Content-Type":"multipart/form-data","X-CSRF-TOKEN":((r=document.querySelector('meta[name="csrf-token"]'))==null?void 0:r.getAttribute("content"))||""}});if(s.data.success){if(s.data.conversation_messages){let d=s.data.conversation_messages;
6F||(d=d.filter(o=>o.status!=="hidden")),Y(d)}ue(null),G(""),H("text"),j(null),setTimeout(()=>{J()},100),s.data.slug&&window.history.replaceState({slug:s.data.slug},"",`/X/${encodeURIComponent(s.data.slug)}`)}else alert(s.data.message||"Failed to upload file")}catch(s){if(console.error("Upload error:",s),q.isAxiosError(s)&&s.response){const d=s.response.data.message||"Failed to upload file";j(d),alert(d)}else{const d="Failed to upload file. Please try again.";j(d),alert(d)}}finally{Ue(!1)}},Ia=t=>{var d;const n=(d=t.target.files)==null?void 0:d[0];if(!n)return;if(j(null),n.size>100*1024*1024){const o="File size must be less than 100MB";j(o),alert(o);return}const r=Je(n);if(!r.valid){j(r.error||"Invalid file type"),alert(r.error);return}const s=new FileReader;s.onload=o=>{var h;ue({name:n.name,size:n.size,type:n.type,data:(h=o.target)==null?void 0:h.result,file:n})},s.onerror=()=>{const o="Error reading file";j(o),alert(o)},s.readAsDataURL(n)},Ta=async()=>{var t;if(I.trim()){ze(!0);try{const n=await q.post("/content/comment",{content:I,conversation_id:m.conversation_id,parent_slug:m.slug},{headers:{"X-CSRF-TOKEN":((t=document.querySelector('meta[name="csrf-token"]'))==null?void 0:t.getAttribute("content"))||""}});if(n.data.success){if(n.data.conversation_messages){let r=n.data.conversation_messages;F||(r=r.filter(s=>s.status!=="hidden")),Y(r)}G(""),H("text"),setTimeout(()=>{J()},100),n.data.slug&&window.history.replaceState({slug:n.data.slug},"",`/X/${encodeURIComponent(n.data.slug)}`)}else alert(n.data.message||"Failed to post comment")}catch(n){console.error("Comment error:",n),q.isAxiosError(n)&&n.response?alert(n.response.data.message||"Failed to post comment"):alert("Failed to post comment. Please try again.")}finally{ze(!1)}}},Qe=async t=>{var n;if(t&&t.preventDefault(),Oe){ge((a==null?void 0:a.ai_search_view_disabled)||"Ask AI is currently disabled. Please try again later.");return}if(!D){ge("You do not have permission to continue this conversation."),!f&&(_==="private"||$)&&O(!0);return}if(u.length>l){ge(((a==null?void 0:a.ai_search_view_question_too_long)||"Question exceeds maximum length of {max} characters. Please shorten your question.").replace("{max}",l.toString()));return}if(!(!u.trim()||W)){Ae(!0);try{const s=await(await fetch("/searchai/ai",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json","X-CSRF-TOKEN":((n=document.querySelector('meta[name="csrf-token"]'))==null?void 0:n.getAttribute("content"))||""},body:JSON.stringify({query:u,conversation_id:m.conversation_id,thread_id:m.thread_id,parent_slug:m.slug,enable_thinking:!1,web_search:se})})).json();if(s.success){if(s.conversation_messages&&Array.isArray(s.conversation_messages)){let d=s.conversation_messages;F||(d=d.filter(o=>o.status!=="hidden")),Y(d)}re(""),s.conversation_cost!==void 0&&fa(s.conversation_cost),s.conversation_tokens!==void 0&&_a(s.conversation_tokens),s.slug&&window.history.replaceState({slug:s.slug},"",`/X/${encodeURIComponent(s.slug)}`),setTimeout(()=>{J()},100)}else alert(s.message||"Failed to get response")}catch(r){console.error("Error asking question:",r),alert("An error occurred. Please try again.")}finally{Ae(!1)}}},$a=t=>{t.key==="Enter"&&!t.shiftKey?(t.preventDefault(),Qe()):t.key==="Escape"&&re("")},A=t=>{const n=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(n)},Ze=t=>(t/1e3*.01).toFixed(4),Pa=t=>{if(!t)return"";const n=t.split(".");if(n.length===4)return`${n[0]}.${n[1]}.${n[2]}.***`;{const r=t.lastIndexOf(":");if(r!==-1)return t.substring(0,r+1)+"***";const s=Math.floor(t.length/2);return t.substring(0,s)+"*".repeat(t.length-s)}},La=t=>{const n=t.mime_type.startsWith("image/"),r=t.mime_type.startsWith("video/"),s=t.mime_type.startsWith("audio/"),d=t.mime_type==="application/pdf";if(n)return e.jsxs("div",{className:"w-full",children:[e.jsx("div",{className:"rounded-lg overflow-hidden border border-gray-200/80 bg-gray-50 flex items-center justify-center relative group/img max-h-64 shadow-2xs",children:e.jsx("img",{src:t.url,alt:t.original_name,className:"max-h-64 w-full object-cover rounded-lg transition-transform duration-200 group-hover/img:scale-[1.02]",loading:"lazy"})}),e.jsxs("div",{className:"mt-2 flex items-center justify-between text-xs text-gray-500",children:[e.jsxs("span",{className:"truncate font-medium text-gray-700",title:t.original_name,children:["ð· ",t.original_name]}),e.jsx("span",{className:"text-gray-400 shrink-0 ml-2 text-[11px] font-mono",children:je(t.size)})]})]});const o=()=>n?` 7 8*${t.original_name}*`:r?`**Video:** ${t.original_name} 9 10<video src="${t.url}" controls style="max-width: 100%; border-radius: 0.5rem;"> 11 Your browser does not support the video tag. 12</video>`:s?`**Audio:** ${t.original_name} 13 14<audio src="${t.url}" controls style="width: 100%;"> 15 Your browser does not support the audio element. 16</audio>`:d?`**PDF Document:** ${t.original_name} 17 18<iframe src="${t.url}" style="width: 100%; height: 500px; border: none; border-radius: 0.5rem;" title="${t.original_name}"> 19 Your browser does not support PDFs. [Download PDF](${t.url}) 20</iframe>
20`:`**File:** [${t.original_name}](${t.url}) (${je(t.size)})`;return e.jsx("div",{className:"break-words",children:e.jsx(ee,{source:o(),style:{...Q,backgroundColor:"transparent",fontSize:"15px",color:"#1f2937"}})})},za=t=>e.jsx("div",{className:"break-words",children:e.jsx(ee,{source:t,style:{...Q,backgroundColor:"transparent",fontSize:"15px",color:"#1f2937"}})}),Ba=t=>{var n;return t.message_role==="user"?e.jsx("div",{className:"rounded-2xl px-4 py-3 bg-[#22c55e] text-white break-words",children:e.jsx(ee,{source:t.query,style:{...Q,backgroundColor:"transparent",fontSize:"15px",color:"white"}})}):e.jsxs("div",{className:"break-words",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[((n=t.file_metadata)==null?void 0:n.web_search)&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-700 text-xs rounded-full","data-tooltip-id":"main-tooltip","data-tooltip-content":"This response includes real-time web search results",children:[e.jsx(c,{icon:be,className:"w-3 h-3"}),"Web Search"]}),t.model&&e.jsxs("span",{className:"text-xs text-gray-400",children:["Model: ",t.model]})]}),e.jsx(ee,{source:t.response||"",style:{...Q,backgroundColor:"transparent",fontSize:"15px",color:"#1f2937"}})]})},ea=(t,n=!1)=>{var aa,ta,na,ra;if(t.status==="hidden"&&!F)return null;const r=t.message_role==="user",s=ya===t.id;let d="",o="";if(r)if(t.ip_address&&(o=Pa(t.ip_address)),t.user&&t.user.email){const p=t.user.email,[T,M]=p.split("@"),qa=T.substring(0,2)+"*".repeat(3),Ra="*".repeat(3)+M.substring(M.length-3);d=`${qa}@${Ra}`}else d="Guest";const h=t.status==="hidden"&&F,g=()=>{if(h)return e.jsx(c,{icon:R,className:"w-4 h-4 text-white"});if(t.content_type==="upload"){const p=t.file_data;return p?p.mime_type.startsWith("image/")?e.jsx(c,{icon:Da,className:"w-4 h-4 text-white"}):p.mime_type==="application/pdf"?e.jsx(c,{icon:ha,className:"w-4 h-4 text-white"}):p.mime_type.includes("video/")?e.jsx(c,{icon:ma,className:"w-4 h-4 text-white"}):p.mime_type.includes("audio/")?e.jsx(c,{icon:xa,className:"w-4 h-4 text-white"}):e.jsx(c,{icon:ye,className:"w-4 h-4 text-white"}):e.jsx(c,{icon:ye,className:"w-4 h-4 text-white"})}else return t.content_type==="comment"?e.jsx(c,{icon:la,className:"w-4 h-4 text-white"}):t.content_type==="embed"?e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"text-white",children:[e.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"3",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"3",y:"13",width:"8",height:"8",rx:"1.5"}),e.jsx("rect",{x:"13",y:"13",width:"8",height:"8",rx:"1.5"})]}):r?e.jsx(c,{icon:Ha,className:"w-4 h-4 text-white"}):e.jsx(c,{icon:ca,className:"w-4 h-4 text-white"})},y=()=>h?"bg-gray-400":t.content_type==="upload"?"bg-blue-500":t.content_type==="comment"?"bg-purple-500":t.content_type==="embed"?"bg-emerald-600":r?"bg-[#22c55e]":"bg-purple-500";return e.jsxs("div",{id:`message-${t.slug}`,className:`w-full scroll-mt-24 transition-all duration-200 group relative flex flex-col justify-between ${n?"bg-white rounded-xl border border-gray-200/90 shadow-2xs hover:shadow-md hover:border-gray-300 p-4 min-h-[220px] mb-6":"mb-6 max-w-full"}`,children:[h&&e.jsxs("div",{className:`${n?"mb-2 inline-flex self-start":"absolute -left-24 top-1/2 transform -translate-y-1/2"} bg-gray-800 text-white text-xs px-2.5 py-1 rounded-full flex items-center gap-1.5 shadow-sm`,children:[e.jsx(c,{icon:R,className:"w-3 h-3"}),e.jsx("span",{children:"Hidden"})]}),!n&&e.jsx("button",{onClick:()=>{var T,M;let p="";t.content_type==="upload"?p=`[File: ${(T=t.file_data)==null?void 0:T.original_name}] ${(M=t.file_data)==null?void 0:M.url}`:t.content_type==="comment"||t.content_type==="embed"?p=t.query:p=r?t.query:t.response||"",Ge(t.id,p)},className:"absolute -left-10 top-1/2 transform -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity duration-200 bg-white border border-gray-200 rounded-lg p-2 shadow-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-[#22c55e]","data-tooltip-id":"main-tooltip","data-tooltip-content":s?(a==null?void 0:a.ai_search_view_message_copied)||"Copied!":(a==null?void 0:a.ai_search_view_copy_message)||"Copy this message",children:s?e.jsx(c,{icon:ve,className:"text-green-500 w-4 h-4"}):e.jsx(c,{icon:ia,className:"text-gray-600 w-4 h-4"})}),e.jsxs("div",{className:`flex ${n?"flex-col flex-1 justify-between h-full":"gap-3"}`,children:[e.jsxs("div",{className:n?"flex items-start gap-3 mb-3":"contents",children:[e.jsx("div",{className:`flex-shrink-0 w-8 h-8 rounded-full flex items-center justify-center shadow-2xs ring-2 ring-white ${y()}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":h?(a==null?void 0:a.ai_search_view_hidden_conversation)||"Hidden message (only visible to you)":t.content_type==="upload"?(a==null?void 0:a.ai_search_view_upload_file)||"File upload":t.content_type==="comment"?(a==null?void 0:a.ai_search_view_add_comment)||"Comment":t.content_type==="embed"?"Embed Row / Masonry":r?(a==null?void 0:a.ai_search_view_user_message)||"User message":(a==null?void 0:a.ai_search_view_assistant_message)||"AI assistant response",children:g()}),n&&r&&e.jsxs("div",{className:"flex-1 min-w-0",children:[d&&e.jsxs("div",{className:"font-mono flex items-center gap-1.5 flex-wrap",title:((aa=t.user)==null?void 0:aa.email)||t.ip_address,"data-tooltip-id":"main-tooltip","data-tooltip-content":(ta=t.user)!=null&&ta.email?"Masked user email":"Guest user",children:[e.jsx("span",{className:"text-gray-400 text-[11px]",children:"User:"}),e.jsx("span",{className:"font-semibold text-gray-800 text-[12px] truncate max-w-[130px]",children:d}),t.content_type==="upload"&&e.jsx("span",{className:"text-blue-600 font-medium bg-blue-50 border border-blue-100 px-1.5 py-0.5 rounded text-[10px]",children:"(Upload)"}),t.content_type==="comment"&&e.jsx("span",{className:"text-purple-600 font-medium bg-purple-50 border border-purple-100 px-1.5 py-0.5 rounded text-[10px]",children:"(Comment)"}),t.content_type==="embed"&&e.jsx("span",{className:"text-emerald-600 font-semibold bg-emerald-50 border border-emerald-100 px-1.5 py-0.5 rounded text-[10px]",children:"(Embed)"})]}),o&&e.jsxs("div",{className:"font-mono text-gray-400 text-[11px]","data-tooltip-id":"main-tooltip","data-tooltip-content":`IP Address: ${t.ip_address}`,children:[e.jsx("span",{className:"text-gray-300",children:"IP:"})," ",o]})]})]}),e.jsxs("div",{className:`flex-1 min-w-0 ${n?"w-full flex flex-col justify-between":""}`,children:[!n&&r&&e.jsxs("div",{className:"text-xs text-gray-500 mb-1 space-y-0.5",children:[d&&e.jsxs("div",{className:"font-mono flex items-center gap-2 flex-wrap",title:((na=t.user)==null?void 0:na.email)||t.ip_address,"data-tooltip-id":"main-tooltip","data-tooltip-content":(ra=t.user)!=null&&ra.email?"Masked user email":"Guest user",children:[e.jsx("span",{className:"opacity-75",children:"User:"}),e.jsx("span",{className:"font-semibold",children:d}),t.content_type==="upload"&&e.jsx("span",{className:"ml-2 text-blue-500",children:"(Upload)"}),t.content_type==="comment"&&e.jsx("span",{className:"ml-2 text-purple-500",children:"(Comment)"}),t.content_type==="embed"&&e.jsx("span",{className:"ml-2 text-emerald-600 font-semibold",children:"(Embed)"})]}),o&&e.jsxs("div",{className:"font-mono text-gray-400","data-tooltip-id":"main-tooltip","data-tooltip-content":`IP Address: ${t.ip_address}`,children:[e.jsx("span",{className:"opacity-75",children:"IP:"})," ",o]})]}
20),e.jsx("div",{className:`flex-1 min-w-0 w-full ${n?"mb-3":""}`,children:h?e.jsx("div",{className:"rounded-2xl px-4 py-3 bg-gray-200 text-gray-500 italic break-words",children:"[This message has been hidden]"}):t.content_type==="upload"&&t.file_data?La(t.file_data):t.content_type==="comment"?za(t.query):t.content_type==="embed"?e.jsx("div",{className:"break-words w-full",children:e.jsx(HtmlDocPreview,{content:t.query,title:"Embed Row / Masonry Layout",filename:"embed.html"})}):Ba(t)}),e.jsx("div",{className:n?"mt-auto pt-3 border-t border-gray-100 w-full":"",children:e.jsxs("div",{className:`flex items-center justify-between text-xs text-gray-400 ${n?"mb-1":"mt-2"}`,children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-gray-500","data-tooltip-id":"main-tooltip","data-tooltip-content":((a==null?void 0:a.ai_search_view_message_sent)||"Message sent at {time}").replace("{time}",A(t.created_at)),children:A(t.created_at)}),t.content_type==="ai"&&!r&&t.total_tokens>0&&!h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-400",children:"â¢"}),e.jsxs("span",{className:"text-gray-500","data-tooltip-id":"main-tooltip","data-tooltip-content":((a==null?void 0:a.ai_search_view_tokens_used)||"{count} total tokens used (prompt + completion)").replace("{count}",t.total_tokens.toString()),children:[t.total_tokens," tokens"]}),e.jsx("span",{className:"text-gray-400",children:"â¢"}),e.jsxs("span",{className:"text-gray-500","data-tooltip-id":"main-tooltip","data-tooltip-content":((a==null?void 0:a.ai_search_view_estimated_cost)||"Estimated cost: ${cost}").replace("{cost}",Ze(t.total_tokens)),children:["$",Ze(t.total_tokens)]})]}),h&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-gray-400",children:"â¢"}),e.jsx("span",{className:"text-gray-500",children:"Hidden"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx(E,{href:`/X/${encodeURIComponent(t.slug)}`,className:"text-gray-400 hover:text-[#22c55e] transition-colors p-1 rounded focus:outline-none","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_permalink)||"View permanent link to this message",children:e.jsx(c,{icon:faExternalLink,className:"w-3.5 h-3.5"})}),e.jsx("button",{onClick:()=>{var T,M;let p="";t.content_type==="upload"?p=`[File: ${(T=t.file_data)==null?void 0:T.original_name}] ${(M=t.file_data)==null?void 0:M.url}`:t.content_type==="comment"?p=t.query:p=r?t.query:t.response||"",Ge(t.id,p)},className:`text-gray-400 hover:text-[#22c55e] transition-colors p-1 rounded focus:outline-none ${s?"text-green-500":""}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":s?(a==null?void 0:a.ai_search_view_message_copied)||"Copied!":(a==null?void 0:a.ai_search_view_copy_message)||"Copy this message",children:s?e.jsx(c,{icon:ve,className:"w-3.5 h-3.5"}):e.jsx(c,{icon:ia,className:"w-3.5 h-3.5"})})]})]})})]})]})]},t.id)},Ua=()=>!D||$&&!f?e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm p-8 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(c,{icon:ae,className:"text-2xl text-purple-600"})}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:C?(a==null?void 0:a.ai_search_view_login_required)||"Login Required":_==="private"?(a==null?void 0:a.ai_search_view_private_conversation)||"Private Conversation":(a==null?void 0:a.ai_search_view_guest_disabled)||"Guest Interaction Disabled"}),e.jsx("p",{className:"text-gray-600 mb-4",children:C?"The owner of this conversation has disabled guest interaction. Please log in to continue.":_==="private"?"This is a private conversation. Please log in to continue.":"The owner of this conversation has disabled guest interaction. Please log in to continue."}),e.jsxs("div",{className:"flex justify-center gap-3",children:[e.jsx(E,{href:"/login",className:"px-6 py-2 bg-[#22c55e] hover:bg-[#16a34a] text-white rounded-lg transition-colors font-medium","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_login)||"Log In",children:"Log In"}),e.jsx(E,{href:"/register",className:"px-6 py-2 border border-gray-300 hover:bg-gray-50 text-gray-700 rounded-lg transition-colors font-medium","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_create_account)||"Sign Up",children:"Sign Up"})]})]}):e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm",children:[e.jsxs("div",{className:"flex items-center gap-2 p-4 border-b border-gray-200",children:[e.jsx("button",{onClick:()=>H("text"),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors duration-200 focus:outline-none ${B==="text"?"bg-[#22c55e] text-white":"text-gray-600 hover:bg-gray-100"}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_ask_ai)||"Ask AI a question",children:"Ask AI"}),e.jsxs("button",{onClick:()=>H("upload"),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors duration-200 focus:outline-none ${B==="upload"?"bg-[#22c55e] text-white":"text-gray-600 hover:bg-gray-100"}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_upload_file)||"Upload files (Images, PDF, Video, Audio)",children:["Upload Media ",x.filter(t=>t.content_type==="upload").length>0&&`(${x.filter(t=>t.content_type==="upload").length})`]}),e.jsxs("button",{onClick:()=>H("comment"),className:`px-4 py-2 text-sm font-semibold rounded-md transition-colors duration-200 focus:outline-none ${B==="comment"?"bg-[#22c55e] text-white":"text-gray-600 hover:bg-gray-100"}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_add_comment)||"Add a comment",children:["Human Touch ",x.filter(t=>t.content_type==="comment").length>0&&`(${x.filter(t=>t.content_type==="comment").length})`]})]}),e.jsxs("div",{className:"p-6",children:[B==="text"&&e.jsx("form",{onSubmit:t=>Qe(t),children:Oe?e.jsxs("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-6 text-center",children:[e.jsx("div",{className:"w-12 h-12 bg-yellow-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"#eab308",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 8v4"}),e.jsx("path",{d:"M12 16h.01"})]})}),e.jsx("h3",{className:"text-lg font-semibold text-yellow-800 mb
20-2",children:(a==null?void 0:a.ai_search_view_disabled)||"Ask AI Disabled"}),e.jsxs("p",{className:"text-yellow-700",children:["Ask AI is currently disabled for ",f?"logged-in users":"guests",". Please try again later."]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4 px-1",children:[e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:se,onChange:t=>ga(t.target.checked)}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-2 peer-focus:ring-[#22c55e]/30 rounded-full peer peer-checked:after:translate-x-full rtl:peer-checked:after:-translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:start-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-[#22c55e]"}),e.jsxs("span",{className:"ms-3 text-sm font-medium text-gray-700 flex items-center gap-1",children:[e.jsx(c,{icon:be,className:"text-blue-500"}),"Web Search"]})]}),se&&e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full flex items-center gap-1","data-tooltip-id":"main-tooltip","data-tooltip-content":"Get real-time information from the internet",children:[e.jsx(c,{icon:be,className:"w-3 h-3"}),"Using kimi-k2-turbo-preview"]})]}),e.jsx("div",{className:"text-xs text-gray-400 cursor-help","data-tooltip-id":"main-tooltip","data-tooltip-content":"Enable web search to get real-time information from the internet",children:"â"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:Ca,value:u,onChange:t=>{const n=t.target.value;l===0?P((a==null?void 0:a.ai_search_view_disabled)||"Ask AI is disabled"):n.length<=l?(re(n),P("")):P(((a==null?void 0:a.ai_search_view_question_too_long)||"Maximum {max} characters allowed").replace("{max}",l.toString()))},onKeyDown:$a,placeholder:l===0?(a==null?void 0:a.ai_search_view_disabled)||"Ask AI is disabled":((a==null?void 0:a.ai_search_view_question_placeholder)||"Ask a follow-up question... (Max {max} chars, Press Enter to send, Shift+Enter for new line)").replace("{max}",l.toString()),className:`w-full bg-gray-50 border ${u.length>l||oe?"border-red-500 focus:ring-red-500":"border-gray-200 focus:ring-[#22c55e]"} rounded-lg py-3 px-4 pr-32 text-sm focus:outline-none focus:ring-2 focus:border-transparent min-h-[100px] resize-y`,disabled:W||l===0,rows:3,maxLength:l===0?0:l,"data-tooltip-id":"main-tooltip","data-tooltip-content":l===0?(a==null?void 0:a.ai_search_view_disabled)||"Ask AI is disabled":((a==null?void 0:a.ai_search_view_characters_remaining)||"Maximum {max} characters. You have {remaining} remaining.").replace("{max}",l.toString()).replace("{remaining}",(l-u.length).toString())}),l>0&&e.jsx("div",{className:"absolute bottom-3 right-3 text-xs",children:e.jsxs("span",{className:`${u.length>l?"text-red-500 font-bold":"text-gray-400"}`,children:[u.length,"/",l]})}),e.jsx("div",{className:"absolute bottom-3 right-16",children:e.jsx("button",{type:"submit",disabled:!u.trim()||W||u.length>l||l===0,className:"px-4 py-2 bg-[#22c55e] hover:bg-[#16a34a] text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2","data-tooltip-id":"main-tooltip","data-tooltip-content":l===0?(a==null?void 0:a.ai_search_view_disabled)||"Ask AI is disabled":u.trim()?u.length>l?((a==null?void 0:a.ai_search_view_question_too_long)||"Question too long (max {max} chars)").replace("{max}",l.toString()):W?(a==null?void 0:a.ai_search_view_ai_thinking)||"AI is thinking...":(a==null?void 0:a.ai_search_view_send_question)||"Send your question to AI":(a==null?void 0:a.ai_search_view_type_question)||"Type a question first",children:W?e.jsxs(e.Fragment,{children:[e.jsx(c,{icon:we,className:"animate-spin"}),e.jsx("span",{children:"Asking..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{icon:ca}),e.jsx("span",{children:"Ask AI"})]})})})]}),e.jsxs("div",{className:"flex items-center justify-between mt-4 text-sm text-gray-500",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_press_enter)||"Press Enter to send your message",children:"Press Enter to send"}),e.jsx("span",{children:"â¢"}),e.jsx("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_shift_enter)||"Use Shift+Enter to add a new line",children:"Shift+Enter for new line"})]}),e.jsx("div",{className:"flex items-center space-x-4",children:e.jsx("span",{className:`${u.length>l?"text-red-500 font-semibold":""}`,"data-tooltip-id":"main-tooltip","data-tooltip-content":l===0?(a==null?void 0:a.ai_search_view_disabled)||"Ask AI is disabled":f?((a==null?void 0:a.ai_search_view_char_remaining)||"You have {remaining} characters remaining").replace("{remaining}",(l-u.length).toString()):((a==null?void 0:a.ai_search_view_login_for_more)||"Login for up to {limit} characters").replace("{limit}",((w==null?void 0:w.user_char_limit)||2e3).toString()),children:l===0?"Disabled":u.length>l?((a==null?void 0:a.ai_search_view_exceeded_by)||"â ï¸ Exceeded by {count}").replace("{count}",(u.length-l).toString()):((a==null?void 0:a.ai_search_view_char_count)||"{current}/{max} chars").replace("{current}",u.length.toString()).replace("{max}",l.toString())})})]}),oe&&e.jsxs("div",{className:"mt-2 text-sm text-red-600 flex items-center gap-1",children:[e.jsx(c,{icon:pe,className:"w-4 h-4"}),oe]})]})}),B==="comment"&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(Ya,{value:
20I,onChange:t=>G(t||""),placeholder:"Write your comment here... (Markdown supported)",minHeight:300}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:Ta,disabled:!I.trim()||Le,className:"px-6 py-2 bg-[#22c55e] hover:bg-[#16a34a] text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2","data-tooltip-id":"main-tooltip","data-tooltip-content":I.trim()?(a==null?void 0:a.ai_search_view_post_comment)||"Post your comment":(a==null?void 0:a.ai_search_view_type_comment)||"Type a comment first",children:Le?e.jsxs(e.Fragment,{children:[e.jsx(c,{icon:we,className:"animate-spin"}),e.jsx("span",{children:"Posting..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{icon:la}),e.jsx("span",{children:"Post Comment"})]})})})]}),B==="upload"&&e.jsxs("div",{className:"space-y-4",children:[qe&&e.jsxs("div",{className:"bg-red-50 border border-red-200 text-red-600 px-4 py-3 rounded-lg flex items-center gap-2",children:[e.jsx(c,{icon:pe,className:"text-red-500"}),e.jsx("span",{className:"text-sm",children:qe}),e.jsx("button",{onClick:()=>j(null),className:"ml-auto text-red-500 hover:text-red-700","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_close_alert)||"Close notification",children:e.jsx(c,{icon:da})})]}),b?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"relative group bg-gray-50 rounded-lg p-4 border border-gray-200",children:[e.jsx("button",{onClick:()=>{ue(null),j(null)},className:"absolute -top-2 -right-2 w-6 h-6 bg-red-500 hover:bg-red-600 text-white rounded-full flex items-center justify-center shadow-lg transition-colors z-10","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_remove_file)||"Remove file",children:e.jsx(c,{icon:da,className:"text-xs"})}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"w-12 h-12 rounded flex items-center justify-center bg-blue-500",children:b.type.startsWith("image/")?e.jsx("img",{src:b.data,alt:b.name,className:"w-12 h-12 object-cover rounded"}):b.type.startsWith("video/")?e.jsx(c,{icon:ma,className:"text-white text-xl"}):b.type.startsWith("audio/")?e.jsx(c,{icon:xa,className:"text-white text-xl"}):b.type==="application/pdf"?e.jsx(c,{icon:ha,className:"text-white text-xl"}):e.jsx(c,{icon:ye,className:"text-white text-xl"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-gray-900 truncate",children:b.name}),e.jsx("p",{className:"text-xs text-gray-500",children:je(b.size)})]})]})]}),e.jsx("input",{type:"text",value:I,onChange:t=>G(t.target.value),placeholder:"Add a description (optional)",className:"w-full px-4 py-2 border border-gray-200 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:Ma,disabled:Be,className:"px-6 py-2 bg-[#22c55e] hover:bg-[#16a34a] text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_upload_file_button)||"Upload your file",children:Be?e.jsxs(e.Fragment,{children:[e.jsx(c,{icon:we,className:"animate-spin"}),e.jsx("span",{children:"Uploading..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(c,{icon:oa}),e.jsx("span",{children:"Upload File"})]})})})]}):e.jsxs("div",{className:"flex flex-col items-center justify-center w-full h-40 border-2 border-dashed border-gray-300 rounded-lg cursor-pointer bg-gray-50 hover:bg-gray-100 transition-colors",onClick:()=>{var t;return(t=Ve.current)==null?void 0:t.click()},"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_click_upload)||"Click to upload or drag & drop",children:[e.jsxs("div",{className:"flex flex-col items-center justify-center",children:[e.jsx(c,{icon:oa,className:"w-8 h-8 text-gray-400 mb-2"}),e.jsxs("p",{className:"text-sm text-gray-500",children:[e.jsx("span",{className:"font-semibold",children:"Click to upload"})," or drag & drop"]}),e.jsx("p",{className:"text-xs text-gray-400 mt-1",children:(a==null?void 0:a.ai_search_view_file_types)||"Images, PDF, Video, Audio files up to 100MB"})]}),e.jsx("input",{ref:Ve,type:"file",className:"hidden",accept:"image/*,.pdf,video/*,audio/*,.mp4,.webm,.ogg,.mp3,.wav,.mov,.avi",onChange:Ia})]})]})]})]});return pa?e.jsxs(e.Fragment,{children:[e.jsx(_e,{title:"Checking Access..."}),e.jsx("div",{className:"min-h-screen bg-[#FCFCFC] flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-16 h-16 border-4 border-gray-200 border-t-[#22c55e] rounded-full animate-spin mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:(a==null?void 0:a.ai_search_view_loading_more)||"Checking access permissions..."})]})})]}):D?e.jsxs(e.Fragment,{children:[e.jsx(_e,{title:`${ie} | Ez.wiki AI Conversation`}),e.jsx(Va,{id:"main-tooltip",place:"top",className:"!bg-gray-900 !text-white !text-xs !px-3 !py-2 !rounded-lg !z-[100] !shadow-xl",effect:"solid"}),e.jsxs("div",{className:"min-h-screen bg-[#FCFCFC] text-slate-800",children:[Fe&&e.jsx("div",{className:"fixed top-20 left-1/2 transform -translate-x-1/2 z-50 max-w-4xl w-full px-4 animate-slideDown",children:e.jsxs("div",{className:"bg-gradient-to-r from-green-50 to-emerald-50 border border-green-200 text-green-800 rounded-xl shadow-lg p-4 backdrop-blur-sm relative pr-12",children:[e.jsx("button",{onClick:()=>{Me(null),Ie(null)},className:"absolute top-4 right-4 text-green-600 hover:text-green-800 transition-colors","aria-label":"Close alert","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_close_alert)||"Close notification",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),Fe]})}),Re&&e.jsxs("div",{className:"fixed top-20 right-4 bg-red-600 text-white px-4 py-2 rounded-md shadow-lg z-50","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_error_notification)||"Error notification",children:[e.jsx(c,{icon:pe,className:"mr-2"}),Re]}),We&&e.jsxs("div",{className:"fixed top-20 right-4 bg-green-600 text-white px-4 py-2 rounded-md shadow-lg z-50","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_success_notification)||"Success notification",children:[e.jsx(c,{icon:ve,className:"mr-2"}),We]}),Na&&e.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 transition-opacity",onClick:()=>O(!1)}),e.jsx("div",{className:"flex min-h-full items-center justify-center p-4",children:e.jsxs("div",{className:"relative bg-white rounded-xl shadow-xl max-w-md w-full p-6 transform transition-all",children:[e.jsx("button",{onClick:()=>O(!1),className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_login_prompt_close)||"Close",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("div",{className:"w-16 h-16 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-4",children:e.jsx(c,{icon:sa,className:"text-2xl text-purple-600"})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:C?(a==null?void 0:a.ai_search_view_login_required)||"Login Required":(a==null?void 0:a.ai_search_view_private_conversation)||"Private Conversation"}),e.jsx("p",{className:"text-gray-600",children:C?"The owner of this conversation has disabled guest interaction. Please log in to continue the conversation.":"This is a private conversation. Please log in to continue the conversation."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{href:"/login",className:"block w-full px-4 py-3 bg-[#22c55e] hover:bg-[#16a34a] text-white rounded-lg transition-colors font-medium text-center","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_login)||"Log In",children:"Log In"}),e.jsx(E,{href:"/register",className:"block w-full px-4 py-3 border border-gray-300 hover:bg-gray-50 text-gray-700 rounded-lg transition-colors font-medium text-center","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_create_account)||"Create Account",children:"Create Account"}),e.jsx("button",{onClick:()=>O(!1),className:"block w-full px-4 py-3 text-gray-500 hover:text-gray-700 transition-colors font-medium text-center","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_login_prompt_close)||"Close",children:"Close"})]})]})})]}),e.jsx("header",{className:"border-b border-gray-200 bg-white sticky top-0 z-40 shadow-sm",children:e.jsx("div",{className:"container mx-auto px-4 py-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsxs(E,{href:"/",className:"flex items-center space-x-2",children:[e.jsx("img",{src:"/ezlogo.png",alt:"Ez.wiki Logo",className:"w-8 h-8 object-contain rounded","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_go_homepage)||"Go to homepage"}),e.jsx("span",{className:"text-xl font-semibold text-gray-900",children:"Ez.wiki"})]}),e.jsxs("div",{className:"hidden md:flex items-center space-x-2 text-sm text-gray-600",children:[e.jsxs("span",{className:"px-2 py-1 bg-gray-100 rounded flex items-center gap-1","data-tooltip-id":"main-tooltip","data-tooltip-content":_==="public"?(a==null?void 0:a.ai_search_view_public_conversation)||"Public conversation - anyone can view":_==="private"?(a==null?void 0:a.ai_search_view_private_conversation)||"Private conversation - only you can view":(a==null?void 0:a.ai_search_view_hidden_conversation)||"Hidden conversation",children:[_==="private"&&e.jsx(c,{icon:ae,className:"w-3 h-3"}),_==="hidden"&&e.jsx(c,{icon:R,className:"w-3 h-3"}),"AI Conversation"]}),e.jsx("span",{children:"â¢"}),e.jsxs("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_messages)||"Total messages in this conversation",children:[x.length," messages"]}),e.jsx("span",{children:"â¢"}),e.jsx("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":`Conversation started on ${A(m.created_at)}`,children:A(m.created_at)})]})]}),e.jsx("div",{className:"flex items-center space-x-3",children:e.jsxs("button",{onClick:Sa,className:"px-4 py-2 bg-gray-100 hover:bg-gray-200 rounded-lg transition-colors flex items-center space-x-2 text-sm relative","data-tooltip-id":"main-tooltip","data-tooltip-content":Ce?(a==null?void 0:a.ai_search_view_link_copied)||"Link copied!":(a==null?void 0:a.ai_search_view_copy_link)||"Copy conversation link to clipboard",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),e.jsx("span",{children:Ce?(a==null?void 0:a.ai_search_view_link_copied)||"Copied!":"Copy Link"})]})})]})})}),xe&&e.jsxs("div",{className:"fixed inset-0 z-50 overflow-y-auto",children:[e.jsx("div",{className:"fixed inset-0 bg-black/50 transition-opacity",onClick:Z}),e.jsx("div",{className:"flex min-h-full items-center justify-center p-4",children:e.jsxs("div",{className:"relative bg-white rounded-xl shadow-xl max-w-md w-full p-6 transform transition-all",children:[e.jsx("button",{onClick:Z,className:"absolute top-4 right-4 text-gray-400 hover:text-gray-600 transition-colors","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_close_modal)||"Close modal",children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})}),e.jsxs("div",{className:"mb-6",children:[e.jsx("div",{className:"w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mb-4",children:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-purple-600",children:[e.jsx("circle",{cx:"12",cy:"12",r:"3"}),e.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H5.78a1.65 1.65 0 0 0-1.51 1 1.65 1.65 0 0 0 .33 1.82l.05.05A10 10 0 0 0 12 17.66a10 10 0 0 0 6.24-2.28l.05-.05Z"}),e.jsx("path",{d:"M6.3 8.7 7.7 7.3"}),e.jsx("path",{d:"M17.7 8.7 16.3 7.3"}),e.jsx("path",{d:"M9 5 8 3"}),e.jsx("path",{d:"M15 5 16 3"})]})}),e.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:(a==null?void 0:a.ai_search_view_save_theme)||"Save to eztheme"}),e.jsx("p",{className:"text-sm text-gray-600",children:"Enter your email address to save this conversation to your eztheme collection."})]}),e.jsxs("form",{onSubmit:Fa,children:[e.jsxs("div",{className:"mb-4",children:[e.jsxs("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-2",children:["Email address ",e.jsx("span",{className:"text-red-500",children:"*"})]}),e.jsx("input",{ref:fe,type:"email",id:"email",value:V,onChange:t=>{De(t.target.value),X("")},placeholder:"[email protected]",className:`w-full px-4 py-2.5 border ${he?"border-red-500":"border-gray-300"} rounded-lg focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent transition-colors`,disabled:K,"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_save_theme_email)||"Enter your email to receive theme access"}),he&&e.jsx("p",{className:"mt-2 text-sm text-red-600",children:he})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[e.jsx("button",{type:"button",onClick:Z,className:"flex-1 px-4 py-2.5 border border-gray-300 text-gray-700 rounded-lg hover:bg-gray-50 transition-colors text-sm font-medium",disabled:K,"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_cancel)||"Cancel and close",children:"Cancel"}),e.jsx("button",{type:"submit",disabled:K||!V.trim(),className:"flex-1 px-4 py-2.5 bg-purple-600 hover:bg-purple-700 text-white rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed text-sm font-medium flex items-center justify-center space-x-2","data-tooltip-id":"main-tooltip","data-tooltip-content":V.trim()?(a==null?void 0:a.ai_search_view_save_theme_button)||"Save this conversation as a theme":(a==null?void 0:a.ai_search_view_theme_email_required)||"Email is required",children:K?e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"animate-spin",children:e.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),e.jsx("span",{children:(a==null?void 0:a.ai_search_view_saving_theme)||"Saving..."})]}):e.jsxs(e.Fragment,{children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),e.jsx("span",{children:(a==null?void 0:a.ai_search_view_save_theme)||"Save Theme"})]})})]})]}),e.jsx("p",{className:"mt-4 text-xs text-center text-gray-500",children:"We'll send you a confirmation email. You can unsubscribe at any time."})]})})]}),e.jsx("main",{className:"container mx-auto px-4 py-8 max-w-6xl",children:e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-8",children:[e.jsx("div",{className:"lg:col-span-1",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-6 shadow-sm sticky top-24",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-700 uppercase tracking-wider mb-3",children:(a==null?void 0:a.ai_search_view_quick_actions)||"Quick Actions"}),e.jsx("div",{className:"space-y-3 mb-2"
20,children:e.jsx("div",{className:"bg-gray-50 rounded-lg p-2",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>Ke("up"),className:`flex-1 px-3 py-2 text-white rounded-lg text-sm flex items-center justify-center gap-2 transition-all shadow-md hover:shadow-lg active:scale-95 ${N==="up"?"bg-blue-600 ring-2 ring-blue-300 animate-pulse":"bg-blue-500 hover:bg-blue-600"}`,title:N==="up"?"Click to stop auto-scrolling":(a==null?void 0:a.ai_search_view_scroll_top)||"Auto scroll to top in slow motion","data-tooltip-id":"main-tooltip","data-tooltip-content":N==="up"?"Auto-scrolling up (Click to stop)":(a==null?void 0:a.ai_search_view_scroll_top)||"Auto scroll to top in slow motion",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"m5 17 7-7 7 7"}),e.jsx("path",{d:"m5 7 7-7 7 7"})]}),e.jsx("span",{children:"Top"})]}),e.jsxs("button",{onClick:()=>Ke("down"),className:`flex-1 px-3 py-2 text-white rounded-lg text-sm flex items-center justify-center gap-2 transition-all shadow-md hover:shadow-lg active:scale-95 ${N==="down"?"bg-green-600 ring-2 ring-green-300 animate-pulse":"bg-green-500 hover:bg-green-600"}`,title:N==="down"?"Click to stop auto-scrolling":(a==null?void 0:a.ai_search_view_scroll_bottom)||"Auto scroll to bottom in slow motion","data-tooltip-id":"main-tooltip","data-tooltip-content":N==="down"?"Auto-scrolling down (Click to stop)":(a==null?void 0:a.ai_search_view_scroll_bottom)||"Auto scroll to bottom in slow motion",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"m19 12-7-5-7 5"}),e.jsx("path",{d:"m5 7 7 5 7-5"})]}),e.jsx("span",{children:"Bottom"})]})]})})}),e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("h1",{className:"text-lg font-semibold text-gray-900 break-words whitespace-normal overflow-hidden",style:{wordBreak:"break-word",hyphens:"auto"},"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_conversation_title)||"Conversation title",children:ie}),_==="private"&&e.jsxs("span",{className:"text-xs bg-purple-100 text-purple-700 px-2 py-1 rounded-full flex items-center gap-1","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_private_conversation)||"Private conversation - only visible to you",children:[e.jsx(c,{icon:ae,className:"w-3 h-3"}),"Private"]}),_==="hidden"&&F&&e.jsxs("span",{className:"text-xs bg-gray-100 text-gray-700 px-2 py-1 rounded-full flex items-center gap-1","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_hidden_conversation)||"Hidden conversation - only visible to you",children:[e.jsx(c,{icon:R,className:"w-3 h-3"}),"Hidden"]})]}),e.jsxs("div",{className:"flex items-center text-sm text-gray-600 space-x-2",children:[e.jsxs("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_messages)||"Total messages in this conversation",children:[x.length," messages"]}),e.jsx("span",{children:"â¢"}),e.jsxs("span",{"data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_tokens)||"Total tokens used in this conversation",children:[le," tokens"]})]}),e.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[e.jsxs("span",{className:"text-xs bg-green-100 text-green-700 px-2 py-1 rounded-full",children:["AI: ",x.filter(t=>t.content_type==="ai").length]}),e.jsxs("span",{className:"text-xs bg-purple-100 text-purple-700 px-2 py-1 rounded-full",children:["Comments: ",x.filter(t=>t.content_type==="comment").length]}),e.jsxs("span",{className:"text-xs bg-emerald-100 text-emerald-700 px-2 py-1 rounded-full",children:["Embeds: ",x.filter(t=>t.content_type==="embed").length]}),e.jsxs("span",{className:"text-xs bg-blue-100 text-blue-700 px-2 py-1 rounded-full",children:["Uploads: ",x.filter(t=>t.content_type==="upload").length]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-700 uppercase tracking-wider mb-3",children:(a==null?void 0:a.ai_search_view_stats)||"Conversation Stats"}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_messages)||"Number of messages exchanged",children:[e.jsx("span",{className:"text-xs text-gray-500 block",children:"Total Messages"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:x.length})]}),e.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_tokens)||"Total tokens used (prompt + completion)",children:[e.jsx("span",{className:"text-xs text-gray-500 block",children:"Total Tokens"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:le})]}),e.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_ai_model)||"AI model used for responses",children:[e.jsx("span",{className:"text-xs text-gray-500 block",children:"AI Model"}),e.jsx("span",{className:"text-sm font-semibold text-gray-900",children:m.model})]}),e.jsxs("div",{className:"bg-gray-50 p-3 rounded-lg","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_conversation_cost_tooltip)||"Total cost of this conversation",children:[e.jsx("span",{className:"text-xs text-gray-500 block",children:"Total Cost"}),e.jsxs("span",{className:"text-sm font-semibold text-gray-900",children:["$",ce.toFixed(4)]})]})]})]}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"space-y-3",children:[x.length>0&&e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3",children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2 px-2",children:(a==null?void 0:a.ai_search_view_jump_to_message_title)||"Jump to Message"}),e.jsxs("div",{className:"max-h-[200px] overflow-y-auto pr-1 scrollbar-thin scrollbar-track-gray-100",children:[x.filter(t=>t.message_role==="user").length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("h4",{className:"text-xs font-medium text-gray-400 mb-1 px-2 sticky top-0 bg-gray-50 py-1",children:"User Messages"}),e.jsx("ul",{className:"space-y-1",children:x.filter(t=>t.message_role==="user").map((t,n)=>{var s;let r=t.query;
20return t.content_type==="upload"?r=`[File] ${((s=t.file_data)==null?void 0:s.original_name)||t.query}`:t.content_type==="comment"?r=`[Comment] ${t.query}`:t.content_type==="embed"&&(r="[Embed] Layout"),e.jsx("li",{children:e.jsxs("button",{onClick:()=>Xe(t.slug),className:"w-full text-left px-3 py-2 text-sm text-gray-700 hover:bg-white hover:text-[#22c55e] rounded-lg transition-colors truncate",title:r,"data-tooltip-id":"main-tooltip","data-tooltip-content":((a==null?void 0:a.ai_search_view_jump_to_message)||"Jump to: {preview}").replace("{preview}",r.substring(0,50)),children:[e.jsxs("span",{className:"inline-block w-6 text-gray-400",children:[n+1,"."]}),r.substring(0,40),r.length>40?"...":""]})},t.id)})})]}),x.filter(t=>t.message_role==="assistant").length>0&&e.jsxs("div",{children:[e.jsx("h4",{className:"text-xs font-medium text-gray-400 mb-1 px-2 sticky top-0 bg-gray-50 py-1",children:"AI Responses"}),e.jsx("ul",{className:"space-y-1",children:x.filter(t=>t.message_role==="assistant").map((t,n)=>{const r=ua(t.response||"").substring(0,40);return e.jsx("li",{children:e.jsxs("button",{onClick:()=>Xe(t.slug),className:"w-full text-left px-3 py-2 text-sm text-gray-700 hover:bg-white hover:text-[#22c55e] rounded-lg transition-colors truncate",title:ua(t.response||""),"data-tooltip-id":"main-tooltip","data-tooltip-content":((a==null?void 0:a.ai_search_view_jump_to_message)||"Jump to: {preview}").replace("{preview}",r),children:[e.jsxs("span",{className:"inline-block w-6 text-gray-400",children:[n+1,"."]}),r,r.length>40?"...":""]})},t.id)})})]})]})]}),e.jsxs("div",{className:"bg-gray-50 rounded-lg p-3 text-xs text-gray-600",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{children:"AI messages:"}),e.jsx("span",{className:"font-medium text-gray-900",children:x.filter(t=>t.content_type==="ai").length})]}),e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{children:"Comments:"}),e.jsx("span",{className:"font-medium text-gray-900",children:x.filter(t=>t.content_type==="comment").length})]}),e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{children:"Embeds:"}),e.jsx("span",{className:"font-medium text-gray-900",children:x.filter(t=>t.content_type==="embed").length})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{children:"File uploads:"}),e.jsx("span",{className:"font-medium text-gray-900",children:x.filter(t=>t.content_type==="upload").length})]})]}),e.jsxs("button",{onClick:()=>window.print(),className:"w-full px-4 py-2.5 bg-gray-100 hover:bg-gray-200 rounded-lg text-sm text-gray-700 flex items-center justify-center space-x-2 transition-colors","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_save_pdf)||"Save this conversation as a PDF file",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"6 9 6 2 18 2 18 9"}),e.jsx("path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1-2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"}),e.jsx("rect",{width:"12",height:"8",x:"6",y:"14"})]}),e.jsx("span",{children:(a==null?void 0:a.ai_search_view_save_pdf)||"Save as PDF"})]})]})}),ke.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-gray-700 uppercase tracking-wider mb-3",children:(a==null?void 0:a.ai_search_view_related)||"Related Conversations"}),e.jsx("div",{className:"space-y-3",children:ke.filter(t=>t.status==="public").map((t,n)=>e.jsxs(E,{href:`/X/${encodeURIComponent(t.slug)}`,className:"block p-3 bg-gray-50 hover:bg-gray-100 rounded-lg transition-colors group","data-tooltip-id":"main-tooltip","data-tooltip-content":`View related conversation: ${t.conversation_title}`,children:[e.jsx("p",{className:"text-sm text-gray-900 line-clamp-2 group-hover:text-[#22c55e] transition-colors",children:t.conversation_title}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("span",{className:"text-xs text-gray-500","data-tooltip-id":"main-tooltip","data-tooltip-content":((a==null?void 0:a.ai_search_view_total_messages)||"{count} messages in this conversation").replace("{count}",t.message_count.toString()),children:[t.message_count," msgs"]}),e.jsx("span",{className:"text-xs text-gray-500","data-tooltip-id":"main-tooltip","data-tooltip-content":`Created on ${A(t.created_at)}`,children:A(t.created_at)})]})]},n))})]})]})}),e.jsxs("div",{className:"lg:col-span-3",children:[e.jsx("div",{className:`rounded-xl p-6 text-white mb-6 ${_==="private"?"bg-gradient-to-r from-purple-500 to-purple-600":_==="hidden"?"bg-gradient-to-r from-gray-500 to-gray-600":"bg-gradient-to-r from-purple-500 to-purple-600"}`,children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-semibold mb-2 flex items-center gap-2",children:[_==="private"&&e.jsx(c,{icon:ae,className:"text-white/80"}),_==="hidden"&&e.jsx(c,{icon:R,className:"text-white/80"}),"AI Conversation"]}),e.jsx("p",{className:"text-purple-100",children:D?"Continue chatting with AI in this conversation":"Viewing conversation"})]}),e.jsxs("div",{className:"text-right",children:[e.jsxs("div",{className:"text-sm text-purple-200","data-tooltip-id":"main-tooltip","data-tooltip-content":"Unique conversation identifier",children:["ID: ",m.conversation_id.substring(0,8),"..."]}),e.jsxs("div",{className:"text-sm text-purple-200","data-tooltip-id":"main-tooltip","data-tooltip-content":`Started on ${A(m.created_at)}`,children:["Started: ",A(m.created_at)]}),e.jsxs("div",{className:"text-sm text-purple-200 mt-1","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_conversation_cost_tooltip)||"Total cost of this conversation",children:["Total Cost: $",ce.toFixed(4)]})]})]})}),e.jsxs("div",{ref:ka,className:"bg-white rounded-xl border border-gray-200 shadow-sm mb-6",children:[e.jsxs("div",{className:"p-6",children:[x.length>0?(()=>{const t=x.find(r=>!r.parent_id)||x[0],n=x.filter(r=>r.id!==(t==null?void 0:t.id));return e.jsxs("div",{children:[t&&ea(t,!1),n.length>0&&e.jsxs("div",{className:"mt-8 pt-6 border-t border-gray-100",children:[e.jsx("div",{className:"flex items-center justify-between mb-4",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-gray-800",children:"Comments & Replies"}),e.jsx("span",{className:"text-xs font-semibold px-2.5 py-0.5 rounded-full bg-emerald-50 text-emerald-700 border border-emerald-200/70",children:n.length})]})}),e.jsx(Oa,{breakpointCols:Ka,className:"my-masonry-grid",columnClassName:"my-masonry-grid_column",children:n.map(r=>ea(r,!0))})]})]})})():e.jsx("div",{className:"text-center py-12 text-gray-500",children:"No messages to display in this conversation."}),e.jsx("div",{ref:He})]}),x.length>0&&e.jsx("div",{className:"flex justify-center pt-2 pb-6",children:e.jsxs("button",{onClick:Aa,className:"px-6 py-2.5 bg-white hover:bg-gray-50 text-gray-700 rounded-full transition-all flex items-center space-x-2 text-sm font-medium border border-gray-300/80 shadow-2xs hover:shadow-sm","data-tooltip-id":"main-tooltip","data-tooltip-content":$e?(a==null?void 0:a.ai_search_view_message_copied)||"Copied!":(a==null?void 0:a.ai_search_view_copy_entire_conversation)||"Copy the entire conversation to clipboard",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-gray-500",children:[e.jsx("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),e.jsx("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})]}),e.jsx("span",{children:$e?(a==null?void 0:a.ai_search_view_message_copied)||"Copied! â":"Copy the entire conversation to clipboard"})]})})]}),D&&!($&&!f)&&Ua()]})]})}),e.jsx("footer",{className:"border-t border-gray-200 bg-white mt-12",children:e.jsx("div",{className:"container mx-auto px-4 py-8",children:e.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center",children:[e.jsxs("div",{className:"flex items-center space-x-2 mb-4 md:mb-0",children:[e.jsx("img",{src:"/ezlogo.png",alt:"Ez.wiki Logo",className:"w-6 h-6 object-contain rounded","data-tooltip-id":"main-tooltip","data-tooltip-content":"Ez.wiki"}),e.jsx("span",{className:"text-lg font-semibold text-gray-900",children:"Ez.wiki"})]}),e.jsxs("div",{className:"text-sm text-gray-600 text-center md:text-right",children:[e.jsxs("p",{className:"mb-1",children:["AI Conversation â¢",e.jsxs("span",{className:"mx-1","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_messages)||"Total messages",children:[x.length," messages"]}),"â¢",e.jsxs("span",{className:"mx-1","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_total_tokens)||"Total tokens used",children:[le," tokens"]}),"â¢",e.jsxs("span",{className:"mx-1","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_conversation_cost_tooltip)||"Total cost",children:["$",ce.toFixed(4)," cost"]})]}),e.jsxs("p",{children:["© ",new Date().getFullYear()," Ez.wiki â¢",e.jsxs("span",{className:"ml-1","data-tooltip-id":"main-tooltip","data-tooltip-content":"Conversation identifier",children:["Conversation ID: ",m.conversation_id]})]})]})]})})})]}),e.jsx("style",{children:` 21 @keyframes slideDown { 22 from { 23 opacity: 0; 24 transform: translate(-50%, -20px); 25 } 26 to { 27 opacity: 1; 28 transform: translate(-50%, 0); 29 } 30 } 31 .animate-slideDown { 32 animation: slideDown 0.3s ease-out; 33 } 34 35 .scrollbar-thin::-webkit-scrollbar {
36 width: 6px; 37 } 38 .scrollbar-thin::-webkit-scrollbar-track { 39 background: #f3f4f6; 40 border-radius: 3px; 41 } 42 .scrollbar-thin::-webkit-scrollbar-thumb { 43 background: #d1d5db; 44 border-radius: 3px; 45 } 46 .scrollbar-thin::-webkit-scrollbar-thumb:hover { 47 background: #9ca3af; 48 } 49 `})]}):e.jsxs(e.Fragment,{children:[e.jsx(_e,{title:"Access Denied | Ez.wiki"}),e.jsx("div",{className:"min-h-screen bg-[#FCFCFC] flex items-center justify-center p-4",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-lg max-w-md w-full p-8 text-center",children:[e.jsx("div",{className:"w-20 h-20 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-6",children:_==="hidden"?e.jsx(c,{icon:R,className:"text-3xl text-red-600"}):e.jsx(c,{icon:sa,className:"text-3xl text-red-600"})}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-3",children:_==="hidden"?(a==null?void 0:a.ai_search_view_hidden_conversation)||"Conversation Hidden":C?(a==null?void 0:a.ai_search_view_login_required)||"Login Required":(a==null?void 0:a.ai_search_view_private_conversation)||"Access Denied"}),e.jsx("p",{className:"text-gray-600 mb-6",children:va||(C?"The owner of this conversation has disabled guest interaction. Please log in to continue.":_==="hidden"?"This conversation has been hidden and is not available for viewing.":"You do not have permission to view this conversation.")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(E,{href:"/",className:"block w-full px-4 py-3 bg-[#22c55e] hover:bg-[#16a34a] text-white rounded-lg transition-colors font-medium","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_go_homepage)||"Go to homepage",children:"Go to Homepage"}),(_==="private"||C)&&!f&&e.jsx(E,{href:"/login",className:"block w-full px-4 py-3 border border-gray-300 hover:bg-gray-50 text-gray-700 rounded-lg transition-colors font-medium","data-tooltip-id":"main-tooltip","data-tooltip-content":(a==null?void 0:a.ai_search_view_login)||"Log In",children:"Log In"})]})]})})]})}export{pt as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.