1import{d as G,a2 as V,a3 as J,a4 as H,a5 as K,r as i,a6 as Q,j as t,a7 as W,B as X,a8 as Y,a9 as Z,s as p}from"./index-Xfn33nWj.js";import{I as ee}from"./input-D63_hGL9.js";import te from"./Footer-KcpQUydv.js";import{S as se}from"./search-BIcpq1MG.js";import{C as ae,k as re,n as L,e as oe}from"./th-BEgKK9K_.js";import{E as ne}from"./eye-DpiQKBkr.js";import{A as le}from"./arrow-right-By9X826u.js";import{z as ie}from"./zh-CN-7I04bolk.js";/** 2 * @license lucide-react v0.462.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */const ce=G("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),de={th:L,en:oe,zh:ie};function _e(){const{t:h,i18n:S}=V();J({title:"à¸à¸à¸à¸§à¸²à¸¡à¹à¸¥à¸°à¸à¹à¸²à¸§à¸ªà¸²à¸£ AI สำหรัà¸à¸à¸à¸à¹à¸à¸£ | BOTNOI Blog",description:"à¸à¹à¸²à¸à¸à¸à¸à¸§à¸²à¸¡ à¸à¹à¸²à¸§à¸ªà¸²à¸£ à¹à¸¥à¸°à¹à¸à¸ªà¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹ AI Chatbot, Voicebot à¹à¸¥à¸° AI Agent สำหรัà¸à¸à¸¸à¸£à¸à¸´à¸à¹à¸à¸¢à¸à¸²à¸à¸à¸µà¸¡ BOTNOI Group",canonicalPath:"/blog"}),H("blog-list-breadcrumb",K([{name:"BOTNOI Group",path:"/"},{name:"à¸à¸à¸à¸§à¸²à¸¡à¹à¸¥à¸°à¸à¹à¸²à¸§à¸ªà¸²à¸£",path:"/blog"}]));const[f,k]=i.useState([]),[b,C]=i.useState([]),[d,_]=i.useState(null),[I,j]=i.useState(!0),[N,M]=i.useState({}),[y,A]=Q(),u=y.get("q")??"",T=e=>{const r=new URLSearchParams(y);e?r.set("q",e):r.delete("q"),A(r,{replace:!0})},[x,E]=i.useState(!0),s=S.language,P=de[s]||L;i.useEffect(()=>{(async()=>{const{data:r}=await p.from("blog_tags").select("id, name, slug").order("name");C(r||[]);const{data:o}=await p.from("blog_posts").select("id, slug, title_th, title_en, title_zh, excerpt_th, excerpt_en, excerpt_zh, cover_image_url, created_at, view_count").eq("is_published",!0).order("display_order",{ascending:!0}).order("created_at",{ascending:!1});if(!o||o.length===0){j(!1);return}const l=o.map(a=>a.id),{data:n}=await p.from("blog_post_tags").select("post_id, tag_id, blog_tags(name)").in("post_id",l),c={};n==null||n.forEach(a=>{var m;c[a.post_id]||(c[a.post_id]={names:[],ids:[]}),(m=a.blog_tags)!=null&&m.name&&c[a.post_id].names.push(a.blog_tags.name),a.tag_id&&c[a.post_id].ids.push(a.tag_id)});const g={};n==null||n.forEach(a=>{g[a.post_id]||(g[a.post_id]=[]),g[a.post_id].push(a.tag_id)}),M(g),k(o.map(a=>{var m;return{...a,tags:((m=c[a.id])==null?void 0:m.names)||[]}})),j(!1)})()},[]);const w=e=>s==="en"&&e.title_en?e.title_en:s==="zh"&&e.title_zh?e.title_zh:e.title_th,v=e=>s==="en"&&e.excerpt_en?e.excerpt_en:s==="zh"&&e.excerpt_zh?e.excerpt_zh:e.excerpt_th,z=i.useMemo(()=>{let e=f;if(d&&(e=e.filter(r=>{var o;return(o=N[r.id])==null?void 0:o.includes(d)})),u.trim()){const r=u.trim().toLowerCase();e=e.filter(o=>{const l=w(o).toLowerCase(),n=v(o).toLowerCase();return l.includes(r)||n.includes(r)||o.tags.some(c=>c.toLowerCase().includes(r))})}return e=[...e].sort((r,o)=>{const l=new Date(r.created_at).getTime(),n=new Date(o.created_at).getTime();return x?n-l:l-n}),e},[f,d,N,u,x,s]),B=s==="en"?"All":s==="zh"?"å ¨é¨":"à¸à¸±à¹à¸à¸«à¸¡à¸",D=s==="en"?"Loading...":s==="zh"?"å è½½ä¸...":"à¸à¸³à¸¥à¸±à¸à¹à¸«à¸¥à¸...",O=s==="en"?"No articles found":s==="zh"?"æªæ¾å°æç« ":"à¹à¸¡à¹à¸à¸à¸à¸à¸à¸§à¸²à¸¡",q=h("blog.title"),U=h("blog.subtitle"),R=h("blog.read_more"),$=s==="en"?"Search articles...":s==="zh"?"æç´¢æç« ...":"à¸à¹à¸à¸«à¸²à¸à¸à¸à¸§à¸²à¸¡...",F=x?s==="en"?"Newest first":s==="zh"?"ææ°ä¼å ":"à¹à¸«à¸¡à¹à¸ªà¸¸à¸":s==="en"?"Oldest first":s==="zh"?"ææ§ä¼å ":"à¹à¸à¹à¸²à¸ªà¸¸à¸";return t.jsxs(t.Fragment,{children:[t.jsx(W,{}),t.jsx("div",{className:"pt-20 pb-24",children:t.jsxs("div",{className:"mx-auto max-w-7xl px-6",children:[t.jsxs("div",{className:"py-12 md:py-16",children:[t.jsx("h1",{className:"text-3xl md:text-4xl font-bold text-foreground mb-3",children:q}),t.jsx("p",{className:"text-muted-foreground text-lg",children:U})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-6",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(se,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),t.jsx(ee,{value:u,onChange:e=>T(e.target.value),placeholder:$,className:"pl-9"})]}),t.jsxs(X,{variant:"outline",size:"sm",className:"shrink-0 gap-1.5",onClick:()=>E(!x),children:[t.jsx(ce,{className:"h-4 w-4"}),F]})]}),b.length>0&&t.jsxs("div",{className:"flex flex-wrap gap-2 mb-10",children:[t.jsx("button",{onClick:()=>_(null),className:`px-4 py-1.5 rounded-full text-sm font-medium transition-colors ${d?"bg-secondary text-secondary-foreground hover:bg-secondary/80":"bg-primary text-primary-foreground"}`,children:B}),b.map(e=>t.jsx("button",{onClick:()=>_(e.id===d?null:e.id),className:`px-4 py-1.5 rounded-full text-sm font-medium transition-colors ${d===e.id?"bg-primary text-primary-foreground":"bg-secondary text-secondary-foreground hover:bg-secondary/80"}`,children:e.name},e.id))]}),I?t.jsx("p",{className:"text-muted-foreground",children:D}):z.length===0?t.jsx("p",{className:"text-muted-foreground py-12 text-center",children:O}):t.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-8",children:z.map(e=>{var l;const r=w(e),o=v(e);return t.jsxs(Y,{to:`/blog/${e.slug||e.id}`,onClick:()=>Z("click_blog",{slug:e.slug||e.id}),className:"group rounded-2xl border border-border/60 bg-card overflow-hidden hover:shadow-lg hover:shadow-
6primary/5 transition-shadow duration-300",children:[t.jsxs("div",{className:"aspect-[16/9] bg-gradient-to-br from-primary/10 to-secondary/60 flex items-center justify-center relative overflow-hidden",children:[e.cover_image_url?t.jsx("img",{src:e.cover_image_url,alt:r,className:"w-full h-full object-cover",loading:"lazy"}):t.jsx("span",{className:"text-sm text-muted-foreground",children:r}),e.tags.length>0&&t.jsx("div",{className:"absolute top-3 left-3 flex flex-wrap gap-1.5",children:e.tags.map(n=>t.jsx("span",{className:"text-[11px] font-medium bg-card/90 backdrop-blur-sm text-primary px-2.5 py-1 rounded-full",children:n},n))})]}),t.jsxs("div",{className:"p-6 space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[t.jsxs("span",{className:"flex items-center gap-1.5",children:[t.jsx(ae,{className:"h-3.5 w-3.5"}),t.jsx("time",{children:re(new Date(e.created_at),"d MMM yyyy",{locale:P})})]}),t.jsxs("span",{className:"flex items-center gap-1",children:[t.jsx(ne,{className:"h-3.5 w-3.5"}),((l=e.view_count)==null?void 0:l.toLocaleString())||0]})]}),t.jsx("h3",{className:"font-semibold text-foreground leading-snug group-hover:text-primary transition-colors",children:r}),t.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed line-clamp-2",children:o}),t.jsxs("span",{className:"inline-flex items-center text-sm font-medium text-primary pt-1",children:[R," ",t.jsx(le,{className:"ml-1 h-3.5 w-3.5"})]})]})]},e.id)})})]})}),t.jsx(te,{})]})}export{_e as default}; 7//# sourceMappingURL=BlogList-iQvG7VJS.js.map
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.