1import{_ as I}from"./DAnVX8lf.js";import{d as B,j,G as u,z as P,o as p,c as h,n as _,v as s,L as C,a as d,t as w,an as z,ap as y,B as S,i as T,w as $,b,e as V,F as E,k as F,g as N}from"./BUzqy6qZ.js";import{_ as U}from"./CHMjseMp.js";const D={class:"w-full"},L=["disabled"],q={class:"mt-3 block"},G=["disabled"],H=B({__name:"PollAnswerItem",props:{data:{},highestCount:{},open:{},total:{},voted:{type:Boolean}},emits:["handleUpdate"],setup(f,{emit:l}){const e=f,c=j({count:e.data.count||0}),g=l,i=u(()=>e.data.id===e.open),k=u(()=>c.count/e.total*100);P(()=>e.data.count,()=>{c.count=e.data.count||0});const v=(t,o,r)=>o+(r-o)*(t/100),a=u(()=>{if(!e.data.count||!e.highestCount)return 1;const t=e.data.count/e.highestCount*100,o=.4,r=1,m=v(t,o,r);return m===r?1.2:m}),n=()=>{if(!e.open){const t={id:e.data.id,collection:"poll_answer_item",data:{count:1}};z(t).then(o=>{o.data.value&&!o.data.value.cached&&(c.count=c.count+1),g("handleUpdate",{clickedIndex:e.data.id})}).catch(o=>{console.error(o)})}};return(t,o)=>(p(),h("div",D,[t.data.emoji?(p(),h("button",{key:0,disabled:t.voted,class:_(["h-[94px] w-[94px] rounded-full text-[60px] transition-transform ease-out",{"hover:bg-app-grey--dark":!t.voted,"bg-black":s(i),"bg-white":!s(i)}]),style:C({transform:t.voted?`scale(${s(a)})`:void 0}),onClick:n},[d("span",q,w(t.data.emoji),1)],14,L)):(p(),h("button",{key:1,class:_(["relative w-full overflow-hidden rounded-md bg-white p-1 text-lg font-bold uppercase transition-colors duration-150 ease-out",{"hover:bg-app-grey--dark":!t.voted}]),disabled:t.voted,onClick:n},[d("span",{class:_(["relative z-10",{"text-white mix-blend-difference":t.voted,"text-black":!t.voted}])},w(t.data.label),3),d("span",{class:"absolute bottom-0 left-0 top-0 bg-black transition-[width] ease-out",style:C({width:t.voted?`${s(k)}%`:"0%"})},null,4)],10,G))]))}}),M={class:"grid grid-cols-4 gap-x-4 md:grid-cols-12"},J={class:"col-span-full md:col-span-8 md:col-start-3"},K={class:"app-gradient-powned-default rounded-md p-7 text-center md:p-12"},W=B({__name:"PollBlock",props:{data:{}},setup(f){const l=f,e=y(`poll-block_${l.data.id}`),c=u(()=>l.data.answers.some(a=>a.emoji));S(()=>{e.value&&v()});const g=u(()=>{let a=0;return l.data.answers.forEach(n=>{a+=n.count}),a}),i=j({clicked:void 0}),k=u(()=>[...l.data.answers].sort((n,t)=>t.count-n.count)[0].count),v=a=>{if(i.clicked=a?a.clickedIndex:e.value?parseInt(e.value):void 0,a){const n=new Date;n.setTime(n.getTime()+24*60*60*1e3);const t=y(`poll-block_${l.data.id}`,{expires:n});t.value=a.clickedIndex+""}};return(a,n)=>{const t=I,o=N,r=H,m=U;return p(),T(m,null,{default:$(()=>[d("div",M,[d("div",J,[d("div",K,[b(t,{title:"Stelling",size:"small",inverted:!0}),b(o,{variant:"h2",class:"mb-7 mt-2"},{default:$(()=>[V(w(a.data.question),1)]),_:1}),d("ol",{class:_(["m-auto max-w-md",{"flex justify-center":s(c)}])},[(p(!0),h(E,null,F(a.data.answers,(x,A)=>(p(),h("li",{key:x.id,class:_({"mb-4":A!==a.data.answers.length-1&&!s(c),"mx-2":s(c)})},[b(r,{data:x,total:s(g),open:i.clicked,"highest-count":s(k),voted:!!i.clicked,onHandleUpdate:v},null,8,["data","total","open","highest-count","voted"])],2))),128))],2)])])])]),_:1})}}});
1export{W 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.