1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[85114],{10041:(e,t,a)=>{"use strict";a.d(t,{oB:()=>h,c7:()=>p,sT:()=>x,Ai:()=>u,H4:()=>m,X0:()=>r,Kq:()=>s,jb:()=>o,MU:()=>i,iH:()=>v,iT:()=>g});var l=a(13464),n=a(72966);function i(e){let t=["tool-calls",e];return(0,l.Ou)(t,()=>n.A.chatAdmin.listToolCalls(e))}function r(e){let t=["technical-questions",e];return(0,l.Ou)(t,()=>n.A.chatAdmin.listTechnicalQuestions(e))}function s(e){let t=["token-usage",e];return(0,l.Ou)(t,()=>n.A.chatAdmin.listTokenUsage(e))}var d=a(96320),c=a(33035);function o(){let e=(0,d.jE)();return(0,c.n)({mutationFn:e=>{let{userId:t,tokensLimit:a}=e;return n.A.chatAdmin.updateTokenUsage(t,{tokensLimit:a})},onSuccess:()=>{e.invalidateQueries({queryKey:["token-usage"]})}})}function u(){return(0,l.Ou)(["plan-limits"],()=>n.A.chatAdmin.listPlanLimits())}function m(){let e=(0,d.jE)();return(0,c.n)({mutationFn:e=>{let{planType:t,tokensLimit:a}=e;return n.A.chatAdmin.updatePlanLimit(t,{tokensLimit:a})},onSuccess:()=>{e.invalidateQueries({queryKey:["plan-limits"]})}})}function p(e){let t=["ai-model-catalog",e];return(0,l.Ou)(t,()=>n.A.chatAdmin.listModels(e))}function h(){return(0,l.Ou)(["ai-models-active"],()=>n.A.chatAdmin.getActiveModels())}function x(){let e=(0,d.jE)();return(0,c.n)({mutationFn:e=>{let{type:t,modelId:a,description:l}=e;return n.A.chatAdmin.updateActiveModel(t,{modelId:a,description:l})},onSuccess:(t,a)=>{let{type:l}=a;e.setQueryData(["ai-models-active"],e=>e?{...e,data:{...e.data,[l]:t.data}}:e)}})}function v(){return(0,l.Ou)(["chat-admin-tools-catalog"],()=>n.A.chatAdmin.getToolsCatalog())}function g(){return(0,l.Ou)(["whatsapp-instances"],()=>n.A.chatAdmin.listWhatsappInstances())}},11493:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var l=a(36303),n=a(33338),i=a(92239);function r(e){let{open:t,className:a,sx:r}=e;return t?(0,l.Y)(n.A,{sx:{color:"var(--primary)",zIndex:9999,...r},open:t,className:a,children:(0,l.Y)(i.A,{color:"inherit"})}):null}},22738:(e,t,a)=>{"use strict";a.d(t,{VY:()=>c,l0:()=>o,J$:()=>u.A});var l=a(68658),n=a(52327),i=a.n(n),r=a(17017),s=a(95758),d=a(95411);function c(){let{signOut:e}=(0,s.R)();(0,l.useEffect)(()=>{let{"meuajudante.support-token":t}=(0,r.parseCookies)(),a=function(e,t){try{return(0,d.A)(e,void 0)}catch(e){return null}}(t||"");if(!a)return void e();let l=i()((null==a?void 0:a.exp)*1e3);if(!l.isValid())return void e();let n=setInterval(()=>{i()().isAfter(l)&&e()},5e3);return function(){clearInterval(n)}},[])}function o(e){let t=(0,l.useRef)(e);return t.current=e,t}a(34291);var u=a(23243)},34291:(e,t,a)=>{"use strict";a.d(t,{f:()=>n});class l{on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),{off:()=>{this.off(e,t)}}}emit(e,t){let a=this.events[e];a&&a.forEach(e=>{e(t)})}off(e,t){let a=this.events[e];if(a){let e=a.indexOf(t);-1!==e&&a.splice(e,1)}}destroy(){this.events={}}constructor(){this.events={}}}let n=new l},40076:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var l=a(36303),n=a(76180);function i(e){let{children:t,className:a,overflowX:i,...r}=e;return(0,l.Y)("div",{className:(0,n.Q)("".concat(i&&"overflow-x-auto"),a),...r,children:t})}},47082:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var l=a(36303),n=a(76180);function i(e){let{children:t,className:a}=e;return(0,l.Y)("h2",{className:(0,n.Q)("theme-body-lg-bold",a),children:t})}},50147:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var l=a(36303),n=a(76180);function i(e){let{className:t,...a}=e;return(0,l.Y)("hr",{className:(0,n.Q)("border-theme-background-3",t),...a})}},53735:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var l=a(36303),n=a(76180);function i(e){let{children:t,className:a,...i}=e;return(0,l.Y)("div",{className:(0,n.Q)("rounded-xl w-full bg-theme-2 shadow-xl",a),...i,children:t})}},54030:(e,t,a)=>{"use strict";a.r(t),a.d(t,{__N_SSP:()=>W,default:()=>q});var l=a(36303),n=a(78594),i=a(83100),r=a(22738),s=a(10041),d=a(68658),c=a(11493),o=a(75786),u=a(53735),m=a(87479),p=a(47082),h=a(50147),x=a(7081),v=a(41144),g=a(86954),b=a(11792),f=a(4288),N=a(78621),Y=a(21397),A=a(36564),y=a(70636),k=a(18246);let w={text:"Texto",image:"Imagem"},F={openai:"OpenAI",google:"Google"},D={openai:"bg-emerald-900/50 text-emerald-300 border border-emerald-700",google:"bg-blue-900/50 text-blue-300 border border-blue-700"},T={fast:"R\xe1pido",cheap:"Econ\xf4mico",powerful:"Poderoso",balanced:"Equilibrado",multimodal:"Multimodal",latest:"Mais recente",deprecated:"Descontinuado"},M={fast:"bg-sky-900/40 text-sky-300",cheap:"bg-lime-900/40 text-lime-300",powerful:"bg-purple-900/40 text-purple-300",balanced:"bg-teal-900/40 text-teal-300",multimodal:"bg-amber-900/40 text-amber-300",latest:"bg-indigo-900/40 text-indigo-300",deprecated:"bg-red-900/40 text-red-400"};var C=a(17693);
1function P(e){return e.toLocaleString("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:4})}function S(e){let t=[];return void 0!==e.inputPer1MTokens&&t.push({label:"Entrada",value:"".concat(P(e.inputPer1MTokens)," / 1M tokens"),note:void 0!==e.inputPer1MTokensHighTier?"".concat(P(e.inputPer1MTokensHighTier)," tier alto"):void 0}),void 0!==e.outputPer1MTokens&&t.push({label:"Sa\xedda texto",value:"".concat(P(e.outputPer1MTokens)," / 1M tokens"),note:void 0!==e.outputPer1MTokensHighTier?"".concat(P(e.outputPer1MTokensHighTier)," tier alto"):void 0}),void 0!==e.outputImagePer1MTokens&&t.push({label:"Sa\xedda imagem",value:"".concat(P(e.outputImagePer1MTokens)," / 1M tokens")}),void 0!==e.perImage&&t.push({label:"Por imagem",value:P(e.perImage)}),t}function E(e){let{pricing:t}=e,a=S(t);return a.length?(0,l.FD)("div",{className:"mt-2 rounded-md border border-white/10 overflow-hidden",children:[(0,l.FD)("div",{className:"flex items-center gap-1.5 px-3 py-1.5 bg-white/5 border-b border-white/10",children:[(0,l.Y)(C.A,{className:"w-3 h-3 text-slate-300"}),(0,l.Y)("span",{className:"text-[10px] font-semibold text-slate-300 uppercase tracking-wider",children:"Custos"})]}),(0,l.Y)("div",{className:"divide-y divide-white/5",children:a.map(e=>(0,l.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 gap-4",children:[(0,l.Y)("span",{className:"text-[11px] text-slate-200 shrink-0",children:e.label}),(0,l.FD)("div",{className:"text-right",children:[(0,l.Y)("span",{className:"text-[11px] font-semibold text-slate-200 tabular-nums",children:e.value}),e.note&&(0,l.Y)("p",{className:"text-[10px] text-slate-500 tabular-nums",children:e.note})]})]},e.label))})]}):null}function O(e){let{pricing:t}=e,a=S(t);return a.length?(0,l.FD)("div",{className:"rounded-b-xl overflow-hidden",children:[(0,l.FD)("div",{className:"flex items-center gap-2 px-6 py-2.5 border-b border-white/5 bg-theme-background-3/20",children:[(0,l.Y)(C.A,{className:"w-3.5 h-3.5 text-slate-500"}),(0,l.Y)("p",{className:"text-[11px] font-semibold text-slate-500 uppercase tracking-wider",children:"Custos"})]}),(0,l.Y)("div",{className:"divide-y divide-white/5",children:a.map(e=>(0,l.FD)("div",{className:"flex items-center justify-between px-6 py-2.5 gap-4",children:[(0,l.Y)("span",{className:"text-xs text-slate-400 shrink-0",children:e.label}),(0,l.FD)("div",{className:"text-right",children:[(0,l.Y)("span",{className:"text-xs font-semibold text-slate-200 tabular-nums",children:e.value}),e.note&&(0,l.Y)("p",{className:"text-[11px] text-slate-500 tabular-nums",children:e.note})]})]},e.label))})]}):null}function _(e){let{open:t,onClose:a,type:n,currentModel:i,availableModels:r,isSaving:s,onSave:c}=e,[o,u]=(0,d.useState)(""),[m,p]=(0,d.useState)("");(0,d.useEffect)(()=>{if(t){var e;u(null!=(e=null==i?void 0:i.id)?e:""),p("")}},[t,i]);let h=o===(null==i?void 0:i.id);return(0,l.FD)(g.A,{open:t,onClose:a,maxWidth:"sm",fullWidth:!0,PaperProps:{sx:{borderRadius:"12px",border:"1px solid #313244"}},children:[(0,l.FD)("div",{className:"flex items-center justify-between px-6 py-4 border-b border-[#313244]",children:[(0,l.FD)(b.A,{className:"p-0",sx:{fontWeight:600,fontSize:"1.1rem"},children:["Trocar modelo de ",w[n].toLowerCase()]}),(0,l.Y)(f.A,{onClick:a,size:"small",sx:{color:"#a6adc8"},children:(0,l.Y)(x.A,{className:"w-5 h-5"})})]}),(0,l.Y)(N.A,{className:"p-6",children:(0,l.FD)("div",{className:"space-y-5",children:[(0,l.FD)("div",{children:[(0,l.Y)("p",{className:"text-sm text-slate-300 mb-3",children:"Selecione o modelo"}),(0,l.Y)(Y.A,{value:o,onChange:e=>u(e.target.value),children:(0,l.Y)("div",{className:"space-y-2",children:r.map(e=>(0,l.FD)("label",{className:"flex flex-col p-3 rounded-lg border cursor-pointer transition-colors ".concat(o===e.id?"border-theme-state-action bg-theme-state-action/10":"border-gray-600 hover:border-gray-500"),children:[(0,l.FD)("div",{className:"flex items-start gap-3",children:[(0,l.Y)(A.A,{value:e.id,control:(0,l.Y)(y.A,{size:"small",sx:{p:0,mr:0}}),label:"",sx:{m:0}}),(0,l.FD)("div",{className:"flex-1 min-w-0",children:[(0,l.FD)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,l.Y)("span",{className:"theme-body-sm-bold text-slate-100",children:e.name}),(0,l.Y)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium ".concat(D[e.provider]),children:F[e.provider]}),e.isDefault&&(0,l.Y)("span",{className:"text-xs px-2 py-0.5 rounded-full bg-amber-900/40 text-amber-300 font-medium",children:"Padr\xe3o"})]}),(0,l.Y)("p",{className:"text-xs text-slate-300 mb-2",children:e.description}),(0,l.Y)("div",{className:"flex flex-wrap gap-1",children:e.tags.map(e=>{var t,a;return(0,l.Y)("span",{className:"text-xs px-1.5 py-0.5 rounded font-medium ".concat(null!=(t=M[e])?t:"bg-slate-800 text-slate-400"),children:null!=(a=T[e])?a:e},e)})})]})]}),e.pricing&&(0,l.Y)(E,{pricing:e.pricing})]},e.id))})})]}),(0,l.Y)(k.A,{label:"Motivo da troca (opcional)",value:m,onChange:e=>p(e.target.value),fullWidth:!0,size:"small",multiline:!0,minRows:2,placeholder:"Ex.: Trocado por ser mais barato",inputProps:{maxLength:500}}),(0,l.FD)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,l.Y)(v.A,{variant:"outlined",color:"action",label:"Cancelar",onClick:a,disabled:s}),(0,l.Y)(v.A,{variant:"contained",color:"success",label:s?"Salvandoâ¦":"Confirmar troca",onClick:()=>{o&&c(n,o,m.trim()||void 0)},disabled:s||h||!o})]})]})})]})}var I=a(29830),L=a(77820),j=a(40076),Q=a(74633);function R(){return(0,l.FD)("div",{className:"animate-pulse space-y-3 p-6",children:[(0,l.Y)("div",{className:"h-5 bg-theme-background-3 rounded w-2/5"}),(0,l.Y)("div",{className:"h-4 bg-theme-background-3 rounded w-1/3"}),(0,l.Y)("div",{className:"h-4 bg-theme-background-3 rounded w-3/4"}),(0,l.FD)("div",{className:"flex gap-2",children:[(0,l.Y)("div",{className:"h-5 bg-theme-background-3 rounded-full w-16"}),(0,l.Y)("div",{className:"h-5 bg-theme-background-3 rounded-full w-20"})]})]})}
1function H(e){return e.toLocaleString("pt-BR")}function K(e){let{type:t,activeModel:a,isLoading:n,onChangeClick:i}=e,r=w[t];return(0,l.FD)(u.A,{className:"flex flex-col h-full",children:[(0,l.FD)(m.A,{className:"flex items-start justify-between gap-4 px-6 py-5",children:[(0,l.FD)("div",{className:"space-y-0.5",children:[(0,l.Y)("p",{className:"text-[10px] font-semibold text-slate-400 uppercase tracking-widest",children:"Modelo ativo"}),(0,l.FD)(p.A,{children:["Chat de ",r]})]}),a&&(0,l.Y)("span",{className:"mt-1 shrink-0 text-xs px-2.5 py-1 rounded-full font-semibold ".concat(D[a.provider]),children:F[a.provider]})]}),(0,l.Y)(h.A,{}),n&&(0,l.Y)(R,{}),!n&&!a&&(0,l.Y)(j.A,{children:(0,l.Y)("p",{className:"text-slate-500 text-sm text-center py-6",children:"Nenhum modelo ativo configurado"})}),!n&&a&&(0,l.FD)("div",{className:"flex-1 px-6 py-5 space-y-5",children:[(0,l.FD)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,l.Y)("h3",{className:"theme-body-lg-bold text-slate-100",children:a.name}),a.isDefault&&(0,l.Y)("span",{className:"inline-flex items-center gap-1 text-[11px] font-semibold px-2 py-0.5 rounded-full bg-amber-900/40 text-amber-300 border border-amber-700/50",children:"â
Padr\xe3o"})]}),(0,l.Y)("p",{className:"text-sm text-slate-400 leading-relaxed",children:a.description}),(0,l.Y)("div",{className:"flex flex-wrap gap-1.5",children:a.tags.map(e=>{var t,a;return(0,l.Y)("span",{className:"text-xs px-2 py-0.5 rounded font-medium ".concat(null!=(t=M[e])?t:"bg-slate-800 text-slate-400"),children:null!=(a=T[e])?a:e},e)})}),(0,l.FD)("div",{className:"grid grid-cols-2 gap-2.5",children:[void 0!==a.contextWindow&&(0,l.FD)("div",{className:"flex items-center gap-3 bg-theme-background-3/50 border border-white/5 rounded-xl px-4 py-3",children:[(0,l.Y)(I.A,{className:"w-4 h-4 text-slate-500 shrink-0"}),(0,l.FD)("div",{children:[(0,l.Y)("p",{className:"text-[11px] text-slate-400 mb-0.5",children:"Contexto"}),(0,l.FD)("p",{className:"text-sm font-semibold text-slate-200 tabular-nums",children:[H(a.contextWindow)," tokens"]})]})]}),void 0!==a.maxOutputTokens&&(0,l.FD)("div",{className:"flex items-center gap-3 bg-theme-background-3/50 border border-white/5 rounded-xl px-4 py-3",children:[(0,l.Y)(I.A,{className:"w-4 h-4 text-slate-500 shrink-0"}),(0,l.FD)("div",{children:[(0,l.Y)("p",{className:"text-[11px] text-slate-400 mb-0.5",children:"Sa\xedda m\xe1x."}),(0,l.FD)("p",{className:"text-sm font-semibold text-slate-200 tabular-nums",children:[H(a.maxOutputTokens)," tokens"]})]})]}),a.supportsVision&&(0,l.FD)("div",{className:"flex items-center gap-3 bg-theme-background-3/50 border border-white/5 rounded-xl px-4 py-3",children:[(0,l.Y)(L.A,{className:"w-4 h-4 text-slate-500 shrink-0"}),(0,l.FD)("div",{children:[(0,l.Y)("p",{className:"text-[11px] text-slate-400 mb-0.5",children:"Vis\xe3o"}),(0,l.Y)("p",{className:"text-sm font-semibold text-slate-200",children:"Suportada"})]})]})]})]}),!n&&(null==a?void 0:a.pricing)&&(0,l.FD)(l.FK,{children:[(0,l.Y)(h.A,{}),(0,l.Y)(O,{pricing:a.pricing})]}),(0,l.Y)(h.A,{}),(0,l.Y)(Q.A,{className:"px-6 py-4",children:(0,l.Y)(v.A,{variant:"outlined",color:"action",label:"Trocar modelo de ".concat(r.toLowerCase()),onClick:i,disabled:n})})]})}function U(e){let{catalog:t,activeText:a,activeImage:n,isLoading:i,isSaving:r,error:s,onUpdate:x}=e,[v,g]=(0,d.useState)(null),b=t.filter(e=>"text"===e.type),f=t.filter(e=>"image"===e.type),N="text"===v?a:n;return(0,l.FD)(l.FK,{children:[(0,l.Y)(c.A,{open:r}),(0,l.FD)(o.A,{children:[(0,l.FD)(u.A,{children:[(0,l.Y)(m.A,{children:(0,l.Y)(p.A,{children:"Modelos de IA â Configura\xe7\xe3o"})}),(0,l.Y)(h.A,{})]}),s&&(0,l.Y)("div",{className:"rounded-xl border border-red-700 bg-red-900/20 px-5 py-4 text-sm text-red-300",children:s.message||"Ocorreu um erro ao salvar. Tente novamente."}),(0,l.FD)("div",{className:"grid grid-cols-1 gap-6 md:grid-cols-2 md:items-stretch",children:[(0,l.Y)(K,{type:"text",activeModel:a,isLoading:i,onChangeClick:()=>g("text")}),(0,l.Y)(K,{type:"image",activeModel:n,isLoading:i,onChangeClick:()=>g("image")})]})]}),(0,l.Y)(_,{open:!!v,onClose:()=>g(null),type:null!=v?v:"text",currentModel:N,availableModels:"text"===v?b:f,isSaving:r,onSave:(e,t,a)=>{x(e,t,a),g(null)}})]})}function V(){var e,t,a,n,i,r,d,c;let o=(0,s.c7)(),u=(0,s.oB)(),m=(0,s.sT)(),p=null!=(r=null==(e=o.data)?void 0:e.data)?r:[],h=null!=(d=null==(a=u.data)||null==(t=a.data)?void 0:t.text)?d:null,x=null!=(c=null==(i=u.data)||null==(n=i.data)?void 0:n.image)?c:null,v=o.isLoading||u.isLoading;return(0,l.Y)(U,{catalog:p,activeText:h,activeImage:x,isLoading:v,isSaving:m.isPending,error:m.error,onUpdate:(e,t,a)=>{m.mutate({type:e,modelId:t,description:a})}})}var W=!0;let q=()=>((0,r.VY)(),(0,l.FD)(l.FK,{children:[(0,l.Y)(n.bV,{title:"Meu ajudante - Modelos de IA",nofollow:!0,noindex:!0}),(0,l.Y)(i.A,{children:(0,l.Y)(V,{})})]}))},74633:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var l=a(36303),n=a(76180);function i(e){let{children:t,className:a,...i}=e;return(0,l.Y)("footer",{className:(0,n.Q)("p-6",a),...i,children:t})}},75786:(e,t,a)=>{"use strict";a.d(t,{A:()=>r});var l=a(36303),n=a(68658),i=a(76180);let r=(0,n.memo)(function(e){let{children:t,sectionProps:a}=e;return(0,l.Y)("section",{className:(0,i.Q)("\n min-h-[calc(100vh-theme(sp
1acing.4)-theme(spacing.4)-4.5rem)]\n sm:min-h-[calc(100vh-theme(spacing.4)-theme(spacing.4)-4.5rem)]\n md:min-h-[calc(100vh-theme(spacing.4)-theme(spacing.10)-4.5rem)]\n ",null==a?void 0:a.className),children:t})})},78010:(e,t,a)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/ma-my-admin/chat-ia/modelos-ia",function(){return a(54030)}])},83100:(e,t,a)=>{"use strict";a.d(t,{A:()=>u});var l=a(36303),n=a(68658),i=a(77910),r=a(40914),s=a(95758),d=a(40076),c=a(75786),o=a(16705);function u(e){let{children:t}=e,{user:a,isAuthenticated:u}=(0,s.R)(),{hasPermission:m}=(0,o.S)(),p=(0,i.useRouter)(),[h,x]=(0,n.useState)(!1);return((0,n.useEffect)(()=>{x(!0)},[]),(0,n.useEffect)(()=>{h&&p.isReady&&(!u||!a)&&p.replace("".concat(r.A.PATHS.HOME,"?redirect=").concat(encodeURIComponent(p.asPath)))},[h,u,a,p]),h&&u&&a)?m(p.pathname)?(0,l.Y)(l.FK,{children:t}):(0,l.Y)(c.A,{children:(0,l.Y)(d.A,{children:(0,l.FD)("div",{className:"text-center py-8",children:[(0,l.Y)("div",{className:"text-red-500 text-lg font-semibold",children:"Acesso restrito"}),(0,l.Y)("div",{className:"text-gray-600 mt-2",children:"Voc\xea n\xe3o tem permiss\xe3o para acessar esta funcionalidade."})]})})}):null}},87479:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var l=a(36303),n=a(76180);function i(e){let{children:t,className:a,...i}=e;return(0,l.Y)("header",{className:(0,n.Q)("p-6",a),...i,children:t})}}},e=>{e.O(0,[80948,90636,46593,38792],()=>e(e.s=78010)),_N_E=e.O()}]);
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.