PageSourceSearch

https://hauss.ambarpartners.com/assets/HaussIntelligenceView-Q9xSBqLE.js

js ambarpartners.com collected 2026-10-07 00:52:58 UTC 192,042 bytes, 65 lines download raw bytes

1var sa=Object.defineProperty;var aa=(s,e,t)=>e in s?sa(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var te=(s,e,t)=>aa(s,typeof e!="symbol"?e+"":e,t);import{o as p,c as m,a as o,d as T,k as a,a3 as M,H as _,t as i,F as X,a0 as N,bM as qt,r as S,j as D,a6 as Yt,m as re,D as fe,Y as Ie,ah as ne,ak as oe,f as ae,G,cc as la,ac as pe,_ as Wt,K as _e,bj as Ue,bk as Be,w as $e,cJ as oa,bY as ra,aq as Ts,cI as ws,p as ia,ab as Ze,a1 as mn,a4 as jt,J as ht,an as Tn,aL as ca,aj as Ss,dt as ua,bi as da,b3 as pa,bR as fa,b2 as ha,v as ba,du as _a}from"./index-BTNZA_bz.js";import{u as bt,A as ma,w as ga,g as xa,_ as Ft,a as va}from"./SoulWizardExperienceCards-t2MW8SPt.js";import{c as Je,b as Lt,h as ot,d as Ea,a as wn}from"./haussClient-BOvC-oc0.js";import{a as Is,u as Ls,b as ka}from"./useHaussIntelligenceAccess-DCldbJS0.js";import{_ as ya}from"./index-CRUidNb7.js";import{_ as Sn}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./axios-BLegh8FB.js";import"./request--fndALTt.js";const Ta={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function wa(s,e){return p(),m("svg",Ta,e[0]||(e[0]=[o("path",{d:"M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z",stroke:"#25272D","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),o("path",{d:"M12 6V12L16 14",stroke:"#25272D","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]))}const Sa={render:wa},Ia={"data-test":"chat-breadcrumb",class:"flex items-center gap-1.5 px-4 py-2.5 border-b border-carbon-25 text-sm text-carbon-75 shrink-0"},La={class:"truncate"},Ca={class:"truncate font-medium text-carbon-100"},Aa=["aria-label"],$a={__name:"ChatBreadcrumb",props:{clientName:{type:String,default:null},matterName:{type:String,default:null}},emits:["clear"],setup(s,{emit:e}){const t=s,n=e;return(l,r)=>(p(),m("div",Ia,[T(a(M),{icon:"case",size:16,area:20,class:"text-carbon-50 shrink-0"}),o("span",La,_(t.clientName||a(i)("CLIENTS_UNKNOWN")),1),t.matterName?(p(),m(X,{key:0},[r[1]||(r[1]=o("span",{class:"text-carbon-50"},"/",-1)),o("span",Ca,_(t.matterName),1)],64)):N("",!0),o("button",{type:"button","data-test":"breadcrumb-clear",class:"ml-auto text-carbon-50 hover:text-carbon-100 shrink-0 transition-colors","aria-label":a(i)("CLIENTS_GENERAL"),onClick:r[0]||(r[0]=d=>n("clear"))},[T(a(M),{icon:"close",size:16,area:20})],8,Aa)]))}},Ra=Object.freeze(["application/pdf","image/png","image/jpeg","image/webp","image/gif","text/plain","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]),Cs=Object.freeze([".pdf",".png",".jpg",".jpeg",".webp",".gif",".txt",".docx"]),As=Cs.join(","),$s=10*1024*1024;function Rs(s){const e=s.name.lastIndexOf(".");return e===-1?"":s.name.slice(e).toLowerCase()}function Ns(s){return Ra.includes(s.type)||Cs.includes(Rs(s))}function Na(s){return Je("/chat",{data:s})}function Oa(s,e){return Lt(`/chats/${s}/modules`,{data:{active_modules:e}})}function Ma(s){return ot("/ably-token",{params:{chat_id:s}})}function Da({clientId:s=null,matterId:e=null}={}){const t={};return s!=null&&(t.client_id=s),e!=null&&(t.matter_id=e),ot("/chats",{params:t})}function Fa(s){return ot(`/chats/${s}/messages`)}function Pa(s,e){return Ea(`/chats/${s}/files/${e}`)}function za(s){return Je(`/chats/${s}/cancel`)}const Ua=5,He=qt("hauss",()=>{const s=S(null),e=S([]),t=S([]),n=S(!1),l=S(""),r=S(null),d=S([]),u=S(null),c=S(null),h=S(null),b=S(null),E=S(null),k=S(localStorage.getItem("ambar-twin-chat-model")||"auto"),C=S(localStorage.getItem("ambar-twin-chat-deep")==="true");function v(g){k.value=g,localStorage.setItem("ambar-twin-chat-model",g)}function I(g){C.value=!!g,localStorage.setItem("ambar-twin-chat-deep",String(!!g))}const y=S(null);async function H(g){if(y.value=g,s.value)try{await Oa(s.value,g)}catch(w){r.value=w.message}}let K=null,O=null,R=null;const B=Yt(),j=D(()=>{var g;return((g=B.data)==null?void 0:g.id)??null}),ie=bt(),$=D(()=>t.value.filter(g=>g.matter_id==null)),z=g=>t.value.filter(w=>w.matter_id===g),W=D(()=>c.value==null?null:{clientId:u.value,clientName:h.value,matterId:c.value,matterName:b.value});async function Z(){j.value&&(t.value=await Da()??[])}function ye(g){E.value=g}function ge(g,w,A,P){u.value=g,c.value=w,h.value=A,b.value=P}async function Oe(g=null,w=null,A=null,P=null){ge(g,w,A,P),await J({keepContext:!0})}
1async function tt(g,w){ge(g.id,w.id,g.name,w.name),await J({keepContext:!0})}async function je(g){if(!(g!=null&&g.trim())||!j.value)return;r.value=null;const w=new FormData;w.append("message",g.trim()),s.value&&w.append("chat_id",String(s.value)),u.value!=null&&w.append("client_id",String(u.value)),c.value!=null&&w.append("matter_id",String(c.value)),w.append("model",k.value),w.append("deep",String(C.value)),!s.value&&y.value&&w.append("active_modules",JSON.stringify(y.value));const A=d.value.map(ce=>({name:ce.name,type:ce.type}));d.value.forEach(ce=>w.append("files",ce)),d.value=[];const P={role:"user",content:g.trim(),attachments:A};e.value.push(P);let V;try{V=await Na(w)}catch(ce){e.value.pop(),r.value=ce.message;return}V!=null&&V.queued&&(P.queued=!0),s.value||await Ge(V.chat_id)}async function nt(){if(!(!s.value||!n.value))try{await za(s.value)}catch(g){r.value=g.message}}function Me(){for(const g of e.value)g.queued&&(g.queued=!1)}async function Ge(g){K=new ma.Realtime({authCallback:async(w,A)=>{try{const P=await Ma(g);let V=P.token??P.tokenRequest??P;if(!V||typeof V=="string"&&!V.trim()){A(new Error("Ably token vacío"),null);return}if(typeof V=="string")try{V=JSON.parse(V)}catch{}A(null,V)}catch(P){A(P,null)}}}),O=K.channels.get(`hauss:${g}`,{params:{rewind:"2m"}}),O.subscribe(w=>{const A=w.data;if(A.type==="thinking")n.value=!0,A.text&&A.text!=="Pensando..."&&(l.value=A.text);else if(A.type==="response"){n.value=!1,l.value="",Me();const P=e.value[e.value.length-1];P&&P.role==="assistant"&&P.content===A.content||e.value.push({role:"assistant",content:A.content,files:A.attachments??[]}),Ce(g)}else A.type==="cancelled"?(n.value=!1,l.value="",Me()):A.type==="error"?(n.value=!1,l.value="",Me(),r.value=A.text):A.type==="soul_updated"&&(ie.markUpdated(),re({type:"success",body:i("SOUL_PROFILE_UPDATED_TOAST")}))}),s.value=g}function Le(){R&&(clearTimeout(R),R=null)}function se(){try{O==null||O.unsubscribe()}catch{}try{K==null||K.close()}catch{}K=null,O=null}async function Ce(g,w=5){var P;await Z();const A=(P=t.value)==null?void 0:P.find(V=>V.id===g);if(A!=null&&A.title||w<=0){Le();return}R=setTimeout(()=>Ce(g,w-1),2e3)}async function J({keepContext:g=!1}={}){Le(),se(),s.value=null,e.value=[],d.value=[],n.value=!1,l.value="",r.value=null,y.value=null,g||ge(null,null,null,null)}async function Xe(g){await J();try{const w=await Fa(g);e.value=w.map(P=>({role:P.role,content:P.content,files:P.attachments??[]}));const A=t.value.find(P=>P.id===g);A&&(ge(A.client_id,A.matter_id,A.client_name,A.matter_name),y.value=A.active_modules??null),await Ge(g)}catch(w){r.value=w.message}}function ee(g){return Ns(g)?g.size>$s?(r.value=`El archivo ${g.name} supera el límite de 10 MB`,!1):d.value.length>=Ua?(r.value="Máximo 5 archivos por mensaje",!1):(d.value=[...d.value,g],!0):(r.value=`Tipo de archivo no soportado: ${g.type||Rs(g)||g.name}`,!1)}function Te(g){d.value=d.value.filter((w,A)=>A!==g)}async function Ve(g){if(!(!s.value||!(g!=null&&g.id)))try{const w=await Pa(s.value,g.id),A=URL.createObjectURL(w),P=document.createElement("a");P.href=A,P.download=g.file_name||"archivo",document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(A)}catch(w){r.value=w.message||"No se pudo descargar el archivo"}}async function we(){Le(),se(),await J()}function x(){Le(),se()}return{chatId:s,messages:e,chats:t,thinking:n,thinkingText:l,error:r,pendingFiles:d,activeClientId:u,activeMatterId:c,activeClientName:h,activeMatterName:b,prefillText:E,model:k,deep:C,setModel:v,setDeep:I,generalChats:$,chatsOfMatter:z,threadContext:W,loadChats:Z,setPrefill:ye,setActiveContext:Oe,startChatInMatter:tt,activeModules:y,setChatFocus:H,sendMessage:je,cancel:nt,newChat:J,openChat:Xe,attachFile:ee,removeFile:Te,downloadFile:Ve,destroy:we,$dispose:x}}),Ba=["aria-pressed","aria-label","title"],Ha=["aria-label","title"],Wa={key:0,"data-test":"model-menu",class:"absolute bottom-full right-0 mb-2 w-64 rounded-xl border border-carbon-25 bg-white shadow-around p-1 z-30"},ja={class:"px-2 py-1 text-10 uppercase tracking-wide text-carbon-50"},Ga=["data-test","onClick"],Va={class:"w-7 h-7 rounded-lg bg-carbon-5 text-carbon-75 flex items-center justify-center shrink-0"},Ka={class:"min-w-0 flex-1"},qa={class:"block text-13 font-medium text-carbon-100"},Ya={class:"block text-11 text-carbon-50 truncate"},Za={__name:"ChatModelControl",setup(s){const e=He(),t=S(!1),n=S(null),l=D(()=>[{value:"auto",icon:"ai-magic",label:i("TWIN_MODEL_AUTO"),hint:i("TWIN_MODEL_AUTO_HINT")},{value:"fast",icon:"zap",label:i("TWIN_MODEL_FAST"),hint:i("TWIN_MODEL_FAST_HINT")},{value:"smart",icon:"scales",label:i("TWIN_MODEL_SMART"),hint:i("TWIN_MODEL_SMART_HINT")},{value:"deep",icon:"award",label:i("TWIN_MODEL_DEEP"),hint:i("TWIN_MODEL_DEEP_HINT")}]),r=D(()=>{var c;return((c=l.value.find(h=>h.value===e.model))==null?void 0:c.label)??i("TWIN_MODEL_AUTO")});function d(c){e.setModel(c),t.value=!1}function u(c){n.value&&!n.value.contains(c.target)&&(t.value=!1)}return fe(()=>document.addEventListener("click",u)),Ie(()=>document.removeEventListener("click",u)),(c,h)=>(p(),m("div",{ref_key:"root",ref:n,class:"relative shrink-0 flex items-center gap-1"},[o("button",{type:"button","data-test":"deep-toggle","aria-pressed":String(a(e).deep),"aria-label":a(i)("TWIN_DEEP_ANALYSIS"),title:a(i)("TWIN_DEEP_ANALYSIS_HINT"),class:ne(["p-1.5 rounded-lg transition-colors",a(e).deep?"bg-secondary-100 text-yellow-dark":"text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5"]),onClick:h[0]||(h[0]=b=>a(e).setDeep(!a(e).deep))},[T(a(M),{icon:"binoculars",size:16,area:20})],10,Ba),o("button",{type:"button","data-test":"model-control","aria-label":a(i)("TWIN_MODEL_LABEL"),title:a(i)("TWIN_MODEL_LABEL")+": "+r.value,class:"p-1.5 rounded-lg text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5 transition-colors",onClick:h[1]||(h[1]=b=>t.value=!t.value)},[T(a(M),{icon:"settings",size:16,area:20})],8,Ha),t.value?(p(),m("div",Wa,[o("p",ja,_(a(i)("TWIN_MODEL_LABEL")),1
1),(p(!0),m(X,null,oe(l.value,b=>(p(),m("button",{key:b.value,type:"button","data-test":`model-opt-${b.value}`,class:"w-full flex items-center gap-2.5 rounded-lg px-2 py-2 text-left hover:bg-carbon-5",onClick:E=>d(b.value)},[o("span",Va,[T(a(M),{icon:b.icon,size:16,area:20},null,8,["icon"])]),o("span",Ka,[o("span",qa,_(b.label),1),o("span",Ya,_(b.hint),1)]),a(e).model===b.value?(p(),ae(a(M),{key:0,icon:"check",size:16,area:20,class:"text-yellow-dark shrink-0"})):N("",!0)],8,Ga))),128))])):N("",!0)],512))}},Os={__name:"IntegrationsMenu",props:{chip:{type:Boolean,default:!1}},setup(s){const e=Is(),t=Ls(),n=S(!1),l=S(null);function r(){n.value=!1,e.openModal()}function d(){n.value=!1,t.openModal()}function u(c){l.value&&!l.value.contains(c.target)&&(n.value=!1)}return fe(()=>{e.loadStatus(),t.loadStatus(),document.addEventListener("click",u)}),Ie(()=>{document.removeEventListener("click",u)}),(c,h)=>(p(),m("div",{ref_key:"root",ref:l,class:"relative"},[s.chip?(p(),m("button",{key:0,type:"button","data-test":"integrations-button",class:"inline-flex items-center gap-1.5 rounded-full border border-carbon-25 bg-white px-3 py-1.5 text-13 text-carbon-75 hover:bg-carbon-5 hover:border-carbon-50 transition-colors",onClick:h[0]||(h[0]=b=>n.value=!n.value)},[T(a(M),{icon:"apps",size:16,area:20}),G(" "+_(a(i)("INTEGRATIONS_TITLE")),1)])):(p(),m("button",{key:1,type:"button","data-test":"integrations-button",class:"w-full flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:h[1]||(h[1]=b=>n.value=!n.value)},[h[2]||(h[2]=o("span",{class:"w-5 h-5 rounded-md bg-carbon-5 flex items-center justify-center shrink-0 text-xs"},"⧉",-1)),G(" "+_(a(i)("INTEGRATIONS_TITLE")),1)])),n.value?(p(),m("div",{key:2,"data-test":"integrations-dropdown",class:ne(["absolute bottom-full left-0 mb-1 rounded-lg border border-carbon-25 bg-white shadow-lg overflow-hidden z-20",s.chip?"w-56":"w-full"])},[o("button",{type:"button","data-test":"integration-onedrive",class:"w-full flex items-center justify-between px-3 py-2 text-sm text-carbon-75 hover:bg-carbon-5",onClick:r},[G(_(a(i)("INTEGRATIONS_ONEDRIVE"))+" ",1),o("span",{class:ne(["w-2 h-2 rounded-full shrink-0",a(e).connected?"bg-green-500":"bg-carbon-25"])},null,2)]),o("button",{type:"button","data-test":"integration-email",class:"w-full flex items-center justify-between px-3 py-2 text-sm text-carbon-75 hover:bg-carbon-5",onClick:d},[G(_(a(i)("INTEGRATIONS_EMAIL"))+" ",1),o("span",{class:ne(["w-2 h-2 rounded-full shrink-0",a(t).accounts.length?"bg-green-500":"bg-carbon-25"])},null,2)])],2)):N("",!0)],512))}},Xa=["aria-label","title"],Qa={key:0,"data-test":"focus-menu",class:"absolute bottom-full right-0 mb-2 w-80 max-h-[60vh] overflow-y-auto rounded-xl border border-carbon-25 bg-white shadow-around p-3 z-30"},Ja={class:"flex items-center justify-between mb-1"},el={class:"text-10 uppercase tracking-wide text-carbon-50"},tl={class:"text-11 text-carbon-50 leading-relaxed mb-3"},nl={class:"text-11 font-semibold text-carbon-75 mb-1.5"},sl={class:"flex flex-wrap gap-1.5"},al=["onClick"],ll={class:"text-11 text-carbon-50 mt-1"},ol={__name:"ModuleFocusControl",setup(s){const e=He(),t=bt(),n=S(!1),l=S(null),r=[{key:"jurisdictions",focusKey:"jurisdiction_ids",label:"TWIN_FOCUS_AXIS_JURISDICTIONS"},{key:"practice_areas",focusKey:"practice_area_ids",label:"TWIN_FOCUS_AXIS_PRACTICE_AREAS"},{key:"subareas",focusKey:"subarea_ids",label:"TWIN_FOCUS_AXIS_SUBAREAS"},{key:"industries",focusKey:"industry_ids",label:"TWIN_FOCUS_AXIS_INDUSTRIES"}],d=O=>{var R;return((R=t.profileModules)==null?void 0:R[O])??[]},u=D(()=>r.filter(O=>d(O.key).length>0)),c=D(()=>u.value.length>0),h=la({jurisdictions:[],practice_areas:[],subareas:[],industries:[]});function b(){const O=e.activeModules;for(const R of r){const B=d(R.key).map(j=>j.id);if(!O||O[R.focusKey]==null)h[R.key]=[...B];else{const j=new Set(O[R.focusKey]);h[R.key]=B.filter(ie=>j.has(ie))}}}fe(b),pe(()=>e.activeModules,b),pe(()=>t.profileModules,b,{deep:!0});const E=D(()=>e.activeModules!=null),k=D(()=>u.value.reduce((O,R)=>
1O+h[R.key].length,0)),C=D(()=>u.value.reduce((O,R)=>O+d(R.key).length,0));function v(){if(r.every(B=>h[B.key].length===d(B.key).length))return null;const R={};for(const B of r)R[B.focusKey]=[...h[B.key]];return R}function I(O,R){const B=h[O];h[O]=B.includes(R)?B.filter(j=>j!==R):[...B,R],e.setChatFocus(v())}function y(O,R){return h[O].includes(R)}function H(){e.setChatFocus(null)}function K(O){l.value&&!l.value.contains(O.target)&&(n.value=!1)}return fe(()=>document.addEventListener("click",K)),Ie(()=>document.removeEventListener("click",K)),(O,R)=>c.value?(p(),m("div",{key:0,ref_key:"root",ref:l,class:"relative shrink-0"},[o("button",{type:"button","data-test":"focus-control","aria-label":a(i)("TWIN_FOCUS_LABEL"),title:a(i)("TWIN_FOCUS_LABEL"),class:ne(["p-1.5 rounded-lg transition-colors",E.value?"bg-secondary-100 text-yellow-dark":"text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5"]),onClick:R[0]||(R[0]=B=>n.value=!n.value)},[T(a(M),{icon:"filter",size:16,area:20})],10,Xa),n.value?(p(),m("div",Qa,[o("div",Ja,[o("p",el,_(a(i)("TWIN_FOCUS_LABEL")),1),E.value?(p(),m("button",{key:0,type:"button","data-test":"focus-reset",class:"text-11 text-carbon-50 hover:text-carbon-100",onClick:H},_(a(i)("TWIN_FOCUS_RESET")),1)):N("",!0)]),o("p",tl,_(a(i)("TWIN_FOCUS_HINT")),1),(p(!0),m(X,null,oe(u.value,B=>(p(),m("section",{key:B.key,class:"mb-3 last:mb-0"},[o("p",nl,_(a(i)(B.label)),1),o("div",sl,[(p(!0),m(X,null,oe(d(B.key),j=>(p(),m("button",{key:j.id,type:"button","data-test":"focus-chip",class:ne(["inline-flex items-center gap-1 rounded-full border px-2.5 py-1 text-12 transition-colors",y(B.key,j.id)?"border-carbon-100 bg-carbon-100 text-white":"border-carbon-25 text-carbon-50 hover:border-carbon-50"]),onClick:ie=>I(B.key,j.id)},[y(B.key,j.id)?(p(),ae(a(M),{key:0,icon:"check",size:12,area:16})):N("",!0),G(" "+_(j.name),1)],10,al))),128))])]))),128)),o("p",ll,_(E.value?`${k.value}/${C.value}`:a(i)("TWIN_FOCUS_ALL")),1)])):N("",!0)],512)):N("",!0)}},rl=/(?:^|\s)\/([a-z0-9-]*)$/i;function il(s,e){const t=S(!1),n=S(""),l=S(-1),r=S(0),d=D(()=>{if(!t.value)return[];const E=n.value,k=e.value??[];return E?k.filter(C=>C.slug.includes(E)||C.description&&C.description.toLowerCase().includes(E)):k});function u(){t.value=!1,n.value="",l.value=-1,r.value=0}function c(E){if(!E)return u();const k=E.selectionStart??s.value.length,v=s.value.slice(0,k).match(rl);if(!v)return u();n.value=v[1].toLowerCase(),l.value=k-v[1].length-1,t.value=!0,r.value=0}async function h(E,k){if(!k||l.value<0)return;const C=(E==null?void 0:E.selectionStart)??s.value.length,v=`/${k.slug} `;s.value=s.value.slice(0,l.value)+v+s.value.slice(C);const I=l.value+v.length;u(),await Wt(),E&&(E.focus(),E.setSelectionRange(I,I))}function b(E,k){if(!t.value||!d.value.length)return!1;switch(E.key){case"ArrowDown":return r.value=(r.value+1)%d.value.length,!0;case"ArrowUp":return r.value=(r.value-1+d.value.length)%d.value.length,!0;case"Enter":case"Tab":return h(k,d.value[r.value]),!0;case"Escape":return u(),!0;default:return!1}}return{open:t,query:n,filtered:d,activeIndex:r,refresh:c,applySkill:h,onKeydown:b,close:u}}function cl(){return ot("/clients")}function ul(s){return Je("/clients",{data:s})}function ss(s,e){return Lt(`/clients/${s}`,{data:e})}function dl(s){return wn(`/clients/${s}`)}function pl({name:s,description:e,instructions:t}){return Je("/clients/generate-context-preview",{data:{name:s,description:e||null,instructions:t||null}})}function fl(s){return ot(`/clients/${s}/matters`)}function hl(s,e){return Je(`/clients/${s}/matters`,{data:e})}function bl(s,e){return Lt(`/matters/${s}`,{data:e})}function _l(s){return wn(`/matters/${s}`)}function ml(s,{name:e,description:t,instructions:n}){return Je(`/clients/${s}/matters/generate-context-preview`,{data:{name:e,description:t||null,instructions:n||null}})}function as(s){return ot(`/matters/${s}/files`)}function ls(s,e,t){const n=new FormData;return e.forEach(l=>n.append("keep_ids",l)),t.forEach(l=>n.append("files",l)),Lt(`/matters/${s}/files`,{data:n})}function os(s,e={}){return ga(s,{readyType:"context_ready",...e}).then(t=>({context:t.context??"",found:t.found!==!1}))}const We=qt("clients",()=>{const s=S([]),e=S(null),t=S(new Map),n=S(new Set),l=S(new Set),r=S(!1),d=S(!1),u=S(!1),c=S(!1),h=S(!1),b=S(null),E=S([]),k=S(!1),C=S(!1),v=S(null),I=S(!1),y=S(null),H=S(null),K=Yt(),O=D(()=>{var x;return((x=K.data)==null?void 0:x.id)??null}),R=x=>t.value.get(x)??[],B=x=>n.value.has(x),j=x=>l.value.has(x);function ie(x){l.value.has(x)?l.value.delete(x):l.value.add(x),l.value=new Set(l.value)}async function $(){if(O.value){d.value=!0,b.value=null;try{s.value=await cl()??[]}catch(x){b.value=x.message}finally{d.value=!1}}}async function z(x){try{const g=await fl(x);t.value.set(x,g??[]),t.value=new Map(t.value)}catch(g){b.value=g.message}}async function W(){const x=s.value.filter(g=>!t.value.has(g.id)).map(g=>z(g.id));x.length&&await Promise.all(x)}async function Z(x){n.value.has(x)?n.value.delete(x):(n.value.add(x),t.value.has(x)||await z(x)),n.value=new Set(n.value)}function ye(){v.value=null,C.value=!0}function ge(x){v.value=x,C.value=!0}function Oe(){C.value=!1,v.value=null}async function tt(x){var g;if(!O.value)return null;u.value=!0,b.value=null;try{const w=!((g=v.value)!=null&&g.id),A=w?await ul(x):await ss(v.value.id,x);return w&&(A==null?void 0:A.id)!=null&&(e.value=A.id),await $(),re({type:"success",body:i("CLIENTS_SAVED_OK")}),A}catch(w){return b.value=w.message,re({type:"error",body:w.message||i("CLIENTS_GENERIC_ERROR")}),null}finally{u.value=!1}}async function je(x,g){u.value=!0,b.value=null;try{const w=await ss(x.id,{name:x.name,description:x.description??null,context:g.trim()||null,rules:x.rules??null});return await $(),re({type:"success",body:i("CLIENTS_SAVED_OK")}),w}catch(w){return b.value=w.message,re({type:"error",body:w.message||i("CLIENTS_GENERIC_ERROR")}),null}finally{u.value=!1}}function nt(){const x=e.value;return e.value=null,x}async function Me(x){try{await dl(x),t.value.delete(x),n.value.delete(x),t.value=new Map(t.value),n.value=new Set(n.value),await $(),re({type:"success",body:i("CLIENTS_DELETED_OK")})}catch(g){re({type:"error",body:g.message||i("CLIENTS_GENERIC_ERROR")})}}function Ge(x){H.value=x,y.value=null,E.value=[],I.value=!0}function Le(x){H.value=x.client_id,y.value=x,E.value=[],I.value=!0,Ce(x.id)}function se(){I.value=!1,y.value=null,H.value=null,E.value=[]}
1async function Ce(x){k.value=!0;try{E.value=await as(x)??[]}catch(g){b.value=g.message,E.value=[]}finally{k.value=!1}}async function J(x,g=null){var A,P;const w=H.value;c.value=!0,b.value=null;try{const V=(A=y.value)!=null&&A.id?await bl(y.value.id,x):await hl(w,x);if(g){const ce=((P=y.value)==null?void 0:P.id)??(V==null?void 0:V.id);ce!=null&&await ls(ce,g.keepIds,g.newFiles)}return await z(w),re({type:"success",body:i("MATTERS_SAVED_OK")}),V}catch(V){return b.value=V.message,re({type:"error",body:V.message||i("CLIENTS_GENERIC_ERROR")}),null}finally{c.value=!1}}async function Xe(x,g){var w;try{const A=await as(x)??[];return await ls(x,A.map(P=>P.id),[g]),((w=y.value)==null?void 0:w.id)===x&&await Ce(x),re({type:"success",body:i("MATTER_SAVE_FILE_SAVED")}),!0}catch(A){return b.value=A.message,re({type:"error",body:A.message||i("CLIENTS_GENERIC_ERROR")}),!1}}async function ee(x){try{await _l(x.id),await z(x.client_id),re({type:"success",body:i("MATTERS_DELETED_OK")})}catch(g){re({type:"error",body:g.message||i("CLIENTS_GENERIC_ERROR")})}}async function Te({title:x,description:g}){if(!O.value)return null;h.value=!0;try{const w=await pl({name:x,description:g,instructions:null}),A=await os(w);return(A==null?void 0:A.found)===!1?(re({type:"info",body:i("CLIENTS_CONTEXT_NOT_FOUND")}),null):(A==null?void 0:A.context)??""}catch(w){return b.value=w.message,re({type:"error",body:w.message||i("CLIENTS_GENERATE_ERROR")}),null}finally{h.value=!1}}async function Ve({title:x,description:g}){const w=H.value;if(!w)return null;h.value=!0;try{const A=await ml(w,{name:x,description:g,instructions:null}),P=await os(A);return(P==null?void 0:P.found)===!1?(re({type:"info",body:i("MATTERS_CONTEXT_NOT_FOUND")}),null):(P==null?void 0:P.context)??""}catch(A){return b.value=A.message,re({type:"error",body:A.message||i("CLIENTS_GENERATE_ERROR")}),null}finally{h.value=!1}}function we(){s.value=[],t.value=new Map,n.value=new Set,l.value=new Set,r.value=!1,b.value=null}return{clients:s,lastCreatedClientId:e,matters:t,expanded:n,expandedMatters:l,menuOpen:r,loadingClients:d,savingClient:u,savingMatter:c,generating:h,error:b,matterFiles:E,loadingMatterFiles:k,clientModalVisible:C,editingClient:v,matterModalVisible:I,editingMatter:y,matterFormClientId:H,mattersOf:R,isExpanded:B,isMatterExpanded:j,toggleMatter:ie,loadClients:$,loadMatters:z,ensureAllMattersLoaded:W,toggleExpand:Z,openCreateClient:ye,openEditClient:ge,closeClientModal:Oe,saveClient:tt,saveClientDescription:je,consumeLastCreatedClient:nt,removeClient:Me,openCreateMatter:Ge,openEditMatter:Le,closeMatterModal:se,loadMatterFiles:Ce,saveMatter:J,addFileToMatter:Xe,removeMatter:ee,createClientContext:Te,createMatterContext:Ve,reset:we}});function gl(){return ot("/skills")}function xl({slug:s,name:e,description:t,instructions:n}){return Je("/skills",{data:{slug:s,name:e||null,description:t||null,instructions:n}})}function vl(s,e){return Lt(`/skills/${s}`,{data:e})}function El(s){return wn(`/skills/${s}`)}function kl({slug:s,name:e,description:t,instructions:n}){return Je("/skills/draft-preview",{data:{slug:s||null,name:e||null,description:t||null,instructions:n||null}})}const In=qt("skills",()=>{const s=S([]),e=S(!1),t=S(!1),n=S(!1),l=S(null),r=S(!1),d=S(null),u=Yt(),c=D(()=>{var H;return((H=u.data)==null?void 0:H.id)??null});async function h(){if(c.value){e.value=!0,l.value=null;try{s.value=await gl()??[]}catch(H){l.value=H.message}finally{e.value=!1}}}function b(){d.value=null,r.value=!0}function E(H){d.value=H,r.value=!0}function k(){r.value=!1,d.value=null}async function C(H){var K;if(!c.value)return null;t.value=!0,l.value=null;try{const O=(K=d.value)!=null&&K.id?await vl(d.value.id,H):await xl(H);return await h(),re({type:"success",body:i("SKILLS_SAVED_OK")}),O}catch(O){return l.value=O.message,re({type:"error",body:O.message||i("SKILLS_GENERIC_ERROR")}),null}finally{t.value=!1}}async function v(H){try{await El(H),await h(),re({type:"success",body:i("SKILLS_DELETED_OK")})}catch(K){re({type:"error",body:K.message||i("SKILLS_GENERIC_ERROR")})}}async function I({slug:H,name:K,description:O,instructions:R}
1){if(!c.value)return null;n.value=!0;try{return await kl({slug:H,name:K,description:O,instructions:R})??null}catch(B){return l.value=B.message,re({type:"error",body:B.message||i("SKILLS_GENERATE_ERROR")}),null}finally{n.value=!1}}function y(){s.value=[],r.value=!1,d.value=null,l.value=null}return{skills:s,loading:e,saving:t,generating:n,error:l,skillModalVisible:r,editingSkill:d,loadSkills:h,openCreateSkill:b,openEditSkill:E,closeSkillModal:k,saveSkill:C,removeSkill:v,draftInstructions:I,reset:y}}),yl={key:0,class:"flex flex-wrap gap-2 mb-3"},Tl=["onClick"],wl={key:1,class:"text-red-500 text-xs mb-2"},Sl={class:"relative flex flex-col gap-1.5 border border-carbon-25 rounded-2xl px-3 py-2.5 bg-white shadow-around focus-within:border-carbon-100 focus-within:ring-4 focus-within:ring-carbon-100/5 transition-all"},Il={key:0,"data-test":"skills-picker",class:"absolute bottom-full left-0 mb-2 w-full max-w-md rounded-lg border border-carbon-25 bg-white shadow-lg overflow-hidden z-20"},Ll={class:"px-3 pt-2 pb-1 text-[10px] uppercase tracking-wide text-carbon-50"},Cl={class:"max-h-56 overflow-y-auto pb-1"},Al=["onMousedown","onFocus"],$l={class:"block text-sm font-medium text-carbon-100"},Rl={key:0,class:"block text-xs text-carbon-50 truncate"},Nl={class:"block"},Ol=["placeholder"],Ml={class:"flex items-center gap-2"},Dl=["disabled"],Fl=["disabled","aria-label"],Pl={class:"ml-auto flex items-center gap-2"},zl=["aria-label"],Ul=["disabled"],Bl={key:2,class:"flex flex-wrap gap-2 mt-3"},Hl=["disabled"],Wl=["disabled"],jl=["disabled"],Gl={class:"p-5 flex flex-col gap-4"},Vl={class:"flex flex-col gap-1.5"},Kl={class:"text-16 font-semibold text-carbon-100"},ql={class:"text-13 text-carbon-75 leading-relaxed"},Yl={class:"flex justify-end gap-2"},Zl={class:"hidden"},Xl=["accept"],Ql=200,rs={__name:"ChatInput",props:{welcome:{type:Boolean,default:!1}},setup(s){const e=He(),t=In(),n=We(),l=S(""),r=S(null),d=S(null),u=S(!1),c=S([]),h=D(()=>t.skills),b=il(l,h);function E(){const $=d.value;$&&($.style.height="auto",$.style.height=`${Math.min($.scrollHeight,Ql)}px`)}pe(l,()=>Wt(E)),pe(()=>e.prefillText,$=>{var z;$!=null&&(l.value=$,e.setPrefill(null),(z=d.value)==null||z.focus())}),fe(()=>{t.skills.length||t.loadSkills(),E()});const k=D(()=>l.value.trim().length>0);function C($){if(b.onKeydown($,d.value)){$.preventDefault();return}if($.key==="Escape"&&e.thinking){$.preventDefault(),e.cancel();return}$.key==="Enter"&&!$.shiftKey&&($.preventDefault(),H())}function v(){b.refresh(d.value)}function I(){b.refresh(d.value)}function y($){b.applySkill(d.value,$)}async function H(){if(!k.value)return;b.close();const $=l.value;l.value="",await e.sendMessage($)}function K(){var $;($=r.value)==null||$.click()}function O(){var $;e.thinking||(l.value.startsWith("/")||(l.value=`/${l.value}`),($=d.value)==null||$.focus(),Wt(()=>b.refresh(d.value)))}function R(){t.openCreateSkill()}function B($){const z=Array.from($.target.files||[]).filter(W=>e.attachFile(W));$.target.value="",e.activeMatterId!=null&&z.length&&(c.value=z,u.value=!0)}function j(){u.value=!1,c.value=[]}async function ie(){const $=e.activeMatterId,z=c.value;if(j(),$!=null)for(const W of z)await n.addFileToMatter($,W)}return($,z)=>(p(),m("div",{class:ne(["px-4 shrink-0 min-h-[75px] flex flex-col justify-center",{"pb-4":!s.welcome}])},[a(e).pendingFiles.length?(p(),m("div",yl,[(p(!0),m(X,null,oe(a(e).pendingFiles,(W,Z)=>(p(),m("span",{key:W.name,class:"flex items-center gap-1 bg-carbon-5 text-carbon-75 text-xs rounded-full px-3 py-1"},[G(_(W.name)+" ",1),o("button",{type:"button",class:"ml-1 text-carbon-50 hover:text-carbon-100 leading-none",onClick:ye=>a(e).removeFile(Z)}," × ",8,Tl)]))),128))])):N("",!0),a(e).error?(p(),m("p",wl,_(a(e).error),1)):N("",!0),o("div",Sl,[a(b).open.value&&a(b).filtered.value.length?(p(),m("div",Il,[o("p",Ll,_(a(i)("SKILLS_PICKER_HINT")),1),o("ul",Cl,[(p(!0),m(X,null,oe(a(b).filtered.value,(W,Z)=>(p(),m("li",{key:W.id},[o("button",{type:"button","data-test":"skills-picker-item",class:ne(["w-full text-left px-3 py-2 hover:bg-carbon-5",Z===a(b).activeIndex.value?"bg-carbon-5":""]),onMousedown:_e(ye=>y(W),["prevent"]),onFocus:ye=>a(b).activeIndex.value=Z},[o("span",$l,"/"+_(W.slug),1),W.description?(p(),m("span",Rl,_(W.description),1)):N("",!0)],42,Al)]))),128))])])):N("",!0),o("label",Nl,[z[2]||(z[2]=o("span",{class:"sr-only"},"Consulta legal",-1)),Ue(o("textarea",{ref_key:"textareaRef",ref:d,"onUpdate:modelValue":z[0]||(z[0]=W=>l.value=W),rows:"1",class:"w-full resize-none overflow-y-auto min-h-[24px] max-h-[200px] leading-relaxed px-1 pt-0.5 bg-transparent border-0 outline-none text-14 text-carbon-100 placeholder:text-carbon-50 disabled:opacity-40",placeholder:a(i)("HAUSS_INTELLIGENCE_PLACEHOLDER"),onKeydown:C,onInput:v,onKeyup:I,onClick:I},null,40,Ol),[[Be,l.value]])]),o("div",Ml,[s.welcome?N("",!0):(p(),m("button",{key:0,t
1ype:"button",class:"text-carbon-50 hover:text-carbon-75 shrink-0 disabled:opacity-40 transition-colors",disabled:a(e).thinking,"aria-label":"Adjuntar archivo",onClick:K},z[3]||(z[3]=[o("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.486L20.5 13"})],-1)]),8,Dl)),s.welcome?N("",!0):(p(),m("button",{key:1,type:"button","data-test":"btn-use-skill",class:"text-carbon-50 hover:text-carbon-75 shrink-0 disabled:opacity-40 transition-colors",disabled:a(e).thinking,"aria-label":a(i)("TWIN_CHIP_USE_SKILL"),onClick:O},[T(a(M),{icon:"checklist",size:20,area:20})],8,Fl)),o("div",Pl,[T(ol),T(Za),a(e).thinking?(p(),m("button",{key:0,"data-testid":"stop-button",type:"button",class:"px-4 py-1.5 rounded-full border border-carbon-25 text-carbon-75 font-bold text-14 shrink-0 transition hover:bg-carbon-5","aria-label":a(i)("TWIN_STOP_ARIA"),onClick:z[1]||(z[1]=W=>a(e).cancel())},_(a(i)("TWIN_STOP")),9,zl)):(p(),m("button",{key:1,"data-testid":"send-button",type:"button",class:"px-4 py-1.5 rounded-full bg-dark text-white font-bold text-14 disabled:opacity-40 shrink-0 transition hover:bg-carbon-100",disabled:!k.value,onClick:H},_(a(i)("HAUSS_INTELLIGENCE_SEND")),9,Ul))])])]),s.welcome?(p(),m("div",Bl,[o("button",{type:"button","data-test":"chip-create-skill",class:"inline-flex items-center gap-1.5 rounded-full border border-carbon-25 bg-white px-3 py-1.5 text-13 text-carbon-75 hover:bg-carbon-5 hover:border-carbon-50 transition-colors disabled:opacity-40",disabled:a(e).thinking,onClick:R},[T(a(M),{icon:"plus",size:16,area:20}),G(" "+_(a(i)("TWIN_CHIP_CREATE_SKILL")),1)],8,Hl),o("button",{type:"button","data-test":"chip-use-skill",class:"inline-flex items-center gap-1.5 rounded-full border border-carbon-25 bg-white px-3 py-1.5 text-13 text-carbon-75 hover:bg-carbon-5 hover:border-carbon-50 transition-colors disabled:opacity-40",disabled:a(e).thinking,onClick:O},[T(a(M),{icon:"checklist",size:16,area:20}),G(" "+_(a(i)("TWIN_CHIP_USE_SKILL")),1)],8,Wl),o("button",{type:"button","data-test":"chip-attach",class:"inline-flex items-center gap-1.5 rounded-full border border-carbon-25 bg-white px-3 py-1.5 text-13 text-carbon-75 hover:bg-carbon-5 hover:border-carbon-50 transition-colors disabled:opacity-40",disabled:a(e).thinking,onClick:K},[T(a(M),{icon:"file",size:16,area:20}),G(" "+_(a(i)("TWIN_CHIP_ATTACH")),1)],8,jl),T(Os,{chip:""})])):N("",!0),u.value?(p(),ae(ya,{key:3,"max-width":"30rem",testid:"matter-save-file-modal",onClose:j},{default:$e(()=>[o("div",Gl,[o("div",Vl,[o("h3",Kl,_(a(i)("MATTER_SAVE_FILE_TITLE")),1),o("p",ql,_(a(i)("MATTER_SAVE_FILE_BODY")),1)]),o("div",Yl,[o("button",{type:"button","data-test":"matter-save-only-chat",class:"px-3 py-2 rounded-lg border border-carbon-25 text-13 text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:j},_(a(i)("MATTER_SAVE_FILE_ONLY_CHAT")),1),o("button",{type:"button","data-test":"matter-save-also-matter",class:"px-3 py-2 rounded-lg bg-carbon-100 text-white text-13 font-medium hover:opacity-90 transition-opacity",onClick:ie},_(a(i)("MATTER_SAVE_FILE_ALSO_MATTER")),1)])])]),_:1})):N("",!0),o("label",Zl,[z[4]||(z[4]=o("span",null,"Adjuntar archivo",-1)),o("input",{ref_key:"fileInputRef",ref:r,type:"file",multiple:"",accept:a(As),onChange:B},null,40,Xl)])],2))}},Jl=["width","height"],eo=["mask"],Ln={__name:"AmbarTwinMark",props:{size:{type:Number,default:24}},setup(s){const e=`ambar-twin-cut-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID().slice(0,8):Math.floor(performance.now())}`;return(t,n)=>(p(),m("svg",{width:s.size,height:s.size,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true"},[o("defs",null,[o("mask",{id:e,maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24"},n[0]||(n[0]=[o("rect",{x:"0",y:"0",width:"24",height:"24",fill:"#fff"},null,-1),o("circle",{cx:"9.14",cy:"9.99",r:"3.64",fill:"none",stroke:"#000","stroke-width":"3"},null,-1),o("path",{d:"M2.9 21.95 A6.5 6.5 0 0 1 15.9 21.95",fill:"none",stroke:"#000","stroke-width":"3","stroke-linecap":"round"},null,-1)]))]),o("g",{mask:`url(#${e}
1)`,fill:"currentColor","fill-opacity":"0.45"},n[1]||(n[1]=[o("rect",{x:"12.78",y:"4.79",width:"6.76",height:"6.76",rx:"1.82"},null,-1),o("path",{d:"M16.16 4.79 L16.16 2.45",fill:"none",stroke:"currentColor","stroke-opacity":"0.45","stroke-width":"1.6","stroke-linecap":"round"},null,-1),o("circle",{cx:"16.16",cy:"1.67",r:"1.17"},null,-1),o("path",{d:"M10.18 19.87 A5.98 5.98 0 0 1 22.14 19.87 Z"},null,-1)]),8,eo),n[2]||(n[2]=o("g",{fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},[o("circle",{cx:"9.14",cy:"9.99",r:"3.64"}),o("path",{d:"M2.9 21.95 A6.5 6.5 0 0 1 15.9 21.95"})],-1))],8,Jl))}};/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:Ms,setPrototypeOf:is,isFrozen:to,getPrototypeOf:no,getOwnPropertyDescriptor:so}=Object;let{freeze:ve,seal:Se,create:gn}=Object,{apply:xn,construct:vn}=typeof Reflect<"u"&&Reflect;ve||(ve=function(e){return e});Se||(Se=function(e){return e});xn||(xn=function(e,t){for(var n=arguments.length,l=new Array(n>2?n-2:0),r=2;r<n;r++)l[r-2]=arguments[r];return e.apply(t,l)});vn||(vn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return new e(...n)});const Pt=Ee(Array.prototype.forEach),ao=Ee(Array.prototype.lastIndexOf),cs=Ee(Array.prototype.pop),vt=Ee(Array.prototype.push),lo=Ee(Array.prototype.splice),Ht=Ee(String.prototype.toLowerCase),cn=Ee(String.prototype.toString),un=Ee(String.prototype.match),Et=Ee(String.prototype.replace),oo=Ee(String.prototype.indexOf),ro=Ee(String.prototype.trim),Ae=Ee(Object.prototype.hasOwnProperty),xe=Ee(RegExp.prototype.test),kt=io(TypeError);function Ee(s){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,n=new Array(t>1?t-1:0),l=1;l<t;l++)n[l-1]=arguments[l];return xn(s,e,n)}}function io(s){return function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return vn(s,t)}}function q(s,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ht;is&&is(s,null);let n=e.length;for(;n--;){let l=e[n];if(typeof l=="string"){const r=t(l);r!==l&&(to(e)||(e[n]=r),l=r)}s[l]=!0}return s}function co(s){for(let e=0;e<s.length;e++)Ae(s,e)||(s[e]=null);return s}function Pe(s){const e=gn(null);for(const[t,n]of Ms(s))Ae(s,t)&&(Array.isArray(n)?e[t]=co(n):n&&typeof n=="object"&&n.constructor===Object?e[t]=Pe(n):e[t]=n);return e}function yt(s,e){for(;s!==null;){const n=so(s,e);if(n){if(n.get)return Ee(n.get);if(typeof n.value=="function")return Ee(n.value)}s=no(s)}function t(){return null}return t}const us=ve(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),dn=ve(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),pn=ve
1(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),uo=ve(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fn=ve(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),po=ve(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),ds=ve(["#text"]),ps=ve(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),hn=ve(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),fs=ve(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","
1subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),zt=ve(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),fo=Se(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ho=Se(/<%[\w\W]*|[\w\W]*%>/gm),bo=Se(/\$\{[\w\W]*/gm),_o=Se(/^data-[\-\w.\u00B7-\uFFFF]+$/),mo=Se(/^aria-[\-\w]+$/),Ds=Se(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),go=Se(/^(?:\w+script|data):/i),xo=Se(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Fs=Se(/^html$/i),vo=Se(/^[a-z][.\w]*(-[.\w]+)+$/i);var hs=Object.freeze({__proto__:null,ARIA_ATTR:mo,ATTR_WHITESPACE:xo,CUSTOM_ELEMENT:vo,DATA_ATTR:_o,DOCTYPE_NAME:Fs,ERB_EXPR:ho,IS_ALLOWED_URI:Ds,IS_SCRIPT_OR_DATA:go,MUSTACHE_EXPR:fo,TMPLIT_EXPR:bo});const Tt={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Eo=function(){return typeof window>"u"?null:window},ko=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let n=null;const l="data-tt-policy-suffix";t&&t.hasAttribute(l)&&(n=t.getAttribute(l));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},bs=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ps(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Eo();const e=U=>Ps(U);if(e.version="3.3.1",e.removed=[],!s||!s.document||s.document.nodeType!==Tt.document||!s.Element)return e.isSupported=!1,e;let{document:t}=s;const n=t,l=n.currentScript,{DocumentFragment:r,HTMLTemplateElement:d,Node:u,Element:c,NodeFilter:h,NamedNodeMap:b=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:E,DOMParser:k,trustedTypes:C}=s,v=c.prototype,I=yt(v,"cloneNode"),y=yt(v,"remove"),H=yt(v,"nextSibling"),K=yt(v,"childNodes"),O=yt(v,"parentNode");if(typeof d=="function"){const U=t.createElement("template");U.content&&U.content.ownerDocument&&(t=U.content.ownerDocument)}let R,B="";const{implementation:j,createNodeIterator:ie,createDocumentFragment:$,getElementsByTagName:z}=t,{importNode:W}=n;let Z=bs();e.isSupported=typeof Ms=="function"&&typeof O=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ye,ERB_EXPR:ge,TMPLIT_EXPR:Oe,DATA_ATTR:tt,ARIA_ATTR:je,IS_SCRIPT_OR_DATA:nt,ATTR_WHITESPACE:Me,CUSTOM_ELEMENT:Ge}=hs;let{IS_ALLOWED_URI:Le}=hs,se=null;const Ce=q({},[...us,...dn,...pn,...fn,...ds]);let J=null;const Xe=q({},[...ps,...hn,...fs,...zt]);let ee=Object.seal(gn(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ve=null;const we=Object.seal(gn(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let x=!0,g=!0,w=!1,A=!0,P=!1,V=!0,ce=!1,mt=!1,Jt=!1,it=!1,$t=!1,Rt=!1,Un=!0,Bn=!1;const Ys="user-content-";let en=!0,gt=!1,ct={},De=null;const tn=q({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Hn=null;const Wn=q({},["audio","video","img","source","image","track"]);let nn=null;const jn=q({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Nt="http://www.w3.org/1998/Math/MathML",Ot="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let ut=Ke,sn=!1,an=null;const Zs=q({},[Nt,Ot,Ke],cn);let Mt=q({},["mi","mo","mn","ms","mtext"]),Dt=q({},["annotation-xml"]);const Xs=q({},["title","style","font","a","script"]);let xt=null;const Qs=["application/xhtml+xml","text/html"],Js="text/html";let de=null,dt=null;const ea=t.createElement("form"),Gn=function(f){return f instanceof RegExp||f instanceof Function},ln=function(){let f=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(dt&&dt===f)){if((!f||typeof f!="object")&&(f={}
vendor: 4,980 bytes, line 1
1),f=Pe(f),xt=Qs.indexOf(f.PARSER_MEDIA_TYPE)===-1?Js:f.PARSER_MEDIA_TYPE,de=xt==="application/xhtml+xml"?cn:Ht,se=Ae(f,"ALLOWED_TAGS")?q({},f.ALLOWED_TAGS,de):Ce,J=Ae(f,"ALLOWED_ATTR")?q({},f.ALLOWED_ATTR,de):Xe,an=Ae(f,"ALLOWED_NAMESPACES")?q({},f.ALLOWED_NAMESPACES,cn):Zs,nn=Ae(f,"ADD_URI_SAFE_ATTR")?q(Pe(jn),f.ADD_URI_SAFE_ATTR,de):jn,Hn=Ae(f,"ADD_DATA_URI_TAGS")?q(Pe(Wn),f.ADD_DATA_URI_TAGS,de):Wn,De=Ae(f,"FORBID_CONTENTS")?q({},f.FORBID_CONTENTS,de):tn,Te=Ae(f,"FORBID_TAGS")?q({},f.FORBID_TAGS,de):Pe({}),Ve=Ae(f,"FORBID_ATTR")?q({},f.FORBID_ATTR,de):Pe({}),ct=Ae(f,"USE_PROFILES")?f.USE_PROFILES:!1,x=f.ALLOW_ARIA_ATTR!==!1,g=f.ALLOW_DATA_ATTR!==!1,w=f.ALLOW_UNKNOWN_PROTOCOLS||!1,A=f.ALLOW_SELF_CLOSE_IN_ATTR!==!1,P=f.SAFE_FOR_TEMPLATES||!1,V=f.SAFE_FOR_XML!==!1,ce=f.WHOLE_DOCUMENT||!1,it=f.RETURN_DOM||!1,$t=f.RETURN_DOM_FRAGMENT||!1,Rt=f.RETURN_TRUSTED_TYPE||!1,Jt=f.FORCE_BODY||!1,Un=f.SANITIZE_DOM!==!1,Bn=f.SANITIZE_NAMED_PROPS||!1,en=f.KEEP_CONTENT!==!1,gt=f.IN_PLACE||!1,Le=f.ALLOWED_URI_REGEXP||Ds,ut=f.NAMESPACE||Ke,Mt=f.MATHML_TEXT_INTEGRATION_POINTS||Mt,Dt=f.HTML_INTEGRATION_POINTS||Dt,ee=f.CUSTOM_ELEMENT_HANDLING||{},f.CUSTOM_ELEMENT_HANDLING&&Gn(f.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=f.CUSTOM_ELEMENT_HANDLING.tagNameCheck),f.CUSTOM_ELEMENT_HANDLING&&Gn(f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=f.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),f.CUSTOM_ELEMENT_HANDLING&&typeof f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=f.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),P&&(g=!1),$t&&(it=!0),ct&&(se=q({},ds),J=[],ct.html===!0&&(q(se,us),q(J,ps)),ct.svg===!0&&(q(se,dn),q(J,hn),q(J,zt)),ct.svgFilters===!0&&(q(se,pn),q(J,hn),q(J,zt)),ct.mathMl===!0&&(q(se,fn),q(J,fs),q(J,zt))),f.ADD_TAGS&&(typeof f.ADD_TAGS=="function"?we.tagCheck=f.ADD_TAGS:(se===Ce&&(se=Pe(se)),q(se,f.ADD_TAGS,de))),f.ADD_ATTR&&(typeof f.ADD_ATTR=="function"?we.attributeCheck=f.ADD_ATTR:(J===Xe&&(J=Pe(J)),q(J,f.ADD_ATTR,de))),f.ADD_URI_SAFE_ATTR&&q(nn,f.ADD_URI_SAFE_ATTR,de),f.FORBID_CONTENTS&&(De===tn&&(De=Pe(De)),q(De,f.FORBID_CONTENTS,de)),f.ADD_FORBID_CONTENTS&&(De===tn&&(De=Pe(De)),q(De,f.ADD_FORBID_CONTENTS,de)),en&&(se["#text"]=!0),ce&&q(se,["html","head","body"]),se.table&&(q(se,["tbody"]),delete Te.tbody),f.TRUSTED_TYPES_POLICY){if(typeof f.TRUSTED_TYPES_POLICY.createHTML!="function")throw kt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof f.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw kt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');R=f.TRUSTED_TYPES_POLICY,B=R.createHTML("")}else R===void 0&&(R=ko(C,l)),R!==null&&typeof B=="string"&&(B=R.createHTML(""));ve&&ve(f),dt=f}},Vn=q({},[...dn,...pn,...uo]),Kn=q({},[...fn,...po]),ta=function(f){let L=O(f);(!L||!L.tagName)&&(L={namespaceURI:ut,tagName:"template"});const F=Ht(f.tagName),le=Ht(L.tagName);return an[f.namespaceURI]?f.namespaceURI===Ot?L.namespaceURI===Ke?F==="svg":L.namespaceURI===Nt?F==="svg"&&(le==="annotation-xml"||Mt[le]):!!Vn[F]:f.namespaceURI===Nt?L.namespaceURI===Ke?F==="math":L.namespaceURI===Ot?F==="math"&&Dt[le]:!!Kn[F]:f.namespaceURI===Ke?L.namespaceURI===Ot&&!Dt[le]||L.namespaceURI===Nt&&!Mt[le]?!1:!Kn[F]&&(Xs[F]||!Vn[F]):!!(xt==="application/xhtml+xml"&&an[f.namespaceURI]):!1},Fe=function(f){vt(e.removed,{element:f});try{O(f).removeChild(f)}catch{y(f)}},st=function(f,L){try{vt(e.removed,{attribute:L.getAttributeNode(f),from:L})}catch{vt(e.removed,{attribute:null,from:L})}if(L.removeAttribute(f),f==="is")if(it||$t)try{Fe(L)}catch{}else try{L.setAttribute(f,"")}catch{}},qn=function(f){let L=null,F=null;if(Jt)f="<remove></remove>"+f;else{const ue=un(f,/^[\r\n\t ]+/);F=ue&&ue[0]}xt==="application/xhtml+xml"&&ut===Ke&&(f='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+f+"</body></html>");const le=R?R.createHTML(f):f;if(ut===Ke)try{L=new k().parseFromString(le,xt)}catch{}if(!L||!L.documentElement){L=j.createDocument(ut,"template",null);try{L.documentElement.innerHTML=sn?B:le}catch{}}const be=L.body||L.documentElement;return f&&F&&be.insertBefore(t.createTextNode(F),be.childNodes[0]||null),ut===Ke?z.call(L,ce?"html":"body")[0]:ce?L.documentElement:be},Yn=function(f){return ie.call(f.ownerDocument||f,f,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},on=function(f){return f instanceof E&&(typeof f.nodeName!="string"||typeof f.textContent!="string"||typeof f.removeChild!="function"||!(f.attributes instanceof b)||typeof f.removeAttribute!="function"||typeof f.setAttribute!="function"||typeof f.namespaceURI!="string"||typeof f.insertBefore!="function"||typeof f.hasChildNodes!="function")},Zn=function(f){return typeof u=="function"&&f instanceof u};function qe(U,f,L){Pt(U,F=>{F.call(e,f,L,dt)})}const Xn=function(f){let L=null;if(qe(Z.beforeSanitizeElements,f,null),on(f))return Fe(f),!0;
vendor: 6,435 bytes, lines 1-2
1const F=de(f.nodeName);if(qe(Z.uponSanitizeElement,f,{tagName:F,allowedTags:se}),V&&f.hasChildNodes()&&!Zn(f.firstElementChild)&&xe(/<[/\w!]/g,f.innerHTML)&&xe(/<[/\w!]/g,f.textContent)||f.nodeType===Tt.progressingInstruction||V&&f.nodeType===Tt.comment&&xe(/<[/\w]/g,f.data))return Fe(f),!0;if(!(we.tagCheck instanceof Function&&we.tagCheck(F))&&(!se[F]||Te[F])){if(!Te[F]&&Jn(F)&&(ee.tagNameCheck instanceof RegExp&&xe(ee.tagNameCheck,F)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(F)))return!1;if(en&&!De[F]){const le=O(f)||f.parentNode,be=K(f)||f.childNodes;if(be&&le){const ue=be.length;for(let ke=ue-1;ke>=0;--ke){const Ye=I(be[ke],!0);Ye.__removalCount=(f.__removalCount||0)+1,le.insertBefore(Ye,H(f))}}}return Fe(f),!0}return f instanceof c&&!ta(f)||(F==="noscript"||F==="noembed"||F==="noframes")&&xe(/<\/no(script|embed|frames)/i,f.innerHTML)?(Fe(f),!0):(P&&f.nodeType===Tt.text&&(L=f.textContent,Pt([ye,ge,Oe],le=>{L=Et(L,le," ")}),f.textContent!==L&&(vt(e.removed,{element:f.cloneNode()}),f.textContent=L)),qe(Z.afterSanitizeElements,f,null),!1)},Qn=function(f,L,F){if(Un&&(L==="id"||L==="name")&&(F in t||F in ea))return!1;if(!(g&&!Ve[L]&&xe(tt,L))){if(!(x&&xe(je,L))){if(!(we.attributeCheck instanceof Function&&we.attributeCheck(L,f))){if(!J[L]||Ve[L]){if(!(Jn(f)&&(ee.tagNameCheck instanceof RegExp&&xe(ee.tagNameCheck,f)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(f))&&(ee.attributeNameCheck instanceof RegExp&&xe(ee.attributeNameCheck,L)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(L,f))||L==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&xe(ee.tagNameCheck,F)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(F))))return!1}else if(!nn[L]){if(!xe(Le,Et(F,Me,""))){if(!((L==="src"||L==="xlink:href"||L==="href")&&f!=="script"&&oo(F,"data:")===0&&Hn[f])){if(!(w&&!xe(nt,Et(F,Me,"")))){if(F)return!1}}}}}}}return!0},Jn=function(f){return f!=="annotation-xml"&&un(f,Ge)},es=function(f){qe(Z.beforeSanitizeAttributes,f,null);const{attributes:L}=f;if(!L||on(f))return;const F={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let le=L.length;for(;le--;){const be=L[le],{name:ue,namespaceURI:ke,value:Ye}=be,pt=de(ue),rn=Ye;let he=ue==="value"?rn:ro(rn);if(F.attrName=pt,F.attrValue=he,F.keepAttr=!0,F.forceKeepAttr=void 0,qe(Z.uponSanitizeAttribute,f,F),he=F.attrValue,Bn&&(pt==="id"||pt==="name")&&(st(ue,f),he=Ys+he),V&&xe(/((--!?|])>)|<\/(style|title|textarea)/i,he)){st(ue,f);continue}if(pt==="attributename"&&un(he,"href")){st(ue,f);continue}if(F.forceKeepAttr)continue;if(!F.keepAttr){st(ue,f);continue}if(!A&&xe(/\/>/i,he)){st(ue,f);continue}P&&Pt([ye,ge,Oe],ns=>{he=Et(he,ns," ")});const ts=de(f.nodeName);if(!Qn(ts,pt,he)){st(ue,f);continue}if(R&&typeof C=="object"&&typeof C.getAttributeType=="function"&&!ke)switch(C.getAttributeType(ts,pt)){case"TrustedHTML":{he=R.createHTML(he);break}case"TrustedScriptURL":{he=R.createScriptURL(he);break}}if(he!==rn)try{ke?f.setAttributeNS(ke,ue,he):f.setAttribute(ue,he),on(f)?Fe(f):cs(e.removed)}catch{st(ue,f)}}qe(Z.afterSanitizeAttributes,f,null)},na=function U(f){let L=null;const F=Yn(f);for(qe(Z.beforeSanitizeShadowDOM,f,null);L=F.nextNode();)qe(Z.uponSanitizeShadowNode,L,null),Xn(L),es(L),L.content instanceof r&&U(L.content);qe(Z.afterSanitizeShadowDOM,f,null)};return e.sanitize=function(U){let f=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},L=null,F=null,le=null,be=null;if(sn=!U,sn&&(U="<!-->"),typeof U!="string"&&!Zn(U))if(typeof U.toString=="function"){if(U=U.toString(),typeof U!="string")throw kt("dirty is not a string, aborting")}else throw kt("toString is not a function");if(!e.isSupported)return U;if(mt||ln(f),e.removed=[],typeof U=="string"&&(gt=!1),gt){if(U.nodeName){const Ye=de(U.nodeName);if(!se[Ye]||Te[Ye])throw kt("root node is forbidden and cannot be sanitized in-place")}}else if(U instanceof u)L=qn("<!---->"),F=L.ownerDocument.importNode(U,!0),F.nodeType===Tt.element&&F.nodeName==="BODY"||F.nodeName==="HTML"?L=F:L.appendChild(F);else{if(!it&&!P&&!ce&&U.indexOf("<")===-1)return R&&Rt?R.createHTML(U):U;if(L=qn(U),!L)return it?null:Rt?B:""}L&&Jt&&Fe(L.firstChild);const ue=Yn(gt?U:L);for(;le=ue.nextNode();)Xn(le),es(le),le.content instanceof r&&na(le.content);if(gt)return U;if(it){if($t)for(be=$.call(L.ownerDocument);L.firstChild;)be.appendChild(L.firstChild);else be=L;return(J.shadowroot||J.shadowrootmode)&&(be=W.call(n,be,!0)),be}let ke=ce?L.outerHTML:L.innerHTML;return ce&&se["!doctype"]&&L.ownerDocument&&L.ownerDocument.doctype&&L.ownerDocument.doctype.name&&xe(Fs,L.ownerDocument.doctype.name)&&(ke="<!DOCTYPE "+L.ownerDocument.doctype.name+`>
2`+ke),P&&Pt([ye,ge,Oe],Ye=>{ke=Et(ke,Ye," ")}),R&&Rt?R.createHTML(ke):ke},e.setConfig=function(){let U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ln(U),mt=!0},e.clearConfig=function(){dt=null,mt=!1},e.isValidAttribute=function(U,f,L){dt||ln({});const F=de(U),le=de(f);return Qn(F,le,L)},e.addHook=function(U,f){typeof f=="function"&&vt(Z[U],f)},e.removeHook=function(U,f){if(f!==void 0){const L=ao(Z[U],f);return L===-1?void 0:lo(Z[U],L,1)[0]}return cs(Z[U])},e.removeHooks=function(U){Z[U]=[]},e.removeAllHooks=function(){Z=bs()},e}var yo=Ps();function Cn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var rt=Cn();function zs(s){rt=s}var at={exec:()=>null};function ft(s){let e=[];return t=>{let n=Math.max(0,Math.min(3,t-1)),l=e[n];return l||(l=s(n),e[n]=l),l}}function Y(s,e=""){let t=typeof s=="string"?s:s.source,n={replace:(l,r)=>{let d=typeof r=="string"?r:r.source;return d=d.replace(me.caret,"$1"),t=t.replace(l,d),n},getRegex:()=>new RegExp(t,e)};return n}var To=((s="")=>{try{return!!new RegExp("(?<=1)(?<!1)"+s)}catch{return!1}})(),me={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine
vendor: 6,699 bytes, lines 2-3
2:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[	 ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:ft(s=>new RegExp(`^ {0,${s}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`)),hrRegex:ft(s=>new RegExp(`^ {0,${s}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:ft(s=>new RegExp(`^ {0,${s}}(?:\`\`\`|~~~)`)),headingBeginRegex:ft(s=>new RegExp(`^ {0,${s}}#`)),htmlBeginRegex:ft(s=>new RegExp(`^ {0,${s}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:ft(s=>new RegExp(`^ {0,${s}}>`))},wo=/^(?:[ \t]*(?:\n|$))+/,So=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Io=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ct=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Lo=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,An=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Us=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Bs=Y(Us).replace(/bull/g,An).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Co=Y(Us).replace(/bull/g,An).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),$n=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ao=/^[^\n]+/,Rn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,$o=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Rn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ro=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,An).getRegex(),Zt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Nn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,No=Y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))","i").replace("comment",Nn).replace("tag",Zt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Hs=Y($n).replace("hr",Ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Zt).getRegex(),Oo=Y(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Hs).getRegex(),On={blockquote:Oo,code:So,def:$o,fences:Io,heading:Lo,hr:Ct,html:No,lheading:Bs,list:Ro,newline:wo,paragraph:Hs,table:at,text:Ao},_s=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}	)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Zt).getRegex(),Mo={...On,lheading:Co,table:_s,paragraph:Y($n).replace("hr",Ct).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_s).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Zt).getRegex()},Do={...On,html:Y(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Nn).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:at,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y($n).replace("hr",Ct).replace("heading",` *#{1,6} *[^
3]`).replace("lheading",Bs).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Fo=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Po=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ws=/^( {2,}|\\)\n(?!\s*$)/,zo=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_t=/[\p{P}\p{S}]/u,Xt=/[\s\p{P}\p{S}]/u,Mn=/[^\s\p{P}\p{S}]/u,Uo=Y(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Xt).getRegex(),js=/(?!~)[\p{P}\p{S}]/u,Bo=/(?!~)[\s\p{P}\p{S}]/u,Ho=/(?:[^\s\p{P}\p{S}]|~)/u,Wo=Y(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("prec
3ode-",To?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Gs=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,jo=Y(Gs,"u").replace(/punct/g,_t).getRegex(),Go=Y(Gs,"u").replace(/punct/g,js).getRegex(),Vs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Vo=Y(Vs,"gu").replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,Xt).replace(/punct/g,_t).getRegex(),Ko=Y(Vs,"gu").replace(/notPunctSpace/g,Ho).replace(/punctSpace/g,Bo).replace(/punct/g,js).getRegex(),qo=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,Xt).replace(/punct/g,_t).getRegex(),Yo=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,_t).getRegex(),Zo="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Xo=Y(Zo,"gu").replace(/notPunctSpace/g,Mn).replace(/punctSpace/g,Xt).replace(/punct/g,_t).getRegex(),Qo=Y(/\\(punct)/,"gu").replace(/punct/g,_t).getRegex(),Jo=Y(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),er=Y(Nn).replace("(?:-->|$)","-->").getRegex(),tr=Y("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",er).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Gt=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,nr=Y(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Gt).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ks=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",Gt).replace("ref",Rn).getRegex(),qs=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",Rn).getRegex(),sr=Y("reflink|nolink(?!\\()","g").replace("reflink",Ks).replace("nolink",qs).getRegex(),ms=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Dn={_backpedal:at,anyPunctuation:Qo,autolink:Jo,blockSkip:Wo,br:Ws,code:Po,del:at,delLDelim:at,delRDelim:at,emStrongLDelim:jo,emStrongRDelimAst:Vo,emStrongRDelimUnd:qo,escape:Fo,link:nr,nolink:qs,punctuation:Uo,reflink:Ks,reflinkSearch:sr,tag:tr,text:zo,url:at},ar={...Dn,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",Gt).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Gt).getRegex()},En={...Dn,emStrongRDelimAst:Ko,emStrongLDelim:Go,delLDelim:Yo,delRDelim:Xo,url:Y(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ms).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Y(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ms).getRegex()},lr={...En,br:Y(Ws).replace("{2,}","*").getRegex(),text:Y(En.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ut={normal:On,gfm:Mo,pedantic:Do},wt={normal:Dn,gfm:En,breaks:lr,pedantic:ar},or={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},gs=s=>or[s];function ze(s,e){if(e){if(me.escapeTest.test(s))return s.replace(me.escapeReplace,gs)}else if(me.escapeTestNoEncode.test(s))return s.replace(me.escapeReplaceNoEncode,gs);return s}function xs(s){try{s=encodeURI(s).replace(me.percentDecode,"%")}catch{return null}return s}function vs(s,e){var r;let t=s.replace(me.findPipe,(d,u,c)=>{let h=!1,b=u;for(;--b>
vendor: 12,733 bytes, lines 3-32
3=0&&c[b]==="\\";)h=!h;return h?"|":" |"}),n=t.split(me.splitPipe),l=0;if(n[0].trim()||n.shift(),n.length>0&&!((r=n.at(-1))!=null&&r.trim())&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;l<n.length;l++)n[l]=n[l].trim().replace(me.slashPipe,"|");return n}function Qe(s,e,t){let n=s.length;if(n===0)return"";let l=0;for(;l<n;){let r=s.charAt(n-l-1);if(r===e&&!t)l++;else if(r!==e&&t)l++;else break}return s.slice(0,n-l)}function Es(s){let e=s.split(`
4`),t=e.length-1;for(;t>=0&&me.blankLine.test(e[t]);)t--;return e.length-t<=2?s:e.slice(0,t+1).join(`
5`)}function rr(s,e){if(s.indexOf(e[1])===-1)return-1;let t=0;for(let n=0;n<s.length;n++)if(s[n]==="\\")n++;else if(s[n]===e[0])t++;else if(s[n]===e[1]&&(t--,t<0))return n;return t>0?-2:-1}function ir(s,e=0){let t=e,n="";for(let l of s)if(l==="	"){let r=4-t%4;n+=" ".repeat(r),t+=r}else n+=l,t++;return n}function ks(s,e,t,n,l){let r=e.href,d=e.title||null,u=s[1].replace(l.other.outputLinkReplace,"$1");n.state.inLink=!0;let c={type:s[0].charAt(0)==="!"?"image":"link",raw:t,href:r,title:d,text:u,tokens:n.inlineTokens(u)};return n.state.inLink=!1,c}function cr(s,e,t){let n=s.match(t.other.indentCodeCompensation);if(n===null)return e;let l=n[1];return e.split(`
6`).map(r=>{let d=r.match(t.other.beginningSpace);if(d===null)return r;let[u]=d;return u.length>=l.length?r.slice(l.length):r}).join(`
7`)}var Vt=class{constructor(s){te(this,"options");te(this,"rules");te(this,"lexer");this.options=s||rt}space(s){let e=this.rules.block.newline.exec(s);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(s){let e=this.rules.block.code.exec(s);if(e){let t=this.options.pedantic?e[0]:Es(e[0]),n=t.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t,codeBlockStyle:"indented",text:n}}}fences(s){let e=this.rules.block.fences.exec(s);if(e){let t=e[0],n=cr(t,e[3]||"",this.rules);return{type:"code",raw:t,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(s){let e=this.rules.block.heading.exec(s);if(e){let t=e[2].trim();if(this.rules.other.endingHash.test(t)){let n=Qe(t,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceChar.test(n))&&(t=n.trim())}return{type:"heading",raw:Qe(e[0],`
8`),depth:e[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(s){let e=this.rules.block.hr.exec(s);if(e)return{type:"hr",raw:Qe(e[0],`
9`)}}blockquote(s){let e=this.rules.block.blockquote.exec(s);if(e){let t=Qe(e[0],`
10`).split(`
11`),n="",l="",r=[];for(;t.length>0;){let d=!1,u=[],c;for(c=0;c<t.length;c++)if(this.rules.other.blockquoteStart.test(t[c]))u.push(t[c]),d=!0;else if(!d)u.push(t[c]);else break;t=t.slice(c);let h=u.join(`
12`),b=h.replace(this.rules.other.blockquoteSetextReplace,`
13    $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
14${h}`:h,l=l?`${l}
15${b}`:b;let E=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,r,!0),this.lexer.state.top=E,t.length===0)break;let k=r.at(-1);if((k==null?void 0:k.type)==="code")break;if((k==null?void 0:k.type)==="blockquote"){let C=k,v=C.raw+`
16`+t.join(`
17`),I=this.blockquote(v);r[r.length-1]=I,n=n.substring(0,n.length-C.raw.length)+I.raw,l=l.substring(0,l.length-C.text.length)+I.text;break}else if((k==null?void 0:k.type)==="list"){let C=k,v=C.raw+`
18`+t.join(`
19`),I=this.list(v);r[r.length-1]=I,n=n.substring(0,n.length-k.raw.length)+I.raw,l=l.substring(0,l.length-C.raw.length)+I.raw,t=v.substring(r.at(-1).raw.length).split(`
20`);continue}}return{type:"blockquote",raw:n,tokens:r,text:l}}}list(s){let e=this.rules.block.list.exec(s);if(e){let t=e[1].trim(),n=t.length>1,l={type:"list",raw:"",ordered:n,start:n?+t.slice(0,-1):"",loose:!1,items:[]};t=n?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=n?t:"[*+-]");let r=this.rules.other.listItemRegex(t),d=!1;for(;s;){let c=!1,h="",b="";if(!(e=r.exec(s))||this.rules.block.hr.test(s))break;h=e[0],s=s.substring(h.length);let E=ir(e[2].split(`
21`,1)[0],e[1].length),k=s.split(`
22`,1)[0],C=!E.trim(),v=0;if(this.options.pedantic?(v=2,b=E.trimStart()):C?v=e[1].length+1:(v=E.search(this.rules.other.nonSpaceChar),v=v>4?1:v,b=E.slice(v),v+=e[1].length),C&&this.rules.other.blankLine.test(k)&&(h+=k+`
23`,s=s.substring(k.length+1),c=!0),!c){let I=this.rules.other.nextBulletRegex(v),y=this.rules.other.hrRegex(v),H=this.rules.other.fencesBeginRegex(v),K=this.rules.other.headingBeginRegex(v),O=this.rules.other.htmlBeginRegex(v),R=this.rules.other.blockquoteBeginRegex(v);for(;s;){let B=s.split(`
24`,1)[0],j;if(k=B,this.options.pedantic?(k=k.replace(this.rules.other.listReplaceNesting,"  "),j=k):j=k.replace(this.rules.other.tabCharGlobal,"    "),H.test(k)||K.test(k)||O.test(k)||R.test(k)||I.test(k)||y.test(k))break;if(j.search(this.rules.other.nonSpaceChar)>=v||!k.trim())b+=`
25`+j.slice(v);else{if(C||E.replace(this.rules.other.tabCharGlobal,"    ").search(this.rules.other.nonSpaceChar)>=4||H.test(E)||K.test(E)||y.test(E))break;b+=`
26`+k}C=!k.trim(),h+=B+`
27`,s=s.substring(B.length+1),E=j.slice(v)}}l.loose||(d?l.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(d=!0)),l.items.push({type:"list_item",raw:h,task:!!this.options.gfm&&this.rules.other.listIsTask.test(b),loose:!1,text:b,tokens:[]}),l.raw+=h}let u=l.items.at(-1);if(u)u.raw=u.raw.trimEnd(),u.text=u.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let c of l.items){this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]);let h=c.tokens[0];if(c.task&&((h==null?void 0:h.type)==="text"||(h==null?void 0:h.type)==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let E=this.lexer.inlineQueue.length-1;E>=0;E--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[E].src)){this.lexer.inlineQueue[E].src=this.lexer.inlineQueue[E].src.replace(this.rules.other.listReplaceTask,"");break}let b=this.rules.other.listTaskCheckbox.exec(c.raw);if(b){let E={type:"checkbox",raw:b[0]+" ",checked:b[0]!=="[ ]"};c.checked=E.checked,l.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=E.raw+c.tokens[0].raw,c.tokens[0].text=E.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(E)):c.tokens.unshift({type:"paragraph",raw:E.raw,text:E.raw,tokens:[E]}):c.tokens.unshift(E)}}else c.task&&(c.task=!1);if(!l.loose){let b=c.tokens.filter(k=>k.type==="space"),E=b.length>0&&b.some(k=>this.rules.other.anyLine.test(k.raw));l.loose=E}}if(l.loose)for(let c of l.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return l}}html(s){let e=this.rules.block.html.exec(s);if(e){let t=Es(e[0]);return{type:"html",block:!0,raw:t,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:t}}}def(s){let e=this.rules.block.def.exec(s);if(e){let t=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:t,raw:Qe(e[0],`
28`),href:n,title:l}}}table(s){var d;let e=this.rules.block.table.exec(s);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let t=vs(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(d=e[3])!=null&&d.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
29`):[],r={type:"table",raw:Qe(e[0],`
30`),header:[],align:[],rows:[]};if(t.length===n.length){for(let u of n)this.rules.other.tableAlignRight.test(u)?r.align.push("right"):this.rules.other.tableAlignCenter.test(u)?r.align.push("center"):this.rules.other.tableAlignLeft.test(u)?r.align.push("left"):r.align.push(null);for(let u=0;u<t.length;u++)r.header.push({text:t[u],tokens:this.lexer.inline(t[u]),header:!0,align:r.align[u]});for(let u of l)r.rows.push(vs(u,r.header.length).map((c,h)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:r.align[h]})));return r}}lheading(s){let e=this.rules.block.lheading.exec(s);if(e){let t=e[1].trim();return{type:"heading",raw:Qe(e[0],`
31`),depth:e[2].charAt(0)==="="?1:2,text:t,tokens:this.lexer.inline(t)}}}paragraph(s){let e=this.rules.block.paragraph.exec(s);if(e){let t=e[1].charAt(e[1].length-1)===`
32`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:t,tokens:this.lexer.inline(t)}}}text(s){let e=this.rules.block.text.exec(s);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(s){let e=this.rules.inline.escape.exec(s);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(s){let e=this.rules.inline.tag.exec(s);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(s){let e=this.rules.inline.link.exec(s);if(e){let t=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;let r=Qe(t.slice(0,-1),"\\");if((t.length-r.length)%2===0)return}else{let r=rr(e[2],"()");if(r===-2)return;if(r>-1){let d=(e[0].indexOf("!")===0?5:4)+e[1].length+r;e[2]=e[2].substring(0,r),e[0]=e[0].substring(0,d).trim(),e[3]=""}}let n=e[2],l="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(n);r&&(n=r[1],l=r[3])}else l=e[3]?e[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?n=n.slice(1):n=n.slice(1,-1)),ks(e,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(s,e){let t;if((t=this.rules.inline.reflink.exec(s))||(t=this.rules.inline.nolink.exec(s))){let n=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=e[n.toLowerCase()];if(!l){let r=t[0].charAt(0);return{type:"text",raw:r,text:r}}return ks(t,l,t[0],this.lexer,this.rules)}}emStrong(s,e,t=""){let n=this.rules.inline.emStrongLDelim.exec(s);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&t.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!t||this.rules.inline.punctuation.exec(t))){let l=[...n[0]].length-1,r,d,u=l,c=0,h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,e=e.slice(-1*s.length+l);(n=h.exec(e))!==null;){if(r=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!r)continue;if(d=[...r].length,n[3]||n[4]){u+=d;continue}else if((n[5]||n[6])&&l%3&&!((l+d)%3)){c+=d;continue}if(u-=d,u>0)continue;d=Math.min(d,d+u+c);let b=[...n[0]][0].length,E=s.slice(0,l+n.index+b+d);if(Math.min(l,d)%2){let C=E.slice(1,-1);return{type:"em",raw:E,text:C,tokens:this.lexer.inlineTokens(C)}}let k=E.slice(2,-2);return{type:"strong",raw:E,text:k,tokens:this.lexer.inlineTokens(k)}}}}codespan(s){let e=this.rules.inline.code.exec(s);if(e){let t=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(t),l=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return n&&l&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:e[0],text:t}}}br(s){let e=this.rules.inline.br.exec(s);if(e)return{type:"br",raw:e[0]}}del(s,e,t=""){let n=this.rules.inline.delLDelim.exec(s);if(n&&(!n[1]||!t||this.rules.inline.punctuation.exec(t))){let l=[...n[0]].length-1,r,d,u=l,c=this.rules.inline.delRDelim;for(c.lastIndex=0,e=e.slice(-1*s.length+l);(n=c.exec(e))!==null;){if(r=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!r||(d=[...r].length,d!==l))continue;if(n[3]||n[4]){u+=d;continue}if(u-=d,u>0)continue;d=Math.min(d,d+u);let h=[...n[0]][0].length,b=s.slice(0,l+n.index+h+d),E=b.slice(l,-l);return{type:"del",raw:b,text:E,tokens:this.lexer.inlineTokens(E)}}}}autolink(s){let e=this.rules.inline.autolink.exec(s);if(e){let t,n;return e[2]==="@"?(t=e[1],n="mailto:"+t):(t=e[1],n=t),{type:"link",raw:e[0],text:t,href:n,tokens:[{type:"text",raw:t,text:t}]}}}url(s){var t;let e;if(e=this.rules.inline.url.exec(s)){let n,l;if(e[2]==="@")n=e[0],l="mailto:"+n;else{let r;do r=e[0],e[0]=((t=this.rules.inline._backpedal.exec(e[0]))==null?void 0:t[0])??"";while(r!==e[0]);n=e[0],e[1]==="www."?l="http://"+e[0]:l=e[0]}return{type:"link",raw:e[0],text:n,href:l,tokens:[{type:"text",raw:n,text:n}]}}}inlineText(s){let e=this.rules.inline.text.exec(s);if(e){let t=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:t}}}}
vendor: 14,601 bytes, lines 32-64
32,Re=class kn{constructor(e){te(this,"tokens");te(this,"options");te(this,"state");te(this,"inlineQueue");te(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||rt,this.options.tokenizer=this.options.tokenizer||new Vt,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:me,block:Ut.normal,inline:wt.normal};this.options.pedantic?(t.block=Ut.pedantic,t.inline=wt.pedantic):this.options.gfm&&(t.block=Ut.gfm,this.options.breaks?t.inline=wt.breaks:t.inline=wt.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ut,inline:wt}}static lex(e,t){return new kn(t).lex(e)}static lexInline(e,t){return new kn(t).inlineTokens(e)}lex(e){e=e.replace(me.carriageReturn,`
33`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let n=this.inlineQueue[t];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){var r,d,u;this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(me.tabCharGlobal,"    ").replace(me.spaceLine,""));let l=1/0;for(;e;){if(e.length<l)l=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let c;if((d=(r=this.options.extensions)==null?void 0:r.block)!=null&&d.some(b=>(c=b.call({lexer:this},e,t))?(e=e.substring(c.raw.length),t.push(c),!0):!1))continue;if(c=this.tokenizer.space(e)){e=e.substring(c.raw.length);let b=t.at(-1);c.raw.length===1&&b!==void 0?b.raw+=`
34`:t.push(c);continue}if(c=this.tokenizer.code(e)){e=e.substring(c.raw.length);let b=t.at(-1);(b==null?void 0:b.type)==="paragraph"||(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
35`)?"":`
36`)+c.raw,b.text+=`
37`+c.text,this.inlineQueue.at(-1).src=b.text):t.push(c);continue}if(c=this.tokenizer.fences(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.heading(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.hr(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.blockquote(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.list(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.html(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.def(e)){e=e.substring(c.raw.length);let b=t.at(-1);(b==null?void 0:b.type)==="paragraph"||(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
38`)?"":`
39`)+c.raw,b.text+=`
40`+c.raw,this.inlineQueue.at(-1).src=b.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},t.push(c));continue}if(c=this.tokenizer.table(e)){e=e.substring(c.raw.length),t.push(c);continue}if(c=this.tokenizer.lheading(e)){e=e.substring(c.raw.length),t.push(c);continue}let h=e;if((u=this.options.extensions)!=null&&u.startBlock){let b=1/0,E=e.slice(1),k;this.options.extensions.startBlock.forEach(C=>{k=C.call({lexer:this},E),typeof k=="number"&&k>=0&&(b=Math.min(b,k))}),b<1/0&&b>=0&&(h=e.substring(0,b+1))}if(this.state.top&&(c=this.tokenizer.paragraph(h))){let b=t.at(-1);n&&(b==null?void 0:b.type)==="paragraph"?(b.raw+=(b.raw.endsWith(`
41`)?"":`
42`)+c.raw,b.text+=`
43`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=b.text):t.push(c),n=h.length!==e.length,e=e.substring(c.raw.length);continue}if(c=this.tokenizer.text(e)){e=e.substring(c.raw.length);let b=t.at(-1);(b==null?void 0:b.type)==="text"?(b.raw+=(b.raw.endsWith(`
44`)?"":`
45`)+c.raw,b.text+=`
46`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=b.text):t.push(c);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){var h,b,E,k,C;this.tokenizer.lexer=this;let n=e,l=null;if(this.tokens.links){let v=Object.keys(this.tokens.links);if(v.length>0)for(;(l=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)v.includes(l[0].slice(l[0].lastIndexOf("[")+1,-1))&&(n=n.slice(0,l.index)+"["+"a".repeat(l[0].length-2)+"]"+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(l=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,l.index)+"++"+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let r;for(;(l=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)r=l[2]?l[2].length:0,n=n.slice(0,l.index+r)+"["+"a".repeat(l[0].length-r-2)+"]"+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=((b=(h=this.options.hooks)==null?void 0:h.emStrongMask)==null?void 0:b.call({lexer:this},n))??n;let d=!1,u="",c=1/0;for(;e;){if(e.length<c)c=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}d||(u=""),d=!1;let v;if((k=(E=this.options.extensions)==null?void 0:E.inline)!=null&&k.some(y=>(v=y.call({lexer:this},e,t))?(e=e.substring(v.raw.length),t.push(v),!0):!1))continue;if(v=this.tokenizer.escape(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.tag(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.link(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(v.raw.length);let y=t.at(-1);v.type==="text"&&(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):t.push(v);continue}if(v=this.tokenizer.emStrong(e,n,u)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.codespan(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.br(e)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.del(e,n,u)){e=e.substring(v.raw.length),t.push(v);continue}if(v=this.tokenizer.autolink(e)){e=e.substring(v.raw.length),t.push(v);continue}if(!this.state.inLink&&(v=this.tokenizer.url(e))){e=e.substring(v.raw.length),t.push(v);continue}let I=e;if((C=this.options.extensions)!=null&&C.startInline){let y=1/0,H=e.slice(1),K;this.options.extensions.startInline.forEach(O=>{K=O.call({lexer:this},H),typeof K=="number"&&K>=0&&(y=Math.min(y,K))}),y<1/0&&y>=0&&(I=e.substring(0,y+1))}if(v=this.tokenizer.inlineText(I)){e=e.substring(v.raw.length),v.raw.slice(-1)!=="_"&&(u=v.raw.slice(-1)),d=!0;let y=t.at(-1);(y==null?void 0:y.type)==="text"?(y.raw+=v.raw,y.text+=v.text):t.push(v);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw new Error(t)}},Kt=class{constructor(s){te(this,"options");te(this,"parser");this.options=s||rt}space(s){return""}code({text:s,lang:e,escaped:t}){var r;let n=(r=(e||"").match(me.notSpaceStart))==null?void 0:r[0],l=s.replace(me.endingNewline,"")+`
47`;return n?'<pre><code class="language-'+ze(n)+'">'+(t?l:ze(l,!0))+`</code></pre>
48`:"<pre><code>"+(t?l:ze(l,!0))+`</code></pre>
49`}blockquote({tokens:s}){return`<blockquote>
50${this.parser.parse(s)}</blockquote>
51`}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:e}){return`<h${e}>${this.parser.parseInline(s)}</h${e}>
52`}hr(s){return`<hr>
53`}list(s){let e=s.ordered,t=s.start,n="";for(let d=0;d<s.items.length;d++){let u=s.items[d];n+=this.listitem(u)}let l=e?"ol":"ul",r=e&&t!==1?' start="'+t+'"':"";return"<"+l+r+`>
54`+n+"</"+l+`>
55`}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
56`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
57`}table(s){let e="",t="";for(let l=0;l<s.header.length;l++)t+=this.tablecell(s.header[l]);e+=this.tablerow({text:t});let n="";for(let l=0;l<s.rows.length;l++){let r=s.rows[l];t="";for(let d=0;d<r.length;d++)t+=this.tablecell(r[d]);n+=this.tablerow({text:t})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
58<thead>
59`+e+`</thead>
60`+n+`</table>
61`}tablerow({text:s}){return`<tr>
62${s}</tr>
63`}tablecell(s){let e=this.parser.parseInline(s.tokens),t=s.header?"th":"td";return(s.align?`<${t} align="${s.align}">`:`<${t}>`)+e+`</${t}>
64`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${ze(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:e,tokens:t}){let n=this.parser.parseInline(t),l=xs(s);if(l===null)return n;s=l;let r='<a href="'+s+'"';return e&&(r+=' title="'+ze(e)+'"'),r+=">"+n+"</a>",r}image({href:s,title:e,text:t,tokens:n}){n&&(t=this.parser.parseInline(n,this.parser.textRenderer));let l=xs(s);if(l===null)return ze(t);s=l;let r=`<img src="${s}" alt="${ze(t)}"`;return e&&(r+=` title="${ze(e)}"`),r+=">",r}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:ze(s.text)}},Fn=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},Ne=class yn{constructor(e){te(this,"options");te(this,"renderer");te(this,"textRenderer");this.options=e||rt,this.options.renderer=this.options.renderer||new Kt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Fn}static parse(e,t){return new yn(t).parse(e)}static parseInline(e,t){return new yn(t).parseInline(e)}parse(e){var n,l;this.renderer.parser=this;let t="";for(let r=0;r<e.length;r++){let d=e[r];if((l=(n=this.options.extensions)==null?void 0:n.renderers)!=null&&l[d.type]){let c=d,h=this.options.extensions.renderers[c.type].call({parser:this},c);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(c.type)){t+=h||"";continue}}let u=d;switch(u.type){case"space":{t+=this.renderer.space(u);break}case"hr":{t+=this.renderer.hr(u);break}case"heading":{t+=this.renderer.heading(u);break}case"code":{t+=this.renderer.code(u);break}case"table":{t+=this.renderer.table(u);break}case"blockquote":{t+=this.renderer.blockquote(u);break}case"list":{t+=this.renderer.list(u);break}case"checkbox":{t+=this.renderer.checkbox(u);break}case"html":{t+=this.renderer.html(u);break}case"def":{t+=this.renderer.def(u);break}case"paragraph":{t+=this.renderer.paragraph(u);break}case"text":{t+=this.renderer.text(u);break}default:{let c='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return t}parseInline(e,t=this.renderer){var l,r;this.renderer.parser=this;let n="";for(let d=0;d<e.length;d++){let u=e[d];if((r=(l=this.options.extensions)==null?void 0:l.renderers)!=null&&r[u.type]){let h=this.options.extensions.renderers[u.type].call({parser:this},u);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)){n+=h||"";continue}}let c=u;switch(c.type){case"escape":{n+=t.text(c);break}case"html":{n+=t.html(c);break}case"link":{n+=t.link(c);break}case"image":{n+=t.image(c);break}case"checkbox":{n+=t.checkbox(c);break}case"strong":{n+=t.strong(c);break}case"em":{n+=t.em(c);break}case"codespan":{n+=t.codespan(c);break}case"br":{n+=t.br(c);break}case"del":{n+=t.del(c);break}case"text":{n+=t.text(c);break}default:{let h='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return n}},Bt,It=(Bt=class{constructor(s){te(this,"options");te(this,"block");this.options=s||rt}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(s=this.block){return s?Re.lex:Re.lexInline}provideParser(s=this.block){return s?Ne.parse:Ne.parseInline}},te(Bt,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),te(Bt,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),Bt),ur=class{constructor(...s){te(this,"defaults",Cn());te(this,"options",this.setOptions);te(this,"parse",this.parseMarkdown(!0));te(this,"parseInline",this.parseMarkdown(!1));te(this,"Parser",Ne);te(this,"Renderer",Kt);te(this,"TextRenderer",Fn);te(this,"Lexer",Re);te(this,"Tokenizer",Vt);te(this,"Hooks",It);this.use(...s)}walkTokens(s,e){var n,l;let t=[];for(let r of s)switch(t=t.concat(e.call(this,r)),r.type){case"table":{let d=r;for(let u of d.header)t=t.concat(this.walkTokens(u.tokens,e));for(let u of d.rows)for(let c of u)t=t.concat(this.walkTokens(c.tokens,e));break}case"list":{let d=r;t=t.concat(this.walkTokens(d.items,e));break}default:{let d=r;(l=(n=this.defaults.extensions)==null?void 0:n.childTokens)!=null&&l[d.type]?this.defaults.extensions.childTokens[d.type].forEach(u=>{let c=d[u].flat(1/0);t=t.concat(this.walkTokens(c,e))}):d.tokens&&(t=t.concat(this.walkTokens(d.tokens,e)))}}return t}use(...s){let e=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(t=>{let n={...t};if(n.async=this.defaults.async||n.async||!1,t.extensions&&(t.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){let r=e.renderers[l.name];r?e.renderers[l.name]=function(...d){let u=l.renderer.apply(this,d);return u===!1&&(u=r.apply(this,d)),u}:e.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=e[l.level];r?r.unshift(l.tokenizer):e[l.level]=[l.tokenizer],l.start&&(l.level==="block"?e.startBlock?e.startBlock.push(l.start):e.startBlock=[l.start]:l.level==="inline"&&(e.startInline?e.startInline.push(l.start):e.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(e.childTokens[l.name]=l.childTokens)}),n.extensions=e),t.renderer){let l=this.defaults.renderer||new Kt(this.defaults);for(let r in t.renderer){if(!(r in l))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let d=r,u=t.renderer[d],c=l[d];l[d]=(...h)=>{let b=u.apply(l,h);return b===!1&&(b=c.apply(l,h)),b||""}}n.renderer=l}if(t.tokenizer){let l=this.defaults.tokenizer||new Vt(this.defaults);for(let r in t.tokenizer){if(!(r in l))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let d=r,u=t.tokenizer[d],c=l[d];l[d]=(...h)=>{let b=u.apply(l,h);return b===!1&&(b=c.apply(l,h)),b}}n.tokenizer=l}if(t.hooks){let l=this.defaults.hooks||new It;for(let r in t.hooks){if(!(r in l))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let d=r,u=t.hooks[d],c=l[d];It.passThroughHooks.has(r)?l[d]=h=>{if(this.defaults.async&&It.passThroughHooksRespectAsync.has(r))return(async()=>{let E=await u.call(l,h);
64return c.call(l,E)})();let b=u.call(l,h);return c.call(l,b)}:l[d]=(...h)=>{if(this.defaults.async)return(async()=>{let E=await u.apply(l,h);return E===!1&&(E=await c.apply(l,h)),E})();let b=u.apply(l,h);return b===!1&&(b=c.apply(l,h)),b}}n.hooks=l}if(t.walkTokens){let l=this.defaults.walkTokens,r=t.walkTokens;n.walkTokens=function(d){let u=[];return u.push(r.call(this,d)),l&&(u=u.concat(l.call(this,d))),u}}this.defaults={...this.defaults,...n}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,e){return Re.lex(s,e??this.defaults)}parser(s,e){return Ne.parse(s,e??this.defaults)}parseMarkdown(s){return(e,t)=>{let n={...t},l={...this.defaults,...n},r=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&n.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(l.hooks&&(l.hooks.options=l,l.hooks.block=s),l.async)return(async()=>{let d=l.hooks?await l.hooks.preprocess(e):e,u=await(l.hooks?await l.hooks.provideLexer(s):s?Re.lex:Re.lexInline)(d,l),c=l.hooks?await l.hooks.processAllTokens(u):u;l.walkTokens&&await Promise.all(this.walkTokens(c,l.walkTokens));let h=await(l.hooks?await l.hooks.provideParser(s):s?Ne.parse:Ne.parseInline)(c,l);return l.hooks?await l.hooks.postprocess(h):h})().catch(r);try{l.hooks&&(e=l.hooks.preprocess(e));let d=(l.hooks?l.hooks.provideLexer(s):s?Re.lex:Re.lexInline)(e,l);l.hooks&&(d=l.hooks.processAllTokens(d)),l.walkTokens&&this.walkTokens(d,l.walkTokens);let u=(l.hooks?l.hooks.provideParser(s):s?Ne.parse:Ne.parseInline)(d,l);return l.hooks&&(u=l.hooks.postprocess(u)),u}catch(d){return r(d)}}}onError(s,e){return t=>{if(t.message+=`
65Please report this to https://github.com/markedjs/marked.`,s){let n="<p>An error occurred:</p><pre>"+ze(t.message+"",!0)+"</pre>";return e?Promise.resolve(n):n}if(e)return Promise.reject(t);throw t}}},lt=new ur;function Q(s,e){return lt.parse(s,e)}Q.options=Q.setOptions=function(s){return lt.setOptions(s),Q.defaults=lt.defaults,zs(Q.defaults),Q};Q.getDefaults=Cn;Q.defaults=rt;Q.use=function(...s){return lt.use(...s),Q.defaults=lt.defaults,zs(Q.defaults),Q};Q.walkTokens=function(s,e){return lt.walkTokens(s,e)};Q.parseInline=lt.parseInline;Q.Parser=Ne;Q.parser=Ne.parse;Q.Renderer=Kt;Q.TextRenderer=Fn;Q.Lexer=Re;Q.lexer=Re.lex;Q.Tokenizer=Vt;Q.Hooks=It;Q.parse=Q;Q.options;Q.setOptions;Q.use;Q.walkTokens;Q.parseInline;Ne.parse;Re.lex;function dr(s){return{html:D(()=>yo.sanitize(Q.parse(a(s)||"")))}}const pr=["innerHTML"],fr={__name:"MarkdownView",props:{content:{type:String,default:""}},setup(s){const e=s,{html:t}=dr(oa(e,"content"));return(n,l)=>(p(),m("div",{class:"hauss-md text-14 text-carbon-100",innerHTML:a(t)},null,8,pr))}},At=Sn(fr,[["__scopeId","data-v-2f0062d6"]]),hr={key:0,"data-testid":"user-bubble",class:"max-w-[70%] rounded-2xl px-4 py-3 bg-dark text-white text-14 flex flex-col gap-2"},br={key:0},_r={key:1,class:"flex flex-wrap gap-1.5"},mr={key:0,class:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},gr={key:1,class:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},xr={key:2,class:"w-3.5 h-3.5 shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},vr={class:"truncate max-w-[160px]"},Er={key:2,"data-test":"msg-queued",class:"text-11 text-white/60 italic"},kr={key:1,class:"flex gap-2.5 max-w-[88%] hauss-reveal"},yr={class:"w-6 h-6 mt-0.5 shrink-0 rounded-md bg-carbon-100 text-yellow flex items-center justify-center"},Tr={class:"min-w-0"},wr={key:0,class:"flex flex-col gap-1.5 mt-3"},Sr=["onClick"],Ir={class:"w-8 h-8 shrink-0 rounded-md bg-carbon-5 text-carbon-75 flex items-center justify-center"},Lr={class:"min-w-0 flex flex-col"},Cr={class:"text-13 font-medium text-carbon-100 truncate"},Ar={key:0,class:"text-11 text-carbon-50"},$r={class:"flex gap-1 mt-2"},Rr={__name:"ChatMessage",props:{role:{type:String,required:!0},content:{type:String,required:!0},attachments:{type:Array,default:()=>[]},files:{type:Array,default:()=>[]},queued:{type:Boolean,default:!1}},setup(s){const e=s,t=D(()=>e.role==="user");function n(u){He().downloadFile(u)}function l(u){return!u&&u!==0?"":u<1024?`${u} B`:u<1024*1024?`${Math.round(u/1024)} KB`:`${(u/(1024*1024)).toFixed(1)} MB`}function r(u){return u==="application/pdf"?"pdf":u.startsWith("image/")?"image":"file"}function d(){var u;(u=navigator.clipboard)==null||u.writeText(e.content||"")}return(u,c)=>(p(),m("div",{class:ne(["flex",t.value?"justify-end":"justify-start"])},[t.value?(p(),m("div",hr,[s.content?(p(),m("span",br,_(s.content),1)):N("",!0),s.attachments.length?(p(),m("div",_r,[(p(!0),m(X,null,oe(s.attachments,h=>(p(),m("span",{key:h.name,class:"flex items-center gap-1.5 bg-white/10 rounded-lg px-2.5 py-1 text-12 text-white/90"},[r(h.type)==="pdf"?(p(),m("svg",mr,c[0]||(c[0]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"},null,-1)]))):r(h.type)==="image"?(p(),m("svg",gr,c[1]||(c[1]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"},null,-1)]))):(p(),m("svg",xr,c[2]||(c[2]=[o("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15.172 7l-6.586 6.586a2 2 0 102.828 2.828l6.414-6.586a4 4 0 00-5.656-5.656l-6.415 6.585a6 6 0 108.486 8.48
656L20.5 13"},null,-1)]))),o("span",vr,_(h.name),1)]))),128))])):N("",!0),s.queued?(p(),m("span",Er,_(a(i)("TWIN_QUEUED_HINT")),1)):N("",!0)])):(p(),m("div",kr,[o("span",yr,[T(Ln,{size:12})]),o("div",Tr,[T(At,{"data-testid":"assistant-bubble",content:s.content},null,8,["content"]),s.files.length?(p(),m("div",wr,[(p(!0),m(X,null,oe(s.files,h=>(p(),m("button",{key:h.id,type:"button","data-test":"msg-download",class:"group flex items-center gap-2.5 self-start max-w-full rounded-lg border border-carbon-25 bg-white px-3 py-2 text-left hover:bg-carbon-5 hover:border-carbon-50 transition-colors",onClick:b=>n(h)},[o("span",Ir,[T(a(M),{icon:"file",size:16,area:20})]),o("span",Lr,[o("span",Cr,_(h.file_name),1),l(h.size_bytes)?(p(),m("span",Ar,_(l(h.size_bytes)),1)):N("",!0)]),T(a(M),{icon:"download",size:16,area:20,class:"ml-1 shrink-0 text-carbon-50 group-hover:text-carbon-100"})],8,Sr))),128))])):N("",!0),o("div",$r,[o("button",{type:"button","data-test":"msg-copy",class:"flex items-center gap-1.5 text-11 text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5 rounded-md px-2 py-1.5 transition-colors",onClick:d},[T(a(M),{icon:"copy",size:12,area:20}),G(" "+_(a(i)("HAUSS_MSG_COPY")),1)])])])]))],2))}},Nr=Sn(Rr,[["__scopeId","data-v-a854a9f3"]]),Or={class:"flex justify-start"},Mr={class:"flex flex-col gap-1 px-4 py-3 max-w-[80%]"},Dr={class:"text-xs text-carbon-50 italic whitespace-pre-wrap"},Fr={__name:"ChatThinking",props:{text:{type:String,default:""}},setup(s){const e=s,t=["TWIN_STATUS_ANALYZING","TWIN_STATUS_REVIEWING","TWIN_STATUS_DRAFTING","TWIN_STATUS_FINISHING"],n=S(0);let l=null;fe(()=>{l=setInterval(()=>{n.value=(n.value+1)%t.length},2500)}),ra(()=>{l&&clearInterval(l)});const r=D(()=>e.text||i(t[n.value]));return(d,u)=>(p(),m("div",Or,[o("div",Mr,[u[0]||(u[0]=o("div",{class:"flex items-center gap-1"},[o("span",{class:"w-2 h-2 rounded-full bg-carbon-50 animate-bounce",style:{"animation-delay":"0ms"}}),o("span",{class:"w-2 h-2 rounded-full bg-carbon-50 animate-bounce",style:{"animation-delay":"150ms"}}),o("span",{class:"w-2 h-2 rounded-full bg-carbon-50 animate-bounce",style:{"animation-delay":"300ms"}})],-1)),o("p",Dr,_(r.value),1)])]))}},Pr={__name:"ChatMessageList",props:{messages:{type:Array,required:!0},thinking:{type:Boolean,default:!1},thinkingText:{type:String,default:""}},setup(s){const e=s,t=S(null);let n=!1;function l(){const d=t.value;d&&(n=d.scrollTop+d.clientHeight<d.scrollHeight-50)}async function r(){if(n)return;await Wt();const d=t.value;d&&(d.scrollTop=d.scrollHeight)}return pe(()=>e.messages.length,r),pe(()=>e.thinking,r),pe(()=>e.thinkingText,r),(d,u)=>(p(),m("div",{ref_key:"listRef",ref:t,class:"flex-1 overflow-y-auto px-6 py-4 flex flex-col gap-4",onScroll:l},[(p(!0),m(X,null,oe(s.messages,(c,h)=>(p(),ae(Nr,{key:`${h}-${c.role}`,role:c.role,content:c.content,attachments:c.attachments,files:c.files,queued:c.queued},null,8,["role","content","attachments","files","queued"]))),128)),s.thinking?(p(),ae(Fr,{key:0,text:s.thinkingText},null,8,["text"])):N("",!0)],544))}},zr={xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 64 64",role:"img","aria-labelledby":"atl"};function Ur(s,e){return p(),m("svg",zr,e[0]||(e[0]=[Ts('<title id="ambar-twin-icon-light_svg__atl">Ambar Twin</title><defs><mask id="ambar-twin-icon-light_svg__atl-cut" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100"><rect x="0" y="0" width="100" height="100" fill="#fff"></rect><circle cx="38" cy="38" r="14" fill="none" stroke="#000" stroke-width="13"></circle><path d="M14 84 A25 25 0 0 1 64 84" fill="none" stroke="#000" stroke-width="13" stroke-linecap="round"></path></mask></defs><rect width="64" height="64" rx="14" fill="#FAEEDA"></rect><g transform="translate(9.95,11.41) scale(0.45)"><g mask="url(#ambar-twin-icon-light_svg__atl-cut)" fill="#BA7517" fill-opacity="0.42"><rect x="52" y="18" width="26" height="26" rx="7"></rect><path d="M65 18 L65 10" fill="none" stroke="#BA7517" stroke-opacity="0.42" stroke-width="4.5" stroke-linecap="round"></path><circle cx="65" cy="7" r="3.5"></circle><path d="M42 76 A23 23 0 0 1 88 76 Z"></path></g><g fill="none" stroke="#854F0B" stroke-width="5.5" stroke-linecap="round"><circle cx="38" cy="38" r="14"></circle><path d="M14 84 A25 25 0 0 1 64 84"></path></g></g>',4)]))}const Br={render:Ur},Hr={class:"w-full max-w-[640px] mx-auto flex flex-col items-center text-center"},Wr={class:"relative mb-6 flex items-center justify-center"},jr={class:"text-30 font-gt-super text-carbon-100 leading-tight mb-8"},Gr={__name:"ChatWelcome",setup(s){const e=Yt(),t=D(()=>{var l,r;return(((r=(l=e.data)==null?void 0:l.user)==null?void 0:r.givenName)??"").trim()}),n=D(()=>t.value?i("HAUSS_GREETING_NAMED",{name:t.value}):i("HAUSS_INTELLIGENCE_WELCOME_TITLE"));return(l,r)=>(p(),m("div",Hr,[o("div",Wr,[r[0]||(r[0]=o("div",{class:"absolute w-32 h-32 rounded-full opacity-70 blur-2xl",style:{background:"radial-gradient(circle, rgba(255,174,0,0.28), transparent 70%)"}},null,-1)),T(a(Br),{class:"relative w-20 h-20 rounded-2xl shadow-around"}
65)]),o("h2",jr,_(n.value),1)]))}},Vr={class:"flex flex-col flex-1 min-h-0 overflow-hidden"},Kr={key:1,class:"flex-1 flex flex-col items-center justify-center px-8"},qr={__name:"ChatArea",setup(s){const e=He(),t=We(),n=D(()=>{const l=e.threadContext;if(!l)return null;const r=t.clients.find(u=>u.id===l.clientId),d=t.mattersOf(l.clientId).find(u=>u.id===l.matterId);return{clientName:l.clientName||(r==null?void 0:r.name)||null,matterName:l.matterName||(d==null?void 0:d.name)||null}});return(l,r)=>(p(),m("div",Vr,[n.value?(p(),ae($a,{key:0,"client-name":n.value.clientName,"matter-name":n.value.matterName,onClear:r[0]||(r[0]=d=>a(e).setActiveContext(null,null))},null,8,["client-name","matter-name"])):N("",!0),a(e).messages.length===0&&!a(e).thinking?(p(),m("div",Kr,[T(Gr),T(rs,{welcome:"",class:"w-full max-w-[720px]"})])):(p(),m(X,{key:2},[T(Pr,{messages:a(e).messages,thinking:a(e).thinking,"thinking-text":a(e).thinkingText},null,8,["messages","thinking","thinking-text"]),T(rs)],64))]))}},Yr={xmlns:"http://www.w3.org/2000/svg",width:"64",height:"64",viewBox:"0 0 64 64",role:"img","aria-labelledby":"att"};function Zr(s,e){return p(),m("svg",Yr,e[0]||(e[0]=[Ts('<title id="ambar-twin-icon_svg__att">Ambar Twin</title><defs><mask id="ambar-twin-icon_svg__att-cut" maskUnits="userSpaceOnUse" x="0" y="0" width="100" height="100"><rect x="0" y="0" width="100" height="100" fill="#fff"></rect><circle cx="38" cy="38" r="14" fill="none" stroke="#000" stroke-width="19"></circle><path d="M14 84 A25 25 0 0 1 64 84" fill="none" stroke="#000" stroke-width="19" stroke-linecap="round"></path></mask></defs><rect width="64" height="64" rx="14" fill="#1C1B19"></rect><g transform="translate(9.95,11.41) scale(0.45)"><g mask="url(#ambar-twin-icon_svg__att-cut)" fill="#FFD9A0" fill-opacity="0.45"><rect x="52" y="18" width="26" height="26" rx="7"></rect><path d="M65 18 L65 10" fill="none" stroke="#FFD9A0" stroke-opacity="0.45" stroke-width="6" stroke-linecap="round"></path><circle cx="65" cy="7" r="3.5"></circle><path d="M42 76 A23 23 0 0 1 88 76 Z"></path></g><g fill="none" stroke="#F2A623" stroke-width="8" stroke-linecap="round"><circle cx="38" cy="38" r="14"></circle><path d="M14 84 A25 25 0 0 1 64 84"></path></g></g>',4)]))}const Xr={render:Zr},Qr={class:"text-xs text-carbon-50 mt-0.5"},Jr={__name:"ChatThreadItem",props:{chat:{type:Object,required:!0},active:{type:Boolean,default:!1}},emits:["open"],setup(s){const e=s,t=D(()=>new Date(e.chat.created_at).toLocaleDateString("es-ES",{day:"numeric",month:"short"}));return(n,l)=>(p(),m("button",{type:"button","data-test":"chat-thread",class:ne(["w-full text-left rounded-lg px-3 py-2 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-carbon-100/15",e.active?"bg-carbon-5 border-l-2 border-yellow":"hover:bg-carbon-5 border-l-2 border-transparent"]),onClick:l[0]||(l[0]=r=>n.$emit("open"))},[o("p",{class:ne(["truncate text-sm",e.active?"font-medium text-carbon-100":"text-carbon-75"])},_(e.chat.title||a(i)("HAUSS_INTELLIGENCE_NEW_CHAT")),3),o("p",Qr,_(t.value),1)],2))}}
65,ei={"data-test":"context-scan",class:"flex flex-col gap-4 rounded-lg border border-carbon-25 bg-carbon-5 px-4 py-5"},ti={class:"flex items-center gap-2.5"},ni={class:"w-8 h-8 rounded-lg bg-secondary-100 text-yellow-dark flex items-center justify-center shrink-0"},si={class:"text-sm font-medium text-carbon-100"},ai={class:"flex flex-col gap-2"},li={class:"shrink-0 w-4 flex items-center justify-center"},oi={key:1,class:"animate-spin h-3.5 w-3.5 text-carbon-50",viewBox:"0 0 24 24",fill:"none"},ri={key:2,class:"w-1.5 h-1.5 rounded-full bg-carbon-25"},ii={__name:"ContextScanAnimation",props:{name:{type:String,default:""}},setup(s){const e=s,t=D(()=>[i("CLIENTS_SCAN_STEP_1",{name:e.name||i("TWIN_NAV_CLIENTS")}),i("CLIENTS_SCAN_STEP_2"),i("CLIENTS_SCAN_STEP_3"),i("CLIENTS_SCAN_STEP_4")]),n=S(0);let l=null;return fe(()=>{l=setInterval(()=>{n.value<t.value.length-1&&(n.value+=1)},2200)}),Ie(()=>{l&&clearInterval(l)}),(r,d)=>(p(),m("div",ei,[o("div",ti,[o("span",ni,[T(a(M),{icon:"mail",size:16,area:20})]),o("span",si,_(a(i)("CLIENTS_SCAN_TITLE")),1)]),o("ul",ai,[(p(!0),m(X,null,oe(t.value,(u,c)=>(p(),m("li",{key:c,class:ne(["flex items-center gap-2 text-13 transition-colors",c<n.value?"text-carbon-75":c===n.value?"text-carbon-100 font-medium":"text-carbon-50"])},[o("span",li,[c<n.value?(p(),ae(a(M),{key:0,icon:"check",size:16,area:20,class:"text-yellow-dark"})):c===n.value?(p(),m("svg",oi,d[0]||(d[0]=[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(p(),m("span",ri))]),G(" "+_(u),1)],2))),128))]),d[1]||(d[1]=o("div",{class:"flex flex-col gap-2 pt-1"},[o("div",{class:"h-2.5 w-3/4 rounded shimmer"}),o("div",{class:"h-2.5 w-full rounded shimmer"}),o("div",{class:"h-2.5 w-5/6 rounded shimmer"})],-1))]))}},Pn=Sn(ii,[["__scopeId","data-v-bd0b4ed7"]]),ci={class:"bg-white rounded-2xl w-full max-w-[32rem] max-h-[85vh] flex flex-col overflow-hidden"},ui={class:"flex items-center justify-between px-5 py-4 border-b border-carbon-25"},di={class:"text-xl font-gt-super text-carbon-100"},pi=["disabled"],fi={class:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4"},hi={class:"flex flex-col gap-1"},bi={class:"text-sm font-medium text-carbon-100"},_i=["aria-label","placeholder"],mi={key:0,"data-test":"client-title-error",class:"text-xs text-red-500"},gi={key:1,class:"flex flex-col gap-3 rounded-lg border border-carbon-25 bg-carbon-5 px-4 py-4"},xi={class:"text-13 leading-relaxed text-carbon-75"},vi=["disabled"],Ei={key:2,class:"flex flex-col gap-1"},ki={class:"flex items-center justify-between"},yi={class:"text-sm font-medium text-carbon-100"},Ti={class:"flex items-center gap-3"},wi={class:"flex gap-1 text-xs"},Si={class:"relative"},Ii=["aria-label","placeholder"],Li={key:0,"data-test":"ctx-preview",class:"min-h-[9rem] rounded-lg border border-carbon-25 px-3 py-2 overflow-y-auto max-h-64"},Ci={key:0,class:"text-sm text-carbon-50"},Ai={class:"flex items-center justify-end gap-2 px-5 py-4 border-t border-carbon-25"},$i=["disabled"],Ri=["disabled"],Ni={__name:"ClientModal",setup(s){const e=We(),t=S(""),n=S(""),l=S(""),r=S("preview"),d=S(!1),u=D(()=>!e.editingClient);pe(()=>e.clientModalVisible,C=>{if(!C)return;const v=e.editingClient;t.value=(v==null?void 0:v.name)??"",n.value=(v==null?void 0:v.context)??"",l.value="",d.value=!u.value,r.value="preview"});const c=D(()=>!!t.value.trim()&&!e.savingClient&&!e.generating&&(!u.value||d.value));function h(){e.generating||e.closeClientModal()}async function b(){if(!c.value)return;await e.saveClient({name:t.value.trim(),description:null,context:n.value.trim()||null,rules:null})&&e.closeClientModal()}async function E(){if(!t.value.trim()){l.value=i("FORM_REQUIRED");return}l.value="";const C=await e.createClientContext({title:t.value.trim(),description:n.value.trim()||null});d.value=!0,C?(n.value=C,r.value="preview"):r.value="edit"}function k(C){C.key==="Escape"&&e.clientModalVisible&&h()}return fe(()=>window.addEventListener("keydown",k)),Ie(()=>window.removeEventListener("keydown",k)),(C,v)=>a(e).clientModalVisible?(p(),m("div",{key:0,"data-test":"client-modal",class:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"presentation",onClick:_e(h,["self"])},[o("div",ci,[o("header",ui,[o("h2",di,_(a(e).editingClient?a(i)("CLIENTS_EDIT_TITLE"):a(i)("CLIENTS_NEW_TITLE")),1),o("button",{type:"button","data-test":"client-close",class:"text-carbon-50 hover:text-carbon-100 disabled:opacity-40",disabled:a(e).generating,onClick:h}," ✕ ",8,pi)]),o("div",fi,[o("div",hi,[o("span",bi,_(a(i)("CLIENTS_FIELD_TITLE")),1),Ue(o("input",{"onUpdate:modelValue":v[0]||(v[0]=I=>
65t.value=I),type:"text","data-test":"client-title","aria-label":a(i)("CLIENTS_FIELD_TITLE"),class:ne(["rounded-lg border px-3 py-2 text-sm text-carbon-100 focus:outline-none",l.value?"border-red-400 focus:border-red-500":"border-carbon-25 focus:border-carbon-50"]),placeholder:a(i)("CLIENTS_FIELD_NAME_PLACEHOLDER"),onInput:v[1]||(v[1]=I=>l.value="")},null,42,_i),[[Be,t.value]]),l.value?(p(),m("span",mi,_(l.value),1)):N("",!0)]),a(e).generating?(p(),ae(Pn,{key:0,name:t.value},null,8,["name"])):u.value&&!d.value?(p(),m("div",gi,[o("p",xi,_(a(i)("CLIENTS_CONTEXT_EXPLAIN")),1),o("button",{type:"button","data-test":"client-generate",class:"self-start inline-flex items-center gap-2 text-13 font-medium rounded-lg bg-carbon-100 px-4 py-2 text-white hover:opacity-90 disabled:opacity-40",disabled:!t.value.trim(),onClick:E},[T(a(M),{icon:"search",size:16,area:20}),G(" "+_(a(i)("CLIENTS_CREATE_CONTEXT")),1)],8,vi)])):(p(),m("div",Ei,[o("div",ki,[o("span",yi,_(a(i)("CLIENTS_FIELD_DESCRIPTION")),1),o("div",Ti,[o("button",{type:"button","data-test":"client-regenerate",class:"inline-flex items-center gap-1 text-xs text-carbon-50 hover:text-carbon-100",onClick:E},[T(a(M),{icon:"refresh",size:12,area:20}),G(" "+_(a(i)("CLIENTS_CREATE_CONTEXT")),1)]),o("div",wi,[o("button",{type:"button","data-test":"ctx-tab-edit",class:ne(["px-2 py-1 rounded-md",r.value==="edit"?"bg-carbon-5 text-carbon-100":"text-carbon-50"]),onClick:v[2]||(v[2]=I=>r.value="edit")},_(a(i)("HAUSS_TAB_EDIT")),3),o("button",{type:"button","data-test":"ctx-tab-preview",class:ne(["px-2 py-1 rounded-md",r.value==="preview"?"bg-carbon-5 text-carbon-100":"text-carbon-50"]),onClick:v[3]||(v[3]=I=>r.value="preview")},_(a(i)("HAUSS_TAB_PREVIEW")),3)])])]),o("div",Si,[Ue(o("textarea",{"onUpdate:modelValue":v[4]||(v[4]=I=>n.value=I),rows:"6","data-test":"client-description","aria-label":a(i)("CLIENTS_FIELD_DESCRIPTION"),class:"w-full rounded-lg border border-carbon-25 px-3 py-2 text-sm text-carbon-100 resize-y focus:outline-none focus:border-carbon-50",placeholder:a(i)("CLIENTS_FIELD_CONTEXT_PLACEHOLDER")},null,8,Ii),[[ws,r.value==="edit"],[Be,n.value]]),r.value==="preview"?(p(),m("div",Li,[T(At,{content:n.value},null,8,["content"]),n.value.trim()?N("",!0):(p(),m("p",Ci,_(a(i)("CLIENTS_FIELD_CONTEXT_PLACEHOLDER")),1))])):N("",!0)])]))]),o("footer",Ai,[o("button",{type:"button",class:"rounded-lg border border-carbon-25 px-4 py-2 text-sm text-carbon-75 disabled:opacity-40",disabled:a(e).generating,onClick:h},_(a(i)("HAUSS_INTELLIGENCE_CLOSE")),9,$i),o("button",{type:"button","data-test":"client-save",class:"rounded-lg bg-primary-500 text-white px-4 py-2 text-sm disabled:opacity-50",disabled:!c.value,onClick:b},_(a(i)("CLIENTS_SAVE")),9,Ri)])])])):N("",!0)}},et=qt("twinView",()=>{const s=S("clients"),e=S(null),t=S(null);function n(){s.value="chat"}function l(){s.value="clients"}function r(c){e.value=c,s.value="client"}function d(c,h){e.value=c,t.value=h,s.value="matter"}function u(){s.value="skills"}return{view:s,activeClientId:e,activeMatterId:t,showChat:n,showClients:l,showClient:r,showMatter:d,showSkills:u}}),Oi={"data-test":"matter-row"},Mi=["aria-expanded","aria-label"],Di={class:"w-5 h-5 rounded-md bg-carbon-5 text-carbon-75 flex items-center justify-center shrink-0"},Fi={key:0,class:"ml-auto text-10 text-carbon-50 bg-carbon-5 rounded-full px-2 py-0.5 group-hover:hidden"},Pi=["aria-label"],zi=["aria-label"],Ui={key:0,class:"ml-3 border-l border-carbon-25 pl-2 flex flex-col gap-0.5"},Bi=["onClick"],Hi={key:0,class:"px-2 py-1 text-xs text-carbon-50"},Wi={__name:"MatterTreeItem",props:{client:{type:Object,required:!0},matter:{type:Object,required:!0}},emits:["request-delete"],setup(s,{emit:e}){const t=s,n=e,l=We(),r=He(),d=et();function u(){l.isMatterExpanded(t.matter.id)||l.toggleMatter(t.matter.id),d.showMatter(t.client.id,t.matter.id)}function c(h){r.openChat(h),d.showChat()}return(h,b)=>(p(),m("div",Oi,[o("div",{class:ne(["group flex items-center gap-1 px-2 rounded-lg hover:bg-carbon-5",a(r).activeMatterId===t.matter.id?"bg-carbon-5":""])},[o("button",{type:"button","data-test":"matter-toggle",class:"p-1 text-carbon-50 shrink-0 focus:outline-none","aria-expanded":String(a(l).isMatterExpanded(t.matter.id)),"aria-label":a(i)("CLIENTS_EXPAND"),onClick:b[0]||(b[0]=E=>a(l).toggleMatter(t.matter.id))},[T(a(M),{icon:"chevron-right",size:16,area:20,class:ne(["transition-transform duration-150",a(l).isMatterExpanded(t.matter.id)?"rotate-90":""])},null,8,["class"])],8,Mi),o("span",Di,[T(a(M),{icon:"case",size:12,area:20})]),o("button",{type:"button","data-test":"matter-open",class:ne(["flex-1 min-w-0 text-left py-1.5 truncate text-[13px] focus:outline-none",a(r).activeMatterId===t.matter.id?"text-carbon-100 font-medium":"text-carbon-75"]),onClick:u},_(t.matter.name),3),a(r).chatsOfMatter(t.matter.id).length?(p(),m("span",Fi,_(a(r).chatsOfMatter(t.matter.id).length),1)):N("",!0),o("button",{type:"button",class:"p-1 text-carbon-50 hover:text-carbon-100 hidden group-hover:flex shrink-0","aria-label":a(i)("CLIENTS_EDIT"),onClick:b[1]||(b[1]=E=>a(l).openEditMatter(t.matter))},[T(a(M),{icon:"pencil",size:16,area:20})],8,Pi),o("button",{type:"button",class:"p-1 text-carbon-50 hover:text-red-600 hidden group-hover:flex shrink-0","aria-label":a(i)("CLIENTS_DELETE"),onClick:b[2]||(b[2]=E=>n("request-delete",t.matter))},[T(a(M),{icon:"trash",size:16,area:20})],8,zi)],2),a(l).isMatterExpanded(t.matter.id)?(p(),m("div",Ui,[(p(!0),m(X,null,oe(a(r).chatsOfMatter(t.matter.id),E=>(p(),m("button",{key:E.id,type:"button","data-test":"matter-chat",class:ne(["w-full text-left rounded-lg px-2 py-1.5 text-[13px] truncate transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-carbon-100/15",E.id===a(r).chatId?"bg-carbon-5 font-medium text-carbon-100 border-l-2 border-yellow":"text-carbon-50 hover:bg-carbon-5 hover:text-carbon-100 border-l-2 border-transparent"]),onClick:k=>c(E.id)},_(E.title||a(i)("HAUSS_INTELLIGENCE_NEW_CHAT")),11,Bi))),128)),a(r).chatsOfMatter(t.matter.id).length?N("",!0):(p(),m("p",Hi,_(a(i)("MATTER_NO_CHATS")),1))])):N("",!0)]))}},ji={"data-test":"client-row"},Gi={class:"group flex items-center gap-1 px-2 rounded-lg hover:bg-carbon-5"},Vi=["aria-expanded","aria-label"],Ki={class:"w-5 h-5 rounded-md bg-carbon-5 text-carbon-75 flex items-center justify-center shrink-0"},qi={key:0,class:"ml-auto text-10 text-carbon-50 bg-carbon-5 rounded-full px-2 py-0.5 group-hover:hidden"}
65,Yi=["aria-label"],Zi=["aria-label"],Xi=["aria-label"],Qi={key:0,class:"ml-3 border-l border-carbon-25 pl-2"},Ji={key:0,"data-test":"no-matter",class:"px-2 py-1.5 text-xs text-carbon-50"},ec={__name:"ClientTreeItem",props:{client:{type:Object,required:!0}},emits:["request-delete-client","request-delete-matter"],setup(s,{emit:e}){const t=s,n=e,l=We(),r=et();return(d,u)=>(p(),m("div",ji,[o("div",Gi,[o("button",{type:"button","data-test":"client-toggle",class:"p-1 text-carbon-50 shrink-0","aria-expanded":String(a(l).isExpanded(t.client.id)),"aria-label":a(i)("CLIENTS_EXPAND"),onClick:u[0]||(u[0]=c=>a(l).toggleExpand(t.client.id))},[T(a(M),{icon:"chevron-right",size:16,area:20,class:ne(["transition-transform duration-150",a(l).isExpanded(t.client.id)?"rotate-90":""])},null,8,["class"])],8,Vi),o("span",Ki,[T(a(M),{icon:"company",size:12,area:20})]),o("button",{type:"button","data-test":"client-name",class:"flex-1 min-w-0 text-left py-2 truncate text-sm font-semibold text-carbon-100 focus:outline-none",onClick:u[1]||(u[1]=c=>a(r).showClient(t.client.id))},_(t.client.name),1),a(l).mattersOf(t.client.id).length?(p(),m("span",qi,_(a(l).mattersOf(t.client.id).length),1)):N("",!0),o("button",{type:"button","data-test":"client-add-matter",class:"p-1 text-carbon-50 hover:text-carbon-100 hidden group-hover:flex shrink-0","aria-label":a(i)("MATTERS_NEW"),onClick:u[2]||(u[2]=_e(c=>a(l).openCreateMatter(t.client.id),["stop"]))},[T(a(M),{icon:"plus",size:16,area:20})],8,Yi),o("button",{type:"button",class:"p-1 text-carbon-50 hover:text-carbon-100 hidden group-hover:flex shrink-0","aria-label":a(i)("CLIENTS_EDIT"),onClick:u[3]||(u[3]=c=>a(l).openEditClient(t.client))},[T(a(M),{icon:"pencil",size:16,area:20})],8,Zi),o("button",{type:"button",class:"p-1 text-carbon-50 hover:text-red-600 hidden group-hover:flex shrink-0","aria-label":a(i)("CLIENTS_DELETE"),onClick:u[4]||(u[4]=c=>n("request-delete-client",t.client))},[T(a(M),{icon:"trash",size:16,area:20})],8,Xi)]),a(l).isExpanded(t.client.id)?(p(),m("div",Qi,[(p(!0),m(X,null,oe(a(l).mattersOf(t.client.id),c=>(p(),ae(Wi,{key:c.id,client:t.client,matter:c,onRequestDelete:u[5]||(u[5]=h=>n("request-delete-matter",h))},null,8,["client","matter"]))),128)),a(l).mattersOf(t.client.id).length?N("",!0):(p(),m("p",Ji,_(a(i)("MATTERS_EMPTY")),1)),o("button",{type:"button","data-test":"matter-new",class:"w-full flex items-center gap-1 px-2 py-1.5 text-xs text-carbon-50 hover:bg-carbon-5 rounded-lg",onClick:u[6]||(u[6]=c=>a(l).openCreateMatter(t.client.id))},[T(a(M),{icon:"plus",size:12,area:20}),G(" "+_(a(i)("MATTERS_NEW")),1)])])):N("",!0)]))}},tc={class:"bg-white rounded-2xl w-full max-w-[32rem] max-h-[85vh] flex flex-col overflow-hidden"},nc={class:"flex items-center justify-between px-5 py-4 border-b border-carbon-25"},sc={class:"text-xl font-gt-super text-carbon-100"},ac=["disabled"],lc={class:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4"},oc={class:"flex flex-col gap-1"},rc={class:"text-sm font-medium text-carbon-100"},ic=["aria-label","placeholder"],cc={key:0,"data-test":"matter-title-error",class:"text-xs text-red-500"},uc={key:1,class:"flex flex-col gap-3 rounded-lg border border-carbon-25 bg-carbon-5 px-4 py-4"},dc={class:"text-13 leading-relaxed text-carbon-75"},pc=["disabled"],fc={key:2,class:"flex flex-col gap-1"},hc={class:"flex items-center justify-between"},bc={class:"text-sm font-medium text-carbon-100"},_c={class:"flex items-center gap-3"},mc={class:"flex gap-1 text-xs"},gc={class:"relative"},xc=["aria-label","placeholder"],vc={key:0,"data-test":"ctx-preview",class:"min-h-[9rem] rounded-lg border border-carbon-25 px-3 py-2 overflow-y-auto max-h-64"},Ec={key:0,class:"text-sm text-carbon-50"},kc={class:"flex flex-col gap-2"},yc={class:"flex items-center justify-between gap-2"},Tc={class:"text-sm font-medium text-carbon-100"},wc=["disabled"],Sc={class:"text-xs text-carbon-50"},Ic={class:"hidden"},Lc=["accept"],Cc={key:0,"data-test":"matter-files-error",class:"text-xs text-red-500"},Ac={key:1,class:"text-xs text-carbon-50"},$c={key:2,class:"flex flex-col gap-1.5"},Rc={class:"text-sm text-carbon-75 truncate"},Nc=["aria-label","onClick"],Oc={class:"text-sm text-carbon-75 truncate"},Mc=["aria-label","onClick"],Dc={key:3,class:"text-xs text-carbon-50"},Fc={class:"flex items-center justify-end gap-2 px-5 py-4 border-t border-carbon-25"},Pc=["disabled"],zc=["disabled"],bn=20,Uc={__name:"MatterModal",setup(s){const e=We(
65),t=S(""),n=S(""),l=S(""),r=S("preview"),d=S(!1),u=D(()=>!e.editingMatter),c=S([]),h=S(new Set),b=S(""),E=S(null),k=D(()=>e.matterFiles.filter($=>!h.value.has($.id))),C=D(()=>k.value.length+c.value.length),v=D(()=>h.value.size>0||c.value.length>0);pe(()=>e.matterModalVisible,$=>{if(!$)return;const z=e.editingMatter;t.value=(z==null?void 0:z.name)??"",n.value=(z==null?void 0:z.context)??"",l.value="",c.value=[],h.value=new Set,b.value="",d.value=!u.value,r.value="preview"});const I=D(()=>!!t.value.trim()&&!e.savingMatter&&!e.generating&&(!u.value||d.value));function y(){e.generating||e.closeMatterModal()}function H(){var $;($=E.value)==null||$.click()}function K($){b.value="";const z=Array.from($.target.files||[]);$.target.value="";for(const W of z){if(!Ns(W)){b.value=i("MATTERS_FILES_TYPE_ERROR",{name:W.name});continue}if(W.size>$s){b.value=i("MATTERS_FILES_SIZE_ERROR",{name:W.name});continue}if(C.value>=bn){b.value=i("MATTERS_FILES_LIMIT",{max:bn});break}c.value.push(W)}}function O($){h.value=new Set(h.value).add($)}function R($){c.value.splice($,1)}async function B(){if(!I.value)return;const $=v.value?{keepIds:k.value.map(W=>W.id),newFiles:c.value}:null;await e.saveMatter({name:t.value.trim(),description:null,context:n.value.trim()||null},$)&&e.closeMatterModal()}async function j(){if(!t.value.trim()){l.value=i("FORM_REQUIRED");return}l.value="";const $=await e.createMatterContext({title:t.value.trim(),description:n.value.trim()||null});d.value=!0,$?(n.value=$,r.value="preview"):r.value="edit"}function ie($){$.key==="Escape"&&e.matterModalVisible&&y()}return fe(()=>window.addEventListener("keydown",ie)),Ie(()=>window.removeEventListener("keydown",ie)),($,z)=>a(e).matterModalVisible?(p(),m("div",{key:0,"data-test":"matter-modal",class:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"presentation",onClick:_e(y,["self"])},[o("div",tc,[o("header",nc,[o("h2",sc,_(a(e).editingMatter?a(i)("MATTERS_EDIT_TITLE"):a(i)("MATTERS_NEW_TITLE")),1),o("button",{type:"button","data-test":"matter-close",class:"text-carbon-50 hover:text-carbon-100 disabled:opacity-40",disabled:a(e).generating,onClick:y}," ✕ ",8,ac)]),o("div",lc,[o("div",oc,[o("span",rc,_(a(i)("MATTERS_FIELD_TITLE")),1),Ue(o("input",{"onUpdate:modelValue":z[0]||(z[0]=W=>t.value=W),type:"text","data-test":"matter-title","aria-label":a(i)("MATTERS_FIELD_TITLE"),class:ne(["rounded-lg border px-3 py-2 text-sm text-carbon-100 focus:outline-none",l.value?"border-red-400 focus:border-red-500":"border-carbon-25 focus:border-carbon-50"]),placeholder:a(i)("MATTERS_FIELD_NAME_PLACEHOLDER"),onInput:z[1]||(z[1]=W=>l.value="")},null,42,ic),[[Be,t.value]]),l.value?(p(),m("span",cc,_(l.value),1)):N("",!0)]),a(e).generating?(p(),ae(Pn,{key:0,name:t.value},null,8,["name"])):u.value&&!d.value?(p(),m("div",uc,[o("p",dc,_(a(i)("MATTERS_CONTEXT_EXPLAIN")),1),o("button",{type:"button","data-test":"matter-generate",class:"self-start inline-flex items-center gap-2 text-13 font-medium rounded-lg bg-carbon-100 px-4 py-2 text-white hover:opacity-90 disabled:opacity-40",disabled:!t.value.trim(),onClick:j},[T(a(M),{icon:"search",size:16,area:20}),G(" "+_(a(i)("CLIENTS_CREATE_CONTEXT")),1)],8,pc)])):(p(),m("div",fc,[o("div",hc,[o("span",bc,_(a(i)("CLIENTS_FIELD_DESCRIPTION")),1),o("div",_c,[o("button",{type:"button","data-test":"matter-regenerate",class:"inline-flex items-center gap-1 text-xs text-carbon-50 hover:text-carbon-100",onClick:j},[T(a(M),{icon:"refresh",size:12,area:20}),G(" "+_(a(i)("CLIENTS_CREATE_CONTEXT")),1)]),o("div",mc,[o("button",{type:"button","data-test":"ctx-tab-edit",class:ne(["px-2 py-1 rounded-md",r.value==="edit"?"bg-carbon-5 text-carbon-100":"text-carbon-50"]),onClick:z[2]||(z[2]=W=>r.value="edit")},_(a(i)("HAUSS_TAB_EDIT")),3),o("button",{type:"button","data-test":"ctx-tab-preview",class:ne(["px-2 py-1 rounded-md",r.value==="preview"?"bg-carbon-5 text-carbon-100":"text-carbon-50"]),onClick:z[3]||(z[3]=W=>r.value="preview")},_(a(i)("HAUSS_TAB_PREVIEW")),3)])])]),o("div",gc,[Ue(o("textarea",{"onUpdate:modelValue":z[4]||(z[4]=W=>n.value=W),rows:"6","data-test":"matter-description","aria-label":a(i)("CLIENTS_FIELD_DESCRIPTION"),class:"w-full rounded-lg border border-carbon-25 px-3 py-2 text-sm text-carbon-100 resize-y focus:outline-none focus:border-carbon-50",placeholder:a(i)("MATTERS_FIELD_CONTEXT_PLACEHOLDER")},null,8,xc),[[ws,r.value==="edit"],[Be,n.value]]),r.value==="preview"?(p(),m("div",vc,[T(At,{content:n.value},null,8,["content"]),n.value.trim()?N("",!0):(p(),m("p",Ec,_(a(i)("MATTERS_FIELD_CONTEXT_PLACEHOLDER")),1))])):N("",!0)])])),o("div",kc,[o("div",yc,[o("span",Tc,_(a(i)("MATTERS_FILES_LABEL")),1
65),o("button",{type:"button","data-test":"matter-files-add",class:"inline-flex items-center gap-1.5 text-xs rounded-md border border-carbon-25 bg-white px-3 py-1.5 text-carbon-75 hover:bg-carbon-10 disabled:opacity-40",disabled:C.value>=bn,onClick:H}," + "+_(a(i)("MATTERS_FILES_ADD")),9,wc)]),o("span",Sc,_(a(i)("MATTERS_FILES_HINT")),1),o("label",Ic,[o("span",null,_(a(i)("MATTERS_FILES_ADD")),1),o("input",{ref_key:"fileInputRef",ref:E,type:"file",multiple:"",accept:a(As),onChange:K},null,40,Lc)]),b.value?(p(),m("p",Cc,_(b.value),1)):N("",!0),a(e).loadingMatterFiles?(p(),m("p",Ac,_(a(i)("MATTERS_FILES_LOADING")),1)):N("",!0),C.value?(p(),m("div",$c,[(p(!0),m(X,null,oe(k.value,W=>(p(),m("div",{key:`e-${W.id}`,class:"flex items-center justify-between gap-2 rounded-lg border border-carbon-25 bg-carbon-5 px-3 py-1.5"},[o("span",Rc,_(W.file_name),1),o("button",{type:"button",class:"shrink-0 text-carbon-50 hover:text-carbon-100 leading-none","aria-label":a(i)("MATTERS_FILES_LABEL"),onClick:Z=>O(W.id)}," × ",8,Nc)]))),128)),(p(!0),m(X,null,oe(c.value,(W,Z)=>(p(),m("div",{key:`n-${W.name}-${W.size}-${W.lastModified}`,class:"flex items-center justify-between gap-2 rounded-lg border border-carbon-25 bg-white px-3 py-1.5"},[o("span",Oc,_(W.name),1),o("button",{type:"button",class:"shrink-0 text-carbon-50 hover:text-carbon-100 leading-none","aria-label":a(i)("MATTERS_FILES_LABEL"),onClick:ye=>R(Z)}," × ",8,Mc)]))),128))])):a(e).loadingMatterFiles?N("",!0):(p(),m("span",Dc,_(a(i)("MATTERS_FILES_EMPTY")),1))])]),o("footer",Fc,[o("button",{type:"button",class:"rounded-lg border border-carbon-25 px-4 py-2 text-sm text-carbon-75 disabled:opacity-40",disabled:a(e).generating,onClick:y},_(a(i)("HAUSS_INTELLIGENCE_CLOSE")),9,Pc),o("button",{type:"button","data-test":"matter-save",class:"rounded-lg bg-primary-500 text-white px-4 py-2 text-sm disabled:opacity-50",disabled:!I.value,onClick:B},_(a(i)("CLIENTS_SAVE")),9,zc)])])])):N("",!0)}},Bc={key:0,"data-test":"settings-panel",class:"absolute bottom-full left-0 mb-2 w-full rounded-xl border border-carbon-25 bg-white shadow-around p-1 flex flex-col gap-0.5 z-20"},Hc={class:"text-yellow-dark shrink-0 flex items-center justify-center w-5"},Wc={__name:"SettingsMenu",emits:["open-twin"],setup(s,{emit:e}){const t=e,n=et();function l(){n.showSkills(),r.value=!1}const r=S(!1),d=S(null);function u(c){d.value&&!d.value.contains(c.target)&&(r.value=!1)}return fe(()=>document.addEventListener("click",u)),Ie(()=>document.removeEventListener("click",u)),(c,h)=>(p(),m("div",{ref_key:"rootRef",ref:d,class:"relative"},[o("button",{type:"button","data-test":"settings-toggle",class:"w-full flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:h[0]||(h[0]=b=>r.value=!r.value)},[T(a(M),{icon:"settings",size:16,area:20}),G(" "+_(a(i)("HAUSS_SETTINGS")),1)]),r.value?(p(),m("div",Bc,[o("button",{type:"button","data-test":"settings-skills",class:"w-full flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:l},[T(a(M),{icon:"checklist",size:16,area:20}),G(" "+_(a(i)("SKILLS_MENU_TITLE")),1)]),T(Os),o("button",{type:"button","data-test":"settings-twin",class:"w-full flex items-center gap-2 rounded-lg px-3 py-2 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:h[1]||(h[1]=b=>{t("open-twin"),r.value=!1})},[o("span",Hc,[T(Ln,{size:18})]),G(" "+_(a(i)("SOUL_PROFILE_BUTTON")),1)])])):N("",!0)],512))}},jc={class:"bg-white rounded-2xl w-full max-w-[34rem] max-h-[85vh] flex flex-col overflow-hidden"},Gc={class:"flex items-center justify-between px-5 py-4 border-b border-carbon-25"},Vc={class:"text-base font-medium text-carbon-100"},Kc=["disabled"],qc={class:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4"},Yc={class:"flex flex-col gap-1"},Zc={class:"text-sm font-medium text-carbon-100"},Xc=["aria-label","placeholder"],Qc={key:0,"data-test":"skill-slug-error",class:"text-xs text-red-500"},Jc={class:"flex flex-col gap-1"},eu={class:"text-sm font-medium text-carbon-100"},tu=["aria-label","placeholder"],nu={class:"flex flex-col gap-1"},su={class:"text-sm font-medium text-carbon-100"},au={class:"relative"},lu=["disabled","aria-label","placeholder"],ou={key:0,"data-test":"skill-skeleton",class:"absolute inset-0 flex flex-col gap-2 rounded-lg bg-white/80 px-3 py-2"},ru={key:0,"data-test":"skill-instructions-error",class:"text-xs text-red-500"},iu={class:"flex flex-col gap-2 rounded-lg border border-carbon-25 bg-carbon-5 px-3 py-3"},cu={class:"text-xs text-carbon-75"},uu=["disabled"],du={key:0,class:"animate-spin h-3.5 w-3.5 text-carbon-50",viewBox:"0 0 24 24",fill:"none"},pu={key:0,"data-test":"skill-draft-hint",class:"text-xs text-carbon-50"},fu={class:"flex items-center justify-end gap-2 px-5 py-4 border-t border-carbon-25"}
65,hu=["disabled"],bu=["disabled"],_u={__name:"SkillModal",setup(s){const e=In(),t=S(""),n=S(""),l=S(""),r=S(""),d=S(""),u=D(()=>!!(n.value.trim()||l.value.trim()));function c(I){return(I||"").toLowerCase().replace(/^\/+/,"").replace(/[^a-z0-9-]+/g,"-").replace(/-{2,}/g,"-").replace(/^-+/,"")}pe(()=>e.skillModalVisible,I=>{if(!I)return;const y=e.editingSkill;t.value=(y==null?void 0:y.slug)??"",n.value=(y==null?void 0:y.description)??"",l.value=(y==null?void 0:y.instructions)??"",r.value="",d.value=""});function h(){t.value=c(t.value),r.value=""}function b(){e.generating||e.closeSkillModal()}function E(){return r.value="",d.value="",!t.value.trim()||t.value.trim().length<2?(r.value=i("SKILLS_FIELD_SLUG_INVALID"),!1):l.value.trim()?!0:(d.value=i("FORM_REQUIRED"),!1)}async function k(){if(e.generating||e.saving||!E())return;await e.saveSkill({slug:t.value.trim(),name:null,description:n.value.trim()||null,instructions:l.value.trim()})&&e.closeSkillModal()}async function C(){if(!u.value||e.generating)return;const I=await e.draftInstructions({slug:t.value.trim()||null,name:null,description:n.value.trim()||null,instructions:l.value.trim()||null});I&&(I.instructions&&(l.value=I.instructions),!t.value.trim()&&I.suggested_slug&&(t.value=c(I.suggested_slug)),!n.value.trim()&&I.suggested_description&&(n.value=I.suggested_description),d.value="")}function v(I){I.key==="Escape"&&e.skillModalVisible&&b()}return fe(()=>window.addEventListener("keydown",v)),Ie(()=>window.removeEventListener("keydown",v)),(I,y)=>a(e).skillModalVisible?(p(),m("div",{key:0,"data-test":"skill-modal",class:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",role:"presentation",onClick:_e(b,["self"])},[o("div",jc,[o("header",Gc,[o("h2",Vc,_(a(e).editingSkill?a(i)("SKILLS_EDIT_TITLE"):a(i)("SKILLS_NEW_TITLE")),1),o("button",{type:"button","data-test":"skill-close",class:"text-carbon-50 hover:text-carbon-100 disabled:opacity-40",disabled:a(e).generating,onClick:b}," ✕ ",8,Kc)]),o("div",qc,[o("div",Yc,[o("span",Zc,_(a(i)("SKILLS_FIELD_SLUG")),1),o("div",{class:ne(["flex items-center rounded-lg border px-3 py-2",r.value?"border-red-400":"border-carbon-25 focus-within:border-carbon-50"])},[y[4]||(y[4]=o("span",{class:"text-sm text-carbon-50 select-none"},"/",-1)),Ue(o("input",{"onUpdate:modelValue":y[0]||(y[0]=H=>t.value=H),type:"text","data-test":"skill-slug","aria-label":a(i)("SKILLS_FIELD_SLUG"),class:"flex-1 bg-transparent border-0 outline-none text-sm text-carbon-100 ml-0.5",placeholder:a(i)("SKILLS_FIELD_SLUG_PLACEHOLDER"),onInput:h},null,40,Xc),[[Be,t.value]])],2),r.value?(p(),m("span",Qc,_(r.value),1)):N("",!0)]),o("div",Jc,[o("span",eu,_(a(i)("SKILLS_FIELD_DESCRIPTION")),1),Ue(o("input",{"onUpdate:modelValue":y[1]||(y[1]=H=>n.value=H),type:"text","data-test":"skill-description","aria-label":a(i)("SKILLS_FIELD_DESCRIPTION"),class:"rounded-lg border border-carbon-25 px-3 py-2 text-sm text-carbon-100 focus:outline-none focus:border-carbon-50",placeholder:a(i)("SKILLS_FIELD_DESCRIPTION_PLACEHOLDER")},null,8,tu),[[Be,n.value]])]),o("div",nu,[o("span",su,_(a(i)("SKILLS_FIELD_INSTRUCTIONS")),1),o("div",au,[Ue(o("textarea",{"onUpdate:modelValue":y[2]||(y[2]=H=>l.value=H),rows:"8","data-test":"skill-instructions",disabled:a(e).generating,"aria-label":a(i)("SKILLS_FIELD_INSTRUCTIONS"),class:ne(["w-full rounded-lg border px-3 py-2 text-sm text-carbon-100 resize-y focus:outline-none focus:border-carbon-50 disabled:bg-carbon-5",d.value?"border-red-400":"border-carbon-25"]),placeholder:a(i)("SKILLS_FIELD_INSTRUCTIONS_PLACEHOLDER"),onInput:y[3]||(y[3]=H=>d.value="")},null,42,lu),[[Be,l.value]]),a(e).generating?(p(),m("div",ou,y[5]||(y[5]=[o("div",{class:"h-3 w-3/4 rounded bg-carbon-10 animate-pulse"},null,-1),o("div",{class:"h-3 w-full rounded bg-carbon-10 animate-pulse"},null,-1),o("div",{class:"h-3 w-5/6 rounded bg-carbon-10 animate-pulse"},null,-1),o("div",{class:"h-3 w-2/3 rounded bg-carbon-10 animate-pulse"},null,-1)]))):N("",!0)]),d.value?(p(),m("span",ru,_(d.value),1)):N("",!0)]),o("div",iu,[o("span",cu,_(a(i)("SKILLS_DRAFT_LEGEND")),1),o("button",{type:"button","data-test":"skill-draft",class:"self
65-start inline-flex items-center gap-2 text-xs rounded-md border border-carbon-25 bg-white px-3 py-1.5 text-carbon-75 hover:bg-carbon-10 disabled:opacity-40",disabled:a(e).generating||!u.value,onClick:C},[a(e).generating?(p(),m("svg",du,y[6]||(y[6]=[o("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),o("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):N("",!0),G(" "+_(a(i)("SKILLS_DRAFT_BUTTON")),1)],8,uu),u.value?N("",!0):(p(),m("span",pu,_(a(i)("SKILLS_DRAFT_NEEDS_INPUT")),1))])]),o("footer",fu,[o("button",{type:"button",class:"rounded-lg border border-carbon-25 px-4 py-2 text-sm text-carbon-75 disabled:opacity-40",disabled:a(e).generating,onClick:b},_(a(i)("HAUSS_INTELLIGENCE_CLOSE")),9,hu),o("button",{type:"button","data-test":"skill-save",class:"rounded-lg bg-primary-500 text-white px-4 py-2 text-sm disabled:opacity-50",disabled:a(e).saving||a(e).generating,onClick:k},_(a(i)("SKILLS_SAVE")),9,bu)])])])):N("",!0)}},mu=["aria-label"],gu={key:0,class:"relative z-10 w-full bg-white flex flex-col rounded-2xl shadow-2xl overflow-hidden",style:{"max-width":"800px","max-height":"85vh","box-shadow":"0 25px 60px rgba(0,0,0,0.25), 0 8px 20px rgba(0,0,0,0.15)"}},xu={class:"flex items-center justify-between px-6 py-4 border-b border-carbon-100 shrink-0"},vu={class:"flex items-center gap-2"},Eu={class:"w-7 h-7 rounded-lg bg-carbon-100 flex items-center justify-center text-yellow"},ku={class:"font-bold text-carbon-100 text-15"},yu=["aria-label"],Tu={class:"flex-1 overflow-y-auto px-6 py-5 flex flex-col gap-5"},wu={key:0,class:"flex items-center justify-center flex-1 gap-3 text-carbon-50"},Su={class:"text-sm"},Iu={key:1,class:"flex flex-col items-center justify-center flex-1 gap-4 text-center"},Lu={class:"text-sm text-carbon-50"},Cu={key:2,class:"flex flex-col gap-5"},Au={class:"text-sm text-carbon-100 leading-relaxed whitespace-pre-wrap"},$u={class:"border-t border-carbon-100 pt-4"},Ru={key:0},Nu={key:1,class:"flex flex-col gap-3"},Ou={class:"block w-full"},Mu={class:"sr-only"},Du=["placeholder"],Fu={key:0,class:"text-sm text-danger",role:"alert"},Pu={class:"flex gap-2"},zu={key:0,class:"shrink-0 border-t border-carbon-100 px-6 py-4"},Uu=["disabled"],Bu=Object.assign({name:"SoulProfileDrawer"},{__name:"SoulProfileDrawer",props:{visible:{type:Boolean,default:!1}},emits:["close"],setup(s,{emit:e}){const t=s,n=e,l=ia(),r=bt(),d=S(!1),u=S(""),c=S(null),h=S(!1),b=pe(()=>t.visible,async v=>{v&&!r.isFetched&&await r.fetchSoul(),v||(d.value=!1,u.value="",c.value=null)});Ie(()=>{b(),r.abort()});async function E(){c.value=null;try{await r.regenerate(u.value.trim()||null),d.value=!1,u.value=""}catch(v){c.value=v.message}}async function k(){try{await r.resetSoul(),h.value=!1,n("close")}catch{h.value=!1,re({type:"error",body:i("SOUL_PROFILE_RESET_ERROR")})}}function C(){n("close"),l.push({name:"dashboard.intelligence.setup"})}return(v,I)=>(p(),m(X,null,[T(mn,{"enter-active-class":"transition-opacity duration-200","leave-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-to-class":"opacity-0"},{default:$e(()=>[s.visible?(p(),m("div",{key:0,class:"fixed inset-0 flex items-center justify-center p-6",style:{"z-index":"9999"},role:"dialog","aria-modal":"true","aria-label":a(i)("SOUL_PROFILE_TITLE")},[o("div",{role:"button",tabindex:"0","aria-label":"Cerrar",class:"absolute inset-0 bg-carbon-100/40",onClick:I[0]||(I[0]=y=>n("close")),onKeydown:[I[1]||(I[1]=Ze(y=>n("close"),["enter"])),I[2]||(I[2]=Ze(y=>n("close"),["escape"]))]},null,32),T(mn,{"enter-active-class":"transition-all duration-300","leave-active-class":"transition-all duration-300","enter-from-class":"opacity-0 scale-95","leave-to-class":"opacity-0 scale-95",appear:""},{default:$e(()=>[s.visible?(p(),m("div",gu,[o("div",xu,[o("div",vu,[o("span",Eu,[T(Ln,{size:16})]),o("h2",ku,_(a(i)("SOUL_PROFILE_TITLE")),1)]),o("button",{type:"button",class:"text-carbon-50 hover:text-carbon-100 transition-colors p-1 rounded focus:outline-none focus:ring-2 focus:ring-carbon-100","aria-label":a(i)("HAUSS_INTELLIGENCE_CLOSE"),onClick:I[3]||(I[3]=y=>n("close"))},I[9]||(I[9]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-5 h-5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[o("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)]),8,yu)]),o("div",Tu,[a(r).isLoading&&!a(r).soul?(p(),m("div",wu,[T(a(jt),{size:"sm"}),o("span",Su,_(a(i)("SOUL_PROFILE_LOADING")),1)])):a(r).soul?(p(),m("div",Cu,[o("div",Au,_(a(r).soul),1),o("div",$u,[d.value?(p(),m("div",Nu,[o("label",Ou,[o("span",Mu,_(a(i)("SOUL_PROFILE_REGENERATE_PLACEHOLDER")),1),Ue(o("textarea",{"onUpdate:modelValue":I[5]||(I[5]=y=>u.value=y),rows:"3",class:"w-full rounded-xl border border-carbon-25 bg-white px-4 py-3 text-sm text-carbon-100 placeholder-carbon-50 resize-none focus:outline-none focus:border-carbon-100 transition-colors",placeholder:a(i)("SOUL_PROFILE_REGENERATE_PLACEHOLDER")},null,8,Du),[[Be,u.value]])]),c.value?(p(),m("p",Fu,_(c.value),1)):N("",!0),o("div",Pu,[T(a(ht),{category:"primary",size:"fit",disabled:a(r).isLoading,onClick:E},{default:$e(()=>[a(r).isLoading?(p(),ae(a(jt),{key:0,size:"sm",class:"mr-1.5"})):N("",!0),G(" "+_(a(i)("SOUL_PROFILE_REGENERATE_SUBMIT")),1)]),_:1},8,["disabled"]),T(a(ht),{category:"secondary",size:"fit",disabled:a(r).isLoading,onClick:I[6]||(I[6]=y=>{d.value=!1,u.value=""})},{default:$e(()=>
65[G(_(a(i)("SOUL_PROFILE_REGENERATE_CANCEL")),1)]),_:1},8,["disabled"])])])):(p(),m("div",Ru,[T(a(ht),{category:"secondary",size:"fit",onClick:I[4]||(I[4]=y=>d.value=!0)},{default:$e(()=>[G(_(a(i)("SOUL_PROFILE_REGENERATE")),1)]),_:1})]))])])):(p(),m("div",Iu,[o("p",Lu,_(a(i)("SOUL_PROFILE_EMPTY")),1),T(a(ht),{category:"primary",size:"fit",onClick:C},{default:$e(()=>[G(_(a(i)("SOUL_PROFILE_EMPTY_CTA")),1)]),_:1})]))]),a(r).soul?(p(),m("div",zu,[o("button",{type:"button",class:"text-13 font-semibold text-danger transition-opacity hover:opacity-80 disabled:opacity-50",disabled:a(r).isLoading,onClick:I[7]||(I[7]=y=>h.value=!0)},_(a(i)("SOUL_PROFILE_RESET")),9,Uu)])):N("",!0)])):N("",!0)]),_:1})],8,mu)):N("",!0)]),_:1}),T(a(Tn),{visible:h.value,title:a(i)("SOUL_PROFILE_RESET_TITLE"),message:a(i)("SOUL_PROFILE_RESET_CONFIRM"),"confirm-label":a(i)("SOUL_PROFILE_RESET_SUBMIT"),"cancel-label":a(i)("HAUSS_INTELLIGENCE_CLOSE"),onConfirm:k,onCancel:I[8]||(I[8]=y=>h.value=!1)},null,8,["visible","title","message","confirm-label","cancel-label"])],64))}}),Hu={class:"shrink-0 flex items-center gap-2 px-3 pt-4 pb-3"},Wu={class:"flex-1 min-h-0 overflow-y-auto px-3 flex flex-col gap-0.5"},ju=["aria-label"],Gu={key:0,class:"px-2 py-1 text-xs text-carbon-50"},Vu={class:"shrink-0 border-t border-carbon-25 px-3 py-2 flex flex-col gap-0.5"},Ku=["aria-label"],qu={key:0,class:"pl-2 flex flex-col gap-0.5 max-h-40 overflow-y-auto"},Yu={class:"px-3 py-2 shrink-0 border-t border-carbon-25"},Zu={__name:"ChatSidebar",setup(s){const e=He(),t=We(),n=et(),l=S(!1),r=S(null);function d(E){r.value={type:"client",item:E}}function u(E){r.value={type:"matter",item:E}}async function c(){const E=r.value;r.value=null,E&&(E.type==="client"&&e.activeClientId===E.item.id?await e.newChat():E.type==="matter"&&e.activeMatterId===E.item.id&&await e.newChat(),E.type==="client"?await t.removeClient(E.item.id):await t.removeMatter(E.item),await e.loadChats())}fe(()=>{t.loadClients()}),pe(()=>t.lastCreatedClientId,E=>{E!=null&&(t.isExpanded(E)||t.toggleExpand(E),t.openCreateMatter(E),t.consumeLastCreatedClient())}),pe(()=>e.activeMatterId,async E=>{if(E==null)return;const k=e.activeClientId;k!=null&&(t.matters.has(k)||await t.loadMatters(k),t.isExpanded(k)||t.toggleExpand(k))},{immediate:!0});const h=D(()=>n.view==="chat"&&e.activeMatterId==null);function b(){e.newChat(),n.showChat()}return(E,k)=>{var C;return p(),m(X,null,[o("aside",ca(E.$attrs,{class:"shrink-0 flex flex-col overflow-hidden h-full"}),[o("div",Hu,[T(a(Xr),{class:"w-6 h-6 rounded-md shrink-0"}),k[11]||(k[11]=o("span",{class:"text-15 font-gt-super text-carbon-100"},"AI Twin",-1))]),o("div",Wu,[o("div",{role:"button",tabindex:"0","data-test":"clients-section-header",class:ne(["w-full flex items-center gap-2 rounded-lg px-2 py-1.5 text-13 cursor-pointer transition-colors",a(n).view==="clients"||a(n).view==="client"?"bg-carbon-5 text-carbon-100 font-medium":"text-carbon-75 hover:bg-carbon-5"]),onClick:k[1]||(k[1]=v=>a(n).showClients()),onKeydown:[k[2]||(k[2]=Ze(v=>a(n).showClients(),["enter"])),k[3]||(k[3]=Ze(_e(v=>a(n).showClients(),["prevent"]),["space"]))]},[T(a(M),{icon:"company",size:16,area:20}),G(" "+_(a(i)("TWIN_NAV_CLIENTS"))+" ",1),o("button",{type:"button","data-test":"client-new",class:"ml-auto p-1 rounded-md text-carbon-50 hover:text-carbon-100 hover:bg-carbon-25 transition-colors","aria-label":a(i)("CLIENTS_NEW"),onClick:k[0]||(k[0]=_e(v=>a(t).openCreateClient(),["stop"]))},[T(a(M),{icon:"plus",size:16,area:20})],8,ju)],34),(p(!0),m(X,null,oe(a(t).clients,v=>(p(),ae(ec,{key:v.id,client:v,onRequestDeleteClient:d,onRequestDeleteMatter:u},null,8,["client"]))),128)),a(t).clients.length?N("",!0):(p(),m("p",Gu,_(a(i)("CLIENTS_EMPTY")),1))]),o("div",Vu,[o("div",{role:"button",tabindex:"0","data-test":"nav-assistant",class:ne(["w-full flex items-center gap-2 rounded-lg px-2 py-1.5 text-13 cursor-pointer transition-colors",h.value?"bg-carbon-5 text-carbon-100 font-medium":"text-carbon-75 hover:bg-carbon-5"]),onClick:k[5]||(k[5]=v=>b()),onKeydown:[k[6]||(k[6]=Ze(v=>b(),["enter"])),k[7]||(k[7]=Ze(_e(v=>b(),["prevent"]),["space"]))]},[T(a(M),{icon:"chat",size:16,area:20}),G(" "+_(a(i)("TWIN_NAV_ASSISTANT"))+" ",1),o("button",{type:"button","data-test":"new-chat",class:"ml-auto p-1 rounded-md text-carbon-50 hover:text-carbon-100 hover:bg-carbon-25 transition-colors","aria-label":a(i)("HAUSS_INTELLIGENCE_NEW_CHAT"),onClick:k[4]||(k[4]=_e(v=>{a(e).newChat(),a(n).showChat()},["stop"]))},[T(a(M),{icon:"plus",size:16,area:20})],8,Ku)],34),h.value?(p(),m("div",qu,[(p(!0),m(X,null,oe(a(e).generalChats,v=>(p(),ae(Jr,{key:v.id,chat:v,active:v.id===a(e).chatId,onOpen:I=>a(e).openChat(v.id)},null,8,["chat","active","onOpen"]))),128))])):N("",!0)]),o("div",Yu,[T(Wc,{onOpenTwin:k[8]||(k[8]=v=>l.value=!0)})])],16),T(Bu,{visible:l.value,onClose:k[9]||(k[9]=v=>l.value=!1)},null,8,["visible"]),T(Ni),T(Uc),T(_u),T(a(Tn),{visible:!!r.value,title:((C=r.value)==null?void 0:C.type)==="matter"?a(i)("MATTERS_DELETE"):a(i)("CLIENTS_DELETE"),message:r.value?a(i)("CLIENTS_DELETE_CONFIRM",{name:r.value.item.name}):"","confirm-label":a(i)("CLIENTS_DELETE"),"cancel-label":a(i)("HAUSS_INTELLIGENCE_CLOSE"),onConfirm:c,onCancel:k[10]||(k[10]=v=>r.value=null)}
65,null,8,["visible","title","message","confirm-label","cancel-label"])],64)}}},Xu={class:"flex flex-col items-center justify-center text-center rounded-2xl border border-dashed border-carbon-25 bg-carbon-5/50 px-6 py-12"},Qu={class:"w-14 h-14 rounded-2xl bg-secondary-100 text-yellow-dark flex items-center justify-center mb-4"},Ju={class:"text-18 font-gt-super text-carbon-100"},ed={key:0,class:"text-13 text-carbon-50 mt-1.5 max-w-md leading-relaxed"},Qt={__name:"TwinEmptyState",props:{icon:{type:String,required:!0},title:{type:String,required:!0},body:{type:String,default:""},actionLabel:{type:String,required:!0}},emits:["action"],setup(s){return(e,t)=>(p(),m("div",Xu,[o("span",Qu,[T(a(M),{icon:s.icon,size:28,area:32},null,8,["icon"])]),o("h3",Ju,_(s.title),1),s.body?(p(),m("p",ed,_(s.body),1)):N("",!0),o("button",{type:"button","data-test":"empty-action",class:"mt-6 flex items-center gap-1.5 rounded-lg bg-carbon-100 px-4 py-2 text-13 font-medium text-white hover:opacity-90",onClick:t[0]||(t[0]=n=>e.$emit("action"))},[T(a(M),{icon:"plus",size:16,area:20}),G(" "+_(s.actionLabel),1)])]))}},td={class:"border-t border-carbon-25 pt-8"},nd={class:"flex flex-col items-center text-center"},sd={class:"w-14 h-14 rounded-2xl bg-carbon-5 text-carbon-75 flex items-center justify-center mb-3"},ad={class:"text-20 font-gt-super text-carbon-100 leading-tight"},ld={class:"text-14 text-carbon-50 leading-relaxed mt-1.5 max-w-2xl"},od={key:0,class:"grid grid-cols-2 gap-x-12 gap-y-7 mt-9"},rd={class:"w-11 h-11 rounded-xl bg-carbon-5 text-carbon-75 flex items-center justify-center shrink-0"},id={class:"min-w-0 pt-0.5"},cd={class:"block text-14 font-semibold text-carbon-100"},ud={class:"block text-13 text-carbon-50 leading-relaxed mt-0.5"},zn={__name:"TwinValueBanner",props:{icon:{type:String,required:!0},title:{type:String,required:!0},body:{type:String,required:!0},benefits:{type:Array,default:()=>[]}},setup(s){return(e,t)=>(p(),m("section",td,[o("div",nd,[o("span",sd,[T(a(M),{icon:s.icon,size:28,area:32},null,8,["icon"])]),o("h3",ad,_(s.title),1),o("p",ld,_(s.body),1)]),s.benefits.length?(p(),m("div",od,[(p(!0),m(X,null,oe(s.benefits,n=>(p(),m("div",{key:n.title,class:"flex items-start gap-4"},[o("span",rd,[T(a(M),{icon:n.icon,size:24,area:32},null,8,["icon"])]),o("span",id,[o("span",cd,_(n.title),1),o("span",ud,_(n.body),1)])]))),128))])):N("",!0)]))}},dd={class:"flex flex-col h-full min-h-0 overflow-y-auto px-8 pb-6"},pd={class:"sticky top-0 z-10 bg-white flex items-center justify-between gap-3 pt-6 pb-4 mb-1"},fd={class:"flex items-center gap-2 min-w-0"},hd=["aria-label"],bd={class:"text-24 font-gt-super text-carbon-100 truncate"},_d={"data-test":"client-description-section",class:"rounded-2xl border border-carbon-25 bg-white px-5 py-4 mb-6"},md={class:"flex items-center justify-between mb-2"},gd={class:"text-14 font-semibold text-carbon-100"},xd={class:"flex items-center gap-2"},vd=["disabled"],Ed=["disabled"],kd=["disabled"],yd=["aria-label","placeholder"],Td={key:2},wd={key:1,"data-test":"desc-empty",class:"text-13 text-carbon-50 leading-relaxed"},Sd={key:0,class:"grid grid-cols-2 lg:grid-cols-3 gap-3"},Id=["onClick"],Ld={class:"w-9 h-9 rounded-lg bg-secondary-100 text-yellow-dark flex items-center justify-center shrink-0"},Cd={class:"min-w-0 flex-1"},Ad={class:"block text-14 font-semibold text-carbon-100 truncate"},$d={class:"block text-12 text-carbon-50"},Rd={key:1,"data-test":"matters-empty"},Nd={__name:"ClientDetail",setup(s){const e=We(),t=He(),n=et(),l=D(()=>e.clients.find(I=>I.id===n.activeClientId)??null),r=D(()=>e.mattersOf(n.activeClientId)),d=S(!1),u=S(""),c=D(()=>[{icon:"case",title:i("MATTERS_BENEFIT_1_TITLE"),body:i("MATTERS_BENEFIT_1_BODY")},{icon:"file",title:i("MATTERS_BENEFIT_2_TITLE"),body:i("MATTERS_BENEFIT_2_BODY")},{icon:"chat",title:i("MATTERS_BENEFIT_3_TITLE"),body:i("MATTERS_BENEFIT_3_BODY")},{icon:"search",title:i("MATTERS_BENEFIT_4_TITLE"),body:i("MATTERS_BENEFIT_4_BODY")},{icon:"chat",title:i("MATTERS_BENEFIT_5_TITLE"),body:i("MATTERS_BENEFIT_5_BODY")},{icon:"papers",title:i("MATTERS_BENEFIT_6_TITLE"),body:i("MATTERS_BENEFIT_6_BODY")}]);fe(()=>{n.activeClientId!=null&&!e.matters.has(n.activeClientId)&&e.loadMatters(n.activeClientId)}),pe(()=>n.activeClientId,()=>{d.value=!1});function h(){var I;u.value=((I=l.value)==null?void 0:I.context)??"",d.value=!0}function b(){d.value=!1}
65async function E(){if(!l.value)return;await e.saveClientDescription(l.value,u.value)&&(d.value=!1)}async function k(){if(!l.value)return;const I=await e.createClientContext({title:l.value.name,description:u.value.trim()||null});I&&(u.value=I)}function C(I){n.showMatter(n.activeClientId,I.id)}function v(I){const y=t.chatsOfMatter(I).length;return`${y} ${y===1?i("CHATS_COUNT_ONE"):i("CHATS_COUNT_LABEL")}`}return(I,y)=>{var H,K,O;return p(),m("div",dd,[o("div",pd,[o("div",fd,[o("button",{type:"button","data-test":"detail-back","aria-label":a(i)("TWIN_NAV_CLIENTS"),class:"shrink-0 -ml-1 p-1 rounded-md text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5 transition-colors",onClick:y[0]||(y[0]=R=>a(n).showClients())},[T(a(M),{icon:"chevron-left",size:20,area:24})],8,hd),o("h2",bd,_((H=l.value)==null?void 0:H.name),1)]),o("button",{type:"button","data-test":"detail-new-matter",class:"shrink-0 flex items-center gap-1.5 rounded-lg bg-carbon-100 px-3 py-2 text-13 font-medium text-white hover:opacity-90",onClick:y[1]||(y[1]=R=>a(e).openCreateMatter(a(n).activeClientId))},[T(a(M),{icon:"plus",size:16,area:20}),G(" "+_(a(i)("MATTERS_NEW")),1)])]),o("section",_d,[o("div",md,[o("h3",gd,_(a(i)("CLIENT_DESC_TITLE")),1),o("div",xd,[d.value?(p(),m(X,{key:0},[o("button",{type:"button","data-test":"desc-generate",class:"inline-flex items-center gap-1 text-xs text-carbon-50 hover:text-carbon-100 disabled:opacity-40",disabled:a(e).generating,onClick:k},[T(a(M),{icon:"refresh",size:12,area:20}),G(" "+_(a(i)("CLIENTS_CREATE_CONTEXT")),1)],8,vd),o("button",{type:"button","data-test":"desc-cancel",class:"text-xs text-carbon-50 hover:text-carbon-100 disabled:opacity-40",disabled:a(e).generating,onClick:b},_(a(i)("CLIENT_DESC_CANCEL")),9,Ed),o("button",{type:"button","data-test":"desc-save",class:"text-xs rounded-md bg-carbon-100 text-white px-2.5 py-1 disabled:opacity-40",disabled:a(e).savingClient||a(e).generating,onClick:E},_(a(i)("CLIENT_DESC_SAVE")),9,kd)],64)):(p(),m("button",{key:1,type:"button","data-test":"desc-edit",class:"inline-flex items-center gap-1 text-xs text-carbon-50 hover:text-carbon-100",onClick:h},[T(a(M),{icon:"pencil",size:12,area:20}),G(" "+_(a(i)("CLIENT_DESC_EDIT")),1)]))])]),a(e).generating?(p(),ae(Pn,{key:0,name:(K=l.value)==null?void 0:K.name},null,8,["name"])):d.value?Ue((p(),m("textarea",{key:1,"onUpdate:modelValue":y[2]||(y[2]=R=>u.value=R),rows:"6","data-test":"desc-textarea","aria-label":a(i)("CLIENT_DESC_TITLE"),class:"w-full rounded-lg border border-carbon-25 px-3 py-2 text-sm text-carbon-100 resize-y focus:outline-none focus:border-carbon-50",placeholder:a(i)("CLIENTS_FIELD_CONTEXT_PLACEHOLDER")},null,8,yd)),[[Be,u.value]]):(p(),m("div",Td,[(O=l.value)!=null&&O.context?(p(),ae(At,{key:0,content:l.value.context},null,8,["content"])):(p(),m("p",wd,_(a(i)("CLIENT_DESC_EMPTY")),1))]))]),r.value.length?(p(),m("div",Sd,[(p(!0),m(X,null,oe(r.value,R=>(p(),m("button",{key:R.id,type:"button","data-test":"matter-card",class:"group flex items-center gap-3 text-left rounded-xl border border-carbon-25 bg-white px-4 py-4 transition-all hover:border-carbon-100 hover:shadow-around",onClick:B=>C(R)},[o("span",Ld,[T(a(M),{icon:"case",size:16,area:20})]),o("span",Cd,[o("span",Ad,_(R.name),1),o("span",$d,_(v(R.id)),1)]),T(a(M),{icon:"chevron-right",size:16,area:20,class:"text-carbon-25 group-hover:text-carbon-75"})],8,Id))),128))])):(p(),m("div",Rd,[T(Qt,{icon:"case",title:a(i)("MATTERS_EMPTY_TITLE"),body:a(i)("MATTERS_EMPTY_BODY"),"action-label":a(i)("MATTERS_NEW"),onAction:y[3]||(y[3]=R=>a(e).openCreateMatter(a(n).activeClientId))},null,8,["title","body","action-label"])])),T(zn,{icon:"case",title:a(i)("MATTERS_INFO_TITLE"),body:a(i)("MATTERS_INFO_BODY"),benefits:c.value,class:"mt-8"},null,8,["title","body","benefits"])])}}},Od={class:"flex flex-col h-full min-h-0 overflow-y-auto px-8 pb-6"},Md={class:"sticky top-0 z-10 bg-white flex items-center justify-between pt-6 pb-4 mb-1"},Dd={class:"text-24 font-gt-super text-carbon-100"},Fd={key:0,class:"grid grid-cols-2 lg:grid-cols-3 gap-3"},Pd=["onClick"],zd={class:"w-9 h-9 rounded-lg bg-secondary-100 text-yellow-dark flex items-center justify-center shrink-0"},Ud={class:"min-w-0 flex-1"},Bd={class:"block text-14 font-semibold text-carbon-100 truncate"},Hd={class:"block text-12 text-carbon-50"},Wd={key:1,"data-test":"clients-empty"}
65,jd={__name:"ClientsGrid",setup(s){const e=We(),t=et(),n=D(()=>e.clients),l=D(()=>[{icon:"company",title:i("CLIENTS_BENEFIT_1_TITLE"),body:i("CLIENTS_BENEFIT_1_BODY")},{icon:"case",title:i("CLIENTS_BENEFIT_2_TITLE"),body:i("CLIENTS_BENEFIT_2_BODY")},{icon:"chat",title:i("CLIENTS_BENEFIT_3_TITLE"),body:i("CLIENTS_BENEFIT_3_BODY")},{icon:"mail",title:i("CLIENTS_BENEFIT_4_TITLE"),body:i("CLIENTS_BENEFIT_4_BODY")},{icon:"papers",title:i("CLIENTS_BENEFIT_5_TITLE"),body:i("CLIENTS_BENEFIT_5_BODY")},{icon:"search",title:i("CLIENTS_BENEFIT_6_TITLE"),body:i("CLIENTS_BENEFIT_6_BODY")}]);function r(d){const u=e.mattersOf(d).length;return`${u} ${u===1?i("MATTERS_COUNT_ONE"):i("MATTERS_COUNT_LABEL")}`}return fe(()=>e.ensureAllMattersLoaded()),pe(()=>e.clients.length,()=>e.ensureAllMattersLoaded()),(d,u)=>(p(),m("div",Od,[o("div",Md,[o("h2",Dd,_(a(i)("TWIN_NAV_CLIENTS")),1),o("button",{type:"button","data-test":"clients-create",class:"flex items-center gap-1.5 rounded-lg bg-carbon-100 px-3 py-2 text-13 font-medium text-white hover:opacity-90",onClick:u[0]||(u[0]=c=>a(e).openCreateClient())},[T(a(M),{icon:"plus",size:16,area:20}),G(" "+_(a(i)("CLIENTS_CREATE")),1)])]),n.value.length?(p(),m("div",Fd,[(p(!0),m(X,null,oe(n.value,c=>(p(),m("button",{key:c.id,type:"button","data-test":"client-card",class:"group flex items-center gap-3 text-left rounded-xl border border-carbon-25 bg-white px-4 py-4 transition-all hover:border-carbon-100 hover:shadow-around",onClick:h=>a(t).showClient(c.id)},[o("span",zd,[T(a(M),{icon:"company",size:16,area:20})]),o("span",Ud,[o("span",Bd,_(c.name),1),o("span",Hd,_(r(c.id)),1)]),T(a(M),{icon:"chevron-right",size:16,area:20,class:"text-carbon-25 group-hover:text-carbon-75"})],8,Pd))),128))])):(p(),m("div",Wd,[T(Qt,{icon:"company",title:a(i)("CLIENTS_EMPTY_TITLE"),body:a(i)("CLIENTS_EMPTY_BODY"),"action-label":a(i)("CLIENTS_CREATE"),onAction:u[1]||(u[1]=c=>a(e).openCreateClient())},null,8,["title","body","action-label"])])),T(zn,{icon:"company",title:a(i)("CLIENTS_INFO_TITLE"),body:a(i)("CLIENTS_INFO_BODY"),benefits:l.value,class:"mt-8"},null,8,["title","body","benefits"])]))}},Gd={class:"flex flex-col h-full min-h-0 overflow-y-auto px-8 pb-6"},Vd={class:"sticky top-0 z-10 bg-white flex items-center justify-between gap-3 pt-6 pb-4 mb-1"},Kd={class:"flex items-center gap-2 min-w-0"},qd=["aria-label"],Yd={class:"min-w-0"},Zd={key:0,class:"text-12 text-carbon-50 truncate"},Xd={class:"text-24 font-gt-super text-carbon-100 truncate"},Qd={class:"rounded-2xl border border-carbon-25 bg-white px-5 py-4 mb-6"},Jd={class:"text-13 text-carbon-75 leading-relaxed"},ep={class:"mb-6"},tp={class:"text-14 font-semibold text-carbon-100 mb-3"},np={key:0,class:"flex flex-col gap-2"},sp=["onClick"],ap={class:"w-8 h-8 rounded-lg bg-carbon-5 text-carbon-75 flex items-center justify-center shrink-0"},lp={class:"min-w-0 flex-1 text-14 text-carbon-100 truncate"},op={class:"flex items-center justify-between mb-2"},rp={class:"text-14 font-semibold text-carbon-100"},ip={class:"text-12 text-carbon-50 mb-3"},cp={key:0,class:"flex flex-col gap-1.5"},up={class:"w-8 h-8 shrink-0 rounded-md bg-carbon-5 text-carbon-75 flex items-center justify-center"},dp={class:"min-w-0 text-13 text-carbon-100 truncate"},pp={key:1,"data-test":"matter-files-empty",class:"text-13 text-carbon-50"},fp={__name:"MatterDetail",setup(s){const e=We(),t=He(),n=et(),l=D(()=>e.clients.find(E=>E.id===n.activeClientId)??null),r=D(()=>e.mattersOf(n.activeClientId).find(E=>E.id===n.activeMatterId)??null),d=D(()=>t.chatsOfMatter(n.activeMatterId));function u(){n.activeClientId!=null&&!e.matters.has(n.activeClientId)&&e.loadMatters(n.activeClientId),n.activeMatterId!=null&&e.loadMatterFiles(n.activeMatterId)}fe(u),pe(()=>n.activeMatterId,u),pe(()=>e.matterModalVisible,E=>{!E&&n.view==="matter"&&n.activeMatterId!=null&&e.loadMatterFiles(n.activeMatterId)});async function c(){!l.value||!r.value||(await t.startChatInMatter(l.value,r.value),n.showChat())}function h(E){t.openChat(E),n.showChat()}function b(){r.value&&e.openEditMatter(r.value)}return(E,k)=>{var C,v,I;return p(),m("div",Gd,[o("div",Vd,[o("div",Kd,[o("button",{type:"button","data-test":"matter-back","aria-label":(C=l.value)==null?void 0:C.name,class:"shrink-0 -ml-1 p-1 rounded-md text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5 transition-colors",onClick:k[0]||(k[0]=y=>a(n).showClient(a(n).activeClientId))},[T(a(M),{icon:"chevron-left",size:20,area:24})],8,qd),o("div",Yd,[l.value?(p(),m("p",Zd,_(l.value.name),1)):N("",!0),o("h2",Xd,_((v=r.value)==null?void 0:v.name),1)])]),o("button",{type:"button","data-test":"matter-new-conversation",class:"shrink-0 flex items-center gap-1.5 rounded-lg bg-carbon-100 px-3 py-2 text-13 font-medium text-white hover:opacity-90",onClick:c},[T(a(M),{icon:"plus",size:16,area:20}),G(" "+_(a(i)("MATTER_NEW_CONVERSATION")),1)])]),o("section",Qd,[o("p",Jd,_(a(i)("MATTER_DETAIL_EXPLAIN")),1),(I=r.value)!=null&&I.context?(p(),ae(At,{key:0,content:r.value.context,class:"mt-3"},null,8,["content"])):N("",!0)]),o("section",ep,[o("h3",tp,_(a(i)("MATTER_CONVERSATIONS_TITLE")),1),d.value.length?(p(),m("div",np,[(p(!0),m(X,null,oe(d.value,y=>(p(),m("button",{key:y.id,type:"button","data-test":"matter-conversation",class:"group flex items-center gap-3 text-left rounded-xl border border-carbon-25 bg-white px-4 py-3 transition-all hover:border-carbon-100 hover:shadow-around",onClick:H=>h(y.id)},[o("span",ap,[T(a(M),{icon:"chat",size:16,area:20})]),o("span",lp,_(y.title||a(i)("MATTER_UNTITLED_CHAT")),1),T(a(M),{icon:"chevron-right",size:16,area:20,class:"text-carbon-25 group-hover:text-carbon-75"})],8,sp))),128))])):(p(),ae(Qt,{key:1,"data-test":"matter-conversations-empty",icon:"chat",title:a(i)("MATTER_CONVERSATIONS_TITLE"),body:a(i)("MATTER_CONVERSATIONS_EMPTY"),"action-label":a(i)("MATTER_NEW_CONVERSATION"),onAction:c},null,8,["title","body","action-label"]))]),o("section",null,[o("div",op,[o("h3",rp,_(a(i)("MATTER_FILES_TITLE")),1),o("button",{type:"button","data-test":"matter-manage-files",class:"inline-flex items-center gap-1.5 rounded-lg border border-carbon-25 px-3 py-1.5 text-13 text-carbon-75 hover:bg-carbon-5 hover:border-carbon-50 transition-colors",onClick:b},[T(a(M),{icon:"file",size:16,area:20}),G(" "+_(a(i)("MATTER_MANAGE_FILES")),1)])]),o("p",ip,_(a(i)("MATTERS_FILES_HINT")),1),a(e).matterFiles.length?(p(),m("div",cp,[(p(!0),m(X,null,oe(a(e).matterFiles,y=>(p(),m("div",{key:y.id,"data-test":"matter-file",class:"flex items-center gap-2.5 rounded-lg border border-carbon-25 bg-white px-3 py-2"},[o("span",up,[T(a(M),{icon:"file",size:16,area:20})]),o("span",dp,_(y.file_name),1)]))),128))])):(p(),m("p",pp,_(a(i)("MATTER_FILES_EMPTY")),1))])])}}}
65,hp={__name:"PanelSplitter",emits:["start"],setup(s,{emit:e}){const t=e;return(n,l)=>(p(),m("div",{"data-test":"panel-splitter",role:"separator","aria-orientation":"vertical",class:"group relative w-1.5 shrink-0 cursor-col-resize flex items-stretch justify-center",onPointerdown:l[0]||(l[0]=r=>t("start",r))},l[1]||(l[1]=[o("span",{class:"w-px bg-carbon-25 group-hover:bg-carbon-50 transition-colors"},null,-1)]),32))}},bp={class:"flex flex-col h-full min-h-0 overflow-y-auto px-8 pb-6"},_p={class:"sticky top-0 z-10 bg-white flex items-center justify-between pt-6 pb-4 mb-1"},mp={class:"text-24 font-gt-super text-carbon-100"},gp={key:0,class:"grid grid-cols-2 lg:grid-cols-3 gap-3"},xp=["onClick","onKeydown"],vp={class:"w-9 h-9 rounded-lg bg-secondary-100 text-yellow-dark flex items-center justify-center shrink-0"},Ep={class:"min-w-0 flex-1"},kp={class:"block text-13 font-mono text-carbon-75 truncate"},yp={key:0,class:"block text-14 font-semibold text-carbon-100 truncate"},Tp={key:1,class:"block text-12 text-carbon-50 line-clamp-2 mt-0.5"},wp={class:"hidden group-hover:flex shrink-0 items-center gap-0.5"},Sp=["aria-label","onClick"],Ip=["aria-label","onClick"],Lp={key:1,"data-test":"skills-empty"},Cp={__name:"SkillsGrid",setup(s){const e=In(),t=D(()=>e.skills),n=S(null),l=D(()=>[{icon:"refresh",title:i("SKILLS_BENEFIT_1_TITLE"),body:i("SKILLS_BENEFIT_1_BODY")},{icon:"checklist",title:i("SKILLS_BENEFIT_2_TITLE"),body:i("SKILLS_BENEFIT_2_BODY")},{icon:"pencil",title:i("SKILLS_BENEFIT_3_TITLE"),body:i("SKILLS_BENEFIT_3_BODY")},{icon:"chat",title:i("SKILLS_BENEFIT_4_TITLE"),body:i("SKILLS_BENEFIT_4_BODY")}]);fe(()=>e.loadSkills());function r(u){n.value=u}async function d(){const u=n.value;n.value=null,u&&await e.removeSkill(u.id)}return(u,c)=>(p(),m("div",bp,[o("div",_p,[o("h2",mp,_(a(i)("SKILLS_MENU_TITLE")),1),o("button",{type:"button","data-test":"skills-create",class:"flex items-center gap-1.5 rounded-lg bg-carbon-100 px-3 py-2 text-13 font-medium text-white hover:opacity-90",onClick:c[0]||(c[0]=h=>a(e).openCreateSkill())},[T(a(M),{icon:"plus",size:16,area:20}),G(" "+_(a(i)("SKILLS_NEW")),1)])]),t.value.length?(p(),m("div",gp,[(p(!0),m(X,null,oe(t.value,h=>(p(),m("div",{key:h.id,"data-test":"skill-card",role:"button",tabindex:"0",class:"group relative flex items-start gap-3 text-left rounded-xl border border-carbon-25 bg-white px-4 py-4 cursor-pointer transition-all hover:border-carbon-100 hover:shadow-around",onClick:b=>a(e).openEditSkill(h),onKeydown:Ze(b=>a(e).openEditSkill(h),["enter"])},[o("span",vp,[T(a(M),{icon:"checklist",size:16,area:20})]),o("span",Ep,[o("span",kp,"/"+_(h.slug),1),h.name?(p(),m("span",yp,_(h.name),1)):N("",!0),h.description?(p(),m("span",Tp,_(h.description),1)):N("",!0)]),o("div",wp,[o("button",{type:"button","data-test":"skill-edit",class:"p-1 rounded-md text-carbon-50 hover:text-carbon-100 hover:bg-carbon-5","aria-label":a(i)("SKILLS_EDIT"),onClick:_e(b=>a(e).openEditSkill(h),["stop"])},[T(a(M),{icon:"pencil",size:16,area:20})],8,Sp),o("button",{type:"button","data-test":"skill-delete",class:"p-1 rounded-md text-carbon-50 hover:text-red-600 hover:bg-carbon-5","aria-label":a(i)("SKILLS_DELETE"),onClick:_e(b=>r(h),["stop"])},[T(a(M),{icon:"trash",size:16,area:20})],8,Ip)])],40,xp))),128))])):(p(),m("div",Lp,[T(Qt,{icon:"checklist",title:a(i)("SKILLS_EMPTY_TITLE"),body:a(i)("SKILLS_EMPTY_BODY"),"action-label":a(i)("SKILLS_NEW"),onAction:c[1]||(c[1]=h=>a(e).openCreateSkill())},null,8,["title","body","action-label"])])),T(zn,{icon:"checklist",title:a(i)("SKILLS_INFO_TITLE"),body:a(i)("SKILLS_INFO_BODY"),benefits:l.value,class:"mt-8"},null,8,["title","body","benefits"]),T(a(Tn),{visible:!!n.value,title:a(i)("SKILLS_DELETE"),message:n.value?a(i)("SKILLS_DELETE_CONFIRM",{name:`/${n.value.slug}`}):"","confirm-label":a(i)("SKILLS_DELETE"),"cancel-label":a(i)("HAUSS_INTELLIGENCE_CLOSE"),onConfirm:d,onCancel:c[2]||(c[2]=h=>n.value=null)}
65,null,8,["visible","title","message","confirm-label","cancel-label"])]))}},Ap={class:"flex flex-col min-h-0 flex-1"},$p={class:"shrink-0 px-6 pt-6 pb-4 border-b border-carbon-100"},Rp={class:"text-xl font-bold text-carbon-100 mb-3"},Np={class:"space-y-1"},Op={class:"h-1.5 w-full bg-carbon-100 rounded-full overflow-hidden"},Mp={class:"text-xs text-carbon-50"},Dp={class:"flex-1 min-h-0 overflow-y-auto px-6 py-5"},Fp={key:0,class:"flex items-center justify-center py-12"},Pp={key:1,class:"flex flex-col gap-6"},zp={class:"flex items-start justify-between mb-3"},Up={class:"flex items-center gap-2"},Bp={class:"font-semibold text-carbon-100 text-sm"},Hp={class:"text-xs text-carbon-50 shrink-0 pt-0.5"},Wp={class:"flex items-start justify-between mb-3"},jp={class:"flex items-center gap-2"},Gp={class:"font-semibold text-carbon-100 text-sm"},Vp={class:"text-xs text-carbon-50 shrink-0 pt-0.5"},Kp={key:0},qp={class:"flex items-start justify-between mb-3"},Yp={class:"flex items-center gap-2"},Zp={class:"font-semibold text-carbon-100 text-sm"},Xp={class:"text-xs text-carbon-50 shrink-0 pt-0.5"},Qp={class:"flex items-start justify-between mb-3"},Jp={class:"flex items-center gap-2"},ef={class:"font-semibold text-carbon-100 text-sm"},tf={class:"text-xs text-carbon-50 shrink-0 pt-0.5"},nf={class:"flex items-start justify-between mb-3"},sf={class:"flex items-center gap-2"},af={class:"font-semibold text-carbon-100 text-sm"},lf={class:"text-xs text-carbon-50 shrink-0 pt-0.5"},of={class:"flex items-start justify-between mb-3"},rf={class:"flex items-center gap-2"},cf={class:"font-semibold text-carbon-100 text-sm"},uf={class:"text-xs text-carbon-50 shrink-0 pt-0.5"},df={class:"flex flex-col gap-2"},pf=["aria-label"],ff={class:"text-sm text-carbon-50"},hf={class:"text-xs text-carbon-50"},bf={class:"text-xs text-carbon-50"},_f={key:0,class:"flex items-center gap-3"},mf={class:"text-xs font-semibold text-carbon-100"},gf={class:"text-xs text-carbon-50"},xf={key:1,class:"flex flex-col gap-1"},vf={class:"text-xs text-carbon-100 truncate"},Ef=["aria-label","onClick"],kf={key:2,class:"text-xs text-danger",role:"alert"},yf={key:1,class:"text-sm text-danger",role:"alert"},Tf={class:"shrink-0 border-t border-carbon-100 px-6 py-3 flex items-center justify-between gap-4"},wf={class:"flex flex-col gap-1 min-w-0"},Sf={class:"text-xs font-semibold text-carbon-50 tracking-widest uppercase"},If={key:0,class:"flex flex-wrap gap-1.5"},Lf=["aria-label","onClick"],ys=4,_n=10,Cf=5*1024*1024,St=30*1024*1024,Af=Object.assign({name:"SoulWizardContent"},{__name:"SoulWizardContent",setup(s){const e=bt(),t=S(!0),n=da(),l=pa(),r=fa(),d=ha(),u=S(null),c=S([]);function h(x,g){var A;const w=(A=u.value)==null?void 0:A[g];return w?x.filter(P=>w.has(P.value)):x}const b=D(()=>h((n.data??[]).map(x=>({value:x.id,label:x.name})),"jurisdictions")),E=D(()=>h((l.data??[]).map(x=>({value:x.id,label:x.name})),"practice_areas")),k=D(()=>h((d.data??[]).map(x=>({value:x.id,label:x.name})),"industries")),C=D(()=>h(c.value.map(x=>({value:x.id,label:x.name})),"subareas")),v=D(()=>new Map((n.data??[]).map(x=>[x.id,x.name]))),I=D(()=>new Map((l.data??[]).map(x=>[x.id,x.name]))),y=D(()=>new Map((d.data??[]).map(x=>[x.id,x.name]))),H=D(()=>new Map(c.value.map(x=>[x.id,x.name]))),K=D(()=>n.isLoading||l.isLoading||d.isLoading),O=S([]),R=S([]),B=S([]),j=S(null),ie=S([]);pe(R,async x=>{if(!x.length){c.value=[],B.value=[];return}const g=new Map;for(const A of x){const P=await r.run({areaId:A});for(const V of(P==null?void 0:P.data)??[])g.set(V.id,{id:V.id,name:V.name})}c.value=[...g.values()];const w=new Set(c.value.map(A=>A.id));B.value=B.value.filter(A=>w.has(A))});const $=S([]),z=S(null),W=S(!1),Z=S(null),ye=[".txt",".eml"],ge=D(()=>$.value.reduce((x,g)=>x+g.size,0)),Oe=D(()=>ge.value/St),tt=D(()=>Oe.value>=.9?"danger":Oe.value>=.7?"warn":"default");function je(x){return`${(x/(1024*1024)).toFixed(1)} MB`}const nt=D(()=>i("SOUL_WIZARD_SECTION_VOICE_BUDGET",{used:je(ge.value),total:je(St)}));function Me(x){const g=x.name.slice(x.name.lastIndexOf(".")).toLowerCase();return ye.includes(g)?x.size>Cf?`${x.name} supera 5 MB`:null:`Tipo no soportado: ${x.name} (solo .txt y .eml)`}function Ge(x){z.value=null;const g=Array.from(x),w=_n-$.value.length;if(w<=0){z.value=`Máximo ${_n} archivos`;return}const A=g.slice(0,w);let P=ge.value;for(const V of A){const ce=Me(V);if(ce){z.value=ce;return}
65if(!$.value.some(mt=>mt.name===V.name)){if(P+V.size>St){z.value=i("SOUL_WIZARD_SECTION_VOICE_BUDGET_EXCEEDED",{total:je(St)});return}P+=V.size,$.value=[...$.value,V]}}}function Le(x){$.value=$.value.filter((g,w)=>w!==x),z.value=null}function se(x){Ge(x.target.files),x.target.value=""}function Ce(x){W.value=!1,Ge(x.dataTransfer.files)}const J=D(()=>{let x=0;return O.value.length>0&&x++,R.value.length>0&&x++,j.value&&x++,(ie.value.length>0||$.value.length>0)&&x++,x}),Xe=D(()=>Math.round(J.value/ys*100)),ee=D(()=>e.isLoading||O.value.length===0||R.value.length===0||!j.value),Te=D(()=>{const x=[];for(const g of O.value)x.push({label:v.value.get(g)??g,field:"jurisdictions",value:g});for(const g of R.value)x.push({label:I.value.get(g)??g,field:"practiceAreas",value:g});for(const g of B.value)x.push({label:H.value.get(g)??g,field:"subareas",value:g});if(j.value){const g={EXTERNAL_ADVISOR:i("SOUL_WIZARD_EXPERIENCE_EXTERNAL_ADVISOR_LABEL"),IN_HOUSE:i("SOUL_WIZARD_EXPERIENCE_IN_HOUSE_LABEL"),MIXED:i("SOUL_WIZARD_EXPERIENCE_MIXED_LABEL")};x.push({label:g[j.value],field:"experience",value:j.value})}for(const g of ie.value)x.push({label:y.value.get(g)??g,field:"industries",value:g});return x});function Ve({field:x,value:g}){x==="jurisdictions"?O.value=O.value.filter(w=>w!==g):x==="practiceAreas"?R.value=R.value.filter(w=>w!==g):x==="subareas"?B.value=B.value.filter(w=>w!==g):x==="experience"?j.value=null:x==="industries"&&(ie.value=ie.value.filter(w=>w!==g))}async function we(){if(!ee.value){Z.value=null;try{await e.generate({jurisdictions:O.value.map(x=>v.value.get(x)??x),practice_areas:R.value.map(x=>I.value.get(x)??x),subareas:B.value.map(x=>H.value.get(x)??x),experience:j.value,industries:ie.value.map(x=>y.value.get(x)??x),jurisdiction_ids:O.value,practice_area_ids:R.value,subarea_ids:B.value,industry_ids:ie.value,attached_mails_files:$.value})}catch(x){t.value&&(Z.value=x.message)}}}return fe(async()=>{await Promise.all([n.run({size:100}),l.run({size:100}),d.run({size:100}),xa().then(x=>{u.value={jurisdictions:new Set((x==null?void 0:x.jurisdictions)??[]),practice_areas:new Set((x==null?void 0:x.practice_areas)??[]),subareas:new Set((x==null?void 0:x.subareas)??[]),industries:new Set((x==null?void 0:x.industries)??[])}}).catch(()=>{u.value=null})])}),Ie(()=>{t.value=!1,e.abort()}),(x,g)=>(p(),m("div",Ap,[o("div",$p,[o("h1",Rp,_(a(i)("SOUL_WIZARD_TITLE")),1),o("div",Np,[o("div",Op,[o("div",{class:"h-full bg-yellow rounded-full transition-all duration-500",style:Ss({width:`${Xe.value}%`})},null,4)]),o("p",Mp,_(a(i)("SOUL_WIZARD_STEP_OF",{current:J.value,total:ys}))+" · "+_(a(i)("SOUL_WIZARD_SUBTITLE")),1)])]),o("div",Dp,[K.value?(p(),m("div",Fp,[T(a(jt),{size:"sm"})])):(p(),m("div",Pp,[o("section",null,[o("div",zp,[o("div",Up,[g[10]||(g[10]=o("span",{class:"w-6 h-6 rounded-full bg-carbon-100 text-white text-xs font-bold flex items-center justify-center shrink-0"},"1",-1)),o("h2",Bp,_(a(i)("SOUL_WIZARD_SECTION_JURISDICTIONS_LABEL")),1)]),o("span",Hp,_(a(i)("SOUL_WIZARD_SECTION_JURISDICTIONS_HINT")),1)]),T(Ft,{modelValue:O.value,"onUpdate:modelValue":g[0]||(g[0]=w=>O.value=w),options:b.value},null,8,["modelValue","options"])]),o("section",null,[o("div",Wp,[o("div",jp,[g[11]||(g[11]=o("span",{class:"w-6 h-6 rounded-full bg-carbon-100 text-white text-xs font-bold flex items-center justify-center shrink-0"},"2",-1)),o("h2",Gp,_(a(i)("SOUL_WIZARD_SECTION_PRACTICE_AREAS_LABEL")),1)]),o("span",Vp,_(a(i)("SOUL_WIZARD_SECTION_PRACTICE_AREAS_HINT")),1)]),T(Ft,{modelValue:R.value,"onUpdate:modelValue":g[1]||(g[1]=w=>R.value=w),options:E.value},null,8,["modelValue","options"])]),C.value.length?(p(),m("section",Kp,[o("div",qp,[o("div",Yp,[g[12]||(g[12]=o("span",{class:"w-6 h-6 rounded-full bg-carbon-25 text-carbon-75 text-xs font-bold flex items-center justify-center shrink-0"},"+",-1)),o("h2",Zp,_(a(i)("SOUL_WIZARD_SECTION_SUBAREAS_LABEL")),1)]),o("span",Xp,_(a(i)("SOUL_WIZARD_SECTION_SUBAREAS_HINT")),1)]),T(Ft,{modelValue:B.value,"onUpdate:modelValue":g[2]||(g[2]=w=>B.value=w),options:C.value},null,8,["modelValue","options"])])):N("",!0),o("section",null,[o("div",Qp,[o("div",Jp,[g[13]||(g[13]=o("span",{class:"w-6 h-6 rounded-full bg-carbon-100 text-white text-xs font-bold flex items-center justify-center shrink-0"},"3",-1)),o("h2",ef,_(a(i)("SOUL_WIZARD_SECTION_EXPERIENCE_LABEL")),1
65)]),o("span",tf,_(a(i)("SOUL_WIZARD_SECTION_EXPERIENCE_HINT")),1)]),T(va,{modelValue:j.value,"onUpdate:modelValue":g[3]||(g[3]=w=>j.value=w)},null,8,["modelValue"])]),o("section",null,[o("div",nf,[o("div",sf,[g[14]||(g[14]=o("span",{class:"w-6 h-6 rounded-full bg-carbon-100 text-white text-xs font-bold flex items-center justify-center shrink-0"},"4",-1)),o("h2",af,_(a(i)("SOUL_WIZARD_SECTION_INDUSTRIES_LABEL")),1)]),o("span",lf,_(a(i)("SOUL_WIZARD_SECTION_INDUSTRIES_HINT")),1)]),T(Ft,{modelValue:ie.value,"onUpdate:modelValue":g[4]||(g[4]=w=>ie.value=w),options:k.value},null,8,["modelValue","options"])]),o("section",null,[o("div",of,[o("div",rf,[g[15]||(g[15]=o("span",{class:"w-6 h-6 rounded-full bg-carbon-100 text-white text-xs font-bold flex items-center justify-center shrink-0"},"5",-1)),o("h2",cf,_(a(i)("SOUL_WIZARD_SECTION_VOICE_LABEL")),1)]),o("span",uf,_(a(i)("SOUL_WIZARD_SECTION_VOICE_HINT")),1)]),o("div",df,[o("div",{class:ne(["rounded-xl border-2 border-dashed transition-colors cursor-pointer flex flex-col items-center justify-center gap-2 py-6 px-4 text-center",W.value?"border-carbon-100 bg-carbon-100":"border-carbon-25 bg-white hover:border-carbon-50"]),role:"button",tabindex:"0","aria-label":a(i)("SOUL_WIZARD_SECTION_VOICE_DROP_LABEL"),onDragover:g[5]||(g[5]=_e(w=>W.value=!0,["prevent"])),onDragleave:g[6]||(g[6]=_e(w=>W.value=!1,["prevent"])),onDrop:_e(Ce,["prevent"]),onClick:g[7]||(g[7]=w=>x.$refs.fileInput.click()),onKeydown:[g[8]||(g[8]=Ze(_e(w=>x.$refs.fileInput.click(),["prevent"]),["enter"])),g[9]||(g[9]=Ze(_e(w=>x.$refs.fileInput.click(),["prevent"]),["space"]))]},[g[16]||(g[16]=o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6 text-carbon-50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"1.5","aria-hidden":"true"},[o("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})],-1)),o("p",ff,_(a(i)("SOUL_WIZARD_SECTION_VOICE_DROP_HINT")),1),o("p",hf,_(a(i)("SOUL_WIZARD_SECTION_VOICE_DROP_TYPES")),1)],42,pf),o("p",bf,_(a(i)("SOUL_WIZARD_SECTION_VOICE_ATTACHMENTS_NOTE")),1),$.value.length>0?(p(),m("div",_f,[T(a(ua),{total:St,amount:ge.value,category:tt.value,radius:22},{default:$e(()=>[o("span",mf,_($.value.length)+"/"+_(_n),1)]),_:1},8,["amount","category"]),o("span",gf,_(nt.value),1)])):N("",!0),o("input",{ref:"fileInput",type:"file",multiple:"",accept:".txt,.eml","aria-label":"Seleccionar archivos de correo",class:"sr-only",onChange:se},null,544),$.value.length>0?(p(),m("ul",xf,[(p(!0),m(X,null,oe($.value,(w,A)=>(p(),m("li",{key:w.name,class:"flex items-center justify-between gap-2 rounded-lg border border-carbon-100 bg-white px-3 py-2"},[o("span",vf,_(w.name),1),o("button",{type:"button",class:"shrink-0 text-carbon-50 hover:text-danger transition-colors focus:outline-none","aria-label":`Eliminar ${w.name}`,onClick:P=>Le(A)},g[17]||(g[17]=[o("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},[o("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)]),8,Ef)]))),128))])):N("",!0),z.value?(p(),m("p",kf,_(z.value),1)):N("",!0)])]),Z.value?(p(),m("p",yf,_(Z.value),1)):N("",!0)]))]),o("div",Tf,[o("div",wf,[o("p",Sf,_(a(i)("SOUL_WIZARD_SUMMARY_LABEL")),1),Te.value.length>0?(p(),m("div",If,[(p(!0),m(X,null,oe(Te.value,w=>(p(),m("span",{key:`${w.field}-${w.value}`,style:{background:"#111827",color:"white","font-size":"11px",padding:"2px 8px 2px 10px","border-radius":"999px","font-weight":"500",display:"inline-flex","align-items":"center",gap:"4px","white-space":"nowrap"}},[G(_(w.label)+" ",1),o("button",{type:"button",style:{background:"none",border:"none",color:"rgba(255,255,255,0.65)",cursor:"pointer",padding:"0","line-height":"1","font-size":"14px",display:"flex","align-items":"center"},"aria-label":`Quitar ${w.label}`,onClick:A=>Ve(w)}," × ",8,Lf)]))),128))])):N("",!0)]),T(a(ht),{category:"primary",size:"fit",disabled:ee.value,onClick:we},{default:$e(()=>[a(e).isLoading?(p(),m(X,{key:0},[T(a(jt),{size:"sm",class:"mr-2"}),G(" "+_(a(i)("SOUL_WIZARD_LOADING")),1)],64)):(p(),m(X,{key:1},[G(_(a(i)("SOUL_WIZARD_SUBMIT")),1)],64))]),_:1},8,["disabled"])])]))}}),$f={class:"flex flex-col min-h-0 flex-1"},Rf={class:"shrink-0 px-6 pt-6 pb-4 border-b border-carbon-100"},Nf={class:"text-xs font-semibold text-carbon-50 tracking-widest uppercase mb-1"},Of={class:"text-xl font-bold text-carbon-100 mb-1"},Mf={class:"text-xs text-carbon-50"},Df={class:"flex-1 min-h-0 overflow-y-auto px-6 py-5 flex flex-col gap-4"},Ff={key:0,"data-test":"step2-discarded-mails",class:"text-xs text-carbon-50 rounded-lg bg-carbon-5 px-3 py-2"},Pf={"data-test":"step2-email",class:"rounded-xl border border-carbon-25 p-4 flex flex-col gap-3"},zf={class:"flex items-start gap-3"},Uf={class:"font-semibold text-carbon-100 text-sm"},Bf={class:"text-xs text-carbon-50"},Hf={key:0,"data-test":"step2-email-connected",class:"flex flex-wrap gap-1.5"},Wf={key:1,class:"grid grid-cols-2 gap-3"},jf={"data-test":"step2-onedrive",class:"rounded-xl border border-carbon-25 p-4 flex flex-col gap-3"},Gf={class:"flex items-start gap-3"},Vf={class:"font-semibold text-carbon-100 text-sm"},Kf={class:"text-xs text-carbon-50"},qf={key:0,"data-test":"step2-onedrive-connected",class:"flex"},Yf={class:"text-xs rounded-full bg-success-light text-carbon-100 px-2.5 py-0.5"},Zf={key:1,class:"flex justify-center"},Xf={class:"shrink-0 border-t border-carbon-100 px-6 py-3 flex items-center justify-end gap-3"},Qf=Object.assign({name:"SoulWizardIntegrationsStep"},{__name:"SoulWizardIntegrationsStep",setup(s){const e=bt(),t=Ls(),n=Is(),l=D(()=>t.accounts.length>0),r=D(()=>l.value||n.connected);return fe(()=>{t.loadStatus(),n.loadStatus()}),(d,u)=>(p(),m("div",$f,[o("div",Rf,[o("p",Nf,_(a(i)("SOUL_WIZARD_HEADER_LABEL")),1
65),o("h1",Of,_(a(i)("SOUL_WIZARD_STEP2_TITLE")),1),o("p",Mf,_(a(i)("SOUL_WIZARD_STEP2_SUBTITLE")),1)]),o("div",Df,[a(e).discardedMails>0?(p(),m("p",Ff,_(a(i)("SOUL_WIZARD_SECTION_VOICE_DISCARDED",{count:a(e).discardedMails})),1)):N("",!0),o("section",Pf,[o("div",zf,[u[5]||(u[5]=o("span",{class:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-carbon-5 text-base"},"✉",-1)),o("div",null,[o("h2",Uf,_(a(i)("SOUL_WIZARD_STEP2_EMAIL_TITLE")),1),o("p",Bf,_(a(i)("SOUL_WIZARD_STEP2_EMAIL_DESC")),1)])]),l.value?(p(),m("div",Hf,[(p(!0),m(X,null,oe(a(t).accounts,c=>(p(),m("span",{key:`${c.provider}-${c.email}`,class:"text-xs rounded-full bg-success-light text-carbon-100 px-2.5 py-0.5"},_(c.email),1))),128))])):(p(),m("div",Wf,[o("button",{type:"button","data-test":"step2-connect-google",class:"flex items-center justify-center gap-2 rounded-lg border border-carbon-25 px-3 py-3 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:u[0]||(u[0]=c=>a(t).connectGoogle())},[T(a(M),{icon:"mail",size:20}),G(" "+_(a(i)("EMAIL_GOOGLE")),1)]),a(t).msSupported?(p(),m("button",{key:0,type:"button","data-test":"step2-connect-microsoft",class:"flex items-center justify-center gap-2 rounded-lg border border-carbon-25 px-3 py-3 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:u[1]||(u[1]=c=>a(t).connectMicrosoft())},[T(a(M),{icon:"mail",size:20}),G(" "+_(a(i)("EMAIL_MICROSOFT")),1)])):N("",!0)]))]),o("section",jf,[o("div",Gf,[u[6]||(u[6]=o("span",{class:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-carbon-5 text-base"},"⧉",-1)),o("div",null,[o("h2",Vf,_(a(i)("SOUL_WIZARD_STEP2_ONEDRIVE_TITLE")),1),o("p",Kf,_(a(i)("SOUL_WIZARD_STEP2_ONEDRIVE_DESC")),1)])]),a(n).connected?(p(),m("div",qf,[o("span",Yf,_(a(n).email||a(i)("SOUL_WIZARD_STEP2_CONNECTED")),1)])):(p(),m("div",Zf,[o("button",{type:"button","data-test":"step2-connect-onedrive",class:"flex w-1/2 items-center justify-center gap-2 rounded-lg border border-carbon-25 px-3 py-3 text-sm text-carbon-75 hover:bg-carbon-5 transition-colors",onClick:u[2]||(u[2]=c=>a(n).connect())},[u[7]||(u[7]=o("span",{class:"text-base leading-none"},"⧉",-1)),G(" "+_(a(i)("ONEDRIVE_CONNECT")),1)])]))])]),o("div",Xf,[r.value?(p(),ae(a(ht),{key:1,category:"primary",size:"fit","data-test":"step2-done",onClick:u[4]||(u[4]=c=>a(e).finishIntegrationsStep())},{default:$e(()=>[G(_(a(i)("SOUL_WIZARD_STEP2_DONE")),1)]),_:1})):(p(),m("button",{key:0,type:"button","data-test":"step2-skip",class:"text-sm text-carbon-50 hover:text-carbon-100 transition-colors",onClick:u[3]||(u[3]=c=>a(e).finishIntegrationsStep())},_(a(i)("SOUL_WIZARD_STEP2_SKIP")),1))])]))}});function Jf({storageKey:s,initial:e,min:t,max:n}){const l=k=>Math.min(n,Math.max(t,k)),r=s?parseInt(localStorage.getItem(s),10):NaN,d=S(l(Number.isFinite(r)?r:e));let u=0,c=0;function h(k){d.value=l(c+(k.clientX-u))}function b(){window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",b),s&&localStorage.setItem(s,String(d.value))}function E(k){var C;(C=k.preventDefault)==null||C.call(k),u=k.clientX,c=d.value,window.addEventListener("pointermove",h),window.addEventListener("pointerup",b)}return Ie(()=>{window.removeEventListener("pointermove",h),window.removeEventListener("pointerup",b)}),{width:d,startDrag:E}}const eh={key:0,class:"relative flex h-full overflow-hidden bg-white"},th={class:"flex-1 min-w-0 flex flex-col"},nh={key:0,class:"absolute inset-0 z-40 flex items-center justify-center p-6"},sh={class:"relative bg-white rounded-2xl shadow-2xl flex flex-col overflow-hidden",style:{width:"100%","max-width":"640px","max-height":"80vh","box-shadow":"0 25px 60px rgba(0,0,0,0.25), 0 8px 20px rgba(0,0,0,0.15)"}},ah={key:1,class:"h-full bg-bone"},lh={key:2,class:"relative flex h-full items-center justify-center overflow-hidden bg-bone px-6","data-testid":"intelligence-placeholder"},oh={class:"relative flex max-w-lg flex-col items-center text-center"},rh={class:"mt-6 inline-flex items-center gap-1.5 rounded-full bg-value-wash px-3 py-1 font-satoshi text-11 font-medium uppercase tracking-[0.12em] text-value-ink"},ih={class:"mt-4 font-gt-super text-30 leading-tight tracking-tight text-ink lg:text-34"},ch={class:"mt-3 font-satoshi text-15 leading-relaxed text-ink-60"},xh=Object.assign({name:ba(import.meta.url)},{__name:"HaussIntelligenceView",setup(s){const e=He(),t=bt(),n=et(),l=S(!0),{width:r,startDrag:d}=Jf({storageKey:"ambar-twin-sidebar-width",initial:264,min:220,max:440}),{hasIntelligenceAccess:u,intelligenceFlagsReady:c}=ka(),h=D(()=>t.isFetched&&!t.hasSoul||t.showIntegrationsStep);fe(()=>{document.body.classList.add("ambar-twin-view")});let b=!1;const E=async()=>{b||!l.value||(b=!0,e.loadChats(),await t.fetchSoul())},k=pe(u,C=>{C&&E()},{immediate:!0});return Ie(()=>{l.value=!1,document.body.classList.remove("ambar-twin-view"),k(),b&&(e.destroy(),t.abort())}),_a((C,v,I)=>
65(console.error("[Twin] error contenido en la vista:",I,C),!1)),(C,v)=>a(u)?(p(),m("div",eh,[T(Zu,{style:Ss({width:a(r)+"px"}),class:"shrink-0"},null,8,["style"]),T(hp,{onStart:a(d)},null,8,["onStart"]),o("div",th,[a(n).view==="chat"?(p(),ae(qr,{key:0})):a(n).view==="clients"?(p(),ae(jd,{key:1})):a(n).view==="client"?(p(),ae(Nd,{key:2})):a(n).view==="matter"?(p(),ae(fp,{key:3})):a(n).view==="skills"?(p(),ae(Cp,{key:4})):N("",!0)]),T(mn,{"enter-active-class":"transition-opacity duration-200","leave-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","leave-to-class":"opacity-0"},{default:$e(()=>[h.value?(p(),m("div",nh,[v[0]||(v[0]=o("div",{class:"absolute inset-0 bg-carbon-100/40"},null,-1)),o("div",sh,[a(t).showIntegrationsStep?(p(),ae(Qf,{key:0})):(p(),ae(Af,{key:1}))])])):N("",!0)]),_:1})])):a(c)?(p(),m("div",lh,[v[2]||(v[2]=o("div",{class:"pointer-events-none absolute inset-0",style:{background:"radial-gradient(60% 55% at 50% 42%, rgba(200,160,74,0.10), transparent 70%)"}},null,-1)),o("div",oh,[T(a(Sa),{class:"h-16 w-16 text-ink"}),o("span",rh,[v[1]||(v[1]=o("span",{class:"h-1.5 w-1.5 rounded-full bg-value"},null,-1)),G(" "+_(C.$t("HAUSS_INTELLIGENCE_PLACEHOLDER_BADGE")),1)]),o("h1",ih,_(C.$t("HAUSS_INTELLIGENCE_PLACEHOLDER_TITLE")),1),o("p",ch,_(C.$t("HAUSS_INTELLIGENCE_PLACEHOLDER_BODY")),1)])])):(p(),m("div",ah))}});export{xh 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.