1import{_ as j}from"./t81qrEwv.js";import{_ as q}from"./BdrUqFCS.js";import{_ as G,I as Q,S as Y,d as h,b as i,e as Z,J as ee,v as te,u as ae,c,f as M,a as o,l as le,F as X,r as D,g as y,w as x,s as oe,T as ne,L as se,o as u,p as re}from"./HyZdrKlb.js";import{u as ie}from"./UnPAzSCw.js";const ue={class:"fabric-detail-page"},ce={class:"fabric-detail-page__grid"},ve=["onClick"],de={class:"fabric-detail-page__image"},me=["src","alt"],he={key:0,class:"fabric-lightbox"},pe={class:"fabric-lightbox__container"},fe=["src","alt"],ge={class:"fabric-lightbox__thumbs"},_e=["onClick"],be=["src","alt"],ye={__name:"[id]",setup(we){const g=Q(),F=Y(),R=se();ie();const p=h(()=>g.params.group),A=h(()=>g.params.id),d=i(!1),l=i(0),n=i(0),C=i(0),S=i(0),_=i(!1),t=i(null),v=i(null),I=i(!0),T=i(null),H=async()=>{I.value=!0,T.value=null;try{const e=await $fetch(`/api/fabrics/${p.value}/${A.value}`);if(e.success&&(t.value=e.data,t.value?.group?.gallery?.url)){const{data:a}=await $fetch(`${R.public.apiBase}/gallery/category/${t.value.group.gallery.url}`);v.value=a}}catch(e){T.value="ÐÑибка загÑÑзки даннÑÑ
о Ñкани",console.error("Error loading fabric:",e),e.statusCode===404&&await F.push(`/fabrics/${p.value}`)}finally{I.value=!1}},s=h(()=>t.value?.images?t.value.images.map(e=>({id:e.id,url:e.file.url,file_id:e.file.id})):[]),L=h(()=>s.value[l.value]),N=h(()=>{const e=[{title:"ÐлавнаÑ",to:"/"},{title:"ÐоÑпоÑаÑÐ¸Ð²Ð½Ð°Ñ Ð¾Ð´ÐµÐ¶Ð´Ð°",to:"/category",hideOnMobile:!0}],a=t.value?.group?.gallery;return a?.url&&a?.header&&e.push({title:a.header,to:`/category/${a.url}`}),e.push({title:t.value?.group?.name||"",to:`/fabrics/${p.value}`}),e.push({title:t.value?.name||"",hideOnMobile:!0}),e}),O=h(()=>{let e=[];return t.value?.group?.gallery?(e.push({name:v.value?.back_button_text||v.value?.menu_title||t.value.group.gallery.header||"ТоваÑÑ",link:`/category/${t.value.group.gallery.url}`,bold:!0}),v.value?.has_models&&v.value?.model_group_url&&v.value?.model_group_name&&e.push({name:v.value.model_group_name,link:`/models/${v.value.model_group_url}`,bold:!0}),t.value.group.gallery.has_branding&&e.push({name:"ÐаÑианÑÑ Ð±ÑендиÑованиÑ",link:`/branding/${t.value.group.gallery.url}`,bold:!0,outline:!0}),e.push({name:"Ткани",link:`/fabrics/${p.value}`,bold:!0,outline:!0})):e=[{name:"главнаÑ",link:"/"},{name:"каÑалоги Ñканей",link:"/fabrics"},{name:t.value?.group?.name||"",link:`/fabrics/${p.value}`}],{title:t.value?.name||"",elements:e}}),U=e=>{l.value=e,d.value=!0,document.body.style.overflow="hidden";const a=s.value[e].file_id;window.history.replaceState({gallery:!0},"",`#photo-${a}`)},b=()=>{d.value=!1,document.body.style.overflow="",n.value=0,window.history.replaceState(null,"",window.location.pathname)},w=e=>{l.value=e,n.value=0;const a=s.value[e].file_id;window.history.replaceState({gallery:!0},"",`#photo-${a}`)},k=()=>{l.value<s.value.length-1&&w(l.value+1)},$=()=>{l.value>0&&w(l.value-1)},V=e=>{C.value=e.touches[0].clientX,S.value=Date.now(),_.value=!0},W=e=>{if(!_.value)return;const r=e.touches[0].clientX-C.value;l.value===0&&r>0||l.value===s.value.length-1&&r<0?n.value=r*.3:n.value=r},z=()=>{if(!_.value)return;const e=50,a=300,r=Date.now()-S.value;Math.abs(n.value)>e||r<a&&Math.abs(n.value)>20?n.value>0&&l.value>0?$():n.value<0&&l.value<s.value.length-1?k():n.value=0:n.value=0,_.value=!1},B=()=>{d.value&&(d.value=!1,document.body.style.overflow="")},E=e=>{if(d.value)switch(e.key){case"Escape":b();break;case"ArrowRight":k();break;case"ArrowLeft":$();break}},J=()=>{if(g.hash?.startsWith("#photo-")){const e=g.hash.replace("#photo-",""),a=s.value.findIndex(r=>String(r.file_id)===e);a!==-1&&(l.value=a,d.value=!0,document.body.style.overflow="hidden")}};return Z(async()=>{document.body.classList.remove("dis-scroll"),document.body.style.overflow="",document.body.style.position="",document.body.style.top="",window.lenis&&window.lenis.start(),await H(),s.value.length>0&&J(),window.addEventListener("keydown",E),window.addEventListener("popstate",B)}),ee(()=>{window.removeEventListener("keydown",E),window.removeEventListener("popstate",B),document.body.style.overflow=""}),te(t,e=>{e?.name&&console.log("Setting title to:",e.name)}),ae(()=>({title:t.value?.name?`${t.value.name} - Stoneblack`:"",meta:[{name:"description",content:t.value?.name?`${t.value.name}. ${t.value.property?.name||""}`:"ÐаÑалог Ñканей Ð´Ð»Ñ ÐºÐ¾ÑпоÑаÑивной одеждÑ."},{property:"og:title",content:t.value?.name?`${t.value.name} - Stoneblack`:""},{property:"og:description",content:t.value?.name?`${t.value.name}. ${t.value.property?.name||""}`:"ÐаÑалог Ñканей Ð´Ð»Ñ ÐºÐ¾ÑпоÑаÑивной одеждÑ."}]})),(e,a)=>{const r=j,K=q;return u(),c("div",ue,[M(r,{items:N.value},null,8,["items"]),M(K,{head:O.value,menu:!0},null,8,["head"]),o("div",ce,[(u(!0),c(X,null,D(s.value,(f,m)=>(u(),c("div",{key:f.id,class:"fabric-detail-page__item",onClick:P=>U(m)},[o("div",de,[o("img",{src:f.url,alt:`${t.value?.name} - ${m+1}`},null,8,me)])],8,ve))),128))]),(u(),le(ne,{to:"body"},[d.value?(u(),c("div",he,[o("div",{class:"fabric-lightbox__overlay",onClick:b}),o("div",pe,[o("button",{class:"fabric-lightbox__close",onClick:b,"aria-label":"ÐакÑÑÑÑ"},a[1]||(a[1]=[o("svg",{width:"30",height:"30",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[o("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])),o("div",{class:"fabric-lightbox__main",onClick:b,onTouchstart:V,onTouchmove:W,onTouchend:z},[L.value?(u(),c("img",{key:0,src:L.value.url,alt:`${t.value?.name} - ${l.value+1}`,class:"fabric-lightbox__image",style:oe({transform:`translateX(${n.value}px)`}),onClick:a[0]||(a[0]=x(()=>{},["stop"]))},null,12,fe)):y("",!0),l.value>0?(u(),c("button",{key:1,class:"fabric-lightbox__nav fabric-lightbox__nav--prev",onClick:x($,["stop"]),"aria-label":"ÐÑедÑдÑÑее изобÑажение"},a[2]||(a[2]=[o("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[o("polyline",{points:"15 18 9 12 15 6"})],-1)]))):y("",!0),l.value<s.value.length-1?(u(),c("button",{key:2,class:"fabric-lightbox__nav fabric-lightbox__nav--next",onClick:x(k,["stop"]),"aria-label":"СледÑÑÑее изобÑажение"},a[3]||(a[3]=[o("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[o("polyline",{points:"9 18 15 12 9 6"})],-1)]))):y("",!0)],32),o("div",ge,[(u(!0),c(X,null,D(s.value,(f,m)=>(u(),c("div",{key:f.id,class:re(["fabric-lightbox__thumb",{active:l.value===m}]),onClick:P=>w(m)},[o("img",{src:f.url,alt:`ÐиниаÑÑÑа ${m+1}`},null,8,be)],10,_e))),128))])])])):y("",!0)]))])}}},Se=G(ye,[["__scopeId","data-v-c0545b21"]]);export{Se 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.