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

8 lines
34 KiB
JavaScript
Raw Normal View History

2025-07-22 23:06:16 +03:30
import{d as D,bk as Qe,s as ae,e as et,C as b,k as Q,aG as C,bB as tt,aV as J,aW as ot,aI as ze,r as F,K as _e,b5 as nt,bl as st,bW as Le,bU as it,ac as ie,aZ as Ae,aN as xe,aO as de,cr as Z,aU as at,aT as rt,ba as lt,bc as Pe,cx as ut,aJ as dt,a0 as He,bR as ct,bZ as pt,u as be,G,o as me,ai as fe,y as L,z as _,A as r,H as d,D as X,a1 as ee,a2 as ce,F as re,aj as le,a6 as ue,ah as Ce,B as A,U as mt,J as te,S as Y,E as Oe,I as Ie,cE as Ve,ax as De,aw as ke,N as ft,a4 as vt,a3 as ve,a8 as ge,a7 as gt,Q as ht}from"./CwKn53hw.js";import{e as se}from"./DWEdiVkG.js";import{f as wt,a as Ue}from"./Ce3UjBaQ.js";import{S as yt,a as xt}from"./C3TKO2Y0.js";/* empty css *//* empty css */import{P as _t}from"./DPKLCRhs.js";import{i as Te}from"./kspBzamA.js";import{B as pe}from"./fSnp-cKK.js";import{_ as bt}from"./DlAUqK2U.js";import{_ as Se}from"./CIIw-eKd.js";import{C as We}from"./DoLnxKlT.js";import{B as Ct}from"./DdjqH3QY.js";import{U as kt}from"./DHToldUC.js";/* empty css */import{_ as St}from"./CfNh9OFJ.js";/* empty css */import{T as $t}from"./pXk2senR.js";import{M as Lt,_ as he,u as Pt}from"./DGKoACy0.js";import{S as Ke}from"./BvGIWt3c.js";import{B as Ot}from"./DlapJrzf.js";import{u as It,a as Tt}from"./BWieP8Lh.js";import{g as Mt,a as Me}from"./BUV4kMxE.js";import{i as Bt,g as Ft,c as Nt,d as Et,a as jt,e as Rt}from"./CfmyYeKp.js";function zt(e){const{selectionStart:i}=e;return e.value.slice(0,i)}function At(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 Ht(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=Ht(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(T=>{let{value:M}=T;return M===N});l(P)},onMousedown:m},{default:()=>[!u.value&&$.map((h,N)=>{var P,T;const{value:M,disabled:j,label:V=h.value,class:U,style:K}=h;return b(he,{key:M,disabled:j,onMouseenter:()=>{s(N)},class:U,style:K},{default:()=>[(T=(P=o.option)===null||P===void 0?void 0:P.call(o,h))!==null&&T!==void 0?T: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)]})]})}}}),Zt={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}}},Xt=D({compatConfig:{MODE:3},name:"KeywordTrigger",props:{loading:{type:Boolean,default:void 0},options:{type:Array,default:()=>[]},prefixCls:String,placement:String,visible:{type
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,T=F(!1),M=F([]),j=F(""),V=F(null),U=F(!1),K=F(0),q=F(20),W=async()=>{try{if(!U.value){T.value=!0;const f=await xn(N.id,++K.value,q.value);(f==null?void 0:f.length)<q.value&&(U.value=!0),M.value.push(...f)}}catch(f){console.log("e ===>",f)}finally{T.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(){M.value=[],K.value=0,U.value=!1}const c=async()=>{var f,x,H,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=[]),(H=k.value)==null||H.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=M.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,H,R){var z,E,w;try{if(y.value=!0,ge())if(f)if(Qo(x),H){const g=M.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=M.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),H){const g=M.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=M.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)}),He(N,f=>{f.open?oe():ne()}),(f,x)=>{const H=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:X(()=>[r("div",_n,[x[5]||(x[5]=r("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),r("div",bn,A(d(t).useString("comments")),1)])]),default:X(()=>{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(M.value,w=>(_(),re(hn,{item:w,onLikeComment:S,onReply:g=>k.value=w,addLikeLoading:y.value},null,8,["item","onReply","addLikeLoading"]))),256)),T.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,!T.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