Files
appco_dist/.output/public/_nuxt/DVZD4ngf.js
T
2025-08-18 18:29:28 +03:30

2 lines
2.6 KiB
JavaScript

import{d as w,k as y,al as S,y as v,z as h,a7 as g,A as u,H as c,am as C,a4 as _,ef as x,r as f,C as b,D as z}from"./B3Hm6diO.js";import{i as k}from"./DS96Ojhv.js";import{_ as $}from"./DQNs7P-A.js";import{f as B,m as R}from"./BSwG5mSN.js";const D=["id","value"],j=["for"],L=w({__name:"StoriesComponent",props:{story:{},selectedStory:{}},emits:["update:selectedStory"],setup(d,{emit:m}){const a=d,l=m,i=y(()=>{var e,t;return(t=a.selectedStory)==null?void 0:t.includes((e=a.story)==null?void 0:e.id)}),s=y({get(){return a.selectedStory},set(e){l("update:selectedStory",e)}});function p(){var t,r,o;const e=(t=s.value)==null?void 0:t.findIndex(n=>n===a.story.id);e===-1?(r=s.value)==null||r.push(a.story.id):(o=s.value)==null||o.splice(e,1)}return(e,t)=>{var o;const r=S("lazy");return h(),v("div",{class:"w-full h-full aspect-[2/3] relative",onClick:p},[g(u("img",{class:_(["w-full h-full object-cover aspect-[2/3]",i.value&&"bg-gray-500 opacity-50"])},null,2),[[r,{src:c(C)((o=e.story)==null?void 0:o.media_url),loading:c(k),error:c(k)}]]),g(u("input",{type:"checkbox",id:`story-${e.story.id}`,value:e.story,"onUpdate:modelValue":t[0]||(t[0]=n=>s.value=n),class:"absolute opacity-0 w-full h-full peer"},null,8,D),[[x,s.value]]),u("label",{for:`story-${e.story.id}`,class:"absolute bottom-2 right-2 w-5 h-5 rounded border-1 border-black cursor-pointer transition-all group-hover:ring-2 group-hover:ring-blue-400 peer-checked:bg-black peer-checked:border-black"},[(h(),v("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"3","stroke-linecap":"round","stroke-linejoin":"round",class:_(["w-18px h-18px text-white bg-black transition-opacity",i.value?"peer-checked:opacity-100":"opacity-0"])},t[1]||(t[1]=[u("path",{d:"M5 12l5 5L20 7"},null,-1)]),2))],8,j)])}}}),U={class:"cropper-wrapper"},M=w({__name:"ProfilePictureEditor",props:{src:{}},emits:["onCropped"],setup(d,{expose:m,emit:a}){const l=d,i=a,s=f(null),p=f(null);f(!1);const e=y(()=>l.src.startsWith("data:")?l.src:`${l.src}?cacheBust=${Date.now()}`);return m({crop:()=>{const r=p.value;if(!r)return;const o=r.getResult({size:{width:400,height:400},mime:"image/jpeg",quality:.9});o!=null&&o.canvas?(s.value=o.canvas.toDataURL(),i("onCropped",s.value)):console.warn("❗ Failed to get canvas result")}}),(r,o)=>{const n=$;return h(),v("div",U,[b(n,null,{default:z(()=>[b(c(B),{ref_key:"cropperRef",ref:p,class:"cropper",src:e.value,"stencil-component":c(R),"stencil-props":{aspectRatio:1,movable:!1,resizable:!1},"stencil-size":{width:340,height:340},"image-restriction":"stencil"},null,8,["src","stencil-component"])]),_:1})])}}});export{L as _,M as a};