1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3974],{5431:(e,a,t)=>{t.d(a,{r:()=>h});var s=t(22454),r=t(92343);let l=(()=>{let e="https://backend.wizebot.com.br".replace(/\/$/,"");return e.endsWith("/api/v1")?e:"".concat(e,"/api/v1")})();class n extends Error{constructor(e){super("rate-limited"),this.retryAfterMs=e,this.name="MediaRateLimitError"}}class i extends Error{constructor(e,a){super(e),this.statusCode=a,this.name="MediaResolveError"}}function d(e){return e&&"object"==typeof e&&"data"in e&&null!=e.data?e.data:e}let o=[],c=null;function m(e){return e?"completed"===e?"available":"processing"===e?"downloading":e:null}function u(e){let a=e.headers.get("retry-after"),t=a?Number.parseInt(a,10):NaN;return Number.isFinite(t)&&t>0?1e3*t:3e4}async function x(e){let a=[...new Set(e.map(e=>e.mediaId))];try{if(1===a.length){let t=await p(a[0]);e.forEach(e=>e.resolve(t));return}let t=await (0,r.Hh)("".concat(l,"/whatsapp/media/resolved-urls"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mediaIds:a})});if(429===t.status){let a=new n(u(t));e.forEach(e=>e.reject(a));return}if(!t.ok){let a=await t.text().catch(()=>""),s=new i("resolved-urls ".concat(t.status,": ").concat(a.slice(0,200)),t.status);e.forEach(e=>e.reject(s));return}let s=d(await t.json()),o=new Map(((null==s?void 0:s.results)||[]).map(e=>[e.mediaId,e]));e.forEach(e=>{let a=o.get(e.mediaId);if(!a)return void e.reject(new i("sem resultado para ".concat(e.mediaId)));try{e.resolve(function(e){var a,t;if("ok"===e.status&&e.url)return{url:e.url,mimeType:null!=(a=e.mimeType)?a:null,serverStatus:"available"};if("not_ready"===e.status)return{url:null,mimeType:null!=(t=e.mimeType)?t:null,serverStatus:m(e.mediaStatus)};if("not_found"===e.status||"invalid"===e.status)return{url:null,mimeType:null,serverStatus:"unknown"};throw new i("falha ao assinar m\xeddia ".concat(e.mediaId))}(a))}catch(a){e.reject(a)}})}catch(a){e.forEach(e=>e.reject(a))}}async function p(e){var a,t;let s=await (0,r.Hh)("".concat(l,"/whatsapp/media/").concat(e,"/resolved-url"));if(429===s.status)throw new n(u(s));if(409===s.status){let e=d(await s.json());return{url:null,mimeType:null!=(a=e.mimeType)?a:null,serverStatus:m(e.mediaStatus)}}if(404===s.status||400===s.status)return{url:null,mimeType:null,serverStatus:"unknown"};if(!s.ok){let e=await s.text().catch(()=>"");throw new i("resolved-url ".concat(s.status,": ").concat(e.slice(0,200)),s.status)}let o=d(await s.json());return{url:o.url,mimeType:null!=(t=o.mimeType)?t:null,serverStatus:"available"}}function h(e){var a,t,r,l;let{mediaId:i,mediaStatus:d}=e,m=(0,s.I)({queryKey:["media-url",i],enabled:!!i&&"unknown"!==i&&("available"===d||void 0===d),staleTime:72e4,gcTime:9e5,retry:(e,a)=>!(a instanceof n)&&e<1,queryFn:()=>new Promise((e,a)=>{if(o.push({mediaId:i,resolve:e,reject:a}),new Set(o.map(e=>e.mediaId)).size>=50){let e=o;o=[],c&&(clearTimeout(c),c=null),x(e);return}c||(c=setTimeout(()=>{let e=o;o=[],c=null,x(e)},30))})});return{url:null!=(r=null==(a=m.data)?void 0:a.url)?r:null,isLoading:m.isLoading,isError:m.isError,serverStatus:null!=(l=null==(t=m.data)?void 0:t.serverStatus)?l:null,refetch:()=>m.refetch()}}},23974:(e,a,t)=>{t.r(a),t.d(a,{KanbanCardModal:()=>eq,default:()=>eU});var s=t(95155),r=t(12115),l=t(4538),n=t(20063),i=t(86917),d=t(54679),o=t(79235),c=t(97003),m=t(35496),u=t(66970),x=t(39489),p=t(14747),h=t(21344);class g{async generateSummary(e){return this.api.post("/api/v1/ai/summary/generate",e)}constructor(){this.api=new h.OW}}let f=new g,N={activeTab:"summary",isEditing:!1,editedName:"",showDeleteConfirm:!1,isSaving:!1,hasChanges:!1,localStages:[],loadingStages:!1,expandedStages:[],newNote:"",backendNotes:[],backendMedia:[],loadingNotes:!1,loadingMedia:!1,savingNote:!1,generatingSummary:!1,summaryStatus:"",summarySuggestion:"",formData:{pipelineId:"",stageId:"",priority:"medium",assigneeId:"",value:"",aiSummary:"",tags:[],notes:[]}};function v(e,a){switch(a.type){case"SET_TAB":return{...e,activeTab:a.payload};case"START_EDITING":return{...e,isEditing:!0,editedName:a.payload};case"STOP_EDITING":return{...e,isEditing:!1};case"SET_EDITED_NAME":return{...e,editedName:a.payload};case"TOGGLE_DELETE_CONFIRM":return{...e,showDeleteConfirm:a.payload};case"SET_SAVING":return{...e,isSaving:a.payload};case"SET_HAS_CHANGES":return{...e,hasChanges:a.payload};case"SET_LOCAL_STAGES":return{...e,localStages:a.payload};case"ADD_LOCAL_STAGES":return{...e,localStages:[...e.localStages,...a.payload]};case"SET_LOADING_STAGES":return{...e,loadingStages:a.payload};case"TOGGLE_STAGE_EXPANDED":return{...e,expandedStages:e.expandedStages.includes(a.payload)?e.expandedStages.filter(e=>e!==a.payload):[...e.expandedStages,a.payload]};case"SET_EXPANDED_STAGES":return{...e,expandedStages:a.payload};case"SET_NEW_NOTE":return{...e,newNote:a.payload};case"SET_BACKEND_NOTES":return{...e,backendNotes:a.payload};case"ADD_BACKEND_NOTE":return{...e,backendNotes:[a.payload,...e.backendNotes]};case"REMOVE_BACKEND_NOTE":return{...e,backendNotes:e.backendNotes.filter(e=>e.id!==a.payload)};case"SET_BACKEND_MEDIA":return{...e,backendMedia:a.payload};case"SET_LOADING_NOTES":return{...e,loadingNotes:a.payload};case"SET_LOADING_MEDIA":return{...e,loadingMedia:a.payload};case"SET_SAVING_NOTE":return{...e,savingNote:a.payload};case"SET_GENERATING_SUMMARY":return{...e,generatingSummary:a.payload};case"SET_SUMMARY_RESULT":return{...e,summaryStatus:a.payload.status,summarySuggestion:a.payload.suggestion};case"UPDATE_FORM_DATA":return{...e,formData:{...e.formData,...a.payload},hasChanges:!0};case"RESET_FORM":{var t,s;let{card:e,stages:r}=a.payload;return{...N,localStages:r.filter(a=>a.pipelineId===e.pipelineId),expandedStages:[e.stageId],formData:{pipelineId:e.pipelineId,stageId:e.stageId,priority:e.priority,assigneeId:(null==(t=e.assignee)?void 0:t.id)||"",value:(null==(s=e.value)?void 0:s.toString())||"",aiSummary:e.aiSummary||"",tags:e.tags||[],notes:e.notes||[]}}}default:return e}}var y=t(33884),j=t(33789),b=t(47507),w=t(25016),S=t(26196),E=t(48215),A=t(35110),C=t(2499),T=t(6061),D=t(46436),k=t(2149);let _={low:{label:"Baixa",color:"text-muted-foreground",bg:"bg-muted"},medium:{label:"M\xe9dia",color:"text-info",bg:"bg-info/10"},high:{label:"Alta",color:"text-warning",bg:"bg-warning/10"},urgent:{label:"Urgente",color:"text-destructive",bg:"bg-destructive/10"}},I={whatsapp:"WhatsApp",instagram:"Instagram",telegram:"Telegram",email:"Email"},M={whatsapp:C.A,instagram:T.A,telegram:D.A,email:k.A},O=e=>{if(!e)return"";let a=new Date(e);return isNaN(a.getTime())?"":new Intl.DateTimeFormat("pt-BR",{day:"2-digit",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}).format(a)};var L=t(89712),R=t(55165),F=t(47522),G=t(2186),B=t(27610),P=t(47619),z=t(355),$=t(59962),q=t(93759),U=t(88954),V=t(99099);function K(e){let{currentTags:a,onAddTag:t,onRemoveTag:l}=e,[n,i]=(0,r.useState)(!1),[d,o]=(0,r.useState)([]),[c,m]=(0,r.useState)(""),u=(0,r.useRef)(null);(0,r.useEffect)(()=>{n&&A._.getAllTags().then(e=>{Array.isArray(e)&&o(e)}).catch(()=>{})},[n]),(0,r.useEffect)(()=>
1{if(!n)return;let e=e=>{u.current&&!u.current.contains(e.target)&&i(!1)},a=setTimeout(()=>document.addEventListener("mousedown",e),0);return()=>{clearTimeout(a),document.removeEventListener("mousedown",e)}},[n]);let x=new Set(a.map(e=>e.id)),p=d.filter(e=>!x.has(e.id)&&(!c.trim()||e.name.toLowerCase().includes(c.toLowerCase())));return(0,s.jsxs)("div",{className:"relative",ref:u,children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(!n),className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors border border-dashed border-border/50",children:[(0,s.jsx)(L.A,{className:"w-[9px] h-[9px]"}),(0,s.jsx)("span",{children:"Tag"})]}),n&&(0,s.jsxs)("div",{className:"absolute top-full left-0 mt-1 z-50 w-56 bg-card border border-border/30 rounded-xl shadow-xl shadow-black/15 dark:shadow-black/30 overflow-hidden",children:[(0,s.jsx)("div",{className:"p-2",children:(0,s.jsx)("input",{value:c,onChange:e=>m(e.target.value),placeholder:"Buscar tag...",className:"w-full h-7 px-2.5 text-xs bg-muted/50 border border-border/30 rounded-md outline-none focus:ring-1 focus:ring-ring/50",autoFocus:!0})}),(0,s.jsx)("div",{className:"max-h-36 overflow-y-auto px-1 pb-1",children:0===p.length?(0,s.jsx)("div",{className:"text-xs text-muted-foreground text-center py-3",children:0===d.length?"Carregando...":"Nenhuma tag dispon\xedvel"}):p.map(e=>(0,s.jsxs)("button",{type:"button",onClick:()=>{t({id:e.id,name:e.name,color:e.color||"#6B7280"}),m("")},className:"w-full flex items-center gap-2 px-2.5 py-1.5 rounded-md text-xs hover:bg-accent transition-colors text-left",children:[(0,s.jsx)("span",{className:"w-2.5 h-2.5 rounded-full flex-shrink-0",style:{backgroundColor:e.color||"var(--muted-foreground)"}}),(0,s.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]})}function J(e){var a,t,r,l,n,i,d;let{card:o,formData:m,isEditing:u,editedName:x,pipelines:p,assignees:h,onStartEdit:g,onSaveEdit:f,onCancelEdit:N,onEditedNameChange:v,onFormDataChange:A,onPipelineChange:C,onGoToChat:T}=e,D=(0,S.gY)(o.contact.phone||"");return(0,s.jsxs)("div",{className:"px-6 py-6",children:[(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsxs)(y.eu,{className:"w-16 h-16 rounded-xl",children:[o.contact.avatar&&(0,s.jsx)(y.BK,{src:o.contact.avatar,alt:o.contact.name,className:"rounded-xl"}),(0,s.jsx)(y.q5,{className:(0,w.cn)(D.bg,D.icon,"rounded-xl"),children:(0,s.jsx)(R.A,{className:"w-6 h-6"})})]}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[u?(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)(j.p,{value:x,onChange:e=>v(e.target.value),className:"h-9 text-lg font-semibold",autoFocus:!0}),(0,s.jsx)(c.$,{size:"sm",onClick:f,children:(0,s.jsx)(F.A,{className:"w-5 h-5"})}),(0,s.jsx)(c.$,{size:"sm",variant:"ghost",onClick:N,children:(0,s.jsx)(G.A,{className:"w-5 h-5"})})]}):(0,s.jsx)("h1",{className:"text-xl font-semibold text-card-foreground truncate cursor-pointer hover:text-primary-text transition-colors",onClick:g,children:o.contact.name}),o.contact.phone&&(0,s.jsxs)("p",{className:"text-sm text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[(0,s.jsx)(B.A,{className:"w-2.5 h-2.5"}),(0,E.q)(o.contact.phone,"")]}),o.contact.email&&(0,s.jsxs)("p",{className:"text-xs text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[(0,s.jsx)(k.A,{className:"w-2.5 h-2.5"}),o.contact.email]})]}),(0,s.jsxs)(c.$,{variant:"default",size:"sm",className:"shrink-0",onClick:T,children:[(0,s.jsx)(P.A,{className:"w-5 h-5 mr-2"}),"Ir para o Chat"]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mt-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-muted/50 rounded-full text-xs",children:[(0,s.jsx)(z.A,{className:"w-5 h-5 text-muted-foreground"}),(0,s.jsx)("span",{className:"font-medium",children:(e=>{let a="string"==typeof e?parseFloat(e):e;return isNaN(a)?"R$ 0":new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL",minimumFractionDigits:0}).format(a)})(m.value||0)})]}),(0,s.jsxs)("div",{className:(0,w.cn)("flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs",null==(a=_[m.priority])?void 0:a.bg),children:[(0,s.jsx)($.A,{className:(0,w.cn)("w-5 h-5",null==(t=_[m.priority])?void 0:t.color)}),(0,s.jsx)("span",{className:(0,w.cn)("font-medium",null==(r=_[m.priority])?void 0:r.color),children:null==(l=_[m.priority])?void 0:l.label})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-muted/50 rounded-full text-xs",children:[(()=>{let e=M[o.channel]||q.A;return(0,s.jsx)(e,{className:"w-5 h-5 text-muted-foreground"})})(),(0,s.jsx)("span",{className:"font-medium",children:I[o.channel]||o.channel})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-muted/50 rounded-full text-xs",children:[(0,s.jsx)(U.A,{className:"w-5 h-5 text-muted-foreground"}),(0,s.jsx)("span",{className:"font-medium",children:(e=>{if(!e)return"";let a=new Date(e);return isNaN(a.getTime())?"":new Intl.DateTimeFormat("pt-BR",{day:"2-digit",month:"2-digit",year:"numeric"}).format(a)})(o.createdAt)})]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 mt-4",children:[m.tags.map(e=>(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 px-2 py-1 rounded-md text-xs font-medium group",style:{backgroundColor:e.color+"20",color:e.color,border:"1px solid ".concat(e.color,"40")},children:[(0,s.jsx)("span",{className:"w-2 h-2 rounded-full flex-shrink-0",style:{backgroundColor:e.color}}),e.name,(0,s.jsx)("button",{type:"button",onClick:()=>A({tags:m.tags.filter(a=>a.id!==e.id)}),className:"ml-0.5 opacity-0 group-hover:opacity-100 hover:text-destructive transition-opacity p-0.5","aria-label":"Remover tag ".concat(e.name),children:(0,s.jsx)(G.A,{className:"w-2 h-2"})})]},e.id)),(0,s.jsx)(K,{currentTags:m.tags,onAddTag:e=>A({tags:[...m.tags,e]}),onRemoveTag:e=>A({tags:m.tags.filter(a=>a.id!==e)})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-3 mt-4",children:[(0,s.jsxs)(b.l6,{value:m.assigneeId||"none",onValueChange:e=>A({assigneeId:"none"===e?"":e}),children:[(0,s.jsx)(b.bq,{className:"w-auto h-8 px-3 text-xs bg-transparent border border-border/50 hover:bg-accent rounded-lg [&>svg]:hidden",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(y.eu,{className:"w-5 h-5",children:[(()=>{let e=h.find(e=>e.id===m.assigneeId);return(null==e?void 0:e.avatar)?(0,s.jsx)(y.BK,{src:e.avatar,alt:e.name}):null})(),(0,s.jsx)(y.q5,{className:"bg-primary/10 text-primary",children:(0,s.jsx)(R.A,{className:"w-2 h-2"})})]}),(0,s.jsx)("span",{children:m.assigneeId?null==(n=h.find(e=>e.id===m.assigneeId))?void 0:n.name:"Sem atribui\xe7\xe3o"}),(0,s.jsx)(V.A,{className:"text-muted-foreground w-3.5 h-3.5"})]})}),(0,s.jsxs)(b.gC,{children:[(0,s.jsx)(b.eb,{value:"none",children:"Sem atribui\xe7\xe3o"}),h.map(e=>(0,s.jsx)(b.eb,{value:e.id,children:e.name},e.id))]})]}),(0,s.jsxs)(b.l6,{value:m.pipelineId,onValueChange:C,children:[(0,s.jsx)(b.bq,{className:"w-auto h-8 px-3 text-xs bg-transparent border border-border/50 hover:bg-accent rounded-lg [&>svg]:hidden",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:(null==(i=p.find(e=>e.id===m.pipelineId))?void 0:i.color)||"var(--muted-foreground)"}}),(0,s.jsx)("span",{children:(null==(d=p.find(e=>e.id===m.pipelineId))?void 0:d.name)||"Pipeline"}),(0,s.jsx)(V.A,{className:"text-muted-foreground w-3.5 h-3.5"})]})}),(0,s.jsx)(b.gC,{children:p.map(e=>(0,s.jsx)(b.eb,{value:e.id,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:e.color}}),e.name]})},e.id))})]})]})]})}let H=[{id:"summary",label:"Resumo"},{id:"activities",label:"Atividades"},{id:"tasks",label:"Tarefas"},{id:"products",label:"Produtos"},{id:"media",label:"M\xeddias"},{id:"notes",label:"Notas"}];function W(e){let{activeTab:a,onTabChange:t}=e;return(0,s.jsx)("div",{className:"px-6 overflow-x-auto scrollbar-hide",children:(0,s.jsx)("div",{className:"flex gap-4 min-w-max",children:H.map(e=>(0,s.jsxs)("button",{onClick:()=>t(e.id),className:(0,w.cn)("pb-3 text-sm font-medium transition-colors relative",a===e.id?"text-card-foreground":"text-muted-foreground hover:text-card-foreground"),children:[e.label,a===e.id&&(0,s.jsx)("div",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full"})]},e.id))})})}var X=t(36838),Y=t(61456),Q=t(48239),Z=t(42404),ee=t(72556);function ea(e){let{hasChanges:a,isSaving:t,onDelete:r,onClose:l,onSave:n,onCloseDeal
1:i,onReopenDeal:d,dealStatus:o}=e,m="won"===o||"lost"===o;return(0,s.jsx)("div",{className:"px-6 py-4 border-t border-border/50 bg-muted/30",children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(c.$,{variant:"ghost",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:r,children:[(0,s.jsx)(Y.A,{className:"w-5 h-5 mr-2"}),"Excluir"]}),m&&d&&(0,s.jsxs)(c.$,{variant:"outline",size:"sm",onClick:d,children:[(0,s.jsx)(Q.A,{className:"w-5 h-5 mr-2"}),"Reabrir"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[!m&&i&&(0,s.jsxs)(c.$,{variant:"outline",onClick:i,children:[(0,s.jsx)(Z.A,{className:"w-5 h-5 mr-2"}),"Fechar Deal"]}),(0,s.jsx)(c.$,{variant:"outline",onClick:l,children:"Cancelar"}),(0,s.jsx)(c.$,{onClick:n,disabled:t||!a,children:t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X.y,{className:"mr-2"}),"Salvando..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ee.A,{className:"w-5 h-5 mr-2"}),"Salvar altera\xe7\xf5es"]})})]})]})})}var et=t(3235),es=t(33186),er=t(64443),el=t(10254),en=t(45600),ei=t(7991),ed=t(47185);function eo(e){let{card:a,formData:t,generatingSummary:l,summaryStatus:n,summarySuggestion:i,onGenerateSummary:d,onFormDataChange:o,onGoToChat:m}=e,[u,x]=(0,r.useState)(!1),[p,h]=(0,r.useState)(t.aiSummary||"");return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsxs)(c.$,{variant:"outline",size:"sm",onClick:()=>{h(t.aiSummary||""),x(!0)},disabled:u,children:[(0,s.jsx)(et.A,{className:"w-5 h-5 mr-2"}),"Editar"]}),(0,s.jsx)(c.$,{variant:t.aiSummary?"outline":"default",size:"sm",onClick:()=>d(!!t.aiSummary),disabled:l||u,children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X.y,{className:"mr-2"}),"Gerando..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(es.A,{className:"w-5 h-5 mr-2"}),t.aiSummary?"Regenerar":"Gerar com IA"]})})]}),u?(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"p-4 bg-card border border-border rounded-xl",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)(et.A,{className:"w-5 h-5 text-primary"}),(0,s.jsx)("h3",{className:"text-sm font-semibold text-card-foreground",children:"Editar Resumo"})]}),(0,s.jsx)("textarea",{value:p,onChange:e=>h(e.target.value),placeholder:"Digite o resumo do atendimento...",className:"w-full min-h-[120px] bg-transparent text-sm text-card-foreground leading-relaxed resize-y border-none outline-none placeholder:text-muted-foreground",autoFocus:!0})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,s.jsx)(c.$,{variant:"ghost",size:"sm",onClick:()=>{h(t.aiSummary||""),x(!1)},children:"Cancelar"}),(0,s.jsx)(c.$,{size:"sm",onClick:()=>{o({aiSummary:p.trim()}),x(!1)},children:"Salvar resumo"})]})]}):t.aiSummary?(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"p-4 bg-primary/5 border border-primary/20 rounded-xl",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)(er.A,{className:"w-5 h-5 text-primary"}),(0,s.jsx)("h3",{className:"text-sm font-semibold text-card-foreground",children:"Resumo"})]}),(0,s.jsx)("p",{className:"text-sm text-card-foreground leading-relaxed whitespace-pre-wrap",children:t.aiSummary})]}),n&&(0,s.jsx)("div",{className:"p-3 bg-muted/30 border border-border/50 rounded-xl",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:["Conclu\xeddo"===n&&(0,s.jsx)(el.A,{className:"w-4 h-4 text-green-500"}),"Pendente"===n&&(0,s.jsx)(en.A,{className:"w-4 h-4 text-yellow-500"}),"Lead Quente"===n&&(0,s.jsx)(ei.A,{className:"w-4 h-4 text-orange-500"}),(0,s.jsxs)("span",{className:"text-sm font-medium text-card-foreground",children:["Status: ",n]})]})}),i&&(0,s.jsx)("div",{className:"p-3 bg-info/5 border border-info/20 rounded-xl",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(ed.A,{className:"w-5 h-5 text-info mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs font-medium text-info",children:"Pr\xf3ximo passo sugerido:"}),(0,s.jsx)("p",{className:"text-sm text-card-foreground mt-1",children:i})]})]})})]}):(0,s.jsxs)("div",{className:"text-center py-8",children:[(0,s.jsx)("div",{className:"w-16 h-16 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)(es.A,{className:"w-6 h-6 text-muted-foreground"})}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nenhum resumo dispon\xedvel"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Use o bot\xe3o de IA para gerar automaticamente ou o l\xe1pis para escrever manualmente"})]}),a.lastMessage&&(0,s.jsxs)("div",{className:"p-4 bg-muted/30 border border-border/50 rounded-xl",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)(q.A,{className:"w-5 h-5 text-muted-foreground"}),(0,s.jsx)("h3",{className:"text-sm font-medium text-card-foreground",children:"\xdaltima Mensagem"})]}),(0,s.jsxs)("p",{className:"text-sm text-card-foreground",children:[!a.lastMessage.isFromContact&&(0,s.jsx)("span",{className:"text-primary-text font-medium",children:"Voc\xea: "}),a.lastMessage.content]}
1),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:O(a.lastMessage.timestamp)})]}),(0,s.jsxs)(c.$,{variant:"outline",className:"w-full",onClick:m,children:[(0,s.jsx)(P.A,{className:"w-5 h-5 mr-2"}),"Ver conversa completa"]})]})}var ec=t(68122),em=t(79350),eu=t(54025),ex=t(59493),ep=t(66176),eh=t(99743);function eg(e){let{media:a,loading:t}=e;return t?(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2",children:[1,2,3,4,5,6].map(e=>(0,s.jsx)(ec.E,{className:"aspect-square rounded-lg"},e))}):0===a.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("div",{className:"w-16 h-16 rounded-full bg-muted/50 flex items-center justify-center mx-auto mb-4",children:(0,s.jsx)(em.A,{className:"w-6 h-6 text-muted-foreground"})}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nenhuma m\xeddia compartilhada ainda"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"M\xeddias enviadas na conversa aparecer\xe3o aqui"})]}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2",children:a.map(e=>(0,s.jsxs)("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted/50 border border-border/50 hover:border-primary/50 transition-colors group relative",children:["image"===e.type?(0,s.jsx)(eh.w,{mediaId:e.media_id,alt:e.filename||"Imagem"}):"video"===e.type?(0,s.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:(0,s.jsx)(eu.A,{className:"w-6 h-6 text-muted-foreground"})}):"audio"===e.type?(0,s.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-muted",children:(0,s.jsx)(ex.A,{className:"w-6 h-6 text-muted-foreground"})}):(0,s.jsxs)("div",{className:"w-full h-full flex flex-col items-center justify-center bg-muted p-2",children:[(0,s.jsx)(er.A,{className:"w-6 h-6 text-muted-foreground mb-1"}),(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground text-center truncate w-full",children:e.filename||"Documento"})]}),(0,s.jsx)("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/20 transition-colors flex items-center justify-center opacity-0 group-hover:opacity-100",children:(0,s.jsx)(ep.A,{className:"w-[18px] h-[18px] text-white"})})]},e.id))}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground text-center",children:[a.length," m\xeddia(s) encontrada(s)"]})]})}function ef(e){let{notes:a,loading:t,newNote:r,savingNote:l,onNewNoteChange:n,onAddNote:i,onDeleteNote:d}=e;return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("textarea",{value:r,onChange:e=>n(e.target.value),placeholder:"Adicionar uma nota...",className:"w-full p-3 bg-input-bg border border-border/50 rounded-xl text-sm resize-none outline-none focus-visible:ring-[2px] focus-visible:ring-ring/50 focus-visible:border-ring placeholder:text-muted-foreground transition-all hover:bg-input-bg-hover focus-visible:bg-input-bg-focus",rows:3,disabled:l}),(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsx)(c.$,{size:"sm",onClick:i,disabled:!r.trim()||l,children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(X.y,{className:"mr-2"}),"Salvando..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(L.A,{className:"w-5 h-5 mr-2"}),"Adicionar nota"]})})})]}),t?(0,s.jsx)("div",{className:"space-y-3 mt-6",children:[1,2,3].map(e=>(0,s.jsx)(ec.E,{className:"h-24 rounded-xl"},e))}):a.length>0?(0,s.jsx)("div",{className:"space-y-3 mt-6",children:a.map(e=>(0,s.jsxs)("div",{className:"p-4 bg-muted/30 border border-border/50 rounded-xl group relative",children:[(0,s.jsx)("p",{className:"text-sm text-card-foreground whitespace-pre-wrap",children:e.content}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:O(new Date(e.created_at))}),(0,s.jsx)("button",{onClick:()=>d(e.id),className:"absolute top-2 right-2 p-1.5 rounded-lg opacity-0 group-hover:opacity-100 hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-all",title:"Excluir nota",children:(0,s.jsx)(Y.A,{className:"w-3.5 h-3.5"})})]},e.id))}):(0,s.jsx)("div",{className:"text-center py-8",children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"Nenhuma nota adicionada"})})]})}var eN=t(26138),ev=t(68595),ey=t(65633),ej=t(17148),eb=t(21470),ew=t(83818),eS=t(73790);let eE={created:(0,s.jsx)(L.A,{className:"w-4 h-4 text-green-500"}),stage_changed:(0,s.jsx)(ev.A,{className:"w-4 h-4 text-blue-500"}),assigned:(0,s.jsx)(ey.A,{className:"w-4 h-4 text-purple-500"}),unassigned:(0,s.jsx)(ey.A,{className:"w-4 h-4 text-gray-400"}),value_changed:(0,s.jsx)(ej.A,{className:"w-4 h-4 text-yellow-500"}),priority_changed:(0,s.jsx)(ej.A,{className:"w-4 h-4 text-orange-500"}),tag_added:(0,s.jsx)(eb.A,{className:"w-4 h-4 text-teal-500"}),tag_removed:(0,s.jsx)(eb.A,{className:"w-4 h-4 text-gray-400"}),note_added:(0,s.jsx)(P.A,{className:"w-4 h-4 text-blue-400"}),message_sent:(0,s.jsx)(P.A,{className:"w-4 h-4 text-green-400"}),message_received:(0,s.jsx)(P.A,{className:"w-4 h-4 text-blue-400"}),won:(0,s.jsx)(ew.A,{className:"w-4 h-4 text-yellow-500"}),lost:(0,s.jsx)(eS.A,{className:"w-4 h-4 text-red-500"}),reopened:(0,s.jsx)(ev.A,{className:"w-4 h-4 text-green-500"})};function eA(e){let{dealId:a}=e,[t,l]=(0,r.useState)([]),[n,i]=(0,r.useState)(!0);(0,r.useEffect)(()=>{d()},[a]);let d=async()=>{try{i(!0);
1let e=await eN.s.getDealActivities(a);l(e)}catch(e){}finally{i(!1)}};return n?(0,s.jsx)("div",{className:"space-y-3 p-4",children:[1,2,3,4].map(e=>(0,s.jsxs)("div",{className:"flex gap-3 animate-pulse",children:[(0,s.jsx)("div",{className:"w-7 h-7 rounded-full bg-muted"}),(0,s.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,s.jsx)("div",{className:"h-3 bg-muted rounded w-3/4"}),(0,s.jsx)("div",{className:"h-2.5 bg-muted rounded w-1/3"})]})]},e))}):0===t.length?(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-8 text-muted-foreground",children:[(0,s.jsx)(en.A,{className:"w-8 h-8 mb-2 opacity-40"}),(0,s.jsx)("p",{className:"text-sm",children:"Nenhuma atividade registrada"})]}):(0,s.jsx)("div",{className:"space-y-1 p-4 max-h-[400px] overflow-y-auto custom-scrollbar",children:t.map((e,a)=>(0,s.jsxs)("div",{className:"flex gap-3 relative",children:[a<t.length-1&&(0,s.jsx)("div",{className:"absolute left-[13px] top-7 bottom-0 w-px bg-border"}),(0,s.jsx)("div",{className:"w-7 h-7 rounded-full bg-card border border-border flex items-center justify-center shrink-0 z-10",children:eE[e.activityType]||(0,s.jsx)(en.A,{className:"w-4 h-4 text-muted-foreground"})}),(0,s.jsxs)("div",{className:"flex-1 pb-4 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm text-foreground leading-snug",children:e.description}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-0.5",children:[(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:(e=>{if(!e)return"";let a=new Date(e);if(isNaN(a.getTime()))return"";let t=new Date().getTime()-a.getTime(),s=Math.floor(t/6e4),r=Math.floor(t/36e5),l=Math.floor(t/864e5);return s<1?"Agora":s<60?"".concat(s,"min atr\xe1s"):r<24?"".concat(r,"h atr\xe1s"):l<7?"".concat(l,"d atr\xe1s"):a.toLocaleDateString("pt-BR",{day:"2-digit",month:"short"})})(e.createdAt)}),e.performedByName&&(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:["⢠",e.performedByName]})]})]})]},e.id))})}var eC=t(90235),eT=t(63626),eD=t(43643),ek=t(65546),e_=t(44748),eI=t(80796);let eM={follow_up:(0,s.jsx)(en.A,{className:"w-4 h-4"}),call:(0,s.jsx)(eT.A,{className:"w-4 h-4"}),meeting:(0,s.jsx)(eD.A,{className:"w-4 h-4"}),email:(0,s.jsx)(k.A,{className:"w-4 h-4"}),whatsapp:(0,s.jsx)(P.A,{className:"w-4 h-4"}),task:(0,s.jsx)(ek.A,{className:"w-4 h-4"}),deadline:(0,s.jsx)(e_.A,{className:"w-4 h-4"}),other:(0,s.jsx)(eI.A,{className:"w-4 h-4"})},eO={follow_up:"Follow-up",call:"Liga\xe7\xe3o",meeting:"Reuni\xe3o",email:"E-mail",whatsapp:"WhatsApp",task:"Tarefa",deadline:"Prazo"},eL={low:"Baixa",medium:"M\xe9dia",high:"Alta",urgent:"Urgente"},eR={low:"text-gray-400",medium:"text-blue-500",high:"text-orange-500",urgent:"text-red-500"};function eF(e){var a;let{dealId:t}=e,{showToast:l}=(0,m.h)(),[n,i]=(0,r.useState)([]),[d,o]=(0,r.useState)(!0),[u,x]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),[g,f]=(0,r.useState)({title:"",dealId:t,taskType:"follow_up",priority:"medium"});(0,r.useEffect)(()=>{N()},[t]);let N=async()=>{try{o(!0);let e=await eN.s.getTasksByDeal(t);i(e)}catch(e){l({type:"error",title:"Erro ao carregar tarefas",variant:"prominent"})}finally{o(!1)}},v=async()=>{if(g.title.trim())try{h(!0);let e=await eN.s.createTask(g);i(a=>[e,...a]),f({title:"",dealId:t,taskType:"follow_up",priority:"medium"}),x(!1),l({type:"success",title:"Tarefa criada"})}catch(e){l({type:"error",title:"Erro ao criar tarefa",variant:"prominent"})}finally{h(!1)}},y=(0,r.useCallback)(async e=>{let a="completed"===e.status?"pending":"completed";i(t=>t.map(t=>t.id===e.id?{...t,status:a}:t));try{await eN.s.updateTask(e.id,{status:a})}catch(a){i(a=>a.map(a=>a.id===e.id?{...a,status:e.status}:a)),l({type:"error",title:"Erro ao atualizar tarefa"})}},[]),w=(0,r.useCallback)(async e=>{i(a=>a.filter(a=>a.id!==e));try{await eN.s.deleteTask(e)}catch(e){N(),l({type:"error",title:"Erro ao excluir tarefa"})}},[]),S=e=>{let a=new Date(e),t=new Date,s=new Date(t);return(s.setDate(s.getDate()+1),a.toDateString()===t.toDateString())?"Hoje":a.toDateString()===s.toDateString()?"Amanh\xe3":a.toLocaleDateString("pt-BR",{day:"2-digit",month:"short"})};if(d)return(0,s.jsx)("div",{className:"space-y-3 p-4",children:[1,2,3].map(e=>(0,s.jsxs)("div",{className:"flex gap-3 animate-pulse",children:[(0,s.jsx)("div",{className:"w-5 h-5 rounded-full bg-muted"}),(0,s.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,s.jsx)("div",{className:"h-3 bg-muted rounded w-2/3"}),(0,s.jsx)("div",{className:"h-2.5 bg-muted rounded w-1/4"})]})]},e))});let E=n.filter(e=>"completed"!==e.status),A=n.filter(e=>"completed"===e.status);return(0,s.jsxs)("div",{className:"space-y-4",children:[u?(0,s.jsxs)("div",{className:"space-y-3 p-4 bg-card rounded-xl border border-border",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"T\xedtulo"}),(0,s.jsx)(j.p,{placeholder:"T\xedtulo da tarefa...",value:g.title,onChange:e=>f({...g,title:e.target.value}),autoFocus:!0,onKeyDown:e=>"Enter"===e.key&&v()})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Tipo"}),(0,s.jsxs)(b.l6,{value:g.taskType,onValueChange:e=>f({...g,taskType:e}),children:[(0,s.jsx)(b.bq,{className:"h-9",children:(0,s.jsx)(b.yv,{})}),(0,s.jsx)(b.gC,{children:Object.entries(eO).map(e=>{let[a,t]=e;return(0,s.jsx)(b.eb,{value:a,children:(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[eM[a],t]})},a)})})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Prioridade"}),(0,s.jsxs)(b.l6,{value:g.priority,onValueChange:e=>f({...g,priority:e}),children:[(0,s.jsx)(b.bq,{className:"h-9",children:(0,s.jsx)(b.yv,{})}),(0,s.jsx)(b.gC,{children:Object.entries(eL).map(e=>{let[a,t]=e;return(0,s.jsx)(b.eb,{value:a,children:t},a)})})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Prazo"}),(0,s.jsx)(j.p,{type:"date",className:"h-9",value:(null==(a=g.dueDate)?void 0:a.split("T")[0])||"",onChange:e=>f({...g,dueDate:e.target.value?new Date(e.target.value).toISOString():void 0})})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,s.jsx)(c.$,{variant:"ghost",size:"sm",onClick:()=>x(!1),children:"Cancelar"}),(0,s.jsx)(c.$,{size:"sm",onClick:v,disabled:!g.title.trim()||p,children:p?"Salvando...":"Criar"})]})]}):(0,s.jsxs)(c.$,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[(0,s.jsx)(L.A,{className:"w-5 h-5"}),"Nova tarefa"]}),E.length>0&&(0,s.jsx)("div",{className:"space-y-1",children:E.map(e=>(0,s.jsx)(eG,{task:e,isOverdue:!!e.dueDate&&"completed"!==e.status&&new Date(e.dueDate)<new Date,formatDueDate:S,onToggle:y,onDelete:w},e.id))}),A.length>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("p",{className:"text-xs text-muted-foreground font-medium mb-1",children:["Conclu\xeddas (",A.length,")"]}),A.map(e=>(0,s.jsx)(eG,{task:e,isOverdue:!1,formatDueDate:S,onToggle:y,onDelete:w},e.id))]}),0===n.length&&!u&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-6 text-muted-foreground",children:[(0,s.jsx)(ek.A,{className:"w-8 h-8 mb-2 opacity-40"}),(0,s.jsx)("p",{className:"text-sm",children:"Nenhuma tarefa"})]})]})}function eG(e){let{task:a,isOverdue:t,formatDueDate:r,onToggle:l,onDelete:n}=e,i="completed"===a.status;return(0,s.jsxs)("div",{className:"flex items-start gap-2 p-2 rounded-lg hover:bg-accent/50 group transition-colors ".concat(i?"opacity-60":""),children:[(0,s.jsx)("button",{onClick:()=>l(a),className:"mt-0.5 shrink-0",children:i?(0,s.jsx)(el.A,{className:"w-4.5 h-4.5 text-primary"}):(0,s.jsx)(eI.A,{className:"w-4.5 h-4.5 ".concat(t?"text-error":"text-muted-foreground")})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm leading-snug ".concat(i?"line-through text-muted-foreground":"text-foreground"),children:a.title}),(0,s.jsxs)("div",{className:"flex items-center gap-2 mt-0.5 flex-wrap",children:[(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs ".concat(eR[a.priority]),children:[eM[a.taskType],"follow_up"===a.taskType?"Follow-up":a.taskType]}),a.dueDate&&(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 text-xs ".concat(t?"text-error font-medium":"text-muted-foreground"),children:[(0,s.jsx)(U.A,{className:"w-3.5 h-3.5"}),r(a.dueDate)]})]})]}),(0,s.jsx)("button",{onClick:()=>n(a.id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive shrink-0",children:(0,s.jsx)(Y.A,{className:"w-4 h-4"})})]})}var eB=t(92982),eP=t(31826);function ez(e){let{dealId:a,onValueChange:t}=e,{showToast:l}=(0,m.h)(),[n,i]=(0,r.useState)([]),[d,o]=(0,r.useState)(!0),[u,x]=(0,r.useState)(!1),[p,h]=(0,r.useState)(!1),[g,f]=(0,r.useState)({name:"",quantity:1,unitPrice:0,discount:0});(0,r.useEffect)(()=>{N()},[a]);let N=async()=>{try{o(!0);let e=await eN.s.getDealProducts(a);i(e)}catch(e){l({type:"error",title:"Erro ao carregar produtos",variant:"prominent"})}finally{o(!1)}},v=n.reduce((e,a)=>e+(a.total||0),0),y=async()=>
1{if(g.name.trim())try{h(!0);let e=await eN.s.addDealProduct(a,g);i(a=>[...a,e]),f({name:"",quantity:1,unitPrice:0,discount:0}),x(!1),null==t||t(v+(e.total||0)),l({type:"success",title:"Produto adicionado"})}catch(e){l({type:"error",title:"Erro ao adicionar produto",variant:"prominent"})}finally{h(!1)}},b=(0,r.useCallback)(async e=>{let a=n.find(a=>a.id===e);i(a=>a.filter(a=>a.id!==e));try{await eN.s.removeDealProduct(e),a&&(null==t||t(v-(a.total||0)))}catch(e){N(),l({type:"error",title:"Erro ao remover produto"})}},[n,v,t]),w=e=>new Intl.NumberFormat("pt-BR",{style:"currency",currency:"BRL"}).format(e);return d?(0,s.jsx)("div",{className:"space-y-3 p-4",children:[1,2].map(e=>(0,s.jsxs)("div",{className:"flex gap-3 animate-pulse",children:[(0,s.jsx)("div",{className:"w-10 h-10 rounded bg-muted"}),(0,s.jsxs)("div",{className:"flex-1 space-y-1.5",children:[(0,s.jsx)("div",{className:"h-3 bg-muted rounded w-1/2"}),(0,s.jsx)("div",{className:"h-2.5 bg-muted rounded w-1/4"})]})]},e))}):(0,s.jsxs)("div",{className:"space-y-4",children:[n.length>0&&(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 bg-primary/5 rounded-xl border border-primary/10",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Total dos produtos"}),(0,s.jsx)("span",{className:"text-sm font-semibold text-primary-text",children:w(v)})]}),n.map(e=>(0,s.jsxs)("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-accent/50 group transition-colors",children:[(0,s.jsx)("div",{className:"w-9 h-9 rounded-lg bg-muted/50 flex items-center justify-center shrink-0",children:(0,s.jsx)(eB.A,{className:"w-5 h-5 text-muted-foreground"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-foreground truncate",children:e.name}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[e.quantity,"x ",w(e.unitPrice),e.discount>0&&(0,s.jsxs)("span",{className:"text-red-500 ml-1",children:["-",w(e.discount)]})]})]}),(0,s.jsx)("span",{className:"text-sm font-medium text-foreground shrink-0",children:w(e.total)}),(0,s.jsx)("button",{onClick:()=>b(e.id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-red-500 shrink-0",children:(0,s.jsx)(Y.A,{className:"w-4 h-4"})})]},e.id)),u?(0,s.jsxs)("div",{className:"space-y-3 p-4 bg-card rounded-xl border border-border",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Nome do produto"}),(0,s.jsx)(j.p,{placeholder:"Nome do produto...",value:g.name,onChange:e=>f({...g,name:e.target.value}),autoFocus:!0})]}),(0,s.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Quantidade"}),(0,s.jsx)(j.p,{type:"number",min:1,className:"h-9",value:g.quantity||1,onChange:e=>f({...g,quantity:parseInt(e.target.value)||1})})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Pre\xe7o unit."}),(0,s.jsx)(j.p,{type:"number",min:0,step:.01,className:"h-9",value:g.unitPrice||0,onChange:e=>f({...g,unitPrice:parseFloat(e.target.value)||0})})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eC.J,{className:"text-xs",children:"Desconto"}),(0,s.jsx)(j.p,{type:"number",min:0,step:.01,className:"h-9",value:g.discount||0,onChange:e=>f({...g,discount:parseFloat(e.target.value)||0})})]})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-1",children:[(0,s.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Total: ",(0,s.jsx)("span",{className:"font-medium text-foreground",children:w((g.quantity||1)*(g.unitPrice||0)-(g.discount||0))})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(c.$,{variant:"ghost",size:"sm",onClick:()=>x(!1),children:"Cancelar"}),(0,s.jsx)(c.$,{size:"sm",onClick:y,disabled:!g.name.trim()||p,children:p?"Salvando...":"Adicionar"})]})]})]}):(0,s.jsxs)(c.$,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[(0,s.jsx)(L.A,{className:"w-5 h-5"}),"Adicionar produto"]}),0===n.length&&!u&&(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-6 text-muted-foreground",children:[(0,s.jsx)(eP.A,{className:"w-8 h-8 mb-2 opacity-40"}),(0,s.jsx)("p",{className:"text-sm",children:"Nenhum produto adicionado"})]})]})}function e$(e){let{isOpen:a,onClose:t,onConfirm:l,dealTitle:n,currentValue:i}=e,[d,o]=(0,r.useState)("won"),[m,u]=(0,r.useState)([]),[x,p]=(0,r.useState)(""),[h,g]=(0,r.useState)(""),[f,N]=(0,r.useState)(i||0),[v,y]=(0,r.useState)(!1);(0,r.useEffect)(()=>{a&&(b(),N(i||0),p(""),g(""))},[a,i]);let b=async()=>{try{let e=await eN.s.getLostReasons();u(e)}catch(e){}},w=async()=>{try{y(!0);let e=m.find(e=>e.id===x);await l({status:d,value:"won"===d?f:void 0,lostReasonId:"lost"===d&&x||void 0,lostReason:"lost"===d&&((null==e?void 0:e.name)||h)||void 0}),t()}catch(e){}finally{y(!1)}};return a?(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,s.jsxs)("div",{className:"relative bg-card rounded-2xl shadow-xl w-full max-w-md mx-4 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[(0,s.jsx)("h3",{className:"text-base font-semibold text-foreground",children:"Fechar Deal"}),(0,s.jsx)("button",{onClick:t,className:"text-muted-foreground hover:text-foreground",children:(0,s.jsx)(G.A,{className:"w-5 h-5"})})]}),(0,s.jsxs)("div",{className:"p-4 space-y-4",children:[n&&(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Deal: ",(0,s.jsx)("span",{className:"font-medium text-foreground",children:n})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)("button",{onClick:()=>o("won"),className:"flex items-center justify-center gap-2 p-3 rounded-xl border-2 transition-all ".concat("won"===d?"border-success bg-success/10 text-success":"border-border text-muted-foreground hover:border-success/30"),children:[(0,s.jsx)(ew.A,{className:"w-5 h-5"}),(0,s.jsx)("span",{className:"font-medium text-sm",children:"Ganho"})]}),(0,s.jsxs)("button",{onClick:()=>o("lost"),className:"flex items-center justify-center gap-2 p-3 rounded-xl border-2 transition-all ".concat("lost"===d?"border-destructive bg-destructive/10 text-destructive":"border-border text-muted-foreground hover:border-destructive/30"),children:[(0,s.jsx)(eS.A,{className:"w-5 h-5"}),(0,s.jsx)("span",{className:"font-medium text-sm",children:"Perdido"})]})]}),"won"===d&&(0,s.jsxs)("div",{children:[(0,s.jsx)(eC.J,{className:"mb-1 block",children:"Valor final (R$)"}
1),(0,s.jsx)(j.p,{type:"number",min:0,step:.01,value:f,onChange:e=>N(parseFloat(e.target.value)||0)})]}),"lost"===d&&(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eC.J,{className:"block",children:"Motivo da perda"}),(0,s.jsx)("div",{className:"grid grid-cols-2 gap-2",children:m.map(e=>(0,s.jsx)("button",{onClick:()=>{p(e.id),g("")},className:"text-left p-2.5 rounded-lg border text-sm transition-all ".concat(x===e.id?"border-destructive bg-destructive/10 text-destructive":"border-border text-muted-foreground hover:border-destructive/30"),children:e.name},e.id))}),(0,s.jsx)("div",{children:(0,s.jsx)(j.p,{type:"text",placeholder:"Ou digite um motivo personalizado...",value:h,onChange:e=>{g(e.target.value),p("")}})})]})]}),(0,s.jsxs)("div",{className:"flex justify-end gap-2 p-4 border-t border-border",children:[(0,s.jsx)(c.$,{variant:"ghost",onClick:t,children:"Cancelar"}),(0,s.jsx)(c.$,{onClick:w,disabled:v,variant:"won"===d?"default":"destructive",children:v?"Salvando...":"won"===d?"Marcar como Ganho":"Marcar como Perdido"})]})]})]}):null}function eq(){var e,a,t;let h=(0,n.useRouter)(),{showConfirm:g,showToast:y}=(0,m.h)(),{isCardModalOpen:j,closeCardModal:b,getSelectedCard:w,updateCard:S,deleteCard:E,pipelines:A,stages:C,assignees:T}=(0,i.K)((0,l.k)(e=>({isCardModalOpen:e.isCardModalOpen,closeCardModal:e.closeCardModal,getSelectedCard:e.getSelectedCard,updateCard:e.updateCard,deleteCard:e.deleteCard,pipelines:e.pipelines,stages:e.stages,assignees:e.assignees}))),D=w(),{state:k,actions:_}=function(){let[e,a]=(0,r.useReducer)(v,N);return{state:e,actions:(0,r.useMemo)(()=>({setTab:e=>a({type:"SET_TAB",payload:e}),startEditing:e=>a({type:"START_EDITING",payload:e}),stopEditing:()=>a({type:"STOP_EDITING"}),setEditedName:e=>a({type:"SET_EDITED_NAME",payload:e}),toggleDeleteConfirm:e=>a({type:"TOGGLE_DELETE_CONFIRM",payload:e}),setSaving:e=>a({type:"SET_SAVING",payload:e}),setHasChanges:e=>a({type:"SET_HAS_CHANGES",payload:e}),setLocalStages:e=>a({type:"SET_LOCAL_STAGES",payload:e}),addLocalStages:e=>a({type:"ADD_LOCAL_STAGES",payload:e}),setLoadingStages:e=>a({type:"SET_LOADING_STAGES",payload:e}),toggleStageExpanded:e=>a({type:"TOGGLE_STAGE_EXPANDED",payload:e}),setExpandedStages:e=>a({type:"SET_EXPANDED_STAGES",payload:e}),setNewNote:e=>a({type:"SET_NEW_NOTE",payload:e}),setBackendNotes:e=>a({type:"SET_BACKEND_NOTES",payload:e}),addBackendNote:e=>a({type:"ADD_BACKEND_NOTE",payload:e}),removeBackendNote:e=>a({type:"REMOVE_BACKEND_NOTE",payload:e}),setBackendMedia:e=>a({type:"SET_BACKEND_MEDIA",payload:e}),setLoadingNotes:e=>a({type:"SET_LOADING_NOTES",payload:e}),setLoadingMedia:e=>a({type:"SET_LOADING_MEDIA",payload:e}),setSavingNote:e=>a({type:"SET_SAVING_NOTE",payload:e}),setGeneratingSummary:e=>a({type:"SET_GENERATING_SUMMARY",payload:e}),setSummaryResult:(e,t)=>a({type:"SET_SUMMARY_RESULT",payload:{status:e,suggestion:t}}),updateFormData:e=>a({type:"UPDATE_FORM_DATA",payload:e}),resetForm:(e,t)=>a({type:"RESET_FORM",payload:{card:e,stages:t}})}),[])}}(),[I,M]=r.useState(!1);(0,r.useEffect)(()=>{D&&(_.resetForm(D,C),O(D.contact.id),L(D.contact.id))},[null==D?void 0:D.id,C.length]);let O=async e=>{if(e){_.setLoadingNotes(!0);try{let a=await u.M.getNotesByContact(e);_.setBackendNotes(a)}catch(e){_.setBackendNotes([])}finally{_.setLoadingNotes(!1)}}},L=async e=>{if(e){_.setLoadingMedia(!0);try{let a=await x.DX.getContactMedia(e,{limit:50});_.setBackendMedia(a)}catch(e){_.setBackendMedia([])}finally{_.setLoadingMedia(!1)}}},R=(0,r.useCallback)(()=>{D&&_.startEditing(D.contact.name)},[D,_]),F=(0,r.useCallback)(()=>{D&&(S(D.id,{contact:{...D.contact,name:k.editedName}}),_.stopEditing())},[D,k.editedName,S,_]),G=(0,r.useCallback)(()=>{_.stopEditing()},[_]),B=(0,r.useCallback)(async()=>{if(D){_.toggleDeleteConfirm(!1),b();try{await E(D.id),y({type:"success",title:"Card exclu\xeddo"})}catch(e){y({type:"error",title:"Erro ao excluir card",variant:"prominent"})}}},[D,E,b,_,y]),P=(0,r.useCallback)(async e=>{let a=k.localStages.filter(a=>a.pipelineId===e);if(a.length>0){var t;_.updateFormData({pipelineId:e,stageId:(null==(t=a.sort((e,a)=>e.order-a.order)[0])?void 0:t.id)||""})}else{_.setLoadingStages(!0);try{let a=(await p.s.getStages(e)).map(a=>({id:a.id,pipelineId:a.pipeline_id||e,name:a.name,color:a.color||"#6B7280",order:a.order||0}));_.addLocalStages(a);let t=a.sort((e,a)=>e.order-a.order)[0];_.updateFormData({pipelineId:e,stageId:(null==t?void 0:t.id)||""})}finally{_.setLoadingStages(!1)}}},[k.localStages,_]),z=(0,r.useCallback)(async()=>
1{if(!D)return;let e=k.formData.assigneeId?T.find(e=>e.id===k.formData.assigneeId):void 0;_.setHasChanges(!1),b();try{await S(D.id,{pipelineId:k.formData.pipelineId,stageId:k.formData.stageId,priority:k.formData.priority,assignee:e,value:k.formData.value?Number(k.formData.value):void 0,aiSummary:k.formData.aiSummary||void 0,tags:k.formData.tags})}catch(e){y({type:"error",title:"Erro ao salvar card",variant:"prominent"})}},[D,k.formData,T,S,b,_,y]),$=(0,r.useCallback)(()=>{k.hasChanges?g({title:"Altera\xe7\xf5es n\xe3o salvas",message:"Voc\xea tem altera\xe7\xf5es n\xe3o salvas. Deseja sair sem salvar?",type:"warning",confirmText:"Sair sem salvar",cancelText:"Continuar editando",onConfirm:()=>b()}):b()},[k.hasChanges,g,b]),q=(0,r.useCallback)(async()=>{if(!k.newNote.trim()||!D)return;let e="temp-".concat(Date.now()),a={id:e,content:k.newNote.trim(),created_at:new Date().toISOString(),contact_id:D.contact.id};_.addBackendNote(a),_.setNewNote("");try{let t=await u.M.createNote(D.contact.id,{content:a.content});_.removeBackendNote(e),_.addBackendNote(t)}catch(a){_.removeBackendNote(e),y({type:"error",title:"Erro ao adicionar nota",variant:"prominent"})}},[k.newNote,D,_]),U=(0,r.useCallback)(async e=>{if(!D)return;let a=k.backendNotes.find(a=>a.id===e);_.removeBackendNote(e);try{await u.M.deleteNote(D.contact.id,e)}catch(e){a&&_.addBackendNote(a),y({type:"error",title:"Erro ao excluir nota",variant:"prominent"})}},[D,_,k.backendNotes]),V=(0,r.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!D)return;let a=await p.s.getDeal(D.id),t=(null==a?void 0:a.conversationId)||(null==a?void 0:a.conversation_id);if(t){_.setGeneratingSummary(!0);try{let a=await f.generateSummary({conversationId:t,dealId:D.id,forceRegenerate:e});_.updateFormData({aiSummary:a.summary}),_.setSummaryResult(a.status,a.suggestion)}finally{_.setGeneratingSummary(!1)}}},[D,_]),K=(0,r.useCallback)(()=>{if(!D)return;b();let e=D.contact.phone.replace(/\D/g,"");h.push("/chat?c=".concat(e))},[D,b,h]),H=(0,r.useCallback)(async e=>{if(D)try{await p.s.closeDeal(D.id,e),S(D.id,{status:e.status}),b(),y({type:"success",title:"won"===e.status?"Deal marcado como ganho":"Deal marcado como perdido"})}catch(e){throw y({type:"error",title:"Erro ao fechar deal",variant:"prominent"}),e}},[D,S,b]),X=(0,r.useCallback)(async()=>{if(D)try{await p.s.reopenDeal(D.id),S(D.id,{status:"open"}),y({type:"success",title:"Deal reaberto"})}catch(e){y({type:"error",title:"Erro ao reabrir deal",variant:"prominent"})}},[D,S]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o._,{isOpen:j&&!!D,onClose:$,width:"half",side:"right",showCloseButton:!1,className:"bg-card",children:D&&(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsx)(J,{card:D,formData:k.formData,isEditing:k.isEditing,editedName:k.editedName,pipelines:A,assignees:T,onStartEdit:R,onSaveEdit:F,onCancelEdit:G,onEditedNameChange:_.setEditedName,onFormDataChange:_.updateFormData,onPipelineChange:P,onGoToChat:K}),(0,s.jsx)(W,{activeTab:k.activeTab,onTabChange:_.setTab}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto px-6 py-4 bg-muted/30",children:["summary"===k.activeTab&&(0,s.jsx)(eo,{card:D,formData:k.formData,generatingSummary:k.generatingSummary,summaryStatus:k.summaryStatus,summarySuggestion:k.summarySuggestion,onGenerateSummary:V,onFormDataChange:_.updateFormData,onGoToChat:K}),"media"===k.activeTab&&(0,s.jsx)(eg,{media:k.backendMedia,loading:k.loadingMedia}),"activities"===k.activeTab&&(0,s.jsx)(eA,{dealId:D.id}),"tasks"===k.activeTab&&(0,s.jsx)(eF,{dealId:D.id}),"products"===k.activeTab&&(0,s.jsx)(ez,{dealId:D.id,onValueChange:e=>{_.updateFormData({value:e.toString()}),S(D.id,{value:e})}}),"notes"===k.activeTab&&(0,s.jsx)(ef,{notes:k.backendNotes,loading:k.loadingNotes,newNote:k.newNote,savingNote:k.savingNote,onNewNoteChange:_.setNewNote,onAddNote:q,onDeleteNote:U})]}),(0,s.jsx)(ea,{hasChanges:k.hasChanges,isSaving:k.isSaving,onDelete:()=>_.toggleDeleteConfirm(!0),onClose:$,onSave:z,onCloseDeal:()=>M(!0),onReopenDeal:X,dealStatus:null==D?void 0:D.status})]})}),(0,s.jsx)(e$,{isOpen:I,onClose:()=>M(!1),onConfirm:H,dealTitle:(null==D||null==(e=D.contact)?void 0:e.name)||(null==D?void 0:D.title),currentValue:null==D?void 0:D.value}),(0,s.jsx)(d.lG,{open:k.showDeleteConfirm&&!!D,onOpenChange:e=>_.toggleDeleteConfirm(e),children:(0,s.jsxs)(d.Cf,{className:"ph-no-capture max-w-sm rounded-2xl",children:[(0,s.jsx)(d.c7,{children:(0,s.jsx)(d.L3,{children:"Excluir Card"})}),(0,s.jsxs)("p",{className:"text-sm text-muted-foreground",children:["Tem certeza que deseja excluir o card de ",(0,s.jsx)("strong",{children:null!=(t=null==D||null==(a=D.contact)?void 0:a.name)?t:"este contato"}),"? Esta a\xe7\xe3o n\xe3o pode ser desfeita."]}),(0,s.jsxs)(d.Es,{children:[(0,s.jsx)(c.$,{variant:"outline",onClick:()=>_.toggleDeleteConfirm(!1),children:"Cancelar"}),(0,s.jsx)(c.$,{variant:"destructive",onClick:B,children:"Excluir"})]})]})})]})}let eU=eq},26196:(e,a,t)=>{function s(e){return e&&""!==e.trim()?e.trim().split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2):"?"}
1function r(e){let a=[{bg:"bg-blue-100 dark:bg-blue-900/40",icon:"text-blue-600 dark:text-blue-400"},{bg:"bg-emerald-100 dark:bg-emerald-900/40",icon:"text-emerald-600 dark:text-emerald-400"},{bg:"bg-purple-100 dark:bg-purple-900/40",icon:"text-purple-600 dark:text-purple-400"},{bg:"bg-amber-100 dark:bg-amber-900/40",icon:"text-amber-600 dark:text-amber-400"},{bg:"bg-rose-100 dark:bg-rose-900/40",icon:"text-rose-600 dark:text-rose-400"}];return e?a[e.replace(/[\s\-\(\)\+]/g,"").split("").reduce((e,a)=>e+a.charCodeAt(0),0)%a.length]:{bg:"bg-muted",icon:"text-muted-foreground"}}function l(e){let a=encodeURIComponent(e);return"https://api.dicebear.com/9.x/toon-head/svg?seed=".concat(a)}t.d(a,{IM:()=>s,c8:()=>l,gY:()=>r})},39489:(e,a,t)=>{t.d(a,{DX:()=>n,lA:()=>i});var s=t(21344),r=t(83654);class l{async getContactMedia(e,a){return(await this.api.get(r.Sn.CONTACT_MEDIA(e),a)).map(e=>({id:e.id,media_id:e.provider_media_id||e.media_id||"",storage_key:e.storage_key||"",mime_type:e.mime_type||"",size:e.size,created_at:e.created_at,type:this.getMediaType(e.mime_type),filename:e.filename||this.extractFilename(e.storage_key)}))}async getContactMediaStats(e){return await this.api.get("".concat(r.Sn.CONTACT_MEDIA(e),"/stats"))||{total:0,by_type:{}}}async uploadMedia(e){try{let a=new FormData;a.append("file",e.file),a.append("conversationId",e.conversationId),a.append("type",e.type),e.caption&&a.append("caption",e.caption),e.metadata&&a.append("metadata",JSON.stringify(e.metadata));let t=await fetch("".concat(r.PI.API_BASE_URL,"/api/v1/messages/upload-media"),{method:"POST",headers:await this.getAuthHeaders(),body:a});if(!t.ok)throw Error("Upload failed: ".concat(t.statusText));let s=await t.json();return{success:!0,data:s}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Upload failed"}}}async uploadAudio(e,a,t,s){try{let l=e.type||"audio/webm",n=l.includes("webm")?"webm":l.includes("mp4")?"m4a":l.includes("ogg")?"ogg":"webm",i=new FormData;i.append("file",e,"audio.".concat(n)),i.append("conversationId",a),i.append("type","audio"),i.append("metadata",JSON.stringify({duration:t,tempId:s}));let d=await fetch("".concat(r.PI.API_BASE_URL,"/api/v1/messages/upload-media"),{method:"POST",headers:await this.getAuthHeaders(),body:i});if(!d.ok)throw Error("Upload failed: ".concat(d.statusText));let o=await d.json();return{success:!0,data:o}}catch(e){return{success:!1,error:e instanceof Error?e.message:"Upload failed"}}}async getAuthHeaders(){let{getAccessToken:e,isTokenExpired:a,refreshTokens:s}=await Promise.resolve().then(t.bind(t,92343));if(a())try{await s()}catch(e){throw Error("Sess\xe3o expirada")}let r=await e();if(!r)throw Error("N\xe3o autenticado");return{Authorization:"Bearer ".concat(r)}}getMediaType(e){return e.startsWith("image/")?"image":e.startsWith("video/")?"video":e.startsWith("audio/")?"audio":"document"}extractFilename(e){if(!e)return"";let a=e.split("/"),t=a[a.length-1];return t.replace(/^\d+_\d+/,"")||t}constructor(){this.api=new s.OW}}let n=new l,i=n},48215:(e,a,t)=>{t.d(a,{q:()=>s});function s(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"â";if(!e)return a;let t=e.replace(/\D/g,"");return 13===t.length?"+".concat(t.slice(0,2)," (").concat(t.slice(2,4),") ").concat(t.slice(4,9),"-").concat(t.slice(9)):12===t.length?"+".concat(t.slice(0,2)," (").concat(t.slice(2,4),") ").concat(t.slice(4,8),"-").concat(t.slice(8)):e}},66970:(e,a,t)=>{t.d(a,{M:()=>n});var s=t(21344),r=t(83654);class l{async getNotesByContact(e){return this.api.get(r.Sn.CONTACT_NOTES(e))}async createNote(e,a){return this.api.post(r.Sn.CONTACT_NOTES(e),a)}async updateNote(e,a,t){return this.api.put("".concat(r.Sn.CONTACT_NOTES(e),"/").concat(a),t)}async deleteNote(e,a){await this.api.delete("".concat(r.Sn.CONTACT_NOTES(e),"/").concat(a))}constructor(){this.api=new s.OW}}let n=new l},68122:(e,a,t)=>{t.d(a,{E:()=>l});var s=t(95155),r=t(25016);function l(e){let{className:a,...t}=e;return(0,s.jsx)("div",{className:(0,r.cn)("animate-pulse rounded-md bg-muted",a),...t})}},99743:(e,a,t)=>{t.d(a,{w:()=>d});var s=t(95155),r=t(12115),l=t(79350),n=t(25016),i=t(5431);function d(e){let{mediaId:a,mediaStatus:t,alt:d,className:o}=e,c=(0,i.r)({mediaId:a,mediaStatus:null!=t?t:void 0}),[m,u]=(0,r.useState)(!1);return((0,r.useEffect)(()=>{u(!1)},[c.url]),c.isLoading)?(0,s.jsx)("div",{className:(0,n.cn)("w-full h-full bg-muted animate-pulse",o)}):!c.url||c.isError||m?(0,s.jsx)("div",{className:(0,n.cn)("w-full h-full flex items-center justify-center bg-muted",o),children:(0,s.jsx)(l.A,{className:"w-5 h-5 text-muted-foreground"})}):(0,s.jsx)("img",{src:c.url,alt:d||"Imagem",loading:"lazy",className:(0,n.cn)("w-full h-full object-cover",o),onError:()=>u(!0)})}}}]);
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.