1import{f as T,r as u,h as $,u as G,g as J,q as P,c as l,i as h,a as e,j as o,B as N,t as n,A as X,F,k as C,b as D,w as B,e as Z,o as a,d as x}from"#entry";import{u as ee}from"./CI36eZX6.js";import{u as te}from"./Dy9pVEbO.js";import"./DKLWY9DJ.js";const se={class:"min-h-screen bg-gray-50 py-8"},oe={class:"relative max-w-3xl mx-auto px-4 sm:px-6 lg:px-8 h-full flex items-center"},le={class:"text-center w-full"},ae={class:"text-xl text-white"},ie={key:0},re={key:1},ne={class:"max-w-3xl mx-auto px-4 sm:px-6 lg:px-8"},de={key:0,class:"text-center mb-8"},ue={class:"text-xl text-gray-600"},ce={key:0},ge={key:1},fe={key:1,class:"bg-white rounded-lg shadow-md p-6 mb-8"},me={class:"grid md:grid-cols-2 gap-6 items-center"},he={key:0,class:"rounded-lg overflow-hidden"},ve=["src","alt"],be={key:1,class:"bg-gray-200 rounded-lg h-64 flex items-center justify-center text-6xl"},_e={key:2,class:"mb-8"},pe={class:"flex justify-between items-center mb-2"},ye={class:"text-sm font-medium text-gray-700"},xe={class:"text-sm text-gray-500"},we={class:"w-full bg-gray-200 rounded-full h-2"},ke={key:3,class:"bg-white rounded-lg shadow-md p-8"},ze={class:"space-y-3 mb-6"},qe=["onClick"],je=["src","alt"],Fe={key:1,class:"w-16 h-16 rounded-full bg-gray-200 flex items-center justify-center text-2xl mr-4"},Ce={class:"text-lg font-semibold text-gray-900"},De={class:"text-sm text-gray-600"},Be={key:0},Ae={key:4,class:"bg-white rounded-lg shadow-md p-8"},Me={key:0,class:"bg-blue-50 border border-blue-200 rounded-lg p-4 mb-6 flex items-center"},Se=["src","alt"],Qe={key:1,class:"w-12 h-12 rounded-full bg-gray-200 flex items-center justify-center text-xl mr-3"},$e={class:"font-semibold text-blue-900"},Pe={class:"text-sm text-blue-700"},Ne={class:"text-2xl font-semibold text-gray-900 mb-6"},We={class:"space-y-3"},Le=["onClick"],Ie={class:"flex items-center"},Re={class:"text-2xl mr-3"},Ye={class:"text-lg"},Ee={class:"flex justify-between mt-6"},Ve={key:1},Ue={key:5,class:"space-y-6"},He={class:"bg-white rounded-lg shadow-md p-8 text-center"},Oe={class:"text-3xl font-bold text-gray-900 mb-2"},Ke={key:0},Te={key:1},Ge={class:"text-gray-600 mb-6"},Je={key:0},Xe={key:1},Ze={key:1,class:"bg-green-50 border border-green-200 rounded-lg p-4 mb-6"},et={key:0,class:"bg-yellow-50 border border-yellow-200 rounded-lg p-6 text-center"},tt={key:1,class:"grid md:grid-cols-2 gap-6"},st={class:"relative"},ot=["src","alt"],lt={key:1,class:"w-full h-48 bg-gray-200 flex items-center justify-center"},at={key:2,class:"absolute top-2 left-2"},it={class:"p-4"},rt={class:"text-sm text-gray-500"},nt={class:"text-xl font-semibold text-gray-900 mb-2"},dt={class:"text-sm text-gray-600 mb-4"},ut={class:"flex justify-between items-center"},ct={class:"text-2xl font-bold text-gray-900"},gt=["href","onClick"],ft={class:"flex justify-center gap-4 mt-8"},pt=T({__name:"quiz",setup(mt){const{fetchImageWithFallback:A}=ee(),p=u(""),v=u(null);$(async()=>{try{const t=await A("dog food nutrition quiz",{orientation:"landscape",width:1920,height:400});t&&(p.value=t.url)}catch{}try{const t=await A("dog eating healthy food",{orientation:"landscape",width:600,height:400});t&&(v.value=t)}catch{}});const w=G(),b=J(),g=u(0),k=u(!1),c=u(!1),d=u({}),z=u([]),W=u(""),L=u(!1);u(!1);const y=u([]),r=u(null),M=u(!0),S=[{id:"breed_size",question:"What size is your dog?",options:[{label:"Small (under 10kg)",value:"small",emoji:"ð"},{label:"Medium (10-25kg)",value:"medium",emoji:"ð¶"},{label:"Large (over 25kg)",value:"large",emoji:"ð¦®"}]},{id:"life_stage",question:"How old is your dog?",options:[{label:"Puppy (under 1 year)",value:"puppy",emoji:"ð¾"},{label:"Adult (1-7 years)",value:"adult",emoji:"ð¦´"},{label:"Senior (7+ years)",value:"senior",emoji:"ð´"}]},{id:"food_type",question:"What type of food do you prefer?",options:[{label:"Dry Food (Kibble)",value:"dry",emoji:"ð¥"},{label:"Wet Food (Cans/Pouches)",value:"wet",emoji:"ð¥«"},{label:"Raw Food",value:"raw",emoji:"ð¥©"},{label:"No Preference",value:"",emoji:"ð¤·"}]},{id:"special_needs",question:"Does your dog have any special dietary needs?",options:[{label:"Grain Free",value:"grain-free",emoji:"ð¾"},{label:"Hypoallergenic",value:"hypoallergenic",emoji:"ð"},{label:"Weight Management",value:"weight-management",emoji:"âï¸"},{label:"Sensitive Stomach",value:"sensitive-stomach",emoji:"ð©º"},{label:"No Special Needs",value:"",emoji:"â
"}]},{id:"budget",question:"What's your monthly budget for dog food?",options:[{label:"Budget Friendly (Under £30)",value:"
10-30",emoji:"ð·"},{label:"Mid-Range (£30-£60)",value:"30-60",emoji:"ð°"},{label:"Premium (£60+)",value:"60+",emoji:"ð"},{label:"Any Budget",value:"",emoji:"ð¤·"}]}],_=P(()=>r.value?S.filter(t=>!(t.id==="breed_size"&&r.value?.weight_kg||t.id==="life_stage"&&r.value?.birth_date)):S),q=P(()=>_.value[g.value]),Q=async()=>{if(!b.isAuthenticated){M.value=!1,c.value=!0;return}try{const{data:t,error:s}=await w.from("doghealthy_dogs").select("*").eq("user_id",b.userId).eq("is_active",!0).order("created_at",{ascending:!1});if(s)throw s;y.value=t||[],y.value.length===0&&(c.value=!0)}catch(t){console.error("Error loading dogs:",t),c.value=!0}finally{M.value=!1}},I=t=>{if(r.value=t,t.weight_kg&&(t.weight_kg<10?d.value.breed_size="small":t.weight_kg<=25?d.value.breed_size="medium":d.value.breed_size="large"),t.birth_date){const s=E(t.birth_date);s<1?d.value.life_stage="puppy":s>=7?d.value.life_stage="senior":d.value.life_stage="adult"}c.value=!0},R=()=>{r.value=null,c.value=!0},Y=t=>{const s=new Date(t),f=new Date,i=f.getFullYear()-s.getFullYear(),m=f.getMonth()-s.getMonth();return i===0?`${m} month${m!==1?"s":""} old`:m<0?`${i-1} year${i!==1?"s":""} old`:`${i} year${i!==1?"s":""} old`},E=t=>{const s=new Date(t);return new Date().getFullYear()-s.getFullYear()},V=async t=>{d.value[q.value.id]=t,g.value<_.value.length-1?g.value++:await H()},U=()=>{g.value>0&&g.value--},H=async()=>{try{let t=w.from("doghealthy_dog_food_products").select("*").eq("is_active",!0);if(d.value.breed_size&&(t=t.or(`breed_size.eq.${d.value.breed_size},breed_size.eq.all`)),d.value.life_stage&&(t=t.or(`life_stage.eq.${d.value.life_stage},life_stage.eq.all`)),d.value.food_type&&(t=t.eq("food_type",d.value.food_type)),d.value.special_needs&&(t=t.eq("special_diet",d.value.special_needs)),d.value.budget){const[i,m]=d.value.budget.split("-").map(j=>j==="+"?999999:parseFloat(j));m<999999?t=t.gte("price_gbp",i).lte("price_gbp",m):t=t.gte("price_gbp",i)}const{data:s,error:f}=await t.order("avg_rating",{ascending:!1}).limit(4);if(f){console.error("Error fetching recommendations:",f);return}z.value=s||[],k.value=!0}catch(t){console.error("Error:",t)}},O=async t=>{try{await w.from("doghealthy_affiliate_clicks").insert({product_id:t.id,user_id:b.userId||null,retailer:t.retailer,utm_source:"doghealthy",utm_medium:"quiz",utm_campaign:"recommendation"})}catch(s){console.error("Error tracking click:",s)}},K=()=>{g.value=0,k.value=!1,c.value=!1,d.value={},L.value=!1,W.value="",r.value=null,b.isAuthenticated?Q():c.value=!0};return $(()=>{Q()}),te({title:"Dog Food Quiz â Personalised Recommendations",description:"Take the DogHealthy UK dog food quiz. Answer a few questions about breed, age, allergies and budget to get personalised dog food recommendations in minutes.",keywords:"dog food quiz UK, personalised dog food, dog nutrition quiz, best dog food recommendation, DogHealthy quiz, puppy food quiz",path:"/food-finder/quiz"}),(t,s)=>{const f=Z;return a(),l("div",se,[o(p)?(a(),l("div",{key:0,class:"relative h-48 bg-cover bg-center mb-8",style:N({backgroundImage:`url(${o(p)})`})},[s[1]||(s[1]=e("div",{class:"absolute inset-0 bg-black opacity-30"},null,-1)),e("div",oe,[e("div",le,[s[0]||(s[0]=e("h1",{class:"text-4xl font-bold text-white mb-2"},"ð¯ Dog Food Finder Quiz",-1)),e("p",ae,[o(r)?(a(),l("span",ie,"Find the perfect food for "+n(o(r).name),1)):(a(),l("span",re,"Answer a few questions to find the perfect food for your dog"))])])])],4)):h("",!0),e("div",ne,[o(p)?h("",!0):(a(),l("div",de,[s[2]||(s[2]=e("h1",{class:"text-4xl font-bold text-gray-900 mb-2"},"ð¯ Dog Food Finder Quiz",-1)),e("p",ue,[o(r)?(a(),l("span",ce,"Find the perfect food for "+n(o(r).name),1)):(a(),l("span",ge,"Answer a few questions to find the perfect food for your dog. Our personalized quiz considers your dog's breed, age, activity level, and dietary needs to recommend the best nutrition options."))])])),o(v)&&!o(c)?(a(),l("div",fe,[e("div",me,[s[3]||(s[3]=X('<div><h2 class="text-2xl font-bold text-gray-900 mb-3">Why Take Our Quiz?</h2><p class="text-gray-600 mb-3"> Every dog is unique, and their nutritional needs vary based on multiple factors. Our quiz helps you find the perfect food match by considering: </p><ul class="space-y-2 text-gray-600"><li class="flex items-start"><svg class="w-5 h-5 text-green-500 mr-2 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg><span>Breed size and specific nutritional requirements</span></li><li class="flex items-start"><svg class="w-5 h-5 text-green-500 mr-2 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg><span>Life stage (puppy, adult, or senior)</span></li><li class="flex items-start"><svg class="w-5 h-5 text-green-500 mr-2 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg><span>Activity level and energy needs</span></li><li class="flex items-start"><svg class="w-5 h-5 text-green-500 mr-2 mt-0.5 flex-shrink-0" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"></path></svg><span>Special dietary requirements and preferences</span></li></ul></div>',1)),o(v)?(a(),l("div",he,[e("img",{src:o(v).url,alt:o(v).description||"Dog food quiz",class:"w-full h-auto object-cover"},null,8,ve)])):(a(),l("div",be," ð "))])])):h("",!0),o(c)?(a(),l("div",_e,[e("div",pe,[e("span",ye,"Question "+n(o(g)+1)+" of "+n(o(_).length),1),e("span",xe,n(Math.round((o(g)+1)/o(_).length*100))+"% Complete",1)]),e("div",we,[e("div",{class:"bg-blue-600 h-2 rounded-full transition-all duration-300",style:N({width:`${(o(g)+1)/o(_).length*100}%`})},null,4)])])):h("",!0),!o(c)&&o(b).isAuthenticated&&o(y).length>0?(a(),l("div",ke,[s[4]||(s[4]=e("h2",{class:"text-2xl font-semibold text-gray-900 mb-4"}," Which dog are you finding food for? ",-1)),s[5]||(s[5]=e("p",{class:"text-gray-600 mb-6"}," We'll use your dog's info to give personalized recommendations! ",-1)),e("div",ze,[(a(!0),l(F,null,C(o(y),i=>(a(),l("button",{key:i.id,onClick:m=>I(i),class:"w-full text-left p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-all flex items-center"},[i.photo_url?(a(),l("img",{key:0,src:i.photo_url,alt:i.name,class:"w-16 h-16 rounded-full object-cover mr-4"},null,8,je)):(a(),l("div",Fe," ð ")),e("div",null,[e("div",Ce,n(i.name),1),e("div",De,[x(n(i.breed||"Mixed Breed")+" ",1),i.birth_date?(a(),l("span",Be,"⢠"+n(Y(i.birth_date)),1)):h("",!0)])])],8,qe))),128))]),e("div",{class:"text-center"},[e("button",{onClick:R,class:"text-blue-600 hover:text-blue-700 font-medium"}," Or answer questions manually â ")])])):!o(k)&&o(c)?(a(),l("div",Ae,[o(r)?(a(),l("div",Me,[o(r).photo_url?(a(),l("img",{key:0,src:o(r).photo_url,alt:o(r).name,class:"w-12 h-12 rounded-full object-cover mr-3"},null,8,Se)):(a(),l("div",Qe," ð ")),e("div",null,[e("div",$e,"Finding food for "+n(o(r).name),1),e("div",Pe,n(o(r).breed||"Mixed Breed"),1)])])):h("",!0),e("h2",Ne,n(o(q).question),1),e("div",We,[(a(!0),l(F,null,C(o(q).options,i=>(a(),l("button",{key:i.value,onClick:m=>
1V(i.value),class:"w-full text-left p-4 border-2 border-gray-200 rounded-lg hover:border-blue-500 hover:bg-blue-50 transition-all"},[e("div",Ie,[e("span",Re,n(i.emoji),1),e("span",Ye,n(i.label),1)])],8,Le))),128))]),e("div",Ee,[o(g)>0?(a(),l("button",{key:0,onClick:U,class:"px-6 py-2 text-gray-700 hover:text-gray-900"}," â Previous ")):(a(),l("div",Ve)),D(f,{to:"/food-finder",class:"text-gray-500 hover:text-gray-700"},{default:B(()=>[...s[6]||(s[6]=[x(" Skip Quiz ",-1)])]),_:1})])])):(a(),l("div",Ue,[e("div",He,[s[8]||(s[8]=e("div",{class:"text-6xl mb-4"},"ð",-1)),e("h2",Oe,[o(r)?(a(),l("span",Ke,"Perfect Food for "+n(o(r).name)+"!",1)):(a(),l("span",Te,"Your Perfect Match!"))]),e("p",Ge,[o(r)?(a(),l("span",Je," Based on "+n(o(r).name)+"'s profile and your preferences, here are the best foods: ",1)):(a(),l("span",Xe," Based on your answers, here are the best foods for your dog: "))]),(a(),l("div",Ze,[...s[7]||(s[7]=[e("p",{class:"text-green-800"},"â
Check your email for your free nutrition guide!",-1)])]))]),o(z).length===0?(a(),l("div",et,[s[10]||(s[10]=e("svg",{class:"mx-auto h-12 w-12 text-yellow-500 mb-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})],-1)),s[11]||(s[11]=e("h3",{class:"text-lg font-semibold text-yellow-900 mb-2"},"No Products Available Yet",-1)),s[12]||(s[12]=e("p",{class:"text-yellow-800 mb-4"}," We're currently building our product database. Check back soon! ",-1)),D(f,{to:"/food-finder",class:"inline-block bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded-lg transition-colors"},{default:B(()=>[...s[9]||(s[9]=[x(" Go to Food Finder ",-1)])]),_:1})])):(a(),l("div",tt,[(a(!0),l(F,null,C(o(z),(i,m)=>(a(),l("div",{key:i.id,class:"bg-white rounded-lg shadow-md overflow-hidden"},[e("div",st,[i.image_url?(a(),l("img",{key:0,src:i.image_url,alt:i.name,class:"w-full h-48 object-cover"},null,8,ot)):(a(),l("div",lt,[...s[13]||(s[13]=[e("span",{class:"text-6xl"},"ð",-1)])])),m===0?(a(),l("div",at,[...s[14]||(s[14]=[e("span",{class:"bg-yellow-500 text-white text-sm font-semibold px-3 py-1 rounded"}," ð #1 Recommended ",-1)])])):h("",!0)]),e("div",it,[e("p",rt,n(i.brand),1),e("h3",nt,n(i.name),1),e("p",dt,n(i.description),1),e("div",ut,[e("div",ct,"£"+n(i.price_gbp.toFixed(2)),1),e("a",{href:i.affiliate_link,onClick:j=>O(i),target:"_blank",rel:"noopener sponsored",class:"bg-blue-600 hover:bg-blue-700 text-white px-6 py-3 rounded-lg transition-colors font-semibold"}," Buy Now ",8,gt)])])]))),128))])),e("div",ft,[e("button",{onClick:K,class:"px-6 py-3 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors"}," Retake Quiz "),D(f,{to:"/food-finder",class:"px-6 py-3 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition-colors"},{default:B(()=>[...s[15]||(s[15]=[x(" View All Products ",-1)])]),_:1})])]))])])}}});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.