import{_ as T,p as L,a as r,l as c,q as y,b as t,t as s,u as a,i as n,h as p,m as d,g as w,F as _,x as h,k as N,y as x,z as S,r as A,o as l,S as F,C,f as B}from"./index-C--0e2U-.js";import{T as j}from"./target-dGrJgR_B.js";import{A as q}from"./arrow-left-C-Wn16Dy.js";const D={class:"row",style:{"align-items":"center"}},E={style:{margin:"0"}},I={class:"muted",style:{"margin-left":"auto"}},M={key:0,class:"card guide"},R={key:1,class:"row",style:{margin:"12px 0",gap:"10px"}},G={class:"primary"},H={class:"grid"},J={class:"row",style:{"justify-content":"space-between"}},K={class:"diff"},O={class:"muted"},Q={class:"muted"},U={class:"muted"},W={class:"muted",style:{"margin-top":"6px"}},X={class:"primary",style:{width:"100%"}},Y={class:"primary",style:{width:"100%"}},Z={class:"muted",style:{"margin-top":"auto","font-size":"12px"}},tt=["onClick","disabled"],st={__name:"Personas",setup(et){const u=N().params.gid,k=A([]),z=A(!0);async function b(){try{k.value=(await x.listPersonas(u)).personas}finally{z.value=!1}}function P(o){return k.value.filter(i=>i.tier===o)}function V(o){return n.t(o==="A"?"tierA":o==="B"?"tierB":"tierC")}function v(o){return o==="won"?n.t("won"):o==="lost"?n.t("lost"):o==="not_tried"?n.t("notTried"):o||"-"}async function $(o){o._busy=!0;try{await x.createPersonaVariant(u,o.id),await b()}catch(i){alert(i.message)}finally{o._busy=!1}}return L(b),(o,i)=>{const m=S("router-link");return l(),r("div",null,[c(m,{to:"/training",class:"btn-back"},{default:y(()=>[c(a(q),{size:16,"stroke-width":2}),d(" "+s(a(n).t("training")),1)]),_:1}),t("div",D,[t("h2",E,s(a(n).t("personas")),1),t("span",I,s(a(n).t("selectPersona")),1)]),a(p).isAdmin?w("",!0):(l(),r("div",M,[t("strong",null,[c(a(j),{size:17,"stroke-width":1.8,style:{"vertical-align":"-3px"}}),i[0]||(i[0]=d(" วิธีฝึก",-1))]),i[1]||(i[1]=t("ol",{style:{margin:"8px 0 0","padding-left":"20px","line-height":"1.8"}},[t("li",null,"เลือกลูกค้าจำลอง (บุคคลต้นแบบ) คนหนึ่งที่อยากฝึกด้วย"),t("li",null,"ระดับ A ง่ายสุด → ระดับ C ยากสุด (ดูจากดาว ★ ความยาก)"),t("li",null,[d("กด "),t("strong",null,"แชท"),d(" → เลือกสถานการณ์ (โซเชียล / พบหน้า-โทร) → เริ่มคุยกับลูกค้า")]),t("li",null,"ลูกค้าจะตัดสินใจเองว่าซื้อหรือไม่ซื้อ (ฝึกได้คนละครั้งเท่านั้น)")],-1))])),a(p).isAdmin?(l(),r("div",R,[c(m,{to:`/admin/groups/${a(u)}/edit`},{default:y(()=>[t("button",G,[c(a(F),{size:18,"stroke-width":1.8}),d(" "+s(a(n).t("managePersonas")),1)])]),_:1},8,["to"]),i[2]||(i[2]=t("span",{class:"muted"},"Admin: จัดการรายละเอียดบุคคลต้นแบบได้ที่นี่",-1))])):w("",!0),(l(),r(_,null,h(["A","B","C"],f=>t("div",{key:f,style:{margin:"20px 0"}},[t("h4",null,s(V(f)),1),t("div",H,[(l(!0),r(_,null,h(P(f),e=>(l(),r("div",{key:e.id,class:"card pcard lift"},[t("div",J,[t("strong",null,s(e.name),1),t("span",{class:C(["badge",e.my_outcome])},s(v(e.my_outcome)),3)]),t("div",K,[(l(),r(_,null,h(5,g=>t("span",{key:g,class:C(["star",{on:g<=(e.difficulty||1)}])},"★",2)),64)),t("span",O,s(a(n).t("difficulty"))+" "+s(e.difficulty||1)+"/5",1)]),t("div",Q,[d(s(e.profession)+" · "+s(e.age_group)+" · "+s(e.location),1),i[3]||(i[3]=t("br",null,null,-1)),t("span",U,s(a(n).t("difficulty"))+" "+s(e.difficulty||1)+"/5",1)]),t("div",W,s(e.product_context),1),a(p).isAdmin?(l(),B(m,{key:0,to:`/groups/${a(u)}/chat/${e.id}`,style:{"margin-top":"auto"}},{default:y(()=>[t("button",X,s(a(n).t("chat")),1)]),_:1},8,["to"])):(l(),r(_,{key:1},[e.my_outcome==="not_tried"?(l(),B(m,{key:0,to:`/groups/${a(u)}/chat/${e.id}`,style:{"margin-top":"auto"}},{default:y(()=>[t("button",Y,s(a(n).t("chat")),1)]),_:1},8,["to"])):(l(),r(_,{key:1},[t("div",Z,"✓ "+s(a(n).t("trained"))+" ("+s(v(e.my_outcome))+")",1),t("button",{class:"soft",style:{width:"100%","margin-top":"8px"},onClick:g=>$(e),disabled:e._busy},s(e._busy?"กำลังสร้าง…":"สร้างบุคคลต้นแบบจากต้นแบบนี้"),9,tt)],64))],64))]))),128))])])),64))])}}},lt=T(st,[["__scopeId","data-v-20adbc50"]]);export{lt as default};