PageSourceSearch

https://meubiz.com.br/_nuxt/CXeCBkkb.js

js meubiz.com.br collected 2026-10-04 21:22:26 UTC 9,119 bytes, 7 lines download raw bytes

1import{u as q,a as S,_ as W}from"./DJJmyNE4.js";import{E as z,O as g,G as h,aj as A,ax as M,ay as V,ao as f,ap as y,ar as k,h as B,o as R,am as I,an as O,aq as L,u,b as w}from"./Dgi4Cgz7.js";class G{diff(t,n,e={}){let o;typeof e=="function"?(o=e,e={}):"callback"in e&&(o=e.callback);const s=this.castInput(t,e),a=this.castInput(n,e),p=this.removeEmpty(this.tokenize(s,e)),i=this.removeEmpty(this.tokenize(a,e));return this.diffWithOptionsObj(p,i,e,o)}diffWithOptionsObj(t,n,e,o){var s;const a=l=>{if(l=this.postProcess(l,e),o){setTimeout(function(){o(l)},0);return}else return l},p=n.length,i=t.length;let c=1,d=p+i;e.maxEditLength!=null&&(d=Math.min(d,e.maxEditLength));const _=(s=e.timeout)!==null&&s!==void 0?s:1/0,P=Date.now()+_,x=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(x[0],n,t,0,e);if(x[0].oldPos+1>=i&&b+1>=p)return a(this.buildValues(x[0].lastComponent,n,t));let r=-1/0,m=1/0;const T=()=>{for(let l=Math.max(r,-c);l<=Math.min(m,c);l+=2){let C;const D=x[l-1],E=x[l+1];D&&(x[l-1]=void 0);let j=!1;if(E){const $=E.oldPos-l;j=E&&0<=$&&$<p}const N=D&&D.oldPos+1<i;if(!j&&!N){x[l]=void 0;continue}if(!N||j&&D.oldPos<E.oldPos?C=this.addToPath(E,!0,!1,0,e):C=this.addToPath(D,!1,!0,1,e),b=this.extractCommon(C,n,t,l,e),C.oldPos+1>=i&&b+1>=p)return a(this.buildValues(C.lastComponent,n,t))||!0;x[l]=C,C.oldPos+1>=i&&(m=Math.min(m,l-1)),b+1>=p&&(r=Math.max(r,l+1))}c++};if(o)(function l(){setTimeout(function(){if(c>d||Date.now()>P)return o(void 0);T()||l()},0)})();else for(;c<=d&&Date.now()<=P;){const l=T();if(l)return l}}addToPath(t,n,e,o,s){const a=t.lastComponent;return a&&!s.oneChangePerToken&&a.added===n&&a.removed===e?{oldPos:t.oldPos+o,lastComponent:{count:a.count+1,added:n,removed:e,previousComponent:a.previousComponent}}:{oldPos:t.oldPos+o,lastComponent:{count:1,added:n,removed:e,previousComponent:a}}}extractCommon(t,n,e,o,s){const a=n.length,p=e.length;let i=t.oldPos,c=i-o,d=0;for(;c+1<a&&i+1<p&&this.equals(e[i+1],n[c+1],s);)c++,i++,d++,s.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return d&&!s.oneChangePerToken&&(t.lastComponent={count:d,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=i,c}equals(t,n,e){return e.comparator?e.comparator(t,n):t===n||!!e.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let e=0;e<t.length;e++)t[e]&&n.push(t[e]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,e){const o=[];let s;for(;t;)o.push(t),s=t.previousComponent,delete t.previousComponent,t=s;o.reverse();const a=o.length;let p=0,i=0,c=0;for(;p<a;p++){const d=o[p];if(d.removed)d.value=this.join(e.slice(c,c+d.count)),c+=d.count;else{if(!d.added&&this.useLongestToken){let _=n.slice(i,i+d.count);_=_.map(function(P,x){const b=e[c+x];return b.length>P.length?b:P}),d.value=this.join(_)}else d.value=this.join(n.slice(i,i+d.count));i+=d.count,d.added||(c+=d.count)}}return o}}class F extends G{constructor(){super(...arguments),this.tokenize=K}equals(t,n,e){return e.ignoreWhitespace?((!e.newlineIsToken||!t.includes(`
2`))&&(t=t.trim()),(!e.newlineIsToken||!n.includes(`
3`))&&(n=n.trim())):e.ignoreNewlineAtEof&&!e.newlineIsToken&&(t.endsWith(`
4`)&&(t=t.slice(0,-1)),n.endsWith(`
5`)&&(n=n.slice(0,-1))),super.equals(t,n,e)}}const J=new F;function H(v,t,n){return J.diff(v,t,n)}function K(v,t){t.stripTrailingCr&&(v=v.replace(/\r\n/g,`
6`));const n=[],e=v.split(/(\n|\r\n)/);e[e.length-1]||e.pop();for(let o=0;o<e.length;o++){const s=e[o];o%2&&!t.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}const Q={class:"overflow-hidden rounded-lg border border-gray-300 bg-white font-mono text-xs leading-relaxed"},U={key:0,class:"px-3 py-4 text-center text-gray-400"},X=z({__name:"PromptDiffViewer",props:{oldText:{},newText:{}},setup(v){const t=v,n=B(()=>H(t.oldText||"",t.newText||"").map((o,s)=>({key:s,type:o.added?"added":o.removed?"removed":"unchanged",lines:o.value.replace(/\n$/,"").split(`
7`)})));return(e,o)=>(g(),h("div",Q,[(g(!0),h(A,null,M(n.value,s=>(g(),h("div",{key:s.key,class:V({"bg-green-50":s.type==="added","bg-red-50":s.type==="removed"})}
7,[(g(!0),h(A,null,M(s.lines,(a,p)=>(g(),h("div",{key:p,class:V(["flex whitespace-pre-wrap px-3 py-0.5",{"text-green-800":s.type==="added","text-red-800 line-through decoration-red-400":s.type==="removed","text-gray-700":s.type==="unchanged"}])},[f("span",{class:V(["mr-2 select-none",s.type==="added"?"text-green-500":s.type==="removed"?"text-red-500":"text-gray-300"])},y(s.type==="added"?"+":s.type==="removed"?"-":" "),3),f("span",null,y(a||" "),1)],2))),128))],2))),128)),n.value.length===0?(g(),h("div",U," Nenhuma diferença encontrada. ")):k("",!0)]))}}),Y=Object.assign(X,{__name:"AdminManychatAgentTesterPromptDiffViewer"}),Z={class:"min-h-screen bg-gray-50"},ee={class:"mx-auto max-w-5xl px-4 py-8"},te={class:"mb-4 flex flex-wrap gap-3"},ne={key:0,class:"text-sm text-gray-400"},se={class:"mb-6 flex flex-wrap items-center justify-between gap-3"},oe={class:"mt-1 text-sm text-gray-600"},ae={class:"rounded bg-gray-100 px-1 py-0.5 text-xs"},re={key:0,class:"mb-4 rounded-lg bg-red-50 px-4 py-2 text-red-700"},ie={key:1,class:"mb-4 rounded-lg bg-emerald-50 px-4 py-2 text-emerald-700"},de={key:2,class:"mb-6 rounded-xl border border-gray-200 bg-white p-4 shadow-sm"},le={class:"whitespace-pre-wrap text-sm text-gray-700"},ce={class:"mb-6"},ue={key:3,class:"flex justify-end gap-3"},pe=["disabled"],me=["disabled"],fe={key:4,class:"text-sm text-emerald-700"},xe=z({__name:"[id]",setup(v){const t=q();S();const n=Number(t.params.id),e=w(null),o=w(""),s=w(!1),a=w(""),p=w(""),i=w(!1),c=w(!1);async function d(){s.value=!0,a.value="";try{const r=await $fetch(`/api/admin/manychat-agent-tester/prompt-proposals/${n}`);e.value=r.proposal,o.value=r.currentPromptText}catch(r){a.value=r?.data?.message||r?.message||"Erro ao carregar proposta de prompt."}finally{s.value=!1}}R(d);async function _(){if(e.value&&confirm("Publicar esta proposta como a nova versão ativa do system prompt do agente?")){i.value=!0,a.value="";try{const r=await $fetch(`/api/admin/manychat-agent-tester/prompt-proposals/${n}/publish`,{method:"POST"});e.value=r.proposal,p.value="Proposta publicada como nova versão do system prompt."}catch(r){a.value=r?.data?.message||r?.message||"Erro ao publicar proposta."}finally{i.value=!1}}}async function P(){if(e.value&&confirm("Descartar esta proposta de prompt?")){c.value=!0,a.value="";try{const r=await $fetch(`/api/admin/manychat-agent-tester/prompt-proposals/${n}/discard`,{method:"POST"});e.value=r.proposal,p.value="Proposta descartada."}catch(r){a.value=r?.data?.message||r?.message||"Erro ao descartar proposta."}finally{c.value=!1}}}function x(r){return r==="published"?"Publicada":r==="discarded"?"Descartada":"Rascunho"}function b(r){return r==="published"?"bg-emerald-100 text-emerald-700":r==="discarded"?"bg-gray-200 text-gray-500":"bg-cyan-100 text-cyan-700"}return(r,m)=>{const T=W,l=Y;return g(),h("div",Z,[f("div",ee,[f("div",te,[I(T,{to:"/admin/manychat-agent-tester/conversations",class:"inline-flex items-center gap-2 rounded-lg bg-gray-100 px-4 py-2 text-gray-700 transition-colors hover:bg-gray-200"},{default:O(()=>[...m[0]||(m[0]=[L(" Voltar às conversas curadas ",-1)])]),_:1})]),u(s)?(g(),h("p",ne,"Carregando proposta…")):u(e)?(g(),h(A,{key:1},[f("div",se,[f("div",null,[m[2]||(m[2]=f("h1",{class:"text-2xl font-bold text-gray-900"},"Proposta de novo system prompt",-1)),f("p",oe,[m[1]||(m[1]=L(" Gerada com ",-1)),f("code",ae,y(u(e).model),1),L(" a partir de "+y(u(e).source_test_conversation_ids.length)+" conversa(s) curada(s). ",1)])]),f("span",{class:V(["rounded-full px-3 py-1 text-xs font-semibold",b(u(e).status)])},y(x(u(e).status)),3)]),u(a)?(g(),h("p",re,y(u(a)),1)):k("",!0),u(p)?(g(),h("p",ie,y(u(p)),1)):k("",!0),u(e).rationale?(g(),h("section",de,[m[3]||(m[3]=f("h2",{class:"mb-2 text-sm font-semibold text-gray-800"},"Justificativa da LLM",-1)),f("p",le,y(u(e).rationale),1)])):k("",!0),f("section",ce,[m[4]||(m[4]=f("h2",{class:"mb-2 text-sm font-semibold text-gray-800"}," Diff: prompt atual (vermelho) → proposta (verde) ",-1)),I(l,{"old-text":u(o),"new-text":u(e).proposed_text},null,8,["old-text","new-text"])]),u(e).status==="draft"?(g(),h("div",ue,[f("button",{type:"button",class:"rounded-lg bg-gray-100 px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-200 disabled:opacity-50",disabled:u(c),onClick:P},y(u(c)?"Descartando…":"Descartar proposta"),9,pe),f("button",{type:"button",class:"rounded-lg bg-cyan-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-cyan-700 disabled:opacity-50",disabled:u(i),onClick:_},y(u(i)?"Publicando…":"Publicar como nova versão"),9,me)])):u(e).status==="published"?(g(),h("p",fe,[L(" Publicada como prompt id "+y(u(e).published_prompt_id)+". Veja em ",1),I(T,{to:"/admin/llm-prompts",class:"underline"},{default:O(()=>
7[...m[5]||(m[5]=[L("Prompts de IA",-1)])]),_:1}),m[6]||(m[6]=L(". ",-1))])):k("",!0)],64)):k("",!0)])])}}});export{xe as default};

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.