diff --git a/orchestrator/src/views/AgenteDetail.vue b/orchestrator/src/views/AgenteDetail.vue index 63fc164..007eb9f 100644 --- a/orchestrator/src/views/AgenteDetail.vue +++ b/orchestrator/src/views/AgenteDetail.vue @@ -109,6 +109,35 @@ async function subirArchivo() { } } +// Editar una fuente escrita a mano. Las plantillas de rubro dejan las notas +// con valores entre corchetes para reemplazar — sin esto, no había con qué. +const editandoDoc = ref(null) +const docForm = ref({ titulo: '', contenido: '' }) +const guardandoDoc = ref(false) + +function editarDocumento(d) { + editandoDoc.value = d + docForm.value = { titulo: d.origen, contenido: d.contenido || '' } +} + +async function guardarDocumento() { + if (!editandoDoc.value) return + guardandoDoc.value = true + error.value = '' + try { + await api.put(apiUmind(`/umind/documentos/${editandoDoc.value.ID}`), { + titulo: docForm.value.titulo, + contenido: docForm.value.contenido, + }) + editandoDoc.value = null + await cargarDocumentos() + } catch (e) { + error.value = e.message + } finally { + guardandoDoc.value = false + } +} + async function reprocesar(d) { error.value = '' try { @@ -584,15 +613,63 @@ watch( :title="d.auto_actualizar ? 'Dejar de releer sola' : 'Releer el sitio cada semana'" @click="alternarAuto(d)" >{{ d.auto_actualizar ? '🔁 auto' : '↻ manual' }} + + + + +
+ Al guardar se vuelve a leer y el agente empieza a contestar con esto. +
+ + +z)for(;R<=F;)Oe(d[R],k,w,!0),R++;else{const ee=R,ce=R,ge=new Map;for(R=ce;R<=z;R++){const De=p[R]=T?$t(p[R]):yt(p[R]);De.key!=null&&ge.set(De.key,R)}let fe,Re=0;const Ie=z-ce+1;let nt=!1,st=0;const Jt=new Array(Ie);for(R=0;R=Ie){Oe(De,k,w,!0);continue}let We;if(De.key!=null)We=ge.get(De.key);else for(fe=ce;fe<=z;fe++)if(Jt[fe-ce]===0&&yn(De,p[fe])){We=fe;break}We===void 0?Oe(De,k,w,!0):(Jt[We-ce]=R+1,We>=st?st=We:nt=!0,P(De,p[We],g,null,k,w,V,N,T),Re++)}const Gn=nt?Aa(Jt):an;for(fe=Gn.length-1,R=Ie-1;R>=0;R--){const De=ce+R,We=p[De],Lt=p[De+1],Kn=De+1 {const{el:w,type:V,transition:N,children:T,shapeFlag:R}=d;if(R&6){Ke(d.component.subTree,p,g,_);return}if(R&128){d.suspense.move(p,g,_);return}if(R&64){V.move(d,p,g,J);return}if(V===ie){s(w,p,g);for(let F=0;FN.enter(w),k));else{const{leave:F,delayLeave:z,afterLeave:ee}=N,ce=()=>{d.ctx.isUnmounted?o(w):s(w,p,g)},ge=()=>{const fe=w._isLeaving||!!w[Ts];w._isLeaving&&w[Ts](!0),N.persisted&&!fe?ce():F(w,()=>{ce(),ee&&ee()})};z?z(w,ce,ge):ge()}else s(w,p,g)},Oe=(d,p,g,_=!1,k=!1)=>{const{type:w,props:V,ref:N,children:T,dynamicChildren:R,shapeFlag:Q,patchFlag:F,dirs:z,cacheIndex:ee,memo:ce}=d;if(F===-2&&(k=!1),N!=null&&(Dt(),In(N,null,g,d,!0),Mt()),ee!=null&&(p.renderCache[ee]=void 0),Q&256){p.ctx.deactivate(d);return}const ge=Q&1&&z,fe=!dn(d);let Re;if(fe&&(Re=V&&V.onVnodeBeforeUnmount)&&bt(Re,p,d),Q&6)vt(d.component,g,_);else{if(Q&128){d.suspense.unmount(g,_);return}ge&&Qt(d,null,p,"beforeUnmount"),Q&64?d.type.remove(d,p,g,J,_):R&&!R.hasOnce&&(w!==ie||F>0&&F&64)?He(R,p,g,!1,!0):(w===ie&&F&384||!k&&Q&16)&&He(T,p,g),_&&tt(d)}const Ie=ce!=null&&ee==null;(fe&&(Re=V&&V.onVnodeUnmounted)||ge||Ie)&&et(()=>{Re&&bt(Re,p,d),ge&&Qt(d,null,p,"unmounted"),Ie&&(d.el=null)},g)},tt=d=>{const{type:p,el:g,anchor:_,transition:k}=d;if(p===ie){le(g,_);return}if(p===ns){I(d);return}const w=()=>{o(g),k&&!k.persisted&&k.afterLeave&&k.afterLeave()};if(d.shapeFlag&1&&k&&!k.persisted){const{leave:V,delayLeave:N}=k,T=()=>V(g,w);N?N(d.el,w,T):T()}else w()},le=(d,p)=>{let g;for(;d!==p;)g=v(d),o(d),d=g;o(p)},vt=(d,p,g)=>{const{bum:_,scope:k,job:w,subTree:V,um:N,m:T,a:R}=d;Fo(T),Fo(R),_&&es(_),k.stop(),w&&(w.flags|=8,Oe(V,d,p,g)),N&&et(N,p),et(()=>{d.isUnmounted=!0},p)},He=(d,p,g,_=!1,k=!1,w=0)=>{for(let V=w;V {if(d.shapeFlag&6)return S(d.component.subTree);if(d.shapeFlag&128)return d.suspense.next();const p=v(d.anchor||d.el),g=p&&p[Ll];return g?v(g):p};let q=!1;const U=(d,p,g)=>{let _;d==null?p._vnode&&(Oe(p._vnode,null,null,!0),_=p._vnode.component):P(p._vnode||null,d,p,null,null,null,g),p._vnode=d,q||(q=!0,$o(_),zr(),q=!1)},J={p:P,um:Oe,m:Ke,r:tt,mt:Ze,mc:L,pc:ue,pbc:Z,n:S,o:e};return{render:U,hydrate:void 0,createApp:ca(U)}}function Ds({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Yt({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ka(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function bi(e,t,n=!1){const s=e.children,o=t.children;if(X(s)&&X(o))for(let r=0;r >1,e[n[a]] 0&&(t[s]=n[r-1]),n[r]=s)}}for(r=n.length,i=n[r-1];r-- >0;)n[r]=i,i=t[i];return n}function xi(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:xi(t)}function Fo(e){if(e)for(let t=0;t e.__isSuspense;function Ra(e,t){t&&t.pendingBranch?X(e)?t.effects.push(...e):t.effects.push(e):Ml(e)}const ie=Symbol.for("v-fgt"),Es=Symbol.for("v-txt"),Et=Symbol.for("v-cmt"),ns=Symbol.for("v-stc"),Nt=[];let rt=null;function y(e=!1){Nt.push(rt=e?null:[])}function wo(){Nt.pop(),rt=Nt[Nt.length-1]||null}let Dn=1;function us(e,t=!1){Dn+=e,e<0&&rt&&t&&(rt.hasOnce=!0)}function wi(e){return e.dynamicChildren=Dn>0?rt||an:null,wo(),Dn>0&&rt&&rt.push(e),e}function C(e,t,n,s,o,r){return wi(l(e,t,n,s,o,r,!0))}function ot(e,t,n,s,o){return wi(ke(e,t,n,s,o,!0))}function Mn(e){return e?e.__v_isVNode===!0:!1}function yn(e,t){return e.type===t.type&&e.key===t.key}const Ci=({key:e})=>e??null,ss=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Pe(e)||Ge(e)||ne(e)?{i:Le,r:e,k:t,f:!!n}:e:null);function l(e,t=null,n=null,s=0,o=null,r=e===ie?0:1,i=!1,a=!1){const u={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ci(t),ref:t&&ss(t),scopeId:Qr,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:s,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:Le};return a?(cs(u,n),r&128&&e.normalize(u)):n&&(u.shapeFlag|=Pe(n)?8:16),Dn>0&&!i&&rt&&(u.patchFlag>0||r&6)&&u.patchFlag!==32&&rt.push(u),u}const ke=Ia;function Ia(e,t=null,n=null,s=0,o=null,r=!1){if((!e||e===ea)&&(e=Et),Mn(e)){const a=hn(e,t,!0);return n&&cs(a,n),Dn>0&&!r&&rt&&(a.shapeFlag&6?rt[rt.indexOf(e)]=a:rt.push(a)),a.patchFlag=-2,a}if(Fa(e)&&(e=e.__vccOpts),t){t=$a(t);let{class:a,style:u}=t;a&&!Pe(a)&&(t.class=Se(a)),ve(u)&&(mo(u)&&!X(u)&&(u=Fe({},u)),t.style=nn(u))}const i=Pe(e)?1:yi(e)?128:ys(e)?64:ve(e)?4:ne(e)?2:0;return l(e,t,n,s,o,i,r,!0)}function $a(e){return e?mo(e)||fi(e)?Fe({},e):e:null}function hn(e,t,n=!1,s=!1){const{props:o,ref:r,patchFlag:i,children:a,transition:u}=e,f=t?Pa(o||{},t):o,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&Ci(f),ref:t&&t.ref?n&&r?X(r)?r.concat(ss(t)):[r,ss(t)]:ss(t):r,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ie?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:u,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&hn(e.ssContent),ssFallback:e.ssFallback&&hn(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return u&&s&&vo(c,u.clone(c)),c}function we(e=" ",t=0){return ke(Es,null,e,t)}function Ei(e,t){const n=ke(ns,null,e);return n.staticCount=t,n}function Y(e="",t=!1){return t?(y(),ot(Et,null,e)):ke(Et,null,e)}function yt(e){return e==null||typeof e=="boolean"?ke(Et):X(e)?ke(ie,null,e.slice()):Mn(e)?$t(e):ke(Es,null,String(e))}function $t(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:hn(e)}function cs(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(X(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),cs(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!fi(t)?t._ctx=Le:o===3&&Le&&(Le.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(ne(t)){if(s&65){cs(e,{default:t});return}t={default:t,_ctx:Le},n=32}else t=String(t),s&64?(n=16,t=[we(t)]):n=8;e.children=t,e.shapeFlag|=n}function Pa(...e){const t={};for(let n=0;n qe||Le;let ds,Vn;{const e=vs(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),r=>{o.length>1?o.forEach(i=>i(r)):o[0](r)}};ds=t("__VUE_INSTANCE_SETTERS__",n=>qe=n),Vn=t("__VUE_SSR_SETTERS__",n=>jn=n)}const qn=e=>{const t=qe;return ds(e),e.scope.on(),()=>{e.scope.off(),ds(t)}},Ho=()=>{qe&&qe.scope.off(),ds(null)};function Si(e){return e.vnode.shapeFlag&4}let jn=!1;function Ma(e,t=!1,n=!1){t&&Vn(t);const{props:s,children:o}=e.vnode,r=Si(e);ba(e,s,r,t),wa(e,o,n||t);const i=r?Va(e,t):void 0;return t&&Vn(!1),i}function Va(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,sa);const{setup:s}=n;if(s){Dt();const o=e.setupContext=s.length>1?Ua(e):null,r=qn(e),i=Hn(s,e,0,[e.props,o]),a=wr(i);if(Mt(),r(),(a||e.sp)&&!dn(e)&&ti(e),a){if(i.then(Ho,Ho),t)return i.then(u=>{Vn(!0);try{Bo(e,u,t)}finally{Vn(!1)}}).catch(u=>{_s(u,e,0)});e.asyncDep=i}else Bo(e,i)}else ki(e)}function Bo(e,t,n){ne(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:ve(t)&&(e.setupState=Gr(t)),ki(e)}function ki(e,t,n){const s=e.type;e.render||(e.render=s.render||Ct);{const o=qn(e);Dt();try{oa(e)}finally{Mt(),o()}}}const ja={get(e,t){return Be(e,"get",""),e[t]}};function Ua(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,ja),slots:e.slots,emit:e.emit,expose:t}}function Ss(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Gr(kl(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in $n)return $n[n](e)},has(t,n){return n in t||n in $n}})):e.proxy}function La(e,t=!0){return ne(e)?e.displayName||e.name:e.name||t&&e.__name}function Fa(e){return ne(e)&&"__vccOpts"in e}const ye=(e,t)=>Pl(e,t,jn);function Ai(e,t,n){try{us(-1);const s=arguments.length;return s===2?ve(t)&&!X(t)?Mn(t)?ke(e,null,[t]):ke(e,t):ke(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Mn(n)&&(n=[n]),ke(e,t,n))}finally{us(1)}}const Ha="3.5.41";/** +* @vue/runtime-dom v3.5.41 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let Xs;const qo=typeof window<"u"&&window.trustedTypes;if(qo)try{Xs=qo.createPolicy("vue",{createHTML:e=>e})}catch{}const Ri=Xs?e=>Xs.createHTML(e):e=>e,Ba="http://www.w3.org/2000/svg",qa="http://www.w3.org/1998/Math/MathML",Rt=typeof document<"u"?document:null,Go=Rt&&Rt.createElement("template"),Ga={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const o=t==="svg"?Rt.createElementNS(Ba,e):t==="mathml"?Rt.createElementNS(qa,e):n?Rt.createElement(e,{is:n}):Rt.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>Rt.createTextNode(e),createComment:e=>Rt.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Rt.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,r){const i=n?n.previousSibling:t.lastChild;if(o&&(o===r||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===r||!(o=o.nextSibling)););else{Go.innerHTML=Ri(s==="svg"?``:s==="mathml"?``:e);const a=Go.content;if(s==="svg"||s==="mathml"){const u=a.firstChild;for(;u.firstChild;)a.appendChild(u.firstChild);a.removeChild(u)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Ka=Symbol("_vtc");function Wa(e,t,n){const s=e[Ka];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Ko=Symbol("_vod"),za=Symbol("_vsh"),Ja=Symbol(""),Qa=/(?:^|;)\s*display\s*:/;function Ya(e,t,n){const s=e.style,o=Pe(n);let r=!1;if(n&&!o){if(t)if(Pe(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&En(s,a,"")}else for(const i in t)n[i]==null&&En(s,i,"");for(const i in n){i==="display"&&(r=!0);const a=n[i];a!=null?Za(e,i,!Pe(t)&&t?t[i]:void 0,a)||En(s,i,a):En(s,i,"")}}else if(o){if(t!==n){const i=s[Ja];i&&(n+=";"+i),s.cssText=n,r=Qa.test(n)}}else t&&e.removeAttribute("style");Ko in e&&(e[Ko]=r?s.display:"",e[za]&&(s.display="none"))}const Wo=/\s*!important$/;function En(e,t,n){if(X(n))n.forEach(s=>En(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=Xa(e,t);Wo.test(n)?e.setProperty(sn(s),n.replace(Wo,""),"important"):e[s]=n}}const zo=["Webkit","Moz","ms"],Ms={};function Xa(e,t){const n=Ms[t];if(n)return n;let s=Xe(t);if(s!=="filter"&&s in e)return Ms[t]=s;s=hs(s);for(let o=0;o Vs||(ru.then(()=>Vs=0),Vs=Date.now());function lu(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(X(o)){const r=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{r.call(s),s._stopped=!0};const i=o.slice(),a=[s];for(let u=0;u e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,au=(e,t,n,s,o,r)=>{const i=o==="svg";t==="class"?Wa(e,s,i):t==="style"?Ya(e,n,s):fs(t)?ps(t)||tu(e,t,n,s,r):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):uu(e,t,s,i))?(Yo(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Qo(e,t,s,i,r,t!=="value")):e._isVueCE&&(cu(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Pe(s)))?Yo(e,Xe(t),s,r,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),Qo(e,t,s,i))};function uu(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&Zo(t)&&ne(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return Zo(t)&&Pe(n)?!1:t in e}function cu(e,t){const n=e._def.props;if(!n)return!1;const s=Xe(t);return Array.isArray(n)?n.some(o=>Xe(o)===s):Object.keys(n).some(o=>Xe(o)===s)}const zt=e=>{const t=e.props["onUpdate:modelValue"]||!1;return X(t)?n=>es(t,n):t};function du(e){e.target.composing=!0}function er(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const it=Symbol("_assign"),Yn=Symbol("_initialValue");function js(e,t,n){return t&&(e=e.trim()),n&&(e=gs(e)),e}const be={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e.parentNode&&(e.type==="text"?e[Yn]=e.defaultValue.replace(/[\r\n]/g,""):e.type==="textarea"&&(e[Yn]=e.defaultValue.replace(/\r\n?/g,` +`))),e[it]=zt(o);const r=s||o.props&&o.props.type==="number";Tt(e,t?"change":"input",i=>{i.target.composing||e[it](js(e.value,n,r))}),(n||r)&&Tt(e,"change",()=>{e.value=js(e.value,n,r)}),t||(Tt(e,"compositionstart",du),Tt(e,"compositionend",er),Tt(e,"change",er))},mounted(e,{value:t,modifiers:{trim:n,number:s}}){const o=t??"",r=e[Yn];delete e[Yn],r!==void 0&&(e.type==="text"||e.type==="textarea")&&e.value!==r?e[it](js(e.value,n,s)):e.value=o},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:r}},i){if(e[it]=zt(i),e.composing)return;const a=(r||e.type==="number")&&!/^0\d/.test(e.value)?gs(e.value):e.value,u=t??"";if(a===u)return;const f=e.getRootNode();(f instanceof Document||f instanceof ShadowRoot)&&f.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===u)||(e.value=u)}},It={deep:!0,created(e,t,n){e[it]=zt(n),Tt(e,"change",()=>{const s=e._modelValue,o=gn(e),r=e.checked,i=e[it];if(X(s)){const a=io(s,o),u=a!==-1;if(r&&!u)i(s.concat(o));else if(!r&&u){const f=[...s];f.splice(a,1),i(f)}}else if(xn(s)){const a=new Set(s);r?a.add(o):a.delete(o),i(a)}else i(Ii(e,r))})},mounted:tr,beforeUpdate(e,t,n){e[it]=zt(n),tr(e,t,n)}};function tr(e,{value:t,oldValue:n},s){e._modelValue=t;let o;if(X(t))o=io(t,s.props.value)>-1;else if(xn(t))o=t.has(s.props.value);else{if(t===n)return;o=Wt(t,Ii(e,!0))}e.checked!==o&&(e.checked=o)}const fu={created(e,{value:t},n){e.checked=Wt(t,n.props.value),e[it]=zt(n),Tt(e,"change",()=>{e[it](gn(e))})},beforeUpdate(e,{value:t,oldValue:n},s){e[it]=zt(s),t!==n&&(e.checked=Wt(t,s.props.value))}},Un={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,Tt(e,"change",()=>{const o=Array.prototype.filter.call(e.options,r=>r.selected).map(r=>n?gs(gn(r)):gn(r));e[it](e.multiple?xn(e._modelValue)?new Set(o):o:o[0]),e._assigning=!0,ho(()=>{e._assigning=!1})}),e[it]=zt(s)},mounted(e,{value:t}){nr(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[it]=zt(n)},updated(e,{value:t}){e._assigning||nr(e,t)}};function nr(e,t){const n=e.multiple,s=X(t);if(!(n&&!s&&!xn(t))){for(let o=0,r=e.options.length;o String(f)===String(a)):i.selected=io(t,a)>-1}else i.selected=t.has(a);else if(Wt(gn(i),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function gn(e){return"_value"in e?e._value:e.value}function Ii(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const pu=["ctrl","shift","alt","meta"],mu={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>pu.some(n=>e[`${n}Key`]&&!t.includes(n))},Ue=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...r)=>{for(let i=0;i {const t=gu().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=xu(s);if(!o)return;const r=t._component;!ne(r)&&!r.render&&!r.template&&(r.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const i=n(o,!1,bu(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),i},t});function bu(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function xu(e){return Pe(e)?document.querySelector(e):e}/*! + * vue-router v4.6.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */const ln=typeof document<"u";function $i(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function _u(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&$i(e.default)}const pe=Object.assign;function Us(e,t){const n={};for(const s in t){const o=t[s];n[s]=ht(o)?o.map(e):e(o)}return n}const Pn=()=>{},ht=Array.isArray;function or(e,t){const n={};for(const s in e)n[s]=s in t?t[s]:e[s];return n}const Pi=/#/g,yu=/&/g,wu=/\//g,Cu=/=/g,Eu=/\?/g,Oi=/\+/g,Su=/%5B/g,ku=/%5D/g,Ti=/%5E/g,Au=/%60/g,Ni=/%7B/g,Ru=/%7C/g,Di=/%7D/g,Iu=/%20/g;function Co(e){return e==null?"":encodeURI(""+e).replace(Ru,"|").replace(Su,"[").replace(ku,"]")}function $u(e){return Co(e).replace(Ni,"{").replace(Di,"}").replace(Ti,"^")}function Zs(e){return Co(e).replace(Oi,"%2B").replace(Iu,"+").replace(Pi,"%23").replace(yu,"%26").replace(Au,"`").replace(Ni,"{").replace(Di,"}").replace(Ti,"^")}function Pu(e){return Zs(e).replace(Cu,"%3D")}function Ou(e){return Co(e).replace(Pi,"%23").replace(Eu,"%3F")}function Tu(e){return Ou(e).replace(wu,"%2F")}function Ln(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Nu=/\/$/,Du=e=>e.replace(Nu,"");function Ls(e,t,n="/"){let s,o={},r="",i="";const a=t.indexOf("#");let u=t.indexOf("?");return u=a>=0&&u>a?-1:u,u>=0&&(s=t.slice(0,u),r=t.slice(u,a>0?a:t.length),o=e(r.slice(1))),a>=0&&(s=s||t.slice(0,a),i=t.slice(a,t.length)),s=Uu(s??t,n),{fullPath:s+r+i,path:s,query:o,hash:Ln(i)}}function Mu(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function rr(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Vu(e,t,n){const s=t.matched.length-1,o=n.matched.length-1;return s>-1&&s===o&&vn(t.matched[s],n.matched[o])&&Mi(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function vn(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Mi(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!ju(e[n],t[n]))return!1;return!0}function ju(e,t){return ht(e)?ir(e,t):ht(t)?ir(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function ir(e,t){return ht(t)?e.length===t.length&&e.every((n,s)=>n===t[s]):e.length===1&&e[0]===t}function Uu(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),s=e.split("/"),o=s[s.length-1];(o===".."||o===".")&&s.push("");let r=n.length-1,i,a;for(i=0;i 1&&r--;else break;return n.slice(0,r).join("/")+"/"+s.slice(i).join("/")}const Ft={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let eo=(function(e){return e.pop="pop",e.push="push",e})({}),Fs=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Lu(e){if(!e)if(ln){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Du(e)}const Fu=/^[^#]+#/;function Hu(e,t){return e.replace(Fu,"#")+t}function Bu(e,t){const n=document.documentElement.getBoundingClientRect(),s=e.getBoundingClientRect();return{behavior:t.behavior,left:s.left-n.left-(t.left||0),top:s.top-n.top-(t.top||0)}}const ks=()=>({left:window.scrollX,top:window.scrollY});function qu(e){let t;if("el"in e){const n=e.el,s=typeof n=="string"&&n.startsWith("#"),o=typeof n=="string"?s?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!o)return;t=Bu(o,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function lr(e,t){return(history.state?history.state.position-t:-1)+e}const to=new Map;function Gu(e,t){to.set(e,t)}function Ku(e){const t=to.get(e);return to.delete(e),t}function Wu(e){return typeof e=="string"||e&&typeof e=="object"}function Vi(e){return typeof e=="string"||typeof e=="symbol"}let $e=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const ji=Symbol("");$e.MATCHER_NOT_FOUND+"",$e.NAVIGATION_GUARD_REDIRECT+"",$e.NAVIGATION_ABORTED+"",$e.NAVIGATION_CANCELLED+"",$e.NAVIGATION_DUPLICATED+"";function bn(e,t){return pe(new Error,{type:e,[ji]:!0},t)}function At(e,t){return e instanceof Error&&ji in e&&(t==null||!!(e.type&t))}const zu=["params","query","hash"];function Ju(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of zu)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Qu(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let s=0;s o&&Zs(o)):[s&&Zs(s)]).forEach(o=>{o!==void 0&&(t+=(t.length?"&":"")+n,o!=null&&(t+="="+o))})}return t}function Yu(e){const t={};for(const n in e){const s=e[n];s!==void 0&&(t[n]=ht(s)?s.map(o=>o==null?null:""+o):s==null?s:""+s)}return t}const Xu=Symbol(""),ur=Symbol(""),As=Symbol(""),Eo=Symbol(""),no=Symbol("");function wn(){let e=[];function t(s){return e.push(s),()=>{const o=e.indexOf(s);o>-1&&e.splice(o,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Bt(e,t,n,s,o,r=i=>i()){const i=s&&(s.enterCallbacks[o]=s.enterCallbacks[o]||[]);return()=>new Promise((a,u)=>{const f=v=>{v===!1?u(bn($e.NAVIGATION_ABORTED,{from:n,to:t})):v instanceof Error?u(v):Wu(v)?u(bn($e.NAVIGATION_GUARD_REDIRECT,{from:t,to:v})):(i&&s.enterCallbacks[o]===i&&typeof v=="function"&&i.push(v),a())},c=r(()=>e.call(s&&s.instances[o],t,n,f));let m=Promise.resolve(c);e.length<3&&(m=m.then(f)),m.catch(v=>u(v))})}function Hs(e,t,n,s,o=r=>r()){const r=[];for(const i of e)for(const a in i.components){let u=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if($i(u)){const f=(u.__vccOpts||u)[t];f&&r.push(Bt(f,n,s,i,a,o))}else{let f=u();r.push(()=>f.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const m=_u(c)?c.default:c;i.mods[a]=c,i.components[a]=m;const v=(m.__vccOpts||m)[t];return v&&Bt(v,n,s,i,a,o)()}))}}return r}function Zu(e,t){const n=[],s=[],o=[],r=Math.max(t.matched.length,e.matched.length);for(let i=0;i vn(f,a))?s.push(a):n.push(a));const u=e.matched[i];u&&(t.matched.find(f=>vn(f,u))||o.push(u))}return[n,s,o]}/*! + * vue-router v4.6.4 + * (c) 2025 Eduardo San Martin Morote + * @license MIT + */let ec=()=>location.protocol+"//"+location.host;function Ui(e,t){const{pathname:n,search:s,hash:o}=t,r=e.indexOf("#");if(r>-1){let i=o.includes(e.slice(r))?e.slice(r).length:1,a=o.slice(i);return a[0]!=="/"&&(a="/"+a),rr(a,"")}return rr(n,e)+s+o}function tc(e,t,n,s){let o=[],r=[],i=null;const a=({state:v})=>{const x=Ui(e,location),M=n.value,P=t.value;let K=0;if(v){if(n.value=x,t.value=v,i&&i===M){i=null;return}K=P?v.position-P.position:0}else s(x);o.forEach(H=>{H(n.value,M,{delta:K,type:eo.pop,direction:K?K>0?Fs.forward:Fs.back:Fs.unknown})})};function u(){i=n.value}function f(v){o.push(v);const x=()=>{const M=o.indexOf(v);M>-1&&o.splice(M,1)};return r.push(x),x}function c(){if(document.visibilityState==="hidden"){const{history:v}=window;if(!v.state)return;v.replaceState(pe({},v.state,{scroll:ks()}),"")}}function m(){for(const v of r)v();r=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:u,listen:f,destroy:m}}function cr(e,t,n,s=!1,o=!1){return{back:e,current:t,forward:n,replaced:s,position:window.history.length,scroll:o?ks():null}}function nc(e){const{history:t,location:n}=window,s={value:Ui(e,n)},o={value:t.state};o.value||r(s.value,{back:null,current:s.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function r(u,f,c){const m=e.indexOf("#"),v=m>-1?(n.host&&document.querySelector("base")?e:e.slice(m))+u:ec()+e+u;try{t[c?"replaceState":"pushState"](f,"",v),o.value=f}catch(x){console.error(x),n[c?"replace":"assign"](v)}}function i(u,f){r(u,pe({},t.state,cr(o.value.back,u,o.value.forward,!0),f,{position:o.value.position}),!0),s.value=u}function a(u,f){const c=pe({},o.value,t.state,{forward:u,scroll:ks()});r(c.current,c,!0),r(u,pe({},cr(s.value,u,null),{position:c.position+1},f),!1),s.value=u}return{location:s,state:o,push:a,replace:i}}function sc(e){e=Lu(e);const t=nc(e),n=tc(e,t.state,t.location,t.replace);function s(r,i=!0){i||n.pauseListeners(),history.go(r)}const o=pe({location:"",base:e,go:s,createHref:Hu.bind(null,e)},t,n);return Object.defineProperty(o,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(o,"state",{enumerable:!0,get:()=>t.state.value}),o}let Zt=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Me=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(Me||{});const oc={type:Zt.Static,value:""},rc=/[a-zA-Z0-9_]/;function ic(e){if(!e)return[[]];if(e==="/")return[[oc]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(x){throw new Error(`ERR (${n})/"${f}": ${x}`)}let n=Me.Static,s=n;const o=[];let r;function i(){r&&o.push(r),r=[]}let a=0,u,f="",c="";function m(){f&&(n===Me.Static?r.push({type:Zt.Static,value:f}):n===Me.Param||n===Me.ParamRegExp||n===Me.ParamRegExpEnd?(r.length>1&&(u==="*"||u==="+")&&t(`A repeatable param (${f}) must be alone in its segment. eg: '/:ids+.`),r.push({type:Zt.Param,value:f,regexp:c,repeatable:u==="*"||u==="+",optional:u==="*"||u==="?"})):t("Invalid state to consume buffer"),f="")}function v(){f+=u}for(;a t.length?t.length===1&&t[0]===Je.Static+Je.Segment?1:-1:0}function Li(e,t){let n=0;const s=e.score,o=t.score;for(;n 0&&t[t.length-1]<0}const dc={strict:!1,end:!0,sensitive:!1};function fc(e,t,n){const s=uc(ic(e.path),n),o=pe(s,{record:e,parent:t,children:[],alias:[]});return t&&!o.record.aliasOf==!t.record.aliasOf&&t.children.push(o),o}function pc(e,t){const n=[],s=new Map;t=or(dc,t);function o(m){return s.get(m)}function r(m,v,x){const M=!x,P=mr(m);P.aliasOf=x&&x.record;const K=or(t,m),H=[P];if("alias"in m){const I=typeof m.alias=="string"?[m.alias]:m.alias;for(const E of I)H.push(mr(pe({},P,{components:x?x.record.components:P.components,path:E,aliasOf:x?x.record:P})))}let D,B;for(const I of H){const{path:E}=I;if(v&&E[0]!=="/"){const O=v.record.path,te=O[O.length-1]==="/"?"":"/";I.path=v.record.path+(E&&te+E)}if(D=fc(I,v,K),x?x.alias.push(D):(B=B||D,B!==D&&B.alias.push(D),M&&m.name&&!hr(D)&&i(m.name)),Fi(D)&&u(D),P.children){const O=P.children;for(let te=0;te {i(B)}:Pn}function i(m){if(Vi(m)){const v=s.get(m);v&&(s.delete(m),n.splice(n.indexOf(v),1),v.children.forEach(i),v.alias.forEach(i))}else{const v=n.indexOf(m);v>-1&&(n.splice(v,1),m.record.name&&s.delete(m.record.name),m.children.forEach(i),m.alias.forEach(i))}}function a(){return n}function u(m){const v=gc(m,n);n.splice(v,0,m),m.record.name&&!hr(m)&&s.set(m.record.name,m)}function f(m,v){let x,M={},P,K;if("name"in m&&m.name){if(x=s.get(m.name),!x)throw bn($e.MATCHER_NOT_FOUND,{location:m});K=x.record.name,M=pe(pr(v.params,x.keys.filter(B=>!B.optional).concat(x.parent?x.parent.keys.filter(B=>B.optional):[]).map(B=>B.name)),m.params&&pr(m.params,x.keys.map(B=>B.name))),P=x.stringify(M)}else if(m.path!=null)P=m.path,x=n.find(B=>B.re.test(P)),x&&(M=x.parse(P),K=x.record.name);else{if(x=v.name?s.get(v.name):n.find(B=>B.re.test(v.path)),!x)throw bn($e.MATCHER_NOT_FOUND,{location:m,currentLocation:v});K=x.record.name,M=pe({},v.params,m.params),P=x.stringify(M)}const H=[];let D=x;for(;D;)H.unshift(D.record),D=D.parent;return{name:K,path:P,params:M,matched:H,meta:hc(H)}}e.forEach(m=>r(m));function c(){n.length=0,s.clear()}return{addRoute:r,resolve:f,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:o}}function pr(e,t){const n={};for(const s of t)s in e&&(n[s]=e[s]);return n}function mr(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:mc(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function mc(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const s in e.components)t[s]=typeof n=="object"?n[s]:n;return t}function hr(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function hc(e){return e.reduce((t,n)=>pe(t,n.meta),{})}function gc(e,t){let n=0,s=t.length;for(;n!==s;){const r=n+s>>1;Li(e,t[r])<0?s=r:n=r+1}const o=vc(e);return o&&(s=t.lastIndexOf(o,s-1)),s}function vc(e){let t=e;for(;t=t.parent;)if(Fi(t)&&Li(e,t)===0)return t}function Fi({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function gr(e){const t=dt(As),n=dt(Eo),s=ye(()=>{const u=Ve(e.to);return t.resolve(u)}),o=ye(()=>{const{matched:u}=s.value,{length:f}=u,c=u[f-1],m=n.matched;if(!c||!m.length)return-1;const v=m.findIndex(vn.bind(null,c));if(v>-1)return v;const x=vr(u[f-2]);return f>1&&vr(c)===x&&m[m.length-1].path!==x?m.findIndex(vn.bind(null,u[f-2])):v}),r=ye(()=>o.value>-1&&wc(n.params,s.value.params)),i=ye(()=>o.value>-1&&o.value===n.matched.length-1&&Mi(n.params,s.value.params));function a(u={}){if(yc(u)){const f=t[Ve(e.replace)?"replace":"push"](Ve(e.to)).catch(Pn);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:s,href:ye(()=>s.value.href),isActive:r,isExactActive:i,navigate:a}}function bc(e){return e.length===1?e[0]:e}const xc=ei({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:gr,setup(e,{slots:t}){const n=xs(gr(e)),{options:s}=dt(As),o=ye(()=>({[br(e.activeClass,s.linkActiveClass,"router-link-active")]:n.isActive,[br(e.exactActiveClass,s.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const r=t.default&&bc(t.default(n));return e.custom?r:Ai("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:o.value},r)}}}),_c=xc;function yc(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function wc(e,t){for(const n in t){const s=t[n],o=e[n];if(typeof s=="string"){if(s!==o)return!1}else if(!ht(o)||o.length!==s.length||s.some((r,i)=>r.valueOf()!==o[i].valueOf()))return!1}return!0}function vr(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const br=(e,t,n)=>e??t??n,Cc=ei({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const s=dt(no),o=ye(()=>e.route||s.value),r=dt(ur,0),i=ye(()=>{let f=Ve(r);const{matched:c}=o.value;let m;for(;(m=c[f])&&!m.components;)f++;return f}),a=ye(()=>o.value.matched[i.value]);ts(ur,ye(()=>i.value+1)),ts(Xu,a),ts(no,o);const u=W();return Kt(()=>[u.value,a.value,e.name],([f,c,m],[v,x,M])=>{c&&(c.instances[m]=f,x&&x!==c&&f&&f===v&&(c.leaveGuards.size||(c.leaveGuards=x.leaveGuards),c.updateGuards.size||(c.updateGuards=x.updateGuards))),f&&c&&(!x||!vn(c,x)||!v)&&(c.enterCallbacks[m]||[]).forEach(P=>P(f))},{flush:"post"}),()=>{const f=o.value,c=e.name,m=a.value,v=m&&m.components[c];if(!v)return xr(n.default,{Component:v,route:f});const x=m.props[c],M=x?x===!0?f.params:typeof x=="function"?x(f):x:null,K=Ai(v,pe({},M,t,{onVnodeUnmounted:H=>{H.component.isUnmounted&&(m.instances[c]=null)},ref:u}));return xr(n.default,{Component:K,route:f})||K}}});function xr(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ec=Cc;function Sc(e){const t=pc(e.routes,e),n=e.parseQuery||Qu,s=e.stringifyQuery||ar,o=e.history,r=wn(),i=wn(),a=wn(),u=Al(Ft);let f=Ft;ln&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Us.bind(null,S=>""+S),m=Us.bind(null,Tu),v=Us.bind(null,Ln);function x(S,q){let U,J;return Vi(S)?(U=t.getRecordMatcher(S),J=q):J=S,t.addRoute(J,U)}function M(S){const q=t.getRecordMatcher(S);q&&t.removeRoute(q)}function P(){return t.getRoutes().map(S=>S.record)}function K(S){return!!t.getRecordMatcher(S)}function H(S,q){if(q=pe({},q||u.value),typeof S=="string"){const g=Ls(n,S,q.path),_=t.resolve({path:g.path},q),k=o.createHref(g.fullPath);return pe(g,_,{params:v(_.params),hash:Ln(g.hash),redirectedFrom:void 0,href:k})}let U;if(S.path!=null)U=pe({},S,{path:Ls(n,S.path,q.path).path});else{const g=pe({},S.params);for(const _ in g)g[_]==null&&delete g[_];U=pe({},S,{params:m(g)}),q.params=m(q.params)}const J=t.resolve(U,q),ae=S.hash||"";J.params=c(v(J.params));const d=Mu(s,pe({},S,{hash:$u(ae),path:J.path})),p=o.createHref(d);return pe({fullPath:d,hash:ae,query:s===ar?Yu(S.query):S.query||{}},J,{redirectedFrom:void 0,href:p})}function D(S){return typeof S=="string"?Ls(n,S,u.value.path):pe({},S)}function B(S,q){if(f!==S)return bn($e.NAVIGATION_CANCELLED,{from:q,to:S})}function I(S){return te(S)}function E(S){return I(pe(D(S),{replace:!0}))}function O(S,q){const U=S.matched[S.matched.length-1];if(U&&U.redirect){const{redirect:J}=U;let ae=typeof J=="function"?J(S,q):J;return typeof ae=="string"&&(ae=ae.includes("?")||ae.includes("#")?ae=D(ae):{path:ae},ae.params={}),pe({query:S.query,hash:S.hash,params:ae.path!=null?{}:S.params},ae)}}function te(S,q){const U=f=H(S),J=u.value,ae=S.state,d=S.force,p=S.replace===!0,g=O(U,J);if(g)return te(pe(D(g),{state:typeof g=="object"?pe({},ae,g.state):ae,force:d,replace:p}),q||U);const _=U;_.redirectedFrom=q;let k;return!d&&Vu(s,J,U)&&(k=bn($e.NAVIGATION_DUPLICATED,{to:_,from:J}),Ke(J,J,!0,!1)),(k?Promise.resolve(k):Z(_,J)).catch(w=>At(w)?At(w,$e.NAVIGATION_GUARD_REDIRECT)?w:gt(w):ue(w,_,J)).then(w=>{if(w){if(At(w,$e.NAVIGATION_GUARD_REDIRECT))return te(pe({replace:p},D(w.to),{state:typeof w.to=="object"?pe({},ae,w.to.state):ae,force:d}),q||_)}else w=Ne(_,J,!0,p,ae);return j(_,J,w),w})}function L(S,q){const U=B(S,q);return U?Promise.reject(U):Promise.resolve()}function Ae(S){const q=le.values().next().value;return q&&typeof q.runWithContext=="function"?q.runWithContext(S):S()}function Z(S,q){let U;const[J,ae,d]=Zu(S,q);U=Hs(J.reverse(),"beforeRouteLeave",S,q);for(const g of J)g.leaveGuards.forEach(_=>{U.push(Bt(_,S,q))});const p=L.bind(null,S,q);return U.push(p),He(U).then(()=>{U=[];for(const g of r.list())U.push(Bt(g,S,q));return U.push(p),He(U)}).then(()=>{U=Hs(ae,"beforeRouteUpdate",S,q);for(const g of ae)g.updateGuards.forEach(_=>{U.push(Bt(_,S,q))});return U.push(p),He(U)}).then(()=>{U=[];for(const g of d)if(g.beforeEnter)if(ht(g.beforeEnter))for(const _ of g.beforeEnter)U.push(Bt(_,S,q));else U.push(Bt(g.beforeEnter,S,q));return U.push(p),He(U)}).then(()=>(S.matched.forEach(g=>g.enterCallbacks={}),U=Hs(d,"beforeRouteEnter",S,q,Ae),U.push(p),He(U))).then(()=>{U=[];for(const g of i.list())U.push(Bt(g,S,q));return U.push(p),He(U)}).catch(g=>At(g,$e.NAVIGATION_CANCELLED)?g:Promise.reject(g))}function j(S,q,U){a.list().forEach(J=>Ae(()=>J(S,q,U)))}function Ne(S,q,U,J,ae){const d=B(S,q);if(d)return d;const p=q===Ft,g=ln?history.state:{};U&&(J||p?o.replace(S.fullPath,pe({scroll:p&&g&&g.scroll},ae)):o.push(S.fullPath,ae)),u.value=S,Ke(S,q,U,p),gt()}let G;function Ze(){G||(G=o.listen((S,q,U)=>{if(!vt.listening)return;const J=H(S),ae=O(J,vt.currentRoute.value);if(ae){te(pe(ae,{replace:!0,force:!0}),J).catch(Pn);return}f=J;const d=u.value;ln&&Gu(lr(d.fullPath,U.delta),ks()),Z(J,d).catch(p=>At(p,$e.NAVIGATION_ABORTED|$e.NAVIGATION_CANCELLED)?p:At(p,$e.NAVIGATION_GUARD_REDIRECT)?(te(pe(D(p.to),{force:!0}),J).then(g=>{At(g,$e.NAVIGATION_ABORTED|$e.NAVIGATION_DUPLICATED)&&!U.delta&&U.type===eo.pop&&o.go(-1,!1)}).catch(Pn),Promise.reject()):(U.delta&&o.go(-U.delta,!1),ue(p,J,d))).then(p=>{p=p||Ne(J,d,!1),p&&(U.delta&&!At(p,$e.NAVIGATION_CANCELLED)?o.go(-U.delta,!1):U.type===eo.pop&&At(p,$e.NAVIGATION_ABORTED|$e.NAVIGATION_DUPLICATED)&&o.go(-1,!1)),j(J,d,p)}).catch(Pn)}))}let Ut=wn(),Ee=wn(),de;function ue(S,q,U){gt(S);const J=Ee.list();return J.length?J.forEach(ae=>ae(S,q,U)):console.error(S),Promise.reject(S)}function ut(){return de&&u.value!==Ft?Promise.resolve():new Promise((S,q)=>{Ut.add([S,q])})}function gt(S){return de||(de=!S,Ze(),Ut.list().forEach(([q,U])=>S?U(S):q()),Ut.reset()),S}function Ke(S,q,U,J){const{scrollBehavior:ae}=e;if(!ln||!ae)return Promise.resolve();const d=!U&&Ku(lr(S.fullPath,0))||(J||!U)&&history.state&&history.state.scroll||null;return ho().then(()=>ae(S,q,d)).then(p=>p&&qu(p)).catch(p=>ue(p,S,q))}const Oe=S=>o.go(S);let tt;const le=new Set,vt={currentRoute:u,listening:!0,addRoute:x,removeRoute:M,clearRoutes:t.clearRoutes,hasRoute:K,getRoutes:P,resolve:H,options:e,push:I,replace:E,go:Oe,back:()=>Oe(-1),forward:()=>Oe(1),beforeEach:r.add,beforeResolve:i.add,afterEach:a.add,onError:Ee.add,isReady:ut,install(S){S.component("RouterLink",_c),S.component("RouterView",Ec),S.config.globalProperties.$router=vt,Object.defineProperty(S.config.globalProperties,"$route",{enumerable:!0,get:()=>Ve(u)}),ln&&!tt&&u.value===Ft&&(tt=!0,I(o.location).catch(J=>{}));const q={};for(const J in Ft)Object.defineProperty(q,J,{get:()=>u.value[J],enumerable:!0});S.provide(As,vt),S.provide(Eo,Br(q)),S.provide(no,u);const U=S.unmount;le.add(S),S.unmount=function(){le.delete(S),le.size<1&&(f=Ft,G&&G(),G=null,u.value=Ft,tt=!1,de=!1),U()}}};function He(S){return S.reduce((q,U)=>q.then(()=>Ae(U)),Promise.resolve())}return vt}function So(){return dt(As)}function Hi(e){return dt(Eo)}const Xn=window.location.pathname.startsWith("/portal/"),Ye={esPortal:Xn,baseRuta:Xn?"/portal/studio/":"/studio/",apiBase:Xn?"/portal":"/app",urlLogin:Xn?"/portal/login":"/login"};function oe(e){return Ye.apiBase+e}async function Zn(e,t={}){const n=await fetch(e,{...t,headers:{"Content-Type":"application/json",...t.headers}}),s=n.headers.get("content-type")||"";if(n.redirected||!s.includes("application/json"))throw window.location.href=Ye.urlLogin,new Error("Sesión expirada");const o=await n.json();if(!n.ok){const r=typeof(o==null?void 0:o.error)=="string"?o.error:o==null?void 0:o.message;throw new Error(r||"Error de servidor")}return o}const re={get:e=>Zn(e),post:(e,t)=>Zn(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Zn(e,{method:"PUT",body:JSON.stringify(t)}),del:e=>Zn(e,{method:"DELETE"})},Sn=W(!1),kc={class:"h-14 px-4 flex items-center gap-2 border-b border-borde"},Ac={key:0,class:"px-3 pt-3"},Rc={key:1,class:"px-3 pt-2 text-xs text-red-600 dark:text-red-400"},Ic={class:"flex-1 overflow-y-auto px-2 py-3 space-y-0.5"},$c={key:0,class:"px-2 text-xs text-tenue"},Pc={key:1,class:"px-2 text-xs text-tenue"},Oc={class:"truncate"},Tc={class:"flex items-center gap-1 mt-0.5"},Nc={class:"text-[11px] text-tenue"},Dc={key:0,class:"flex opacity-0 group-hover:opacity-100 transition-opacity pr-1.5 gap-0.5"},Mc=["onClick"],Vc=["onClick"],jc={class:"card w-full max-w-lg p-6 animate-escalar shadow-2xl"},Uc={class:"font-semibold text-texto mb-4"},Lc={key:0,class:"grid grid-cols-2 gap-3"},Fc=["value"],Hc={class:"text-[11px] text-tenue mt-1"},Bc=["value"],qc={class:"text-[11px] text-tenue mt-1"},Gc={class:"flex items-center gap-2 text-sm text-texto"},Kc={class:"flex justify-end gap-2 pt-2"},Wc={__name:"Sidebar",setup(e,{expose:t}){const n=Hi(),s=So(),o=W([]),r=W([]),i=W([]),a=W(!0),u=W(""),f=W(!1),c=W(null),m=W(x()),v=ye(()=>n.params.tenantId||n.params.id);Kt(()=>n.fullPath,()=>{Sn.value=!1});function x(){return{nombre:"",dominios_permitidos:"",activo:!0,cliente_id:null,plan_id:null}}async function M(){a.value=!0,u.value="";try{const E=await re.get(oe("/umind/tenants"));o.value=E.items||[]}catch(E){u.value=E.message}finally{a.value=!1}}function P(E){return Array.isArray(E)?E:(E==null?void 0:E.items)||(E==null?void 0:E.registros)||[]}async function K(){if(Ye.esPortal)return;const[E,O]=await Promise.allSettled([re.get("/app/api/clientes/select"),re.get("/app/umind-planes/list")]);r.value=E.status==="fulfilled"?P(E.value):[],i.value=O.status==="fulfilled"?P(O.value):[];const te=[];E.status==="rejected"&&te.push("clientes"),O.status==="rejected"&&te.push("planes"),te.length&&(u.value=`No se pudo cargar la lista de ${te.join(" ni ")}.`)}function H(){c.value=null,m.value=x(),f.value=!0}function D(E){c.value=E,m.value={nombre:E.nombre,dominios_permitidos:E.dominios_permitidos,activo:E.activo,cliente_id:E.cliente_id??null,plan_id:E.plan_id??null},f.value=!0}async function B(){const E={...m.value,dominios_permitidos:m.value.dominios_permitidos.split(",").map(O=>O.trim()).filter(Boolean)};try{if(c.value)await re.put(oe(`/umind/tenants/${c.value.ID}`),E),f.value=!1,await M();else{const O=await re.post(oe("/umind/tenants"),E);f.value=!1,await M(),s.push(`/tenants/${O.id}`)}}catch(O){u.value=O.message}}async function I(E){confirm(`¿Eliminar el espacio "${E.nombre}"? Esto borra también sus agentes. No se puede deshacer.`)&&(await re.del(oe(`/umind/tenants/${E.ID}`)),v.value===String(E.ID)&&s.push("/"),await M())}return t({recargar:M}),xo(()=>{M(),K()}),(E,O)=>{const te=Bn("router-link");return y(),C(ie,null,[Ve(Sn)?(y(),C("div",{key:0,class:"fixed inset-0 bg-black/50 z-30 md:hidden",onClick:O[0]||(O[0]=L=>Sn.value=!1)})):Y("",!0),l("aside",{class:Se(["w-64 shrink-0 flex flex-col border-r border-borde bg-superficie fixed inset-y-0 left-0 z-40 transition-transform duration-200 md:static md:h-screen md:sticky md:top-0 md:translate-x-0",Ve(Sn)?"translate-x-0":"-translate-x-full"])},[l("div",kc,[ke(te,{to:"/",class:"flex items-center gap-2 text-base font-semibold text-texto"},{default:Gt(()=>[...O[8]||(O[8]=[l("svg",{viewBox:"0 0 96 96",class:"w-6 h-6 shrink-0","aria-hidden":"true"},[l("rect",{width:"96",height:"96",rx:"22",fill:"#8eb02f"}),l("path",{d:"M32,42 V58 A14,14 0 0 0 60,58 V42",fill:"none",stroke:"#fff","stroke-width":"10","stroke-linecap":"round","stroke-linejoin":"round"}),l("path",{d:"M60,58 V64",fill:"none",stroke:"#fff","stroke-width":"10","stroke-linecap":"round"}),l("circle",{cx:"60",cy:"28",r:"7",fill:"#fff"})],-1),l("span",null,[we("uMind "),l("span",{class:"text-brand"},"Studio")],-1)])]),_:1})]),Ve(Ye).esPortal?Y("",!0):(y(),C("div",Ac,[l("button",{class:"btn-primary w-full",onClick:H}," + Nuevo espacio ")])),u.value?(y(),C("p",Rc,$(u.value),1)):Y("",!0),l("nav",Ic,[a.value?(y(),C("p",$c,"Cargando...")):o.value.length===0?(y(),C("p",Pc,$(Ve(Ye).esPortal?"Todavía no tenés ningún espacio asignado. Escribinos y lo activamos.":"Sin espacios todavía."),1)):Y("",!0),(y(!0),C(ie,null,Te(o.value,L=>(y(),C("div",{key:L.ID,class:Se(["group flex items-center rounded-lg transition-colors",v.value===String(L.ID)?"bg-brand/10":"hover:bg-elevado"])},[ke(te,{to:`/tenants/${L.ID}`,class:Se(["flex-1 min-w-0 px-2.5 py-2 text-sm",v.value===String(L.ID)?"text-brand font-medium":"text-texto"])},{default:Gt(()=>[l("div",Oc,$(L.nombre),1),l("div",Tc,[l("span",{class:Se(["w-1.5 h-1.5 rounded-full",L.activo?"bg-green-500":"bg-tenue/40"])},null,2),l("span",Nc,$(L.activo?"activo":"inactivo"),1)])]),_:2},1032,["to","class"]),Ve(Ye).esPortal?Y("",!0):(y(),C("div",Dc,[l("button",{class:"p-1 text-tenue hover:text-texto",title:"Editar",onClick:Ae=>D(L)}," ✎ ",8,Mc),l("button",{class:"p-1 text-tenue hover:text-red-600",title:"Eliminar",onClick:Ae=>I(L)}," ✕ ",8,Vc)]))],2))),128))])],2),f.value?(y(),C("div",{key:1,class:"fixed inset-0 bg-black/40 flex items-center justify-center p-4 z-50",onClick:O[7]||(O[7]=Ue(L=>f.value=!1,["self"]))},[l("div",jc,[l("h2",Uc,$(c.value?"Editar espacio":"Nuevo espacio"),1),O[17]||(O[17]=l("p",{class:"text-xs text-tenue mb-3"}," Un espacio es el negocio o sitio dueño de los dominios permitidos. La config de IA, tono y demás se configuran por agente, dentro del tenant. ",-1)),l("form",{class:"space-y-3",onSubmit:Ue(B,["prevent"])},[l("div",null,[O[9]||(O[9]=l("label",{class:"label"},"Nombre",-1)),se(l("input",{"onUpdate:modelValue":O[1]||(O[1]=L=>m.value.nombre=L),required:"",class:"input"},null,512),[[be,m.value.nombre]])]),l("div",null,[O[10]||(O[10]=l("label",{class:"label"},"Dominios permitidos (separados por coma)",-1)),se(l("input",{"onUpdate:modelValue":O[2]||(O[2]=L=>m.value.dominios_permitidos=L),placeholder:"ejemplo.com, www.ejemplo.com",required:"",class:"input"},null,512),[[be,m.value.dominios_permitidos]])]),Ve(Ye).esPortal?Y("",!0):(y(),C("div",Lc,[l("div",null,[O[12]||(O[12]=l("label",{class:"label"},"Cliente",-1)),se(l("select",{"onUpdate:modelValue":O[3]||(O[3]=L=>m.value.cliente_id=L),class:"input"},[O[11]||(O[11]=l("option",{value:null},"— sin asignar —",-1)),(y(!0),C(ie,null,Te(r.value,L=>(y(),C("option",{key:L.ID,value:L.ID},$(L.nombre),9,Fc))),128))],512),[[Un,m.value.cliente_id]]),l("p",Hc,$(r.value.length?"Define quién ve este espacio desde el portal.":"No hay clientes activos — creá uno en Clientes."),1)]),l("div",null,[O[14]||(O[14]=l("label",{class:"label"},"Plan",-1)),se(l("select",{"onUpdate:modelValue":O[4]||(O[4]=L=>m.value.plan_id=L),class:"input"},[O[13]||(O[13]=l("option",{value:null},"— sin plan —",-1)),(y(!0),C(ie,null,Te(i.value,L=>(y(),C("option",{key:L.ID,value:L.ID},$(L.nombre)+" ("+$(L.max_agentes===0?"∞":L.max_agentes)+" agentes) ",9,Bc))),128))],512),[[Un,m.value.plan_id]]),l("p",qc,$(i.value.length?"Límite de agentes y precios de consumo.":"No hay planes — creá uno en uMind Planes."),1)])])),l("label",Gc,[se(l("input",{"onUpdate:modelValue":O[5]||(O[5]=L=>m.value.activo=L),type:"checkbox"},null,512),[[It,m.value.activo]]),O[15]||(O[15]=we(" Activo ",-1))]),l("div",Kc,[l("button",{type:"button",class:"btn-ghost",onClick:O[6]||(O[6]=L=>f.value=!1)}," Cancelar "),O[16]||(O[16]=l("button",{type:"submit",class:"btn-primary"}," Guardar ",-1))])],32)])])):Y("",!0)],64)}}},Bi="umind-tema";function zc(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"oscuro":"claro"}const pn=W(localStorage.getItem(Bi)||zc());function qi(){document.documentElement.classList.toggle("dark",pn.value==="oscuro")}function _r(){pn.value=pn.value==="oscuro"?"claro":"oscuro",localStorage.setItem(Bi,pn.value),qi()}qi();const Jc={class:"min-h-screen flex"},Qc={class:"flex-1 min-w-0 flex flex-col"},Yc={class:"h-14 shrink-0 flex items-center gap-1 px-4 sm:px-6 border-b border-borde"},Xc=["title"],Zc={class:"text-base leading-none"},ed={class:"flex-1 max-w-5xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-6 sm:py-8 animate-aparecer"},td={__name:"App",setup(e){return(t,n)=>{const s=Bn("router-view");return y(),C("div",Jc,[ke(Wc),l("main",Qc,[l("header",Yc,[l("button",{class:"btn-ghost !px-2 !py-1.5 md:hidden","aria-label":"Abrir menú",onClick:n[0]||(n[0]=o=>Sn.value=!0)},[...n[2]||(n[2]=[l("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor","stroke-width":"2",viewBox:"0 0 24 24"},[l("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 6h16M4 12h16M4 18h16"})],-1)])]),n[3]||(n[3]=l("span",{class:"flex-1"},null,-1)),l("button",{class:"btn-ghost !px-2.5 !py-1.5",title:Ve(pn)==="oscuro"?"Cambiar a claro":"Cambiar a oscuro",onClick:n[1]||(n[1]=(...o)=>Ve(_r)&&Ve(_r)(...o))},[l("span",Zc,$(Ve(pn)==="oscuro"?"☀️":"🌙"),1)],8,Xc)]),l("div",ed,[ke(s)])])])}}},nd=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},sd=["width","height","aria-label"],od=["fill"],rd=["stroke"],id=["cy"],ld=["cy"],ad=["cy"],ud=["cy"],cd={key:1,d:"M41,66 h12 M67,66 h12",class:"umi-linea","stroke-width":"5","stroke-linecap":"round",fill:"none"},dd={key:4,d:"M50,78 q10,8 20,0",class:"umi-linea","stroke-width":"4",fill:"none","stroke-linecap":"round"},fd={__name:"UiMascota",props:{estado:{type:String,default:"normal"},tam:{type:[Number,String],default:72}},setup(e){return(t,n)=>(y(),C("svg",{width:e.tam,height:e.tam,viewBox:"0 0 120 120",class:"shrink-0",role:"img","aria-label":`Umi, la mascota de uMind (${e.estado})`},[l("circle",{cx:"60",cy:"26",r:"6",fill:e.estado==="alerta"?"#dc2626":"currentColor",class:Se(e.estado==="pensando"?"umi-late":"")},null,10,od),l("line",{x1:"60",y1:"32",x2:"60",y2:"44",stroke:e.estado==="alerta"?"#dc2626":"currentColor","stroke-width":"4","stroke-linecap":"round"},null,8,rd),n[7]||(n[7]=l("path",{d:"M30,46 V76 A30,30 0 0 0 90,76 V46 Z",fill:"currentColor"},null,-1)),e.estado==="normal"||e.estado==="contenta"||e.estado==="alerta"?(y(),C(ie,{key:0},[l("circle",{cx:"47",cy:e.estado==="contenta"?64:66,r:"6",class:"umi-ojo"},null,8,id),l("circle",{cx:"73",cy:e.estado==="contenta"?64:66,r:"6",class:"umi-ojo"},null,8,ld),l("circle",{cx:"48",cy:e.estado==="contenta"?65:67,r:"3",class:"umi-pupila"},null,8,ad),l("circle",{cx:"74",cy:e.estado==="contenta"?65:67,r:"3",class:"umi-pupila"},null,8,ud)],64)):e.estado==="durmiendo"?(y(),C("path",cd)):e.estado==="pensando"?(y(),C(ie,{key:2},[n[0]||(n[0]=l("circle",{cx:"45",cy:"66",r:"4.5",class:"umi-ojo umi-p1"},null,-1)),n[1]||(n[1]=l("circle",{cx:"60",cy:"66",r:"4.5",class:"umi-ojo umi-p2"},null,-1)),n[2]||(n[2]=l("circle",{cx:"75",cy:"66",r:"4.5",class:"umi-ojo umi-p3"},null,-1))],64)):e.estado==="buscando"?(y(),C(ie,{key:3},[n[3]||(n[3]=l("circle",{cx:"47",cy:"66",r:"6",class:"umi-ojo"},null,-1)),n[4]||(n[4]=l("circle",{cx:"73",cy:"66",r:"6",class:"umi-ojo"},null,-1)),n[5]||(n[5]=l("circle",{cx:"50",cy:"66",r:"3",class:"umi-pupila"},null,-1)),n[6]||(n[6]=l("circle",{cx:"76",cy:"66",r:"3",class:"umi-pupila"},null,-1))],64)):Y("",!0),e.estado==="contenta"?(y(),C("path",dd)):Y("",!0)],8,sd))}},Gi=nd(fd,[["__scopeId","data-v-551897a0"]]),pd={key:0,class:"flex flex-col items-center justify-center py-24 text-sm text-tenue"},md={key:1,class:"max-w-md mx-auto text-center py-20"},hd={key:2,class:"flex flex-col items-center justify-center text-center py-24"},gd={class:"text-lg font-medium text-texto"},vd={class:"text-sm text-tenue mt-1"},bd={__name:"Home",setup(e){const t=So(),n=W(Ye.esPortal),s=W(!1);async function o(){if(Ye.esPortal)try{const i=(await re.get(oe("/umind/tenants"))).items||[];if(i.length===0){s.value=!0;return}if(i.length!==1)return;const a=i[0].ID,f=(await re.get(oe(`/umind/agentes?tenant_id=${a}`))).items||[];if(f.length===1){t.replace(`/tenants/${a}/agentes/${f[0].ID}`);return}t.replace(`/tenants/${a}`)}catch{}finally{n.value=!1}}return xo(o),(r,i)=>n.value?(y(),C("div",pd," Abriendo tu asistente… ")):s.value?(y(),C("div",md,[ke(Gi,{estado:"durmiendo",tam:80,class:"mx-auto mb-4 text-brand"}),i[0]||(i[0]=Ei(' Todavía no tenés un asistente activo
uMind contesta por vos en WhatsApp y en tu sitio, con la información de tu negocio. Entiende las notas de voz y lee las fotos y archivos que te mandan tus clientes.
Quiero activarlo',4))])):(y(),C("div",hd,[i[1]||(i[1]=l("div",{class:"text-4xl mb-4"},"💬",-1)),l("h1",gd,$(Ve(Ye).esPortal?"Elegí tu espacio de la izquierda":"Elegí un espacio de la izquierda"),1),l("p",vd,$(Ve(Ye).esPortal?"Adentro vas a poder crear y configurar tus agentes.":"o creá uno nuevo para empezar a configurar su agente."),1)]))}},xd={class:"flex flex-col items-center justify-center text-center py-12 px-6"},_d={key:0,class:"text-3xl mb-3 opacity-70"},yd={class:"text-sm font-medium text-texto"},wd={key:2,class:"text-xs text-tenue mt-1.5 max-w-sm leading-relaxed"},Cd={key:3,class:"mt-4"},qt={__name:"UiEmptyState",props:{estado:{type:String,default:"durmiendo"},titulo:String,detalle:String,icono:{type:String,default:""}},setup(e){return(t,n)=>(y(),C("div",xd,[e.icono?(y(),C("div",_d,$(e.icono),1)):(y(),ot(Gi,{key:1,estado:e.estado,tam:64,class:"mb-3 text-brand"},null,8,["estado"])),l("p",yd,$(e.titulo),1),e.detalle?(y(),C("p",wd,$(e.detalle),1)):Y("",!0),t.$slots.default?(y(),C("div",Cd,[na(t.$slots,"default")])):Y("",!0)]))}},Ed={key:0,class:"mb-6"},Sd={class:"flex items-start justify-between gap-4"},kd={class:"text-xl font-semibold text-texto"},Ad={class:"text-xs text-tenue mt-1"},Rd={key:1,class:"text-sm text-red-600 dark:text-red-400 mb-4"},Id={class:"flex items-center justify-between mb-4"},$d={class:"flex items-center gap-2"},Pd={key:0,class:"badge-alerta"},Od={key:1,class:"badge-neutro"},Td=["disabled"],Nd={key:2,class:"text-xs text-tenue -mt-2 mb-4"},Dd={key:3,class:"text-xs text-tenue -mt-2 mb-4"},Md={key:4,class:"grid gap-3 sm:grid-cols-2"},Vd=["disabled"],jd={key:6,class:"grid gap-3 sm:grid-cols-2"},Ud={class:"flex items-start gap-3"},Ld={class:"min-w-0 flex-1"},Fd={class:"flex items-center gap-2"},Hd={class:"font-medium text-texto truncate"},Bd={class:"text-xs text-tenue mt-0.5 truncate"},qd={class:"flex gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity shrink-0"},Gd=["onClick"],Kd=["onClick"],Wd=["onClick"],zd={class:"flex items-center gap-4 mt-3.5 pt-3 border-t border-borde text-xs text-tenue"},Jd={class:"tabular-nums"},Qd={class:"text-texto font-medium"},Yd={class:"tabular-nums"},Xd={class:"text-texto font-medium"},Zd={class:"tabular-nums"},ef={class:"text-texto font-medium"},tf={class:"bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-800 rounded-xl p-6 w-full max-w-lg max-h-[calc(100vh-2rem)] overflow-y-auto"},nf={class:"font-semibold text-gray-800 dark:text-gray-100 mb-4"},sf={key:0},of={class:"grid gap-1.5"},rf=["value"],lf={class:"min-w-0"},af={class:"block text-sm text-texto"},uf={class:"block text-xs text-tenue"},cf={key:0,class:"block text-xs text-tenue mt-0.5"},df=["value"],ff={class:"flex items-center gap-2"},pf={class:"flex items-center gap-2 text-sm text-gray-600 dark:text-gray-300"},mf={class:"flex justify-end gap-2 pt-2"},hf={type:"submit",class:"bg-brand hover:bg-brand-dark text-white text-sm font-medium px-4 py-2 rounded-lg"},gf={__name:"TenantAgentes",props:{id:{type:String,required:!0}},setup(e){const t=e,n=ye(()=>Number(t.id)),s=So(),o=W(null),r=W([]),i=W([]),a=W(""),u=W(!1),f=W(null),c=W(D()),m=W(null),v=W({}),x=W(!0);function M(Z){const j=v.value[Z.ID]||{};return Z.activo?j.documentos>0?{tipo:"ok",texto:"listo"}:{tipo:"alerta",texto:"sin conocimiento"}:{tipo:"neutro",texto:"inactivo"}}function P(Z){const j=v.value[Z.ID]||{};return{documentos:j.documentos||0,canales:j.canales||0,conversaciones:j.conversaciones_7d||0}}function K(Z){return String(Z||"?").trim().split(/\s+/).slice(0,2).map(j=>j[0]).join("").toUpperCase()}const H=ye(()=>{if(!m.value)return{sinPlan:!0};const Z=m.value.max_agentes||0;return{sinPlan:!1,nombre:m.value.nombre,ilimitado:Z<=0,max:Z,usados:r.value.length,lleno:Z>0&&r.value.length>=Z}});function D(){return{nombre:"",ai_config_id:null,tono:"",mensaje_bienvenida:"",color:"#8eb02f",activo:!0,plantilla_rubro:""}}const B=W([]);async function I(){a.value="",x.value=!0;try{const[Z,j,Ne,G]=await Promise.all([re.get(oe("/umind/tenants")),re.get(oe(`/umind/agentes?tenant_id=${t.id}`)),re.get(oe("/umind/ai-configs")),re.get(oe("/umind/plantillas-rubro"))]);o.value=(Z.items||[]).find(Ze=>String(Ze.ID)===t.id)||null,r.value=j.items||[],m.value=j.plan||null,v.value=j.resumen||{},i.value=Ne.items||[],B.value=G.items||[]}catch(Z){a.value=Z.message}finally{x.value=!1}}async function E(Z){const j=prompt(`Nombre de la copia de "${Z.nombre}":`,`${Z.nombre} (copia)`);if(j!==null){a.value="";try{const Ne=await re.post(oe(`/umind/agentes/${Z.ID}/duplicar`),{tenant_id:Number(n.value),nombre:j.trim()});await I(),Ne.aviso&&alert(Ne.aviso)}catch(Ne){a.value=Ne.message}}}function O(){f.value=null,c.value=D(),u.value=!0}function te(Z){f.value=Z,c.value={nombre:Z.nombre,ai_config_id:Z.ai_config_id,tono:Z.tono,mensaje_bienvenida:Z.mensaje_bienvenida,color:Z.color||"#8eb02f",activo:Z.activo},u.value=!0}async function L(){try{if(f.value)await re.put(oe(`/umind/agentes/${f.value.ID}`),{tenant_id:n.value,...c.value}),u.value=!1,await I();else{const Z=await re.post(oe("/umind/agentes"),{tenant_id:n.value,...c.value});u.value=!1,s.push(`/tenants/${n.value}/agentes/${Z.id}`)}}catch(Z){a.value=Z.message}}async function Ae(Z){confirm(`¿Eliminar el agente "${Z.nombre}"? Esto no se puede deshacer.`)&&(await re.del(oe(`/umind/agentes/${Z.ID}`)),await I())}return Kt(()=>t.id,I,{immediate:!0}),(Z,j)=>{const Ne=Bn("router-link");return y(),C("div",null,[o.value?(y(),C("div",Ed,[l("div",Sd,[l("div",null,[l("h1",kd,$(o.value.nombre),1),l("p",Ad,$(o.value.dominios_permitidos||"sin dominios configurados"),1)]),ke(Ne,{to:`/tenants/${n.value??e.id}/uso`,class:"btn-ghost"},{default:Gt(()=>[...j[10]||(j[10]=[we("📊 Consumo",-1)])]),_:1},8,["to"])])])):Y("",!0),a.value?(y(),C("p",Rd,$(a.value),1)):Y("",!0),l("div",Id,[l("div",$d,[j[11]||(j[11]=l("h2",{class:"text-sm font-medium text-tenue"},"Agentes",-1)),H.value.sinPlan?(y(),C("span",Pd,"sin plan · sin límite")):H.value.ilimitado?(y(),C("span",Od,$(H.value.nombre)+" · ilimitado",1)):(y(),C("span",{key:2,class:Se(H.value.lleno?"badge-alerta":"badge-neutro")},$(H.value.nombre)+" · "+$(H.value.usados)+" de "+$(H.value.max),3))]),l("button",{class:"btn-primary",disabled:H.value.lleno,onClick:O},"+ Nuevo agente",8,Td)]),H.value.sinPlan&&!Ve(Ye).esPortal?(y(),C("p",Nd," Este espacio no tiene plan asignado, así que no se le aplica ningún límite de agentes. Asignale uno desde el lápiz del espacio, en la barra izquierda. ")):H.value.lleno?(y(),C("p",Dd," Alcanzaste el máximo de agentes de tu plan. ")):Y("",!0),x.value?(y(),C("div",Md,[(y(),C(ie,null,Te(2,G=>l("div",{key:G,class:"card p-4 animate-pulse"},[...j[12]||(j[12]=[Ei('',2)])])),64))])):r.value.length===0?(y(),ot(qt,{key:5,class:"card",estado:"durmiendo",titulo:"Todavía no hay agentes",detalle:"Creá el primero y cargale su base de conocimiento para que empiece a responder."},{default:Gt(()=>[l("button",{class:"btn-primary",disabled:H.value.lleno,onClick:O},"+ Crear el primer agente",8,Vd)]),_:1})):(y(),C("div",jd,[(y(!0),C(ie,null,Te(r.value,G=>(y(),ot(Ne,{key:G.ID,to:`/tenants/${n.value}/agentes/${G.ID}`,class:"card p-4 relative group hover:shadow-lg hover:-translate-y-0.5 transition-all overflow-hidden"},{default:Gt(()=>[l("span",{class:"absolute inset-x-0 top-0 h-1",style:nn({background:G.color||"#8eb02f"})},null,4),l("div",Ud,[l("span",{class:"w-10 h-10 rounded-xl flex items-center justify-center text-white text-sm font-semibold shrink-0",style:nn({background:G.color||"#8eb02f",opacity:G.activo?1:.4})},$(K(G.nombre)),5),l("div",Ld,[l("div",Fd,[l("span",Hd,$(G.nombre),1),l("span",{class:Se(`badge-${M(G).tipo}`)},$(M(G).texto),3)]),l("p",Bd,$(G.tono||"sin tono definido"),1)]),l("div",qd,[l("button",{class:"p-1 text-tenue hover:text-texto",title:"Editar",onClick:Ue(Ze=>te(G),["prevent","stop"])},"✎",8,Gd),l("button",{class:"p-1 text-tenue hover:text-texto",title:"Duplicar: copia el conocimiento y las herramientas a un agente nuevo",onClick:Ue(Ze=>E(G),["prevent","stop"])},"⧉",8,Kd),l("button",{class:"p-1 text-tenue hover:text-red-600",title:"Eliminar",onClick:Ue(Ze=>Ae(G),["prevent","stop"])},"✕",8,Wd)])]),l("div",zd,[l("span",Jd,[l("b",Qd,$(P(G).conversaciones),1),j[13]||(j[13]=we(" conversaciones · 7d",-1))]),l("span",Yd,[l("b",Xd,$(P(G).documentos),1),j[14]||(j[14]=we(" fuentes",-1))]),l("span",Zd,[l("b",ef,$(P(G).canales),1),j[15]||(j[15]=we(" canales",-1))])])]),_:2},1032,["to"]))),128))])),u.value?(y(),C("div",{key:7,class:"fixed inset-0 bg-black/40 flex items-center justify-center p-4 z-50",onClick:j[9]||(j[9]=Ue(G=>u.value=!1,["self"]))},[l("div",tf,[l("h2",nf,$(f.value?"Editar agente":"Nuevo agente"),1),l("form",{class:"space-y-3",onSubmit:Ue(L,["prevent"])},[l("div",null,[j[16]||(j[16]=l("label",{class:"label"},"Nombre",-1)),se(l("input",{"onUpdate:modelValue":j[0]||(j[0]=G=>c.value.nombre=G),required:"",placeholder:"ej: Ventas, Soporte",class:"input"},null,512),[[be,c.value.nombre]])]),!f.value&&B.value.length?(y(),C("div",sf,[j[17]||(j[17]=l("label",{class:"label"},"Arrancar con",-1)),l("div",of,[(y(!0),C(ie,null,Te([{clave:"",nombre:"Agente en blanco",descripcion:"Sin conocimiento cargado. Lo escribís vos desde cero."},...B.value],G=>(y(),C("label",{key:G.clave,class:Se(["flex gap-2.5 p-2.5 rounded-lg border cursor-pointer transition-colors",c.value.plantilla_rubro===G.clave?"border-brand bg-brand/5":"border-borde hover:border-brand/40"])},[se(l("input",{"onUpdate:modelValue":j[1]||(j[1]=Ze=>c.value.plantilla_rubro=Ze),type:"radio",value:G.clave,class:"mt-1 text-brand focus:ring-brand"},null,8,rf),[[fu,c.value.plantilla_rubro]]),l("span",lf,[l("span",af,$(G.nombre),1),l("span",uf,$(G.descripcion),1),G.notas?(y(),C("span",cf,$(G.notas)+" notas listas para editar · "+$(G.resumen),1)):Y("",!0)])],2))),128))]),j[18]||(j[18]=l("p",{class:"text-xs text-tenue mt-1.5"}," Las notas vienen con ejemplos entre corchetes — abrilas y reemplazalas por tus datos reales. ",-1))])):Y("",!0),l("div",null,[j[20]||(j[20]=l("label",{class:"label"},"Config de IA",-1)),se(l("select",{"onUpdate:modelValue":j[2]||(j[2]=G=>c.value.ai_config_id=G),class:"input"},[j[19]||(j[19]=l("option",{value:null},"— sin asignar —",-1)),(y(!0),C(ie,null,Te(i.value,G=>(y(),C("option",{key:G.ID,value:G.ID},$(G.nombre)+" ("+$(G.provider)+")",9,df))),128))],512),[[Un,c.value.ai_config_id]])]),l("div",null,[j[21]||(j[21]=l("label",{class:"label"},"Tono / personalidad",-1)),se(l("textarea",{"onUpdate:modelValue":j[3]||(j[3]=G=>c.value.tono=G),rows:"2",class:"input"},null,512),[[be,c.value.tono]])]),l("div",null,[j[22]||(j[22]=l("label",{class:"label"},"Mensaje de bienvenida",-1)),se(l("input",{"onUpdate:modelValue":j[4]||(j[4]=G=>c.value.mensaje_bienvenida=G),class:"input"},null,512),[[be,c.value.mensaje_bienvenida]])]),l("div",null,[j[23]||(j[23]=l("label",{class:"label"},"Color del widget",-1)),l("div",ff,[se(l("input",{"onUpdate:modelValue":j[5]||(j[5]=G=>c.value.color=G),type:"color",class:"w-10 h-9 border border-gray-300 dark:border-gray-700 rounded cursor-pointer bg-white dark:bg-gray-800"},null,512),[[be,c.value.color]]),se(l("input",{"onUpdate:modelValue":j[6]||(j[6]=G=>c.value.color=G),type:"text",pattern:"#[0-9a-fA-F]{6}",class:"flex-1 border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800 text-gray-800 dark:text-gray-100 rounded-lg px-3 py-2 text-sm font-mono"},null,512),[[be,c.value.color]])])]),l("label",pf,[se(l("input",{"onUpdate:modelValue":j[7]||(j[7]=G=>c.value.activo=G),type:"checkbox"},null,512),[[It,c.value.activo]]),j[24]||(j[24]=we(" Activo ",-1))]),l("div",mf,[l("button",{type:"button",class:"px-4 py-2 text-sm text-gray-500 dark:text-gray-400",onClick:j[8]||(j[8]=G=>u.value=!1)},"Cancelar"),l("button",hf,$(f.value?"Guardar":"Crear"),1)])],32)])])):Y("",!0)])}}},vf={key:0,class:"mb-6 mt-1 flex items-start justify-between gap-4"},bf={class:"min-w-0"},xf={class:"text-xl font-semibold text-texto"},_f={class:"text-xs text-tenue mt-1"},yf={class:"bg-elevado px-1.5 py-0.5 rounded"},wf=["href"],Cf={key:1,class:"text-sm text-red-600 dark:text-red-400 mb-4"},Ef={class:"flex gap-1.5 mb-6 overflow-x-auto sin-barra pb-1"},Sf=["onClick"],kf={key:2},Af={class:"card p-4 mb-4"},Rf={class:"flex gap-1 mb-3"},If=["onClick"],$f={class:"flex items-center justify-between"},Pf=["disabled"],Of={class:"flex items-center justify-between"},Tf=["disabled"],Nf={class:"flex gap-2"},Df={class:"flex items-center justify-between"},Mf={class:"flex items-center gap-2 text-xs text-tenue cursor-pointer"},Vf=["disabled"],jf={class:"card divide-y divide-borde"},Uf={class:"text-sm text-texto"},Lf={class:"text-xs text-tenue mt-0.5"},Ff={key:0},Hf={key:1},Bf={key:2},qf={key:3,class:"text-red-600 dark:text-red-400"},Gf={class:"flex items-center gap-3 shrink-0"},Kf=["title","onClick"],Wf=["onClick"],zf=["disabled","title","onClick"],Jf=["onClick"],Qf={class:"card w-full max-w-2xl p-6 max-h-[calc(100vh-2rem)] overflow-y-auto"},Yf={class:"flex justify-end gap-2 pt-1"},Xf=["disabled"],Zf={key:3},ep={class:"card divide-y divide-borde"},tp={class:"text-sm text-texto font-mono"},np={class:"label mt-0.5"},sp={class:"text-xs text-tenue mt-0.5"},op={key:0,class:"ml-1 text-green-600 dark:text-green-400"},rp={key:1,class:"ml-1 text-gray-400"},ip={class:"flex gap-3 text-sm shrink-0"},lp=["onClick"],ap=["onClick"],up={class:"card p-6 w-full max-w-xl max-h-[85vh] overflow-y-auto"},cp={class:"font-semibold text-texto mb-4"},dp={class:"border border-borde rounded-lg p-3 space-y-2"},fp=["onUpdate:modelValue"],pp=["onUpdate:modelValue"],mp=["onUpdate:modelValue"],hp={class:"label flex items-center gap-1"},gp=["onUpdate:modelValue"],vp=["onClick"],bp={key:0,class:"text-xs text-gray-400"},xp={class:"border border-borde rounded-lg p-3 space-y-2"},_p={class:"flex items-center gap-2 label"},yp={class:"flex items-center gap-2 text-sm text-texto"},wp={class:"flex justify-end gap-2 pt-2"},Cp={key:4},Ep={class:"card p-4 mb-4"},Sp={class:"flex items-center justify-between mb-2"},kp={class:"bg-elevado border border-borde rounded-lg p-2.5 text-xs text-texto overflow-x-auto"},Ap={class:"card divide-y divide-borde"},Rp={class:"flex items-center justify-between"},Ip={class:"font-medium text-texto capitalize"},$p={class:"flex gap-3 text-sm"},Pp=["onClick"],Op=["onClick"],Tp={class:"flex gap-4 mt-2 text-xs"},Np={class:"flex items-center gap-1.5 text-texto cursor-pointer"},Dp=["checked","onChange"],Mp={class:"flex items-center gap-1.5 text-texto cursor-pointer"},Vp=["checked","onChange"],jp={class:"flex items-center gap-1.5 text-texto cursor-pointer"},Up=["checked","onChange"],Lp={class:"label mt-1 break-all"},Fp={class:"bg-elevado px-1 rounded"},Hp={key:0,class:"text-xs text-tenue mt-1"},Bp={key:1,class:"text-xs text-red-600 dark:text-red-400 mt-1"},qp={class:"card p-6 w-full max-w-md"},Gp={key:0},Kp={class:"flex flex-col gap-2 pt-1"},Wp={class:"flex items-center gap-2 text-sm text-texto cursor-pointer"},zp={class:"flex items-center gap-2 text-sm text-texto cursor-pointer"},Jp={class:"flex items-center gap-2 text-sm text-texto cursor-pointer"},Qp={class:"flex justify-end gap-2 pt-2"},Yp={key:5},Xp={class:"flex gap-2 mb-4"},Zp={class:"card divide-y divide-borde"},em={class:"font-medium text-texto capitalize"},tm={class:"ml-2 text-sm text-tenue"},nm=["onClick"],sm={key:6,class:"card p-4 flex flex-col h-[28rem]"},om={class:"flex-1 overflow-y-auto space-y-2 mb-3"},rm={key:0,class:"text-sm text-tenue"},im={key:1,class:"text-xs text-tenue"},lm=["disabled"],am={key:7,class:"grid grid-cols-3 gap-4"},um={class:"col-span-1 card divide-y divide-borde max-h-[28rem] overflow-y-auto"},cm=["onClick"],dm={class:"text-texto truncate"},fm={class:"text-xs text-tenue mt-0.5"},pm={class:"col-span-2 card p-4 max-h-[28rem] overflow-y-auto space-y-2"},mm={key:0,class:"text-sm text-tenue"},hm={key:8},gm={class:"card divide-y divide-borde max-h-[32rem] overflow-y-auto"},vm={class:"cursor-pointer flex items-center gap-2 text-sm"},bm={class:"text-tenue text-xs shrink-0"},xm={class:"text-texto truncate"},_m={class:"text-tenue text-xs ml-auto shrink-0"},ym={key:0,class:"mt-2 bg-elevado border border-borde rounded-lg p-2 text-xs text-gray-600 dark:text-gray-400 overflow-x-auto whitespace-pre-wrap"},wm={__name:"AgenteDetail",props:{tenantId:{type:String,required:!0},agenteId:{type:String,required:!0}},setup(e){const t=e,n=ye(()=>Number(t.agenteId)),s=Hi(),o=W(null),r=W(""),i=W(typeof s.query.tab=="string"?s.query.tab:Ye.esPortal?"conversaciones":"conocimiento"),a=W([]),u=W(""),f=W(30),c=W(!1);async function m(){const A=await re.get(oe(`/umind/agentes?tenant_id=${t.tenantId}`));o.value=(A.items||[]).find(h=>String(h.ID)===t.agenteId)||null}async function v(){const A=await re.get(oe(`/umind/documentos?agente_id=${t.agenteId}`));a.value=A.items||[]}const x=W("texto"),M=W(!0),P=W(""),K=W(""),H=W(null);async function D(){if(u.value.trim()){c.value=!0,r.value="";try{await re.post(oe("/umind/documentos"),{agente_id:n.value,url:u.value.trim(),max_paginas:Number(f.value)||30,auto_actualizar:M.value}),u.value="",await v()}catch(A){r.value=A.message}finally{c.value=!1}}}async function B(){if(K.value.trim()){c.value=!0,r.value="";try{await re.post(oe("/umind/documentos/texto"),{agente_id:n.value,titulo:P.value.trim(),contenido:K.value}),P.value="",K.value="",await v()}catch(A){r.value=A.message}finally{c.value=!1}}}async function I(){var h,St;const A=(St=(h=H.value)==null?void 0:h.files)==null?void 0:St[0];if(A){c.value=!0,r.value="";try{const b=new FormData;b.append("agente_id",String(n.value)),b.append("archivo",A);const Ce=await fetch(oe("/umind/documentos/archivo"),{method:"POST",body:b}),lt=await Ce.json();if(!Ce.ok)throw new Error(lt.error||"No se pudo subir");H.value.value="",await v()}catch(b){r.value=b.message}finally{c.value=!1}}}const E=W(null),O=W({titulo:"",contenido:""}),te=W(!1);function L(A){E.value=A,O.value={titulo:A.origen,contenido:A.contenido||""}}async function Ae(){if(E.value){te.value=!0,r.value="";try{await re.put(oe(`/umind/documentos/${E.value.ID}`),{titulo:O.value.titulo,contenido:O.value.contenido}),E.value=null,await v()}catch(A){r.value=A.message}finally{te.value=!1}}}async function Z(A){r.value="";try{await re.post(oe(`/umind/documentos/${A.ID}/reprocesar`),{}),await v()}catch(h){r.value=h.message}}async function j(A){try{await re.put(oe(`/umind/documentos/${A.ID}`),{auto_actualizar:!A.auto_actualizar}),await v()}catch(h){r.value=h.message}}function Ne(A){if(!A)return"sin procesar";const h=Math.floor((Date.now()-new Date(A))/864e5);if(h<=0)return"hoy";if(h===1)return"ayer";if(h<30)return`hace ${h} días`;const St=Math.floor(h/30);return St===1?"hace un mes":`hace ${St} meses`}function G(A){return A.procesado_at?Date.now()-new Date(A.procesado_at)>60*864e5:!1}async function Ze(A){confirm("¿Eliminar esta fuente y sus fragmentos indexados?")&&(await re.del(oe(`/umind/documentos/${A}`)),await v())}const Ut=ye(()=>A=>({listo:"badge-ok",procesando:"badge-alerta",pendiente:"badge-neutro",error:"badge-error"})[A]||"badge-neutro"),Ee=W([]),de=W([]),ue=W(null);async function ut(){const A=await re.get(oe(`/umind/sesiones?agente_id=${t.agenteId}`));Ee.value=A.items||[]}async function gt(A){ue.value=A;const h=await re.get(oe(`/umind/historial?agente_id=${t.agenteId}&session_id=${A}`));de.value=h.items||[]}const Ke=W([]),Oe=W(!1),tt=W(null),le=W(vt());function vt(){return{nombre:"",descripcion:"",url:"",auth_header_nombre:"",auth_header_valor:"",tocarAuth:!1,parametros:[],activa:!0}}async function He(){const A=await re.get(oe(`/umind/tools?agente_id=${t.agenteId}`));Ke.value=A.items||[]}function S(){tt.value=null,le.value=vt(),Oe.value=!0}function q(A){tt.value=A;let h=[];try{h=JSON.parse(A.parametros_json||"[]")||[]}catch{h=[]}le.value={nombre:A.nombre,descripcion:A.descripcion,url:A.url,auth_header_nombre:A.auth_header_nombre,auth_header_valor:"",tocarAuth:!1,parametros:h,activa:A.activa},Oe.value=!0}function U(){le.value.parametros.push({nombre:"",tipo:"string",descripcion:"",requerido:!1})}function J(A){le.value.parametros.splice(A,1)}async function ae(){const A={agente_id:n.value,nombre:le.value.nombre.trim(),descripcion:le.value.descripcion,url:le.value.url.trim(),auth_header_nombre:le.value.auth_header_nombre,parametros:le.value.parametros,activa:le.value.activa};le.value.tocarAuth&&(A.auth_header_valor=le.value.auth_header_valor);try{tt.value?await re.put(oe(`/umind/tools/${tt.value.ID}`),A):await re.post(oe("/umind/tools"),A),Oe.value=!1,await He()}catch(h){r.value=h.message}}async function d(A){confirm(`¿Eliminar la herramienta "${A.nombre}"?`)&&(await re.del(oe(`/umind/tools/${A.ID}`)),await He())}const p=W([]),g=W(!1),_=W(T()),k=W(!1),w=ye(()=>{const A=new Date,h=new Date(A.getFullYear(),A.getMonth(),1).toISOString().slice(0,10),St=A.toISOString().slice(0,10);return oe(`/umind/reporte.xlsx?agente_id=${t.agenteId}&desde=${h}&hasta=${St}`)}),V=ye(()=>{var h;const A=((h=o.value)==null?void 0:h.site_key)||"TU_SITE_KEY";return` - + +