Files
appco_dist/.output/public/_nuxt/DblPSvkM.js
T

8 lines
34 KiB
JavaScript
Raw Normal View History

2025-07-24 21:23:30 +03:30
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
2025-07-22 23:06:16 +03:30
user:users(name, avatar),
like:likes(user_id),
replies:comments(*,
user:users(name, avatar),
like:likes(user_id)
2025-07-23 16:57:31 +03:30
)`).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