1import{D as ue,M as de,a as p,af as fe,R as te,k as ie,N as me,l as pe,o as c,c as g,d as X,u as se,g as V,J as H,e as E,f as ae,O as L,w as J,K as N,T as oe,aV as ge,F as re,Q as le,L as he,az as ye,n as P,_ as we,r as ne,U as ve,cS as be}from"./SetupSentry-DE6y2Ajh.js";import{H as xe}from"./HoverTooltip-D-oR1nbg.js";import{_ as ke}from"./MessageTextarea-Z1wXSNL5.js";import{F as Te}from"./FormButton-CCi9BtWO.js";import{M as Ce}from"./MessageApi-7iWuP4lk.js";import{r as Ie}from"./XMarkIcon-Dpv1f6WB.js";import{r as Ae}from"./PaperAirplaneIcon-CunuTPK3.js";import"./_commonjsHelpers-DKZAErUA.js";import"./_sentry-release-injection-file-DmW9TZFH.js";import"./preload-helper-nkV39p5t.js";import"./GoogleAnalytics-kF7mJAxL.js";import"./BorderGradient-B0PSq-p-.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},k=new s.Error().stack;k&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[k]="f83b3edf-55d3-4079-ad1f-a35fd5f1932b",s._sentryDebugIdIdentifier="sentry-dbid-f83b3edf-55d3-4079-ad1f-a35fd5f1932b")}catch{}})();{var A=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};A._sentryModuleMetadata=A._sentryModuleMetadata||{},A._sentryModuleMetadata[new A.Error().stack]=Object.assign({},A._sentryModuleMetadata[new A.Error().stack],{"_sentryBundlerPluginAppKey:business-draft-crm":!0})}const Me=["aria-label"],Fe=["src","alt"],Se={class:"flex-1 overflow-hidden max-w-full"},De={key:0,class:"spinning-loader","aria-label":"Sending Message",style:{"--loader-diameter":"16px","--loader-border-size":"0.2rem"}},He={key:2,class:"flex items-center mt-3 gap-3"},Ee={__name:"SonnerToast",props:{toast:{type:Object,required:!0},isFocused:{type:Boolean,default:!1},getChannel:{type:Function,default:()=>null}},emits:["update:height","dismiss","update:is-focused","before-unmount"],setup(s,{emit:k}){const y=k,n=s,u=ue(),w=de(),f=p(),i=p(""),v=p(!1),M=p(),T=p(),O=p(!1),$=p(!0),b=p(!1),{loginAsCompany:U}=fe(w),F=te(()=>!!i.value),S=async()=>{if(!F.value){toast.warning("Please enter a message to send");return}if(!n.toast.conversationUuid||!n.toast.conversationMessageId){toast.warning("There was an issue responding to this conversation, please contact support");return}if(v.value)return;v.value=!0;const o=ye({conversation_uuid:n.toast.conversationUuid,reply_to_id:n.toast.conversationMessageId,type:"text",content_type:"text",content:i.value},"post"),l=new Ce;try{await l.createWithFiles(o),i.value="",D()}finally{v.value=!1}},D=()=>y("dismiss"),j=o=>y("update:is-focused",o),e=()=>{const o=f.value.scrollHeight;y("update:height",o)},a=()=>{O.value=M.value.scrollWidth>M.value.clientWidth,$.value=T.value.scrollHeight>T.value.clientHeight,b.value=!1},r=async()=>{b.value=!b.value,await P(),e()},C=te(()=>{const o=async(d,B,R,m)=>{const I=new URL(R,window.location.origin),K=I.pathname===window.location.pathname;if(B&&!K){const x=Object.fromEntries(I.searchParams.entries());await w.push({path:I.pathname,query:x})}else d&&(window.location.href=R);m&&await m()},l=(d,B,R,m,I,K=!1)=>{const x=m&&m[0]==="/",W=m&&!x;return{text:B,color:R,useRouterLink:!d&&x,useRawLink:!d&&W,...m&&!d?x?{to:m}:{href:m,target:"_blank"}:{},onClick:async _=>{var Z,ee;if(!d||((ee=(Z=u==null?void 0:u.user)==null?void 0:Z.activeCompany)==null?void 0:ee.id)===d){await o(W,x,m,I);return}_.preventDefault(),_.stopPropagation(),_.stopImmediatePropagation(),toast.info("Switching to the right account...");const q=u.user.companies.find(ce=>ce.id===d);if(!q)return toast.error("Hmm, we couldn't find the company you are trying to switch to â please contact support");if(await U(q.id,q.billableEntityId,async()=>{await u.fetchUserAccount()}),await P(),d!==u.user.activeCompany.id)return toast.error("There was an issue logging into the company you are trying to switch to â please contact support");await o(W,x,m,I)},classes:K?"w-full flex-1":"max-w-fit"}},t=n.toast;return[l(t.setCompanyId,t.primaryActionText,t.primaryActionButtonColor,t.primaryActionLink,t.primaryActionCallback,!0),l(t.setCompanyId,t.secondaryActionText,t.secondaryActionButtonColor,t.secondaryActionLink,t.secondaryActionCallback)].filter(d=>d.text)});let h;const Q=()=>
1{if(!F.value||!n.toast.actionIsMessage)return;const o=n.getChannel(!0);o&&o.whisper("start-typing",{id:u.user.id})},Y=()=>{if(!n.toast.actionIsMessage)return;const o=n.getChannel();o&&o.whisper("stop-typing",{id:u.user.id})};ie(()=>F.value,(o,l)=>{if(o!==l){if(clearInterval(h),o){Q(),h=setInterval(Q,2e3);return}Y()}});const z=(o,l)=>{var t;typeof((t=n.toast)==null?void 0:t.onInteract)=="function"&&n.toast.onInteract(),l(o)};return me(()=>{e(),a()}),pe(()=>{clearInterval(h),Y(),y("before-unmount")}),(o,l)=>(c(),g("li",{ref_key:"toastLi",ref:f,class:"w-full bg-black bg-opacity-80 text-white rounded-2xl backdrop-blur-sm shadow-2xl p-4 flex items-start gap-3 text-sm overflow-hidden border border-white/40","aria-label":`${s.toast.actionIsMessage?"New Message":"Event or Upcoming Event"} â ${s.toast.title} â ${s.toast.actionIsMessage?"Message Content":"Details"}: ${s.toast.description}`},[s.toast.dismissible?(c(),g("button",{key:0,type:"button","aria-label":"Dismiss Notification",class:"absolute top-2 right-2 bg-white rounded-lg bg-opacity-10 hover:bg-opacity-20 p-1 text-white z-50",onClick:l[0]||(l[0]=t=>z(t,D))},[X(se(Ie),{"aria-hidden":"true",class:"h-4 w-4"})])):V("",!0),H("div",{class:L(["rounded-full h-6 w-6 flex items-center justify-center min-w-6 mt-2 overflow-hidden",s.toast.avatar?"bg-white bg-opacity-10":s.toast.iconClasses])},[s.toast.avatar?(c(),g("img",{key:0,src:s.toast.avatar,alt:s.toast.avatarAlt,class:"h-full w-full object-cover"},null,8,Fe)):s.toast.icon?(c(),E(ae(s.toast.icon),{key:1,"aria-label":s.toast.iconAria,class:"h-4 w-4"},null,8,["aria-label"])):V("",!0)],2),H("div",Se,[(c(),E(ae(O.value?xe:"div"),{placement:"bottom",tip:s.toast.title},{default:J(()=>[H("p",{ref_key:"title",ref:M,class:"font-bold truncate pr-6"},N(s.toast.title),513)]),_:1},8,["tip"])),H("p",{ref_key:"description",ref:T,class:L(["text-xs opacity-60 font-medium mt-1 pr-6",!b.value&&"line-clamp-2 max-h-8"])},N(s.toast.description),3),$.value?(c(),g("button",{key:0,type:"button",class:"text-xs underline pt-2 pb-1 opacity-70 hover:opacity-100 text-white transition-all block text-left",onClick:l[1]||(l[1]=t=>z(t,r))},N(b.value?"Show Less":"Show More"),1)):V("",!0),s.toast.actionIsMessage?(c(),g("form",{key:1,class:"relative mt-3",onSubmit:oe(S,["prevent"])},[X(ke,{modelValue:i.value,"onUpdate:modelValue":l[2]||(l[2]=t=>i.value=t),"is-focused":s.isFocused,placeholder:`Reply to ${s.toast.conversationSenderFirst||"user"}...`,"is-small-dark":"","onUpdate:height":e,"onUpdate:isFocused":j,onKeydown:ge(oe(S,["prevent"]),["enter"])},null,8,["modelValue","is-focused","placeholder","onKeydown"]),H("button",{type:"submit",class:L(["rounded-md p-1.5 bg-bdBlue-600 text-white flex items-center justify-center absolute right-1 top-1/2 -translate-y-1/2",!i.value&&"opacity-80"]),"aria-label":"Send Message"},[v.value?(c(),g("span",De)):(c(),E(se(Ae),{key:1,"aria-label":"Paper Airplane Icon",class:"h-4 w-4"}))],2)],32)):C.value.length?(c(),g("div",He,[(c(!0),g(re,null,le(C.value,(t,G)=>(c(),E(Te,{key:G,"use-router-link":t.useRouterLink,"use-raw-link":t.useRawLink,to:t==null?void 0:t.to,href:t==null?void 0:t.href,color:t.color,class:L(t.classes),size:"sm",bold:"",onClick:d=>z(d,t.onClick)},{default:J(()=>[he(N(t.text),1)]),_:2},1032,["use-router-link","use-raw-link","to","href","color","class","onClick"]))),128))])):V("",!0)])],8,Me))}},Le=["aria-expanded"],Oe="124px",$e=2e3,Re=350,Ve={__name:"SonnerToasts",props:{placement:{type:String,default:"fixed bottom-4 right-6"},show:{type:Boolean,default:!1},currentToasts:{type:Array,default:()=>[]},maxVisibleToasts:{type:Number,default:3}},emits:["dismiss"],setup(s,{emit:k}){const y=k,n=s,u=ne({}),w=ne({}),f=p([]),i=p({}),v=p(!1),M=()=>f.value.some(e=>S(e.id)),T=()=>{if(!v.value&&!M()){f.value=[...n.currentToasts].slice(-n.maxVisibleToasts);return}setTimeout(T,$e)},O=(e=!1,a=null)=>{if(!a)return null;if(!i[a]){if(!e)return null;i[a]={value:window.Echo.join(`Conversation.${a}`),usedByCount:0}}return i[a].usedByCount++,i[a].value},$=async e=>{!e||!i[e]||(i[e].usedByCount--,await P(),i[e].usedByCount<=0&&(window.Echo.leave(`Conversation.${e}`),delete i[e]))},b=async(e,a)=>{await P(),setTimeout(()=>{u[e]=a},Re)},U=(e,a)=>w[e]=a,F=e=>u[e]||Oe,S=e=>w[e]||!1,D=e=>v.value=e,j=e=>y("dismiss",e);return ie(()=>n.currentToasts,()=>
1{T(),Object.keys(u).forEach(e=>{n.currentToasts.some(a=>a.id===e)||delete u[e]}),Object.keys(w).forEach(e=>{n.currentToasts.some(a=>a.id===e)||delete w[e]}),f.value=f.value.filter(e=>n.currentToasts.some(a=>a.id===e.id))},{immediate:!0,deep:!0}),(e,a)=>(c(),g("ol",{class:L([[s.placement,!s.show&&"scale-0 opacity-0"],"w-80 flex flex-col transition-all origin-bottom-right sonner-group z-0"]),role:"alert","aria-live":"assertive","aria-atomic":"true","aria-expanded":s.show?"true":"false",style:{"--offset-y":"0"},onMouseenter:a[0]||(a[0]=r=>D(!0)),onMouseleave:a[1]||(a[1]=r=>D(!1))},[X(be,{name:"sonner-transition"},{default:J(()=>[(c(!0),g(re,null,le(f.value,(r,C)=>(c(),E(Ee,{key:r.id,"is-focused":S(r.id),toast:r,style:ve(`--toasts-before:${f.value.length-C};--z-index:${f.value.length-C};--toast-height:${F(r.id)};`),"data-is-most-recent":C===f.value.length-1?"true":"false","get-channel":(h=!1)=>O(h,r.conversationUuid),class:"sonner-toast",onBeforeUnmount:()=>$(r==null?void 0:r.conversationUuid),"onUpdate:height":h=>b(r.id,h),"onUpdate:isFocused":h=>U(r.id,h),onDismiss:()=>j(r.id)},null,8,["is-focused","toast","style","data-is-most-recent","get-channel","onBeforeUnmount","onUpdate:height","onUpdate:isFocused","onDismiss"]))),128))]),_:1})],42,Le))}},Ge=we(Ve,[["__scopeId","data-v-799da4f4"]]);export{Ge as default}; 2//# sourceMappingURL=SonnerToasts-CpJP4Yxv.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.