Files
appco_dist/.output/public/_nuxt/FVfVRvfu.js
T
2026-01-27 16:02:45 +03:30

2 lines
8.7 KiB
JavaScript

import{U as Se}from"./ScpmmaE4.js";import{d as ne,u as we,r as t,G as re,cZ as ke,k as be,H as ue,o as ce,af as de,bb as Ce,$ as se,ae,ai as Ie,y as f,z as l,a0 as A,A as u,R as k,C as b,T as ve,D as X,a1 as V,bR as U,a5 as ie,J as o,B as $,F as q,c_ as De,d0 as Ee,d1 as Le}from"./Cbt2tPBc.js";import{B as Y}from"./_OSaw0MT.js";import{d as Te}from"./SolGyfyY.js";import{_ as He,C as Re,i as oe}from"./BGrduSck.js";import{S as $e,a as Pe}from"./mPGATRDV.js";/* empty css */import{u as ze}from"./CLMw6_SR.js";import{e as le}from"./DGFRw2HL.js";import{r as Be}from"./DRgfp1up.js";import{s as Me}from"./B1N_kU_k.js";import{_ as Ue}from"./DlAUqK2U.js";const Ae={class:"flex full_story z-400 justify-center"},Xe={key:0,class:"absolute w-full top-0 right-0 left-0 z-1000"},qe={class:"flex items-center gap-2"},Ye={class:"relative"},je={class:"w-2.5rem h-2.5rem rounded-full",alt:""},Ne={key:0,src:He,alt:"",class:"w-15px absolute right-0 bottom-0 bg-white rounded-full"},Oe={class:"text-gray-200 text-shadow text-xs"},We={class:"w-full"},Ve={key:0,class:"absolute w-full bottom-0 right-0 left-0 z-1000 flex items-center gap8 px5 functions_area"},Fe={class:"flex flex-col items-center gap-2 text-white functions-area basic-icon-old"},Ge={class:"text-xs text-red-6"},Je={class:"flex flex-col items-center gap-2 text-white functions-area basic-icon-old"},Ze={class:"text-xs"},Ke=ne({__name:"HighlightStories",props:{id:{},specifyId:{type:Boolean,default:!1},stories:{},highlightId:{},cover:{},title:{}},emits:["update:id","refresh"],setup(p,{emit:P}){const L=we();t();const h=t(null),i=t(0),n=t(0),C=t(0);t("");const c=re(),v=p,_=P,m=t([]),s=t(null),{direction:j,isSwiping:z}=ke(s);t(!1),t(!1),t(!1);const B=be(()=>{if(v.stories?.length)return v.stories[i.value]});let T;const N=ze();ue();const x=t(!1),y=t(!1);t(!1);let I,H=!1,M=0,a=!1;function w(e){c.isSeller?L.push({name:"add-story"}):L.push({name:"user_detail-id",params:{id:B.value?.id}})}function D(e){F=e.touches[0].clientY,M=e.touches[0].clientX,a=!1,H=!1,I=setTimeout(()=>{H=!0,a||fe(e)},300)}function g(e){a||setTimeout(()=>{a=!0,clearTimeout(I)},50)}function R(e){clearTimeout(I);const r=s.value?.querySelector(".account-detail-area"),d=s.value?.querySelector(".functions_area");r&&r.contains(e.target)||d&&d.contains(e.target)||(e.preventDefault(),!H&&!a?Q(e):me(e))}function fe(e){const r=s.value?.querySelector(".account-detail-area"),d=s.value?.querySelector(".functions_area");r&&r.contains(e.target)||d&&d.contains(e.target)||(e.preventDefault(),e.stopPropagation(),x.value=!0,O())}function me(e){e.preventDefault(),e.stopPropagation(),x.value&&Z(),x.value=!1}let F=0;function G(e){(e.touches[0]?.clientY??0)-F>0&&e.preventDefault()}ce(()=>{i.value=v.stories?.findIndex(e=>e?.media?.id===v.id),h.value.activeIndex=i.value,i.value===0&&J(),s.value?.addEventListener("touchstart",D),s.value?.addEventListener("touchend",R),s.value?.addEventListener("touchmove",g),s.value?.addEventListener("touchcancel",R),s.value?.addEventListener("touchmove",G,{passive:!1})}),de(()=>{s.value?.removeEventListener("touchstart",D),s.value?.removeEventListener("touchend",R),s.value?.addEventListener("touchmove",g),s.value?.removeEventListener("touchcancel",R),s.value?.removeEventListener("touchmove",G)}),Ce(()=>{z.value&&j.value==="down"&&_("update:id",void 0)}),se(i,async e=>{await J()});async function J(){C.value=v.stories?.length,m.value=[],await ae(),h.value&&(h.value.activeIndex=i.value);for(let e=0;e<C.value;e++)m.value.push(0);O(),Z()}const he=e=>{h.value=e,y.value=!0},ge=e=>{if(!y.value)return;const r=e?.activeIndex;n.value!==r&&(n.value=r)};function Z(){T=Me(()=>{n.value<m.value.length&&(m.value[n.value]+=10,m.value[n.value]>100&&K())},1e3)}function O(){clearInterval(T),T=void 0}function K(){C.value>n.value+1?n.value++:(O(),n.value=0,_e())}function pe(){n.value!==0?n.value--:xe()}function _e(){v.specifyId?_("update:id",void 0):N.users.length>i.value+1?i.value++:_("update:id",void 0)}function Q(e){if(e.target.closest(".basic-icon-old"))return;const d=s.value?.querySelector(".account-detail-area"),S=s.value?.querySelector(".functions_area");if(d&&d.contains(e.target)||S&&S.contains(e.target))return;const E=e.currentTarget?.clientWidth;let W=0;"touches"in e?W=M:e instanceof MouseEvent&&(W=e.offsetX),W>E/2?c.isRtl?ee():te():c.isRtl?te():ee()}function ee(){m.value[n.value]=100,K()}function te(){m.value[n.value]=0,m.value[n.value-1]=0,pe()}function xe(){i.value!==0&&!v.specifyId&&i.value--}async function ye(){await De(c.useString("areYouSureToDeleteThisHighlight"),v.highlightId??"",Be,()=>_("refresh"))}return se([n,y],([e,r])=>{if(!r||!h.value||!v.stories?.length)return;const d=Math.max(0,Math.min(e,v.stories.length-1));h.value.activeIndex!==d&&setTimeout(()=>{try{h.value?.slideTo(d)}catch{y.value=!1,ae(()=>y.value=!0)}},50)},{immediate:!0}),(e,r)=>{const d=Ie("lazy");return l(),f(A,null,[u("div",Ae,[u("div",{ref_key:"target",ref:s,class:"relative w-full md:w-426px bg-black flex items-center",onClick:Q},[b(ve,{name:"fade"},{default:X(()=>[x.value?k("",!0):(l(),f("div",Xe,[(l(),f("div",{class:"flex gap-2px shadow-xl",key:i.value},[(l(!0),f(A,null,V(p.stories,(S,E)=>(l(),q(Re,{key:E,rtl:o(c).isRTL,percent:m.value[E]},null,8,["rtl","percent"]))),128))])),u("div",{class:"p-2 flex items-center gap-2 account-detail-area justify-between",onClick:U(w,["prevent"])},[u("div",qe,[u("div",Ye,[ie(u("img",je,null,512),[[d,{src:o(c).useDataStorage(p.cover),loading:o(le),error:o(le)}]]),o(c).isSeller?(l(),f("img",Ne)):k("",!0)]),u("div",Oe,$(p.title),1)]),b(Y,{icon:"vuesax-linear:add",class:"text-white rotate-45",size:"32",onClick:r[0]||(r[0]=U(S=>_("update:id",void 0),["stop","prevent"]))})])]))]),_:1}),u("div",We,[(l(),q(o($e),{key:i.value,ref_key:"swiperRef",ref:h,onSwiper:he,onSlideChange:ge,initialSlide:i.value,grabCursor:!0,modules:[],speed:0,noSwiping:!0,class:"mySwiper6"},{default:X(()=>[(l(!0),f(A,null,V(p.stories,(S,E)=>(l(),q(o(Pe),{key:E,class:"self-center"},{default:X(()=>[ie((l(),f("img",{alt:"instagram",class:"w-full bg-black pointer-events-none",key:i.value})),[[d,{src:o(c).useDataStorage(S?.media?.media_url),loading:o(oe),error:o(oe)}]])]),_:2},1024))),128))]),_:1},8,["initialSlide"]))])],512)]),x.value?k("",!0):(l(),f("div",Ve,[o(c).isSeller?(l(),f("div",{key:0,class:"flex gap-5 items-center",dir:"rtl",onClick:U(ye,["stop"])},[u("div",Fe,[b(Y,{icon:"vuesax-linear:trash",color:"red",size:"22",class:"h7"}),u("div",Ge,$(o(c).useString("delete")),1)])])):k("",!0),o(c).isSeller?(l(),f("div",{key:1,class:"flex gap-5 items-center",dir:"rtl",onClick:r[1]||(r[1]=U(S=>o(L).push({name:"highlight-edit-id",params:{id:p.highlightId}}),["stop"]))},[u("div",Je,[b(Y,{icon:"vuesax-linear:edit-2",size:"22",class:"h6"}),u("div",Ze,$(o(c).useString("edit")),1)])])):k("",!0)]))],64)}}}),Qe=Object.assign(Ke,{__name:"HighlightStories"}),et={class:"stories-container -ms4"},tt={class:"border-gray-600 border-1 border-solid w-70px h-70px rounded-full flex items-center justify-center"},st={class:"text-center text-xs mt-7px"},at=["onClick"],it={class:"text-center"},ot={class:"w-full text-center text-xs truncate"},lt=ne({__name:"Highlights",props:{currentUser:{}},setup(p){const P=t([]),L=Ee(),h=Le(),i=t(null),n=t(null),C=t(null),c=t(null),v=t(null),_=t([]),m=t(!1),s=re(),{user:j}=ue();let z,B;const T=p,N=a=>{window.innerWidth<426||(m.value=!0,z=a.clientX,B=v.value.scrollLeft)},x=()=>{m.value=!1},y=a=>{if(!m.value)return;const D=(a.clientX-z)*2;v.value.scrollLeft=B-D},I=async()=>{try{const a=await Te(h?.params?.id||s?.sellerConfig?.store.id,{page:1,limit:40});P.value=a}catch(a){console.log(a)}},H=a=>{console.log(a),i.value=a?.cover_media_url,n.value=a?.id,c.value=a?.cover_media_url,C.value=a?.title,_.value=a?.stories};function M(){I(),i.value=null}return ce(async()=>{document.addEventListener("mouseup",x),document.addEventListener("mousemove",y),await I()}),de(()=>{document.removeEventListener("mouseup",x),document.removeEventListener("mousemove",y)}),(a,w)=>{const D=Se;return l(),f("div",et,[u("div",{ref_key:"scrollContainer",ref:v,class:"scroll-wrapper ps-3",onMousedown:N},[o(j)?.id===T.currentUser?.id?(l(),f("div",{key:0,class:"me-2",onClick:w[0]||(w[0]=()=>o(L).push({name:"highlight-create"}))},[u("div",tt,[b(Y,{icon:"vuesax-linear:add"})]),u("div",st,$(o(s).useString("new")),1)])):k("",!0),(l(!0),f(A,null,V(P.value,g=>(l(),f("div",{key:g?.id,onClick:R=>H(g),class:"story"},[u("div",it,[b(D,{src:g?.cover_media_url,"seen-story":!0,width:"75"},null,8,["src"])]),u("div",ot,$(g?.title),1)],8,at))),128))],544),b(ve,{name:"slide-up",mode:"out-in"},{default:X(()=>[i.value?(l(),q(Qe,{key:0,id:i.value,"onUpdate:id":w[1]||(w[1]=g=>i.value=g),highlightId:n.value,title:C.value,cover:c.value,stories:_.value,onRefresh:M},null,8,["id","highlightId","title","cover","stories"])):k("",!0)]),_:1})])}}}),xt=Object.assign(Ue(lt,[["__scopeId","data-v-4a8cdaa9"]]),{__name:"Highlights"});export{xt as H};