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

8 lines
28 KiB
JavaScript

import{d as j,a$ as Ye,s as ne,e as Ze,C as x,k as Y,aJ as f,bv as qe,aY as X,aZ as Ge,aL as Pe,r as S,K as Ie,bi as Je,b1 as Qe,bX as _e,bV as et,af as Z,bu as Te,aQ as ge,aR as ie,cu as U,aX as tt,aW as nt,b5 as ot,bd as be,cA as st,aM as it,a1 as xe,bS as at,b_ as rt,G,y as $,H as g,z as w,F as se,U as lt,D as q,a2 as ee,aA as Me,J as te,az as we,al as Be,A as c,a7 as ye,am as Fe,ak as Ne,B as R,S as oe,a3 as ve,cH as ut,o as Ee,N as ct,u as Re,a5 as dt,a4 as ce,a9 as de,a8 as pt,Q as he,cJ as mt,cK as ft}from"./UdOyBpMP.js";import{B as je}from"./w0GIr-t-.js";import{a as Ae}from"./I_ptg6eW.js";import{e as ae}from"./DWEdiVkG.js";import{_ as He}from"./C06seMeQ.js";import{C as gt}from"./D9uwqMTQ.js";import{U as vt}from"./Ci8_aquE.js";import"./GnIoT5nL.js";import{B as ht}from"./rfNZXhah.js";import{B as re}from"./j0GddizS.js";import{T as xt}from"./auK7iHvF.js";import{M as wt,_ as pe,u as yt}from"./BaMyv3ih.js";import{S as ze}from"./R7bDMkOx.js";import{B as _t}from"./BZQsegbX.js";import{u as bt,b as Ct}from"./C9wgtwsA.js";import{g as St,a as Ce}from"./GUCsZWHE.js";import{i as kt,g as $t,c as Lt,d as Ot,a as Pt,e as It}from"./BkHRfldW.js";import"./dBeUTPvU.js";import{u as Tt}from"./BCqcZsDP.js";function Mt(e){const{selectionStart:s}=e;return e.value.slice(0,s)}function Bt(e){let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(Array.isArray(s)?s:[s]).reduce((t,o)=>{const l=e.lastIndexOf(o);return l>t.location?{location:l,prefix:o}:t},{location:-1,prefix:""})}function Se(e){return(e||"").toLowerCase()}function Ft(e,s,n){const t=e[0];if(!t||t===n)return e;let o=e;const l=s.length;for(let i=0;i<l;i+=1)if(Se(o[i])!==Se(s[i])){o=o.slice(i);break}else i===l-1&&(o=o.slice(l));return o}function Nt(e,s){const{measureLocation:n,prefix:t,targetText:o,selectionStart:l,split:i}=s;let a=e.slice(0,n);a[a.length-i.length]===i&&(a=a.slice(0,a.length-i.length)),a&&(a=`${a}${i}`);let p=Ft(e.slice(l),o.slice(l-n-t.length),i);p.slice(0,i.length)===i&&(p=p.slice(i.length));const r=`${a}${t}${o}${i}`;return{text:`${r}${p}`,selectionLocation:r.length}}function Et(e,s){e.setSelectionRange(s,s),e.blur(),e.focus()}function Rt(e,s){const{split:n}=s;return!n||e.indexOf(n)===-1}function jt(e,s){let{value:n=""}=s;const t=e.toLowerCase();return n.toLowerCase().indexOf(t)!==-1}const De=Symbol("MentionsContextKey");function At(){}const Ht=j({compatConfig:{MODE:3},name:"DropdownMenu",props:{prefixCls:String,options:{type:Array,default:()=>[]}},setup(e,s){let{slots:n}=s;const{activeIndex:t,setActiveIndex:o,selectOption:l,onFocus:i=At,loading:a}=Ye(De,{activeIndex:ne(),loading:ne(!1)});let p;const r=y=>{clearTimeout(p),p=setTimeout(()=>{i(y)})};return Ze(()=>{clearTimeout(p)}),()=>{var y;const{prefixCls:_,options:L}=e,v=L[t.value]||{};return x(wt,{prefixCls:`${_}-menu`,activeKey:v.value,onSelect:O=>{let{key:I}=O;const B=L.find(N=>{let{value:T}=N;return T===I});l(B)},onMousedown:r},{default:()=>[!a.value&&L.map((O,I)=>{var B,N;const{value:T,disabled:E,label:H=O.value,class:z,style:K}=O;return x(pe,{key:T,disabled:E,onMouseenter:()=>{o(I)},class:z,style:K},{default:()=>[(N=(B=n.option)===null||B===void 0?void 0:B.call(n,O))!==null&&N!==void 0?N:typeof H=="function"?H(O):H]})}),!a.value&&L.length===0?x(pe,{key:"notFoundContent",disabled:!0},{default:()=>[(y=n.notFoundContent)===null||y===void 0?void 0:y.call(n)]}):null,a.value&&x(pe,{key:"loading",disabled:!0},{default:()=>[x(ze,{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}}},Dt=j({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,s){let{slots:n}=s;const t=()=>`${e.prefixCls}-dropdown`,o=()=>{const{options:i}=e;return x(Ht,{prefixCls:t(),options:i},{notFoundContent:n.notFoundContent,option:n.option})},l=Y(()=>{const{placement:i,direction:a}=e;let p="topRight";return a==="rtl"?p=i==="top"?"topLeft":"bottomLeft":p=i==="top"?"topRight":"bottomRight",p});return()=>{const{visible:i,transitionName:a,getPopupContainer:p}=e;return x(xt,{prefixCls:t(),popupVisible:i,popup:o(),popupClassName:e.dropdownClassName,popupPlacement:l.value,popupTransitionName:a,builtinPlacements:zt,getPopupContainer:p},{default:n.default})}}}),Vt=Ge("top","bottom"),Ve={autofocus:{type:Boolean,default:void 0},prefix:X.oneOfType([X.string,X.arrayOf(X.string)]),prefixCls:String,value:String,disabled:{type:Boolean,default:void 0},split:String,transitionName:String,placement:X.oneOf(Vt),character:X.any,characterRender:Function,filterOption:{type:[Boolean,Function]},validateSearch:Function,getPopupContainer:{type:Function},options:qe(),loading:{type:Boolean,default:void 0},rows:[Number,String],direction:{type:String}},Ue=f(f({},Ve),{dropdownClassName:String}),Ke={prefix:"@",split:" ",rows:1,validateSearch:Rt,filterOption:()=>jt};Pe(Ue,Ke);var ke=function(e,s){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)s.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]]);return n};function $e(){}const Ut=j({compatConfig:{MODE:3},name:"Mentions",inheritAttrs:!1,props:Pe(Ue,Ke),emits:["change","select","search","focus","blur","pressenter"],setup(e,s){let{emit:n,attrs:t,expose:o,slots:l}=s;const i=S(null),a=S(null),p=S(),r=Ie({value:e.value||"",measuring:!1,measureLocation:0,measureText:null,measurePrefix:"",activeIndex:0,isFocus:!1});Je(()=>{r.value=e.value});const y=d=>{n("change",d)},_=d=>{let{target:{value:u}}=d;y(u)},L=(d,u,h)=>{f(r,{measuring:!0,measureText:d,measurePrefix:u,measureLocation:h,activeIndex:0})},v=d=>{f(r,{measuring:!1,measureLocation:0,measureText:null}),d?.()},O=d=>{const{which:u}=d;if(r.measuring){if(u===U.UP||u===U.DOWN){const h=D.value.length,b=u===U.UP?-1:1,m=(r.activeIndex+b+h)%h;r.activeIndex=m,d.preventDefault()}else if(u===U.ESC)v();else if(u===U.ENTER){if(d.preventDefault(),!D.value.length){v();return}const h=D.value[r.activeIndex];z(h)}}},I=d=>{const{key:u,which:h}=d,{measureText:b,measuring:m}=r,{prefix:C,validateSearch:A}=e,k=d.target;if(k.composing)return;const F=Mt(k),{location:M,prefix:P}=Bt(F,C);if([U.ESC,U.UP,U.DOWN,U.ENTER].indexOf(h)===-1)if(M!==-1){const V=F.slice(M+P.length),J=A(V,e),Q=!!W(V).length;J?(u===P||u==="Shift"||m||V!==b&&Q)&&L(V,P,M):m&&v(),J&&n("search",V,P)}else m&&v()},B=d=>{r.measuring||n("pressenter",d)},N=d=>{E(d)},T=d=>{H(d)},E=d=>{clearTimeout(p.value);const{isFocus:u}=r;!u&&d&&n("focus",d),r.isFocus=!0},H=d=>{p.value=setTimeout(()=>{r.isFocus=!1,v(),n("blur",d)},100)},z=d=>{const{split:u}=e,{value:h=""}=d,{text:b,selectionLocation:m}=Nt(r.value,{measureLocation:r.measureLocation,targetText:h,prefix:r.measurePrefix,selectionStart:a.value.getSelectionStart(),split:u});y(b),v(()=>{Et(a.value.input,m)}),n("select",d,r.measurePrefix)},K=d=>{r.activeIndex=d},W=d=>{const u=d||r.measureText||"",{filterOption:h}=e;return e.options.filter(m=>h?h(u,m):!0)},D=Y(()=>W());return o({blur:()=>{a.value.blur()},focus:()=>{a.value.focus()}}),Qe(De,{activeIndex:_e(r,"activeIndex"),setActiveIndex:K,selectOption:z,onFocus:E,onBlur:H,loading:_e(e,"loading")}),et(()=>{Z(()=>{r.measuring&&(i.value.scrollTop=a.value.getScrollTop())})}),()=>{const{measureLocation:d,measurePrefix:u,measuring:h}=r,{prefixCls:b,placement:m,transitionName:C,getPopupContainer:A,direction:k}=e,F=ke(e,["prefixCls","placement","transitionName","getPopupContainer","direction"]),{class:M,style:P}=t,V=ke(t,["class","style"]),J=Te(F,["value","prefix","split","validateSearch","filterOption","options","loading"]),Q=f(f(f({},J),V),{onChange:$e,onSelect:$e,value:r.value,onInput:_,onBlur:T,onKeydown:O,onKeyup:I,onFocus:N,onPressenter:B});return x("div",{class:ge(b,M),style:P},[x(_t,ie(ie({},Q),{},{ref:a,tag:"textarea"}),null),h&&x("div",{ref:i,class:`${b}-measure`},[r.value.slice(0,d),x(Dt,{prefixCls:b,transitionName:C,dropdownClassName:e.dropdownClassName,placement:m,options:h?D.value:[],visible:!0,direction:k,getPopupContainer:A},{default:()=>[x("span",null,[u])],notFoundContent:l.notFoundContent,option:l.option}),r.value.slice(d+u.length)])])}}}),Kt={value:String,disabled:Boolean,payload:tt()},We=f(f({},Kt),{label:nt([])}),Xe={name:"Option",props:We,render(e,s){let{slots:n}=s;var t;return(t=n.default)===null||t===void 0?void 0:t.call(n)}};j(f({compatConfig:{MODE:3}},Xe));const Wt=e=>{const{componentCls:s,colorTextDisabled:n,controlItemBgHover:t,controlPaddingHorizontal:o,colorText:l,motionDurationSlow:i,lineHeight:a,controlHeight:p,inputPaddingHorizontal:r,inputPaddingVertical:y,fontSize:_,colorBgElevated:L,borderRadiusLG:v,boxShadowSecondary:O}=e,I=Math.round((e.controlHeight-e.fontSize*e.lineHeight)/2);return{[s]:f(f(f(f(f({},be(e)),$t(e)),{position:"relative",display:"inline-block",height:"auto",padding:0,overflow:"hidden",lineHeight:a,whiteSpace:"pre-wrap",verticalAlign:"bottom"}),Lt(e,s)),{"&-disabled":{"> textarea":f({},It(e))},"&-focused":f({},Pt(e)),[`&-affix-wrapper ${s}-suffix`]:{position:"absolute",top:0,insetInlineEnd:r,bottom:0,zIndex:1,display:"inline-flex",alignItems:"center",margin:"auto"},[`> textarea, ${s}-measure`]:{color:l,boxSizing:"border-box",minHeight:p-2,margin:0,padding:`${y}px ${r}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":f({width:"100%",border:"none",outline:"none",resize:"none",backgroundColor:"inherit"},Ot(e.colorTextPlaceholder)),[`${s}-measure`]:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,zIndex:-1,color:"transparent",pointerEvents:"none","> span":{display:"inline-block",minHeight:"1em"}},"&-dropdown":f(f({},be(e)),{position:"absolute",top:-9999,insetInlineStart:-9999,zIndex:e.zIndexPopup,boxSizing:"border-box",fontSize:_,fontVariant:"initial",backgroundColor:L,borderRadius:v,outline:"none",boxShadow:O,"&-hidden":{display:"none"},[`${s}-dropdown-menu`]:{maxHeight:e.dropdownHeight,marginBottom:0,paddingInlineStart:0,overflow:"auto",listStyle:"none",outline:"none","&-item":f(f({},st),{position:"relative",display:"block",minWidth:e.controlItemWidth,padding:`${I}px ${o}px`,color:l,fontWeight:"normal",lineHeight:a,cursor:"pointer",transition:`background ${i} ease`,"&:hover":{backgroundColor:t},"&:first-child":{borderStartStartRadius:v,borderStartEndRadius:v,borderEndStartRadius:0,borderEndEndRadius:0},"&:last-child":{borderStartStartRadius:0,borderStartEndRadius:0,borderEndStartRadius:v,borderEndEndRadius:v},"&-disabled":{color:n,cursor:"not-allowed","&:hover":{color:n,backgroundColor:t,cursor:"not-allowed"}},"&-selected":{color:l,fontWeight:e.fontWeightStrong,backgroundColor:t},"&-active":{backgroundColor:t}})}})})}},Xt=ot("Mentions",e=>{const s=kt(e);return[Wt(s)]},e=>({dropdownHeight:250,controlItemWidth:100,zIndexPopup:e.zIndexPopupBase+50}));var Le=function(e,s){var n={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.indexOf(t)<0&&(n[t]=e[t]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,t=Object.getOwnPropertySymbols(e);o<t.length;o++)s.indexOf(t[o])<0&&Object.prototype.propertyIsEnumerable.call(e,t[o])&&(n[t[o]]=e[t[o]]);return n};function Yt(){return!0}const Zt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{prefix:n="@",split:t=" "}=s,o=Array.isArray(n)?n:[n];return e.split(t).map(function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",i=null;return o.some(a=>l.slice(0,a.length)===a?(i=a,!0):!1),i!==null?{prefix:i,value:l.slice(i.length)}:null}).filter(l=>!!l&&!!l.value)},qt=()=>f(f({},Ve),{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:X.any,defaultValue:String,id:String,status:String}),me=j({compatConfig:{MODE:3},name:"AMentions",inheritAttrs:!1,props:qt(),slots:Object,setup(e,s){let{slots:n,emit:t,attrs:o,expose:l}=s;var i,a;const{prefixCls:p,renderEmpty:r,direction:y}=it("mentions",e),[_,L]=Xt(p),v=ne(!1),O=ne(null),I=ne((a=(i=e.value)!==null&&i!==void 0?i:e.defaultValue)!==null&&a!==void 0?a:""),B=bt(),N=Ct.useInject(),T=Y(()=>St(N.status,e.status));yt({prefixCls:Y(()=>`${p.value}-menu`),mode:Y(()=>"vertical"),selectable:Y(()=>!1),onClick:()=>{},validator:u=>{let{mode:h}=u}}),xe(()=>e.value,u=>{I.value=u});const E=u=>{v.value=!0,t("focus",u)},H=u=>{v.value=!1,t("blur",u),B.onFieldBlur()},z=function(){for(var u=arguments.length,h=new Array(u),b=0;b<u;b++)h[b]=arguments[b];t("select",...h),v.value=!0},K=u=>{e.value===void 0&&(I.value=u),t("update:value",u),t("change",u),B.onFieldChange()},W=()=>{const u=e.notFoundContent;return u!==void 0?u:n.notFoundContent?n.notFoundContent():r("Select")},D=()=>{var u;return at(((u=n.default)===null||u===void 0?void 0:u.call(n))||[]).map(h=>{var b,m;return f(f({},rt(h)),{label:(m=(b=h.children)===null||b===void 0?void 0:b.default)===null||m===void 0?void 0:m.call(b)})})};l({focus:()=>{O.value.focus()},blur:()=>{O.value.blur()}});const d=Y(()=>e.loading?Yt:e.filterOption);return()=>{const{disabled:u,getPopupContainer:h,rows:b=1,id:m=B.id.value}=e,C=Le(e,["disabled","getPopupContainer","rows","id"]),{hasFeedback:A,feedbackIcon:k}=N,{class:F}=o,M=Le(o,["class"]),P=Te(C,["defaultValue","onUpdate:value","prefixCls"]),V=ge({[`${p.value}-disabled`]:u,[`${p.value}-focused`]:v.value,[`${p.value}-rtl`]:y.value==="rtl"},Ce(p.value,T.value),!A&&F,L.value),J=f(f(f(f({prefixCls:p.value},P),{disabled:u,direction:y.value,filterOption:d.value,getPopupContainer:h,options:e.loading?[{value:"ANTDV_SEARCHING",disabled:!0,label:x(ze,{size:"small"},null)}]:e.options||D(),class:V}),M),{rows:b,onChange:K,onSelect:z,onFocus:E,onBlur:H,ref:O,value:I.value,id:m}),Q=x(Ut,ie(ie({},J),{},{dropdownClassName:L.value}),{notFoundContent:W,option:n.option});return _(A?x("div",{class:ge(`${p.value}-affix-wrapper`,Ce(`${p.value}-affix-wrapper`,T.value,A),F,L.value)},[Q,x("span",{class:`${p.value}-suffix`},[k])]):Q)}}}),fe=j(f(f({compatConfig:{MODE:3}},Xe),{name:"AMentionsOption",props:We})),Gt=f(me,{Option:fe,getMentions:Zt,install:e=>(e.component(me.name,me),e.component(fe.name,fe),e)}),Jt="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",Qt="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",en={key:0,src:Jt,alt:"comment","cursor-pointer":""},tn={key:1,src:Qt,alt:"comment","cursor-pointer":""},mo=j({__name:"comment",setup(e){const s=G();return(n,t)=>g(s).isNightStore?(w(),$("img",en)):(w(),$("img",tn))}}),nn="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",on="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",sn="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",an="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",rn={key:0,src:nn,alt:"comment","cursor-pointer":""},ln={key:1,src:on,alt:"comment","cursor-pointer":""},un={key:0,src:sn,alt:"comment","cursor-pointer":""},cn={key:1,src:an,alt:"comment","cursor-pointer":""},fo=j({__name:"save",props:{isSaved:{type:Boolean}},setup(e){const s=G();return(n,t)=>(w(),se(lt,{name:"fade-nav",mode:"out-in"},{default:q(()=>[n.isSaved?(w(),$(ee,{key:1},[g(s).isNightStore?(w(),$("img",un)):(w(),$("img",cn))],64)):(w(),$(ee,{key:0},[g(s).isNightStore?(w(),$("img",rn)):(w(),$("img",ln))],64))]),_:1}))}}),dn="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",pn="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",mn={key:0,src:dn,alt:"comment","cursor-pointer":""},fn={key:1,class:"rtl:-scale-x-100",src:pn,alt:"comment","cursor-pointer":""},go=j({__name:"share",setup(e){const s=G();return(n,t)=>g(s).isNightStore?(w(),$("img",mn)):(w(),$("img",fn))}}),vo=async e=>await we.post("/media/create-like",{product_id:e}),ho=async e=>Me.fetch("likes","delete",{field:["user_id","product_id"],value:[te().user.id,e]}),gn=async e=>await we.post("/media/create-comment-like",{comment_id:e}),vn=async e=>Me.fetch("likes","delete",{field:["user_id","comment_id"],value:[te().user.id,e]}),hn={class:"mt-4"},xn={class:"flex text-xs gap-2"},wn=["alt"],yn={class:"flex-1"},_n={class:"flex gap-2 items-center"},bn={class:"text-xs text-gray-500"},Cn=["aria-disabled"],Sn=j({__name:"SubCommentCard",props:{item:{},addLikeLoading:{type:Boolean}},emits:["likeComment","reply"],setup(e,{emit:s}){const n=te();G();const t=s;return(o,l)=>{const i=Be("lazy");return w(),$("div",hn,[c("div",xn,[c("div",null,[ye(c("img",{alt:g(Ne),width:"40",class:"rounded-full aspect-square"},null,8,wn),[[i,{src:g(Fe)(o.item?.user?.avatar),loading:g(ae),error:g(ae)}]])]),c("div",yn,[c("div",_n,[c("div",null,R(o.item.user.name),1),c("div",bn,R(g(Ae)(o.item.created_at)),1)]),c("div",null,R(o.item.message),1)]),c("div",{class:"flex flex-col items-center gap-1 w-14px",onClick:l[0]||(l[0]=a=>t("likeComment",o.item.like?.some(p=>p.user_id===g(n).user?.id),o.item.id)),"aria-disabled":o.addLikeLoading},[x(He,{"is-gray":"","is-liked":o.item.like?.some(a=>a.user_id===g(n).user?.id)},null,8,["is-liked"]),c("div",null,R(o.item.like?.length),1)],8,Cn)])])}}}),kn={class:"mb-5"},$n={class:"flex text-xs gap-2"},Ln=["alt"],On={class:"flex-1"},Pn={class:"flex gap-2 items-center"},In={class:"text-xs text-gray-500"},Tn=["aria-disabled"],Mn={key:1,class:"ms11"},Bn=j({__name:"CommentCard",props:{item:{},addLikeLoading:{type:Boolean}},emits:["likeComment","reply"],setup(e,{emit:s}){const n=te(),t=G(),o=s,l=S(!1);return(i,a)=>{const p=Be("lazy");return w(),$("div",kn,[c("div",$n,[c("div",null,[ye(c("img",{alt:g(Ne),width:"40",class:"rounded-full aspect-square"},null,8,Ln),[[p,{src:g(Fe)(i.item.user.avatar),loading:g(ae),error:g(ae)}]])]),c("div",On,[c("div",Pn,[c("div",null,R(i.item.user.name),1),c("div",In,R(g(Ae)(i.item.created_at)),1)]),c("div",null,R(i.item.message),1),c("div",{class:"text-gray-5",onClick:a[0]||(a[0]=r=>o("reply"))},R(g(t).useString("reply")),1)]),c("div",{class:"flex flex-col items-center gap-1 w-14px","aria-disabled":i.addLikeLoading,onClick:a[1]||(a[1]=r=>o("likeComment",i.item.like?.some(y=>y.user_id===g(n).user?.id),i.item.id,!1,i.item.id))},[x(He,{"is-gray":"","is-liked":i.item.like?.some(r=>r.user_id===g(n).user?.id)},null,8,["is-liked"]),c("div",null,R(i.item.like?.length),1)],8,Tn)]),i.item?.replies?.length>0?(w(),$(ee,{key:0},[l.value?(w(),$("div",Mn,[(w(!0),$(ee,null,ve(i.item?.replies,r=>(w(),se(Sn,{item:r,onLikeComment:y=>o("likeComment",r.like?.some(_=>_.user_id===g(n).user?.id),r.id,!0,i.item.id),addLikeLoading:i.addLikeLoading},null,8,["item","onLikeComment","addLikeLoading"]))),256))])):(w(),$("div",{key:0,onClick:a[2]||(a[2]=r=>l.value=!l.value),class:"text-zinc-5 text-xs mt-2 ms-20"},R(g(t).useString("viewMoreReplies",i.item?.replies?.length)),1))],64)):oe("",!0)])}}}),Fn=["width"],Nn=j({__name:"CommentCardSkeleton",setup(e){const s=S(!1),n=S(null),t=Ie(ut(n,{width:0,height:0},{box:"border-box"}));return Ee(async()=>{s.value=!0}),(o,l)=>s.value?(w(),$("div",{key:0,ref_key:"skeletonRatio",ref:n,class:"h-fit"},[x(g(gt),{width:t.width,height:"60"},{default:q(()=>[l[0]||(l[0]=c("circle",{cx:15,cy:"30",r:"15"},null,-1)),l[1]||(l[1]=c("rect",{x:"45",y:"15",rx:"3",ry:"3",width:"100",height:"12"},null,-1)),c("rect",{x:"45",y:"35",rx:"5",ry:"5",width:t.width-100,height:"10"},null,8,Fn)]),_:1,__:[0,1]},8,["width"])],512)):oe("",!0)}}),En=async(e,s=1,n=10)=>{const t=(s-1)*n,o=t+n-1;return(await ct.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,o).order("created_at",{ascending:!1}))?.data},Oe=async(e,s,n=void 0)=>await we.post("/media/add-comment",{message:e,product_id:s,parent_id:n}),Rn={flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},jn={"mt-1":"","font-semibold":""},An={class:"flex items-center"},Hn={class:"me-1"},zn={class:"flex items-center p1"},Dn=j({__name:"CommentAddEdit",props:{open:{type:Boolean},id:{}},emits:["update:open","addCommentId"],setup(e,{emit:s}){const n=Re(),t=G(),o=te(),l=S(null),i=S(!0),a=S(null),p=S(!1),r=S(!1),y=S(!1);te();const _=S(void 0),L=()=>{i.value=a.value.scrollTop<=5};function v(){_.value=void 0}function O(){setTimeout(()=>{document.activeElement?.scrollIntoView({behavior:"smooth",block:"center"}),p.value=!0},300)}Ee(()=>{Z(()=>{a.value&&L()})});const I=e,B=s,N=S(!1),T=S([]),E=S(""),H=S(null),z=S(!1),K=S(0),W=S(20),D=async()=>{try{if(!z.value){N.value=!0;const m=await En(I.id,++K.value,W.value);m?.length<W.value&&(z.value=!0),T.value.push(...m)}}catch(m){console.log("e ===>",m)}finally{N.value=!1}};async function le(){await D(),await Z(),await l.value?.setOpen(),await H.value?.focus()}async function ue(){await Z(),await l.value?.setClose(),d(),v()}function d(){T.value=[],K.value=0,z.value=!1}const u=async()=>{try{if(E.value?.length>0){if(r.value=!0,_.value){const m=await Oe(E.value,I.id,_.value.id);_.value?.replies||(_.value.replies=[]),_.value?.replies.push({message:E.value,user:{name:o.user.name,avatar:o.user.avatar},like:[],...m}),B("addCommentId",m.id)}else{const m=await Oe(E.value,I.id);T.value?.unshift({message:E.value,user:{name:o.user.name,avatar:o.user.avatar},like:[],replies:[],...m}),B("addCommentId",m.id)}await Z(()=>{E.value="",_.value=void 0})}}catch(m){console.log(m)}finally{r.value=!1}};function h(m,C,A,k){try{if(y.value=!0,de())if(m)if(vn(C),A){const M=T.value.find(P=>P.id===k)?.replies.find(P=>P.id===C);M?.like.splice(M.like?.findIndex(P=>P.user_id===o.user?.id))}else{const F=T.value.find(M=>M.id===k);F?.like.splice(F?.like?.findIndex(M=>M.user_id===o.user?.id))}else gn(C),A?T.value.find(P=>P.id===k)?.replies.find(P=>P.id===C)?.like.push({product_id:C,user_id:o.user.id}):T.value.find(M=>M.id===k)?.like?.push({product_id:C,user_id:o.user.id});else n.push({name:"auth-login"}),he.warn(t.useString("pleaseLoginOrRegister"))}catch(F){console.log(F)}finally{y.value=!1}}const b=S();return dt(b,([{isIntersecting:m}])=>{m&&I.open&&setTimeout(()=>{D()},100)}),xe(I,m=>{m.open?le():ue()}),(m,C)=>{const A=Gt;return w(),se(je,{title:"",ref_key:"sheetRef",ref:l,headerCls:"",allowCloseScrollup:i.value,closeOnClickOutside:"",onOnClickOutside:C[3]||(C[3]=k=>B("update:open",!1)),onOnClose:C[4]||(C[4]=k=>B("update:open",!1))},{header:q(()=>[c("div",Rn,[C[5]||(C[5]=c("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""},null,-1)),c("div",jn,R(g(t).useString("comments")),1)])]),default:q(()=>[c("div",{class:ce(["h-70vh w-full relative relative",g(de)()?"pb-4rem":""])},[c("div",{class:"h-full px-4 overflow-auto",ref_key:"scrollArea",ref:a,onScroll:L},[(w(!0),$(ee,null,ve(T.value,k=>(w(),se(Bn,{item:k,onLikeComment:h,onReply:F=>_.value=k,addLikeLoading:y.value},null,8,["item","onReply","addLikeLoading"]))),256)),N.value?(w(),$(ee,{key:0},ve(5,k=>x(Nn)),64)):oe("",!0),ye(c("div",{ref_key:"observer",ref:b,class:"w-full opacity-0 relative"}," load ",512),[[pt,!N.value]])],544),g(de)()?(w(),$("div",{key:0,class:"flex w-inherit fixed gap-1 items-center my-2 px2 py-1 bottom-1",onFocusin:O,onFocusout:C[2]||(C[2]=k=>p.value=!1)},[x(vt,{width:"40",class:"w-40 ms-2",src:g(o).user?.avatar,"just-show-profile":""},null,8,["src"]),c("div",{class:ce(["border-solid flex-1 border-1 comment_input",_.value?"rounded-3xl":"rounded-full"])},[_.value?(w(),$("div",{key:0,class:ce(["rounded-t-3xl text-xs p3 mb1 flex justify-between",g(t).isNightStore?"bg-zinc-7 text-gray-2":"bg-gray-50 text-gray-4"])},[c("div",An,[c("span",null,[c("span",Hn,R(g(t).useString("replyingTo")),1),c("span",null,R(_.value?.user?.name),1)])]),x(re,{icon:"vuesax-linear:add",class:"rotate-45",color:g(t).isNightStore?"bg-zinc-7":"text-gray-4",onClick:C[0]||(C[0]=k=>_.value=void 0)},null,8,["color"])],2)):oe("",!0),c("div",zn,[x(A,{value:E.value,"onUpdate:value":C[1]||(C[1]=k=>E.value=k),placeholder:g(t).useString("yourComment"),class:"comment_input"},null,8,["value","placeholder"]),x(ht,{onClick:u,class:"rounded-full w-3.5rem",type:"primary",loading:r.value},{default:q(()=>[x(re,{icon:"vuesax-linear:arrow-up"})]),_:1},8,["loading"])])],2)],32)):oe("",!0)],2)]),_:1},8,["allowCloseScrollup"])}}}),xo=Object.assign(Dn,{__name:"CommentAddEdit"}),Vn={class:"h-fit px-4"},Un={class:"flex flex-col gap-2 mt-5 mb-5"},Kn={class:"text-sm text-white"},Wn={class:"text-red text-sm"},wo=j({__name:"moreOptionProduct",props:{open:{type:Boolean},id:{}},emits:["update:open"],setup(e,{emit:s}){const n=Re(),t=G(),o=S(null),l=e,i=s;async function a(){await Z(),await o.value?.setOpen()}async function p(){await Z(),await o.value?.setClose()}async function r(){await mt(t.useString("areYouSureToDeleteThisProduct"),_)}const y=Tt();async function _(){y.percentUpload=0,y.loading=!0;try{await ft(l.id),y.percentUpload=100,he.success(t.useString("deletedSuccessfully"))}catch(L){console.log(L),he.error(t.useString("errorInAction"))}finally{y.loading=!1,i("update:open",!1)}}return xe(l,L=>{L.open?a():p()}),(L,v)=>(w(),se(je,{title:"",ref_key:"sheetRef",ref:o,headerCls:"",closeOnClickOutside:"",onOnClickOutside:v[2]||(v[2]=O=>i("update:open",!1)),onOnClose:v[3]||(v[3]=O=>i("update:open",!1))},{header:q(()=>v[4]||(v[4]=[c("div",{flex:"","justify-center":"","items-center":"","flex-col":"","p-2":""},[c("div",{"bg-gray-500":"","h-2px":"","w-2.5rem":""})],-1)])),default:q(()=>[c("div",Vn,[c("div",Un,[c("div",{class:"flex items-center gap-3 p-3 rounded-lg bg-primary",onClick:v[0]||(v[0]=O=>g(n).push({name:"edit-product-id",params:{id:l.id}}))},[x(re,{icon:"vuesax-linear:edit",color:"white"}),c("div",Kn,R(g(t).useString("edit")),1)]),c("div",{class:"flex items-center gap-3 p-3 rounded-lg bg-red-100",onClick:v[1]||(v[1]=O=>r())},[x(re,{icon:"vuesax-linear:trash",color:"red"}),c("div",Wn,R(g(t).useString("delete")),1)])])])]),_:1},512))}});export{xo as C,wo as _,go as a,mo as b,vo as c,ho as d,fo as e};