1import{d as N,m as i,y as V,ak as B,i as T,o as l,w as u,h as d,g as s,b as m,j as b,f as t,e as v,F as $,r as E,x as F,t as _,n as R,p as U,s as j,c7 as z}from"./peYoHwPY.js";import{_ as A}from"./DpL4h0HX.js";import{_ as H,a as D,b as L,c as M}from"./5kER2t2g.js";import"./C0Mq5Sf7.js";import"./DuOR6ZOZ.js";import{H as O}from"./DaRIXWZf.js";const P={key:0,class:"space-y-6"},Y={class:"space-y-3"},I={class:"space-y-2"},Q={class:"grid grid-cols-11 gap-2"},W=["onClick"],q={class:"space-y-2"},G={key:0,class:"text-red-600 text-sm"},J={class:"flex gap-2 pt-2"},K={key:0,class:"loading loading-spinner size-4 mr-2"},X={key:1,class:"text-center py-8"},Z=N({__name:"nps-survey",props:{open:{type:Boolean,default:!0}},emits:["close","completed"],setup(g,{emit:x}){const f=x,n=i(!1),r=i(null),c=i(""),y=i(!1),p=i(""),k=a=>{r.value=a},S=V(),h=B(),w=async()=>{if(r.value!==null){n.value=!0,p.value="";try{const{error:a}=await S.from(z).insert({user_id:h.userId||null,survey_type:"nps",responses:{rating:r.value,comment:c.value.trim()||null}});if(a)throw a;y.value=!0,setTimeout(()=>{f("completed"),f("close")},2e3)}catch(a){p.value="Failed to submit survey. Please try again.",console.error("Survey submission error:",a)}finally{n.value=!1}}},C=()=>{n.value||f("close")};return(a,e)=>(l(),T(s(M),{open:g.open,"onUpdate:open":e[1]||(e[1]=o=>!o&&C())},{default:u(()=>[d(s(H),{class:"sm:max-w-lg"},{default:u(()=>[d(s(D),null,{default:u(()=>[d(s(L),null,{default:u(()=>[...e[2]||(e[2]=[b("Quick Feedback",-1)])]),_:1})]),_:1}),s(y)?(l(),m("div",X,[d(s(O),{class:"w-12 h-12 text-red-500 mx-auto mb-4",fill:"currentColor"}),e[7]||(e[7]=t("h3",{class:"text-lg font-medium mb-2"},"Thank you for your feedback!",-1)),e[8]||(e[8]=t("p",{class:"text-gray-600 text-sm"},"Your input helps us improve Abalone.",-1))])):(l(),m("div",P,[t("div",Y,[e[4]||(e[4]=t("h3",{class:"text-sm font-medium"}," How likely are you to recommend Abalone to a friend? ",-1)),t("div",I,[t("div",Q,[(l(),m($,null,E(11,o=>t("button",{key:o-1,class:F(["h-10 w-10 rounded text-sm font-medium transition-colors",s(r)===o-1?"bg-blue-600 text-white":"bg-gray-100 hover:bg-gray-200 text-gray-700"]),onClick:ee=>k(o-1)},_(o-1),11,W)),64))]),e[3]||(e[3]=t("div",{class:"flex justify-between text-xs text-gray-500"},[t("span",null,"Not likely"),t("span",null,"Very likely")],-1))])]),t("div",q,[e[5]||(e[5]=t("label",{class:"text-sm font-medium text-gray-700"}," What's the main reason for your score? (optional) ",-1)),R(t("textarea",{"onUpdate:modelValue":e[0]||(e[0]=o=>U(c)?c.value=o:null),rows:"3",class:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm resize-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",placeholder:"Tell us what you think..."},null,512),[[j,s(c)]])]),s(p)?(l(),m("p",G,_(s(p)),1)):v("",!0),t("div",J,[d(s(A),{disabled:s(r)===null||s(n),class:"flex-1",onClick:w},{default:u(()=>[s(n)?(l(),m("span",K)):v("",!0),e[6]||(e[6]=b(" Submit ",-1))]),_:1},8,["disabled"])])]))]),_:1})]),_:1},8,["open"]))}}),re=Object.assign(Z,{__name:"SurveyNpsSurvey"});export{re as N};
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.