2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{d as he,r as x,cF as Me,b6 as ye,k as se,a1 as ae,y as m,z as u,S as G,A as y,u as Te,G as $e,cY as Pe,J as ze,o as Ie,af as Be,ad as De,aj as Le,C as U,U as ue,D as F,a2 as de,a3 as fe,bY as ve,a7 as Q,H as o,ak as ee,ai as X,B as te,F as V,cZ as He,c_ as qe}from"./B565zvD7.js";import{_ as Ae}from"./BDVKAVvV.js";/* empty css */import{_ as Oe}from"./CpmOJupQ.js";/* empty css */import{_ as Fe}from"./DlAUqK2U.js";import{_ as Ve}from"./DlHdCPWP.js";/* empty css */import{B as pe}from"./B8tjfeLk.js";import{S as je,a as me}from"./ZPvgEDtl.js";import{e as Ne,c as Ue,a as Xe}from"./DUQKQ_0t.js";import{g as Re,h as We,i as Ye}from"./BgEwnza3.js";/* empty css */import{u as Ze}from"./DLptWbDk.js";import{e as ge}from"./DWEdiVkG.js";import{u as Ge,s as Je}from"./xNI5qY7-.js";import{s as Ke}from"./x_rD_Ya3.js";function Qe(C){let{swiper:a,duration:$,transformElements:g}=C;const{activeIndex:b}=a;if(a.params.virtualTranslate&&$!==0){let i=!1,r;r=g,r.forEach(f=>{Re(f,()=>{if(i||!a||a.destroyed)return;i=!0,a.animating=!1;const P=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0});a.wrapperEl.dispatchEvent(P)})})}}function et(C){let{swiper:a,extendParams:$,on:g}=C;$({creativeEffect:{limitProgress:1,shadowPerProgress:!1,progressMultiplier:1,perspective:!0,prev:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1},next:{translate:[0,0,0],rotate:[0,0,0],opacity:1,scale:1}}});const b=f=>typeof f=="string"?f:`${f}px`;Ne({effect:"creative",swiper:a,on:g,setTranslate:()=>{const{slides:f,wrapperEl:P,slidesSizesGrid:h}=a,d=a.params.creativeEffect,{progressMultiplier:k}=d,w=a.params.centeredSlides,c=We(a);if(w){const q=h[0]/2-a.params.slidesOffsetBefore||0;P.style.transform=`translateX(calc(50% - ${q}px))`}for(let q=0;q<f.length;q+=1){const z=f[q],j=z.progress,v=Math.min(Math.max(z.progress,-d.limitProgress),d.limitProgress);let E=v;w||(E=Math.min(Math.max(z.originalProgress,-d.limitProgress),d.limitProgress));const M=z.swiperSlideOffset,_=[a.params.cssMode?-M-a.translate:-M,0,0],T=[0,0,0];let L=!1;a.isHorizontal()||(_[1]=_[0],_[0]=0);let p={translate:[0,0,0],rotate:[0,0,0],scale:1,opacity:1};v<0?(p=d.next,L=!0):v>0&&(p=d.prev,L=!0),_.forEach((D,I)=>{_[I]=`calc(${D}px + (${b(p.translate[I])} * ${Math.abs(v*k)}))`}),T.forEach((D,I)=>{let O=p.rotate[I]*Math.abs(v*k);T[I]=O}),z.style.zIndex=-Math.abs(Math.round(j))+f.length;const R=_.join(", "),A=`rotateX(${c(T[0])}deg) rotateY(${c(T[1])}deg) rotateZ(${c(T[2])}deg)`,W=E<0?`scale(${1+(1-p.scale)*E*k})`:`scale(${1-(1-p.scale)*E*k})`,J=E<0?1+(1-p.opacity)*E*k:1-(1-p.opacity)*E*k,Y=`translate3d(${R}) ${A} ${W}`;if(L&&p.shadow||!L){let D=z.querySelector(".swiper-slide-shadow");if(!D&&p.shadow&&(D=Ue("creative",z)),D){const I=d.shadowPerProgress?v*(1/d.limitProgress):v;D.style.opacity=Math.min(Math.max(Math.abs(I),0),1)}}const N=Xe(d,z);N.style.transform=Y,N.style.opacity=J,p.origin&&(N.style.transformOrigin=p.origin)}},setTransition:f=>{const P=a.slides.map(h=>Ye(h));P.forEach(h=>{h.style.transitionDuration=`${f}ms`,h.querySelectorAll(".swiper-slide-shadow").forEach(d=>{d.style.transitionDuration=`${f}ms`})}),Qe({swiper:a,duration:f,transformElements:P})},perspective:()=>a.params.creativeEffect.perspective,overwriteParams:()=>({watchSlidesProgress:!0,virtualTranslate:!a.params.cssMode})})}const tt="data:image/svg+xml,%3c?xml%20version='1.0'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='%233797EF'%20viewBox='0%200%2024%2024'%20width='24px'%20height='24px'%3e%3cpath%20d='M12,2C6.477,2,2,6.477,2,12s4.477,10,10,10s10-4.477,10-10S17.523,2,12,2z%20M16,13h-3v3c0,0.552-0.448,1-1,1h0%20c-0.552,0-1-0.448-1-1v-3H8c-0.552,0-1-0.448-1-1v0c0-0.552,0.448-1,1-1h3V8c0-0.552,0.448-1,1-1h0c0.552,0,1,0.448,1,1v3h3%20c0.552,0,1,0.448,1,1v0C17,12.552,16.552,13,16,13z'/%3e%3c/svg%3e",st="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20fill='none'%20viewBox='0%200%2024%2024'%20id='instagram-highlight-story'%3e%3cpath%20fill='%23fff'%20fill-rule='evenodd'%20d='M12.1213%207.40686C10.6607%206.40269%208.64684%206.54986%207.34835%207.84835%205.88388%209.31282%205.88388%2011.6872%207.34835%2013.1517L11.591%2017.3943C11.7316%2017.5349%2011.9224%2017.614%2012.1213%2017.614%2012.3202%2017.614%2012.511%2017.5349%2012.6517%2017.3943L16.8943%2013.1517C18.3588%2011.6872%2018.3588%209.31282%2016.8943%207.84835%2015.5958%206.54986%2013.582%206.40269%2012.1213%207.40686zM11.591%208.90901C10.7123%208.03033%209.28769%208.03033%208.40901%208.90901%207.53033%209.78769%207.53033%2011.2123%208.40901%2012.091L12.1213%2015.8033%2015.8336%2012.091C16.7123%2011.2123%2016.7123%209.78769%2015.8336%208.90901%2014.955%208.03033%2013.5303%208.03033%2012.6517%208.90901%2012.3588%209.2019%2011.8839%209.2019%2011.591%208.90901zM10.2263%202.128C10.3296%202.52914%2010.0881%202.93802%209.68694%203.04127%209.19056%203.16903%208.7103%203.33698%208.24979%203.54149%207.87123%203.7096%207.42806%203.539%207.25994%203.16044%207.09183%202.78187%207.26243%202.3387%207.64099%202.17059%208.17667%201.9327%208.73547%201.73727%209.31306%201.58861%209.7142%201.48537%2010.1231%201.72686%2010.2263%202.128zM5.75633%204.15238C6.03781%204.45625%206.01966%204.93078%205.71579%205.21226%204.97148%205.90172%204.34093%206.71184%203.85525%207.61113%203.65841%207.97559%203.2034%208.11148%202.83894%207.91464%202.47448%207.71781%202.33859%207.26279%202.53543%206.89834%203.1%205.85298%203.83243%204.91218%204.69645%204.11183%205.00032%203.83035%205.47485%203.8485%205.75633%204.15238zM2.25612%209.61903C2.66481%209.6865%202.94142%2010.0725%202.87396%2010.4812%202.79247%2010.9748%202.75%2011.4821%202.75%2011.9999%202.75%2012.5177%202.79247%2013.025%202.87396%2013.5186%202.94142%2013.9273%202.66481%2014.3133%202.25612%2014.3808%201.84744%2014.4482%201.46145%2014.1716%201.39399%2013.7629%201.29922%2013.1888%201.25%2012.5998%201.25%2011.9999%201.25%2011.4%201.29922%2010.811%201.39399%2010.2369%201.46145%209.82819%201.84744%209.55157%202.25612%209.61903zM2.83894%2016.0851C3.2034%2015.8883%203.65841%2016.0242%203.85525%2016.3887%204.34093%2017.288%204.97147%2018.0981%205.71578%2018.7875%206.01966%2019.069%206.03781%2019.5435%205.75633%2019.8474%205.47485%2020.1513%205.00032%2020.1694%204.69644%2019.888%203.83243%2019.0876%203.1%2018.1468%202.53543%2017.1015%202.33859%2016.737%202.47448%2016.282%202.83894%2016.0851zM7.25994%2020.8394C7.42805%2020.4608%207.87122%2020.2902%208.24979%2020.4583%208.7103%2020.6628%209.19056%2020.8308%209.68694%2020.9585%2010.0881%2021.0618%2010.3296%2021.4707%2010.2263%2021.8718%2010.1231%2022.2729%209.7142%2022.5144%209.31306%2022.4112%208.73547%2022.2625%208.17667%2022.0671%207.64099%2021.8292%207.26243%2021.6611%207.09183%2021.2179%207.25994%2020.8394z'%20clip-rule='evenodd'%3e%3c/path%3e%3cpath%20fill='%23fff'%20fill-rule='evenodd'%20d='M11.25%202C11.25%201.58579%2011.5858%201.25%2012%201.25C17.9371%201.25%2022.75%206.06294%2022.75%2012C22.75%2012.4142%2022.4142%2012.75%2022%2012.75C21.5858%2012.75%2021.25%2012.4142%2021.25%2012C21.25%206.89137%2017.1086%202.75%2012%202.75C11.5858%202.75%2011.25%202.41421%2011.25%202ZM21.4682%2015.3127C21.8478%2015.4786%2022.021%2015.9207%2021.8552%2016.3003C20.197%2020.0954%2016.4094%2022.75%2012%2022.75C11.5858%2022.75%2011.25%2022.4142%2011.25%2022C11.25%2021.5858%2011.5858%2021.25%2012%2021.25C15.7919%2021.25%2019.0526%2018.9682%2020.4806%2015.6997C20.6465%2015.3202%2021.0886%2015.1469%2021.4682%2015.3127Z'%20clip-rule='evenodd'%3e%3c/path%3e%3c/svg%3e",at=["width","height","viewBox"],rt=["width","height"],it=["width","height"],lt=he({__name:"CustomProgressBar",props:{percent:{type:Number,required:!0},barHeight:{type:Number,default:2}},setup(C){const a=x(null),{width:$}=Me(a),g=C,b=x(0);ye(()=>{$.value>0&&(b.value=$.value)});const i=x(0),r=se(()=>b.value*g.percent/100);return ae(r,()=>{(g.percent===100||g.percent===0)&&i.value++}),(f,P)=>(u(),m("div",{ref_key:"el",ref:a,class:"progress-container"},[b.value>0?(u(),m("svg",{key:0,width:b.value,height:C.barHeight,viewBox:`0 0 ${b.value} ${C.barHeight}`,class:"progress-bar"},[y("rect",{x:"0",y:"0",width:b.value,height:C.barHeight,fill:"rgba(255, 255, 255, 0.3)",rx:"1",ry:"1"},null,8,rt),(u(),m("rect",{x:"0",y:"0",width:r.value,height:C.barHeight,fill:"white",rx:"1",ry:"1",key:i.value,class:"progress-fill"},null,8,it))],8,at)):G("",!0)],512))}}),ot=Fe(lt,[["__scopeId","data-v-9bef4aaa"]]),Z=""+new URL("story_loading.Cuvmkir-.gif",import.meta.url).href,nt={class:"flex full_story z-400 justify-center",dir:"ltr"},ct={key:0,class:"absolute w-full top-0 right-0 left-0 z-1000 blurred-gradient-bg"},ut={class:"relative"},dt=["alt"],ft=["alt"],vt={class:"text-white"},pt={key:0,class:"absolute w-full bottom-0 right-0 left-0 blurred-gradient-bg z-2000 functions-area"},mt={key:0,class:"flex gap-5 p-5 items-center"},gt={class:"flex w-1.5rem justify-end items-center"},ht={key:1,class:"flex gap-5 p-5 items-center mx4",dir:"rtl"},yt={class:"text-xs"},wt=["alt"],_t={class:"text-xs"},St={class:"w-full"},xt=["alt"],Ct=["alt"],Vt=he({__name:"FullScreenStories",props:{id:{},specifyId:{type:Boolean,default:!1}},emits:["update:id"],setup(C,{emit:a}){const $=Te(),g=x(null),b=[et],i=x(0),r=x(0),f=x(0),P=x(""),h=$e(),d=C,k=a,w=x([]),c=x(null),{direction:q,isSwiping:z}=Pe(c),j=x(!1),v=se(()=>(console.log("mediaStore.users ===>",M.users),console.log("props.id ===>",d.id),d.specifyId?M.users.find(e=>e.id===d.id):M.users[i.value]));let E;const M=Ze(),_=ze(),T=x(!1);let L,p=!1,R=0,A=!1;const W=se(()=>{var e,t;return h.isSeller&&((e=_.user)==null?void 0:e.id)===((t=v.value)==null?void 0:t.id)});function J(e){var t;h.isSeller?$.push({name:"add-story"}):$.push({name:"user_detail",params:{id:(t=v.value)==null?void 0:t.id}})}function Y(e){R=e.touches[0].clientX,A=!1,p=!1,L=setTimeout(()=>{p=!0,A||we(e)},300)}const N=async e=>{await He(h.useString("areYouSureToDeleteThisStory"),e??"",qe,D)};async function D(){k("update:id",void 0),await M.getList()}function I(e){A||setTimeout(()=>{A=!0,clearTimeout(L)},50)}function O(e){var s,l;clearTimeout(L);const t=(s=c.value)==null?void 0:s.querySelector(".account-detail-area"),n=(l=c.value)==null?void 0:l.querySelector(".functions-area");t&&t.contains(e==null?void 0:e.target)||n&&n.contains(e==null?void 0:e.target)||(e.preventDefault(),!p&&!A?oe(e):_e(e))}function we(e){var s,l;const t=(s=c.value)==null?void 0:s.querySelector(".account-detail-area"),n=(l=c.value)==null?void 0:l.querySelector(".functions-area");t&&t.contains(e==null?void 0:e.target)||n&&n.contains(e==null?void 0:e.target)||(e.preventDefault(),e.stopPropagation(),T.value=!0,K())}function _e(e){e.preventDefault(),e.stopPropagation(),T.value&&ie(),T.value=!1}Ie(()=>{var e,t,n,s;i.value=M.users.findIndex(l=>l.id===d.id),g.value.activeIndex=i.value,i.value===0&&re(),(e=c.value)==null||e.addEventListener("touchstart",Y),(t=c.value)==null||t.addEventListener("touchend",O),(n=c.value)==null||n.addEventListener("touchmove",I),(s=c.value)==null||s.addEventListener("touchcancel",O)}),Be(()=>{var e,t,n,s;(e=c.value)==null||e.removeEventListener("touchstart",Y),(t=c.value)==null||t.removeEventListener("touchend",O),(n=c.value)==null||n.addEventListener("touchmove",I),(s=c.value)==null||s.removeEventListener("touchcancel",O)}),ye(()=>{z.value&&q.value==="down"&&k("update:id",void 0)}),ae(i,async e=>{await re()});async function re(){var e;f.value=(e=v.value)==null?void 0:e.stories.length,w.value=[],await De(),g.value&&(g.value.activeIndex=i.value);for(let t=0;t<f.value;t++)w.value.push(0);ie()}const Se=e=>{g.value=e},xe=e=>{r.value=0,K(),i.value=e.activeIndex};function Ce(e){e!==""?j.value=!0:j.value=!1}function ie(){E=Ke(()=>{r.value<w.value.length&&(w.value[r.value]+=10,w.value[r.value]>100&&le())},1e3)}function K(){clearInterval(E),E=void 0}function le(){f.value>r.value+1?r.value++:(K(),r.value=0,ke())}function be(){r.value!==0?r.value--:Ee()}function ke(){d.specifyId?k("update:id",void 0):M.users.length>i.value+1?i.value++:k("update:id",void 0)}function oe(e){var S,B,H;const t=(S=c.value)==null?void 0:S.querySelector(".account-detail-area"),n=(B=c.value)==null?void 0:B.querySelector(".functions-area");if(t&&t.contains(e==null?void 0:e.target)||n&&n.contains(e==null?void 0:e.target))return;const s=(H=e.currentTarget)==null?void 0:H.clientWidth;let l=0;"touches"in e?l=R:e instanceof MouseEvent&&(l=e.offsetX),l>s/2?(w.value[r.value]=100,le()):(w.value[r.value]=0,w.value[r.value-1]=0,be())}function Ee(){i.value!==0&&!d.specifyId&&i.value--}return ae([r,i],async()=>{var n,s,l,S;const e=(n=v.value)==null?void 0:n.stories[r.value],t=e.storyviews.find(B=>{var H;return B.user_id===(((H=_.user)==null?void 0:H.id)||"me")});(s=_.user)!=null&&s.id?t||await Ge((l=_.user)==null?void 0:l.id,e.id):Je(e.id),t||Object.assign(e,{storyviews:[...(t==null?void 0:t.storyviews)??[],{user_id:((S=_.user)==null?void 0:S.id)||"me",story_id:e.id}]})},{deep:!0,immediate:!0}),(e,t)=>{const n=Le("lazy");return u(),m("div",nt,[y("div",{ref_key:"target",ref:c,class:"relative w-full md:w-426px bg-black flex items-center pb-5rem",onClick:oe},[U(ue,{name:"fade"},{default:F(()=>{var s,l;return[T.value?G("",!0):(u(),m("div",ct,[(u(),m("div",{class:"flex gap-2px shadow-xl",key:i.value},[(u(!0),m(de,null,fe(v.value.stories,(S,B)=>(u(),V(ot,{key:B,percent:w.value[B]},null,8,["percent"]))),128))])),y("div",{class:"p-2 flex items-center gap-2 account-detail-area",onClick:ve(J,["prevent"])},[y("div",ut,[Q(y("img",{class:"w-2.5rem h-2.5rem rounded-full",alt:o(X)},null,8,dt),[[n,{src:o(ee)((s=v.value)==null?void 0:s.avatar),loading:o(ge),error:o(ge)}]]),W.value?(u(),m("img",{key:0,src:tt,alt:o(X),class:"w-15px absolute right-0 bottom-0 bg-white rounded-full"},null,8,ft)):G("",!0)]),y("p",vt,te((l=v.value)==null?void 0:l.name),1)])]))]}),_:1}),U(ue,{name:"fade"},{default:F(()=>[T.value?G("",!0):(u(),m("div",pt,[W.value?(u(),m("div",ht,[y("div",{class:"flex flex-col items-center gap-3 text-white",onClick:t[1]||(t[1]=s=>{var l,S,B,H,ne,ce;return N(e.specifyId?(S=(l=v.value)==null?void 0:l.stories[r.value])==null?void 0:S.id:(ce=(ne=(H=(B=o(M))==null?void 0:B.users[i.value])==null?void 0:H.stories)==null?void 0:ne[r.value])==null?void 0:ce.id)})},[U(pe,{icon:"vuesax-linear:trash",size:"22"}),y("div",yt,te(o(h).useString("delete")),1)]),y("div",{class:"flex flex-col items-center gap-3 text-white",onClick:t[2]||(t[2]=s=>o($).push({name:"highlight-create"}))},[y("img",{src:st,alt:o(X)},null,8,wt),y("div",_t,te(o(h).useString("highlight")),1)])])):(u(),m("div",mt,[U(Ae,{value:P.value,"onUpdate:value":t[0]||(t[0]=s=>P.value=s),"place-holder":o(h).useString("sendMessage"),onOnchange:Ce,class:"story_input flex-1"},null,8,["value","place-holder"]),y("div",gt,[j.value?(u(),V(Ve,{key:1,size:"small",shape:"circle",class:"w-2.2rem !h-2.2rem",type:"primary"},{default:F(()=>[U(pe,{icon:"vuesax-linear:send-1"})]),_:1})):(u(),V(Oe,{key:0,mode:"night",class:"w-1.5rem"}))])]))]))]),_:1}),y("div",St,[(u(),V(o(je),{key:i.value,ref_key:"swiperRef",ref:g,onSwiper:Se,onSlideChange:xe,initialSlide:i.value,grabCursor:!0,effect:"creative",creativeEffect:{prev:{shadow:!0,origin:"left center",translate:["-5%",0,-200],rotate:[0,100,0]},next:{origin:"right center",translate:["5%",0,-200],rotate:[0,-100,0]}},modules:b,class:"mySwiper6"},{default:F(()=>[e.specifyId?(u(),V(o(me),{key:1,class:"self-center"},{default:F(()=>{var s;return[Q((u(),m("img",{alt:o(X),class:"w-full bg-black select-none pointer-events-none",key:e.i},null,8,Ct)),[[n,{src:o(ee)((s=v.value.stories[r.value])==null?void 0:s.url),loading:o(Z),error:o(Z)}]])]}),_:1})):(u(!0),m(de,{key:0},fe(o(M).users,(s,l)=>(u(),V(o(me),{key:l,class:"self-center"},{default:F(()=>{var S;return[Q((u(),m("img",{alt:o(X),class:"w-full bg-black select-none pointer-events-none",key:l,onContextmenu:t[3]||(t[3]=ve(()=>{},["prevent"])),draggable:"false"},null,40,xt)),[[n,{src:o(ee)((S=s.stories[r.value])==null?void 0:S.url),loading:o(Z),error:o(Z)}]])]}),_:2},1024))),128))]),_:1},8,["initialSlide"]))])],512)])}}});export{ot as C,Vt as _,tt as a,Z as i};
|