8 lines
34 KiB
JavaScript
8 lines
34 KiB
JavaScript
import{d as D,bl as Qe,s as ae,e as et,C as b,k as Q,aH as C,bC as tt,aW as J,aX as ot,aJ as ze,r as F,K as _e,b6 as nt,bm as st,bX as Le,bV as it,ad as ie,a_ as He,aO as xe,aP as de,cs as X,aV as at,aU as rt,bb as lt,bd as Pe,cy as ut,aK as dt,a1 as Ae,bS as ct,b_ as pt,u as be,G,o as me,aj as fe,y as L,z as _,A as r,H as d,D as Z,a2 as ee,a3 as ce,F as re,ak as le,a7 as ue,ai as Ce,B as H,U as mt,J as te,S as Y,E as Oe,I as Ie,cF as Ve,ay as De,ax as ke,N as ft,a5 as vt,a4 as ve,a9 as ge,a8 as gt,Q as ht}from"./B565zvD7.js";import{e as se}from"./DWEdiVkG.js";import{f as wt,a as Ue}from"./C--l4cbo.js";import{S as yt,a as xt}from"./ZPvgEDtl.js";/* empty css *//* empty css */import{P as _t}from"./BuQge1QG.js";import{i as Me}from"./DGz2YCiv.js";import{B as pe}from"./B8tjfeLk.js";import{_ as bt}from"./DlAUqK2U.js";import{_ as Se}from"./CpmOJupQ.js";import{C as We}from"./DBAUZPHM.js";import{B as Ct}from"./Y0cclhW2.js";import{U as kt}from"./BRgVNBcJ.js";/* empty css */import{_ as St}from"./DlHdCPWP.js";/* empty css */import{T as $t}from"./BeOccFdA.js";import{M as Lt,_ as he,u as Pt}from"./CcNR5PGi.js";import{S as Ke}from"./DouGH0TO.js";import{B as Ot}from"./Bd31JGYm.js";import{u as It,a as Mt}from"./Cjs9-owV.js";import{g as Tt,a as Te}from"./BXsNjjR2.js";import{i as Bt,g as Ft,c as Nt,d as Et,a as jt,e as Rt}from"./CIYhGgSO.js";function zt(e){const{selectionStart:i}=e;return e.value.slice(0,i)}function Ht(e){let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(Array.isArray(i)?i:[i]).reduce((t,s)=>{const l=e.lastIndexOf(s);return l>t.location?{location:l,prefix:s}:t},{location:-1,prefix:""})}function Be(e){return(e||"").toLowerCase()}function At(e,i,o){const t=e[0];if(!t||t===o)return e;let s=e;const l=i.length;for(let a=0;a<l;a+=1)if(Be(s[a])!==Be(i[a])){s=s.slice(a);break}else a===l-1&&(s=s.slice(l));return s}function Vt(e,i){const{measureLocation:o,prefix:t,targetText:s,selectionStart:l,split:a}=i;let u=e.slice(0,o);u[u.length-a.length]===a&&(u=u.slice(0,u.length-a.length)),u&&(u=`${u}${a}`);let p=At(e.slice(l),s.slice(l-o-t.length),a);p.slice(0,a.length)===a&&(p=p.slice(a.length));const m=`${u}${t}${s}${a}`;return{text:`${m}${p}`,selectionLocation:m.length}}function Dt(e,i){e.setSelectionRange(i,i),e.blur(),e.focus()}function Ut(e,i){const{split:o}=i;return!o||e.indexOf(o)===-1}function Wt(e,i){let{value:o=""}=i;const t=e.toLowerCase();return o.toLowerCase().indexOf(t)!==-1}const qe=Symbol("MentionsContextKey");function Kt(){}const qt=D({compatConfig:{MODE:3},name:"DropdownMenu",props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(e,i){let{slots:o}=i;const{activeIndex:t,setActiveIndex:s,selectOption:l,onFocus:a=Kt,loading:u}=Qe(qe,{activeIndex:ae(),loading:ae(!1)});let p;const m=y=>{clearTimeout(p),p=setTimeout(()=>{a(y)})};return et(()=>{clearTimeout(p)}),()=>{var y;const{prefixCls:k,options:$}=e,n=$[t.value]||{};return b(Lt,{prefixCls:`${k}-menu`,activeKey:n.value,onSelect:h=>{let{key:N}=h;const P=$.find(M=>{let{value:T}=M;return T===N});l(P)},onMousedown:m},{default:()=>[!u.value&&$.map((h,N)=>{var P,M;const{value:T,disabled:j,label:V=h.value,class:U,style:K}=h;return b(he,{key:T,disabled:j,onMouseenter:()=>{s(N)},class:U,style:K},{default:()=>[(M=(P=o.option)===null||P===void 0?void 0:P.call(o,h))!==null&&M!==void 0?M:typeof V=="function"?V(h):V]})}),!u.value&&$.length===0?b(he,{key:"notFoundContent",disabled:!0},{default:()=>[(y=o.notFoundContent)===null||y===void 0?void 0:y.call(o)]}):null,u.value&&b(he,{key:"loading",disabled:!0},{default:()=>[b(Ke,{size:"small"},null)]})]})}}}),Xt={bottomRight:{points:["tl","br"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},bottomLeft:{points:["tr","bl"],offset:[0,4],overflow:{adjustX:0,adjustY:1}},topRight:{points:["bl","tr"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}},topLeft:{points:["br","tl"],offset:[0,-4],overflow:{adjustX:0,adjustY:1}}},Zt=D({compatConfig:{MODE:3},name:"KeywordTrigger",props:{loading:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},prefixCls:String,placement:String,visible:{type:Boolean,default:void 0},transitionName:String,getPopupContainer:Function,direction:String,dropdownClassName:String},setup(e,i){let{slots:o}=i;const t=()=>`${e.prefixCls}-dropdown`,s=()=>{const{options:a}=e;return b(qt,{prefixCls:t(),options:a},{notFoundContent:o.notFoundContent,option:o.option})},l=Q(()=>{const{placement:a,direction:u}=e;let p="topRight";return u==="rtl"?p=a==="top"?"topLeft":"bottomLeft":p=a==="top"?"topRight":"bottomRight",p});return()=>{const{visible:a,transitionName:u,getPopupContainer:p}=e;return b($t,{prefixCls:t(),popupVisible:a,popup:s(),popupClassName:e.dropdownClassName,popupPlacement:l.value,popupTransitionName:u,builtinPlacements:Xt,getPopupContainer:p},{default:o.default})}}}),Yt=ot("top","bottom"),Xe={autofocus:{type:Boolean,default:void 0},prefix:J.oneOfType([J.string,J.arrayOf(J.string)]),prefixCls:String,value:String,disabled:{type:Boolean,default:void 0},split:String,transitionName:String,placement:J.oneOf(Yt),character:J.any,characterRender:Function,filterOption:{type:[Boolean,Function]},validateSearch:Function,getPopupContainer:{type:Function},options:tt(),loading:{type:Boolean,default:void 0},rows:[Number,String],direction:{type:String}},Ze=C(C({},Xe),{dropdownClassName:String}),Ye={prefix:"@",split:" ",rows:1,validateSearch:Ut,filterOption:()=>Wt};ze(Ze,Ye);var Fe=function(e,i){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(e);s<t.length;s++)i.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(o[t[s]]=e[t[s]]);return o};function Ne(){}const Gt=D({compatConfig:{MODE:3},name:"Mentions",inheritAttrs:!1,props:ze(Ze,Ye),emits:["change","select","search","focus","blur","pressenter"],setup(e,i){let{emit:o,attrs:t,expose:s,slots:l}=i;const a=F(null),u=F(null),p=F(),m=_e({value:e.value||"",measuring:!1,measureLocation:0,measureText:null,measurePrefix:"",activeIndex:0,isFocus:!1});nt(()=>{m.value=e.value});const y=v=>{o("change",v)},k=v=>{let{target:{value:c}}=v;y(c)},$=(v,c,S)=>{C(m,{measuring:!0,measureText:v,measurePrefix:c,measureLocation:S,activeIndex:0})},n=v=>{C(m,{measuring:!1,measureLocation:0,measureText:null}),v==null||v()},h=v=>{const{which:c}=v;if(m.measuring){if(c===X.UP||c===X.DOWN){const S=W.value.length,O=c===X.UP?-1:1,f=(m.activeIndex+O+S)%S;m.activeIndex=f,v.preventDefault()}else if(c===X.ESC)n();else if(c===X.ENTER){if(v.preventDefault(),!W.value.length){n();return}const S=W.value[m.activeIndex];U(S)}}},N=v=>{const{key:c,which:S}=v,{measureText:O,measuring:f}=m,{prefix:x,validateSearch:A}=e,R=v.target;if(R.composing)return;const z=zt(R),{location:E,prefix:w}=Ht(z,x);if([X.ESC,X.UP,X.DOWN,X.ENTER].indexOf(S)===-1)if(E!==-1){const g=z.slice(E+w.length),I=A(g,e),B=!!q(g).length;I?(c===w||c==="Shift"||f||g!==O&&B)&&$(g,w,E):f&&n(),I&&o("search",g,w)}else f&&n()},P=v=>{m.measuring||o("pressenter",v)},M=v=>{j(v)},T=v=>{V(v)},j=v=>{clearTimeout(p.value);const{isFocus:c}=m;!c&&v&&o("focus",v),m.isFocus=!0},V=v=>{p.value=setTimeout(()=>{m.isFocus=!1,n(),o("blur",v)},100)},U=v=>{const{split:c}=e,{value:S=""}=v,{text:O,selectionLocation:f}=Vt(m.value,{measureLocation:m.measureLocation,targetText:S,prefix:m.measurePrefix,selectionStart:u.value.getSelectionStart(),split:c});y(O),n(()=>{Dt(u.value.input,f)}),o("select",v,m.measurePrefix)},K=v=>{m.activeIndex=v},q=v=>{const c=v||m.measureText||"",{filterOption:S}=e;return e.options.filter(f=>S?S(c,f):!0)},W=Q(()=>q());return s({blur:()=>{u.value.blur()},focus:()=>{u.value.focus()}}),st(qe,{activeIndex:Le(m,"activeIndex"),setActiveIndex:K,selectOption:U,onFocus:j,onBlur:V,loading:Le(e,"loading")}),it(()=>{ie(()=>{m.measuring&&(a.value.scrollTop=u.value.getScrollTop())})}),()=>{const{measureLocation:v,measurePrefix:c,measuring:S}=m,{prefixCls:O,placement:f,transitionName:x,getPopupContainer:A,direction:R}=e,z=Fe(e,["prefixCls","placement","transitionName","getPopupContainer","direction"]),{class:E,style:w}=t,g=Fe(t,["class","style"]),I=He(z,["value","prefix","split","validateSearch","filterOption","options","loading"]),B=C(C(C({},I),g),{onChange:Ne,onSelect:Ne,value:m.value,onInput:k,onBlur:T,onKeydown:h,onKeyup:N,onFocus:M,onPressenter:P});return b("div",{class:xe(O,E),style:w},[b(Ot,de(de({},B),{},{ref:u,tag:"textarea"}),null),S&&b("div",{ref:a,class:`${O}-measure`},[m.value.slice(0,v),b(Zt,{prefixCls:O,transitionName:x,dropdownClassName:e.dropdownClassName,placement:f,options:S?W.value:[],visible:!0,direction:R,getPopupContainer:A},{default:()=>[b("span",null,[c])],notFoundContent:l.notFoundContent,option:l.option}),m.value.slice(v+c.length)])])}}}),Jt={value:String,disabled:Boolean,payload:at()},Ge=C(C({},Jt),{label:rt([])}),Je={name:"Option",props:Ge,render(e,i){let{slots:o}=i;var t;return(t=o.default)===null||t===void 0?void 0:t.call(o)}};D(C({compatConfig:{MODE:3}},Je));const Qt=e=>{const{componentCls:i,colorTextDisabled:o,controlItemBgHover:t,controlPaddingHorizontal:s,colorText:l,motionDurationSlow:a,lineHeight:u,controlHeight:p,inputPaddingHorizontal:m,inputPaddingVertical:y,fontSize:k,colorBgElevated:$,borderRadiusLG:n,boxShadowSecondary:h}=e,N=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return{[i]:C(C(C(C(C({},Pe(e)),Ft(e)),{position:"relative",display:"inline-block",height:"auto",padding:0,overflow:"hidden",lineHeight:u,whiteSpace:"pre-wrap",verticalAlign:"bottom"}),Nt(e,i)),{"&-disabled":{"> textarea":C({},Rt(e))},"&-focused":C({},jt(e)),[`&-affix-wrapper ${i}-suffix`]:{position:"absolute",top:0,insetInlineEnd:m,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto"},[`> textarea, ${i}-measure`]:{color:l,boxSizing:"border-box",minHeight:p-2,margin:0,padding:`${y}px ${m}px`,overflow:"inherit",overflowX:"hidden",overflowY:"auto",fontWeight:"inherit",fontSize:"inherit",fontFamily:"inherit",fontStyle:"inherit",fontVariant:"inherit",fontSizeAdjust:"inherit",fontStretch:"inherit",lineHeight:"inherit",direction:"inherit",letterSpacing:"inherit",whiteSpace:"inherit",textAlign:"inherit",verticalAlign:"top",wordWrap:"break-word",wordBreak:"inherit",tabSize:"inherit"},"> textarea":C({width:"100%",border:"none",outline:"none",resize:"none",backgroundColor:"inherit"},Et(e.colorTextPlaceholder)),[`${i}-measure`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:-1,color:"transparent",pointerEvents:"none","> span":{display:"inline-block",minHeight:"1em"}},"&-dropdown":C(C({},Pe(e)),{position:"absolute",top:-9999,insetInlineStart:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",fontSize:k,fontVariant:"initial",backgroundColor:$,borderRadius:n,outline:"none",boxShadow:h,"&-hidden":{display:"none"},[`${i}-dropdown-menu`]:{maxHeight:e.dropdownHeight,marginBottom:0,paddingInlineStart:0,overflow:"auto",listStyle:"none",outline:"none","&-item":C(C({},ut),{position:"relative",display:"block",minWidth:e.controlItemWidth,padding:`${N}px ${s}px`,color:l,fontWeight:"normal",lineHeight:u,cursor:"pointer",transition:`background ${a} ease`,"&:hover":{backgroundColor:t},"&:first-child":{borderStartStartRadius:n,borderStartEndRadius:n,borderEndStartRadius:0,borderEndEndRadius:0},"&:last-child":{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:n,borderEndEndRadius:n},"&-disabled":{color:o,cursor:"not-allowed","&:hover":{color:o,backgroundColor:t,cursor:"not-allowed"}},"&-selected":{color:l,fontWeight:e.fontWeightStrong,backgroundColor:t},"&-active":{backgroundColor:t}})}})})}},eo=lt("Mentions",e=>{const i=Bt(e);return[Qt(i)]},e=>({dropdownHeight:250,controlItemWidth:100,zIndexPopup:e.zIndexPopupBase+50}));var Ee=function(e,i){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,t=Object.getOwnPropertySymbols(e);s<t.length;s++)i.indexOf(t[s])<0&&Object.prototype.propertyIsEnumerable.call(e,t[s])&&(o[t[s]]=e[t[s]]);return o};function to(){return!0}const oo=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{prefix:o="@",split:t=" "}=i,s=Array.isArray(o)?o:[o];return e.split(t).map(function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=null;return s.some(u=>l.slice(0,u.length)===u?(a=u,!0):!1),a!==null?{prefix:a,value:l.slice(a.length)}:null}).filter(l=>!!l&&!!l.value)},no=()=>C(C({},Xe),{loading:{type:Boolean,default:void 0},onFocus:{type:Function},onBlur:{type:Function},onSelect:{type:Function},onChange:{type:Function},onPressenter:{type:Function},"onUpdate:value":{type:Function},notFoundContent:J.any,defaultValue:String,id:String,status:String}),we=D({compatConfig:{MODE:3},name:"AMentions",inheritAttrs:!1,props:no(),slots:Object,setup(e,i){let{slots:o,emit:t,attrs:s,expose:l}=i;var a,u;const{prefixCls:p,renderEmpty:m,direction:y}=dt("mentions",e),[k,$]=eo(p),n=ae(!1),h=ae(null),N=ae((u=(a=e.value)!==null&&a!==void 0?a:e.defaultValue)!==null&&u!==void 0?u:""),P=It(),M=Mt.useInject(),T=Q(()=>Tt(M.status,e.status));Pt({prefixCls:Q(()=>`${p.value}-menu`),mode:Q(()=>"vertical"),selectable:Q(()=>!1),onClick:()=>{},validator:c=>{let{mode:S}=c}}),Ae(()=>e.value,c=>{N.value=c});const j=c=>{n.value=!0,t("focus",c)},V=c=>{n.value=!1,t("blur",c),P.onFieldBlur()},U=function(){for(var c=arguments.length,S=new Array(c),O=0;O<c;O++)S[O]=arguments[O];t("select",...S),n.value=!0},K=c=>{e.value===void 0&&(N.value=c),t("update:value",c),t("change",c),P.onFieldChange()},q=()=>{const c=e.notFoundContent;return c!==void 0?c:o.notFoundContent?o.notFoundContent():m("Select")},W=()=>{var c;return ct(((c=o.default)===null||c===void 0?void 0:c.call(o))||[]).map(S=>{var O,f;return C(C({},pt(S)),{label:(f=(O=S.children)===null||O===void 0?void 0:O.default)===null||f===void 0?void 0:f.call(O)})})};l({focus:()=>{h.value.focus()},blur:()=>{h.value.blur()}});const v=Q(()=>e.loading?to:e.filterOption);return()=>{const{disabled:c,getPopupContainer:S,rows:O=1,id:f=P.id.value}=e,x=Ee(e,["disabled","getPopupContainer","rows","id"]),{hasFeedback:A,feedbackIcon:R}=M,{class:z}=s,E=Ee(s,["class"]),w=He(x,["defaultValue","onUpdate:value","prefixCls"]),g=xe({[`${p.value}-disabled`]:c,[`${p.value}-focused`]:n.value,[`${p.value}-rtl`]:y.value==="rtl"},Te(p.value,T.value),!A&&z,$.value),I=C(C(C(C({prefixCls:p.value},w),{disabled:c,direction:y.value,filterOption:v.value,getPopupContainer:S,options:e.loading?[{value:"ANTDV_SEARCHING",disabled:!0,label:b(Ke,{size:"small"},null)}]:e.options||W(),class:g}),E),{rows:O,onChange:K,onSelect:U,onFocus:j,onBlur:V,ref:h,value:N.value,id:f}),B=b(Gt,de(de({},I),{},{dropdownClassName:$.value}),{notFoundContent:q,option:o.option});return k(A?b("div",{class:xe(`${p.value}-affix-wrapper`,Te(`${p.value}-affix-wrapper`,T.value,A),z,$.value)},[B,b("span",{class:`${p.value}-suffix`},[R])]):B)}}}),ye=D(C(C({compatConfig:{MODE:3}},Je),{name:"AMentionsOption",props:Ge})),so=C(we,{Option:ye,getMentions:oo,install:e=>(e.component(we.name,we),e.component(ye.name,ye),e)}),io={class:"mt-.5rem"},ao={key:0,class:"video-container"},ro=["src"],lo={key:1,class:"w-full aspect-square flex items-center"},uo=["alt"],co={class:"font-semibold font-azar text-xs"},po={class:"flex items-center"},mo={class:"text-xs"},fo=D({__name:"Content",props:{media:{},name:{},id:{},scrollSave:{}},setup(e){const i=be(),o=G(),t=e,s=F([]);function l(u){const p=document.querySelector(".scrollHome");p&&(sessionStorage.setItem(t.scrollSave,p.scrollTop.toString()),console.log("content",p.scrollTop.toString(),t.scrollSave)),i.push({name:"product_detail-id",params:{id:u}})}me(()=>{const u={root:null,rootMargin:"0px",threshold:.5},p=y=>{y.forEach(k=>{const $=k.target;k.isIntersecting?$.play():$.pause()})},m=new IntersectionObserver(p,u);s.value.forEach(y=>{m.observe(y)})});const a=[_t];return(u,p)=>{const m=fe("lazy");return _(),L("div",io,[b(d(yt),{pagination:!0,modules:a,class:"postConfig !h-unset !aspect-square !m-unset"},{default:Z(()=>[(_(!0),L(ee,null,ce(u.media,y=>(_(),re(d(xt),{class:"!w-full !h-unset !aspect-square"},{default:Z(()=>[y.type==="video"?(_(),L("div",ao,[r("video",{ref_for:!0,ref_key:"videos",ref:s,src:d(le)(y.url),playsinline:"",muted:"",loop:"",class:"video"},null,8,ro)])):(_(),L("div",lo,[ue(r("img",{alt:d(Ce),class:"w-full"},null,8,uo),[[m,{src:d(le)(y.url),loading:d(Me),error:d(Me)}]])]))]),_:2},1024))),256))]),_:1}),r("div",{class:"flex bg-[#0195f7] text-white px-3 py-3 items-center justify-between",onClick:p[0]||(p[0]=y=>l(u.id))},[r("div",co,H(u.name),1),r("div",po,[r("div",mo,H(d(o).useString("viewProduct")),1),b(pe,{icon:d(o).isRTL?"vuesax-linear:arrow-left-1":"vuesax-linear:arrow-right-1",size:"16"},null,8,["icon"])])])])}}}),vo=bt(fo,[["__scopeId","data-v-8c70fb9e"]]),go="data:image/svg+xml,%3csvg%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.7431%2015.215C19.5381%2013.825%2020.0031%2012.22%2020.0031%2010.5C20.0031%205.255%2015.7481%201%2010.5031%201C5.25811%201%201.00311%205.255%201.00311%2010.5C1.00311%2015.745%205.25811%2020%2010.5031%2020C12.2581%2020%2013.8931%2019.515%2015.3031%2018.69L19.3581%2019.775C19.6481%2019.855%2019.9181%2019.585%2019.8381%2019.295L18.7431%2015.215Z'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",ho="data:image/svg+xml,%3csvg%20width='21'%20height='21'%20viewBox='0%200%2021%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M18.7431%2015.215C19.5381%2013.825%2020.0031%2012.22%2020.0031%2010.5C20.0031%205.255%2015.7481%201%2010.5031%201C5.25811%201%201.00311%205.255%201.00311%2010.5C1.00311%2015.745%205.25811%2020%2010.5031%2020C12.2581%2020%2013.8931%2019.515%2015.3031%2018.69L19.3581%2019.775C19.6481%2019.855%2019.9181%2019.585%2019.8381%2019.295L18.7431%2015.215Z'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",wo={key:0,src:go,alt:"comment","cursor-pointer":""},yo={key:1,src:ho,alt:"comment","cursor-pointer":""},xo=D({__name:"comment",setup(e){const i=G();return(o,t)=>d(i).isNightStore?(_(),L("img",wo)):(_(),L("img",yo))}}),_o="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",bo="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",Co="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20fill='white'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",ko="data:image/svg+xml,%3csvg%20width='18'%20height='20'%20viewBox='0%200%2018%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9%2011.5L16.94%2019H17V1H1V19H1.06L9%2011.5Z'%20fill='black'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",So={key:0,src:_o,alt:"comment","cursor-pointer":""},$o={key:1,src:bo,alt:"comment","cursor-pointer":""},Lo={key:0,src:Co,alt:"comment","cursor-pointer":""},Po={key:1,src:ko,alt:"comment","cursor-pointer":""},Oo=D({__name:"save",props:{isSaved:{type:Boolean}},setup(e){const i=G();return(o,t)=>(_(),re(mt,{name:"fade-nav",mode:"out-in"},{default:Z(()=>[o.isSaved?(_(),L(ee,{key:1},[d(i).isNightStore?(_(),L("img",Lo)):(_(),L("img",Po))],64)):(_(),L(ee,{key:0},[d(i).isNightStore?(_(),L("img",So)):(_(),L("img",$o))],64))]),_:1}))}}),Io="data:image/svg+xml,%3csvg%20width='22'%20height='20'%20viewBox='0%200%2022%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.0031%201H1.00311L8.50311%208.5M21.0031%201L10.5031%2018.5L8.50311%208.5M21.0031%201L8.50311%208.5'%20stroke='white'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",Mo="data:image/svg+xml,%3csvg%20width='22'%20height='20'%20viewBox='0%200%2022%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M21.0031%201H1.00311L8.50311%208.5M21.0031%201L10.5031%2018.5L8.50311%208.5M21.0031%201L8.50311%208.5'%20stroke='black'%20stroke-width='2'%20stroke-linejoin='round'/%3e%3c/svg%3e",To={key:0,src:Io,alt:"comment","cursor-pointer":""},Bo={key:1,class:"rtl:-scale-x-100",src:Mo,alt:"comment","cursor-pointer":""},Fo=D({__name:"share",setup(e){const i=G();return(o,t)=>d(i).isNightStore?(_(),L("img",To)):(_(),L("img",Bo))}}),No=["id"],Eo={class:"flex px-3 items-center justify-between"},jo={alt:"instagram",class:"w-2rem h-2rem rounded-full"},Ro={class:"ms-2"},zo={class:"text-sm font-semibold"},Ho={key:0},Ao={class:"p-4"},Vo={class:"flex gap-4 items-center justify-between"},Do={class:"flex items-center gap-4"},Uo=["aria-disabled"],Wo={class:"mt-2 text-sm"},Ko={class:"font-semibold ms1"},qo={class:"ms-2 font-azar text-xs"},Xo={class:"text-xs mt-1 text-gray-500"},je=100,Yn=D({__name:"Post",props:{post:{},index:{},scrollSave:{},addLikeLoading:{type:Boolean}},emits:["openOption","openComment","handleLike","handleSave"],setup(e,{emit:i}){const o=be(),t=i,s=G(),l=F({}),a=te(),u=n=>(n==null?void 0:n.length)>je;function p(n){t("openOption",n)}function m(n){t("openComment",n)}async function y(n,h,N){if(navigator.share)try{await navigator.share({title:`${s.lang==="fa"?`${Ie.fa} | ${h}`:`${Ie.en} | ${h}`}`,text:`${N}`,url:`${window.location.origin}/product_detail/${n}`})}catch(P){console.error("Sharing failed",P)}else alert("Web Share API not supported in this browser.")}const k=n=>{l.value={...l.value,[n]:!l.value[n]}},$=n=>u(n)?(n==null?void 0:n.slice(0,je))+"...":n;return(n,h)=>{var P,M,T,j,V,U,K,q,W,oe,ne,v,c,S,O,f,x,A,R,z;const N=fe("lazy");return _(),L("div",{class:"w-full mb-2",id:"post-"+n.post.id},[r("div",Eo,[r("div",{class:"flex items-center",onClick:h[0]||(h[0]=E=>{var w,g;return d(o).push({name:"user_detail-id",params:{id:(g=(w=n.post)==null?void 0:w.users)==null?void 0:g.id}})})},[ue(r("img",jo,null,512),[[N,{src:d(le)((M=(P=n.post)==null?void 0:P.users)==null?void 0:M.avatar),loading:d(se),error:d(se)}]]),r("div",Ro,[r("div",zo,H((j=(T=n.post)==null?void 0:T.users)==null?void 0:j.username),1)])]),((U=(V=n.post)==null?void 0:V.users)==null?void 0:U.id)===((K=d(a).user)==null?void 0:K.id)?(_(),L("div",Ho,[b(pe,{icon:"vuesax-linear:more",class:"rotate-90",size:"18",onClick:h[1]||(h[1]=E=>p(n.post.id))})])):Y("",!0)]),b(vo,{media:(q=n.post)==null?void 0:q.files,name:n.post.title_fa,id:n.post.id,scrollSave:n.scrollSave},null,8,["media","name","id","scrollSave"]),r("div",Ao,[r("div",Vo,[r("div",Do,[r("div",{class:"flex items-center gap-1","aria-disabled":n.addLikeLoading,onClick:h[2]||(h[2]=E=>{var w,g;return t("handleLike",(w=n.post.likes)==null?void 0:w.some(I=>{var B;return I.user_id===((B=d(a).user)==null?void 0:B.id)}),(g=n.post)==null?void 0:g.id)})},[b(Se,{"is-liked":(W=n.post.likes)==null?void 0:W.some(E=>{var w;return E.user_id===((w=d(a).user)==null?void 0:w.id)})},null,8,["is-liked"]),Oe(" "+H(((ne=(oe=n.post)==null?void 0:oe.likes)==null?void 0:ne.length)??0),1)],8,Uo),r("div",{class:"flex items-center gap-1",onClick:h[3]||(h[3]=E=>m(n.post.id))},[b(xo),Oe(" "+H(((c=(v=n.post)==null?void 0:v.comments)==null?void 0:c.length)??0),1)]),r("div",{class:"flex items-center gap-1",onClick:h[4]||(h[4]=E=>{var w,g,I;return y((w=n.post)==null?void 0:w.id,(g=n.post)==null?void 0:g.title_fa,(I=n.post)==null?void 0:I.description)})},[b(Fo)])]),r("div",{onClick:h[5]||(h[5]=E=>{var w,g;return t("handleSave",(w=n.post.saved)==null?void 0:w.some(I=>{var B;return I.user_id===((B=d(a).user)==null?void 0:B.id)}),(g=n.post)==null?void 0:g.id)})},[b(Oo,{"is-saved":(S=n.post.saved)==null?void 0:S.some(E=>{var w;return E.user_id===((w=d(a).user)==null?void 0:w.id)})},null,8,["is-saved"])])]),r("div",Wo,[r("span",Ko,H((f=(O=n.post)==null?void 0:O.users)==null?void 0:f.name),1),r("span",qo,H(l.value[n.index]?(x=n.post)==null?void 0:x.description:$((A=n.post)==null?void 0:A.description)),1),u((R=n.post)==null?void 0:R.description)?(_(),L("span",{key:0,class:"text-gray cursor-pointer ms-1",onClick:h[6]||(h[6]=E=>k(n.index))},H(l.value[n.index]?d(s).useString("less"):d(s).useString("more")),1)):Y("",!0),r("div",Xo,H(d(wt)((z=n.post)==null?void 0:z.created_at)),1)])])],8,No)}}}),Zo=["width","height"],Yo=["y"],Go=["y"],Gn=D({__name:"PostCardSkeleton",setup(e){const i=F(!1),o=F(null),t=_e(Ve(o,{width:0,height:0},{box:"border-box"}));return me(async()=>{i.value=!0}),(s,l)=>i.value?(_(),L("div",{key:0,ref_key:"skeletonRatio",ref:o,class:"h-fit"},[b(d(We),{width:t.width,height:"800"},{default:Z(()=>[l[0]||(l[0]=r("circle",{cx:30,cy:"30",r:"20"},null,-1)),l[1]||(l[1]=r("rect",{x:"60",y:"25",rx:"3",ry:"3",width:"100",height:"10"},null,-1)),r("rect",{x:"0",y:"60",rx:"0",ry:"0",width:Math.max(100,t.width),height:Math.max(0,t.width-100)},null,8,Zo),r("rect",{x:"20",y:Math.max(0,t.width-10),rx:"0",ry:"0",width:300,height:10},null,8,Yo),r("rect",{x:"20",y:Math.max(0,t.width+10),rx:"0",ry:"0",width:300,height:8},null,8,Go)]),_:1,__:[0,1]},8,["width"])],512)):Y("",!0)}}),Jn=async e=>await ke.post("/media/create-like",{product_id:e}),Qn=async e=>De.fetch("likes","delete",{field:["user_id","product_id"],value:[te().user.id,e]}),Jo=async e=>await ke.post("/media/create-comment-like",{comment_id:e}),Qo=async e=>De.fetch("likes","delete",{field:["user_id","comment_id"],value:[te().user.id,e]}),en={class:"mt-4"},tn={class:"flex text-xs gap-2"},on=["alt"],nn={class:"flex-1"},sn={class:"flex gap-2 items-center"},an={class:"text-xs text-gray-500"},rn=["aria-disabled"],ln=D({__name:"SubCommentCard",props:{item:{},addLikeLoading:{type:Boolean}},emits:["likeComment","reply"],setup(e,{emit:i}){const o=te();G();const t=i;return(s,l)=>{var u,p,m,y;const a=fe("lazy");return _(),L("div",en,[r("div",tn,[r("div",null,[ue(r("img",{alt:d(Ce),width:"40",class:"rounded-full aspect-square"},null,8,on),[[a,{src:d(le)((p=(u=s.item)==null?void 0:u.user)==null?void 0:p.avatar),loading:d(se),error:d(se)}]])]),r("div",nn,[r("div",sn,[r("div",null,H(s.item.user.name),1),r("div",an,H(d(Ue)(s.item.created_at)),1)]),r("div",null,H(s.item.message),1)]),r("div",{class:"flex flex-col items-center gap-1 w-14px",onClick:l[0]||(l[0]=k=>{var $;return t("likeComment",($=s.item.like)==null?void 0:$.some(n=>{var h;return n.user_id===((h=d(o).user)==null?void 0:h.id)}),s.item.id)}),"aria-disabled":s.addLikeLoading},[b(Se,{"is-gray":"","is-liked":(m=s.item.like)==null?void 0:m.some(k=>{var $;return k.user_id===(($=d(o).user)==null?void 0:$.id)})},null,8,["is-liked"]),r("div",null,H((y=s.item.like)==null?void 0:y.length),1)],8,rn)])])}}}),un={class:"mb-5"},dn={class:"flex text-xs gap-2"},cn=["alt"],pn={class:"flex-1"},mn={class:"flex gap-2 items-center"},fn={class:"text-xs text-gray-500"},vn=["aria-disabled"],gn={key:1,class:"ms11"},hn=D({__name:"CommentCard",props:{item:{},addLikeLoading:{type:Boolean}},emits:["likeComment","reply"],setup(e,{emit:i}){const o=te(),t=G(),s=i,l=F(!1);return(a,u)=>{var m,y,k,$,n,h,N;const p=fe("lazy");return _(),L("div",un,[r("div",dn,[r("div",null,[ue(r("img",{alt:d(Ce),width:"40",class:"rounded-full aspect-square"},null,8,cn),[[p,{src:d(le)(a.item.user.avatar),loading:d(se),error:d(se)}]])]),r("div",pn,[r("div",mn,[r("div",null,H(a.item.user.name),1),r("div",fn,H(d(Ue)(a.item.created_at)),1)]),r("div",null,H(a.item.message),1),r("div",{class:"text-gray-5",onClick:u[0]||(u[0]=P=>s("reply"))},H(d(t).useString("reply")),1)]),r("div",{class:"flex flex-col items-center gap-1 w-14px","aria-disabled":a.addLikeLoading,onClick:u[1]||(u[1]=P=>{var M;return s("likeComment",(M=a.item.like)==null?void 0:M.some(T=>{var j;return T.user_id===((j=d(o).user)==null?void 0:j.id)}),a.item.id,!1,a.item.id)})},[b(Se,{"is-gray":"","is-liked":(m=a.item.like)==null?void 0:m.some(P=>{var M;return P.user_id===((M=d(o).user)==null?void 0:M.id)})},null,8,["is-liked"]),r("div",null,H((y=a.item.like)==null?void 0:y.length),1)],8,vn)]),(($=(k=a.item)==null?void 0:k.replies)==null?void 0:$.length)>0?(_(),L(ee,{key:0},[l.value?(_(),L("div",gn,[(_(!0),L(ee,null,ce((N=a.item)==null?void 0:N.replies,P=>(_(),re(ln,{item:P,onLikeComment:M=>{var T;return s("likeComment",(T=P.like)==null?void 0:T.some(j=>{var V;return j.user_id===((V=d(o).user)==null?void 0:V.id)}),P.id,!0,a.item.id)},addLikeLoading:a.addLikeLoading},null,8,["item","onLikeComment","addLikeLoading"]))),256))])):(_(),L("div",{key:0,onClick:u[2]||(u[2]=P=>l.value=!l.value),class:"text-zinc-5 text-xs mt-2 ms-20"},H(d(t).useString("viewMoreReplies",(h=(n=a.item)==null?void 0:n.replies)==null?void 0:h.length)),1))],64)):Y("",!0)])}}}),wn=["width"],yn=D({__name:"CommentCardSkeleton",setup(e){const i=F(!1),o=F(null),t=_e(Ve(o,{width:0,height:0},{box:"border-box"}));return me(async()=>{i.value=!0}),(s,l)=>i.value?(_(),L("div",{key:0,ref_key:"skeletonRatio",ref:o,class:"h-fit"},[b(d(We),{width:t.width,height:"60"},{default:Z(()=>[l[0]||(l[0]=r("circle",{cx:15,cy:"30",r:"15"},null,-1)),l[1]||(l[1]=r("rect",{x:"45",y:"15",rx:"3",ry:"3",width:"100",height:"12"},null,-1)),r("rect",{x:"45",y:"35",rx:"5",ry:"5",width:t.width-100,height:"10"},null,8,wn)]),_:1,__:[0,1]},8,["width"])],512)):Y("",!0)}}),xn=async(e,i=1,o=10)=>{var l;const t=(i-1)*o,s=t+o-1;return(l=await ft.from("comments").select(`*,
|
|
user:users(name, avatar),
|
|
like:likes(user_id),
|
|
replies:comments(*,
|
|
user:users(name, avatar),
|
|
like:likes(user_id)
|
|
)`).eq("product_id",e).is("parent_id",null).range(t,s).order("created_at",{ascending:!1}))==null?void 0:l.data},Re=async(e,i,o=void 0)=>await ke.post("/media/add-comment",{message:e,product_id:i,parent_id:o}),_n={flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},bn={"mt-1":"","font-semibold":""},Cn={class:"flex items-center"},kn={class:"me-1"},Sn={class:"flex items-center p1"},es=D({__name:"CommentAddEdit",props:{open:{type:Boolean},id:{}},emits:["update:open"],setup(e,{emit:i}){const o=be(),t=G(),s=te(),l=F(null),a=F(!0),u=F(null),p=F(!1),m=F(!1),y=F(!1);te();const k=F(void 0),$=()=>{a.value=u.value.scrollTop<=5};function n(){k.value=void 0}function h(){setTimeout(()=>{var f;(f=document.activeElement)==null||f.scrollIntoView({behavior:"smooth",block:"center"}),p.value=!0},300)}me(()=>{ie(()=>{u.value&&$()})});const N=e,P=i,M=F(!1),T=F([]),j=F(""),V=F(null),U=F(!1),K=F(0),q=F(20),W=async()=>{try{if(!U.value){M.value=!0;const f=await xn(N.id,++K.value,q.value);(f==null?void 0:f.length)<q.value&&(U.value=!0),T.value.push(...f)}}catch(f){console.log("e ===>",f)}finally{M.value=!1}};async function oe(){var f,x;await W(),await ie(),await((f=l.value)==null?void 0:f.setOpen()),await((x=V.value)==null?void 0:x.focus())}async function ne(){var f;await ie(),await((f=l.value)==null?void 0:f.setClose()),v(),n()}function v(){T.value=[],K.value=0,U.value=!1}const c=async()=>{var f,x,A,R;try{if(((f=j.value)==null?void 0:f.length)>0){if(m.value=!0,k.value){const z=await Re(j.value,N.id,k.value.id);(x=k.value)!=null&&x.replies||(k.value.replies=[]),(A=k.value)==null||A.replies.push({message:j.value,user:{name:s.user.name,avatar:s.user.avatar},like:[],...z})}else{const z=await Re(j.value,N.id);(R=T.value)==null||R.unshift({message:j.value,user:{name:s.user.name,avatar:s.user.avatar},like:[],replies:[],...z})}await ie(()=>{j.value="",k.value=void 0})}}catch(z){console.log(z)}finally{m.value=!1}};function S(f,x,A,R){var z,E,w;try{if(y.value=!0,ge())if(f)if(Qo(x),A){const g=T.value.find(B=>B.id===R),I=g==null?void 0:g.replies.find(B=>B.id===x);I==null||I.like.splice((z=I.like)==null?void 0:z.findIndex(B=>{var $e;return B.user_id===(($e=s.user)==null?void 0:$e.id)}))}else{const g=T.value.find(I=>I.id===R);g==null||g.like.splice((E=g==null?void 0:g.like)==null?void 0:E.findIndex(I=>{var B;return I.user_id===((B=s.user)==null?void 0:B.id)}))}else if(Jo(x),A){const g=T.value.find(B=>B.id===R),I=g==null?void 0:g.replies.find(B=>B.id===x);I==null||I.like.push({product_id:x,user_id:s.user.id})}else{const g=T.value.find(I=>I.id===R);(w=g==null?void 0:g.like)==null||w.push({product_id:x,user_id:s.user.id})}else o.push({name:"auth-login"}),ht.warn(t.useString("pleaseLoginOrRegister"))}catch(g){console.log(g)}finally{y.value=!1}}const O=F();return vt(O,([{isIntersecting:f}])=>{f&&N.open&&setTimeout(()=>{W()},100)}),Ae(N,f=>{f.open?oe():ne()}),(f,x)=>{const A=so;return _(),re(Ct,{title:"",ref_key:"sheetRef",ref:l,headerCls:"",allowCloseScrollup:a.value,closeOnClickOutside:"",onOnClickOutside:x[3]||(x[3]=R=>P("update:open",!1)),onOnClose:x[4]||(x[4]=R=>P("update:open",!1))},{header:Z(()=>[r("div",_n,[x[5]||(x[5]=r("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),r("div",bn,H(d(t).useString("comments")),1)])]),default:Z(()=>{var R,z,E;return[r("div",{class:ve(["h-70vh w-full relative relative",d(ge)()?"pb-4rem":""])},[r("div",{class:"h-full px-4 overflow-auto",ref_key:"scrollArea",ref:u,onScroll:$},[(_(!0),L(ee,null,ce(T.value,w=>(_(),re(hn,{item:w,onLikeComment:S,onReply:g=>k.value=w,addLikeLoading:y.value},null,8,["item","onReply","addLikeLoading"]))),256)),M.value?(_(),L(ee,{key:0},ce(5,w=>b(yn)),64)):Y("",!0),ue(r("div",{ref_key:"observer",ref:O,class:"w-full opacity-0 relative"}," load ",512),[[gt,!M.value]])],544),d(ge)()?(_(),L("div",{key:0,class:"flex w-inherit fixed gap-2 items-end my-2 px4 py-1 bottom-1",onFocusin:h,onFocusout:x[2]||(x[2]=w=>p.value=!1)},[b(kt,{width:"40",src:(R=d(s).user)==null?void 0:R.avatar,"just-show-profile":""},null,8,["src"]),r("div",{class:ve(["border-solid w-full border-1 comment_input",k.value?"rounded-3xl":"rounded-full"])},[k.value?(_(),L("div",{key:0,class:ve(["rounded-t-3xl text-xs p3 mb1 flex justify-between",d(t).isNightStore?"bg-zinc-7 text-gray-2":"bg-gray-50 text-gray-4"])},[r("div",Cn,[r("span",null,[r("span",kn,H(d(t).useString("replyingTo")),1),r("span",null,H((E=(z=k.value)==null?void 0:z.user)==null?void 0:E.name),1)])]),b(pe,{icon:"vuesax-linear:add",class:"rotate-45",color:d(t).isNightStore?"bg-zinc-7":"text-gray-4",onClick:x[0]||(x[0]=w=>k.value=void 0)},null,8,["color"])],2)):Y("",!0),r("div",Sn,[b(A,{value:j.value,"onUpdate:value":x[1]||(x[1]=w=>j.value=w),placeholder:d(t).useString("yourComment"),class:"comment_input"},null,8,["value","placeholder"]),b(St,{onClick:c,class:"rounded-full w-3.5rem",type:"primary",loading:m.value},{default:Z(()=>[b(pe,{icon:"vuesax-linear:arrow-up"})]),_:1},8,["loading"])])],2)],32)):Y("",!0)],2)]}),_:1},8,["allowCloseScrollup"])}}});export{Gn as _,es as a,Yn as b,Jn as c,Qn as d,Fo as e};
|