solace-agent-mesh 1.3.2__py3-none-any.whl → 1.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of solace-agent-mesh might be problematic. Click here for more details.
- solace_agent_mesh/agent/adk/artifacts/filesystem_artifact_service.py +16 -8
- solace_agent_mesh/agent/adk/setup.py +183 -8
- solace_agent_mesh/agent/sac/app.py +337 -622
- solace_agent_mesh/agent/sac/component.py +47 -1
- solace_agent_mesh/agent/tools/dynamic_tool.py +36 -5
- solace_agent_mesh/agent/tools/tool_config_types.py +58 -0
- solace_agent_mesh/assets/docs/404.html +3 -3
- solace_agent_mesh/assets/docs/assets/js/0e682baa.da822665.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1023fc19.8a8a9309.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.2645ef68.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.43771adc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.2afaee76.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/332e10b5.f7629851.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/3d406171.5560fdf9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.508ae8db.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/442a8107.b5c2532a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/483cef9a.8d318c2f.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/55f47984.bcd00a86.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.dff11eca.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/664b740a.ba305a89.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/75384d09.abdf9cf9.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/768e31b0.9abcdc48.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/945fb41e.abf2be91.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9a09e75d.92de8cf5.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.d62aad71.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.1d029b81.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{aba87c2f.071e2d94.js → aba87c2f.4ddf32f2.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/ae0e903d.abca774a.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/ae4415af.24cdc514.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/bac0be12.27ee2c26.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c2c06897.87cb1f47.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/c835a94d.ce21f0bf.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cc969b05.feef7dcc.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.a19e7d78.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{cee5d587.f5b73ca1.js → cee5d587.f1e1ca86.js} +1 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.cad4dbf2.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/f897a61a.bc634a3e.js +1 -0
- solace_agent_mesh/assets/docs/assets/js/{main.4adc477a.js → main.1de3da6a.js} +2 -2
- solace_agent_mesh/assets/docs/assets/js/runtime~main.3188e049.js +1 -0
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/installation/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/Enterprise/single-sign-on/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-gateway-upgrade-to-0.3.0/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/Migrations/A2A Upgrade To 0.3.0/a2a-technical-migration-map/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/concepts/agents/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/concepts/architecture/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/cli/index.html +18 -18
- solace_agent_mesh/assets/docs/docs/documentation/concepts/gateways/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/orchestrator/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/concepts/plugins/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/deployment/debugging/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/deployment/deploy/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/deployment/observability/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/component-overview/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/configurations/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/installation/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/introduction/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/getting-started/quick-start/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/bedrock-agents/index.html +23 -23
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/custom-agent/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/event-mesh-gateway/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mcp-integration/index.html +4 -4
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/mongodb-integration/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rag-integration/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/rest-gateway/index.html +8 -8
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/slack-integration/index.html +6 -6
- solace_agent_mesh/assets/docs/docs/documentation/tutorials/sql-database/index.html +9 -9
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/artifact-management/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/audio-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/data-analysis-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/embeds/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/builtin-tools/index.html +5 -5
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-agents/index.html +19 -19
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/create-gateways/index.html +7 -7
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-python-tools/index.html +73 -8
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/creating-service-providers/index.html +10 -10
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/solace-ai-connector/index.html +3 -3
- solace_agent_mesh/assets/docs/docs/documentation/user-guide/structure/index.html +4 -4
- solace_agent_mesh/assets/docs/lunr-index-1757991496554.json +1 -0
- solace_agent_mesh/assets/docs/lunr-index.json +1 -1
- solace_agent_mesh/assets/docs/search-doc-1757991496554.json +1 -0
- solace_agent_mesh/assets/docs/search-doc.json +1 -1
- solace_agent_mesh/cli/__init__.py +1 -1
- solace_agent_mesh/cli/commands/run_cmd.py +4 -7
- solace_agent_mesh/client/webui/frontend/static/assets/{authCallback-CAX9u8a7.js → authCallback-j1LW-wlq.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/{client-DXU9SPI5.js → client-B9p_nFNA.js} +1 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-B9s_V9tJ.css +1 -0
- solace_agent_mesh/client/webui/frontend/static/assets/main-Dq4AJNvn.js +339 -0
- solace_agent_mesh/client/webui/frontend/static/assets/{vendor-B0BEKoAR.js → vendor-CS5YMf8a.js} +74 -69
- solace_agent_mesh/client/webui/frontend/static/auth-callback.html +3 -3
- solace_agent_mesh/client/webui/frontend/static/index.html +4 -4
- solace_agent_mesh/common/utils/pydantic_utils.py +56 -0
- solace_agent_mesh/config_portal/backend/plugin_catalog/registry_manager.py +6 -4
- solace_agent_mesh/gateway/base/app.py +58 -120
- solace_agent_mesh/gateway/http_sse/app.py +99 -150
- solace_agent_mesh/gateway/http_sse/component.py +57 -30
- solace_agent_mesh/gateway/http_sse/sse_event_buffer.py +87 -0
- solace_agent_mesh/gateway/http_sse/sse_manager.py +44 -23
- {solace_agent_mesh-1.3.2.dist-info → solace_agent_mesh-1.4.0.dist-info}/METADATA +1 -1
- {solace_agent_mesh-1.3.2.dist-info → solace_agent_mesh-1.4.0.dist-info}/RECORD +103 -100
- solace_agent_mesh/assets/docs/assets/js/0e682baa.b3bbde9a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1023fc19.364235d5.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1523c6b4.1b0ec6f9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/1c6e87d2.a8c5ce5a.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/2a9cab12.8909df92.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/332e10b5.7a103f42.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/3d406171.0b9eeed1.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/42b3f8d8.d97b8e94.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/442a8107.b3159bb2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/483cef9a.03d5dceb.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/55f47984.cf3781c4.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/5b4258a4.0d080cd9.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/664b740a.1b744a32.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/75384d09.c193a8f0.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/768e31b0.8b51cd70.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/945fb41e.c63791d1.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/9a09e75d.d6607c56.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/9eff14a2.472b0310.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/a3a92b25.4b7fa6a2.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ae0e903d.4d8dda10.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/ae4415af.7a2f0bbf.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/bac0be12.f50d9bac.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c2c06897.587b4af5.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/c835a94d.146e3186.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/cc969b05.bd3e0d6c.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/cd3d4052.b6535013.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f284c35a.7334119c.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/f897a61a.0aa29dbb.js +0 -1
- solace_agent_mesh/assets/docs/assets/js/runtime~main.cf0229ea.js +0 -1
- solace_agent_mesh/assets/docs/lunr-index-1757704179464.json +0 -1
- solace_agent_mesh/assets/docs/search-doc-1757704179464.json +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-C03yrETa.css +0 -1
- solace_agent_mesh/client/webui/frontend/static/assets/main-DjoMeldu.js +0 -339
- /solace_agent_mesh/assets/docs/assets/js/{main.4adc477a.js.LICENSE.txt → main.1de3da6a.js.LICENSE.txt} +0 -0
- {solace_agent_mesh-1.3.2.dist-info → solace_agent_mesh-1.4.0.dist-info}/WHEEL +0 -0
- {solace_agent_mesh-1.3.2.dist-info → solace_agent_mesh-1.4.0.dist-info}/entry_points.txt +0 -0
- {solace_agent_mesh-1.3.2.dist-info → solace_agent_mesh-1.4.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
var Ap=Object.defineProperty;var Np=(e,t,n)=>t in e?Ap(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ua=(e,t,n)=>Np(e,typeof t!="symbol"?t+"":t,n);import{c as kp}from"./client-DXU9SPI5.js";import{r as u,j as a,c as zl,a as Ur,R as pi,b as _p,N as po,X as Ro,E as Ip,d as zt,C as $l,e as mi,f as jp,A as Bl,L as hi,g as gi,P as Ul,B as Mp,S as Rp,F as da,h as Pp,i as Lp,k as sr,l as Dp,m as Op,n as Fp,o as Hl,D as xi,p as Wl,q as vi,T as zp,I as wi,s as Gl,t as $p,u as Bp,v as Up,w as Vl,x as Hp,y as Yl,z as Wp,G as Gp,H as fa,J as Vp,K as Kl,M as Yp,O as Xe,Q as Ze,U as ql,V as Kp,W as qp,Y as pa,Z as ma,_ as cs,$ as Xp,a0 as Zp,a1 as Jp,a2 as Qp,a3 as em,a4 as tm,a5 as nm,a6 as rm,a7 as om,a8 as sm,a9 as im,aa as Xl,ab as am,ac as Zl,ad as lm,ae as ha,af as ga,ag as cm,ah as xa,ai as um,aj as dm,ak as fm}from"./vendor-B0BEKoAR.js";function va(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jl(...e){return t=>{let n=!1;const r=e.map(o=>{const s=va(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():va(e[o],null)}}}}function $e(...e){return u.useCallback(Jl(...e),e)}function Pn(e){const t=pm(e),n=u.forwardRef((r,o)=>{const{children:s,...i}=r,l=u.Children.toArray(s),c=l.find(hm);if(c){const d=c.props.children,f=l.map(p=>p===c?u.Children.count(d)>1?u.Children.only(null):u.isValidElement(d)?d.props.children:null:p);return a.jsx(t,{...i,ref:o,children:u.isValidElement(d)?u.cloneElement(d,void 0,f):null})}return a.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}var Ql=Pn("Slot");function pm(e){const t=u.forwardRef((n,r)=>{const{children:o,...s}=n;if(u.isValidElement(o)){const i=xm(o),l=gm(s,o.props);return o.type!==u.Fragment&&(l.ref=r?Jl(r,i):i),u.cloneElement(o,l)}return u.Children.count(o)>1?u.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ec=Symbol("radix.slottable");function mm(e){const t=({children:n})=>a.jsx(a.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=ec,t}function hm(e){return u.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ec}function gm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{const c=s(...l);return o(...l),c}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function xm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const wa=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,ba=zl,Tn=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return ba(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(d=>{const f=n==null?void 0:n[d],p=s==null?void 0:s[d];if(f===null)return null;const m=wa(f)||wa(p);return o[d][m]}),l=n&&Object.entries(n).reduce((d,f)=>{let[p,m]=f;return m===void 0||(d[p]=m),d},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((d,f)=>{let{class:p,className:m,...h}=f;return Object.entries(h).every(x=>{let[g,v]=x;return Array.isArray(v)?v.includes({...s,...l}[g]):{...s,...l}[g]===v})?[...d,p,m]:d},[]);return ba(e,i,c,n==null?void 0:n.class,n==null?void 0:n.className)},bi=()=>localStorage.getItem("access_token"),vm=()=>localStorage.getItem("refresh_token"),wm=(e,t)=>{localStorage.setItem("access_token",e),localStorage.setItem("refresh_token",t)},bm=()=>{localStorage.removeItem("access_token"),localStorage.removeItem("refresh_token")},ym=async()=>{const e=vm();if(!e)return null;const t=await fetch("/api/v1/auth/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e})});if(t.ok){const n=await t.json();return wm(n.access_token,n.refresh_token),n.access_token}return bm(),window.location.href="/api/v1/auth/login",null},ze=async(e,t={})=>{const n=bi();if(!n)return fetch(e,t);const r=await fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${n}`}});if(r.status===401){const o=await ym();if(o)return fetch(e,{...t,headers:{...t.headers,Authorization:`Bearer ${o}`}})}return r},yi="-",Sm=e=>{const t=Em(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(yi);return l[0]===""&&l.length!==1&&l.shift(),tc(l,t)||Cm(i)},getConflictingClassGroupIds:(i,l)=>{const c=n[i]||[];return l&&r[i]?[...c,...r[i]]:c}}},tc=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?tc(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(yi);return(i=t.validators.find(({validator:l})=>l(s)))==null?void 0:i.classGroupId},ya=/^\[(.+)\]$/,Cm=e=>{if(ya.test(e)){const t=ya.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Em=e=>{const{theme:t,classGroups:n}=e,r={nextPart:new Map,validators:[]};for(const o in n)Os(n[o],r,o,t);return r},Os=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Sa(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(Tm(o)){Os(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{Os(i,Sa(t,s),n,r)})})},Sa=(e,t)=>{let n=e;return t.split(yi).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Tm=e=>e.isThemeGetter,Am=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Fs="!",zs=":",Nm=zs.length,km=e=>{const{prefix:t,experimentalParseClassName:n}=e;let r=o=>{const s=[];let i=0,l=0,c=0,d;for(let x=0;x<o.length;x++){let g=o[x];if(i===0&&l===0){if(g===zs){s.push(o.slice(c,x)),c=x+Nm;continue}if(g==="/"){d=x;continue}}g==="["?i++:g==="]"?i--:g==="("?l++:g===")"&&l--}const f=s.length===0?o:o.substring(c),p=_m(f),m=p!==f,h=d&&d>c?d-c:void 0;return{modifiers:s,hasImportantModifier:m,baseClassName:p,maybePostfixModifierPosition:h}};if(t){const o=t+zs,s=r;r=i=>i.startsWith(o)?s(i.substring(o.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:i,maybePostfixModifierPosition:void 0}}if(n){const o=r;r=s=>n({className:s,parseClassName:o})}return r},_m=e=>e.endsWith(Fs)?e.substring(0,e.length-1):e.startsWith(Fs)?e.substring(1):e,Im=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(r=>[r,!0]));return r=>{if(r.length<=1)return r;const o=[];let s=[];return r.forEach(i=>{i[0]==="["||t[i]?(o.push(...s.sort(),i),s=[]):s.push(i)}),o.push(...s.sort()),o}},jm=e=>({cache:Am(e.cacheSize),parseClassName:km(e),sortModifiers:Im(e),...Sm(e)}),Mm=/\s+/,Rm=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o,sortModifiers:s}=t,i=[],l=e.trim().split(Mm);let c="";for(let d=l.length-1;d>=0;d-=1){const f=l[d],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:x,maybePostfixModifierPosition:g}=n(f);if(p){c=f+(c.length>0?" "+c:c);continue}let v=!!g,b=r(v?x.substring(0,g):x);if(!b){if(!v){c=f+(c.length>0?" "+c:c);continue}if(b=r(x),!b){c=f+(c.length>0?" "+c:c);continue}v=!1}const w=s(m).join(":"),y=h?w+Fs:w,E=y+b;if(i.includes(E))continue;i.push(E);const T=o(b,v);for(let _=0;_<T.length;++_){const I=T[_];i.push(y+I)}c=f+(c.length>0?" "+c:c)}return c};function Pm(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=nc(t))&&(r&&(r+=" "),r+=n);return r}const nc=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=nc(e[r]))&&(n&&(n+=" "),n+=t);return n};function Lm(e,...t){let n,r,o,s=i;function i(c){const d=t.reduce((f,p)=>p(f),e());return n=jm(d),r=n.cache.get,o=n.cache.set,s=l,l(c)}function l(c){const d=r(c);if(d)return d;const f=Rm(c,n);return o(c,f),f}return function(){return s(Pm.apply(null,arguments))}}const Ge=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},rc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,oc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Dm=/^\d+\/\d+$/,Om=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Fm=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,zm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,$m=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wn=e=>Dm.test(e),Te=e=>!!e&&!Number.isNaN(Number(e)),gn=e=>!!e&&Number.isInteger(Number(e)),us=e=>e.endsWith("%")&&Te(e.slice(0,-1)),an=e=>Om.test(e),Um=()=>!0,Hm=e=>Fm.test(e)&&!zm.test(e),sc=()=>!1,Wm=e=>$m.test(e),Gm=e=>Bm.test(e),Vm=e=>!ne(e)&&!re(e),Ym=e=>pr(e,lc,sc),ne=e=>rc.test(e),In=e=>pr(e,cc,Hm),ds=e=>pr(e,Jm,Te),Ca=e=>pr(e,ic,sc),Km=e=>pr(e,ac,Gm),Zr=e=>pr(e,uc,Wm),re=e=>oc.test(e),yr=e=>mr(e,cc),qm=e=>mr(e,Qm),Ea=e=>mr(e,ic),Xm=e=>mr(e,lc),Zm=e=>mr(e,ac),Jr=e=>mr(e,uc,!0),pr=(e,t,n)=>{const r=rc.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},mr=(e,t,n=!1)=>{const r=oc.exec(e);return r?r[1]?t(r[1]):n:!1},ic=e=>e==="position"||e==="percentage",ac=e=>e==="image"||e==="url",lc=e=>e==="length"||e==="size"||e==="bg-size",cc=e=>e==="length",Jm=e=>e==="number",Qm=e=>e==="family-name",uc=e=>e==="shadow",eh=()=>{const e=Ge("color"),t=Ge("font"),n=Ge("text"),r=Ge("font-weight"),o=Ge("tracking"),s=Ge("leading"),i=Ge("breakpoint"),l=Ge("container"),c=Ge("spacing"),d=Ge("radius"),f=Ge("shadow"),p=Ge("inset-shadow"),m=Ge("text-shadow"),h=Ge("drop-shadow"),x=Ge("blur"),g=Ge("perspective"),v=Ge("aspect"),b=Ge("ease"),w=Ge("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...E(),re,ne],_=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],A=()=>[re,ne,c],q=()=>[Wn,"full","auto",...A()],K=()=>[gn,"none","subgrid",re,ne],U=()=>["auto",{span:["full",gn,re,ne]},gn,re,ne],Y=()=>[gn,"auto",re,ne],J=()=>["auto","min","max","fr",re,ne],O=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],X=()=>["start","end","center","stretch","center-safe","end-safe"],N=()=>["auto",...A()],R=()=>[Wn,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...A()],S=()=>[e,re,ne],F=()=>[...E(),Ea,Ca,{position:[re,ne]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],P=()=>["auto","cover","contain",Xm,Ym,{size:[re,ne]}],ee=()=>[us,yr,In],D=()=>["","none","full",d,re,ne],$=()=>["",Te,yr,In],L=()=>["solid","dashed","dotted","double"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],k=()=>[Te,us,Ea,Ca],V=()=>["","none",x,re,ne],Q=()=>["none",Te,re,ne],te=()=>["none",Te,re,ne],oe=()=>[Te,re,ne],se=()=>[Wn,"full",...A()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[an],breakpoint:[an],color:[Um],container:[an],"drop-shadow":[an],ease:["in","out","in-out"],font:[Vm],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[an],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[an],shadow:[an],spacing:["px",Te],text:[an],"text-shadow":[an],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Wn,ne,re,v]}],container:["container"],columns:[{columns:[Te,ne,re,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:T()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:q()}],"inset-x":[{"inset-x":q()}],"inset-y":[{"inset-y":q()}],start:[{start:q()}],end:[{end:q()}],top:[{top:q()}],right:[{right:q()}],bottom:[{bottom:q()}],left:[{left:q()}],visibility:["visible","invisible","collapse"],z:[{z:[gn,"auto",re,ne]}],basis:[{basis:[Wn,"full","auto",l,...A()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Te,Wn,"auto","initial","none",ne]}],grow:[{grow:["",Te,re,ne]}],shrink:[{shrink:["",Te,re,ne]}],order:[{order:[gn,"first","last","none",re,ne]}],"grid-cols":[{"grid-cols":K()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":K()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":J()}],"auto-rows":[{"auto-rows":J()}],gap:[{gap:A()}],"gap-x":[{"gap-x":A()}],"gap-y":[{"gap-y":A()}],"justify-content":[{justify:[...O(),"normal"]}],"justify-items":[{"justify-items":[...X(),"normal"]}],"justify-self":[{"justify-self":["auto",...X()]}],"align-content":[{content:["normal",...O()]}],"align-items":[{items:[...X(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...X(),{baseline:["","last"]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...X(),"baseline"]}],"place-self":[{"place-self":["auto",...X()]}],p:[{p:A()}],px:[{px:A()}],py:[{py:A()}],ps:[{ps:A()}],pe:[{pe:A()}],pt:[{pt:A()}],pr:[{pr:A()}],pb:[{pb:A()}],pl:[{pl:A()}],m:[{m:N()}],mx:[{mx:N()}],my:[{my:N()}],ms:[{ms:N()}],me:[{me:N()}],mt:[{mt:N()}],mr:[{mr:N()}],mb:[{mb:N()}],ml:[{ml:N()}],"space-x":[{"space-x":A()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":A()}],"space-y-reverse":["space-y-reverse"],size:[{size:R()}],w:[{w:[l,"screen",...R()]}],"min-w":[{"min-w":[l,"screen","none",...R()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...R()]}],h:[{h:["screen","lh",...R()]}],"min-h":[{"min-h":["screen","lh","none",...R()]}],"max-h":[{"max-h":["screen","lh",...R()]}],"font-size":[{text:["base",n,yr,In]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,re,ds]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",us,ne]}],"font-family":[{font:[qm,ne,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[o,re,ne]}],"line-clamp":[{"line-clamp":[Te,"none",re,ds]}],leading:[{leading:[s,...A()]}],"list-image":[{"list-image":["none",re,ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",re,ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:S()}],"text-color":[{text:S()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:[Te,"from-font","auto",re,In]}],"text-decoration-color":[{decoration:S()}],"underline-offset":[{"underline-offset":[Te,"auto",re,ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re,ne]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",re,ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:F()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:P()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},gn,re,ne],radial:["",re,ne],conic:[gn,re,ne]},Zm,Km]}],"bg-color":[{bg:S()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:S()}],"gradient-via":[{via:S()}],"gradient-to":[{to:S()}],rounded:[{rounded:D()}],"rounded-s":[{"rounded-s":D()}],"rounded-e":[{"rounded-e":D()}],"rounded-t":[{"rounded-t":D()}],"rounded-r":[{"rounded-r":D()}],"rounded-b":[{"rounded-b":D()}],"rounded-l":[{"rounded-l":D()}],"rounded-ss":[{"rounded-ss":D()}],"rounded-se":[{"rounded-se":D()}],"rounded-ee":[{"rounded-ee":D()}],"rounded-es":[{"rounded-es":D()}],"rounded-tl":[{"rounded-tl":D()}],"rounded-tr":[{"rounded-tr":D()}],"rounded-br":[{"rounded-br":D()}],"rounded-bl":[{"rounded-bl":D()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...L(),"hidden","none"]}],"divide-style":[{divide:[...L(),"hidden","none"]}],"border-color":[{border:S()}],"border-color-x":[{"border-x":S()}],"border-color-y":[{"border-y":S()}],"border-color-s":[{"border-s":S()}],"border-color-e":[{"border-e":S()}],"border-color-t":[{"border-t":S()}],"border-color-r":[{"border-r":S()}],"border-color-b":[{"border-b":S()}],"border-color-l":[{"border-l":S()}],"divide-color":[{divide:S()}],"outline-style":[{outline:[...L(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Te,re,ne]}],"outline-w":[{outline:["",Te,yr,In]}],"outline-color":[{outline:S()}],shadow:[{shadow:["","none",f,Jr,Zr]}],"shadow-color":[{shadow:S()}],"inset-shadow":[{"inset-shadow":["none",p,Jr,Zr]}],"inset-shadow-color":[{"inset-shadow":S()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:S()}],"ring-offset-w":[{"ring-offset":[Te,In]}],"ring-offset-color":[{"ring-offset":S()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":S()}],"text-shadow":[{"text-shadow":["none",m,Jr,Zr]}],"text-shadow-color":[{"text-shadow":S()}],opacity:[{opacity:[Te,re,ne]}],"mix-blend":[{"mix-blend":[...G(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":G()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Te]}],"mask-image-linear-from-pos":[{"mask-linear-from":k()}],"mask-image-linear-to-pos":[{"mask-linear-to":k()}],"mask-image-linear-from-color":[{"mask-linear-from":S()}],"mask-image-linear-to-color":[{"mask-linear-to":S()}],"mask-image-t-from-pos":[{"mask-t-from":k()}],"mask-image-t-to-pos":[{"mask-t-to":k()}],"mask-image-t-from-color":[{"mask-t-from":S()}],"mask-image-t-to-color":[{"mask-t-to":S()}],"mask-image-r-from-pos":[{"mask-r-from":k()}],"mask-image-r-to-pos":[{"mask-r-to":k()}],"mask-image-r-from-color":[{"mask-r-from":S()}],"mask-image-r-to-color":[{"mask-r-to":S()}],"mask-image-b-from-pos":[{"mask-b-from":k()}],"mask-image-b-to-pos":[{"mask-b-to":k()}],"mask-image-b-from-color":[{"mask-b-from":S()}],"mask-image-b-to-color":[{"mask-b-to":S()}],"mask-image-l-from-pos":[{"mask-l-from":k()}],"mask-image-l-to-pos":[{"mask-l-to":k()}],"mask-image-l-from-color":[{"mask-l-from":S()}],"mask-image-l-to-color":[{"mask-l-to":S()}],"mask-image-x-from-pos":[{"mask-x-from":k()}],"mask-image-x-to-pos":[{"mask-x-to":k()}],"mask-image-x-from-color":[{"mask-x-from":S()}],"mask-image-x-to-color":[{"mask-x-to":S()}],"mask-image-y-from-pos":[{"mask-y-from":k()}],"mask-image-y-to-pos":[{"mask-y-to":k()}],"mask-image-y-from-color":[{"mask-y-from":S()}],"mask-image-y-to-color":[{"mask-y-to":S()}],"mask-image-radial":[{"mask-radial":[re,ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":k()}],"mask-image-radial-to-pos":[{"mask-radial-to":k()}],"mask-image-radial-from-color":[{"mask-radial-from":S()}],"mask-image-radial-to-color":[{"mask-radial-to":S()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[Te]}],"mask-image-conic-from-pos":[{"mask-conic-from":k()}],"mask-image-conic-to-pos":[{"mask-conic-to":k()}],"mask-image-conic-from-color":[{"mask-conic-from":S()}],"mask-image-conic-to-color":[{"mask-conic-to":S()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:F()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:P()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",re,ne]}],filter:[{filter:["","none",re,ne]}],blur:[{blur:V()}],brightness:[{brightness:[Te,re,ne]}],contrast:[{contrast:[Te,re,ne]}],"drop-shadow":[{"drop-shadow":["","none",h,Jr,Zr]}],"drop-shadow-color":[{"drop-shadow":S()}],grayscale:[{grayscale:["",Te,re,ne]}],"hue-rotate":[{"hue-rotate":[Te,re,ne]}],invert:[{invert:["",Te,re,ne]}],saturate:[{saturate:[Te,re,ne]}],sepia:[{sepia:["",Te,re,ne]}],"backdrop-filter":[{"backdrop-filter":["","none",re,ne]}],"backdrop-blur":[{"backdrop-blur":V()}],"backdrop-brightness":[{"backdrop-brightness":[Te,re,ne]}],"backdrop-contrast":[{"backdrop-contrast":[Te,re,ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Te,re,ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Te,re,ne]}],"backdrop-invert":[{"backdrop-invert":["",Te,re,ne]}],"backdrop-opacity":[{"backdrop-opacity":[Te,re,ne]}],"backdrop-saturate":[{"backdrop-saturate":[Te,re,ne]}],"backdrop-sepia":[{"backdrop-sepia":["",Te,re,ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":A()}],"border-spacing-x":[{"border-spacing-x":A()}],"border-spacing-y":[{"border-spacing-y":A()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",re,ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Te,"initial",re,ne]}],ease:[{ease:["linear","initial",b,re,ne]}],delay:[{delay:[Te,re,ne]}],animate:[{animate:["none",w,re,ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,re,ne]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:te()}],"scale-x":[{"scale-x":te()}],"scale-y":[{"scale-y":te()}],"scale-z":[{"scale-z":te()}],"scale-3d":["scale-3d"],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[re,ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":["translate-none"],accent:[{accent:S()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:S()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",re,ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",re,ne]}],fill:[{fill:["none",...S()]}],"stroke-w":[{stroke:[Te,yr,In,ds]}],stroke:[{stroke:["none",...S()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},th=Lm(eh);function Ce(...e){return th(zl(e))}const nh=e=>{try{const t=new URL(e);if(t.protocol!=="artifact:")return null;const n=t.pathname.split("/").filter(s=>s),r=n[n.length-1],o=t.searchParams.get("version");return{filename:r,version:o}}catch(t){return console.error("Invalid artifact URI:",t),null}},dc=(e,t)=>{try{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t||"download",document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}catch(n){console.error("Error downloading blob:",n)}},rh=async e=>{try{let t,n=e.name;if(e.content){const r=atob(e.content),o=new Array(r.length);for(let i=0;i<r.length;i++)o[i]=r.charCodeAt(i);const s=new Uint8Array(o);t=new Blob([s],{type:e.mime_type||"application/octet-stream"})}else if(e.uri){const r=nh(e.uri);if(!r)throw new Error(`Invalid or unhandled URI format: ${e.uri}`);n=r.filename;const o=r.version||"latest",s=`/api/v1/artifacts/${encodeURIComponent(n)}/versions/${o}`,i=await ze(s,{credentials:"include"});if(!i.ok)throw new Error(`Failed to download file: ${i.statusText}`);t=await i.blob()}else throw new Error("File has no content or URI to download.");dc(t,n)}catch(t){console.error("Error creating download link:",t)}},fc=(e,t=2)=>{if(e===0)return"0 Bytes";const n=1024,r=t<0?0:t,o=["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"],s=Math.floor(Math.log(e)/Math.log(n));return parseFloat((e/Math.pow(n,s)).toFixed(r))+" "+o[s]},Ta=e=>{try{const t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3),o=Math.floor(r/60),s=Math.floor(o/60),i=Math.floor(s/24);return r<60?`${r}s ago`:o<60?`${o}m ago`:s<24?`${s}h ago`:i===1?"Yesterday":i<7?`${i}d ago`:t.toLocaleDateString()}catch(t){return console.error("Error formatting date:",t),e}},Aa=(e="")=>`
|
|
2
|
-
whitespace-normal
|
|
3
|
-
break-words
|
|
4
|
-
leading-[24px]
|
|
5
|
-
|
|
6
|
-
/* Typography */
|
|
7
|
-
[&_h1]:text-2xl [&_h1]:font-bold [&_h1]:mb-4 [&_h1]:mt-6 [&_h1]:text-foreground
|
|
8
|
-
[&_h2]:text-xl [&_h2]:font-bold [&_h2]:mb-3 [&_h2]:mt-5 [&_h2]:text-foreground
|
|
9
|
-
[&_h3]:text-lg [&_h3]:font-semibold [&_h3]:mb-2 [&_h3]:mt-4 [&_h3]:text-foreground
|
|
10
|
-
[&_h4]:text-base [&_h4]:font-semibold [&_h4]:mb-2 [&_h4]:mt-3 [&_h4]:text-foreground
|
|
11
|
-
[&_h5]:text-sm [&_h5]:font-semibold [&_h5]:mb-1 [&_h5]:mt-2 [&_h5]:text-foreground
|
|
12
|
-
[&_h6]:text-xs [&_h6]:font-semibold [&_h6]:mb-1 [&_h6]:mt-2 [&_h6]:text-foreground
|
|
13
|
-
|
|
14
|
-
/* Paragraphs */
|
|
15
|
-
[&_p]:mb-2 [&_p]:leading-[24px] [&_p]:text-foreground
|
|
16
|
-
|
|
17
|
-
/* Text formatting */
|
|
18
|
-
[&_strong]:font-semibold [&_strong]:text-foreground
|
|
19
|
-
[&_em]:italic
|
|
20
|
-
[&_del]:line-through [&_del]:text-foreground
|
|
21
|
-
|
|
22
|
-
/* Links */
|
|
23
|
-
[&_a]:text-[var(--color-primary-wMain)] [&_a]:underline [&_a]:decoration-[var(--color-primary-wMain)] dark:[&_a]:text-[var(--color-primary-w20)] dark:[&_a]:decoration-[var(--color-primary-w20)]
|
|
24
|
-
[&_a:hover]:text-[var(--color-primary-w100)] [&_a:hover]:decoration-[var(--color-primary-w100)] dark:[&_a:hover]:text-[var(--color-primary-w10)] dark:[&_a:hover]:decoration-[var(--color-primary-w10)]
|
|
25
|
-
|
|
26
|
-
/* Lists */
|
|
27
|
-
[&_ul]:mb-4 [&_ul]:pl-6 [&_ul]:list-disc [&_ul]:space-y-1
|
|
28
|
-
[&_ol]:mb-4 [&_ol]:pl-6 [&_ol]:list-decimal [&_ol]:space-y-1
|
|
29
|
-
[&_li]:text-foreground [&_li]:leading-[24px]
|
|
30
|
-
[&_ul_ul]:mt-1 [&_ul_ul]:mb-1
|
|
31
|
-
[&_ol_ol]:mt-1 [&_ol_ol]:mb-1
|
|
32
|
-
|
|
33
|
-
/* Code */
|
|
34
|
-
[&_code]:bg-transparent [&_code]:py-0.5 [&_code]:rounded
|
|
35
|
-
[&_code]:text-sm [&_code]:font-mono [&_code]:font-semibold [&_code]:text-foreground [&_code]:break-words
|
|
36
|
-
[&_pre]:bg-transparent [&_pre]:p-4 [&_pre]:rounded-lg [&_pre]:overflow-x-auto [&_pre]:max-w-full
|
|
37
|
-
[&_pre]:mb-4 [&_pre]:border [&_pre]:border-border [&_pre]:whitespace-pre-wrap
|
|
38
|
-
[&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-sm [&_pre_code]:break-words
|
|
39
|
-
|
|
40
|
-
/* Blockquotes */
|
|
41
|
-
[&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4
|
|
42
|
-
[&_blockquote]:py-2 [&_blockquote]:mb-4 [&_blockquote]:italic
|
|
43
|
-
[&_blockquote]:text-foreground [&_blockquote]:bg-transparent
|
|
44
|
-
|
|
45
|
-
/* Tables */
|
|
46
|
-
[&_table]:w-full [&_table]:mb-4 [&_table]:border-collapse [&_table]:table-fixed [&_table]:max-w-full
|
|
47
|
-
[&_th]:border [&_th]:border-border [&_th]:px-3 [&_th]:py-2 [&_th]:break-words
|
|
48
|
-
[&_th]:bg-transparent [&_th]:font-semibold [&_th]:text-left
|
|
49
|
-
[&_td]:border [&_td]:border-border [&_td]:px-3 [&_td]:py-2 [&_td]:break-words
|
|
50
|
-
[&_tr:nth-child(even)]:bg-transparent
|
|
51
|
-
|
|
52
|
-
/* Horizontal rules */
|
|
53
|
-
[&_hr]:border-0 [&_hr]:border-t [&_hr]:border-border [&_hr]:my-6
|
|
54
|
-
|
|
55
|
-
/* Images */
|
|
56
|
-
[&_img]:max-w-full [&_img]:h-auto [&_img]:rounded [&_img]:my-2 [&_img]:object-contain
|
|
57
|
-
|
|
58
|
-
${e}
|
|
59
|
-
`.trim().replace(/\s+/g," "),oh=(e="")=>`
|
|
60
|
-
/* Buttons - "important" overrides for flow controls */
|
|
61
|
-
[&>button]:bg-[var(--color-background-w10)]
|
|
62
|
-
[&>button]:dark:!bg-[var(--color-background-w100)]
|
|
63
|
-
[&>button]:hover:bg-[var(--color-background-w20)]
|
|
64
|
-
[&>button]:dark:hover:!bg-[var(--color-primary-w60)]
|
|
65
|
-
[&>button]:text-[var(--color-primary-text-wMain)]
|
|
66
|
-
[&>button]:dark:text-[var(--color-primary-text-w10)]
|
|
67
|
-
[&>button]:!border
|
|
68
|
-
[&>button]:!border-[var(--color-secondary-w40)]
|
|
69
|
-
[&>button]:dark:!border-[var(--color-secondary-w70)]
|
|
70
|
-
|
|
71
|
-
${e}
|
|
72
|
-
`.trim().replace(/\s+/g," ");function ve(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function sh(e,t){const n=u.createContext(t),r=s=>{const{children:i,...l}=s,c=u.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:i})};r.displayName=e+"Provider";function o(s){const i=u.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function An(e,t=[]){let n=[];function r(s,i){const l=u.createContext(i),c=n.length;n=[...n,i];const d=p=>{var b;const{scope:m,children:h,...x}=p,g=((b=m==null?void 0:m[e])==null?void 0:b[c])||l,v=u.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:h})};d.displayName=s+"Provider";function f(p,m){var g;const h=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=u.useContext(h);if(x)return x;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,f]}const o=()=>{const s=n.map(i=>u.createContext(i));return function(l){const c=(l==null?void 0:l[e])||s;return u.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return o.scopeName=e,[r,ih(o,...t)]}function ih(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:c,scopeName:d})=>{const p=c(s)[`__scope${d}`];return{...l,...p}},{});return u.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var ah=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ke=ah.reduce((e,t)=>{const n=Pn(`Primitive.${t}`),r=u.forwardRef((o,s)=>{const{asChild:i,...l}=o,c=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function lh(e,t){e&&Ur.flushSync(()=>e.dispatchEvent(t))}function yn(e){const t=u.useRef(e);return u.useEffect(()=>{t.current=e}),u.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ch(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e);u.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var uh="DismissableLayer",$s="dismissableLayer.update",dh="dismissableLayer.pointerDownOutside",fh="dismissableLayer.focusOutside",Na,pc=u.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Hr=u.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=u.useContext(pc),[f,p]=u.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=u.useState({}),x=$e(t,I=>p(I)),g=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),w=f?g.indexOf(f):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,E=w>=b,T=hh(I=>{const A=I.target,q=[...d.branches].some(K=>K.contains(A));!E||q||(o==null||o(I),i==null||i(I),I.defaultPrevented||l==null||l())},m),_=gh(I=>{const A=I.target;[...d.branches].some(K=>K.contains(A))||(s==null||s(I),i==null||i(I),I.defaultPrevented||l==null||l())},m);return ch(I=>{w===d.layers.size-1&&(r==null||r(I),!I.defaultPrevented&&l&&(I.preventDefault(),l()))},m),u.useEffect(()=>{if(f)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Na=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),ka(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Na)}},[f,m,n,d]),u.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),ka())},[f,d]),u.useEffect(()=>{const I=()=>h({});return document.addEventListener($s,I),()=>document.removeEventListener($s,I)},[]),a.jsx(ke.div,{...c,ref:x,style:{pointerEvents:y?E?"auto":"none":void 0,...e.style},onFocusCapture:ve(e.onFocusCapture,_.onFocusCapture),onBlurCapture:ve(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:ve(e.onPointerDownCapture,T.onPointerDownCapture)})});Hr.displayName=uh;var ph="DismissableLayerBranch",mh=u.forwardRef((e,t)=>{const n=u.useContext(pc),r=u.useRef(null),o=$e(t,r);return u.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),a.jsx(ke.div,{...e,ref:o})});mh.displayName=ph;function hh(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=u.useRef(!1),o=u.useRef(()=>{});return u.useEffect(()=>{const s=l=>{if(l.target&&!r.current){let c=function(){mc(dh,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=c,t.addEventListener("click",o.current,{once:!0})):c()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function gh(e,t=globalThis==null?void 0:globalThis.document){const n=yn(e),r=u.useRef(!1);return u.useEffect(()=>{const o=s=>{s.target&&!r.current&&mc(fh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function ka(){const e=new CustomEvent($s);document.dispatchEvent(e)}function mc(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?lh(o,s):o.dispatchEvent(s)}var nt=globalThis!=null&&globalThis.document?u.useLayoutEffect:()=>{},xh=pi[" useId ".trim().toString()]||(()=>{}),vh=0;function Xt(e){const[t,n]=u.useState(xh());return nt(()=>{n(r=>r??String(vh++))},[e]),t?`radix-${t}`:""}const wh=["top","right","bottom","left"],Sn=Math.min,yt=Math.max,wo=Math.round,Qr=Math.floor,Zt=e=>({x:e,y:e}),bh={left:"right",right:"left",bottom:"top",top:"bottom"},yh={start:"end",end:"start"};function Bs(e,t,n){return yt(e,Sn(t,n))}function dn(e,t){return typeof e=="function"?e(t):e}function fn(e){return e.split("-")[0]}function hr(e){return e.split("-")[1]}function Si(e){return e==="x"?"y":"x"}function Ci(e){return e==="y"?"height":"width"}const Sh=new Set(["top","bottom"]);function Kt(e){return Sh.has(fn(e))?"y":"x"}function Ei(e){return Si(Kt(e))}function Ch(e,t,n){n===void 0&&(n=!1);const r=hr(e),o=Ei(e),s=Ci(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=bo(i)),[i,bo(i)]}function Eh(e){const t=bo(e);return[Us(e),t,Us(t)]}function Us(e){return e.replace(/start|end/g,t=>yh[t])}const _a=["left","right"],Ia=["right","left"],Th=["top","bottom"],Ah=["bottom","top"];function Nh(e,t,n){switch(e){case"top":case"bottom":return n?t?Ia:_a:t?_a:Ia;case"left":case"right":return t?Th:Ah;default:return[]}}function kh(e,t,n,r){const o=hr(e);let s=Nh(fn(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Us)))),s}function bo(e){return e.replace(/left|right|bottom|top/g,t=>bh[t])}function _h(e){return{top:0,right:0,bottom:0,left:0,...e}}function hc(e){return typeof e!="number"?_h(e):{top:e,right:e,bottom:e,left:e}}function yo(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ja(e,t,n){let{reference:r,floating:o}=e;const s=Kt(t),i=Ei(t),l=Ci(i),c=fn(t),d=s==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[l]/2-o[l]/2;let h;switch(c){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-o.width,y:p};break;default:h={x:r.x,y:r.y}}switch(hr(t)){case"start":h[i]-=m*(n&&d?-1:1);break;case"end":h[i]+=m*(n&&d?-1:1);break}return h}const Ih=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=ja(d,r,c),m=r,h={},x=0;for(let g=0;g<l.length;g++){const{name:v,fn:b}=l[g],{x:w,y,data:E,reset:T}=await b({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:h,rects:d,platform:i,elements:{reference:e,floating:t}});f=w??f,p=y??p,h={...h,[v]:{...h[v],...E}},T&&x<=50&&(x++,typeof T=="object"&&(T.placement&&(m=T.placement),T.rects&&(d=T.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):T.rects),{x:f,y:p}=ja(d,m,c)),g=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:h}};async function Rr(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:h=0}=dn(t,e),x=hc(h),v=l[m?p==="floating"?"reference":"floating":p],b=yo(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),w=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),E=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},T=yo(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:w,offsetParent:y,strategy:c}):w);return{top:(b.top-T.top+x.top)/E.y,bottom:(T.bottom-b.bottom+x.bottom)/E.y,left:(b.left-T.left+x.left)/E.x,right:(T.right-b.right+x.right)/E.x}}const jh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=dn(e,t)||{};if(d==null)return{};const p=hc(f),m={x:n,y:r},h=Ei(o),x=Ci(h),g=await i.getDimensions(d),v=h==="y",b=v?"top":"left",w=v?"bottom":"right",y=v?"clientHeight":"clientWidth",E=s.reference[x]+s.reference[h]-m[h]-s.floating[x],T=m[h]-s.reference[h],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let I=_?_[y]:0;(!I||!await(i.isElement==null?void 0:i.isElement(_)))&&(I=l.floating[y]||s.floating[x]);const A=E/2-T/2,q=I/2-g[x]/2-1,K=Sn(p[b],q),U=Sn(p[w],q),Y=K,J=I-g[x]-U,O=I/2-g[x]/2+A,X=Bs(Y,O,J),N=!c.arrow&&hr(o)!=null&&O!==X&&s.reference[x]/2-(O<Y?K:U)-g[x]/2<0,R=N?O<Y?O-Y:O-J:0;return{[h]:m[h]+R,data:{[h]:X,centerOffset:O-X-R,...N&&{alignmentOffset:R}},reset:N}}}),Mh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:g=!0,...v}=dn(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=fn(o),w=Kt(l),y=fn(l)===l,E=await(c.isRTL==null?void 0:c.isRTL(d.floating)),T=m||(y||!g?[bo(l)]:Eh(l)),_=x!=="none";!m&&_&&T.push(...kh(l,g,x,E));const I=[l,...T],A=await Rr(t,v),q=[];let K=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&q.push(A[b]),p){const O=Ch(o,i,E);q.push(A[O[0]],A[O[1]])}if(K=[...K,{placement:o,overflows:q}],!q.every(O=>O<=0)){var U,Y;const O=(((U=s.flip)==null?void 0:U.index)||0)+1,X=I[O];if(X&&(!(p==="alignment"?w!==Kt(X):!1)||K.every(S=>Kt(S.placement)===w?S.overflows[0]>0:!0)))return{data:{index:O,overflows:K},reset:{placement:X}};let N=(Y=K.filter(R=>R.overflows[0]<=0).sort((R,S)=>R.overflows[1]-S.overflows[1])[0])==null?void 0:Y.placement;if(!N)switch(h){case"bestFit":{var J;const R=(J=K.filter(S=>{if(_){const F=Kt(S.placement);return F===w||F==="y"}return!0}).map(S=>[S.placement,S.overflows.filter(F=>F>0).reduce((F,M)=>F+M,0)]).sort((S,F)=>S[1]-F[1])[0])==null?void 0:J[0];R&&(N=R);break}case"initialPlacement":N=l;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function Ma(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ra(e){return wh.some(t=>e[t]>=0)}const Rh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=dn(e,t);switch(r){case"referenceHidden":{const s=await Rr(t,{...o,elementContext:"reference"}),i=Ma(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Ra(i)}}}case"escaped":{const s=await Rr(t,{...o,altBoundary:!0}),i=Ma(s,n.floating);return{data:{escapedOffsets:i,escaped:Ra(i)}}}default:return{}}}}},gc=new Set(["left","top"]);async function Ph(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=fn(n),l=hr(n),c=Kt(n)==="y",d=gc.has(i)?-1:1,f=s&&c?-1:1,p=dn(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:x}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof x=="number"&&(h=l==="end"?x*-1:x),c?{x:h*f,y:m*d}:{x:m*d,y:h*f}}const Lh=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:l}=t,c=await Ph(t,e);return i===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:s+c.y,data:{...c,placement:i}}}}},Dh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=dn(e,t),d={x:n,y:r},f=await Rr(t,c),p=Kt(fn(o)),m=Si(p);let h=d[m],x=d[p];if(s){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",w=h+f[v],y=h-f[b];h=Bs(w,h,y)}if(i){const v=p==="y"?"top":"left",b=p==="y"?"bottom":"right",w=x+f[v],y=x-f[b];x=Bs(w,x,y)}const g=l.fn({...t,[m]:h,[p]:x});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:s,[p]:i}}}}}},Oh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=dn(e,t),f={x:n,y:r},p=Kt(o),m=Si(p);let h=f[m],x=f[p];const g=dn(l,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const y=m==="y"?"height":"width",E=s.reference[m]-s.floating[y]+v.mainAxis,T=s.reference[m]+s.reference[y]-v.mainAxis;h<E?h=E:h>T&&(h=T)}if(d){var b,w;const y=m==="y"?"width":"height",E=gc.has(fn(o)),T=s.reference[p]-s.floating[y]+(E&&((b=i.offset)==null?void 0:b[p])||0)+(E?0:v.crossAxis),_=s.reference[p]+s.reference[y]+(E?0:((w=i.offset)==null?void 0:w[p])||0)-(E?v.crossAxis:0);x<T?x=T:x>_&&(x=_)}return{[m]:h,[p]:x}}}},Fh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=dn(e,t),f=await Rr(t,d),p=fn(o),m=hr(o),h=Kt(o)==="y",{width:x,height:g}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const w=g-f.top-f.bottom,y=x-f.left-f.right,E=Sn(g-f[v],w),T=Sn(x-f[b],y),_=!t.middlewareData.shift;let I=E,A=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(I=w),_&&!m){const K=yt(f.left,0),U=yt(f.right,0),Y=yt(f.top,0),J=yt(f.bottom,0);h?A=x-2*(K!==0||U!==0?K+U:yt(f.left,f.right)):I=g-2*(Y!==0||J!==0?Y+J:yt(f.top,f.bottom))}await c({...t,availableWidth:A,availableHeight:I});const q=await i.getDimensions(l.floating);return x!==q.width||g!==q.height?{reset:{rects:!0}}:{}}}};function Po(){return typeof window<"u"}function gr(e){return xc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function en(e){var t;return(t=(xc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xc(e){return Po()?e instanceof Node||e instanceof Ct(e).Node:!1}function Bt(e){return Po()?e instanceof Element||e instanceof Ct(e).Element:!1}function Qt(e){return Po()?e instanceof HTMLElement||e instanceof Ct(e).HTMLElement:!1}function Pa(e){return!Po()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ct(e).ShadowRoot}const zh=new Set(["inline","contents"]);function Wr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ut(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!zh.has(o)}const $h=new Set(["table","td","th"]);function Bh(e){return $h.has(gr(e))}const Uh=[":popover-open",":modal"];function Lo(e){return Uh.some(t=>{try{return e.matches(t)}catch{return!1}})}const Hh=["transform","translate","scale","rotate","perspective"],Wh=["transform","translate","scale","rotate","perspective","filter"],Gh=["paint","layout","strict","content"];function Ti(e){const t=Ai(),n=Bt(e)?Ut(e):e;return Hh.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Wh.some(r=>(n.willChange||"").includes(r))||Gh.some(r=>(n.contain||"").includes(r))}function Vh(e){let t=Cn(e);for(;Qt(t)&&!ir(t);){if(Ti(t))return t;if(Lo(t))return null;t=Cn(t)}return null}function Ai(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Yh=new Set(["html","body","#document"]);function ir(e){return Yh.has(gr(e))}function Ut(e){return Ct(e).getComputedStyle(e)}function Do(e){return Bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Cn(e){if(gr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Pa(e)&&e.host||en(e);return Pa(t)?t.host:t}function vc(e){const t=Cn(e);return ir(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qt(t)&&Wr(t)?t:vc(t)}function Pr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vc(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Ct(o);if(s){const l=Hs(i);return t.concat(i,i.visualViewport||[],Wr(o)?o:[],l&&n?Pr(l):[])}return t.concat(o,Pr(o,[],n))}function Hs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wc(e){const t=Ut(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Qt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=wo(n)!==s||wo(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function Ni(e){return Bt(e)?e:e.contextElement}function tr(e){const t=Ni(e);if(!Qt(t))return Zt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=wc(t);let i=(s?wo(n.width):n.width)/r,l=(s?wo(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Kh=Zt(0);function bc(e){const t=Ct(e);return!Ai()||!t.visualViewport?Kh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ct(e)?!1:t}function Ln(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ni(e);let i=Zt(1);t&&(r?Bt(r)&&(i=tr(r)):i=tr(e));const l=qh(s,n,r)?bc(s):Zt(0);let c=(o.left+l.x)/i.x,d=(o.top+l.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=Ct(s),h=r&&Bt(r)?Ct(r):r;let x=m,g=Hs(x);for(;g&&r&&h!==x;){const v=tr(g),b=g.getBoundingClientRect(),w=Ut(g),y=b.left+(g.clientLeft+parseFloat(w.paddingLeft))*v.x,E=b.top+(g.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,p*=v.y,c+=y,d+=E,x=Ct(g),g=Hs(x)}}return yo({width:f,height:p,x:c,y:d})}function Oo(e,t){const n=Do(e).scrollLeft;return t?t.left+n:Ln(en(e)).left+n}function yc(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Oo(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Xh(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=en(r),l=t?Lo(t.floating):!1;if(r===i||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=Zt(1);const f=Zt(0),p=Qt(r);if((p||!p&&!s)&&((gr(r)!=="body"||Wr(i))&&(c=Do(r)),Qt(r))){const h=Ln(r);d=tr(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const m=i&&!p&&!s?yc(i,c):Zt(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+m.x,y:n.y*d.y-c.scrollTop*d.y+f.y+m.y}}function Zh(e){return Array.from(e.getClientRects())}function Jh(e){const t=en(e),n=Do(e),r=e.ownerDocument.body,o=yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Oo(e);const l=-n.scrollTop;return Ut(r).direction==="rtl"&&(i+=yt(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:l}}const La=25;function Qh(e,t){const n=Ct(e),r=en(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,l=0,c=0;if(o){s=o.width,i=o.height;const f=Ai();(!f||f&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}const d=Oo(r);if(d<=0){const f=r.ownerDocument,p=f.body,m=getComputedStyle(p),h=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,x=Math.abs(r.clientWidth-p.clientWidth-h);x<=La&&(s-=x)}else d<=La&&(s+=d);return{width:s,height:i,x:l,y:c}}const eg=new Set(["absolute","fixed"]);function tg(e,t){const n=Ln(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Qt(e)?tr(e):Zt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=o*s.x,d=r*s.y;return{width:i,height:l,x:c,y:d}}function Da(e,t,n){let r;if(t==="viewport")r=Qh(e,n);else if(t==="document")r=Jh(en(e));else if(Bt(t))r=tg(t,n);else{const o=bc(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return yo(r)}function Sc(e,t){const n=Cn(e);return n===t||!Bt(n)||ir(n)?!1:Ut(n).position==="fixed"||Sc(n,t)}function ng(e,t){const n=t.get(e);if(n)return n;let r=Pr(e,[],!1).filter(l=>Bt(l)&&gr(l)!=="body"),o=null;const s=Ut(e).position==="fixed";let i=s?Cn(e):e;for(;Bt(i)&&!ir(i);){const l=Ut(i),c=Ti(i);!c&&l.position==="fixed"&&(o=null),(s?!c&&!o:!c&&l.position==="static"&&!!o&&eg.has(o.position)||Wr(i)&&!c&&Sc(e,i))?r=r.filter(f=>f!==i):o=l,i=Cn(i)}return t.set(e,r),r}function rg(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?Lo(t)?[]:ng(t,this._c):[].concat(n),r],l=i[0],c=i.reduce((d,f)=>{const p=Da(t,f,o);return d.top=yt(p.top,d.top),d.right=Sn(p.right,d.right),d.bottom=Sn(p.bottom,d.bottom),d.left=yt(p.left,d.left),d},Da(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function og(e){const{width:t,height:n}=wc(e);return{width:t,height:n}}function sg(e,t,n){const r=Qt(t),o=en(t),s=n==="fixed",i=Ln(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=Zt(0);function d(){c.x=Oo(o)}if(r||!r&&!s)if((gr(t)!=="body"||Wr(o))&&(l=Do(t)),r){const h=Ln(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else o&&d();s&&!r&&o&&d();const f=o&&!r&&!s?yc(o,l):Zt(0),p=i.left+l.scrollLeft-c.x-f.x,m=i.top+l.scrollTop-c.y-f.y;return{x:p,y:m,width:i.width,height:i.height}}function fs(e){return Ut(e).position==="static"}function Oa(e,t){if(!Qt(e)||Ut(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return en(e)===n&&(n=n.ownerDocument.body),n}function Cc(e,t){const n=Ct(e);if(Lo(e))return n;if(!Qt(e)){let o=Cn(e);for(;o&&!ir(o);){if(Bt(o)&&!fs(o))return o;o=Cn(o)}return n}let r=Oa(e,t);for(;r&&Bh(r)&&fs(r);)r=Oa(r,t);return r&&ir(r)&&fs(r)&&!Ti(r)?n:r||Vh(e)||n}const ig=async function(e){const t=this.getOffsetParent||Cc,n=this.getDimensions,r=await n(e.floating);return{reference:sg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ag(e){return Ut(e).direction==="rtl"}const lg={convertOffsetParentRelativeRectToViewportRelativeRect:Xh,getDocumentElement:en,getClippingRect:rg,getOffsetParent:Cc,getElementRects:ig,getClientRects:Zh,getDimensions:og,getScale:tr,isElement:Bt,isRTL:ag};function Ec(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function cg(e,t){let n=null,r;const o=en(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:f,top:p,width:m,height:h}=d;if(l||t(),!m||!h)return;const x=Qr(p),g=Qr(o.clientWidth-(f+m)),v=Qr(o.clientHeight-(p+h)),b=Qr(f),y={rootMargin:-x+"px "+-g+"px "+-v+"px "+-b+"px",threshold:yt(0,Sn(1,c))||1};let E=!0;function T(_){const I=_[0].intersectionRatio;if(I!==c){if(!E)return i();I?i(!1,I):r=setTimeout(()=>{i(!1,1e-7)},1e3)}I===1&&!Ec(d,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(T,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(T,y)}n.observe(e)}return i(!0),s}function ug(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Ni(e),f=o||s?[...d?Pr(d):[],...Pr(t)]:[];f.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const p=d&&l?cg(d,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),n()}),d&&!c&&h.observe(d),h.observe(t));let x,g=c?Ln(e):null;c&&v();function v(){const b=Ln(e);g&&!Ec(g,b)&&n(),g=b,x=requestAnimationFrame(v)}return n(),()=>{var b;f.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(x)}}const dg=Lh,fg=Dh,pg=Mh,mg=Fh,hg=Rh,Fa=jh,gg=Oh,xg=(e,t,n)=>{const r=new Map,o={platform:lg,...n},s={...o.platform,_c:r};return Ih(e,t,{...o,platform:s})};var vg=typeof document<"u",wg=function(){},mo=vg?u.useLayoutEffect:wg;function So(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!So(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!So(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Tc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function za(e,t){const n=Tc(e);return Math.round(t*n)/n}function ps(e){const t=u.useRef(e);return mo(()=>{t.current=e}),t}function bg(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,p]=u.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=u.useState(r);So(m,r)||h(r);const[x,g]=u.useState(null),[v,b]=u.useState(null),w=u.useCallback(S=>{S!==_.current&&(_.current=S,g(S))},[]),y=u.useCallback(S=>{S!==I.current&&(I.current=S,b(S))},[]),E=s||x,T=i||v,_=u.useRef(null),I=u.useRef(null),A=u.useRef(f),q=c!=null,K=ps(c),U=ps(o),Y=ps(d),J=u.useCallback(()=>{if(!_.current||!I.current)return;const S={placement:t,strategy:n,middleware:m};U.current&&(S.platform=U.current),xg(_.current,I.current,S).then(F=>{const M={...F,isPositioned:Y.current!==!1};O.current&&!So(A.current,M)&&(A.current=M,Ur.flushSync(()=>{p(M)}))})},[m,t,n,U,Y]);mo(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,p(S=>({...S,isPositioned:!1})))},[d]);const O=u.useRef(!1);mo(()=>(O.current=!0,()=>{O.current=!1}),[]),mo(()=>{if(E&&(_.current=E),T&&(I.current=T),E&&T){if(K.current)return K.current(E,T,J);J()}},[E,T,J,K,q]);const X=u.useMemo(()=>({reference:_,floating:I,setReference:w,setFloating:y}),[w,y]),N=u.useMemo(()=>({reference:E,floating:T}),[E,T]),R=u.useMemo(()=>{const S={position:n,left:0,top:0};if(!N.floating)return S;const F=za(N.floating,f.x),M=za(N.floating,f.y);return l?{...S,transform:"translate("+F+"px, "+M+"px)",...Tc(N.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:M}},[n,l,N.floating,f.x,f.y]);return u.useMemo(()=>({...f,update:J,refs:X,elements:N,floatingStyles:R}),[f,J,X,N,R])}const yg=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Fa({element:r.current,padding:o}).fn(n):{}:r?Fa({element:r,padding:o}).fn(n):{}}}},Sg=(e,t)=>({...dg(e),options:[e,t]}),Cg=(e,t)=>({...fg(e),options:[e,t]}),Eg=(e,t)=>({...gg(e),options:[e,t]}),Tg=(e,t)=>({...pg(e),options:[e,t]}),Ag=(e,t)=>({...mg(e),options:[e,t]}),Ng=(e,t)=>({...hg(e),options:[e,t]}),kg=(e,t)=>({...yg(e),options:[e,t]});var _g="Arrow",Ac=u.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return a.jsx(ke.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ac.displayName=_g;var Ig=Ac;function jg(e){const[t,n]=u.useState(void 0);return nt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;n({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var ki="Popper",[Nc,xr]=An(ki),[Mg,kc]=Nc(ki),_c=e=>{const{__scopePopper:t,children:n}=e,[r,o]=u.useState(null);return a.jsx(Mg,{scope:t,anchor:r,onAnchorChange:o,children:n})};_c.displayName=ki;var Ic="PopperAnchor",jc=u.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=kc(Ic,n),i=u.useRef(null),l=$e(t,i),c=u.useRef(null);return u.useEffect(()=>{const d=c.current;c.current=(r==null?void 0:r.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),r?null:a.jsx(ke.div,{...o,ref:l})});jc.displayName=Ic;var _i="PopperContent",[Rg,Pg]=Nc(_i),Mc=u.forwardRef((e,t)=>{var k,V,Q,te,oe,se;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:h="optimized",onPlaced:x,...g}=e,v=kc(_i,n),[b,w]=u.useState(null),y=$e(t,de=>w(de)),[E,T]=u.useState(null),_=jg(E),I=(_==null?void 0:_.width)??0,A=(_==null?void 0:_.height)??0,q=r+(s!=="center"?"-"+s:""),K=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},U=Array.isArray(d)?d:[d],Y=U.length>0,J={padding:K,boundary:U.filter(Dg),altBoundary:Y},{refs:O,floatingStyles:X,placement:N,isPositioned:R,middlewareData:S}=bg({strategy:"fixed",placement:q,whileElementsMounted:(...de)=>ug(...de,{animationFrame:h==="always"}),elements:{reference:v.anchor},middleware:[Sg({mainAxis:o+A,alignmentAxis:i}),c&&Cg({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?Eg():void 0,...J}),c&&Tg({...J}),Ag({...J,apply:({elements:de,rects:me,availableWidth:Me,availableHeight:Oe})=>{const{width:Le,height:je}=me.reference,He=de.floating.style;He.setProperty("--radix-popper-available-width",`${Me}px`),He.setProperty("--radix-popper-available-height",`${Oe}px`),He.setProperty("--radix-popper-anchor-width",`${Le}px`),He.setProperty("--radix-popper-anchor-height",`${je}px`)}}),E&&kg({element:E,padding:l}),Og({arrowWidth:I,arrowHeight:A}),m&&Ng({strategy:"referenceHidden",...J})]}),[F,M]=Lc(N),P=yn(x);nt(()=>{R&&(P==null||P())},[R,P]);const ee=(k=S.arrow)==null?void 0:k.x,D=(V=S.arrow)==null?void 0:V.y,$=((Q=S.arrow)==null?void 0:Q.centerOffset)!==0,[L,G]=u.useState();return nt(()=>{b&&G(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:R?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:L,"--radix-popper-transform-origin":[(te=S.transformOrigin)==null?void 0:te.x,(oe=S.transformOrigin)==null?void 0:oe.y].join(" "),...((se=S.hide)==null?void 0:se.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Rg,{scope:n,placedSide:F,onArrowChange:T,arrowX:ee,arrowY:D,shouldHideArrow:$,children:a.jsx(ke.div,{"data-side":F,"data-align":M,...g,ref:y,style:{...g.style,animation:R?void 0:"none"}})})})});Mc.displayName=_i;var Rc="PopperArrow",Lg={top:"bottom",right:"left",bottom:"top",left:"right"},Pc=u.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=Pg(Rc,r),i=Lg[s.placedSide];return a.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:a.jsx(Ig,{...o,ref:n,style:{...o.style,display:"block"}})})});Pc.displayName=Rc;function Dg(e){return e!==null}var Og=e=>({name:"transformOrigin",options:e,fn(t){var v,b,w;const{placement:n,rects:r,middlewareData:o}=t,i=((v=o.arrow)==null?void 0:v.centerOffset)!==0,l=i?0:e.arrowWidth,c=i?0:e.arrowHeight,[d,f]=Lc(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((b=o.arrow)==null?void 0:b.x)??0)+l/2,h=(((w=o.arrow)==null?void 0:w.y)??0)+c/2;let x="",g="";return d==="bottom"?(x=i?p:`${m}px`,g=`${-c}px`):d==="top"?(x=i?p:`${m}px`,g=`${r.floating.height+c}px`):d==="right"?(x=`${-c}px`,g=i?p:`${h}px`):d==="left"&&(x=`${r.floating.width+c}px`,g=i?p:`${h}px`),{data:{x,y:g}}}});function Lc(e){const[t,n="center"]=e.split("-");return[t,n]}var Ii=_c,Fo=jc,ji=Mc,Mi=Pc,Fg="Portal",Gr=u.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[o,s]=u.useState(!1);nt(()=>s(!0),[]);const i=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return i?_p.createPortal(a.jsx(ke.div,{...r,ref:t}),i):null});Gr.displayName=Fg;function zg(e,t){return u.useReducer((n,r)=>t[n][r]??n,e)}var mn=e=>{const{present:t,children:n}=e,r=$g(t),o=typeof n=="function"?n({present:r.isPresent}):u.Children.only(n),s=$e(r.ref,Bg(o));return typeof n=="function"||r.isPresent?u.cloneElement(o,{ref:s}):null};mn.displayName="Presence";function $g(e){const[t,n]=u.useState(),r=u.useRef(null),o=u.useRef(e),s=u.useRef("none"),i=e?"mounted":"unmounted",[l,c]=zg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return u.useEffect(()=>{const d=eo(r.current);s.current=l==="mounted"?d:"none"},[l]),nt(()=>{const d=r.current,f=o.current;if(f!==e){const m=s.current,h=eo(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&m!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),nt(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,p=h=>{const g=eo(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},m=h=>{h.target===t&&(s.current=eo(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:u.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function eo(e){return(e==null?void 0:e.animationName)||"none"}function Bg(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ug=pi[" useInsertionEffect ".trim().toString()]||nt;function Dn({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,s,i]=Hg({defaultProp:t,onChange:n}),l=e!==void 0,c=l?e:o;{const f=u.useRef(e!==void 0);u.useEffect(()=>{const p=f.current;p!==l&&console.warn(`${r} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=l},[l,r])}const d=u.useCallback(f=>{var p;if(l){const m=Wg(f)?f(e):f;m!==e&&((p=i.current)==null||p.call(i,m))}else s(f)},[l,e,s,i]);return[c,d]}function Hg({defaultProp:e,onChange:t}){const[n,r]=u.useState(e),o=u.useRef(n),s=u.useRef(t);return Ug(()=>{s.current=t},[t]),u.useEffect(()=>{var i;o.current!==n&&((i=s.current)==null||i.call(s,n),o.current=n)},[n,o]),[n,r,s]}function Wg(e){return typeof e=="function"}var Dc=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Gg="VisuallyHidden",Oc=u.forwardRef((e,t)=>a.jsx(ke.span,{...e,ref:t,style:{...Dc,...e.style}}));Oc.displayName=Gg;var Vg=Oc,[zo,t1]=An("Tooltip",[xr]),$o=xr(),Fc="TooltipProvider",Yg=700,Ws="tooltip.open",[Kg,Ri]=zo(Fc),zc=e=>{const{__scopeTooltip:t,delayDuration:n=Yg,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,i=u.useRef(!0),l=u.useRef(!1),c=u.useRef(0);return u.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(Kg,{scope:t,isOpenDelayedRef:i,delayDuration:n,onOpen:u.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:u.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:u.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:s})};zc.displayName=Fc;var Lr="Tooltip",[qg,Vr]=zo(Lr),$c=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Ri(Lr,e.__scopeTooltip),d=$o(t),[f,p]=u.useState(null),m=Xt(),h=u.useRef(0),x=i??c.disableHoverableContent,g=l??c.delayDuration,v=u.useRef(!1),[b,w]=Dn({prop:r,defaultProp:o??!1,onChange:I=>{I?(c.onOpen(),document.dispatchEvent(new CustomEvent(Ws))):c.onClose(),s==null||s(I)},caller:Lr}),y=u.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),E=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,w(!0)},[w]),T=u.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),_=u.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,w(!0),h.current=0},g)},[g,w]);return u.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),a.jsx(Ii,{...d,children:a.jsx(qg,{scope:t,contentId:m,open:b,stateAttribute:y,trigger:f,onTriggerChange:p,onTriggerEnter:u.useCallback(()=>{c.isOpenDelayedRef.current?_():E()},[c.isOpenDelayedRef,_,E]),onTriggerLeave:u.useCallback(()=>{x?T():(window.clearTimeout(h.current),h.current=0)},[T,x]),onOpen:E,onClose:T,disableHoverableContent:x,children:n})})};$c.displayName=Lr;var Gs="TooltipTrigger",Bc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Vr(Gs,n),s=Ri(Gs,n),i=$o(n),l=u.useRef(null),c=$e(t,l,o.onTriggerChange),d=u.useRef(!1),f=u.useRef(!1),p=u.useCallback(()=>d.current=!1,[]);return u.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),a.jsx(Fo,{asChild:!0,...i,children:a.jsx(ke.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:c,onPointerMove:ve(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:ve(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:ve(e.onPointerDown,()=>{o.open&&o.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:ve(e.onFocus,()=>{d.current||o.onOpen()}),onBlur:ve(e.onBlur,o.onClose),onClick:ve(e.onClick,o.onClose)})})});Bc.displayName=Gs;var Pi="TooltipPortal",[Xg,Zg]=zo(Pi,{forceMount:void 0}),Uc=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=Vr(Pi,t);return a.jsx(Xg,{scope:t,forceMount:n,children:a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:r})})})};Uc.displayName=Pi;var ar="TooltipContent",Hc=u.forwardRef((e,t)=>{const n=Zg(ar,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=Vr(ar,e.__scopeTooltip);return a.jsx(mn,{present:r||i.open,children:i.disableHoverableContent?a.jsx(Wc,{side:o,...s,ref:t}):a.jsx(Jg,{side:o,...s,ref:t})})}),Jg=u.forwardRef((e,t)=>{const n=Vr(ar,e.__scopeTooltip),r=Ri(ar,e.__scopeTooltip),o=u.useRef(null),s=$e(t,o),[i,l]=u.useState(null),{trigger:c,onClose:d}=n,f=o.current,{onPointerInTransitChange:p}=r,m=u.useCallback(()=>{l(null),p(!1)},[p]),h=u.useCallback((x,g)=>{const v=x.currentTarget,b={x:x.clientX,y:x.clientY},w=nx(b,v.getBoundingClientRect()),y=rx(b,w),E=ox(g.getBoundingClientRect()),T=ix([...y,...E]);l(T),p(!0)},[p]);return u.useEffect(()=>()=>m(),[m]),u.useEffect(()=>{if(c&&f){const x=v=>h(v,f),g=v=>h(v,c);return c.addEventListener("pointerleave",x),f.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",x),f.removeEventListener("pointerleave",g)}}},[c,f,h,m]),u.useEffect(()=>{if(i){const x=g=>{const v=g.target,b={x:g.clientX,y:g.clientY},w=(c==null?void 0:c.contains(v))||(f==null?void 0:f.contains(v)),y=!sx(b,i);w?m():y&&(m(),d())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[c,f,i,d,m]),a.jsx(Wc,{...e,ref:s})}),[Qg,ex]=zo(Lr,{isInside:!1}),tx=mm("TooltipContent"),Wc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Vr(ar,n),d=$o(n),{onClose:f}=c;return u.useEffect(()=>(document.addEventListener(Ws,f),()=>document.removeEventListener(Ws,f)),[f]),u.useEffect(()=>{if(c.trigger){const p=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,f]),a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:a.jsxs(ji,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(tx,{children:r}),a.jsx(Qg,{scope:n,isInside:!0,children:a.jsx(Vg,{id:c.contentId,role:"tooltip",children:o||r})})]})})});Hc.displayName=ar;var Gc="TooltipArrow",Vc=u.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=$o(n);return ex(Gc,n).isInside?null:a.jsx(Mi,{...o,...r,ref:t})});Vc.displayName=Gc;function nx(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function rx(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ox(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function sx(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,f=l.y,p=c.x,m=c.y;f>r!=m>r&&n<(p-d)*(r-f)/(m-f)+d&&(o=!o)}return o}function ix(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),ax(t)}function ax(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var lx=zc,cx=$c,ux=Bc,dx=Uc,fx=Hc,px=Vc;function mx({delayDuration:e=0,...t}){return a.jsx(lx,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function Li({...e}){return a.jsx(mx,{delayDuration:500,children:a.jsx(cx,{"data-slot":"tooltip",...e})})}function Di({...e}){return a.jsx(ux,{"data-slot":"tooltip-trigger",...e})}function Oi({className:e,sideOffset:t=0,children:n,...r}){return a.jsx(dx,{children:a.jsxs(fx,{"data-slot":"tooltip-content",sideOffset:t,className:Ce("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...r,children:[n,a.jsx(px,{className:"bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const Yc="text-[var(--color-primary-wMain)] hover:text-[var(--color-primary-text-w60)] dark:text-[var(--color-primary-w20)] dark:hover:text-[var(--color-primary-text-w10)]",ms=Yc+" hover:bg-[var(--color-primary-w10)] dark:hover:bg-[var(--color-primary-w60)]",hx=Tn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-sm font-semibold transition-all disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 cursor-pointer disabled:cursor-not-allowed disabled:hover:bg-transparent dark:disabled:hover:bg-transparent",{variants:{variant:{default:"text-[var(--color-primary-text-w10)] bg-[var(--color-primary-wMain)] hover:bg-[var(--color-primary-w100)] dark:hover:bg-[var(--color-primary-w60)]",destructive:"text-[var(--color-primary-text-w10)] bg-[var(--color-error-wMain)] hover:bg-[var(--color-error-w70)]",outline:ms+" border border-1 border-[var(--color-primary-wMain)]",secondary:ms,ghost:ms,link:Yc+" underline-offset-4 hover:underline"},size:{default:"h-9 px-5 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ae({className:e,variant:t,size:n,asChild:r=!1,tooltip:o="",testid:s="",...i}){const l=r?Ql:"button",c=o?{...i,"aria-label":o}:i,d=a.jsx(l,{"data-slot":"button","data-testid":s||o||i.title,className:Ce(hx({variant:t,size:n,className:e})),...c});return o?a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:d}),a.jsx(Oi,{children:o})]}):d}const Kc=({onClick:e,text:t="View Agent Workflow"})=>a.jsx(Ae,{variant:"ghost",size:"sm",onClick:e,tooltip:t,children:a.jsx(po,{className:"h-4 w-4"})}),qc=u.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Ce("flex min-h-[80px] w-full rounded-md border px-3 py-2 placeholder:opacity-75 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));qc.displayName="Textarea";var hs="focusScope.autoFocusOnMount",gs="focusScope.autoFocusOnUnmount",$a={bubbles:!1,cancelable:!0},gx="FocusScope",Bo=u.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[l,c]=u.useState(null),d=yn(o),f=yn(s),p=u.useRef(null),m=$e(t,g=>c(g)),h=u.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;u.useEffect(()=>{if(r){let g=function(y){if(h.paused||!l)return;const E=y.target;l.contains(E)?p.current=E:xn(p.current,{select:!0})},v=function(y){if(h.paused||!l)return;const E=y.relatedTarget;E!==null&&(l.contains(E)||xn(p.current,{select:!0}))},b=function(y){if(document.activeElement===document.body)for(const T of y)T.removedNodes.length>0&&xn(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),w.disconnect()}}},[r,l,h.paused]),u.useEffect(()=>{if(l){Ua.add(h);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(hs,$a);l.addEventListener(hs,d),l.dispatchEvent(b),b.defaultPrevented||(xx(Sx(Xc(l)),{select:!0}),document.activeElement===g&&xn(l))}return()=>{l.removeEventListener(hs,d),setTimeout(()=>{const b=new CustomEvent(gs,$a);l.addEventListener(gs,f),l.dispatchEvent(b),b.defaultPrevented||xn(g??document.body,{select:!0}),l.removeEventListener(gs,f),Ua.remove(h)},0)}}},[l,d,f,h]);const x=u.useCallback(g=>{if(!n&&!r||h.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(v&&b){const w=g.currentTarget,[y,E]=vx(w);y&&E?!g.shiftKey&&b===E?(g.preventDefault(),n&&xn(y,{select:!0})):g.shiftKey&&b===y&&(g.preventDefault(),n&&xn(E,{select:!0})):b===w&&g.preventDefault()}},[n,r,h.paused]);return a.jsx(ke.div,{tabIndex:-1,...i,ref:m,onKeyDown:x})});Bo.displayName=gx;function xx(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(xn(r,{select:t}),document.activeElement!==n)return}function vx(e){const t=Xc(e),n=Ba(t,e),r=Ba(t.reverse(),e);return[n,r]}function Xc(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ba(e,t){for(const n of e)if(!wx(n,{upTo:t}))return n}function wx(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function bx(e){return e instanceof HTMLInputElement&&"select"in e}function xn(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&bx(e)&&t&&e.select()}}var Ua=yx();function yx(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Ha(e,t),e.unshift(t)},remove(t){var n;e=Ha(e,t),(n=e[0])==null||n.resume()}}}function Ha(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Sx(e){return e.filter(t=>t.tagName!=="A")}var xs=0;function Fi(){u.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Wa()),document.body.insertAdjacentElement("beforeend",e[1]??Wa()),xs++,()=>{xs===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xs--}},[])}function Wa(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Yt=function(){return Yt=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},Yt.apply(this,arguments)};function Zc(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function Cx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var ho="right-scroll-bar-position",go="width-before-scroll-bar",Ex="with-scroll-bars-hidden",Tx="--removed-body-scroll-bar-size";function vs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Ax(e,t){var n=u.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Nx=typeof window<"u"?u.useLayoutEffect:u.useEffect,Ga=new WeakMap;function kx(e,t){var n=Ax(null,function(r){return e.forEach(function(o){return vs(o,r)})});return Nx(function(){var r=Ga.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(l){s.has(l)||vs(l,null)}),s.forEach(function(l){o.has(l)||vs(l,i)})}Ga.set(n,e)},[e]),n}function _x(e){return e}function Ix(e,t){t===void 0&&(t=_x);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(l){return s(l)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var l=n;n=[],l.forEach(s),i=n}var c=function(){var f=i;i=[],f.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(f){i.push(f),d()},filter:function(f){return i=i.filter(f),n}}}};return o}function jx(e){e===void 0&&(e={});var t=Ix(null);return t.options=Yt({async:!0,ssr:!1},e),t}var Jc=function(e){var t=e.sideCar,n=Zc(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return u.createElement(r,Yt({},n))};Jc.isSideCarExport=!0;function Mx(e,t){return e.useMedium(t),Jc}var Qc=jx(),ws=function(){},Uo=u.forwardRef(function(e,t){var n=u.useRef(null),r=u.useState({onScrollCapture:ws,onWheelCapture:ws,onTouchMoveCapture:ws}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,h=e.noRelative,x=e.noIsolation,g=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,y=e.gapMode,E=Zc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),T=m,_=kx([n,t]),I=Yt(Yt({},E),o);return u.createElement(u.Fragment,null,f&&u.createElement(T,{sideCar:Qc,removeScrollBar:d,shards:p,noRelative:h,noIsolation:x,inert:g,setCallbacks:s,allowPinchZoom:!!v,lockRef:n,gapMode:y}),i?u.cloneElement(u.Children.only(l),Yt(Yt({},I),{ref:_})):u.createElement(w,Yt({},I,{className:c,ref:_}),l))});Uo.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Uo.classNames={fullWidth:go,zeroRight:ho};var Rx=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Px(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Rx();return t&&e.setAttribute("nonce",t),e}function Lx(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Dx(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Ox=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Px())&&(Lx(t,n),Dx(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fx=function(){var e=Ox();return function(t,n){u.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},eu=function(){var e=Fx(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},zx={left:0,top:0,right:0,gap:0},bs=function(e){return parseInt(e||"",10)||0},$x=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[bs(n),bs(r),bs(o)]},Bx=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return zx;var t=$x(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Ux=eu(),nr="data-scroll-locked",Hx=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),`
|
|
73
|
-
.`.concat(Ex,` {
|
|
74
|
-
overflow: hidden `).concat(r,`;
|
|
75
|
-
padding-right: `).concat(l,"px ").concat(r,`;
|
|
76
|
-
}
|
|
77
|
-
body[`).concat(nr,`] {
|
|
78
|
-
overflow: hidden `).concat(r,`;
|
|
79
|
-
overscroll-behavior: contain;
|
|
80
|
-
`).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
81
|
-
padding-left: `.concat(o,`px;
|
|
82
|
-
padding-top: `).concat(s,`px;
|
|
83
|
-
padding-right: `).concat(i,`px;
|
|
84
|
-
margin-left:0;
|
|
85
|
-
margin-top:0;
|
|
86
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
87
|
-
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
.`).concat(ho,` {
|
|
91
|
-
right: `).concat(l,"px ").concat(r,`;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.`).concat(go,` {
|
|
95
|
-
margin-right: `).concat(l,"px ").concat(r,`;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.`).concat(ho," .").concat(ho,` {
|
|
99
|
-
right: 0 `).concat(r,`;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.`).concat(go," .").concat(go,` {
|
|
103
|
-
margin-right: 0 `).concat(r,`;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
body[`).concat(nr,`] {
|
|
107
|
-
`).concat(Tx,": ").concat(l,`px;
|
|
108
|
-
}
|
|
109
|
-
`)},Va=function(){var e=parseInt(document.body.getAttribute(nr)||"0",10);return isFinite(e)?e:0},Wx=function(){u.useEffect(function(){return document.body.setAttribute(nr,(Va()+1).toString()),function(){var e=Va()-1;e<=0?document.body.removeAttribute(nr):document.body.setAttribute(nr,e.toString())}},[])},Gx=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Wx();var s=u.useMemo(function(){return Bx(o)},[o]);return u.createElement(Ux,{styles:Hx(s,!t,o,n?"":"!important")})},Vs=!1;if(typeof window<"u")try{var to=Object.defineProperty({},"passive",{get:function(){return Vs=!0,!0}});window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Vs=!1}var Gn=Vs?{passive:!1}:!1,Vx=function(e){return e.tagName==="TEXTAREA"},tu=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Vx(e)&&n[t]==="visible")},Yx=function(e){return tu(e,"overflowY")},Kx=function(e){return tu(e,"overflowX")},Ya=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=nu(e,r);if(o){var s=ru(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},qx=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Xx=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},nu=function(e,t){return e==="v"?Yx(t):Kx(t)},ru=function(e,t){return e==="v"?qx(t):Xx(t)},Zx=function(e,t){return e==="h"&&t==="rtl"?-1:1},Jx=function(e,t,n,r,o){var s=Zx(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,c=t.contains(l),d=!1,f=i>0,p=0,m=0;do{if(!l)break;var h=ru(e,l),x=h[0],g=h[1],v=h[2],b=g-v-s*x;(x||b)&&nu(e,l)&&(p+=b,m+=x);var w=l.parentNode;l=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(f&&Math.abs(p)<1||!f&&Math.abs(m)<1)&&(d=!0),d},no=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ka=function(e){return[e.deltaX,e.deltaY]},qa=function(e){return e&&"current"in e?e.current:e},Qx=function(e,t){return e[0]===t[0]&&e[1]===t[1]},ev=function(e){return`
|
|
110
|
-
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
111
|
-
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
112
|
-
`)},tv=0,Vn=[];function nv(e){var t=u.useRef([]),n=u.useRef([0,0]),r=u.useRef(),o=u.useState(tv++)[0],s=u.useState(eu)[0],i=u.useRef(e);u.useEffect(function(){i.current=e},[e]),u.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var g=Cx([e.lockRef.current],(e.shards||[]).map(qa),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=u.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!i.current.allowPinchZoom;var b=no(g),w=n.current,y="deltaX"in g?g.deltaX:w[0]-b[0],E="deltaY"in g?g.deltaY:w[1]-b[1],T,_=g.target,I=Math.abs(y)>Math.abs(E)?"h":"v";if("touches"in g&&I==="h"&&_.type==="range")return!1;var A=Ya(I,_);if(!A)return!0;if(A?T=I:(T=I==="v"?"h":"v",A=Ya(I,_)),!A)return!1;if(!r.current&&"changedTouches"in g&&(y||E)&&(r.current=T),!T)return!0;var q=r.current||T;return Jx(q,v,g,q==="h"?y:E)},[]),c=u.useCallback(function(g){var v=g;if(!(!Vn.length||Vn[Vn.length-1]!==s)){var b="deltaY"in v?Ka(v):no(v),w=t.current.filter(function(T){return T.name===v.type&&(T.target===v.target||v.target===T.shadowParent)&&Qx(T.delta,b)})[0];if(w&&w.should){v.cancelable&&v.preventDefault();return}if(!w){var y=(i.current.shards||[]).map(qa).filter(Boolean).filter(function(T){return T.contains(v.target)}),E=y.length>0?l(v,y[0]):!i.current.noIsolation;E&&v.cancelable&&v.preventDefault()}}},[]),d=u.useCallback(function(g,v,b,w){var y={name:g,delta:v,target:b,should:w,shadowParent:rv(b)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(E){return E!==y})},1)},[]),f=u.useCallback(function(g){n.current=no(g),r.current=void 0},[]),p=u.useCallback(function(g){d(g.type,Ka(g),g.target,l(g,e.lockRef.current))},[]),m=u.useCallback(function(g){d(g.type,no(g),g.target,l(g,e.lockRef.current))},[]);u.useEffect(function(){return Vn.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Gn),document.addEventListener("touchmove",c,Gn),document.addEventListener("touchstart",f,Gn),function(){Vn=Vn.filter(function(g){return g!==s}),document.removeEventListener("wheel",c,Gn),document.removeEventListener("touchmove",c,Gn),document.removeEventListener("touchstart",f,Gn)}},[]);var h=e.removeScrollBar,x=e.inert;return u.createElement(u.Fragment,null,x?u.createElement(s,{styles:ev(o)}):null,h?u.createElement(Gx,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rv(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ov=Mx(Qc,nv);var Ho=u.forwardRef(function(e,t){return u.createElement(Uo,Yt({},e,{ref:t,sideCar:ov}))});Ho.classNames=Uo.classNames;var sv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Yn=new WeakMap,ro=new WeakMap,oo={},ys=0,ou=function(e){return e&&(e.host||ou(e.parentNode))},iv=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=ou(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},av=function(e,t,n,r){var o=iv(t,Array.isArray(e)?e:[e]);oo[n]||(oo[n]=new WeakMap);var s=oo[n],i=[],l=new Set,c=new Set(o),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};o.forEach(d);var f=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))f(m);else try{var h=m.getAttribute(r),x=h!==null&&h!=="false",g=(Yn.get(m)||0)+1,v=(s.get(m)||0)+1;Yn.set(m,g),s.set(m,v),i.push(m),g===1&&x&&ro.set(m,!0),v===1&&m.setAttribute(n,"true"),x||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return f(t),l.clear(),ys++,function(){i.forEach(function(p){var m=Yn.get(p)-1,h=s.get(p)-1;Yn.set(p,m),s.set(p,h),m||(ro.has(p)||p.removeAttribute(r),ro.delete(p)),h||p.removeAttribute(n)}),ys--,ys||(Yn=new WeakMap,Yn=new WeakMap,ro=new WeakMap,oo={})}},zi=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=sv(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),av(r,o,n,"aria-hidden")):function(){return null}},Wo="Dialog",[su,n1]=An(Wo),[lv,Ht]=su(Wo),iu=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!0}=e,l=u.useRef(null),c=u.useRef(null),[d,f]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:Wo});return a.jsx(lv,{scope:t,triggerRef:l,contentRef:c,contentId:Xt(),titleId:Xt(),descriptionId:Xt(),open:d,onOpenChange:f,onOpenToggle:u.useCallback(()=>f(p=>!p),[f]),modal:i,children:n})};iu.displayName=Wo;var au="DialogTrigger",cv=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ht(au,n),s=$e(t,o.triggerRef);return a.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Ui(o.open),...r,ref:s,onClick:ve(e.onClick,o.onOpenToggle)})});cv.displayName=au;var $i="DialogPortal",[uv,lu]=su($i,{forceMount:void 0}),cu=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,s=Ht($i,t);return a.jsx(uv,{scope:t,forceMount:n,children:u.Children.map(r,i=>a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:i})}))})};cu.displayName=$i;var Co="DialogOverlay",uu=u.forwardRef((e,t)=>{const n=lu(Co,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Ht(Co,e.__scopeDialog);return s.modal?a.jsx(mn,{present:r||s.open,children:a.jsx(fv,{...o,ref:t})}):null});uu.displayName=Co;var dv=Pn("DialogOverlay.RemoveScroll"),fv=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ht(Co,n);return a.jsx(Ho,{as:dv,allowPinchZoom:!0,shards:[o.contentRef],children:a.jsx(ke.div,{"data-state":Ui(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),On="DialogContent",du=u.forwardRef((e,t)=>{const n=lu(On,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,s=Ht(On,e.__scopeDialog);return a.jsx(mn,{present:r||s.open,children:s.modal?a.jsx(pv,{...o,ref:t}):a.jsx(mv,{...o,ref:t})})});du.displayName=On;var pv=u.forwardRef((e,t)=>{const n=Ht(On,e.__scopeDialog),r=u.useRef(null),o=$e(t,n.contentRef,r);return u.useEffect(()=>{const s=r.current;if(s)return zi(s)},[]),a.jsx(fu,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:ve(e.onFocusOutside,s=>s.preventDefault())})}),mv=u.forwardRef((e,t)=>{const n=Ht(On,e.__scopeDialog),r=u.useRef(!1),o=u.useRef(!1);return a.jsx(fu,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),fu=u.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,...i}=e,l=Ht(On,n),c=u.useRef(null),d=$e(t,c);return Fi(),a.jsxs(a.Fragment,{children:[a.jsx(Bo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Hr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Ui(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(hv,{titleId:l.titleId}),a.jsx(xv,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Bi="DialogTitle",pu=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ht(Bi,n);return a.jsx(ke.h2,{id:o.titleId,...r,ref:t})});pu.displayName=Bi;var mu="DialogDescription",hu=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ht(mu,n);return a.jsx(ke.p,{id:o.descriptionId,...r,ref:t})});hu.displayName=mu;var gu="DialogClose",xu=u.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=Ht(gu,n);return a.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});xu.displayName=gu;function Ui(e){return e?"open":"closed"}var vu="DialogTitleWarning",[r1,wu]=sh(vu,{contentName:On,titleName:Bi,docsSlug:"dialog"}),hv=({titleId:e})=>{const t=wu(vu),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
113
|
-
|
|
114
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
115
|
-
|
|
116
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return u.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},gv="DialogDescriptionWarning",xv=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wu(gv).contentName}}.`;return u.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},vv=iu,wv=cu,bv=uu,yv=du,Sv=pu,Cv=hu,Ev=xu;function Go({...e}){return a.jsx(vv,{"data-slot":"dialog",...e})}function Tv({...e}){return a.jsx(wv,{"data-slot":"dialog-portal",...e})}function Av({className:e,...t}){return a.jsx(bv,{"data-slot":"dialog-overlay",className:Ce("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Vo({className:e,children:t,showCloseButton:n=!0,...r}){return a.jsxs(Tv,{"data-slot":"dialog-portal",children:[a.jsx(Av,{}),a.jsxs(yv,{"data-slot":"dialog-content",className:Ce("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md border p-6 shadow-lg duration-200 sm:max-w-lg",e),...r,children:[t,n&&a.jsxs(Ev,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[a.jsx(Ro,{}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Yo({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-header",className:Ce("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Nv({className:e,...t}){return a.jsx("div",{"data-slot":"dialog-footer",className:Ce("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Ko({className:e,...t}){return a.jsx(Sv,{"data-slot":"dialog-title",className:Ce("text-lg leading-none font-semibold",e),...t})}function qo({className:e,...t}){return a.jsx(Cv,{"data-slot":"dialog-description",className:Ce("py-4 text-sm",e),...t})}const Xo=u.createContext(null);Xo.displayName="PanelGroupContext";const Be={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},Hi=10,Mn=u.useLayoutEffect,Xa=pi.useId,kv=typeof Xa=="function"?Xa:()=>null;let _v=0;function Wi(e=null){const t=kv(),n=u.useRef(e||t||null);return n.current===null&&(n.current=""+_v++),e??n.current}function bu({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:o,forwardedRef:s,id:i,maxSize:l,minSize:c,onCollapse:d,onExpand:f,onResize:p,order:m,style:h,tagName:x="div",...g}){const v=u.useContext(Xo);if(v===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:b,expandPanel:w,getPanelSize:y,getPanelStyle:E,groupId:T,isPanelCollapsed:_,reevaluatePanelConstraints:I,registerPanel:A,resizePanel:q,unregisterPanel:K}=v,U=Wi(i),Y=u.useRef({callbacks:{onCollapse:d,onExpand:f,onResize:p},constraints:{collapsedSize:n,collapsible:r,defaultSize:o,maxSize:l,minSize:c},id:U,idIsFromProps:i!==void 0,order:m});u.useRef({didLogMissingDefaultSizeWarning:!1}),Mn(()=>{const{callbacks:O,constraints:X}=Y.current,N={...X};Y.current.id=U,Y.current.idIsFromProps=i!==void 0,Y.current.order=m,O.onCollapse=d,O.onExpand=f,O.onResize=p,X.collapsedSize=n,X.collapsible=r,X.defaultSize=o,X.maxSize=l,X.minSize=c,(N.collapsedSize!==X.collapsedSize||N.collapsible!==X.collapsible||N.maxSize!==X.maxSize||N.minSize!==X.minSize)&&I(Y.current,N)}),Mn(()=>{const O=Y.current;return A(O),()=>{K(O)}},[m,U,A,K]),u.useImperativeHandle(s,()=>({collapse:()=>{b(Y.current)},expand:O=>{w(Y.current,O)},getId(){return U},getSize(){return y(Y.current)},isCollapsed(){return _(Y.current)},isExpanded(){return!_(Y.current)},resize:O=>{q(Y.current,O)}}),[b,w,y,_,U,q]);const J=E(Y.current,o);return u.createElement(x,{...g,children:e,className:t,id:U,style:{...J,...h},[Be.groupId]:T,[Be.panel]:"",[Be.panelCollapsible]:r||void 0,[Be.panelId]:U,[Be.panelSize]:parseFloat(""+J.flexGrow).toFixed(1)})}const yu=u.forwardRef((e,t)=>u.createElement(bu,{...e,forwardedRef:t}));bu.displayName="Panel";yu.displayName="forwardRef(Panel)";let Ys=null,xo=-1,vn=null;function Iv(e,t,n){const r=(t&Au)!==0,o=(t&Nu)!==0,s=(t&ku)!==0,i=(t&_u)!==0;if(t){if(r)return s?"se-resize":i?"ne-resize":"e-resize";if(o)return s?"sw-resize":i?"nw-resize":"w-resize";if(s)return"s-resize";if(i)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function jv(){vn!==null&&(document.head.removeChild(vn),Ys=null,vn=null,xo=-1)}function Ss(e,t,n){var r,o;const s=Iv(e,t);if(Ys!==s){if(Ys=s,vn===null&&(vn=document.createElement("style"),document.head.appendChild(vn)),xo>=0){var i;(i=vn.sheet)===null||i===void 0||i.removeRule(xo)}xo=(r=(o=vn.sheet)===null||o===void 0?void 0:o.insertRule(`*{cursor: ${s} !important;}`))!==null&&r!==void 0?r:-1}}function Su(e){return e.type==="keydown"}function Cu(e){return e.type.startsWith("pointer")}function Eu(e){return e.type.startsWith("mouse")}function Zo(e){if(Cu(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(Eu(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function Mv(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function Rv(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Pv(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Qa(e),b:Qa(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Se(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Ja(Za(n.a)),b:Ja(Za(n.b))};if(o.a===o.b){const s=r.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let l=s.length;for(;l--;){const c=s[l];if(c===i.a)return 1;if(c===i.b)return-1}}return Math.sign(o.a-o.b)}const Lv=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Dv(e){var t;const n=getComputedStyle((t=Tu(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function Ov(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Dv(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Lv.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Za(e){let t=e.length;for(;t--;){const n=e[t];if(Se(n,"Missing node"),Ov(n))return n}return null}function Ja(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Qa(e){const t=[];for(;e;)t.push(e),e=Tu(e);return t}function Tu(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const Au=1,Nu=2,ku=4,_u=8,Fv=Mv()==="coarse";let $t=[],rr=!1,wn=new Map,Jo=new Map;const Dr=new Set;function zv(e,t,n,r,o){var s;const{ownerDocument:i}=t,l={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:o},c=(s=wn.get(i))!==null&&s!==void 0?s:0;return wn.set(i,c+1),Dr.add(l),Eo(),function(){var f;Jo.delete(e),Dr.delete(l);const p=(f=wn.get(i))!==null&&f!==void 0?f:1;if(wn.set(i,p-1),Eo(),p===1&&wn.delete(i),$t.includes(l)){const m=$t.indexOf(l);m>=0&&$t.splice(m,1),Qo(),o("up",!0,null)}}}function $v(e){const{target:t}=e,{x:n,y:r}=Zo(e);rr=!0,Gi({target:t,x:n,y:r}),Eo(),$t.length>0&&(To("down",e),Qo(),e.preventDefault(),Iu(t)||e.stopImmediatePropagation())}function Cs(e){const{x:t,y:n}=Zo(e);if(rr&&e.buttons===0&&(rr=!1,To("up",e)),!rr){const{target:r}=e;Gi({target:r,x:t,y:n})}To("move",e),Qo(),$t.length>0&&e.preventDefault()}function Es(e){const{target:t}=e,{x:n,y:r}=Zo(e);Jo.clear(),rr=!1,$t.length>0&&(e.preventDefault(),Iu(t)||e.stopImmediatePropagation()),To("up",e),Gi({target:t,x:n,y:r}),Qo(),Eo()}function Iu(e){let t=e;for(;t;){if(t.hasAttribute(Be.resizeHandle))return!0;t=t.parentElement}return!1}function Gi({target:e,x:t,y:n}){$t.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Dr.forEach(o=>{const{element:s,hitAreaMargins:i}=o,l=s.getBoundingClientRect(),{bottom:c,left:d,right:f,top:p}=l,m=Fv?i.coarse:i.fine;if(t>=d-m&&t<=f+m&&n>=p-m&&n<=c+m){if(r!==null&&document.contains(r)&&s!==r&&!s.contains(r)&&!r.contains(s)&&Pv(r,s)>0){let x=r,g=!1;for(;x&&!x.contains(s);){if(Rv(x.getBoundingClientRect(),l)){g=!0;break}x=x.parentElement}if(g)return}$t.push(o)}})}function Ts(e,t){Jo.set(e,t)}function Qo(){let e=!1,t=!1;$t.forEach(r=>{const{direction:o}=r;o==="horizontal"?e=!0:t=!0});let n=0;Jo.forEach(r=>{n|=r}),e&&t?Ss("intersection",n):e?Ss("horizontal",n):t?Ss("vertical",n):jv()}let As;function Eo(){var e;(e=As)===null||e===void 0||e.abort(),As=new AbortController;const t={capture:!0,signal:As.signal};Dr.size&&(rr?($t.length>0&&wn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("contextmenu",Es,t),o.addEventListener("pointerleave",Cs,t),o.addEventListener("pointermove",Cs,t))}),wn.forEach((n,r)=>{const{body:o}=r;o.addEventListener("pointerup",Es,t),o.addEventListener("pointercancel",Es,t)})):wn.forEach((n,r)=>{const{body:o}=r;n>0&&(o.addEventListener("pointerdown",$v,t),o.addEventListener("pointermove",Cs,t))}))}function To(e,t){Dr.forEach(n=>{const{setResizeHandlerState:r}=n,o=$t.includes(n);r(e,o,t)})}function Bv(){const[e,t]=u.useState(0);return u.useCallback(()=>t(n=>n+1),[])}function Se(e,t){if(!e)throw console.error(t),Error(t)}function Fn(e,t,n=Hi){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function cn(e,t,n=Hi){return Fn(e,t,n)===0}function bt(e,t,n){return Fn(e,t,n)===0}function Uv(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const o=e[r],s=t[r];if(!bt(o,s,n))return!1}return!0}function Jn({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Se(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:o=0,collapsible:s,maxSize:i=100,minSize:l=0}=r;if(Fn(n,l)<0)if(s){const c=(o+l)/2;Fn(n,c)<0?n=o:n=l}else n=l;return n=Math.min(i,n),n=parseFloat(n.toFixed(Hi)),n}function _r({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(bt(e,0))return t;const i=[...t],[l,c]=r;Se(l!=null,"Invalid first pivot index"),Se(c!=null,"Invalid second pivot index");let d=0;if(s==="keyboard"){{const p=e<0?c:l,m=n[p];Se(m,`Panel constraints not found for index ${p}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const v=t[p];if(Se(v!=null,`Previous layout not found for panel index ${p}`),bt(v,h)){const b=g-v;Fn(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const p=e<0?l:c,m=n[p];Se(m,`No panel constraints found for index ${p}`);const{collapsedSize:h=0,collapsible:x,minSize:g=0}=m;if(x){const v=t[p];if(Se(v!=null,`Previous layout not found for panel index ${p}`),bt(v,g)){const b=v-h;Fn(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}}{const p=e<0?1:-1;let m=e<0?c:l,h=0;for(;;){const g=t[m];Se(g!=null,`Previous layout not found for panel index ${m}`);const b=Jn({panelConstraints:n,panelIndex:m,size:100})-g;if(h+=b,m+=p,m<0||m>=n.length)break}const x=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-x:x}{let m=e<0?l:c;for(;m>=0&&m<n.length;){const h=Math.abs(e)-Math.abs(d),x=t[m];Se(x!=null,`Previous layout not found for panel index ${m}`);const g=x-h,v=Jn({panelConstraints:n,panelIndex:m,size:g});if(!bt(x,v)&&(d+=x-v,i[m]=v,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?m--:m++}}if(Uv(o,i))return o;{const p=e<0?c:l,m=t[p];Se(m!=null,`Previous layout not found for panel index ${p}`);const h=m+d,x=Jn({panelConstraints:n,panelIndex:p,size:h});if(i[p]=x,!bt(x,h)){let g=h-x,b=e<0?c:l;for(;b>=0&&b<n.length;){const w=i[b];Se(w!=null,`Previous layout not found for panel index ${b}`);const y=w+g,E=Jn({panelConstraints:n,panelIndex:b,size:y});if(bt(w,E)||(g-=E-w,i[b]=E),bt(g,0))break;e>0?b--:b++}}}const f=i.reduce((p,m)=>m+p,0);return bt(f,100)?i:o}function Hv({layout:e,panelsArray:t,pivotIndices:n}){let r=0,o=100,s=0,i=0;const l=n[0];Se(l!=null,"No pivot index found"),t.forEach((p,m)=>{const{constraints:h}=p,{maxSize:x=100,minSize:g=0}=h;m===l?(r=g,o=x):(s+=g,i+=x)});const c=Math.min(o,100-s),d=Math.max(r,100-i),f=e[l];return{valueMax:c,valueMin:d,valueNow:f}}function Or(e,t=document){return Array.from(t.querySelectorAll(`[${Be.resizeHandleId}][data-panel-group-id="${e}"]`))}function ju(e,t,n=document){const o=Or(e,n).findIndex(s=>s.getAttribute(Be.resizeHandleId)===t);return o??null}function Mu(e,t,n){const r=ju(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function Wv(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function Ru(e,t=document){if(Wv(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function es(e,t=document){const n=t.querySelector(`[${Be.resizeHandleId}="${e}"]`);return n||null}function Gv(e,t,n,r=document){var o,s,i,l;const c=es(t,r),d=Or(e,r),f=c?d.indexOf(c):-1,p=(o=(s=n[f])===null||s===void 0?void 0:s.id)!==null&&o!==void 0?o:null,m=(i=(l=n[f+1])===null||l===void 0?void 0:l.id)!==null&&i!==void 0?i:null;return[p,m]}function Vv({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:o,panelGroupElement:s,setLayout:i}){u.useRef({didWarnAboutMissingResizeHandle:!1}),Mn(()=>{if(!s)return;const l=Or(n,s);for(let c=0;c<o.length-1;c++){const{valueMax:d,valueMin:f,valueNow:p}=Hv({layout:r,panelsArray:o,pivotIndices:[c,c+1]}),m=l[c];if(m!=null){const h=o[c];Se(h,`No panel data found for index "${c}"`),m.setAttribute("aria-controls",h.id),m.setAttribute("aria-valuemax",""+Math.round(d)),m.setAttribute("aria-valuemin",""+Math.round(f)),m.setAttribute("aria-valuenow",p!=null?""+Math.round(p):"")}}return()=>{l.forEach((c,d)=>{c.removeAttribute("aria-controls"),c.removeAttribute("aria-valuemax"),c.removeAttribute("aria-valuemin"),c.removeAttribute("aria-valuenow")})}},[n,r,o,s]),u.useEffect(()=>{if(!s)return;const l=t.current;Se(l,"Eager values not found");const{panelDataArray:c}=l,d=Ru(n,s);Se(d!=null,`No group found for id "${n}"`);const f=Or(n,s);Se(f,`No resize handles found for group id "${n}"`);const p=f.map(m=>{const h=m.getAttribute(Be.resizeHandleId);Se(h,"Resize handle element has no handle id attribute");const[x,g]=Gv(n,h,c,s);if(x==null||g==null)return()=>{};const v=b=>{if(!b.defaultPrevented)switch(b.key){case"Enter":{b.preventDefault();const w=c.findIndex(y=>y.id===x);if(w>=0){const y=c[w];Se(y,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:T=0,collapsible:_,minSize:I=0}=y.constraints;if(E!=null&&_){const A=_r({delta:bt(E,T)?I-T:T-E,initialLayout:r,panelConstraints:c.map(q=>q.constraints),pivotIndices:Mu(n,h,s),prevLayout:r,trigger:"keyboard"});r!==A&&i(A)}}break}}};return m.addEventListener("keydown",v),()=>{m.removeEventListener("keydown",v)}});return()=>{p.forEach(m=>m())}},[s,e,t,n,r,o,i])}function el(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Pu(e,t){const n=e==="horizontal",{x:r,y:o}=Zo(t);return n?r:o}function Yv(e,t,n,r,o){const s=n==="horizontal",i=es(t,o);Se(i,`No resize handle element found for id "${t}"`);const l=i.getAttribute(Be.groupId);Se(l,"Resize handle element has no group id attribute");let{initialCursorPosition:c}=r;const d=Pu(n,e),f=Ru(l,o);Se(f,`No group element found for id "${l}"`);const p=f.getBoundingClientRect(),m=s?p.width:p.height;return(d-c)/m*100}function Kv(e,t,n,r,o,s){if(Su(e)){const i=n==="horizontal";let l=0;e.shiftKey?l=100:o!=null?l=o:l=10;let c=0;switch(e.key){case"ArrowDown":c=i?0:l;break;case"ArrowLeft":c=i?-l:0;break;case"ArrowRight":c=i?l:0;break;case"ArrowUp":c=i?0:-l;break;case"End":c=100;break;case"Home":c=-100;break}return c}else return r==null?0:Yv(e,t,n,r,s)}function qv({panelDataArray:e}){const t=Array(e.length),n=e.map(s=>s.constraints);let r=0,o=100;for(let s=0;s<e.length;s++){const i=n[s];Se(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;l!=null&&(r++,t[s]=l,o-=l)}for(let s=0;s<e.length;s++){const i=n[s];Se(i,`Panel constraints not found for index ${s}`);const{defaultSize:l}=i;if(l!=null)continue;const c=e.length-r,d=o/c;r++,t[s]=d,o-=d}return t}function Kn(e,t,n){t.forEach((r,o)=>{const s=e[o];Se(s,`Panel data not found for index ${o}`);const{callbacks:i,constraints:l,id:c}=s,{collapsedSize:d=0,collapsible:f}=l,p=n[c];if(p==null||r!==p){n[c]=r;const{onCollapse:m,onExpand:h,onResize:x}=i;x&&x(r,p),f&&(m||h)&&(h&&(p==null||cn(p,d))&&!cn(r,d)&&h(),m&&(p==null||!cn(p,d))&&cn(r,d)&&m())}})}function so(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function Xv({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:o,precision:s=3}){const i=n[o];let l;return i==null?l=e!=null?e.toFixed(s):"1":r.length===1?l="1":l=i.toFixed(s),{flexBasis:0,flexGrow:l,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function Zv(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function tl(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function Lu(e){return`react-resizable-panels:${e}`}function Du(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:o,order:s}=t;return o?r:s?`${s}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function Ou(e,t){try{const n=Lu(e),r=t.getItem(n);if(r){const o=JSON.parse(r);if(typeof o=="object"&&o!=null)return o}}catch{}return null}function Jv(e,t,n){var r,o;const s=(r=Ou(e,n))!==null&&r!==void 0?r:{},i=Du(t);return(o=s[i])!==null&&o!==void 0?o:null}function Qv(e,t,n,r,o){var s;const i=Lu(e),l=Du(t),c=(s=Ou(e,o))!==null&&s!==void 0?s:{};c[l]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{o.setItem(i,JSON.stringify(c))}catch(d){console.error(d)}}function nl({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((s,i)=>s+i,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(s=>`${s}%`).join(", ")}`);if(!bt(r,100)&&n.length>0)for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=100/r*i;n[s]=l}let o=0;for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=Jn({panelConstraints:t,panelIndex:s,size:i});i!=l&&(o+=i-l,n[s]=l)}if(!bt(o,0))for(let s=0;s<t.length;s++){const i=n[s];Se(i!=null,`No layout data found for index ${s}`);const l=i+o,c=Jn({panelConstraints:t,panelIndex:s,size:l});if(i!==c&&(o-=c-i,n[s]=c,bt(o,0)))break}return n}const ew=100,Ir={getItem:e=>(tl(Ir),Ir.getItem(e)),setItem:(e,t)=>{tl(Ir),Ir.setItem(e,t)}},rl={};function Fu({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:o,id:s=null,onLayout:i=null,keyboardResizeBy:l=null,storage:c=Ir,style:d,tagName:f="div",...p}){const m=Wi(s),h=u.useRef(null),[x,g]=u.useState(null),[v,b]=u.useState([]),w=Bv(),y=u.useRef({}),E=u.useRef(new Map),T=u.useRef(0),_=u.useRef({autoSaveId:e,direction:r,dragState:x,id:m,keyboardResizeBy:l,onLayout:i,storage:c}),I=u.useRef({layout:v,panelDataArray:[],panelDataArrayChanged:!1});u.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),u.useImperativeHandle(o,()=>({getId:()=>_.current.id,getLayout:()=>{const{layout:D}=I.current;return D},setLayout:D=>{const{onLayout:$}=_.current,{layout:L,panelDataArray:G}=I.current,k=nl({layout:D,panelConstraints:G.map(V=>V.constraints)});el(L,k)||(b(k),I.current.layout=k,$&&$(k),Kn(G,k,y.current))}}),[]),Mn(()=>{_.current.autoSaveId=e,_.current.direction=r,_.current.dragState=x,_.current.id=m,_.current.onLayout=i,_.current.storage=c}),Vv({committedValuesRef:_,eagerValuesRef:I,groupId:m,layout:v,panelDataArray:I.current.panelDataArray,setLayout:b,panelGroupElement:h.current}),u.useEffect(()=>{const{panelDataArray:D}=I.current;if(e){if(v.length===0||v.length!==D.length)return;let $=rl[e];$==null&&($=Zv(Qv,ew),rl[e]=$);const L=[...D],G=new Map(E.current);$(e,L,G,v,c)}},[e,v,c]),u.useEffect(()=>{});const A=u.useCallback(D=>{const{onLayout:$}=_.current,{layout:L,panelDataArray:G}=I.current;if(D.constraints.collapsible){const k=G.map(oe=>oe.constraints),{collapsedSize:V=0,panelSize:Q,pivotIndices:te}=jn(G,D,L);if(Se(Q!=null,`Panel size not found for panel "${D.id}"`),!cn(Q,V)){E.current.set(D.id,Q);const se=Xn(G,D)===G.length-1?Q-V:V-Q,de=_r({delta:se,initialLayout:L,panelConstraints:k,pivotIndices:te,prevLayout:L,trigger:"imperative-api"});so(L,de)||(b(de),I.current.layout=de,$&&$(de),Kn(G,de,y.current))}}},[]),q=u.useCallback((D,$)=>{const{onLayout:L}=_.current,{layout:G,panelDataArray:k}=I.current;if(D.constraints.collapsible){const V=k.map(me=>me.constraints),{collapsedSize:Q=0,panelSize:te=0,minSize:oe=0,pivotIndices:se}=jn(k,D,G),de=$??oe;if(cn(te,Q)){const me=E.current.get(D.id),Me=me!=null&&me>=de?me:de,Le=Xn(k,D)===k.length-1?te-Me:Me-te,je=_r({delta:Le,initialLayout:G,panelConstraints:V,pivotIndices:se,prevLayout:G,trigger:"imperative-api"});so(G,je)||(b(je),I.current.layout=je,L&&L(je),Kn(k,je,y.current))}}},[]),K=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{panelSize:G}=jn(L,D,$);return Se(G!=null,`Panel size not found for panel "${D.id}"`),G},[]),U=u.useCallback((D,$)=>{const{panelDataArray:L}=I.current,G=Xn(L,D);return Xv({defaultSize:$,dragState:x,layout:v,panelData:L,panelIndex:G})},[x,v]),Y=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{collapsedSize:G=0,collapsible:k,panelSize:V}=jn(L,D,$);return Se(V!=null,`Panel size not found for panel "${D.id}"`),k===!0&&cn(V,G)},[]),J=u.useCallback(D=>{const{layout:$,panelDataArray:L}=I.current,{collapsedSize:G=0,collapsible:k,panelSize:V}=jn(L,D,$);return Se(V!=null,`Panel size not found for panel "${D.id}"`),!k||Fn(V,G)>0},[]),O=u.useCallback(D=>{const{panelDataArray:$}=I.current;$.push(D),$.sort((L,G)=>{const k=L.order,V=G.order;return k==null&&V==null?0:k==null?-1:V==null?1:k-V}),I.current.panelDataArrayChanged=!0,w()},[w]);Mn(()=>{if(I.current.panelDataArrayChanged){I.current.panelDataArrayChanged=!1;const{autoSaveId:D,onLayout:$,storage:L}=_.current,{layout:G,panelDataArray:k}=I.current;let V=null;if(D){const te=Jv(D,k,L);te&&(E.current=new Map(Object.entries(te.expandToSizes)),V=te.layout)}V==null&&(V=qv({panelDataArray:k}));const Q=nl({layout:V,panelConstraints:k.map(te=>te.constraints)});el(G,Q)||(b(Q),I.current.layout=Q,$&&$(Q),Kn(k,Q,y.current))}}),Mn(()=>{const D=I.current;return()=>{D.layout=[]}},[]);const X=u.useCallback(D=>{let $=!1;const L=h.current;return L&&window.getComputedStyle(L,null).getPropertyValue("direction")==="rtl"&&($=!0),function(k){k.preventDefault();const V=h.current;if(!V)return()=>null;const{direction:Q,dragState:te,id:oe,keyboardResizeBy:se,onLayout:de}=_.current,{layout:me,panelDataArray:Me}=I.current,{initialLayout:Oe}=te??{},Le=Mu(oe,D,V);let je=Kv(k,D,Q,te,se,V);const He=Q==="horizontal";He&&$&&(je=-je);const ot=Me.map(le=>le.constraints),Qe=_r({delta:je,initialLayout:Oe??me,panelConstraints:ot,pivotIndices:Le,prevLayout:me,trigger:Su(k)?"keyboard":"mouse-or-touch"}),et=!so(me,Qe);(Cu(k)||Eu(k))&&T.current!=je&&(T.current=je,!et&&je!==0?He?Ts(D,je<0?Au:Nu):Ts(D,je<0?ku:_u):Ts(D,0)),et&&(b(Qe),I.current.layout=Qe,de&&de(Qe),Kn(Me,Qe,y.current))}},[]),N=u.useCallback((D,$)=>{const{onLayout:L}=_.current,{layout:G,panelDataArray:k}=I.current,V=k.map(me=>me.constraints),{panelSize:Q,pivotIndices:te}=jn(k,D,G);Se(Q!=null,`Panel size not found for panel "${D.id}"`);const se=Xn(k,D)===k.length-1?Q-$:$-Q,de=_r({delta:se,initialLayout:G,panelConstraints:V,pivotIndices:te,prevLayout:G,trigger:"imperative-api"});so(G,de)||(b(de),I.current.layout=de,L&&L(de),Kn(k,de,y.current))},[]),R=u.useCallback((D,$)=>{const{layout:L,panelDataArray:G}=I.current,{collapsedSize:k=0,collapsible:V}=$,{collapsedSize:Q=0,collapsible:te,maxSize:oe=100,minSize:se=0}=D.constraints,{panelSize:de}=jn(G,D,L);de!=null&&(V&&te&&cn(de,k)?cn(k,Q)||N(D,Q):de<se?N(D,se):de>oe&&N(D,oe))},[N]),S=u.useCallback((D,$)=>{const{direction:L}=_.current,{layout:G}=I.current;if(!h.current)return;const k=es(D,h.current);Se(k,`Drag handle element not found for id "${D}"`);const V=Pu(L,$);g({dragHandleId:D,dragHandleRect:k.getBoundingClientRect(),initialCursorPosition:V,initialLayout:G})},[]),F=u.useCallback(()=>{g(null)},[]),M=u.useCallback(D=>{const{panelDataArray:$}=I.current,L=Xn($,D);L>=0&&($.splice(L,1),delete y.current[D.id],I.current.panelDataArrayChanged=!0,w())},[w]),P=u.useMemo(()=>({collapsePanel:A,direction:r,dragState:x,expandPanel:q,getPanelSize:K,getPanelStyle:U,groupId:m,isPanelCollapsed:Y,isPanelExpanded:J,reevaluatePanelConstraints:R,registerPanel:O,registerResizeHandle:X,resizePanel:N,startDragging:S,stopDragging:F,unregisterPanel:M,panelGroupElement:h.current}),[A,x,r,q,K,U,m,Y,J,R,O,X,N,S,F,M]),ee={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return u.createElement(Xo.Provider,{value:P},u.createElement(f,{...p,children:t,className:n,id:s,ref:h,style:{...ee,...d},[Be.group]:"",[Be.groupDirection]:r,[Be.groupId]:m}))}const zu=u.forwardRef((e,t)=>u.createElement(Fu,{...e,forwardedRef:t}));Fu.displayName="PanelGroup";zu.displayName="forwardRef(PanelGroup)";function Xn(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function jn(e,t,n){const r=Xn(e,t),s=r===e.length-1?[r-1,r]:[r,r+1],i=n[r];return{...t.constraints,panelSize:i,pivotIndices:s}}function tw({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){u.useEffect(()=>{if(e||n==null||r==null)return;const o=es(t,r);if(o==null)return;const s=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),n(i);break}case"F6":{i.preventDefault();const l=o.getAttribute(Be.groupId);Se(l,`No group element found for id "${l}"`);const c=Or(l,r),d=ju(l,t,r);Se(d!==null,`No resize element found for id "${t}"`);const f=i.shiftKey?d>0?d-1:c.length-1:d+1<c.length?d+1:0;c[f].focus();break}}};return o.addEventListener("keydown",s),()=>{o.removeEventListener("keydown",s)}},[r,e,t,n])}function $u({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:o,onBlur:s,onClick:i,onDragging:l,onFocus:c,onPointerDown:d,onPointerUp:f,style:p={},tabIndex:m=0,tagName:h="div",...x}){var g,v;const b=u.useRef(null),w=u.useRef({onClick:i,onDragging:l,onPointerDown:d,onPointerUp:f});u.useEffect(()=>{w.current.onClick=i,w.current.onDragging=l,w.current.onPointerDown=d,w.current.onPointerUp=f});const y=u.useContext(Xo);if(y===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:T,registerResizeHandle:_,startDragging:I,stopDragging:A,panelGroupElement:q}=y,K=Wi(o),[U,Y]=u.useState("inactive"),[J,O]=u.useState(!1),[X,N]=u.useState(null),R=u.useRef({state:U});Mn(()=>{R.current.state=U}),u.useEffect(()=>{if(n)N(null);else{const P=_(K);N(()=>P)}},[n,K,_]);const S=(g=r==null?void 0:r.coarse)!==null&&g!==void 0?g:15,F=(v=r==null?void 0:r.fine)!==null&&v!==void 0?v:5;u.useEffect(()=>{if(n||X==null)return;const P=b.current;Se(P,"Element ref not attached");let ee=!1;return zv(K,P,E,{coarse:S,fine:F},($,L,G)=>{if(!L){Y("inactive");return}switch($){case"down":{Y("drag"),ee=!1,Se(G,'Expected event to be defined for "down" action'),I(K,G);const{onDragging:k,onPointerDown:V}=w.current;k==null||k(!0),V==null||V();break}case"move":{const{state:k}=R.current;ee=!0,k!=="drag"&&Y("hover"),Se(G,'Expected event to be defined for "move" action'),X(G);break}case"up":{Y("hover"),A();const{onClick:k,onDragging:V,onPointerUp:Q}=w.current;V==null||V(!1),Q==null||Q(),ee||k==null||k();break}}})},[S,E,n,F,_,K,X,I,A]),tw({disabled:n,handleId:K,resizeHandler:X,panelGroupElement:q});const M={touchAction:"none",userSelect:"none"};return u.createElement(h,{...x,children:e,className:t,id:o,onBlur:()=>{O(!1),s==null||s()},onFocus:()=>{O(!0),c==null||c()},ref:b,role:"separator",style:{...M,...p},tabIndex:m,[Be.groupDirection]:E,[Be.groupId]:T,[Be.resizeHandle]:"",[Be.resizeHandleActive]:U==="drag"?"pointer":J?"keyboard":void 0,[Be.resizeHandleEnabled]:!n,[Be.resizeHandleId]:K,[Be.resizeHandleState]:U})}$u.displayName="PanelResizeHandle";function nw({className:e,...t}){return a.jsx(zu,{"data-slot":"resizable-panel-group",className:Ce("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...t})}function ol({...e}){return a.jsx(yu,{"data-slot":"resizable-panel",...e})}function rw({withHandle:e,className:t,...n}){return a.jsx($u,{"data-slot":"resizable-handle",className:Ce("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",t),...n,children:e&&a.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-xs border",children:a.jsx(Ip,{className:"size-2.5"})})})}function ow({ref:e,anchorRef:t,onClickOutside:n,enabled:r=!0}){u.useEffect(()=>{if(!r)return;const o=s=>{const i=s.target,l=e.current&&!e.current.contains(i),c=t!=null&&t.current?!t.current.contains(i):!0;l&&c&&n()};return document.addEventListener("mousedown",o),()=>{document.removeEventListener("mousedown",o)}},[e,t,n,r])}function sw({onEscape:e,enabled:t=!0}){u.useEffect(()=>{if(!t)return;const n=r=>{r.key==="Escape"&&e()};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[e,t])}const iw={x:0,y:0},kt=16,aw=["top-start","bottom-end","top-end"];function lw({anchorRef:e,placement:t="top-start",offset:n=iw,fallbackPlacements:r=aw}){const o=u.useCallback((c,d,f)=>{let p=0,m=0;switch(f){case"top":p=c.top-d.height-n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"top-start":p=c.top-d.height-n.y,m=c.left+n.x;break;case"top-end":p=c.top-d.height-n.y,m=c.right-d.width-n.x;break;case"bottom":p=c.bottom+n.y,m=c.left+(c.width-d.width)/2+n.x;break;case"bottom-start":p=c.bottom+n.y,m=c.left+n.x;break;case"bottom-end":p=c.bottom+n.y,m=c.right-d.width-n.x;break;case"left":p=c.top+(c.height-d.height)/2+n.y,m=c.left-d.width-n.x;break;case"left-start":p=c.top+n.y,m=c.left-d.width-n.x;break;case"left-end":p=c.bottom-d.height-n.y,m=c.left-d.width-n.x;break;case"right":p=c.top+(c.height-d.height)/2+n.y,m=c.right+n.x;break;case"right-start":p=c.top+n.y,m=c.right+n.x;break;case"right-end":p=c.bottom-d.height-n.y,m=c.right+n.x;break}return console.log(`Calculated position for ${f}:`,{top:p,left:m}),{top:p,left:m,placement:f}},[n.x,n.y]),s=u.useCallback((c,d)=>{const f={width:window.innerWidth,height:window.innerHeight};return c.left<kt||c.top<kt||c.left+d.width>f.width-kt||c.top+d.height>f.height-kt},[]),i=u.useCallback(c=>{if(!e.current){const x={width:window.innerWidth,height:window.innerHeight};return{top:x.height/2-100,left:x.width/2-100,placement:t}}const d=e.current.getBoundingClientRect(),f=c.getBoundingClientRect(),p=o(d,f,t);if(!s(p,f))return p;for(const x of r){const g=o(d,f,x);if(!s(g,f))return g}const m={width:window.innerWidth,height:window.innerHeight},h={...p};return h.left<kt?h.left=kt:h.left+f.width>m.width-kt&&(h.left=m.width-f.width-kt),h.top<kt?h.top=kt:h.top+f.height>m.height-kt&&(h.top=m.height-f.height-kt),h},[e,t,r,o,s]);return{getPositionStyle:u.useCallback(c=>{const d=i(c);return{position:"fixed",top:d.top,left:d.left,zIndex:1e3}},[i]),getOptimalPosition:i}}function cw({defaultWidth:e,minWidth:t,maxWidth:n,position:r="left",onWidthChange:o}){const[s,i]=u.useState(e),[l,c]=u.useState(!1),d=u.useRef(0),f=u.useRef(e),p=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.clientX,f.current=s},[s]),m=u.useCallback(b=>{if(!l)return;const w=b.clientX-d.current,y=r==="right"?-w:w,E=Math.min(Math.max(f.current+y,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),h=u.useCallback(()=>{c(!1)},[]),x=u.useCallback(b=>{b.preventDefault(),c(!0),d.current=b.touches[0].clientX,f.current=s},[s]),g=u.useCallback(b=>{if(!l)return;const w=b.touches[0].clientX-d.current,y=r==="right"?-w:w,E=Math.min(Math.max(f.current+y,t),n);i(E),o==null||o(E)},[l,t,n,r,o]),v=u.useCallback(()=>{c(!1)},[]);return u.useEffect(()=>{if(l)return document.addEventListener("mousemove",m),document.addEventListener("mouseup",h),document.addEventListener("touchmove",g),document.addEventListener("touchend",v),document.body.style.userSelect="none",document.body.style.cursor="col-resize",()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h),document.removeEventListener("touchmove",g),document.removeEventListener("touchend",v),document.body.style.userSelect="",document.body.style.cursor=""}},[l,m,h,g,v]),{width:s,isResizing:l,handleMouseDown:p,handleTouchStart:x,setWidth:i}}const uw=u.forwardRef(({children:e,defaultWidth:t=300,minWidth:n=200,maxWidth:r=800,position:o="left",resizable:s=!0,className:i,onWidthChange:l,...c},d)=>{const{width:f,isResizing:p,handleMouseDown:m,handleTouchStart:h}=cw({defaultWidth:t,minWidth:n,maxWidth:r,position:o,onWidthChange:l}),x={width:`${f}px`},g=o==="left"?"right-0":"left-0";return a.jsxs("div",{ref:d,className:Ce("relative h-full flex-shrink-0 cursor-pointer",o==="left"?"border-r":"border-l",i),style:x,...c,children:[a.jsx("div",{className:Ce("h-full overflow-x-hidden overflow-y-auto"),children:e}),s&&a.jsx("div",{className:Ce("group absolute top-0 bottom-0 w-2",g,"cursor-col-resize","hover:bg-[var(--color-primary-wMain)]","transition-all duration-200",p&&"bg-[var(--color-primary-wMain)]"),onMouseDown:m,onTouchStart:h,role:"separator","aria-orientation":"vertical","aria-label":`Resize ${o} panel`,tabIndex:0,onKeyDown:b=>{if(b.key==="ArrowLeft"||b.key==="ArrowRight"){b.preventDefault();const w=b.key==="ArrowRight"?10:-10,y=o==="right"?-w:w,E=Math.min(Math.max(f+y,n),r);l==null||l(E)}},children:a.jsx("div",{className:Ce("absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 transform","bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]","group-hover:bg-[var(--color-primary-wMain)]","transition-colors duration-200",p&&"bg-[var(--color-primary-wMain)]")})})]})});uw.displayName="SidePanel";const Bu=u.createContext(null),Uu=u.createContext(void 0),Hu=u.createContext(null),Wu=u.createContext(null),Gu=u.createContext(void 0),Vu=u.createContext(null);function tn(){const e=u.useContext(Hu);if(e===null)throw new Error("useConfig must be used within a ConfigProvider");return e}const dw="https://solace.com/a2a/extensions/display-name",fw="https://solace.com/a2a/extensions/peer-agent-topology",pw="https://solace.com/a2a/extensions/sam/tools",mw=e=>{var o,s,i,l;let t,n,r;if((o=e.capabilities)!=null&&o.extensions){const c=e.capabilities.extensions.find(p=>p.uri===dw);(s=c==null?void 0:c.params)!=null&&s.display_name&&(t=c.params.display_name);const d=e.capabilities.extensions.find(p=>p.uri===fw);(i=d==null?void 0:d.params)!=null&&i.peer_agent_names&&(n=d.params.peer_agent_names);const f=e.capabilities.extensions.find(p=>p.uri===pw);(l=f==null?void 0:f.params)!=null&&l.tools&&(r=f.params.tools)}return{...e,display_name:t,peer_agents:n||[],tools:r||[],displayName:t,peerAgents:n||[]}},hw=()=>{const{configServerUrl:e}=tn(),[t,n]=u.useState([]),[r,o]=u.useState(!0),[s,i]=u.useState(null),l=`${e}/api/v1`,c=u.useCallback(async()=>{o(!0),i(null);try{const d=await ze(`${l}/agentCards`,{credentials:"include"});if(!d.ok){const m=await d.json().catch(()=>({message:`Failed to fetch agents: ${d.statusText}`}));throw new Error(m.message||`Failed to fetch agents: ${d.statusText}`)}const p=(await d.json()).map(mw);n(p)}catch(d){console.error("Error fetching agents:",d),i(d instanceof Error?d.message:"Could not load agent information."),n([])}finally{o(!1)}},[l]);return u.useEffect(()=>{c()},[c]),{agents:t,isLoading:r,error:s,refetch:c}},gw=e=>{const{configServerUrl:t}=tn(),[n,r]=u.useState([]),[o,s]=u.useState(!0),[i,l]=u.useState(null),c=`${t}/api/v1`,d=u.useCallback(async()=>{if(!e){r([]),s(!1);return}s(!0),l(null);try{const f=await ze(`${c}/artifacts/${e}`,{credentials:"include"});if(!f.ok){const m=await f.json().catch(()=>({message:`Failed to fetch artifacts. ${f.statusText}`}));throw new Error(m.message||`Failed to fetch artifacts. ${f.statusText}`)}const p=await f.json();r(p)}catch(f){const p=f instanceof Error?f.message:"Failed to fetch artifacts.";l(p),r([])}finally{s(!1)}},[c,e]);return u.useEffect(()=>{d()},[d]),{artifacts:n,isLoading:o,error:i,refetch:d}},Yu=()=>{const e=u.useContext(Bu);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e},Ue=()=>{const e=u.useContext(Uu);if(e===void 0)throw new Error("useChatContext must be used within a ChatProvider");return e};function xw(){const{messages:e}=Ue(),t=tn(),n=u.useCallback(r=>{if((t==null?void 0:t.persistenceEnabled)===!1&&!(e.length<=1))return r.preventDefault(),"Are you sure you want to leave? Your chat history will be lost."},[e.length,t==null?void 0:t.persistenceEnabled]);u.useEffect(()=>(window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}),[n])}function Ku(){const e=u.useContext(Wu);if(!e)throw new Error("useCsrf must be used within a CsrfProvider");return e}function vw(e,t){const[n,r]=u.useState(e);return u.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n}const ww=async(e,t,n)=>{const r=await ze(`${e}/api/v1/artifacts/${t}/${encodeURIComponent(n.filename)}`,{credentials:"include"});if(!r.ok)throw new Error(`Failed to download artifact: ${n.filename}. Status: ${r.status}`);const o=await r.blob();dc(o,n.filename)},qu=()=>{const{configServerUrl:e}=tn(),{addNotification:t,sessionId:n}=Ue();return{onDownload:async o=>{if(!n){t("Cannot download artifact: No active session.","error");return}try{await ww(e,n,o),t(`Downloaded artifact: ${o.filename}.`)}catch{t(`Failed to download artifact: ${o.filename}.`,"error")}}}},bw=({onFilesDropped:e,fileFilter:t,disabled:n=!1})=>{const[r,o]=u.useState(!1),s=u.useRef(0),i=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)+1,f.dataTransfer.types.includes("Files")&&o(!0))},[n,s]),l=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),f.dataTransfer.types.includes("Files")&&(f.dataTransfer.dropEffect="copy"))},[n]),c=u.useCallback(f=>{n||(f.preventDefault(),f.stopPropagation(),s.current=(s.current||0)-1,s.current===0&&o(!1))},[n,s]),d=u.useCallback(f=>{if(n||(f.preventDefault(),f.stopPropagation(),o(!1),s.current=0,!f.dataTransfer.files||f.dataTransfer.files.length===0))return;const p=Array.from(f.dataTransfer.files),m=t?p.filter(t):p;m.length!==0&&e(m)},[n,s,t,e]);return{isDragging:r,handleDragEnter:i,handleDragOver:l,handleDragLeave:c,handleDrop:d}},Xu=()=>{const{messages:e,sessionName:t}=Ue();return u.useMemo(()=>{const n=e.find(r=>r.isUser?r.parts.some(o=>o.kind==="text"&&o.text.trim()):!1);if(n){const o=n.parts.filter(s=>s.kind==="text").map(s=>s.text).join(" ").trim();if(o)return o.length>100?`${o.substring(0,100)}...`:o}return"New Chat"},[e,t])},Vi=()=>{const e=u.useContext(Gu);if(e===void 0)throw new Error("useTaskContext must be used within a TaskProvider");return e};function Zu(){const e=u.useContext(Vu);if(e===null)throw new Error("useThemeContext must be used within a ThemeProvider");return e}u.createContext(null);function Ju(e){const t=e+"CollectionProvider",[n,r]=An(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:b}=g,w=zt.useRef(null),y=zt.useRef(new Map).current;return a.jsx(o,{scope:v,itemMap:y,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=Pn(l),d=zt.forwardRef((g,v)=>{const{scope:b,children:w}=g,y=s(l,b),E=$e(v,y.collectionRef);return a.jsx(c,{ref:E,children:w})});d.displayName=l;const f=e+"CollectionItemSlot",p="data-radix-collection-item",m=Pn(f),h=zt.forwardRef((g,v)=>{const{scope:b,children:w,...y}=g,E=zt.useRef(null),T=$e(v,E),_=s(f,b);return zt.useEffect(()=>(_.itemMap.set(E,{ref:E,...y}),()=>void _.itemMap.delete(E))),a.jsx(m,{[p]:"",ref:T,children:w})});h.displayName=f;function x(g){const v=s(e+"CollectionConsumer",g);return zt.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const y=Array.from(w.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((_,I)=>y.indexOf(_.ref.current)-y.indexOf(I.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:h},x,r]}var yw=u.createContext(void 0);function Yi(e){const t=u.useContext(yw);return e||t||"ltr"}const Ki=u.forwardRef(({actions:e,className:t,...n},r)=>{const o=(i,l)=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),l.onClick())},s=(i,l)=>{var d,f,p,m,h;const c=(d=i.currentTarget.parentElement)==null?void 0:d.querySelectorAll('[role="menuitem"]');if(c)switch(i.key){case"ArrowDown":{i.preventDefault();const x=(l+1)%c.length;(f=c[x])==null||f.focus();break}case"ArrowUp":{i.preventDefault();const x=(l-1+c.length)%c.length;(p=c[x])==null||p.focus();break}case"Home":i.preventDefault(),(m=c[0])==null||m.focus();break;case"End":i.preventDefault(),(h=c[c.length-1])==null||h.focus();break;case"Escape":i.preventDefault(),i.currentTarget.blur();break}};return a.jsx("div",{ref:r,role:"menu",className:Ce("min-w-[8rem] overflow-hidden",t),...n,children:e.map((i,l)=>a.jsxs(u.Fragment,{children:[i.divider&&l>0&&a.jsx("div",{className:"my-1 h-px bg-[var(--color-secondary-w40)] dark:bg-[var(--color-secondary-w70)]"}),a.jsxs("div",{role:"menuitem",tabIndex:0,className:Ce("relative flex cursor-pointer items-center gap-2 px-3 py-1.5 my-1.5 text-sm transition-colors select-none","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","hover:bg-[var(--color-primary-w10)] hover:text-[var(--color-primary-text-w60)] dark:hover:bg-[var(--color-primary-w60)] dark:hover:text-[var(--color-primary-text-w10)]"),onClick:i.onClick,onKeyDown:c=>{o(c,i),s(c,l)},children:[i.icon&&i.iconPosition!=="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon}),a.jsx("span",{className:"flex-1",children:i.label}),i.icon&&i.iconPosition==="right"&&a.jsx("span",{className:"flex h-4 w-4 items-center justify-center",children:i.icon})]})]},i.id))})});Ki.displayName="Menu";var ts="Popover",[Qu,o1]=An(ts,[xr]),Yr=xr(),[Sw,Nn]=Qu(ts),ed=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:o,onOpenChange:s,modal:i=!1}=e,l=Yr(t),c=u.useRef(null),[d,f]=u.useState(!1),[p,m]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:ts});return a.jsx(Ii,{...l,children:a.jsx(Sw,{scope:t,contentId:Xt(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:u.useCallback(()=>m(h=>!h),[m]),hasCustomAnchor:d,onCustomAnchorAdd:u.useCallback(()=>f(!0),[]),onCustomAnchorRemove:u.useCallback(()=>f(!1),[]),modal:i,children:n})})};ed.displayName=ts;var td="PopoverAnchor",Cw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(td,n),s=Yr(n),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=o;return u.useEffect(()=>(i(),()=>l()),[i,l]),a.jsx(Fo,{...s,...r,ref:t})});Cw.displayName=td;var nd="PopoverTrigger",rd=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(nd,n),s=Yr(n),i=$e(t,o.triggerRef),l=a.jsx(ke.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ld(o.open),...r,ref:i,onClick:ve(e.onClick,o.onOpenToggle)});return o.hasCustomAnchor?l:a.jsx(Fo,{asChild:!0,...s,children:l})});rd.displayName=nd;var qi="PopoverPortal",[Ew,Tw]=Qu(qi,{forceMount:void 0}),od=e=>{const{__scopePopover:t,forceMount:n,children:r,container:o}=e,s=Nn(qi,t);return a.jsx(Ew,{scope:t,forceMount:n,children:a.jsx(mn,{present:n||s.open,children:a.jsx(Gr,{asChild:!0,container:o,children:r})})})};od.displayName=qi;var lr="PopoverContent",sd=u.forwardRef((e,t)=>{const n=Tw(lr,e.__scopePopover),{forceMount:r=n.forceMount,...o}=e,s=Nn(lr,e.__scopePopover);return a.jsx(mn,{present:r||s.open,children:s.modal?a.jsx(Nw,{...o,ref:t}):a.jsx(kw,{...o,ref:t})})});sd.displayName=lr;var Aw=Pn("PopoverContent.RemoveScroll"),Nw=u.forwardRef((e,t)=>{const n=Nn(lr,e.__scopePopover),r=u.useRef(null),o=$e(t,r),s=u.useRef(!1);return u.useEffect(()=>{const i=r.current;if(i)return zi(i)},[]),a.jsx(Ho,{as:Aw,allowPinchZoom:!0,children:a.jsx(id,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ve(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:ve(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:ve(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),kw=u.forwardRef((e,t)=>{const n=Nn(lr,e.__scopePopover),r=u.useRef(!1),o=u.useRef(!1);return a.jsx(id,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),s.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:s=>{var c,d;(c=e.onInteractOutside)==null||c.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const i=s.target;((d=n.triggerRef.current)==null?void 0:d.contains(i))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&o.current&&s.preventDefault()}})}),id=u.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:f,...p}=e,m=Nn(lr,n),h=Yr(n);return Fi(),a.jsx(Bo,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:s,children:a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:a.jsx(ji,{"data-state":ld(m.open),role:"dialog",id:m.contentId,...h,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ad="PopoverClose",_w=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Nn(ad,n);return a.jsx(ke.button,{type:"button",...r,ref:t,onClick:ve(e.onClick,()=>o.onOpenChange(!1))})});_w.displayName=ad;var Iw="PopoverArrow",jw=u.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,o=Yr(n);return a.jsx(Mi,{...o,...r,ref:t})});jw.displayName=Iw;function ld(e){return e?"open":"closed"}var Mw=ed,Rw=rd,Pw=od,Lw=sd;function cd({...e}){return a.jsx(Mw,{"data-slot":"popover",...e})}function ud({...e}){return a.jsx(Rw,{"data-slot":"popover-trigger",...e})}function dd({className:e,align:t="center",sideOffset:n=4,...r}){return a.jsx(Pw,{children:a.jsx(Lw,{"data-slot":"popover-content",align:t,sideOffset:n,className:Ce("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-auto origin-(--radix-popover-content-transform-origin) bg-background rounded-sm border px-0 py-1 shadow-sm outline-hidden",e),...r})})}function Dw({isOpen:e,onClose:t,anchorRef:n,children:r,placement:o="bottom-start",offset:s,className:i,closeOnClickOutside:l=!0,closeOnEscape:c=!0,portal:d=!0,animationDuration:f=150,fallbackPlacements:p}){const m=u.useRef(null),[h,x]=u.useState({}),[g,v]=u.useState(!1);ow({ref:m,anchorRef:n,onClickOutside:t,enabled:e&&l}),sw({onEscape:t,enabled:e&&c});const{getPositionStyle:b}=lw({anchorRef:n,placement:o,offset:s,fallbackPlacements:p});if(u.useEffect(()=>{e&&m.current?(v(!1),requestAnimationFrame(()=>{if(m.current){const y=b(m.current);x(y),v(!0)}})):v(!1)},[e,b]),!e)return null;const w=a.jsx("div",{ref:m,role:"dialog","aria-modal":"false",className:Ce("bg-background min-w-[8rem] overflow-hidden border shadow-md",i),style:{...h,opacity:e&&g?1:0,transform:`scale(${e&&g?1:.95})`,transition:`opacity ${f}ms ease-in-out, transform ${f}ms ease-in-out`,pointerEvents:e&&g?"auto":"none",visibility:g?"visible":"hidden"},children:r});return d?Ur.createPortal(w,document.body):w}function sl(e,[t,n]){return Math.min(n,Math.max(t,e))}function Ow(e){const t=u.useRef({value:e,previous:e});return u.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Fw=[" ","Enter","ArrowUp","ArrowDown"],zw=[" ","Enter"],zn="Select",[ns,rs,$w]=Ju(zn),[vr,s1]=An(zn,[$w,xr]),os=xr(),[Bw,kn]=vr(zn),[Uw,Hw]=vr(zn),fd=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:x}=e,g=os(t),[v,b]=u.useState(null),[w,y]=u.useState(null),[E,T]=u.useState(!1),_=Yi(d),[I,A]=Dn({prop:r,defaultProp:o??!1,onChange:s,caller:zn}),[q,K]=Dn({prop:i,defaultProp:l,onChange:c,caller:zn}),U=u.useRef(null),Y=v?x||!!v.closest("form"):!0,[J,O]=u.useState(new Set),X=Array.from(J).map(N=>N.props.value).join(";");return a.jsx(Ii,{...g,children:a.jsxs(Bw,{required:h,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:y,valueNodeHasChildren:E,onValueNodeHasChildrenChange:T,contentId:Xt(),value:q,onValueChange:K,open:I,onOpenChange:A,dir:_,triggerPointerDownPosRef:U,disabled:m,children:[a.jsx(ns.Provider,{scope:t,children:a.jsx(Uw,{scope:e.__scopeSelect,onNativeOptionAdd:u.useCallback(N=>{O(R=>new Set(R).add(N))},[]),onNativeOptionRemove:u.useCallback(N=>{O(R=>{const S=new Set(R);return S.delete(N),S})},[]),children:n})}),Y?a.jsxs(Pd,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:q,onChange:N=>K(N.target.value),disabled:m,form:x,children:[q===void 0?a.jsx("option",{value:""}):null,Array.from(J)]},X):null]})})};fd.displayName=zn;var pd="SelectTrigger",md=u.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=os(n),i=kn(pd,n),l=i.disabled||r,c=$e(t,i.onTriggerChange),d=rs(n),f=u.useRef("touch"),[p,m,h]=Dd(g=>{const v=d().filter(y=>!y.disabled),b=v.find(y=>y.value===i.value),w=Od(v,g,b);w!==void 0&&i.onValueChange(w.value)}),x=g=>{l||(i.onOpenChange(!0),h()),g&&(i.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return a.jsx(Fo,{asChild:!0,...s,children:a.jsx(ke.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Ld(i.value)?"":void 0,...o,ref:c,onClick:ve(o.onClick,g=>{g.currentTarget.focus(),f.current!=="mouse"&&x(g)}),onPointerDown:ve(o.onPointerDown,g=>{f.current=g.pointerType;const v=g.target;v.hasPointerCapture(g.pointerId)&&v.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(x(g),g.preventDefault())}),onKeyDown:ve(o.onKeyDown,g=>{const v=p.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(v&&g.key===" ")&&Fw.includes(g.key)&&(x(),g.preventDefault())})})})});md.displayName=pd;var hd="SelectValue",gd=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...l}=e,c=kn(hd,n),{onValueNodeHasChildrenChange:d}=c,f=s!==void 0,p=$e(t,c.onValueNodeChange);return nt(()=>{d(f)},[d,f]),a.jsx(ke.span,{...l,ref:p,style:{pointerEvents:"none"},children:Ld(c.value)?a.jsx(a.Fragment,{children:i}):s})});gd.displayName=hd;var Ww="SelectIcon",xd=u.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return a.jsx(ke.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});xd.displayName=Ww;var Gw="SelectPortal",vd=e=>a.jsx(Gr,{asChild:!0,...e});vd.displayName=Gw;var $n="SelectContent",wd=u.forwardRef((e,t)=>{const n=kn($n,e.__scopeSelect),[r,o]=u.useState();if(nt(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?Ur.createPortal(a.jsx(bd,{scope:e.__scopeSelect,children:a.jsx(ns.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(yd,{...e,ref:t})});wd.displayName=$n;var Ot=10,[bd,_n]=vr($n),Vw="SelectContentImpl",Yw=Pn("SelectContent.RemoveScroll"),yd=u.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:v,...b}=e,w=kn($n,n),[y,E]=u.useState(null),[T,_]=u.useState(null),I=$e(t,k=>E(k)),[A,q]=u.useState(null),[K,U]=u.useState(null),Y=rs(n),[J,O]=u.useState(!1),X=u.useRef(!1);u.useEffect(()=>{if(y)return zi(y)},[y]),Fi();const N=u.useCallback(k=>{const[V,...Q]=Y().map(se=>se.ref.current),[te]=Q.slice(-1),oe=document.activeElement;for(const se of k)if(se===oe||(se==null||se.scrollIntoView({block:"nearest"}),se===V&&T&&(T.scrollTop=0),se===te&&T&&(T.scrollTop=T.scrollHeight),se==null||se.focus(),document.activeElement!==oe))return},[Y,T]),R=u.useCallback(()=>N([A,y]),[N,A,y]);u.useEffect(()=>{J&&R()},[J,R]);const{onOpenChange:S,triggerPointerDownPosRef:F}=w;u.useEffect(()=>{if(y){let k={x:0,y:0};const V=te=>{var oe,se;k={x:Math.abs(Math.round(te.pageX)-(((oe=F.current)==null?void 0:oe.x)??0)),y:Math.abs(Math.round(te.pageY)-(((se=F.current)==null?void 0:se.y)??0))}},Q=te=>{k.x<=10&&k.y<=10?te.preventDefault():y.contains(te.target)||S(!1),document.removeEventListener("pointermove",V),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",V),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",V),document.removeEventListener("pointerup",Q,{capture:!0})}}},[y,S,F]),u.useEffect(()=>{const k=()=>S(!1);return window.addEventListener("blur",k),window.addEventListener("resize",k),()=>{window.removeEventListener("blur",k),window.removeEventListener("resize",k)}},[S]);const[M,P]=Dd(k=>{const V=Y().filter(oe=>!oe.disabled),Q=V.find(oe=>oe.ref.current===document.activeElement),te=Od(V,k,Q);te&&setTimeout(()=>te.ref.current.focus())}),ee=u.useCallback((k,V,Q)=>{const te=!X.current&&!Q;(w.value!==void 0&&w.value===V||te)&&(q(k),te&&(X.current=!0))},[w.value]),D=u.useCallback(()=>y==null?void 0:y.focus(),[y]),$=u.useCallback((k,V,Q)=>{const te=!X.current&&!Q;(w.value!==void 0&&w.value===V||te)&&U(k)},[w.value]),L=r==="popper"?Ks:Sd,G=L===Ks?{side:l,sideOffset:c,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:x,hideWhenDetached:g,avoidCollisions:v}:{};return a.jsx(bd,{scope:n,content:y,viewport:T,onViewportChange:_,itemRefCallback:ee,selectedItem:A,onItemLeave:D,itemTextRefCallback:$,focusSelectedItem:R,selectedItemText:K,position:r,isPositioned:J,searchRef:M,children:a.jsx(Ho,{as:Yw,allowPinchZoom:!0,children:a.jsx(Bo,{asChild:!0,trapped:w.open,onMountAutoFocus:k=>{k.preventDefault()},onUnmountAutoFocus:ve(o,k=>{var V;(V=w.trigger)==null||V.focus({preventScroll:!0}),k.preventDefault()}),children:a.jsx(Hr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:k=>k.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:a.jsx(L,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:k=>k.preventDefault(),...b,...G,onPlaced:()=>O(!0),ref:I,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ve(b.onKeyDown,k=>{const V=k.ctrlKey||k.altKey||k.metaKey;if(k.key==="Tab"&&k.preventDefault(),!V&&k.key.length===1&&P(k.key),["ArrowUp","ArrowDown","Home","End"].includes(k.key)){let te=Y().filter(oe=>!oe.disabled).map(oe=>oe.ref.current);if(["ArrowUp","End"].includes(k.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(k.key)){const oe=k.target,se=te.indexOf(oe);te=te.slice(se+1)}setTimeout(()=>N(te)),k.preventDefault()}})})})})})})});yd.displayName=Vw;var Kw="SelectItemAlignedPosition",Sd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=kn($n,n),i=_n($n,n),[l,c]=u.useState(null),[d,f]=u.useState(null),p=$e(t,I=>f(I)),m=rs(n),h=u.useRef(!1),x=u.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,y=u.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&g&&v&&b){const I=s.trigger.getBoundingClientRect(),A=d.getBoundingClientRect(),q=s.valueNode.getBoundingClientRect(),K=b.getBoundingClientRect();if(s.dir!=="rtl"){const oe=K.left-A.left,se=q.left-oe,de=I.left-se,me=I.width+de,Me=Math.max(me,A.width),Oe=window.innerWidth-Ot,Le=sl(se,[Ot,Math.max(Ot,Oe-Me)]);l.style.minWidth=me+"px",l.style.left=Le+"px"}else{const oe=A.right-K.right,se=window.innerWidth-q.right-oe,de=window.innerWidth-I.right-se,me=I.width+de,Me=Math.max(me,A.width),Oe=window.innerWidth-Ot,Le=sl(se,[Ot,Math.max(Ot,Oe-Me)]);l.style.minWidth=me+"px",l.style.right=Le+"px"}const U=m(),Y=window.innerHeight-Ot*2,J=g.scrollHeight,O=window.getComputedStyle(d),X=parseInt(O.borderTopWidth,10),N=parseInt(O.paddingTop,10),R=parseInt(O.borderBottomWidth,10),S=parseInt(O.paddingBottom,10),F=X+N+J+S+R,M=Math.min(v.offsetHeight*5,F),P=window.getComputedStyle(g),ee=parseInt(P.paddingTop,10),D=parseInt(P.paddingBottom,10),$=I.top+I.height/2-Ot,L=Y-$,G=v.offsetHeight/2,k=v.offsetTop+G,V=X+N+k,Q=F-V;if(V<=$){const oe=U.length>0&&v===U[U.length-1].ref.current;l.style.bottom="0px";const se=d.clientHeight-g.offsetTop-g.offsetHeight,de=Math.max(L,G+(oe?D:0)+se+R),me=V+de;l.style.height=me+"px"}else{const oe=U.length>0&&v===U[0].ref.current;l.style.top="0px";const de=Math.max($,X+g.offsetTop+(oe?ee:0)+G)+Q;l.style.height=de+"px",g.scrollTop=V-$+g.offsetTop}l.style.margin=`${Ot}px 0`,l.style.minHeight=M+"px",l.style.maxHeight=Y+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,d,g,v,b,s.dir,r]);nt(()=>y(),[y]);const[E,T]=u.useState();nt(()=>{d&&T(window.getComputedStyle(d).zIndex)},[d]);const _=u.useCallback(I=>{I&&x.current===!0&&(y(),w==null||w(),x.current=!1)},[y,w]);return a.jsx(Xw,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:_,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:a.jsx(ke.div,{...o,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Sd.displayName=Kw;var qw="SelectPopperPosition",Ks=u.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Ot,...s}=e,i=os(n);return a.jsx(ji,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ks.displayName=qw;var[Xw,Xi]=vr($n,{}),qs="SelectViewport",Cd=u.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=_n(qs,n),i=Xi(qs,n),l=$e(t,s.onViewportChange),c=u.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(ns.Slot,{scope:n,children:a.jsx(ke.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ve(o.onScroll,d=>{const f=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const h=Math.abs(c.current-f.scrollTop);if(h>0){const x=window.innerHeight-Ot*2,g=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(g,v);if(b<x){const w=b+h,y=Math.min(x,w),E=w-y;p.style.height=y+"px",p.style.bottom==="0px"&&(f.scrollTop=E>0?E:0,p.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Cd.displayName=qs;var Ed="SelectGroup",[Zw,Jw]=vr(Ed),Qw=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Xt();return a.jsx(Zw,{scope:n,id:o,children:a.jsx(ke.div,{role:"group","aria-labelledby":o,...r,ref:t})})});Qw.displayName=Ed;var Td="SelectLabel",e0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Jw(Td,n);return a.jsx(ke.div,{id:o.id,...r,ref:t})});e0.displayName=Td;var Ao="SelectItem",[t0,Ad]=vr(Ao),Nd=u.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,l=kn(Ao,n),c=_n(Ao,n),d=l.value===r,[f,p]=u.useState(s??""),[m,h]=u.useState(!1),x=$e(t,w=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,w,r,o)}),g=Xt(),v=u.useRef("touch"),b=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(t0,{scope:n,value:r,disabled:o,textId:g,isSelected:d,onItemTextChange:u.useCallback(w=>{p(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:a.jsx(ns.ItemSlot,{scope:n,value:r,disabled:o,textValue:f,children:a.jsx(ke.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:x,onFocus:ve(i.onFocus,()=>h(!0)),onBlur:ve(i.onBlur,()=>h(!1)),onClick:ve(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:ve(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:ve(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:ve(i.onPointerMove,w=>{var y;v.current=w.pointerType,o?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ve(i.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:ve(i.onKeyDown,w=>{var E;((E=c.searchRef)==null?void 0:E.current)!==""&&w.key===" "||(zw.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Nd.displayName=Ao;var jr="SelectItemText",kd=u.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=kn(jr,n),l=_n(jr,n),c=Ad(jr,n),d=Hw(jr,n),[f,p]=u.useState(null),m=$e(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),h=f==null?void 0:f.textContent,x=u.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=d;return nt(()=>(g(x),()=>v(x)),[g,v,x]),a.jsxs(a.Fragment,{children:[a.jsx(ke.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?Ur.createPortal(s.children,i.valueNode):null]})});kd.displayName=jr;var _d="SelectItemIndicator",Id=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Ad(_d,n).isSelected?a.jsx(ke.span,{"aria-hidden":!0,...r,ref:t}):null});Id.displayName=_d;var Xs="SelectScrollUpButton",jd=u.forwardRef((e,t)=>{const n=_n(Xs,e.__scopeSelect),r=Xi(Xs,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return nt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});jd.displayName=Xs;var Zs="SelectScrollDownButton",Md=u.forwardRef((e,t)=>{const n=_n(Zs,e.__scopeSelect),r=Xi(Zs,e.__scopeSelect),[o,s]=u.useState(!1),i=$e(t,r.onScrollButtonChange);return nt(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;s(f)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?a.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Md.displayName=Zs;var Rd=u.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=_n("SelectScrollButton",n),i=u.useRef(null),l=rs(n),c=u.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return u.useEffect(()=>()=>c(),[c]),nt(()=>{var f;const d=l().find(p=>p.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[l]),a.jsx(ke.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ve(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ve(o.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ve(o.onPointerLeave,()=>{c()})})}),n0="SelectSeparator",r0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(ke.div,{"aria-hidden":!0,...r,ref:t})});r0.displayName=n0;var Js="SelectArrow",o0=u.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=os(n),s=kn(Js,n),i=_n(Js,n);return s.open&&i.position==="popper"?a.jsx(Mi,{...o,...r,ref:t}):null});o0.displayName=Js;var s0="SelectBubbleInput",Pd=u.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const o=u.useRef(null),s=$e(r,o),i=Ow(t);return u.useEffect(()=>{const l=o.current;if(!l)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&f){const p=new Event("change",{bubbles:!0});f.call(l,t),l.dispatchEvent(p)}},[i,t]),a.jsx(ke.select,{...n,style:{...Dc,...n.style},ref:s,defaultValue:t})});Pd.displayName=s0;function Ld(e){return e===""||e===void 0}function Dd(e){const t=yn(e),n=u.useRef(""),r=u.useRef(0),o=u.useCallback(i=>{const l=n.current+i;t(l),(function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))})(l)},[t]),s=u.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return u.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Od(e,t,n){const o=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=i0(e,Math.max(s,0));o.length===1&&(i=i.filter(d=>d!==n));const c=i.find(d=>d.textValue.toLowerCase().startsWith(o.toLowerCase()));return c!==n?c:void 0}function i0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a0=fd,l0=md,c0=gd,u0=xd,d0=vd,f0=wd,p0=Cd,m0=Nd,h0=kd,g0=Id,x0=jd,v0=Md;function Fd({...e}){return a.jsx(a0,{"data-slot":"select",...e})}function zd({...e}){return a.jsx(c0,{"data-slot":"select-value",...e})}function $d({className:e,size:t="default",children:n,...r}){return a.jsxs(l0,{"data-slot":"select-trigger","data-size":t,className:Ce("flex w-fit items-center justify-between gap-2 border px-3 py-2 text-sm whitespace-nowrap shadow-xs disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,a.jsx(u0,{asChild:!0,children:a.jsx($l,{className:"size-4 opacity-50"})})]})}function Bd({className:e,children:t,position:n="popper",...r}){return a.jsx(d0,{children:a.jsxs(f0,{"data-slot":"select-content",className:Ce("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 bg-background relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[a.jsx(w0,{}),a.jsx(p0,{className:Ce("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),a.jsx(b0,{})]})})}function Ud({className:e,children:t,...n}){return a.jsxs(m0,{"data-slot":"select-item",className:Ce("[&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 hover:bg-[var(--color-primary-w10)] hover:text-[var(--color-primary-text-w60)] dark:hover:bg-[var(--color-primary-w60)] dark:hover:text-[var(--color-primary-text-w10)]",e),...n,children:[a.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:a.jsx(g0,{children:a.jsx(mi,{className:"size-4"})})}),a.jsx(h0,{children:t})]})}function w0({className:e,...t}){return a.jsx(x0,{"data-slot":"select-scroll-up-button",className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(jp,{className:"size-4"})})}function b0({className:e,...t}){return a.jsx(v0,{"data-slot":"select-scroll-down-button",className:Ce("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx($l,{className:"size-4"})})}var Ns="rovingFocusGroup.onEntryFocus",y0={bubbles:!1,cancelable:!0},Kr="RovingFocusGroup",[Qs,Hd,S0]=Ju(Kr),[C0,Wd]=An(Kr,[S0]),[E0,T0]=C0(Kr),Gd=u.forwardRef((e,t)=>a.jsx(Qs.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Qs.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(A0,{...e,ref:t})})}));Gd.displayName=Kr;var A0=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...p}=e,m=u.useRef(null),h=$e(t,m),x=Yi(s),[g,v]=Dn({prop:i,defaultProp:l??null,onChange:c,caller:Kr}),[b,w]=u.useState(!1),y=yn(d),E=Hd(n),T=u.useRef(!1),[_,I]=u.useState(0);return u.useEffect(()=>{const A=m.current;if(A)return A.addEventListener(Ns,y),()=>A.removeEventListener(Ns,y)},[y]),a.jsx(E0,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:g,onItemFocus:u.useCallback(A=>v(A),[v]),onItemShiftTab:u.useCallback(()=>w(!0),[]),onFocusableItemAdd:u.useCallback(()=>I(A=>A+1),[]),onFocusableItemRemove:u.useCallback(()=>I(A=>A-1),[]),children:a.jsx(ke.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...p,ref:h,style:{outline:"none",...e.style},onMouseDown:ve(e.onMouseDown,()=>{T.current=!0}),onFocus:ve(e.onFocus,A=>{const q=!T.current;if(A.target===A.currentTarget&&q&&!b){const K=new CustomEvent(Ns,y0);if(A.currentTarget.dispatchEvent(K),!K.defaultPrevented){const U=E().filter(N=>N.focusable),Y=U.find(N=>N.active),J=U.find(N=>N.id===g),X=[Y,J,...U].filter(Boolean).map(N=>N.ref.current);Kd(X,f)}}T.current=!1}),onBlur:ve(e.onBlur,()=>w(!1))})})}),Vd="RovingFocusGroupItem",Yd=u.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,children:i,...l}=e,c=Xt(),d=s||c,f=T0(Vd,n),p=f.currentTabStopId===d,m=Hd(n),{onFocusableItemAdd:h,onFocusableItemRemove:x,currentTabStopId:g}=f;return u.useEffect(()=>{if(r)return h(),()=>x()},[r,h,x]),a.jsx(Qs.ItemSlot,{scope:n,id:d,focusable:r,active:o,children:a.jsx(ke.span,{tabIndex:p?0:-1,"data-orientation":f.orientation,...l,ref:t,onMouseDown:ve(e.onMouseDown,v=>{r?f.onItemFocus(d):v.preventDefault()}),onFocus:ve(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:ve(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=_0(v,f.orientation,f.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let y=m().filter(E=>E.focusable).map(E=>E.ref.current);if(b==="last")y.reverse();else if(b==="prev"||b==="next"){b==="prev"&&y.reverse();const E=y.indexOf(v.currentTarget);y=f.loop?I0(y,E+1):y.slice(E+1)}setTimeout(()=>Kd(y))}}),children:typeof i=="function"?i({isCurrentTabStop:p,hasTabStop:g!=null}):i})})});Yd.displayName=Vd;var N0={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function k0(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _0(e,t,n){const r=k0(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return N0[r]}function Kd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function I0(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var j0=Gd,M0=Yd,ss="Tabs",[R0,i1]=An(ss,[Wd]),qd=Wd(),[P0,Zi]=R0(ss),Xd=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:l,activationMode:c="automatic",...d}=e,f=Yi(l),[p,m]=Dn({prop:r,onChange:o,defaultProp:s??"",caller:ss});return a.jsx(P0,{scope:n,baseId:Xt(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:c,children:a.jsx(ke.div,{dir:f,"data-orientation":i,...d,ref:t})})});Xd.displayName=ss;var Zd="TabsList",Jd=u.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Zi(Zd,n),i=qd(n);return a.jsx(j0,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:a.jsx(ke.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});Jd.displayName=Zd;var Qd="TabsTrigger",ef=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Zi(Qd,n),l=qd(n),c=rf(i.baseId,r),d=of(i.baseId,r),f=r===i.value;return a.jsx(M0,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(ke.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...s,ref:t,onMouseDown:ve(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:ve(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:ve(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});ef.displayName=Qd;var tf="TabsContent",nf=u.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,l=Zi(tf,n),c=rf(l.baseId,r),d=of(l.baseId,r),f=r===l.value,p=u.useRef(f);return u.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(mn,{present:o||f,children:({present:m})=>a.jsx(ke.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});nf.displayName=tf;function rf(e,t){return`${e}-trigger-${t}`}function of(e,t){return`${e}-content-${t}`}var L0=Xd,D0=Jd,O0=ef,F0=nf;function z0({className:e,...t}){return a.jsx(L0,{"data-slot":"tabs",className:Ce("flex flex-col gap-2",e),...t})}function $0({className:e,...t}){return a.jsx(D0,{"data-slot":"tabs-list",className:Ce("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",e),...t})}function il({className:e,...t}){return a.jsx(O0,{"data-slot":"tabs-trigger","data-testid":t.value,"aria-label":t.value,title:t.title,className:Ce("data-[state=active]:bg-background dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow,background-color] hover:bg-[var(--color-brand-w10)] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:text-[var(--color-brand-wMain)] data-[state=active]:shadow-sm dark:hover:bg-[var(--color-brand-wMain30)] dark:data-[state=active]:text-[var(--color-brand-wMain)] [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}function al({className:e,...t}){return a.jsx(F0,{"data-slot":"tabs-content",className:Ce("flex-1 outline-none",e),...t})}const sf=u.forwardRef(({className:e,...t},n)=>a.jsx(qc,{autoComplete:"off",ref:n,name:"message","data-testid":"chat-input",className:Ce("flex w-full items-center rounded-md px-4 py-3 placeholder:text-[var(--color-secondary-wMain)] disabled:cursor-not-allowed disabled:opacity-50",e),...t}));sf.displayName="ChatInput";const B0=Tn("flex gap-2 max-w-[90%] items-end relative group",{variants:{variant:{received:"self-start",sent:"self-end flex-row-reverse"},layout:{default:"",ai:"max-w-full w-full items-center"}},defaultVariants:{variant:"received",layout:"default"}}),af=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:Ce(B0({variant:t,layout:n,className:e}),"group relative"),ref:s,...o,children:u.Children.map(r,i=>u.isValidElement(i)&&typeof i.type!="string"?u.cloneElement(i,{variant:t,layout:n}):i)}));af.displayName="ChatBubble";const U0=Tn("p-4",{variants:{variant:{received:"rounded-r-lg rounded-tl-lg",sent:"rounded-l-lg rounded-tr-lg justify-end bg-[var(--message-background)]"},layout:{default:"",ai:"border-t w-full rounded-none bg-transparent"}},defaultVariants:{variant:"received",layout:"default"}}),lf=u.forwardRef(({className:e,variant:t,layout:n,children:r,...o},s)=>a.jsx("div",{className:Ce(U0({variant:t,layout:n,className:e}),"relative max-w-full break-words whitespace-pre-wrap"),ref:s,...o,children:a.jsx(a.Fragment,{children:r})}));lf.displayName="ChatBubbleMessage";const H0=u.forwardRef(({variant:e,className:t,children:n,...r},o)=>a.jsx("div",{ref:o,className:Ce("absolute top-1/2 flex -translate-y-1/2 opacity-0 transition-opacity duration-200 group-hover:opacity-100",e==="sent"?"-left-1 -translate-x-full flex-row-reverse":"-right-1 translate-x-full",t),...r,children:n}));H0.displayName="ChatBubbleActionWrapper";const cf={padding:"0 16px",maxWidth:"1280px",minWidth:"400px",margin:"0 auto",width:"100%"},uf=zt.forwardRef(({className:e="",children:t,...n},r)=>{const{scrollRef:o,isAtBottom:s,disableAutoScroll:i,scrollToBottom:l,userHasScrolled:c}=eb({smooth:!0,content:t});return u.useImperativeHandle(r,()=>({scrollToBottom:l})),a.jsxs("div",{className:`fade-both-mask min-h-0 flex-1 py-3 relative h-full w-full ${e}`,children:[a.jsx("div",{className:"flex h-full w-full flex-col overflow-y-auto p-4",ref:o,onWheel:i,onTouchMove:i,...n,style:{scrollBehavior:"smooth"},children:a.jsx("div",{className:"flex flex-col gap-6",style:cf,children:t})}),!s&&c&&a.jsx(Ae,{onClick:()=>{l()},size:"icon",variant:"outline",className:"absolute bottom-2 left-1/2 z-20 inline-flex -translate-x-1/2 transform rounded-full shadow-md bg-background","aria-label":"Scroll to bottom",children:a.jsx(Bl,{className:"h-4 w-4"})})]})});uf.displayName="ChatMessageList";const W0=Tn("flex-col items-center justify-center",{variants:{show:{true:"flex",false:"hidden"}},defaultVariants:{show:!0}}),G0=Tn("animate-spin",{variants:{size:{small:"size-4",medium:"size-8",large:"size-12"},variant:{primary:"text-[var(--color-brand-wMain)]",secondary:"text-[var(--color-primary-wMain)]",muted:"text-[var(--color-secondary-text-wMain)] dark:text-[var(--color-secondary-text-w50)]",foreground:"text-foreground"}},defaultVariants:{size:"medium",variant:"primary"}});function V0({size:e,show:t,children:n,className:r,variant:o}){return a.jsxs("span",{className:W0({show:t}),children:[a.jsx(hi,{className:Ce(G0({size:e,variant:o}),r)}),n]})}function Y0({className:e=""}){return a.jsx(V0,{size:"small",variant:"primary",className:e})}const io={error:"bg-[var(--color-error-w10)] text-[var(--color-error-wMain)] border-[var(--color-error-wMain)] dark:bg-[var(--color-error-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-error-w10)]",warning:"bg-[var(--color-warning-w10)] text-[var(--color-warning-wMain)] border-[var(--color-warning-wMain)] dark:bg-[var(--color-warning-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-warning-w10)]",info:"bg-[var(--color-info-w10)] text-[var(--color-info-wMain)] border-[var(--color-info-w10)] dark:bg-[var(--color-info-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-info-w10)]",success:"bg-[var(--color-success-w10)] text-[var(--color-success-wMain)] border-[var(--color-success-w10)] dark:bg-[var(--color-success-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-success-wMain)]"},K0=Tn("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent [a&]:hover:bg-primary/90",secondary:"border-transparent [a&]:hover:bg-secondary/90",destructive:"border-transparent [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"},type:{error:io.error,warning:io.warning,info:io.info,success:io.success}},defaultVariants:{variant:"default"}});function df({className:e,variant:t,type:n,asChild:r=!1,...o}){const s=r?Ql:"span";return a.jsx(s,{"data-slot":"badge",className:Ce(K0({variant:t,type:n}),e),...o})}const q0=Tn("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function X0({className:e,variant:t,...n}){return a.jsx("div",{"data-slot":"alert",role:"alert",className:Ce(q0({variant:t}),e),...n})}function Z0({className:e,...t}){return a.jsx("div",{"data-slot":"alert-title",className:Ce("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...t})}function J0({message:e,type:t}){return a.jsx("div",{className:"transform transition-all duration-200 ease-in-out",children:a.jsx(X0,{className:"border-border bg-accent max-w-80 rounded-sm shadow-md",children:a.jsxs(Z0,{className:"flex items-center text-sm",children:[t==="error"&&a.jsx(gi,{className:"mr-2 text-[var(--color-error-wMain)]"}),a.jsx("div",{className:"truncate",children:e})]})})})}function Q0(){const{notifications:e}=Ue();return e.length===0?null:a.jsx("div",{className:"pointer-events-none fixed bottom-4 left-1/2 z-50 flex -translate-x-1/2 transform flex-col-reverse gap-2",children:e.map(t=>a.jsx("div",{className:"pointer-events-auto",children:a.jsx(J0,{id:t.id,message:t.message,type:t.type,duration:t.type==="error"?5e3:3e3})},t.id))})}function eb(e={}){const{offset:t=20,smooth:n=!1,content:r,autoScrollOnNewContent:o=!1}=e,s=u.useRef(null),i=u.useRef(0),l=u.useRef(!1),[c,d]=u.useState({isAtBottom:!0,autoScrollEnabled:!0}),f=u.useCallback(x=>{const{scrollTop:g,scrollHeight:v,clientHeight:b}=x;return Math.abs(v-g-b)<=t},[t]),p=u.useCallback(x=>{if(!s.current)return;const g=s.current.scrollHeight-s.current.clientHeight;x?s.current.scrollTop=g:s.current.scrollTo({top:g,behavior:n?"smooth":"auto"}),d({isAtBottom:!0,autoScrollEnabled:!0}),l.current=!1},[n]),m=u.useCallback(()=>{if(!s.current)return;const x=f(s.current);d(g=>({isAtBottom:x,autoScrollEnabled:x?!0:g.autoScrollEnabled}))},[f]);u.useEffect(()=>{const x=s.current;if(x)return x.addEventListener("scroll",m,{passive:!0}),()=>x.removeEventListener("scroll",m)},[m]),u.useEffect(()=>{const x=s.current;if(!x)return;const g=x.scrollHeight;g!==i.current&&((c.autoScrollEnabled||o)&&requestAnimationFrame(()=>{p(i.current===0)}),i.current=g)},[r,c.autoScrollEnabled,p,o]),u.useEffect(()=>{const x=s.current;if(!x)return;const g=new ResizeObserver(()=>{c.autoScrollEnabled&&p(!0)});return g.observe(x),()=>g.disconnect()},[c.autoScrollEnabled,p]);const h=u.useCallback(()=>{(s.current?f(s.current):!1)||(l.current=!0,d(g=>({...g,autoScrollEnabled:!1})))},[f]);return{scrollRef:s,isAtBottom:c.isAtBottom,autoScrollEnabled:c.autoScrollEnabled,scrollToBottom:()=>p(),disableAutoScroll:h,userHasScrolled:l.current}}const tb=({fileName:e,onRemove:t})=>a.jsxs(df,{className:"max-w-50 gap-1.5 rounded-full bg-muted pr-1",children:[a.jsx("span",{className:"min-w-0 flex-1 truncate text-xs md:text-sm",title:e,children:e}),t&&a.jsx(Ae,{variant:"ghost",size:"icon",onClick:t,className:"h-2 min-h-0 w-2 min-w-0 p-2",title:"Remove file",children:a.jsx(Ro,{})})]}),nb=({agents:e=[],scrollToBottom:t})=>{const{isResponding:n,isCancelling:r,userInput:o,selectedAgentName:s,setSelectedAgentName:i,setUserInput:l,handleSubmit:c,handleCancel:d}=Ue(),f=u.useRef(null),[p,m]=u.useState([]),h=u.useRef(null),x=u.useRef(n),[g,v]=u.useState(o),b=vw(g,300);u.useEffect(()=>{l(b)},[b,l]),u.useEffect(()=>{v(o)},[o]),u.useEffect(()=>{x.current&&!n&&setTimeout(()=>{var O;(O=h.current)==null||O.focus()},100),x.current=n},[n]);const w=()=>{var O;n||(O=f.current)==null||O.click()},y=O=>{const X=O.target.files;if(X){const N=Array.from(X).filter(R=>!p.some(S=>S.name===R.name&&S.size===R.size&&S.lastModified===R.lastModified));N.length>0&&m(R=>[...R,...N])}O.target&&(O.target.value=""),setTimeout(()=>{var N;(N=h.current)==null||N.focus()},100)},E=O=>{if(n)return;const X=O.clipboardData;if(!X||!X.files||X.files.length===0)return;X.files.length>0&&O.preventDefault();const N=Array.from(X.files).filter(R=>!p.some(S=>S.name===R.name&&S.size===R.size&&S.lastModified===R.lastModified));N.length>0&&m(R=>[...R,...N])},T=O=>{m(X=>X.filter((N,R)=>R!==O))},_=u.useMemo(()=>!n&&((g==null?void 0:g.trim())||p.length!==0),[n,g,p]),I=async O=>{O.preventDefault(),_&&(await c(O,p,g.trim()),m([]),v(""),t==null||t())},A=O=>{if(n)return;const X=O.filter(N=>!p.some(R=>R.name===N.name&&R.size===N.size&&R.lastModified===N.lastModified));X.length>0&&m(N=>[...N,...X])},{isDragging:q,handleDragEnter:K,handleDragOver:U,handleDragLeave:Y,handleDrop:J}=bw({onFilesDropped:A,disabled:n});return a.jsxs("div",{className:`rounded-lg border p-4 shadow-sm ${q?"border-dotted border-[var(--primary-wMain)] bg-[var(--accent-background)]":""}`,onDragEnter:K,onDragOver:U,onDragLeave:Y,onDrop:J,children:[a.jsx("input",{type:"file",ref:f,className:"hidden",multiple:!0,onChange:y,accept:"*/*",disabled:n}),p.length>0&&a.jsx("div",{className:"mb-2 flex flex-wrap gap-2",children:p.map((O,X)=>a.jsx(tb,{fileName:O.name,onRemove:()=>T(X)},`${O.name}-${O.lastModified}-${X}`))}),a.jsx(sf,{ref:h,value:g,onChange:O=>v(O.target.value),placeholder:"How can I help you today?",className:"text-base/normal min-h-0 max-h-50 resize-none border-none p-3 shadow-none rounded-2xl focus-visible:outline-none field-sizing-content transition-[height] duration-500 ease-in-out",rows:1,onPaste:E,onKeyDown:O=>{O.key==="Enter"&&!O.shiftKey&&_&&I(O)}}),a.jsxs("div",{className:"flex items-center gap-2 m-2",children:[a.jsx(Ae,{variant:"ghost",onClick:w,disabled:n,tooltip:"Attach file",children:a.jsx(Ul,{className:"size-4"})}),a.jsx("div",{children:"Agent: "}),a.jsxs(Fd,{value:s,onValueChange:i,disabled:n||e.length===0,children:[a.jsx($d,{className:"w-[250px]",children:a.jsx(zd,{defaultValue:s})}),a.jsx(Bd,{children:e.map(O=>a.jsx(Ud,{value:O.name,children:O.displayName||O.name},O.name))})]}),n&&!r?a.jsxs(Ae,{className:"ml-auto gap-1.5",onClick:d,variant:"outline",disabled:r,tooltip:"Cancel",children:[a.jsx(Mp,{className:"size-4"}),"Stop"]}):a.jsx(Ae,{variant:"ghost",className:"ml-auto gap-1.5",onClick:I,disabled:!_,tooltip:"Send message",children:a.jsx(Rp,{className:"size-4"})})]})]})};function rb(e,t){return t&&t.toLowerCase().startsWith("text/")?!0:e?e.toLowerCase().endsWith(".txt")||e.toLowerCase().endsWith(".text"):!1}function ob(e,t){if(t){const n=t.toLowerCase();if(n==="text/html"||n==="application/xhtml+xml")return!0}return e?e.toLowerCase().endsWith(".html")||e.toLowerCase().endsWith(".htm"):!1}function sb(e,t){if(t){const n=t.toLowerCase();if(n==="text/x-mermaid"||n==="application/x-mermaid")return!0}return e?e.toLowerCase().endsWith(".mermaid")||e.toLowerCase().endsWith(".mmd"):!1}function ib(e,t){if(t){const n=t.toLowerCase();if(n==="text/csv"||n==="application/csv")return!0}return e?e.toLowerCase().endsWith(".csv"):!1}function ab(e,t){if(t&&t.toLowerCase().startsWith("image/"))return!0;if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".png")||n.endsWith(".jpg")||n.endsWith(".jpeg")||n.endsWith(".gif")||n.endsWith(".bmp")||n.endsWith(".webp")||n.endsWith(".svg")}function lb(e,t){if(t){const n=t.toLowerCase();if(n==="application/json"||n==="text/json")return!0}return e?e.toLowerCase().endsWith(".json"):!1}function cb(e,t){if(t){const r=t.toLowerCase();if(r==="application/yaml"||r==="text/yaml"||r==="application/x-yaml"||r==="text/x-yaml")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".yaml")||n.endsWith(".yml")}function ub(e,t){if(t){const r=t.toLowerCase();if(r==="text/markdown"||r==="application/markdown"||r==="text/x-markdown")return!0}if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".md")||n.endsWith(".markdown")}function db(e,t){if(t&&t.toLowerCase().startsWith("audio/"))return!0;if(!e)return!1;const n=e.toLowerCase();return n.endsWith(".mp3")||n.endsWith(".wav")||n.endsWith(".ogg")||n.endsWith(".aac")||n.endsWith(".flac")||n.endsWith(".m4a")}function qr(e,t){return ob(e,t)?"html":sb(e,t)?"mermaid":ab(e,t)?"image":ub(e,t)?"markdown":db(e,t)?"audio":lb(e,t)?"json":cb(e,t)?"yaml":ib(e,t)?"csv":rb(e,t)?"text":null}function ff(e){try{const t=Uint8Array.from(atob(e),n=>n.charCodeAt(0));return new TextDecoder("utf-8",{fatal:!1}).decode(t)}catch(t){console.warn("TextDecoder failed (potentially non-UTF8 data), falling back to simple atob:",t);try{return atob(e)}catch(n){return console.error("Failed to decode base64 content with atob fallback:",n),e}}}const pf=["csv","html","json","mermaid","image","markdown","audio","text","yaml"],fb=["image","audio"],pb=e=>{if(!e||!e.content)return"";const t=qr(e.name,e.mime_type);if(!t||!pf.includes(t))return"";if(fb.includes(t))return e.content;try{return ff(e.content)}catch(n){return console.error("Failed to decode base64 content:",n),""}},mf=5*1024*1024,mb=fc(mf);function hb(e){if(!e||!e.size)return{canPreview:!1,reason:"No artifact or content available."};const t=qr(e.filename,e.mime_type);return!t||!pf.includes(t)?{canPreview:!1,reason:"Preview not yet supported for this file type."}:e.size>mf?{canPreview:!1,reason:`Preview not supported for files this large. Maximum size is: ${mb}.`}:{canPreview:!0}}const hf=(e,t="h-4 w-4")=>{if(!e)return a.jsx(da,{className:t});switch(qr(e.filename,e.mime_type)){case"image":case"mermaid":return a.jsx(Fp,{className:t});case"audio":return a.jsx(Op,{className:t});case"html":return a.jsx(Dp,{className:t});case"text":return a.jsx(sr,{className:t});case"csv":return a.jsx(Lp,{className:t});case"json":return a.jsx(Pp,{className:t});default:return a.jsx(da,{className:t})}},gf=({fileAttachment:e,isEmbedded:t=!1})=>a.jsx(xf,{filename:e.name,mimeType:e.mime_type,onDownload:()=>rh(e),className:"ml-4",isEmbedded:t}),xf=({filename:e,mimeType:t,className:n,onDownload:r,isEmbedded:o=!1})=>{const{artifacts:s,setPreviewArtifact:i,openSidePanelTab:l}=Ue(),c=u.useMemo(()=>s.find(f=>f.filename===e),[s,e]),d=u.useMemo(()=>hf(c||{filename:e,mime_type:t||""}),[c,e,t]);return a.jsxs("div",{className:`flex flex-shrink items-center gap-2 rounded-lg bg-[var(--accent-background)] px-2 py-1 h-11 max-w-xs ${n||""}`,children:[d,a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm leading-9",title:e,children:a.jsx("strong",{children:a.jsx("code",{children:e})})}),c&&!o&&a.jsx(Ae,{variant:"ghost",onClick:f=>{f.stopPropagation(),l("files"),i(c)},tooltip:"Preview",children:a.jsx(Hl,{className:"h-4 w-4"})}),r&&a.jsx(Ae,{variant:"ghost",onClick:()=>r(),tooltip:"Download file",children:a.jsx(xi,{className:"h-4 w-4"})})]})},gb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"audio/mpeg"};base64,${e}`;return a.jsx("div",{className:"flex h-auto max-w-[100vw] items-center justify-center p-4",children:a.jsxs("audio",{controls:!0,className:"w-full",onLoad:()=>n(null),onError:()=>n("Failed to load audio content."),children:[a.jsx("source",{src:r,type:t||"audio/mpeg"}),"Your browser does not support the audio element."]})})},xb=e=>{if(!e)return[];const t=[];let n=[],r="",o=!1;for(let s=0;s<e.length;s++){const i=e[s],l=s<e.length-1?e[s+1]:"";i==='"'?l==='"'?(r+='"',s++):o=!o:i===","&&!o?(n.push(r.trim()),r=""):(i===`
|
|
117
|
-
`||i==="\r"&&l===`
|
|
118
|
-
`)&&!o?(i==="\r"&&l===`
|
|
119
|
-
`&&s++,n.push(r.trim()),r="",n.some(c=>c.trim())?(t.push(n),n=[]):n=[]):r+=i}return(r||n.length>0)&&(n.push(r.trim()),n.some(s=>s.trim())&&t.push(n)),t},vb=({content:e,setRenderError:t})=>{u.useEffect(()=>{t(null)},[e,t]);const n=u.useMemo(()=>{try{return xb(e)}catch(r){return console.error("Error parsing CSV:",r),t("Failed to parse CSV content."),[]}},[e,t]);return n.length?a.jsx("div",{className:"block w-full overflow-x-scroll p-4",children:a.jsx("div",{style:{minWidth:"min(100%, max-content)"},children:a.jsxs("table",{className:"border text-sm w-full",children:[a.jsx("thead",{className:"sticky top-0 z-10 shadow-sm",children:n.length>0&&a.jsx("tr",{children:n[0].map((r,o)=>a.jsx("th",{className:"border-b p-2 text-left font-medium whitespace-nowrap",title:r,children:(r==null?void 0:r.trim())||""},`header-${o}`))})}),a.jsx("tbody",{children:n.slice(1).map((r,o)=>a.jsx("tr",{className:o%2===0?"bg-muted dark:bg-gray-700":"",children:r.map((s,i)=>a.jsx("td",{className:"min-w-0 border-b p-2 break-words align-top",title:s,children:(s==null?void 0:s.trim())||""},`cell-${o}-${i}`))},`row-${o}`))})]})})}):a.jsx("div",{children:"No valid CSV content found or failed to parse."})},wb=({content:e,setRenderError:t})=>{const n=u.useMemo(()=>e.replace(/<script(?:\s[^>]*)?>([\s\S]*?)<\/script>/gi,(s,i)=>{const l=s.match(/<script(\s[^>]*)?>/i);return`<script${l&&l[1]?l[1]:""}>(function() {
|
|
120
|
-
try {
|
|
121
|
-
${i}
|
|
122
|
-
} catch (e) { console.error('Error in sandboxed script:', e); }
|
|
123
|
-
})();<\/script>`}),[e]);return a.jsx("div",{className:"h-full w-full overflow-hidden dark:bg-gray-400 border",children:a.jsx("iframe",{srcDoc:n,title:"HTML Preview",sandbox:"allow-scripts allow-same-origin allow-downloads allow-forms allow-popups",allow:"autoplay",className:"h-full w-full border-none",onError:()=>t("Failed to load HTML content."),onLoad:()=>t(null)})})},bb=({content:e,mime_type:t,setRenderError:n})=>{const r=`data:${t||"image/png"};base64,${e}`;return a.jsx("div",{className:"flex h-auto w-auto max-w-[100vw] items-center justify-center p-4",children:a.jsx("img",{src:r,onError:()=>n("Failed to load image"),onLoad:()=>n(null),alt:"Preview",className:"h-full w-full object-contain"})})};function vf(){const e=u.useRef(null),t=()=>{if(e.current){const r=document.createRange();r.selectNodeContents(e.current);const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(r))}};return{ref:e,handleKeyDown:r=>{(r.metaKey||r.ctrlKey)&&r.key==="a"&&(r.preventDefault(),t())},selectAllContent:t}}const yb=({content:e})=>{const{ref:t,handleKeyDown:n}=vf();return a.jsx("div",{className:"w-full p-4",children:a.jsx("div",{ref:t,className:"max-w-full overflow-hidden focus-visible:outline-none select-text",tabIndex:0,onKeyDown:n,children:a.jsx(or,{className:"max-w-full break-words",children:e})})})};/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */const{entries:wf,setPrototypeOf:ll,isFrozen:Sb,getPrototypeOf:Cb,getOwnPropertyDescriptor:Eb}=Object;let{freeze:ut,seal:It,create:bf}=Object,{apply:ei,construct:ti}=typeof Reflect<"u"&&Reflect;ut||(ut=function(t){return t});It||(It=function(t){return t});ei||(ei=function(t,n,r){return t.apply(n,r)});ti||(ti=function(t,n){return new t(...n)});const ao=dt(Array.prototype.forEach),Tb=dt(Array.prototype.lastIndexOf),cl=dt(Array.prototype.pop),Sr=dt(Array.prototype.push),Ab=dt(Array.prototype.splice),vo=dt(String.prototype.toLowerCase),ks=dt(String.prototype.toString),ul=dt(String.prototype.match),Cr=dt(String.prototype.replace),Nb=dt(String.prototype.indexOf),kb=dt(String.prototype.trim),Ft=dt(Object.prototype.hasOwnProperty),at=dt(RegExp.prototype.test),Er=_b(TypeError);function dt(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return ei(e,t,r)}}function _b(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return ti(e,n)}}function Ne(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vo;ll&&ll(e,null);let r=t.length;for(;r--;){let o=t[r];if(typeof o=="string"){const s=n(o);s!==o&&(Sb(t)||(t[r]=s),o=s)}e[o]=!0}return e}function Ib(e){for(let t=0;t<e.length;t++)Ft(e,t)||(e[t]=null);return e}function ln(e){const t=bf(null);for(const[n,r]of wf(e))Ft(e,n)&&(Array.isArray(r)?t[n]=Ib(r):r&&typeof r=="object"&&r.constructor===Object?t[n]=ln(r):t[n]=r);return t}function Tr(e,t){for(;e!==null;){const r=Eb(e,t);if(r){if(r.get)return dt(r.get);if(typeof r.value=="function")return dt(r.value)}e=Cb(e)}function n(){return null}return n}const dl=ut(["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","section","select","shadow","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"]),_s=ut(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Is=ut(["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"]),jb=ut(["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"]),js=ut(["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"]),Mb=ut(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),fl=ut(["#text"]),pl=ut(["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","face","for","headers","height","hidden","high","href","hreflang","id","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","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Ms=ut(["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","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"]),ml=ut(["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","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),lo=ut(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Rb=It(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Pb=It(/<%[\w\W]*|[\w\W]*%>/gm),Lb=It(/\$\{[\w\W]*/gm),Db=It(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ob=It(/^aria-[\-\w]+$/),yf=It(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Fb=It(/^(?:\w+script|data):/i),zb=It(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Sf=It(/^html$/i),$b=It(/^[a-z][.\w]*(-[.\w]+)+$/i);var hl=Object.freeze({__proto__:null,ARIA_ATTR:Ob,ATTR_WHITESPACE:zb,CUSTOM_ELEMENT:$b,DATA_ATTR:Db,DOCTYPE_NAME:Sf,ERB_EXPR:Pb,IS_ALLOWED_URI:yf,IS_SCRIPT_OR_DATA:Fb,MUSTACHE_EXPR:Rb,TMPLIT_EXPR:Lb});const Ar={element:1,text:3,progressingInstruction:7,comment:8,document:9},Bb=function(){return typeof window>"u"?null:window},Ub=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const o="data-tt-policy-suffix";n&&n.hasAttribute(o)&&(r=n.getAttribute(o));const s="dompurify"+(r?"#"+r:"");try{return t.createPolicy(s,{createHTML(i){return i},createScriptURL(i){return i}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},gl=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Cf(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Bb();const t=Z=>Cf(Z);if(t.version="3.2.6",t.removed=[],!e||!e.document||e.document.nodeType!==Ar.document||!e.Element)return t.isSupported=!1,t;let{document:n}=e;const r=n,o=r.currentScript,{DocumentFragment:s,HTMLTemplateElement:i,Node:l,Element:c,NodeFilter:d,NamedNodeMap:f=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:p,DOMParser:m,trustedTypes:h}=e,x=c.prototype,g=Tr(x,"cloneNode"),v=Tr(x,"remove"),b=Tr(x,"nextSibling"),w=Tr(x,"childNodes"),y=Tr(x,"parentNode");if(typeof i=="function"){const Z=n.createElement("template");Z.content&&Z.content.ownerDocument&&(n=Z.content.ownerDocument)}let E,T="";const{implementation:_,createNodeIterator:I,createDocumentFragment:A,getElementsByTagName:q}=n,{importNode:K}=r;let U=gl();t.isSupported=typeof wf=="function"&&typeof y=="function"&&_&&_.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:Y,ERB_EXPR:J,TMPLIT_EXPR:O,DATA_ATTR:X,ARIA_ATTR:N,IS_SCRIPT_OR_DATA:R,ATTR_WHITESPACE:S,CUSTOM_ELEMENT:F}=hl;let{IS_ALLOWED_URI:M}=hl,P=null;const ee=Ne({},[...dl,..._s,...Is,...js,...fl]);let D=null;const $=Ne({},[...pl,...Ms,...ml,...lo]);let L=Object.seal(bf(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}})),G=null,k=null,V=!0,Q=!0,te=!1,oe=!0,se=!1,de=!0,me=!1,Me=!1,Oe=!1,Le=!1,je=!1,He=!1,ot=!0,Qe=!1;const et="user-content-";let le=!0,pt=!1,tt={},mt=null;const jt=Ne({},["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 wt=null;const Et=Ne({},["audio","video","img","source","image","track"]);let Tt=null;const Wt=Ne({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ht="http://www.w3.org/1998/Math/MathML",At="http://www.w3.org/2000/svg",Ke="http://www.w3.org/1999/xhtml";let gt=Ke,Mt=!1,Rt=null;const nn=Ne({},[ht,At,Ke],ks);let Nt=Ne({},["mi","mo","mn","ms","mtext"]),De=Ne({},["annotation-xml"]);const qe=Ne({},["title","style","font","a","script"]);let st=null;const rn=["application/xhtml+xml","text/html"],on="text/html";let Pe=null,xt=null;const sn=n.createElement("form"),Gt=function(C){return C instanceof RegExp||C instanceof Function},Pt=function(){let C=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(xt&&xt===C)){if((!C||typeof C!="object")&&(C={}),C=ln(C),st=rn.indexOf(C.PARSER_MEDIA_TYPE)===-1?on:C.PARSER_MEDIA_TYPE,Pe=st==="application/xhtml+xml"?ks:vo,P=Ft(C,"ALLOWED_TAGS")?Ne({},C.ALLOWED_TAGS,Pe):ee,D=Ft(C,"ALLOWED_ATTR")?Ne({},C.ALLOWED_ATTR,Pe):$,Rt=Ft(C,"ALLOWED_NAMESPACES")?Ne({},C.ALLOWED_NAMESPACES,ks):nn,Tt=Ft(C,"ADD_URI_SAFE_ATTR")?Ne(ln(Wt),C.ADD_URI_SAFE_ATTR,Pe):Wt,wt=Ft(C,"ADD_DATA_URI_TAGS")?Ne(ln(Et),C.ADD_DATA_URI_TAGS,Pe):Et,mt=Ft(C,"FORBID_CONTENTS")?Ne({},C.FORBID_CONTENTS,Pe):jt,G=Ft(C,"FORBID_TAGS")?Ne({},C.FORBID_TAGS,Pe):ln({}),k=Ft(C,"FORBID_ATTR")?Ne({},C.FORBID_ATTR,Pe):ln({}),tt=Ft(C,"USE_PROFILES")?C.USE_PROFILES:!1,V=C.ALLOW_ARIA_ATTR!==!1,Q=C.ALLOW_DATA_ATTR!==!1,te=C.ALLOW_UNKNOWN_PROTOCOLS||!1,oe=C.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=C.SAFE_FOR_TEMPLATES||!1,de=C.SAFE_FOR_XML!==!1,me=C.WHOLE_DOCUMENT||!1,Le=C.RETURN_DOM||!1,je=C.RETURN_DOM_FRAGMENT||!1,He=C.RETURN_TRUSTED_TYPE||!1,Oe=C.FORCE_BODY||!1,ot=C.SANITIZE_DOM!==!1,Qe=C.SANITIZE_NAMED_PROPS||!1,le=C.KEEP_CONTENT!==!1,pt=C.IN_PLACE||!1,M=C.ALLOWED_URI_REGEXP||yf,gt=C.NAMESPACE||Ke,Nt=C.MATHML_TEXT_INTEGRATION_POINTS||Nt,De=C.HTML_INTEGRATION_POINTS||De,L=C.CUSTOM_ELEMENT_HANDLING||{},C.CUSTOM_ELEMENT_HANDLING&&Gt(C.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=C.CUSTOM_ELEMENT_HANDLING.tagNameCheck),C.CUSTOM_ELEMENT_HANDLING&&Gt(C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=C.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),C.CUSTOM_ELEMENT_HANDLING&&typeof C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=C.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Q=!1),je&&(Le=!0),tt&&(P=Ne({},fl),D=[],tt.html===!0&&(Ne(P,dl),Ne(D,pl)),tt.svg===!0&&(Ne(P,_s),Ne(D,Ms),Ne(D,lo)),tt.svgFilters===!0&&(Ne(P,Is),Ne(D,Ms),Ne(D,lo)),tt.mathMl===!0&&(Ne(P,js),Ne(D,ml),Ne(D,lo))),C.ADD_TAGS&&(P===ee&&(P=ln(P)),Ne(P,C.ADD_TAGS,Pe)),C.ADD_ATTR&&(D===$&&(D=ln(D)),Ne(D,C.ADD_ATTR,Pe)),C.ADD_URI_SAFE_ATTR&&Ne(Tt,C.ADD_URI_SAFE_ATTR,Pe),C.FORBID_CONTENTS&&(mt===jt&&(mt=ln(mt)),Ne(mt,C.FORBID_CONTENTS,Pe)),le&&(P["#text"]=!0),me&&Ne(P,["html","head","body"]),P.table&&(Ne(P,["tbody"]),delete G.tbody),C.TRUSTED_TYPES_POLICY){if(typeof C.TRUSTED_TYPES_POLICY.createHTML!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof C.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Er('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=C.TRUSTED_TYPES_POLICY,T=E.createHTML("")}else E===void 0&&(E=Ub(h,o)),E!==null&&typeof T=="string"&&(T=E.createHTML(""));ut&&ut(C),xt=C}},Lt=Ne({},[..._s,...Is,...jb]),Dt=Ne({},[...js,...Mb]),be=function(C){let j=y(C);(!j||!j.tagName)&&(j={namespaceURI:gt,tagName:"template"});const W=vo(C.tagName),he=vo(j.tagName);return Rt[C.namespaceURI]?C.namespaceURI===At?j.namespaceURI===Ke?W==="svg":j.namespaceURI===ht?W==="svg"&&(he==="annotation-xml"||Nt[he]):!!Lt[W]:C.namespaceURI===ht?j.namespaceURI===Ke?W==="math":j.namespaceURI===At?W==="math"&&De[he]:!!Dt[W]:C.namespaceURI===Ke?j.namespaceURI===At&&!De[he]||j.namespaceURI===ht&&!Nt[he]?!1:!Dt[W]&&(qe[W]||!Lt[W]):!!(st==="application/xhtml+xml"&&Rt[C.namespaceURI]):!1},Ee=function(C){Sr(t.removed,{element:C});try{y(C).removeChild(C)}catch{v(C)}},B=function(C,j){try{Sr(t.removed,{attribute:j.getAttributeNode(C),from:j})}catch{Sr(t.removed,{attribute:null,from:j})}if(j.removeAttribute(C),C==="is")if(Le||je)try{Ee(j)}catch{}else try{j.setAttribute(C,"")}catch{}},z=function(C){let j=null,W=null;if(Oe)C="<remove></remove>"+C;else{const Re=ul(C,/^[\r\n\t ]+/);W=Re&&Re[0]}st==="application/xhtml+xml"&>===Ke&&(C='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+C+"</body></html>");const he=E?E.createHTML(C):C;if(gt===Ke)try{j=new m().parseFromString(he,st)}catch{}if(!j||!j.documentElement){j=_.createDocument(gt,"template",null);try{j.documentElement.innerHTML=Mt?T:he}catch{}}const ye=j.body||j.documentElement;return C&&W&&ye.insertBefore(n.createTextNode(W),ye.childNodes[0]||null),gt===Ke?q.call(j,me?"html":"body")[0]:me?j.documentElement:ye},H=function(C){return I.call(C.ownerDocument||C,C,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ie=function(C){return C instanceof p&&(typeof C.nodeName!="string"||typeof C.textContent!="string"||typeof C.removeChild!="function"||!(C.attributes instanceof f)||typeof C.removeAttribute!="function"||typeof C.setAttribute!="function"||typeof C.namespaceURI!="string"||typeof C.insertBefore!="function"||typeof C.hasChildNodes!="function")},fe=function(C){return typeof l=="function"&&C instanceof l};function pe(Z,C,j){ao(Z,W=>{W.call(t,C,j,xt)})}const ge=function(C){let j=null;if(pe(U.beforeSanitizeElements,C,null),ie(C))return Ee(C),!0;const W=Pe(C.nodeName);if(pe(U.uponSanitizeElement,C,{tagName:W,allowedTags:P}),de&&C.hasChildNodes()&&!fe(C.firstElementChild)&&at(/<[/\w!]/g,C.innerHTML)&&at(/<[/\w!]/g,C.textContent)||C.nodeType===Ar.progressingInstruction||de&&C.nodeType===Ar.comment&&at(/<[/\w]/g,C.data))return Ee(C),!0;if(!P[W]||G[W]){if(!G[W]&&ae(W)&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,W)||L.tagNameCheck instanceof Function&&L.tagNameCheck(W)))return!1;if(le&&!mt[W]){const he=y(C)||C.parentNode,ye=w(C)||C.childNodes;if(ye&&he){const Re=ye.length;for(let we=Re-1;we>=0;--we){const xe=g(ye[we],!0);xe.__removalCount=(C.__removalCount||0)+1,he.insertBefore(xe,b(C))}}}return Ee(C),!0}return C instanceof c&&!be(C)||(W==="noscript"||W==="noembed"||W==="noframes")&&at(/<\/no(script|embed|frames)/i,C.innerHTML)?(Ee(C),!0):(se&&C.nodeType===Ar.text&&(j=C.textContent,ao([Y,J,O],he=>{j=Cr(j,he," ")}),C.textContent!==j&&(Sr(t.removed,{element:C.cloneNode()}),C.textContent=j)),pe(U.afterSanitizeElements,C,null),!1)},_e=function(C,j,W){if(ot&&(j==="id"||j==="name")&&(W in n||W in sn))return!1;if(!(Q&&!k[j]&&at(X,j))){if(!(V&&at(N,j))){if(!D[j]||k[j]){if(!(ae(C)&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,C)||L.tagNameCheck instanceof Function&&L.tagNameCheck(C))&&(L.attributeNameCheck instanceof RegExp&&at(L.attributeNameCheck,j)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(j))||j==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&at(L.tagNameCheck,W)||L.tagNameCheck instanceof Function&&L.tagNameCheck(W))))return!1}else if(!Tt[j]){if(!at(M,Cr(W,S,""))){if(!((j==="src"||j==="xlink:href"||j==="href")&&C!=="script"&&Nb(W,"data:")===0&&wt[C])){if(!(te&&!at(R,Cr(W,S,"")))){if(W)return!1}}}}}}return!0},ae=function(C){return C!=="annotation-xml"&&ul(C,F)},ue=function(C){pe(U.beforeSanitizeAttributes,C,null);const{attributes:j}=C;if(!j||ie(C))return;const W={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:D,forceKeepAttr:void 0};let he=j.length;for(;he--;){const ye=j[he],{name:Re,namespaceURI:we,value:xe}=ye,it=Pe(Re),hn=xe;let Fe=Re==="value"?hn:kb(hn);if(W.attrName=it,W.attrValue=Fe,W.keepAttr=!0,W.forceKeepAttr=void 0,pe(U.uponSanitizeAttribute,C,W),Fe=W.attrValue,Qe&&(it==="id"||it==="name")&&(B(Re,C),Fe=et+Fe),de&&at(/((--!?|])>)|<\/(style|title)/i,Fe)){B(Re,C);continue}if(W.forceKeepAttr)continue;if(!W.keepAttr){B(Re,C);continue}if(!oe&&at(/\/>/i,Fe)){B(Re,C);continue}se&&ao([Y,J,O],wr=>{Fe=Cr(Fe,wr," ")});const ls=Pe(C.nodeName);if(!_e(ls,it,Fe)){B(Re,C);continue}if(E&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!we)switch(h.getAttributeType(ls,it)){case"TrustedHTML":{Fe=E.createHTML(Fe);break}case"TrustedScriptURL":{Fe=E.createScriptURL(Fe);break}}if(Fe!==hn)try{we?C.setAttributeNS(we,Re,Fe):C.setAttribute(Re,Fe),ie(C)?Ee(C):cl(t.removed)}catch{B(Re,C)}}pe(U.afterSanitizeAttributes,C,null)},Ie=function Z(C){let j=null;const W=H(C);for(pe(U.beforeSanitizeShadowDOM,C,null);j=W.nextNode();)pe(U.uponSanitizeShadowNode,j,null),ge(j),ue(j),j.content instanceof s&&Z(j.content);pe(U.afterSanitizeShadowDOM,C,null)};return t.sanitize=function(Z){let C=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},j=null,W=null,he=null,ye=null;if(Mt=!Z,Mt&&(Z="<!-->"),typeof Z!="string"&&!fe(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw Er("dirty is not a string, aborting")}else throw Er("toString is not a function");if(!t.isSupported)return Z;if(Me||Pt(C),t.removed=[],typeof Z=="string"&&(pt=!1),pt){if(Z.nodeName){const xe=Pe(Z.nodeName);if(!P[xe]||G[xe])throw Er("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof l)j=z("<!---->"),W=j.ownerDocument.importNode(Z,!0),W.nodeType===Ar.element&&W.nodeName==="BODY"||W.nodeName==="HTML"?j=W:j.appendChild(W);else{if(!Le&&!se&&!me&&Z.indexOf("<")===-1)return E&&He?E.createHTML(Z):Z;if(j=z(Z),!j)return Le?null:He?T:""}j&&Oe&&Ee(j.firstChild);const Re=H(pt?Z:j);for(;he=Re.nextNode();)ge(he),ue(he),he.content instanceof s&&Ie(he.content);if(pt)return Z;if(Le){if(je)for(ye=A.call(j.ownerDocument);j.firstChild;)ye.appendChild(j.firstChild);else ye=j;return(D.shadowroot||D.shadowrootmode)&&(ye=K.call(r,ye,!0)),ye}let we=me?j.outerHTML:j.innerHTML;return me&&P["!doctype"]&&j.ownerDocument&&j.ownerDocument.doctype&&j.ownerDocument.doctype.name&&at(Sf,j.ownerDocument.doctype.name)&&(we="<!DOCTYPE "+j.ownerDocument.doctype.name+`>
|
|
124
|
-
`+we),se&&ao([Y,J,O],xe=>{we=Cr(we,xe," ")}),E&&He?E.createHTML(we):we},t.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Pt(Z),Me=!0},t.clearConfig=function(){xt=null,Me=!1},t.isValidAttribute=function(Z,C,j){xt||Pt({});const W=Pe(Z),he=Pe(C);return _e(W,he,j)},t.addHook=function(Z,C){typeof C=="function"&&Sr(U[Z],C)},t.removeHook=function(Z,C){if(C!==void 0){const j=Tb(U[Z],C);return j===-1?void 0:Ab(U[Z],j,1)[0]}return cl(U[Z])},t.removeHooks=function(Z){U[Z]=[]},t.removeAllHooks=function(){U=gl()},t}var Ef=Cf();const Hb=({content:e,setRenderError:t})=>{const[n,r]=u.useState(""),o=u.useMemo(()=>Ef.sanitize(e,{USE_PROFILES:{html:!1},ALLOWED_TAGS:["br","em","strong","b","i"],ALLOWED_ATTR:[]}),[e]);return u.useEffect(()=>{r(`<!DOCTYPE html>
|
|
125
|
-
<html>
|
|
126
|
-
<head>
|
|
127
|
-
<meta charset="utf-8">
|
|
128
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
129
|
-
<title>Mermaid Preview</title>
|
|
130
|
-
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"><\/script>
|
|
131
|
-
<script src="https://cdn.jsdelivr.net/npm/panzoom@9.4.0/dist/panzoom.min.js"><\/script>
|
|
132
|
-
<script>
|
|
133
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
134
|
-
try {
|
|
135
|
-
mermaid.initialize({
|
|
136
|
-
startOnLoad: true,
|
|
137
|
-
theme: 'default',
|
|
138
|
-
fontFamily: 'arial, sans-serif',
|
|
139
|
-
logLevel: 'error',
|
|
140
|
-
securityLevel: 'strict'
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
// Initialize panzoom after Mermaid rendering
|
|
144
|
-
mermaid.run().then(() => {
|
|
145
|
-
const diagramContainer = document.getElementById('diagram-container');
|
|
146
|
-
if (diagramContainer) {
|
|
147
|
-
const pz = panzoom(diagramContainer, {
|
|
148
|
-
maxZoom: 10,
|
|
149
|
-
minZoom: 0.1,
|
|
150
|
-
smoothScroll: true,
|
|
151
|
-
bounds: true,
|
|
152
|
-
boundsPadding: 0.1
|
|
153
|
-
});
|
|
154
|
-
// Add zoom controls (old version had only reset)
|
|
155
|
-
const resetButton = document.getElementById('reset');
|
|
156
|
-
if (resetButton) {
|
|
157
|
-
resetButton.addEventListener('click', () => {
|
|
158
|
-
pz.moveTo(0, 0);
|
|
159
|
-
pz.zoomAbs(0, 0, 1);
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}).catch(err => {
|
|
164
|
-
console.error("Mermaid rendering failed inside iframe:", err);
|
|
165
|
-
const mermaidDiv = document.querySelector('.mermaid');
|
|
166
|
-
if (mermaidDiv) mermaidDiv.innerText = "Error rendering diagram: " + err.message;
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
window.addEventListener('message', function(event) {
|
|
170
|
-
if (event.data && event.data.action === 'getMermaidSvg') {
|
|
171
|
-
const svgElement = document.querySelector('.mermaid svg');
|
|
172
|
-
if (svgElement) {
|
|
173
|
-
if (!svgElement.getAttribute('xmlns')) { // Ensure xmlns for standalone SVG
|
|
174
|
-
svgElement.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
175
|
-
}
|
|
176
|
-
const svgData = new XMLSerializer().serializeToString(svgElement);
|
|
177
|
-
window.parent.postMessage({
|
|
178
|
-
action: 'downloadSvg',
|
|
179
|
-
svgData: svgData,
|
|
180
|
-
filename: event.data.filename || 'mermaid-diagram.svg'
|
|
181
|
-
}, '*');
|
|
182
|
-
} else {
|
|
183
|
-
console.error('SVG element not found for download inside iframe.');
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
} catch (e) {
|
|
188
|
-
console.error("Error initializing Mermaid or Panzoom inside iframe:", e);
|
|
189
|
-
const mermaidDiv = document.querySelector('.mermaid');
|
|
190
|
-
if (mermaidDiv) mermaidDiv.innerText = "Failed to initialize diagram viewer: " + e.message;
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
<\/script>
|
|
194
|
-
<style>
|
|
195
|
-
/* Styles from old code */
|
|
196
|
-
html, body {
|
|
197
|
-
height: 100%;
|
|
198
|
-
margin: 0;
|
|
199
|
-
padding: 0;
|
|
200
|
-
overflow: hidden;
|
|
201
|
-
font-family: Arial, sans-serif; /* Old font */
|
|
202
|
-
}
|
|
203
|
-
.container {
|
|
204
|
-
display: flex;
|
|
205
|
-
flex-direction: column;
|
|
206
|
-
height: 100vh;
|
|
207
|
-
overflow: hidden;
|
|
208
|
-
}
|
|
209
|
-
.diagram-wrapper {
|
|
210
|
-
flex: 1;
|
|
211
|
-
overflow: hidden;
|
|
212
|
-
position: relative;
|
|
213
|
-
display: flex;
|
|
214
|
-
justify-content: center;
|
|
215
|
-
align-items: center;
|
|
216
|
-
background-color: #f9f9f9;
|
|
217
|
-
}
|
|
218
|
-
#diagram-container {
|
|
219
|
-
transform-origin: 0 0;
|
|
220
|
-
cursor: grab;
|
|
221
|
-
box-shadow: 0 0 10px rgba(0,0,0,0.1);
|
|
222
|
-
background-color: white;
|
|
223
|
-
padding: 20px;
|
|
224
|
-
border-radius: 5px;
|
|
225
|
-
/* Ensure diagram container can hold the content */
|
|
226
|
-
width: auto; /* Adjust as needed, or let content define it */
|
|
227
|
-
height: auto;
|
|
228
|
-
max-width: 100%;
|
|
229
|
-
max-height: 100%;
|
|
230
|
-
}
|
|
231
|
-
#diagram-container:active {
|
|
232
|
-
cursor: grabbing;
|
|
233
|
-
}
|
|
234
|
-
.mermaid {
|
|
235
|
-
display: flex; /* Helps in centering if SVG is smaller */
|
|
236
|
-
justify-content: center;
|
|
237
|
-
align-items: center;
|
|
238
|
-
/* width: 100%; Ensures mermaid div takes space, SVG might scale within it */
|
|
239
|
-
/* height: 100%; */
|
|
240
|
-
}
|
|
241
|
-
.mermaid svg {
|
|
242
|
-
max-width: 100%; /* Ensure SVG scales down if too large */
|
|
243
|
-
max-height: 100%;
|
|
244
|
-
}
|
|
245
|
-
.controls{
|
|
246
|
-
position: fixed;
|
|
247
|
-
bottom: 20px;
|
|
248
|
-
right: 20px;
|
|
249
|
-
z-index: 1000;
|
|
250
|
-
display: flex;
|
|
251
|
-
gap: 5px;
|
|
252
|
-
}
|
|
253
|
-
.control-btn {
|
|
254
|
-
width: 40px;
|
|
255
|
-
height: 40px;
|
|
256
|
-
border-radius: 50%;
|
|
257
|
-
border: none;
|
|
258
|
-
background-color: white;
|
|
259
|
-
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
|
|
260
|
-
cursor: pointer;
|
|
261
|
-
font-size: 18px;
|
|
262
|
-
display: flex;
|
|
263
|
-
align-items: center;
|
|
264
|
-
justify-content: center;
|
|
265
|
-
}
|
|
266
|
-
.control-btn:hover {
|
|
267
|
-
background-color: #f0f0f0;
|
|
268
|
-
}
|
|
269
|
-
.instructions {
|
|
270
|
-
position: fixed;
|
|
271
|
-
top: 10px;
|
|
272
|
-
left: 10px;
|
|
273
|
-
background-color: rgba(255,255,255,0.8);
|
|
274
|
-
padding: 5px 10px;
|
|
275
|
-
border-radius: 4px;
|
|
276
|
-
font-size: 12px;
|
|
277
|
-
color: #666;
|
|
278
|
-
}
|
|
279
|
-
</style>
|
|
280
|
-
</head>
|
|
281
|
-
<body>
|
|
282
|
-
<div class="container">
|
|
283
|
-
<div class="diagram-wrapper">
|
|
284
|
-
<div id="diagram-container">
|
|
285
|
-
<div class="mermaid">
|
|
286
|
-
${o}
|
|
287
|
-
</div>
|
|
288
|
-
</div>
|
|
289
|
-
</div>
|
|
290
|
-
<div class="instructions">
|
|
291
|
-
Drag to pan and scroll to zoom
|
|
292
|
-
</div>
|
|
293
|
-
<div class="controls">
|
|
294
|
-
<button id="reset" class="control-btn" title="Reset View">↺</button>
|
|
295
|
-
</div>
|
|
296
|
-
</div>
|
|
297
|
-
</body>
|
|
298
|
-
</html>`)},[o]),a.jsx("div",{className:"bg-background h-full max-w-[100vw] overflow-hidden p-4",children:a.jsx("iframe",{srcDoc:n,title:"Mermaid Diagram Preview",sandbox:"allow-scripts allow-same-origin allow-downloads",className:"h-full w-full border-none",onError:()=>t("Failed to load Mermaid content."),onLoad:()=>t(null)})})};/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function Tf(e){return typeof e>"u"||e===null}function Wb(e){return typeof e=="object"&&e!==null}function Gb(e){return Array.isArray(e)?e:Tf(e)?[]:[e]}function Vb(e,t){var n,r,o,s;if(t)for(s=Object.keys(t),n=0,r=s.length;n<r;n+=1)o=s[n],e[o]=t[o];return e}function Yb(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function Kb(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var qb=Tf,Xb=Wb,Zb=Gb,Jb=Yb,Qb=Kb,ey=Vb,Ve={isNothing:qb,isObject:Xb,toArray:Zb,repeat:Jb,isNegativeZero:Qb,extend:ey};function Af(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
|
|
299
|
-
|
|
300
|
-
`+e.mark.snippet),r+" "+n):r}function Fr(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=Af(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Fr.prototype=Object.create(Error.prototype);Fr.prototype.constructor=Fr;Fr.prototype.toString=function(t){return this.name+": "+Af(this,t)};var ct=Fr;function Rs(e,t,n,r,o){var s="",i="",l=Math.floor(o/2)-1;return r-t>l&&(s=" ... ",t=r-l+s.length),n-r>l&&(i=" ...",n=r+l-i.length),{str:s+e.slice(t,n).replace(/\t/g,"→")+i,pos:r-t+s.length}}function Ps(e,t){return Ve.repeat(" ",t-e.length)+e}function ty(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],o=[],s,i=-1;s=n.exec(e.buffer);)o.push(s.index),r.push(s.index+s[0].length),e.position<=s.index&&i<0&&(i=r.length-2);i<0&&(i=r.length-1);var l="",c,d,f=Math.min(e.line+t.linesAfter,o.length).toString().length,p=t.maxLength-(t.indent+f+3);for(c=1;c<=t.linesBefore&&!(i-c<0);c++)d=Rs(e.buffer,r[i-c],o[i-c],e.position-(r[i]-r[i-c]),p),l=Ve.repeat(" ",t.indent)+Ps((e.line-c+1).toString(),f)+" | "+d.str+`
|
|
301
|
-
`+l;for(d=Rs(e.buffer,r[i],o[i],e.position,p),l+=Ve.repeat(" ",t.indent)+Ps((e.line+1).toString(),f)+" | "+d.str+`
|
|
302
|
-
`,l+=Ve.repeat("-",t.indent+f+3+d.pos)+`^
|
|
303
|
-
`,c=1;c<=t.linesAfter&&!(i+c>=o.length);c++)d=Rs(e.buffer,r[i+c],o[i+c],e.position-(r[i]-r[i+c]),p),l+=Ve.repeat(" ",t.indent)+Ps((e.line+c+1).toString(),f)+" | "+d.str+`
|
|
304
|
-
`;return l.replace(/\n$/,"")}var ny=ty,ry=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],oy=["scalar","sequence","mapping"];function sy(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function iy(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(ry.indexOf(n)===-1)throw new ct('Unknown option "'+n+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(n){return n},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=sy(t.styleAliases||null),oy.indexOf(this.kind)===-1)throw new ct('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Je=iy;function xl(e,t){var n=[];return e[t].forEach(function(r){var o=n.length;n.forEach(function(s,i){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(o=i)}),n[o]=r}),n}function ay(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(o){o.multi?(e.multi[o.kind].push(o),e.multi.fallback.push(o)):e[o.kind][o.tag]=e.fallback[o.tag]=o}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function ni(e){return this.extend(e)}ni.prototype.extend=function(t){var n=[],r=[];if(t instanceof Je)r.push(t);else if(Array.isArray(t))r=r.concat(t);else if(t&&(Array.isArray(t.implicit)||Array.isArray(t.explicit)))t.implicit&&(n=n.concat(t.implicit)),t.explicit&&(r=r.concat(t.explicit));else throw new ct("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof Je))throw new ct("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new ct("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new ct("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof Je))throw new ct("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var o=Object.create(ni.prototype);return o.implicit=(this.implicit||[]).concat(n),o.explicit=(this.explicit||[]).concat(r),o.compiledImplicit=xl(o,"implicit"),o.compiledExplicit=xl(o,"explicit"),o.compiledTypeMap=ay(o.compiledImplicit,o.compiledExplicit),o};var Nf=ni,kf=new Je("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),_f=new Je("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),If=new Je("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),jf=new Nf({explicit:[kf,_f,If]});function ly(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function cy(){return null}function uy(e){return e===null}var Mf=new Je("tag:yaml.org,2002:null",{kind:"scalar",resolve:ly,construct:cy,predicate:uy,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function dy(e){if(e===null)return!1;var t=e.length;return t===4&&(e==="true"||e==="True"||e==="TRUE")||t===5&&(e==="false"||e==="False"||e==="FALSE")}function fy(e){return e==="true"||e==="True"||e==="TRUE"}function py(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var Rf=new Je("tag:yaml.org,2002:bool",{kind:"scalar",resolve:dy,construct:fy,predicate:py,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"});function my(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function hy(e){return 48<=e&&e<=55}function gy(e){return 48<=e&&e<=57}function xy(e){if(e===null)return!1;var t=e.length,n=0,r=!1,o;if(!t)return!1;if(o=e[n],(o==="-"||o==="+")&&(o=e[++n]),o==="0"){if(n+1===t)return!0;if(o=e[++n],o==="b"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(o!=="0"&&o!=="1")return!1;r=!0}return r&&o!=="_"}if(o==="x"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!my(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}if(o==="o"){for(n++;n<t;n++)if(o=e[n],o!=="_"){if(!hy(e.charCodeAt(n)))return!1;r=!0}return r&&o!=="_"}}if(o==="_")return!1;for(;n<t;n++)if(o=e[n],o!=="_"){if(!gy(e.charCodeAt(n)))return!1;r=!0}return!(!r||o==="_")}function vy(e){var t=e,n=1,r;if(t.indexOf("_")!==-1&&(t=t.replace(/_/g,"")),r=t[0],(r==="-"||r==="+")&&(r==="-"&&(n=-1),t=t.slice(1),r=t[0]),t==="0")return 0;if(r==="0"){if(t[1]==="b")return n*parseInt(t.slice(2),2);if(t[1]==="x")return n*parseInt(t.slice(2),16);if(t[1]==="o")return n*parseInt(t.slice(2),8)}return n*parseInt(t,10)}function wy(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Ve.isNegativeZero(e)}var Pf=new Je("tag:yaml.org,2002:int",{kind:"scalar",resolve:xy,construct:vy,predicate:wy,represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),by=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function yy(e){return!(e===null||!by.test(e)||e[e.length-1]==="_")}function Sy(e){var t,n;return t=e.replace(/_/g,"").toLowerCase(),n=t[0]==="-"?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),t===".inf"?n===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:t===".nan"?NaN:n*parseFloat(t,10)}var Cy=/^[-+]?[0-9]+e/;function Ey(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(Ve.isNegativeZero(e))return"-0.0";return n=e.toString(10),Cy.test(n)?n.replace("e",".e"):n}function Ty(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Ve.isNegativeZero(e))}var Lf=new Je("tag:yaml.org,2002:float",{kind:"scalar",resolve:yy,construct:Sy,predicate:Ty,represent:Ey,defaultStyle:"lowercase"}),Df=jf.extend({implicit:[Mf,Rf,Pf,Lf]}),Of=Df,Ff=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),zf=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function Ay(e){return e===null?!1:Ff.exec(e)!==null||zf.exec(e)!==null}function Ny(e){var t,n,r,o,s,i,l,c=0,d=null,f,p,m;if(t=Ff.exec(e),t===null&&(t=zf.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,o=+t[3],!t[4])return new Date(Date.UTC(n,r,o));if(s=+t[4],i=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(f=+t[10],p=+(t[11]||0),d=(f*60+p)*6e4,t[9]==="-"&&(d=-d)),m=new Date(Date.UTC(n,r,o,s,i,l,c)),d&&m.setTime(m.getTime()-d),m}function ky(e){return e.toISOString()}var $f=new Je("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Ay,construct:Ny,instanceOf:Date,represent:ky});function _y(e){return e==="<<"||e===null}var Bf=new Je("tag:yaml.org,2002:merge",{kind:"scalar",resolve:_y}),Ji=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
305
|
-
\r`;function Iy(e){if(e===null)return!1;var t,n,r=0,o=e.length,s=Ji;for(n=0;n<o;n++)if(t=s.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function jy(e){var t,n,r=e.replace(/[\r\n=]/g,""),o=r.length,s=Ji,i=0,l=[];for(t=0;t<o;t++)t%4===0&&t&&(l.push(i>>16&255),l.push(i>>8&255),l.push(i&255)),i=i<<6|s.indexOf(r.charAt(t));return n=o%4*6,n===0?(l.push(i>>16&255),l.push(i>>8&255),l.push(i&255)):n===18?(l.push(i>>10&255),l.push(i>>2&255)):n===12&&l.push(i>>4&255),new Uint8Array(l)}function My(e){var t="",n=0,r,o,s=e.length,i=Ji;for(r=0;r<s;r++)r%3===0&&r&&(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]),n=(n<<8)+e[r];return o=s%3,o===0?(t+=i[n>>18&63],t+=i[n>>12&63],t+=i[n>>6&63],t+=i[n&63]):o===2?(t+=i[n>>10&63],t+=i[n>>4&63],t+=i[n<<2&63],t+=i[64]):o===1&&(t+=i[n>>2&63],t+=i[n<<4&63],t+=i[64],t+=i[64]),t}function Ry(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var Uf=new Je("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Iy,construct:jy,predicate:Ry,represent:My}),Py=Object.prototype.hasOwnProperty,Ly=Object.prototype.toString;function Dy(e){if(e===null)return!0;var t=[],n,r,o,s,i,l=e;for(n=0,r=l.length;n<r;n+=1){if(o=l[n],i=!1,Ly.call(o)!=="[object Object]")return!1;for(s in o)if(Py.call(o,s))if(!i)i=!0;else return!1;if(!i)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function Oy(e){return e!==null?e:[]}var Hf=new Je("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Dy,construct:Oy}),Fy=Object.prototype.toString;function zy(e){if(e===null)return!0;var t,n,r,o,s,i=e;for(s=new Array(i.length),t=0,n=i.length;t<n;t+=1){if(r=i[t],Fy.call(r)!=="[object Object]"||(o=Object.keys(r),o.length!==1))return!1;s[t]=[o[0],r[o[0]]]}return!0}function $y(e){if(e===null)return[];var t,n,r,o,s,i=e;for(s=new Array(i.length),t=0,n=i.length;t<n;t+=1)r=i[t],o=Object.keys(r),s[t]=[o[0],r[o[0]]];return s}var Wf=new Je("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:zy,construct:$y}),By=Object.prototype.hasOwnProperty;function Uy(e){if(e===null)return!0;var t,n=e;for(t in n)if(By.call(n,t)&&n[t]!==null)return!1;return!0}function Hy(e){return e!==null?e:{}}var Gf=new Je("tag:yaml.org,2002:set",{kind:"mapping",resolve:Uy,construct:Hy}),Qi=Of.extend({implicit:[$f,Bf],explicit:[Uf,Hf,Wf,Gf]}),En=Object.prototype.hasOwnProperty,No=1,Vf=2,Yf=3,ko=4,Ls=1,Wy=2,vl=3,Gy=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Vy=/[\x85\u2028\u2029]/,Yy=/[,\[\]\{\}]/,Kf=/^(?:!|!!|![a-z\-]+!)$/i,qf=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function wl(e){return Object.prototype.toString.call(e)}function Jt(e){return e===10||e===13}function Rn(e){return e===9||e===32}function vt(e){return e===9||e===32||e===10||e===13}function Qn(e){return e===44||e===91||e===93||e===123||e===125}function Ky(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function qy(e){return e===120?2:e===117?4:e===85?8:0}function Xy(e){return 48<=e&&e<=57?e-48:-1}function bl(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
306
|
-
`:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"
":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function Zy(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}var Xf=new Array(256),Zf=new Array(256);for(var qn=0;qn<256;qn++)Xf[qn]=bl(qn)?1:0,Zf[qn]=bl(qn);function Jy(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Qi,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function Jf(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=ny(n),new ct(t,n)}function ce(e,t){throw Jf(e,t)}function _o(e,t){e.onWarning&&e.onWarning.call(null,Jf(e,t))}var yl={YAML:function(t,n,r){var o,s,i;t.version!==null&&ce(t,"duplication of %YAML directive"),r.length!==1&&ce(t,"YAML directive accepts exactly one argument"),o=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),o===null&&ce(t,"ill-formed argument of the YAML directive"),s=parseInt(o[1],10),i=parseInt(o[2],10),s!==1&&ce(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=i<2,i!==1&&i!==2&&_o(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var o,s;r.length!==2&&ce(t,"TAG directive accepts exactly two arguments"),o=r[0],s=r[1],Kf.test(o)||ce(t,"ill-formed tag handle (first argument) of the TAG directive"),En.call(t.tagMap,o)&&ce(t,'there is a previously declared suffix for "'+o+'" tag handle'),qf.test(s)||ce(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{ce(t,"tag prefix is malformed: "+s)}t.tagMap[o]=s}};function bn(e,t,n,r){var o,s,i,l;if(t<n){if(l=e.input.slice(t,n),r)for(o=0,s=l.length;o<s;o+=1)i=l.charCodeAt(o),i===9||32<=i&&i<=1114111||ce(e,"expected valid JSON character");else Gy.test(l)&&ce(e,"the stream contains non-printable characters");e.result+=l}}function Sl(e,t,n,r){var o,s,i,l;for(Ve.isObject(n)||ce(e,"cannot merge mappings; the provided source object is unacceptable"),o=Object.keys(n),i=0,l=o.length;i<l;i+=1)s=o[i],En.call(t,s)||(t[s]=n[s],r[s]=!0)}function er(e,t,n,r,o,s,i,l,c){var d,f;if(Array.isArray(o))for(o=Array.prototype.slice.call(o),d=0,f=o.length;d<f;d+=1)Array.isArray(o[d])&&ce(e,"nested arrays are not supported inside keys"),typeof o=="object"&&wl(o[d])==="[object Object]"&&(o[d]="[object Object]");if(typeof o=="object"&&wl(o)==="[object Object]"&&(o="[object Object]"),o=String(o),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(d=0,f=s.length;d<f;d+=1)Sl(e,t,s[d],n);else Sl(e,t,s,n);else!e.json&&!En.call(n,o)&&En.call(t,o)&&(e.line=i||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,ce(e,"duplicated mapping key")),o==="__proto__"?Object.defineProperty(t,o,{configurable:!0,enumerable:!0,writable:!0,value:s}):t[o]=s,delete n[o];return t}function ea(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):ce(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function We(e,t,n){for(var r=0,o=e.input.charCodeAt(e.position);o!==0;){for(;Rn(o);)o===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),o=e.input.charCodeAt(++e.position);if(t&&o===35)do o=e.input.charCodeAt(++e.position);while(o!==10&&o!==13&&o!==0);if(Jt(o))for(ea(e),o=e.input.charCodeAt(e.position),r++,e.lineIndent=0;o===32;)e.lineIndent++,o=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&_o(e,"deficient indentation"),r}function is(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||vt(n)))}function ta(e,t){t===1?e.result+=" ":t>1&&(e.result+=Ve.repeat(`
|
|
307
|
-
`,t-1))}function Qy(e,t,n){var r,o,s,i,l,c,d,f,p=e.kind,m=e.result,h;if(h=e.input.charCodeAt(e.position),vt(h)||Qn(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(o=e.input.charCodeAt(e.position+1),vt(o)||n&&Qn(o)))return!1;for(e.kind="scalar",e.result="",s=i=e.position,l=!1;h!==0;){if(h===58){if(o=e.input.charCodeAt(e.position+1),vt(o)||n&&Qn(o))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),vt(r))break}else{if(e.position===e.lineStart&&is(e)||n&&Qn(h))break;if(Jt(h))if(c=e.line,d=e.lineStart,f=e.lineIndent,We(e,!1,-1),e.lineIndent>=t){l=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=i,e.line=c,e.lineStart=d,e.lineIndent=f;break}}l&&(bn(e,s,i,!1),ta(e,e.line-c),s=i=e.position,l=!1),Rn(h)||(i=e.position+1),h=e.input.charCodeAt(++e.position)}return bn(e,s,i,!1),e.result?!0:(e.kind=p,e.result=m,!1)}function eS(e,t){var n,r,o;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=o=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(bn(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,o=e.position;else return!0;else Jt(n)?(bn(e,r,o,!0),ta(e,We(e,!1,t)),r=o=e.position):e.position===e.lineStart&&is(e)?ce(e,"unexpected end of the document within a single quoted scalar"):(e.position++,o=e.position);ce(e,"unexpected end of the stream within a single quoted scalar")}function tS(e,t){var n,r,o,s,i,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return bn(e,n,e.position,!0),e.position++,!0;if(l===92){if(bn(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),Jt(l))We(e,!1,t);else if(l<256&&Xf[l])e.result+=Zf[l],e.position++;else if((i=qy(l))>0){for(o=i,s=0;o>0;o--)l=e.input.charCodeAt(++e.position),(i=Ky(l))>=0?s=(s<<4)+i:ce(e,"expected hexadecimal character");e.result+=Zy(s),e.position++}else ce(e,"unknown escape sequence");n=r=e.position}else Jt(l)?(bn(e,n,r,!0),ta(e,We(e,!1,t)),n=r=e.position):e.position===e.lineStart&&is(e)?ce(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}ce(e,"unexpected end of the stream within a double quoted scalar")}function nS(e,t){var n=!0,r,o,s,i=e.tag,l,c=e.anchor,d,f,p,m,h,x=Object.create(null),g,v,b,w;if(w=e.input.charCodeAt(e.position),w===91)f=93,h=!1,l=[];else if(w===123)f=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),w=e.input.charCodeAt(++e.position);w!==0;){if(We(e,!0,t),w=e.input.charCodeAt(e.position),w===f)return e.position++,e.tag=i,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=l,!0;n?w===44&&ce(e,"expected the node content, but found ','"):ce(e,"missed comma between flow collection entries"),v=g=b=null,p=m=!1,w===63&&(d=e.input.charCodeAt(e.position+1),vt(d)&&(p=m=!0,e.position++,We(e,!0,t))),r=e.line,o=e.lineStart,s=e.position,cr(e,t,No,!1,!0),v=e.tag,g=e.result,We(e,!0,t),w=e.input.charCodeAt(e.position),(m||e.line===r)&&w===58&&(p=!0,w=e.input.charCodeAt(++e.position),We(e,!0,t),cr(e,t,No,!1,!0),b=e.result),h?er(e,l,x,v,g,b,r,o,s):p?l.push(er(e,null,x,v,g,b,r,o,s)):l.push(g),We(e,!0,t),w=e.input.charCodeAt(e.position),w===44?(n=!0,w=e.input.charCodeAt(++e.position)):n=!1}ce(e,"unexpected end of the stream within a flow collection")}function rS(e,t){var n,r,o=Ls,s=!1,i=!1,l=t,c=0,d=!1,f,p;if(p=e.input.charCodeAt(e.position),p===124)r=!1;else if(p===62)r=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)Ls===o?o=p===43?vl:Wy:ce(e,"repeat of a chomping mode identifier");else if((f=Xy(p))>=0)f===0?ce(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):i?ce(e,"repeat of an indentation width identifier"):(l=t+f-1,i=!0);else break;if(Rn(p)){do p=e.input.charCodeAt(++e.position);while(Rn(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!Jt(p)&&p!==0)}for(;p!==0;){for(ea(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!i||e.lineIndent<l)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!i&&e.lineIndent>l&&(l=e.lineIndent),Jt(p)){c++;continue}if(e.lineIndent<l){o===vl?e.result+=Ve.repeat(`
|
|
308
|
-
`,s?1+c:c):o===Ls&&s&&(e.result+=`
|
|
309
|
-
`);break}for(r?Rn(p)?(d=!0,e.result+=Ve.repeat(`
|
|
310
|
-
`,s?1+c:c)):d?(d=!1,e.result+=Ve.repeat(`
|
|
311
|
-
`,c+1)):c===0?s&&(e.result+=" "):e.result+=Ve.repeat(`
|
|
312
|
-
`,c):e.result+=Ve.repeat(`
|
|
313
|
-
`,s?1+c:c),s=!0,i=!0,c=0,n=e.position;!Jt(p)&&p!==0;)p=e.input.charCodeAt(++e.position);bn(e,n,e.position,!1)}return!0}function Cl(e,t){var n,r=e.tag,o=e.anchor,s=[],i,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ce(e,"tab characters must not be used in indentation")),!(c!==45||(i=e.input.charCodeAt(e.position+1),!vt(i))));){if(l=!0,e.position++,We(e,!0,-1)&&e.lineIndent<=t){s.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,cr(e,t,Yf,!1,!0),s.push(e.result),We(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)ce(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=o,e.kind="sequence",e.result=s,!0):!1}function oS(e,t,n){var r,o,s,i,l,c,d=e.tag,f=e.anchor,p={},m=Object.create(null),h=null,x=null,g=null,v=!1,b=!1,w;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),w=e.input.charCodeAt(e.position);w!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,ce(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(w===63||w===58)&&vt(r))w===63?(v&&(er(e,p,m,h,x,null,i,l,c),h=x=g=null),b=!0,v=!0,o=!0):v?(v=!1,o=!0):ce(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,w=r;else{if(i=e.line,l=e.lineStart,c=e.position,!cr(e,n,Vf,!1,!0))break;if(e.line===s){for(w=e.input.charCodeAt(e.position);Rn(w);)w=e.input.charCodeAt(++e.position);if(w===58)w=e.input.charCodeAt(++e.position),vt(w)||ce(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(er(e,p,m,h,x,null,i,l,c),h=x=g=null),b=!0,v=!1,o=!1,h=e.tag,x=e.result;else if(b)ce(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=f,!0}else if(b)ce(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=f,!0}if((e.line===s||e.lineIndent>t)&&(v&&(i=e.line,l=e.lineStart,c=e.position),cr(e,t,ko,!0,o)&&(v?x=e.result:g=e.result),v||(er(e,p,m,h,x,g,i,l,c),h=x=g=null),We(e,!0,-1),w=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&w!==0)ce(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&er(e,p,m,h,x,null,i,l,c),b&&(e.tag=d,e.anchor=f,e.kind="mapping",e.result=p),b}function sS(e){var t,n=!1,r=!1,o,s,i;if(i=e.input.charCodeAt(e.position),i!==33)return!1;if(e.tag!==null&&ce(e,"duplication of a tag property"),i=e.input.charCodeAt(++e.position),i===60?(n=!0,i=e.input.charCodeAt(++e.position)):i===33?(r=!0,o="!!",i=e.input.charCodeAt(++e.position)):o="!",t=e.position,n){do i=e.input.charCodeAt(++e.position);while(i!==0&&i!==62);e.position<e.length?(s=e.input.slice(t,e.position),i=e.input.charCodeAt(++e.position)):ce(e,"unexpected end of the stream within a verbatim tag")}else{for(;i!==0&&!vt(i);)i===33&&(r?ce(e,"tag suffix cannot contain exclamation marks"):(o=e.input.slice(t-1,e.position+1),Kf.test(o)||ce(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),i=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),Yy.test(s)&&ce(e,"tag suffix cannot contain flow indicator characters")}s&&!qf.test(s)&&ce(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{ce(e,"tag name is malformed: "+s)}return n?e.tag=s:En.call(e.tagMap,o)?e.tag=e.tagMap[o]+s:o==="!"?e.tag="!"+s:o==="!!"?e.tag="tag:yaml.org,2002:"+s:ce(e,'undeclared tag handle "'+o+'"'),!0}function iS(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&ce(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!vt(n)&&!Qn(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&ce(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function aS(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!vt(r)&&!Qn(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&ce(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),En.call(e.anchorMap,n)||ce(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],We(e,!0,-1),!0}function cr(e,t,n,r,o){var s,i,l,c=1,d=!1,f=!1,p,m,h,x,g,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=i=l=ko===n||Yf===n,r&&We(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;sS(e)||iS(e);)We(e,!0,-1)?(d=!0,l=s,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||o),(c===1||ko===n)&&(No===n||Vf===n?g=t:g=t+1,v=e.position-e.lineStart,c===1?l&&(Cl(e,v)||oS(e,v,g))||nS(e,g)?f=!0:(i&&rS(e,g)||eS(e,g)||tS(e,g)?f=!0:aS(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&ce(e,"alias node should not have any properties")):Qy(e,g,No===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=l&&Cl(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&ce(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,m=e.implicitTypes.length;p<m;p+=1)if(x=e.implicitTypes[p],x.resolve(e.result)){e.result=x.construct(e.result),e.tag=x.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(En.call(e.typeMap[e.kind||"fallback"],e.tag))x=e.typeMap[e.kind||"fallback"][e.tag];else for(x=null,h=e.typeMap.multi[e.kind||"fallback"],p=0,m=h.length;p<m;p+=1)if(e.tag.slice(0,h[p].tag.length)===h[p].tag){x=h[p];break}x||ce(e,"unknown tag !<"+e.tag+">"),e.result!==null&&x.kind!==e.kind&&ce(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+x.kind+'", not "'+e.kind+'"'),x.resolve(e.result,e.tag)?(e.result=x.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):ce(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function lS(e){var t=e.position,n,r,o,s=!1,i;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(i=e.input.charCodeAt(e.position))!==0&&(We(e,!0,-1),i=e.input.charCodeAt(e.position),!(e.lineIndent>0||i!==37));){for(s=!0,i=e.input.charCodeAt(++e.position),n=e.position;i!==0&&!vt(i);)i=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),o=[],r.length<1&&ce(e,"directive name must not be less than one character in length");i!==0;){for(;Rn(i);)i=e.input.charCodeAt(++e.position);if(i===35){do i=e.input.charCodeAt(++e.position);while(i!==0&&!Jt(i));break}if(Jt(i))break;for(n=e.position;i!==0&&!vt(i);)i=e.input.charCodeAt(++e.position);o.push(e.input.slice(n,e.position))}i!==0&&ea(e),En.call(yl,r)?yl[r](e,r,o):_o(e,'unknown document directive "'+r+'"')}if(We(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,We(e,!0,-1)):s&&ce(e,"directives end mark is expected"),cr(e,e.lineIndent-1,ko,!1,!0),We(e,!0,-1),e.checkLineBreaks&&Vy.test(e.input.slice(t,e.position))&&_o(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&is(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,We(e,!0,-1));return}if(e.position<e.length-1)ce(e,"end of the stream or a document separator is expected");else return}function Qf(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
314
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new Jy(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,ce(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)lS(n);return n.documents}function cS(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=Qf(e,n);if(typeof t!="function")return r;for(var o=0,s=r.length;o<s;o+=1)t(r[o])}function uS(e,t){var n=Qf(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new ct("expected a single document in the stream, but found more")}}var dS=cS,fS=uS,ep={loadAll:dS,load:fS},tp=Object.prototype.toString,np=Object.prototype.hasOwnProperty,na=65279,pS=9,zr=10,mS=13,hS=32,gS=33,xS=34,ri=35,vS=37,wS=38,bS=39,yS=42,rp=44,SS=45,Io=58,CS=61,ES=62,TS=63,AS=64,op=91,sp=93,NS=96,ip=123,kS=124,ap=125,rt={};rt[0]="\\0";rt[7]="\\a";rt[8]="\\b";rt[9]="\\t";rt[10]="\\n";rt[11]="\\v";rt[12]="\\f";rt[13]="\\r";rt[27]="\\e";rt[34]='\\"';rt[92]="\\\\";rt[133]="\\N";rt[160]="\\_";rt[8232]="\\L";rt[8233]="\\P";var _S=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],IS=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function jS(e,t){var n,r,o,s,i,l,c;if(t===null)return{};for(n={},r=Object.keys(t),o=0,s=r.length;o<s;o+=1)i=r[o],l=String(t[i]),i.slice(0,2)==="!!"&&(i="tag:yaml.org,2002:"+i.slice(2)),c=e.compiledTypeMap.fallback[i],c&&np.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[i]=l;return n}function MS(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new ct("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+Ve.repeat("0",r-t.length)+t}var RS=1,$r=2;function PS(e){this.schema=e.schema||Qi,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Ve.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=jS(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?$r:RS,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function El(e,t){for(var n=Ve.repeat(" ",t),r=0,o=-1,s="",i,l=e.length;r<l;)o=e.indexOf(`
|
|
315
|
-
`,r),o===-1?(i=e.slice(r),r=l):(i=e.slice(r,o+1),r=o+1),i.length&&i!==`
|
|
316
|
-
`&&(s+=n),s+=i;return s}function oi(e,t){return`
|
|
317
|
-
`+Ve.repeat(" ",e.indent*t)}function LS(e,t){var n,r,o;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(o=e.implicitTypes[n],o.resolve(t))return!0;return!1}function jo(e){return e===hS||e===pS}function Br(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==na||65536<=e&&e<=1114111}function Tl(e){return Br(e)&&e!==na&&e!==mS&&e!==zr}function Al(e,t,n){var r=Tl(e),o=r&&!jo(e);return(n?r:r&&e!==rp&&e!==op&&e!==sp&&e!==ip&&e!==ap)&&e!==ri&&!(t===Io&&!o)||Tl(t)&&!jo(t)&&e===ri||t===Io&&o}function DS(e){return Br(e)&&e!==na&&!jo(e)&&e!==SS&&e!==TS&&e!==Io&&e!==rp&&e!==op&&e!==sp&&e!==ip&&e!==ap&&e!==ri&&e!==wS&&e!==yS&&e!==gS&&e!==kS&&e!==CS&&e!==ES&&e!==bS&&e!==xS&&e!==vS&&e!==AS&&e!==NS}function OS(e){return!jo(e)&&e!==Io}function Mr(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function lp(e){var t=/^\n* /;return t.test(e)}var cp=1,si=2,up=3,dp=4,Zn=5;function FS(e,t,n,r,o,s,i,l){var c,d=0,f=null,p=!1,m=!1,h=r!==-1,x=-1,g=DS(Mr(e,0))&&OS(Mr(e,e.length-1));if(t||i)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Mr(e,c),!Br(d))return Zn;g=g&&Al(d,f,l),f=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=Mr(e,c),d===zr)p=!0,h&&(m=m||c-x-1>r&&e[x+1]!==" ",x=c);else if(!Br(d))return Zn;g=g&&Al(d,f,l),f=d}m=m||h&&c-x-1>r&&e[x+1]!==" "}return!p&&!m?g&&!i&&!o(e)?cp:s===$r?Zn:si:n>9&&lp(e)?Zn:i?s===$r?Zn:si:m?dp:up}function zS(e,t,n,r,o){e.dump=(function(){if(t.length===0)return e.quotingType===$r?'""':"''";if(!e.noCompatMode&&(_S.indexOf(t)!==-1||IS.test(t)))return e.quotingType===$r?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,n),i=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(d){return LS(e,d)}switch(FS(t,l,e.indent,i,c,e.quotingType,e.forceQuotes&&!r,o)){case cp:return t;case si:return"'"+t.replace(/'/g,"''")+"'";case up:return"|"+Nl(t,e.indent)+kl(El(t,s));case dp:return">"+Nl(t,e.indent)+kl(El($S(t,i),s));case Zn:return'"'+BS(t)+'"';default:throw new ct("impossible error: invalid scalar style")}})()}function Nl(e,t){var n=lp(e)?String(t):"",r=e[e.length-1]===`
|
|
318
|
-
`,o=r&&(e[e.length-2]===`
|
|
319
|
-
`||e===`
|
|
320
|
-
`),s=o?"+":r?"":"-";return n+s+`
|
|
321
|
-
`}function kl(e){return e[e.length-1]===`
|
|
322
|
-
`?e.slice(0,-1):e}function $S(e,t){for(var n=/(\n+)([^\n]*)/g,r=(function(){var d=e.indexOf(`
|
|
323
|
-
`);return d=d!==-1?d:e.length,n.lastIndex=d,_l(e.slice(0,d),t)})(),o=e[0]===`
|
|
324
|
-
`||e[0]===" ",s,i;i=n.exec(e);){var l=i[1],c=i[2];s=c[0]===" ",r+=l+(!o&&!s&&c!==""?`
|
|
325
|
-
`:"")+_l(c,t),o=s}return r}function _l(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,o=0,s,i=0,l=0,c="";r=n.exec(e);)l=r.index,l-o>t&&(s=i>o?i:l,c+=`
|
|
326
|
-
`+e.slice(o,s),o=s+1),i=l;return c+=`
|
|
327
|
-
`,e.length-o>t&&i>o?c+=e.slice(o,i)+`
|
|
328
|
-
`+e.slice(i+1):c+=e.slice(o),c.slice(1)}function BS(e){for(var t="",n=0,r,o=0;o<e.length;n>=65536?o+=2:o++)n=Mr(e,o),r=rt[n],!r&&Br(n)?(t+=e[o],n>=65536&&(t+=e[o+1])):t+=r||MS(n);return t}function US(e,t,n){var r="",o=e.tag,s,i,l;for(s=0,i=n.length;s<i;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(pn(e,t,l,!1,!1)||typeof l>"u"&&pn(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=o,e.dump="["+r+"]"}function Il(e,t,n,r){var o="",s=e.tag,i,l,c;for(i=0,l=n.length;i<l;i+=1)c=n[i],e.replacer&&(c=e.replacer.call(n,String(i),c)),(pn(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&pn(e,t+1,null,!0,!0,!1,!0))&&((!r||o!=="")&&(o+=oi(e,t)),e.dump&&zr===e.dump.charCodeAt(0)?o+="-":o+="- ",o+=e.dump);e.tag=s,e.dump=o||"[]"}function HS(e,t,n){var r="",o=e.tag,s=Object.keys(n),i,l,c,d,f;for(i=0,l=s.length;i<l;i+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=s[i],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),pn(e,t,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),pn(e,t,d,!1,!1)&&(f+=e.dump,r+=f));e.tag=o,e.dump="{"+r+"}"}function WS(e,t,n,r){var o="",s=e.tag,i=Object.keys(n),l,c,d,f,p,m;if(e.sortKeys===!0)i.sort();else if(typeof e.sortKeys=="function")i.sort(e.sortKeys);else if(e.sortKeys)throw new ct("sortKeys must be a boolean or a function");for(l=0,c=i.length;l<c;l+=1)m="",(!r||o!=="")&&(m+=oi(e,t)),d=i[l],f=n[d],e.replacer&&(f=e.replacer.call(n,d,f)),pn(e,t+1,d,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&zr===e.dump.charCodeAt(0)?m+="?":m+="? "),m+=e.dump,p&&(m+=oi(e,t)),pn(e,t+1,f,!0,p)&&(e.dump&&zr===e.dump.charCodeAt(0)?m+=":":m+=": ",m+=e.dump,o+=m));e.tag=s,e.dump=o||"{}"}function jl(e,t,n){var r,o,s,i,l,c;for(o=n?e.explicitTypes:e.implicitTypes,s=0,i=o.length;s<i;s+=1)if(l=o[s],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(c=e.styleMap[l.tag]||l.defaultStyle,tp.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(np.call(l.represent,c))r=l.represent[c](t,c);else throw new ct("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function pn(e,t,n,r,o,s,i){e.tag=null,e.dump=n,jl(e,n,!1)||jl(e,n,!0);var l=tp.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=l==="[object Object]"||l==="[object Array]",p,m;if(f&&(p=e.duplicates.indexOf(n),m=p!==-1),(e.tag!==null&&e.tag!=="?"||m||e.indent!==2&&t>0)&&(o=!1),m&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(f&&m&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(WS(e,t,e.dump,o),m&&(e.dump="&ref_"+p+e.dump)):(HS(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!i&&t>0?Il(e,t-1,e.dump,o):Il(e,t,e.dump,o),m&&(e.dump="&ref_"+p+e.dump)):(US(e,t,e.dump),m&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&zS(e,e.dump,t,s,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new ct("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function GS(e,t){var n=[],r=[],o,s;for(ii(e,n,r),o=0,s=r.length;o<s;o+=1)t.duplicates.push(n[r[o]]);t.usedDuplicates=new Array(s)}function ii(e,t,n){var r,o,s;if(e!==null&&typeof e=="object")if(o=t.indexOf(e),o!==-1)n.indexOf(o)===-1&&n.push(o);else if(t.push(e),Array.isArray(e))for(o=0,s=e.length;o<s;o+=1)ii(e[o],t,n);else for(r=Object.keys(e),o=0,s=r.length;o<s;o+=1)ii(e[r[o]],t,n)}function VS(e,t){t=t||{};var n=new PS(t);n.noRefs||GS(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),pn(n,0,r,!0,!0)?n.dump+`
|
|
329
|
-
`:""}var YS=VS,KS={dump:YS};function ra(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var qS=Je,XS=Nf,ZS=jf,JS=Df,QS=Of,eC=Qi,tC=ep.load,nC=ep.loadAll,rC=KS.dump,oC=ct,sC={binary:Uf,float:Lf,map:If,null:Mf,pairs:Wf,set:Gf,timestamp:$f,bool:Rf,int:Pf,merge:Bf,omap:Hf,seq:_f,str:kf},iC=ra("safeLoad","load"),aC=ra("safeLoadAll","loadAll"),lC=ra("safeDump","dump"),cC={Type:qS,Schema:XS,FAILSAFE_SCHEMA:ZS,JSON_SCHEMA:JS,CORE_SCHEMA:QS,DEFAULT_SCHEMA:eC,load:tC,loadAll:nC,dump:rC,YAMLException:oC,types:sC,safeLoad:iC,safeLoadAll:aC,safeDump:lC};const uC=({content:e,rendererType:t,setRenderError:n})=>{const[r,o]=u.useState(!1);u.useEffect(()=>{n(null)},[e,n]);const[s,i]=u.useMemo(()=>{try{if(t==="yaml"){const l=cC.load(e);return[e,l]}else if(t==="json"){const l=JSON.parse(e);return[JSON.stringify(l,null,2),l]}throw new Error(`Unsupported renderer type: ${t}`)}catch(l){const c=t==="yaml"?"YAML":"JSON";console.error(`Error parsing ${c} for panel:`,l);const d={[`${c}_Parsing_Error`]:`The provided content is not valid ${c}.`,Details:l.message,Content_Snippet:e.substring(0,500)+(e.length>500?"...":"")};return n(`${c} parsing failed: ${l.message}`),[e,d]}},[e,t,n]);return a.jsxs("div",{className:"flex flex-col h-full overflow-hidden bg-background relative",children:[a.jsx("div",{className:"absolute top-4 right-4 z-10",children:a.jsx(Ae,{onClick:()=>o(!r),title:r?"Show Structured View":"Show Raw Text",children:r?a.jsxs(a.Fragment,{children:[a.jsx(Hl,{})," Structured"]}):a.jsxs(a.Fragment,{children:[a.jsx(Wl,{})," Raw Text"]})})}),a.jsx("div",{className:"flex min-h-0 flex-col",children:a.jsx("div",{className:"flex-1 overflow-auto",children:r?a.jsx(fp,{content:s,setRenderError:n}):a.jsx(fi,{data:i,maxDepth:4,className:"min-h-16 border-none p-2"})})})]})},fp=({content:e,className:t=""})=>{const{ref:n,handleKeyDown:r}=vf();return a.jsx("div",{className:`p-4 overflow-auto ${t}`,children:a.jsx("pre",{ref:n,className:"whitespace-pre-wrap focus-visible:outline-none select-text",style:{overflowWrap:"anywhere"},tabIndex:0,onKeyDown:r,children:e})})},pp=({content:e,rendererType:t,mime_type:n,setRenderError:r})=>{switch(t){case"csv":return a.jsx(vb,{content:e,setRenderError:r});case"mermaid":return a.jsx(Hb,{content:e,setRenderError:r});case"html":return a.jsx(wb,{content:e,setRenderError:r});case"json":case"yaml":return a.jsx(uC,{content:e,rendererType:t,setRenderError:r});case"image":return a.jsx(bb,{content:e,mime_type:n,setRenderError:r});case"markdown":return a.jsx(yb,{content:e,setRenderError:r});case"audio":return a.jsx(gb,{content:e,mime_type:n,setRenderError:r});default:return a.jsx(fp,{content:e,setRenderError:r})}},dC={"application/pdf":"pdf","application/zip":"zip","application/msword":"doc","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.ms-excel":"xls","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","application/vnd.ms-powerpoint":"ppt","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","text/plain":"txt","text/csv":"csv","text/html":"html","text/markdown":"md","text/x-markdown":"md","application/json":"json","application/yaml":"yaml","text/yaml":"yaml","application/xml":"xml","text/xml":"xml","image/jpeg":"jpg","image/png":"png","image/gif":"gif","image/svg+xml":"svg","image/webp":"webp","image/bmp":"bmp","image/tiff":"tiff","audio/mpeg":"mp3","audio/wav":"wav","audio/ogg":"ogg","audio/aac":"aac","audio/flac":"flac","audio/x-m4a":"m4a","video/mp4":"mp4","video/webm":"webm","video/ogg":"ogv","application/javascript":"js","application/gzip":"gz","application/x-tar":"tar","application/rtf":"rtf"};function fC(e,t){const n=dC[e]||"bin";return`embedded_file_${t+1}.${n}`}function pC(e){if(!e||typeof e!="string")return[];const t=[],n=/data:([a-zA-Z0-9/.-]+);base64,([A-Za-z0-9+/=]+)/g;let r,o=0;for(;(r=n.exec(e))!==null;){const[s,i,l]=r,c=e[r.index-1],d=e[r.index+s.length];if(!(c==='"'&&d==='"'||c==="'"&&d==="'")&&l&&l.length>10){const f=qr(void 0,i);f?t.push({type:f,content:l,mimeType:i,originalMatch:s}):t.push({type:"file",content:l,mimeType:i,originalMatch:s,filename:fC(i,o++)})}}return t}function mC(e){if(!e||typeof e!="string")return[];const t=[],n=/<html[\s\S]*?<\/html>/gi;let r;for(;(r=n.exec(e))!==null;)t.push({type:"html",content:r[0].trim(),originalMatch:r[0]});return t}function hC(e){if(!e||typeof e!="string")return[];const t=[],n=/```mermaid\s*\n([\s\S]*?)```/gi;let r;for(;(r=n.exec(e))!==null;){const[o,s]=r;t.push({type:"mermaid",content:s.trim(),originalMatch:o})}return t}function gC(e){return!e||typeof e!="string"?[]:[...pC(e),...mC(e),...hC(e)]}const xC=["image","audio"],vC=({message:e})=>{var d;const[t,n]=u.useState(null);if(e.isStatusBubble)return null;const r=(d=e.parts)==null?void 0:d.filter(f=>f.kind==="text"),o=(r==null?void 0:r.map(f=>f.text).join(""))||"";if(e.isUser)return a.jsx("span",{children:o});const s=o.trim();if(!s)return null;if(e.isError)return a.jsxs("div",{className:"flex items-center",children:[a.jsx(gi,{className:"mr-2 self-start text-[var(--color-error-wMain)]"}),a.jsx(or,{children:s})]});const i=gC(s);if(i.length===0)return a.jsx(or,{children:s});let l=s;const c=[];return i.forEach((f,p)=>{if(l=l.replace(f.originalMatch,""),f.type==="file"){const m={name:f.filename||"downloaded_file",content:f.content,mime_type:f.mimeType};c.push(a.jsx("div",{className:"my-2",children:a.jsx(gf,{fileAttachment:m,isEmbedded:!0})},`embedded-file-${p}`))}else if(!xC.includes(f.type)){const m=ff(f.content);m&&c.push(a.jsx("div",{className:"my-2 h-auto w-md max-w-md overflow-hidden",children:a.jsx(pp,{content:m,rendererType:f.type,mime_type:f.mimeType,setRenderError:n})},`embedded-${p}`))}}),a.jsxs("div",{children:[t&&a.jsx(oa,{variant:"error",message:"Error rendering preview"}),a.jsx(or,{children:l}),c]})},mp=({message:e,children:t,className:n})=>a.jsx("div",{className:`mt-1 space-y-1 ${e.isUser?"ml-auto":"mr-auto"} ${n}`,children:t}),wC=e=>e.uploadedFiles&&e.uploadedFiles.length>0?a.jsx(mp,{message:e,className:"flex flex-wrap justify-end gap-2",children:e.uploadedFiles.map((t,n)=>{var r;return a.jsx(xf,{filename:t.name,mimeType:t.type},`uploaded-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,bC=e=>e.files&&e.files.length>0?a.jsx(mp,{message:e,children:e.files.map((t,n)=>{var r;return a.jsx(gf,{fileAttachment:t},`file-${(r=e.metadata)==null?void 0:r.messageId}-${n}`)})}):null,yC=(e,t,n)=>{var d,f;const{openSidePanelTab:r,setTaskIdInSidePanel:o}=t;if(e.isStatusBubble)return null;const s=(d=e.parts)==null?void 0:d.some(p=>p.kind==="text"&&p.text.trim());if(!s&&!e.artifactNotification)return null;const i=e.isUser?"sent":"received",l=!e.isUser&&e.isComplete&&!!e.taskId&&n,c=()=>{e.taskId&&(o(e.taskId),r("workflow"))};return a.jsx(af,{variant:i,children:a.jsxs(lf,{variant:i,children:[s&&a.jsx(vC,{message:e}),e.artifactNotification&&a.jsxs("div",{className:"flex items-center p-2 my-1 bg-blue-100 dark:bg-blue-900/50 rounded-md",children:[a.jsx(sr,{className:"mr-2 text-blue-500 dark:text-blue-400"}),a.jsxs("span",{className:"text-sm",children:["Artifact created: ",a.jsx("strong",{children:e.artifactNotification.name}),e.artifactNotification.version&&` (v${e.artifactNotification.version})`]})]}),l&&a.jsx("div",{className:"mt-3",children:a.jsx(Kc,{onClick:c})})]})},(f=e.metadata)==null?void 0:f.messageId)},SC=({message:e,isLastWithTaskId:t})=>{const n=Ue();return e?a.jsxs(a.Fragment,{children:[yC(e,n,t),wC(e),bC(e)]}):null},CC=()=>{const{handleSwitchSession:e,updateSessionName:t,openSessionDeleteModal:n}=Ue(),{configServerUrl:r}=tn();Yu();const o=`${r}/api/v1`,[s,i]=u.useState([]),[l,c]=u.useState(null),[d,f]=u.useState(""),p=u.useRef(null),m=async()=>{const y=`${o}/sessions`;try{const E=await ze(y);if(E.ok){const T=await E.json();i(T.sessions||[])}else console.error(`Failed to fetch sessions: ${E.status} ${E.statusText}`)}catch(E){console.error("An error occurred while fetching sessions:",E)}};u.useEffect(()=>{m();const y=()=>{m()},E=T=>{const{sessionId:_}=T.detail;i(I=>{const A=I.find(q=>q.id===_);if(A){const q=I.filter(K=>K.id!==_);return[A,...q]}return I})};return window.addEventListener("new-chat-session",y),window.addEventListener("session-updated",E),()=>{window.removeEventListener("new-chat-session",y),window.removeEventListener("session-updated",E)}},[o]),u.useEffect(()=>{l&&p.current&&p.current.focus()},[l]);const h=async y=>{l!==y&&await e(y)},x=y=>{c(y.id),f(y.name||"")},g=async()=>{l&&(await t(l,d),c(null),m())},v=y=>{n(y)},b=y=>new Date(y).toLocaleString(),w=y=>{if(y.name&&y.name.trim())return y.name;const E=y.id;return E.startsWith("web-session-")?`Chat ${E.replace("web-session-","").substring(0,8)}`:`Session ${E.substring(0,8)}`};return a.jsxs("div",{className:"p-4",children:[a.jsx("h2",{className:"text-lg font-bold mb-4",children:"Chat History"}),a.jsx("ul",{children:s.map(y=>a.jsx("li",{className:"mb-2 group",children:a.jsxs("div",{className:"flex items-center justify-between p-2 rounded hover:bg-gray-200 dark:hover:bg-gray-700",children:[l===y.id?a.jsx("input",{ref:p,type:"text",value:d,onChange:E=>f(E.target.value),onKeyDown:E=>E.key==="Enter"&&g(),onBlur:g,className:"flex-grow bg-transparent focus:outline-none"}):a.jsx("button",{onClick:()=>h(y.id),className:"flex-grow text-left",children:a.jsxs("div",{className:"flex flex-col",children:[a.jsx("span",{className:"font-semibold",children:w(y)}),a.jsx("span",{className:"text-xs text-gray-500",children:b(y.updated_at)})]})}),a.jsx("div",{className:"flex items-center opacity-0 group-hover:opacity-100 transition-opacity",children:l===y.id?a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:g,className:"p-1 hover:bg-gray-300 dark:hover:bg-gray-700 rounded",children:a.jsx(mi,{size:16})}),a.jsx("button",{onClick:()=>c(null),className:"p-1 hover:bg-gray-300 dark:hover:bg-gray-700 rounded",children:a.jsx(Ro,{size:16})})]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{onClick:()=>x(y),className:"p-1 hover:bg-gray-300 dark:hover:bg-gray-700 rounded",children:a.jsx(vi,{size:16})}),a.jsx("button",{onClick:()=>v(y),className:"p-1 hover:bg-gray-300 dark:hover:bg-gray-700 rounded",children:a.jsx(zp,{size:16})})]})})]})},y.id))})]})},EC=()=>{const{persistenceEnabled:e}=tn(),t=Xu();return e===!1?a.jsx("div",{className:"flex h-full flex-col",children:a.jsxs("div",{className:"flex-1 overflow-y-auto px-4",children:[a.jsxs("div",{className:"bg-accent/50 hover:bg-accent mb-3 cursor-pointer rounded-md p-3",children:[a.jsx("div",{className:"text-foreground truncate text-sm font-medium text-nowrap",children:t}),a.jsx("div",{className:"text-muted-foreground mt-1 text-xs",children:"Current session"})]}),a.jsx("div",{className:"text-muted-foreground mt-4 text-center text-xs",children:"Multi-session support coming soon"})]})}):a.jsx("div",{className:"flex h-full flex-col",children:a.jsx("div",{className:"flex-1 overflow-y-auto px-4",children:a.jsx(CC,{})})})},TC=({artifactInfo:e,isPreview:t=!1,isExpanded:n=!1,onDelete:r,onDownload:o,setIsExpanded:s})=>{const{previewedArtifactAvailableVersions:i,currentPreviewedVersionNumber:l,navigateArtifactVersion:c}=Ue(),d=u.useMemo(()=>i??[],[i]);return a.jsxs("div",{className:"flex flex-row justify-between gap-1",children:[a.jsxs("div",{className:"flex items-center gap-4 min-w-0",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"truncate text-sm",title:e.filename,children:e.filename}),a.jsx("div",{className:"truncate text-xs",title:Ta(e.last_modified),children:Ta(e.last_modified)})]}),t&&d.length>1&&a.jsx("div",{className:"align-right",children:a.jsxs(Fd,{value:l==null?void 0:l.toString(),onValueChange:f=>{c(e.filename,parseInt(f))},children:[a.jsx($d,{className:"h-[16px] py-0 text-xs shadow-none",children:a.jsx(zd,{placeholder:"Version"})}),a.jsx(Bd,{children:d.map(f=>a.jsxs(Ud,{value:f.toString(),children:["Version ",f]},f))})]})})]}),a.jsxs("div",{className:`whitespace-nowrap ${t?"opacity-100":"opacity-0 transition-opacity duration-150 group-focus-within:opacity-100 group-hover:opacity-100"}`,children:[s&&a.jsx(Ae,{variant:"ghost",size:"sm",onClick:f=>{f.stopPropagation(),f.preventDefault(),s(!n)},tooltip:n?"Collapse Details":"Expand Details",children:a.jsx(wi,{})}),o&&a.jsx(Ae,{variant:"ghost",size:"sm",onClick:async f=>{f.stopPropagation(),f.preventDefault(),await o(e)},tooltip:"Download",children:a.jsx(xi,{})}),r&&a.jsx(Ae,{variant:"ghost",size:"sm",onClick:f=>{f.preventDefault(),f.stopPropagation(),r(e)},tooltip:"Delete",children:a.jsx(Gl,{})})]})]})},Ml=({artifact:e,isPreview:t})=>{const{openDeleteModal:n,setPreviewArtifact:r}=Ue(),{onDownload:o}=qu(),[s,i]=u.useState(!1),l=()=>{t&&r(null),n(e)},c=d=>{if(!d||typeof d=="object"&&Object.keys(d).length===0)return a.jsx("span",{children:"Not available"});const f=(p,m=0)=>typeof p=="string"?a.jsx("span",{children:p}):Array.isArray(p)?a.jsxs(a.Fragment,{children:["[",p.length>0&&f(p[0],m+1),p.length>1&&a.jsx("span",{children:", ..."}),"]"]}):typeof p=="object"&&p!==null?a.jsx("div",{className:`ml-${m*2} border-l pl-2`,children:Object.entries(p).map(([h,x],g)=>a.jsxs("div",{className:"text-xs",children:[a.jsxs("span",{className:"font-semibold",children:[h,":"]})," ",f(x,m+1)]},g))}):String(p);return a.jsxs("div",{className:"mt-1 space-y-0.5",children:[typeof d=="object"&&d.type&&a.jsxs("p",{children:[a.jsx("strong",{children:"Type:"})," ",d.type," ",d.inferred&&a.jsx("span",{className:"text-xs",children:"(inferred)"})]}),typeof d=="object"&&d.columns&&a.jsxs("p",{children:[a.jsx("strong",{children:"Columns:"})," ",d.columns.join(", ")]}),typeof d=="object"&&d.structure&&a.jsxs("div",{children:[a.jsx("strong",{children:"Structure:"}),f(d.structure)]}),typeof d=="object"&&d.error&&a.jsxs("p",{className:"text-[var(--color-error-wMain)]",children:[a.jsx("strong",{children:"Schema Error:"})," ",d.error]}),typeof d=="string"&&a.jsx("p",{children:d})]})};return a.jsx("div",{className:`group relative w-full border-b px-4 py-3 transition-all duration-150 ${t?"":"cursor-pointer hover:bg-[var(--accent-background)]"}`,onClick:d=>{d.stopPropagation(),r(e)},onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),d.stopPropagation(),r(e))},tabIndex:0,role:"button","aria-expanded":s,children:a.jsxs("div",{className:"flex items-start space-x-2",children:[a.jsx("div",{className:"flex-shrink-0 pt-0.5",children:hf(e,"h-4 w-4 flex-shrink-0")}),a.jsxs("div",{className:"min-w-0 flex-grow",children:[a.jsx(TC,{artifactInfo:e,isExpanded:s,onDelete:l,onDownload:o,setIsExpanded:i,isPreview:t}),s&&a.jsxs("div",{className:"text-xs",children:[a.jsx("div",{className:"mt-1 text-xs break-words whitespace-pre-wrap italic",children:e.description||"No description."}),a.jsxs("div",{className:"mt-2 space-y-1 pt-2",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Size: "}),fc(e.size)]}),e.uri&&a.jsxs("div",{children:[a.jsx("strong",{children:"URI: "}),a.jsx("span",{className:"break-all",children:e.uri||"None"})]}),e.schema&&a.jsx("div",{children:c(e.schema)})]})]})]})]})})},AC=()=>{const{isDeleteModalOpen:e,artifactToDelete:t,closeDeleteModal:n,confirmDelete:r}=Ue();return!e||!t?null:a.jsx(Go,{open:e,onOpenChange:n,children:a.jsxs(Vo,{children:[a.jsxs(Yo,{children:[a.jsxs(Ko,{className:"flex flex-row gap-1 max-w-[400px]",children:["Delete",a.jsx("span",{className:"inline-block truncate",title:t.filename,children:a.jsx("code",{children:t.filename})}),"?"]}),a.jsx(qo,{className:"flex flex-col gap-2",children:a.jsx("div",{children:"This file will be permanently deleted. "})})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ae,{variant:"outline",onClick:n,children:"Cancel"}),a.jsx(Ae,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})})},NC={replace:e=>{e instanceof Up.Element&&e.attribs&&e.name==="a"&&(e.attribs.target="_blank",e.attribs.rel="noopener noreferrer")}};function or({children:e,className:t}){if(!e)return null;try{const n=$p.parse(e,{gfm:!0}),r=Ef.sanitize(n,{USE_PROFILES:{html:!0}}),o=Bp(r,NC);return a.jsx("div",{className:Aa(t),children:o})}catch{return a.jsx("div",{className:Aa(t),children:e})}}const kC=Tn("flex items-center gap-3 px-4 py-3 text-sm font-medium transition-all border-l-4 border-solid ",{variants:{variant:{error:"bg-[var(--color-error-w10)] text-[var(--color-error-wMain)] border-[var(--color-error-wMain)] dark:bg-[var(--color-error-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-error-w10)]",warning:"bg-[var(--color-warning-w10)] text-[var(--color-warning-wMain)] border-[var(--color-warning-wMain)] dark:bg-[var(--color-warning-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-warning-w10)]",info:"bg-[var(--color-info-w10)] text-[var(--color-info-wMain)] border-[var(--color-info-w10)] dark:bg-[var(--color-info-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-info-w10)]",success:"bg-[var(--color-success-w10)] text-[var(--color-success-wMain)] border-[var(--color-success-w10)] dark:bg-[var(--color-success-wMain)] dark:text-[var(--color-primary-text-w10)] dark:border-[var(--color-success-w10)]"}},defaultVariants:{variant:"error"}}),_C={error:gi,warning:Hp,info:wi,success:Vl};function oa({className:e,variant:t="error",message:n,dismissible:r=!1,onDismiss:o,...s}){const i=_C[t||"error"];return a.jsxs("div",{className:Ce(kC({variant:t,className:e})),role:"alert","aria-live":"polite",...s,children:[a.jsx(i,{className:"size-5 shrink-0"}),a.jsx("span",{className:"flex-1",children:n}),r&&o&&a.jsx(Ae,{variant:"ghost",onClick:o,"aria-label":"Dismiss",children:a.jsx(Ro,{className:"size-3"})})]})}const IC=({artifact:e,message:t})=>{const{onDownload:n}=qu();return a.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 p-4",children:[a.jsx("div",{className:"mb-1 font-semibold",children:"Preview Coming Soon"}),a.jsx("div",{children:t}),a.jsx("div",{className:"mb-4",children:"Download file to view."}),a.jsxs(Ae,{onClick:()=>n(e),children:[a.jsx(xi,{className:"h-4 w-4"}),"Download"]})]})},Ds=({children:e})=>a.jsx("div",{className:"text-muted-foreground flex h-[50vh] items-center justify-center",children:e||"No preview available"}),jC=({artifact:e})=>{const{openArtifactForPreview:t,previewFileContent:n}=Ue(),r=u.useMemo(()=>hb(e),[e]),[o,s]=u.useState(!1),[i,l]=u.useState(null);if(u.useEffect(()=>{s(!1),l(null)},[e]),u.useEffect(()=>{async function f(){try{s(!0),l(null),await t(e.filename)}catch(p){console.error("Error fetching artifact content:",p),l(p instanceof Error?p.message:"Failed to load artifact content")}finally{s(!1)}}r!=null&&r.canPreview&&f()},[e,t,r]),i)return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(oa,{variant:"error",message:"Error rendering preview"}),a.jsx(Ds,{children:"No preview available"})]});if(o)return a.jsx(Ds,{children:a.jsx(hi,{className:"text-muted-foreground h-6 w-6 animate-spin"})});if(!r.canPreview)return a.jsx(IC,{artifact:e,message:r.reason??""});const c=qr(e.filename,e.mime_type),d=pb(n);return!c||!d?a.jsx(Ds,{children:"No preview available"}):a.jsx(pp,{content:d,rendererType:c,mime_type:n==null?void 0:n.mime_type,setRenderError:l})},qt={NameAsc:"name_asc",NameDesc:"name_desc",DateAsc:"date_asc",DateDesc:"date_desc"},MC=e=>{switch(e){case qt.NameAsc:return"Name (A-Z)";case qt.NameDesc:return"Name (Z-A)";case qt.DateAsc:return"Date (oldest first)";case qt.DateDesc:return"Date (newest first)"}},RC=({currentSortOption:e,onSortChange:t,children:n})=>{const r=Object.values(qt).map(o=>({id:o,label:MC(o),onClick:()=>t(o),icon:e===o?a.jsx(mi,{}):void 0,iconPosition:"right"}));return a.jsxs(cd,{children:[a.jsx(ud,{asChild:!0,children:n}),a.jsx(dd,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:a.jsx(Ki,{actions:r})})]})},PC=({children:e})=>{const{artifactsRefetch:t,setIsBatchDeleteModalOpen:n}=Ue(),r=[{id:"refreshAll",label:"Refresh",onClick:()=>{t()},icon:a.jsx(Yl,{}),iconPosition:"left"},{id:"deleteAll",label:"Delete All",onClick:()=>{n(!0)},icon:a.jsx(Gl,{}),iconPosition:"left",divider:!0}];return a.jsxs(cd,{children:[a.jsx(ud,{asChild:!0,children:e}),a.jsx(dd,{align:"end",side:"bottom",className:"w-auto",sideOffset:0,children:a.jsx(Ki,{actions:r})})]})},LC=()=>{const{artifacts:e,isBatchDeleteModalOpen:t,setIsBatchDeleteModalOpen:n,confirmBatchDeleteArtifacts:r,setSelectedArtifactFilenames:o}=Ue();return u.useEffect(()=>{t&&o(new Set(e.map(s=>s.filename)))},[e,t,o]),t?a.jsx(Go,{open:t,onOpenChange:n,children:a.jsxs(Vo,{children:[a.jsxs(Yo,{children:[a.jsx(Ko,{children:"Delete All?"}),a.jsxs(qo,{children:[e.length===1?"One file":`All ${e.length} files`," will be permanently deleted."]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(Ae,{variant:"outline",onClick:()=>n(!1),children:"Cancel"}),a.jsx(Ae,{variant:"default",onClick:()=>r(),children:"Delete"})]})]})}):null},DC={[qt.NameAsc]:(e,t)=>e.filename.localeCompare(t.filename),[qt.NameDesc]:(e,t)=>t.filename.localeCompare(e.filename),[qt.DateAsc]:(e,t)=>e.last_modified>t.last_modified?1:-1,[qt.DateDesc]:(e,t)=>e.last_modified<t.last_modified?1:-1},OC=()=>{const{artifacts:e,artifactsLoading:t,previewArtifact:n,setPreviewArtifact:r}=Ue(),[o,s]=u.useState(qt.DateDesc),i=u.useMemo(()=>t?[]:e?[...e].sort(DC[o]):[],[e,t,o]),l=u.useMemo(()=>n?a.jsxs("div",{className:"flex items-center gap-2 border-b p-2",children:[a.jsx(Ae,{variant:"ghost",onClick:()=>r(null),children:a.jsx(Wp,{})}),a.jsx("div",{className:"text-md font-semibold",children:"Preview"})]}):i.length>0&&a.jsxs("div",{className:"flex items-center justify-end border-b p-2",children:[a.jsx(RC,{currentSortOption:o,onSortChange:s,children:a.jsxs(Ae,{variant:"ghost",title:"Sort By",children:[a.jsx(Bl,{className:"h-5 w-5"}),a.jsx("div",{children:"Sort By"})]})},"sort-popover"),a.jsx(PC,{children:a.jsx(Ae,{variant:"ghost",tooltip:"More",children:a.jsx(Gp,{className:"h-5 w-5"})})},"more-popover")]}),[n,i.length,o,r]);return a.jsxs("div",{className:"flex h-full flex-col",children:[l,a.jsxs("div",{className:"flex min-h-0 flex-1",children:[!n&&a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[i.map(c=>a.jsx(Ml,{artifact:c},c.filename)),i.length===0&&a.jsx("div",{className:"flex h-full items-center justify-center p-4",children:a.jsxs("div",{className:"text-muted-foreground text-center",children:[t&&a.jsx(hi,{className:"size-6 animate-spin"}),!t&&a.jsxs(a.Fragment,{children:[a.jsx(sr,{className:"mx-auto mb-4 h-12 w-12"}),a.jsx("div",{className:"text-lg font-medium",children:"Files"}),a.jsx("div",{className:"mt-2 text-sm",children:"No files available"})]})]})})]}),n&&a.jsxs("div",{className:"flex flex-1 flex-col gap-2 min-h-0 min-w-0",children:[a.jsx(Ml,{artifact:n,isPreview:!0},n.filename),a.jsx("div",{className:"flex-1 min-h-0 min-w-0 overflow-y-auto",children:a.jsx(jC,{artifact:n})})]})]}),a.jsx(AC,{}),a.jsx(LC,{})]})},FC=({onCollapsedToggle:e,isSidePanelCollapsed:t,setIsSidePanelCollapsed:n,isSidePanelTransitioning:r})=>{const{activeSidePanelTab:o,setActiveSidePanelTab:s,setPreviewArtifact:i,taskIdInSidePanel:l}=Ue(),{isReconnecting:c,isTaskMonitorConnecting:d,isTaskMonitorConnected:f,monitoredTasks:p,connectTaskMonitorStream:m}=Vi(),[h,x]=u.useState(null);u.useEffect(()=>{if(l&&p[l]){const y=p[l],E=wE(y.events||[],p,y);x(E)}else x(null)},[l,p]);const g=()=>c||d?{message:"Connecting to task monitor ...",showButton:!1}:f?l?h?null:{message:"No workflow data available for the selected task",showButton:!1}:{message:"No task selected to display",showButton:!1}:{message:"No connection to task monitor",showButton:!0,buttonText:"Reconnect",buttonIcon:Vp,buttonAction:m},v=()=>{const y=!t;n(y),e(y)},b=y=>{y==="files"&&i(null),s(y)},w=y=>{t&&(n(!1),e==null||e(!1)),b(y)};return t?a.jsxs("div",{className:"bg-background flex h-full w-full flex-col items-center border-l py-4",children:[a.jsx(Ae,{variant:"ghost",size:"sm",onClick:v,className:"h-10 w-10 p-0",tooltip:"Expand Panel",children:a.jsx(fa,{className:"size-5"})}),a.jsx("div",{className:"bg-border my-4 h-px w-8"}),a.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>w("files"),className:"mb-2 h-10 w-10 p-0",tooltip:"Files",children:a.jsx(sr,{className:"size-5"})}),a.jsx(Ae,{variant:"ghost",size:"sm",onClick:()=>w("workflow"),className:"h-10 w-10 p-0",tooltip:"Workflow",children:a.jsx(po,{className:"size-5"})})]}):a.jsx("div",{className:"bg-background flex h-full flex-col border-l",children:a.jsx("div",{className:"m-1 min-h-0 flex-1",children:a.jsxs(z0,{value:o,onValueChange:y=>b(y),className:"flex h-full flex-col",children:[a.jsxs("div",{className:"flex gap-2 p-2",children:[a.jsx(Ae,{variant:"ghost",onClick:v,className:"p-1",tooltip:"Collapse Panel",children:a.jsx(fa,{className:"size-5"})}),a.jsxs($0,{className:"grid w-full grid-cols-2 bg-transparent p-0",children:[a.jsxs(il,{value:"files",title:"Files",className:"border-border bg-muted data-[state=active]:bg-background relative cursor-pointer rounded-none rounded-l-md border border-r-0 data-[state=active]:z-10 data-[state=active]:border-r-0",children:[a.jsx(sr,{className:"mr-2 h-4 w-4"}),"Files"]}),a.jsxs(il,{value:"workflow",title:"Workflow",className:"border-border bg-muted data-[state=active]:bg-background relative cursor-pointer rounded-none rounded-r-md border border-l-0 data-[state=active]:z-10 data-[state=active]:border-l-0",children:[a.jsx(po,{className:"mr-2 h-4 w-4"}),"Workflow"]})]})]}),a.jsxs("div",{className:"min-h-0 flex-1",children:[a.jsx(al,{value:"files",className:"m-0 h-full",children:a.jsx("div",{className:"h-full",children:a.jsx(OC,{})})}),a.jsx(al,{value:"workflow",className:"m-0 h-full",children:a.jsx("div",{className:"h-full",children:(()=>{const y=g();return!y&&h?a.jsxs("div",{className:"flex h-full flex-col",children:[a.jsx(BC,{task:h}),a.jsx(vE,{processedSteps:h.steps||[],isRightPanelVisible:!1,isSidePanelTransitioning:r})]}):a.jsx("div",{className:"flex h-full items-center justify-center p-4",children:a.jsxs("div",{className:"text-muted-foreground text-center",children:[a.jsx(po,{className:"mx-auto mb-4 h-12 w-12"}),a.jsx("div",{className:"text-lg font-medium",children:"Workflow"}),a.jsx("div",{className:"mt-2 text-sm",children:y==null?void 0:y.message}),(y==null?void 0:y.showButton)&&a.jsx("div",{className:"mt-4",children:a.jsxs(Ae,{onClick:y.buttonAction,children:[y.buttonIcon&&(()=>{const E=y.buttonIcon;return a.jsx(E,{className:"h-4 w-4"})})(),y.buttonText]})})]})})})()})})]})]})})})},ai=({statusText:e,onViewWorkflow:t})=>a.jsxs("div",{className:"flex h-8 items-center space-x-3 py-1",children:[t?a.jsx(Kc,{onClick:t}):a.jsx(Y0,{className:"ml-2 mr-3"}),a.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-1",children:e&&a.jsx("span",{className:"text-muted-foreground animate-pulse truncate text-sm",title:e,children:e})})]}),hp=({isOpen:e,onClose:t})=>{const{handleNewSession:n}=Ue(),{persistenceEnabled:r}=tn();return a.jsx(Go,{open:e,onOpenChange:t,children:a.jsxs(Vo,{children:[a.jsxs(Yo,{children:[a.jsx(Ko,{className:"flex flex-row gap-1 max-w-[400px]",children:r===!1?"New Chat Session?":"Start New Chat Session?"}),a.jsx(qo,{className:"flex flex-col gap-2",children:r===!1?"Starting a new chat session will clear the current chat history and files. Are you sure you want to proceed?":"This will create a new chat session. Your current chat will be saved in the sessions panel."})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Ae,{variant:"outline",onClick:t,children:"Cancel"}),a.jsx(Ae,{variant:"default",onClick:()=>{n(),t()},children:"Start New Chat"})]})]})})},zC=({onToggle:e})=>{const[t,n]=u.useState(!1);return a.jsxs("div",{className:"bg-background flex h-full w-100 flex-col border-r",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 pt-[35px] pb-3",children:[a.jsx(Ae,{variant:"ghost",onClick:e,className:"p-2",tooltip:"Collapse Sessions Panel",children:a.jsx(Kl,{className:"size-5"})}),a.jsxs(Ae,{variant:"ghost",onClick:()=>n(!0),tooltip:"Start New Chat Session",children:[a.jsx(vi,{className:"size-5"}),"New chat"]})]}),a.jsx("div",{className:"mt-1 min-h-0 flex-1",children:a.jsx(EC,{})}),a.jsx(hp,{isOpen:t,onClose:()=>n(!1)})]})},Nr=(e,t)=>a.jsx(df,{type:t,className:"rounded-full border-none",children:a.jsx("span",{className:"text-xs font-semibold",title:e,children:e})}),$C=(e,t)=>{var r;if(e.currentStatusText)return a.jsx("div",{title:e.currentStatusText,children:a.jsx(ai,{statusText:e.currentStatusText})});const n=(r=t==null?void 0:t.parts)==null?void 0:r.filter(o=>o.kind==="text").map(o=>o.text).join("");switch(e.status){case"submitted":case"working":return a.jsx("div",{title:n||e.status,children:a.jsx(ai,{statusText:n||e.status})});case"input-required":return Nr("Input Required","info");case"completed":return Nr("Completed","success");case"canceled":return Nr("Canceled","info");case"failed":return Nr("Failed","error");default:return Nr("Unknown","info")}},BC=({task:e})=>{const{messages:t}=Ue(),n=u.useMemo(()=>{const r=t.find(o=>o.isStatusBubble);return e?$C(e,r):null},[t,e]);return e?a.jsxs("div",{className:"grid grid-cols-[auto_1fr] grid-rows-[32px_32px] gap-x-8 border-b p-4 leading-[32px]",children:[a.jsx("div",{className:"text-muted-foreground",children:"User"}),a.jsx("div",{className:"truncate",title:e.initialRequestText,children:e.initialRequestText}),a.jsx("div",{className:"text-muted-foreground",children:"Status"}),a.jsx("div",{className:"truncate",children:n})]}):null};class gp{getEdgeAnimationState(t,n,r){const o=r.find(l=>l.id===t);if(!o)return{isAnimated:!1,animationType:"static"};if(!this.isAgentToToolRequest(o))return{isAnimated:!1,animationType:"static"};const s=r.slice(0,n+1);return this.hasMatchingResponse(o,s)?{isAnimated:!1,animationType:"static"}:{isAnimated:!0,animationType:"request"}}isAgentToToolRequest(t){var n,r;switch(t.type){case"AGENT_LLM_CALL":return!0;case"AGENT_TOOL_INVOCATION_START":return!(((n=t.data.toolDecision)==null?void 0:n.isPeerDelegation)||((r=t.data.toolInvocationStart)==null?void 0:r.isPeerInvocation)||t.target&&t.target.startsWith("peer_"));default:return!1}}hasMatchingResponse(t,n){switch(t.type){case"AGENT_LLM_CALL":return this.hasLLMResponse(t,n);case"AGENT_TOOL_INVOCATION_START":return this.hasToolResponse(t,n);default:return!1}}hasLLMResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.source;return n.some(s=>{var f;if(new Date(s.timestamp).getTime()<r)return!1;const l=(s.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||s.type==="AGENT_LLM_RESPONSE_TO_AGENT")&&s.target===o,c=s.source===o&&(s.type==="AGENT_TOOL_INVOCATION_START"||s.type==="TASK_COMPLETED"),d=s.type==="AGENT_TOOL_EXECUTION_RESULT"&&((f=s.data.toolResult)==null?void 0:f.isPeerResponse);return l||c||d})}hasToolResponse(t,n){const r=new Date(t.timestamp).getTime(),o=t.target,s=t.source;return n.some(i=>new Date(i.timestamp).getTime()<r?!1:i.type==="AGENT_TOOL_EXECUTION_RESULT"&&i.source===o&&i.target===s)}isRequestStep(t){return this.isAgentToToolRequest(t)}isResponseStep(t){return["AGENT_TOOL_EXECUTION_RESULT","AGENT_LLM_RESPONSE_TOOL_DECISION","AGENT_LLM_RESPONSE_TO_AGENT"].includes(t.type)}}const un={USER:50,MAIN_FLOW:300,TOOLS:600},UC=50,Ye=50,_t=330,Bn=50,Vt=20,ur=10,Rl=Ye+20,HC=90;function Un(e,t,n){return e.push(n),t.add(n.id),n}function WC(e,t){return e.push(t),t}function Hn(e,t){return e.nodeIdCounter++,`${t.replace(/[^a-zA-Z0-9_]/g,"_")}_${e.nodeIdCounter}`}function ft(e){return e.currentPhaseIndex===-1||e.currentPhaseIndex>=e.phases.length?null:e.phases[e.currentPhaseIndex]}function Xr(e){const t=ft(e);return!t||e.currentSubflowIndex===-1||e.currentSubflowIndex>=t.subflows.length?null:t.subflows[e.currentSubflowIndex]}function GC(e,t,n){var r;for(let o=e.length-1;o>=0;o--){const s=e[o],i=n.find(l=>l.id===s.id);if(((r=i==null?void 0:i.data)==null?void 0:r.toolName)===t)return s}return null}function VC(e,t){if(!t)return null;const n=ft(e);return n&&n.subflows.findLast(r=>r.functionCallId===t)||null}function YC(e,t){if(!t)return null;const n=ft(e);return n&&n.subflows.findLast(r=>r.id===t)||null}function as(e,t){var o;const n=ft(e);if(!n)return null;if(t.functionCallId){const s=VC(e,t.functionCallId);if(s)return s}if(t.owningTaskId&&t.isSubTaskStep){const s=YC(e,t.owningTaskId);if(s){const i=n.subflows||[];if(!(new Set(i.map(c=>c.id)).size!==i.length))return s}}const r=Xr(e);if(r&&t.source){const s=t.source.replace(/[^a-zA-Z0-9_]/g,"_"),i=(o=t.target)==null?void 0:o.replace(/[^a-zA-Z0-9_]/g,"_"),l=r.peerAgent.id;if(l.includes(s)||i&&l.includes(i))return r}return r||null}function xp(e,t){var r,o,s;if(((r=e.data.toolDecision)==null?void 0:r.isParallel)===!0)return!0;const n=(s=(o=e.data)==null?void 0:o.toolInvocationStart)==null?void 0:s.functionCallId;return n?Array.from(t.parallelFlows.values()).some(i=>i.subflowFunctionCallIds.includes(n)):!1}function vp(e,t,n,r){var o;if(r)for(let s=e.length-1;s>=0;s--){const i=e[s];if(i.functionCallId===r){const l=n.find(c=>c.id===i.id);if(((o=l==null?void 0:l.data)==null?void 0:o.toolName)===t||t==="LLM")return i}}return GC(e,t,n)}function KC(e,t,n){const r=ft(e);if(!r)return null;const o=t.replace(/[^a-zA-Z0-9_]/g,"_"),s=n==null?void 0:n.replace(/[^a-zA-Z0-9_]/g,"_");let i=null;for(const l of r.subflows)if(l.peerAgent.id.includes(o)||s&&l.peerAgent.id.includes(s)){i=l;break}if(!i)return null;if(i.isParallel)return i;if(i.parentSubflowId){const l=r.subflows.find(c=>c.id===i.parentSubflowId);if(l&&l.isParallel)return l;if(l)return wp(r,l)}return null}function wp(e,t){if(t.isParallel)return t;if(t.parentSubflowId){const n=e.subflows.find(r=>r.id===t.parentSubflowId);if(n)return wp(e,n)}return null}function dr(e,t,n,r){const o=`phase_${e.phases.length}`,s=Hn(e,`${t}_${o}`),i=e.nextAvailableGlobalY,l={id:s,type:"orchestratorNode",position:{x:un.MAIN_FLOW,y:i},data:{label:t,visualizerStepId:n.id}};Un(r,e.allCreatedNodeIds,l),e.nodePositions.set(s,l.position);const c={id:s,yPosition:i,height:Ye,width:_t},d={id:s,name:t,type:"orchestrator",phaseId:o,context:"main",nodeInstance:c};e.agentRegistry.registerAgent(d);const f={id:o,orchestratorAgent:c,userNodes:[],subflows:[],toolInstances:[],currentToolYOffset:0,maxY:i+Ye};return e.phases.push(f),e.currentPhaseIndex=e.phases.length-1,e.currentSubflowIndex=-1,e.nextAvailableGlobalY=f.maxY+Bn,f}function li(e,t,n,r,o){var q,K,U,Y,J;const s=ft(e);if(!s)return null;const i=n.type==="AGENT_TOOL_EXECUTION_RESULT"&&((q=n.data.toolResult)==null?void 0:q.isPeerResponse)===!0,l=n.source||"",c=n.target||"",d=fr(l);!i&&!d&&!o&&e.indentationLevel++;const f=((U=(K=n.delegationInfo)==null?void 0:K[0])==null?void 0:U.subTaskId)||n.owningTaskId,p=Hn(e,`${t}_${f}`),m=Hn(e,`group_${t}_${f}`),h=((J=(Y=n.data)==null?void 0:Y.toolInvocationStart)==null?void 0:J.functionCallId)||n.functionCallId||"";let x,g,v;const b=Array.from(e.parallelFlows.values()).find(O=>O.subflowFunctionCallIds.includes(h)),w=Xr(e),y=KC(e,l,c);o&&b?(x=b.startX+b.currentXOffset,g=b.startY,v=g+Vt,b.currentXOffset+=(_t+ur)*2.2):y?(v=e.nextAvailableGlobalY,x=(y.groupNode.xPosition||un.MAIN_FLOW-50)+e.indentationLevel*e.indentationStep,g=v-Vt):(v=e.nextAvailableGlobalY,x=un.MAIN_FLOW-50+e.indentationLevel*e.indentationStep,g=v-Vt);const E={id:p,type:"genericAgentNode",position:{x:50,y:Vt},data:{label:t,visualizerStepId:n.id},parentId:m},T={id:m,type:"group",position:{x,y:g},data:{label:`${t} Sub-flow`},style:{backgroundColor:"rgba(220, 220, 255, 0.1)",border:"1px solid #aac",borderRadius:"8px",minHeight:`${Ye+2*Vt}px`}};Un(r,e.allCreatedNodeIds,T),Un(r,e.allCreatedNodeIds,E),e.nodePositions.set(p,E.position),e.nodePositions.set(m,T.position);const _={id:p,xPosition:un.MAIN_FLOW,yPosition:v,height:Ye,width:_t},I={id:p,name:t,type:"peer",phaseId:s.id,subflowId:f,context:"subflow",nodeInstance:_};e.agentRegistry.registerAgent(I);const A={id:f,functionCallId:h,isParallel:o,peerAgent:_,groupNode:{id:m,xPosition:x,yPosition:g,height:Ye+2*Vt,width:0},toolInstances:[],currentToolYOffset:0,maxY:v+Ye,maxContentXRelative:E.position.x+_t,callingPhaseId:s.id,parentSubflowId:w==null?void 0:w.id,inheritedXOffset:y==null?void 0:y.groupNode.xPosition};return s.subflows.push(A),y&&(y.lastSubflow=A),e.currentSubflowIndex=s.subflows.length-1,o&&b?(b.maxHeight=Math.max(b.maxHeight,A.groupNode.height),e.nextAvailableGlobalY=b.startY+b.maxHeight+Bn):e.nextAvailableGlobalY=A.groupNode.yPosition+A.groupNode.height+Bn,A}function bp(e,t,n,r,o,s,i=!1){const l=ft(e);if(!l)return null;const c=s?s.toolInstances:l.toolInstances,d=i?"LLM":`Tool: ${t}`,f=i?"LLM":t,p=s?s.groupNode.id:void 0;let m,h,x,g;if(s){if(m=s.peerAgent.yPosition+s.currentToolYOffset,s.currentToolYOffset+=Rl,x=50+300,s.groupNode.xPosition===void 0||s.groupNode.yPosition===void 0)return null;h=s.groupNode.xPosition+x,g=m-s.groupNode.yPosition}else h=un.TOOLS,m=l.orchestratorAgent.yPosition+l.currentToolYOffset,l.currentToolYOffset+=Rl,x=h,g=m;const v=Hn(e,`${f}_${r.id}`),b={id:v,type:n,position:{x,y:g},data:{label:d,visualizerStepId:r.id,toolName:t},parentId:p};Un(o,e.allCreatedNodeIds,b),e.nodePositions.set(v,{x,y:g});const w={id:v,xPosition:h,yPosition:m,height:Ye,width:_t,functionCallId:r.functionCallId};c.push(w);const y=m+Ye;if(s){s.maxY=Math.max(s.maxY,y),s.maxContentXRelative=Math.max(s.maxContentXRelative,x+_t);const E=s.maxY-s.groupNode.yPosition+Vt;s.groupNode.height=Math.max(s.groupNode.height,E);const T=s.maxContentXRelative+ur;s.groupNode.width=Math.max(s.groupNode.width||0,T);const _=o.find(I=>I.id===s.groupNode.id);_&&(_.style={..._.style,height:`${s.groupNode.height}px`,width:`${s.groupNode.width}px`}),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,s.groupNode.yPosition+s.groupNode.height+Bn)}else l.maxY=Math.max(l.maxY,y),e.nextAvailableGlobalY=Math.max(e.nextAvailableGlobalY,l.maxY+Bn);return w}function sa(e,t,n,r){e.userNodeCounter++;const o=Hn(e,`User_response_${e.userNodeCounter}`),s=e.nextAvailableGlobalY+20,i={id:o,type:"userNode",position:{x:un.USER,y:s},data:{label:"User",visualizerStepId:n.id,isBottomNode:!0}};Un(r,e.allCreatedNodeIds,i),e.nodePositions.set(o,i.position);const l={id:o,yPosition:s,height:Ye,width:_t};t.userNodes.push(l),e.allUserNodes.push(l);const c=s+Ye;return t.maxY=Math.max(t.maxY,c),l}function St(e,t,n,r,o,s,i,l,c){if(!e||!t||e===t)return;const d=o.allCreatedNodeIds.has(e),f=o.allCreatedNodeIds.has(t);if(!d||!f)return;const p=`edge-${e}${l||""}-to-${t}${c||""}-${n.id}`;if(!r.some(h=>h.id===p)){const h=n.title&&n.title.length>30?n.type.replace(/_/g," ").toLowerCase():n.title||"",x=s.isRequestStep(n),g={id:p,source:e,target:t,label:h,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:x,animationType:x?"request":"static",duration:1}};l&&(g.sourceHandle=l),c&&(g.targetHandle=c),WC(r,g)}}function qC(){const e=new Map;return{agents:e,findAgentByName(t){const n=t.startsWith("peer_")?t.substring(5):t,r=[];for(const[,o]of e)(o.name===n||o.name===t)&&r.push(o);return r.length===0?null:r.reduce((o,s)=>{const i=parseInt(o.id.split("_").pop()||"0");return parseInt(s.id.split("_").pop()||"0")>i?s:o})},findAgentById(t){for(const[,n]of e)if(n.id===t)return n;return null},registerAgent(t){e.set(t.id,t)}}}function ci(e,t,n){return e==="orchestrator"?t==="output"?n==="bottom"?"orch-bottom-output":"orch-right-output-tools":n==="top"?"orch-top-input":"orch-right-input-tools":t==="output"?n==="bottom"?"peer-bottom-output":"peer-right-output-tools":n==="top"?"peer-top-input":"peer-right-input-tools"}function fr(e){return e==="OrchestratorAgent"||e.toLowerCase().includes("orchestrator")}const XC=["USER_REQUEST","AGENT_LLM_CALL","AGENT_LLM_RESPONSE_TO_AGENT","AGENT_LLM_RESPONSE_TOOL_DECISION","AGENT_TOOL_INVOCATION_START","AGENT_TOOL_EXECUTION_RESULT","AGENT_RESPONSE_TEXT","TASK_COMPLETED","TASK_FAILED"];function ZC(e,t,n,r,o,s){const i=e.target,l=i.replace(/[^a-zA-Z0-9_]/g,"_"),c=ft(t),d=Xr(t);let f,p=!1;if(d?(f=d.peerAgent,f.id.startsWith(l+"_")&&(p=!0)):c&&(f=c.orchestratorAgent,f.id.startsWith(l+"_")&&(p=!0)),p&&f&&c){t.userNodeCounter++;const m=Hn(t,`User_continue_${t.userNodeCounter}`),h=t.nextAvailableGlobalY,x={id:m,type:"userNode",position:{x:un.USER,y:h},data:{label:"User",visualizerStepId:e.id}};Un(n,t.allCreatedNodeIds,x),t.nodePositions.set(m,x.position);const g={id:m,yPosition:h,height:Ye,width:_t};c.userNodes.push(g),t.allUserNodes.push(g);const v=h+Ye;f.yPosition=Math.max(f.yPosition,h),c.maxY=Math.max(c.maxY,v,f.yPosition+Ye),t.nextAvailableGlobalY=c.maxY+Bn;const b=fr(i)?"orch-left-input":"peer-left-input";St(g.id,f.id,e,r,t,o,s,"user-right-output",b)}else{const m=dr(t,i,e,n),h=Hn(t,`User_${m.id}`),x={id:h,type:"userNode",position:{x:un.USER,y:m.orchestratorAgent.yPosition-HC},data:{label:"User",visualizerStepId:e.id,isTopNode:!0}};Un(n,t.allCreatedNodeIds,x),t.nodePositions.set(h,x.position);const g={id:h,yPosition:x.position.y,height:Ye,width:_t};m.userNodes.push(g),t.allUserNodes.push(g),t.userNodeCounter++,m.maxY=Math.max(m.maxY,x.position.y+Ye),t.nextAvailableGlobalY=m.maxY+Bn,St(h,m.orchestratorAgent.id,e,r,t,o,s,"user-bottom-output","orch-top-input")}}function JC(e,t,n,r,o,s){const i=ft(t);if(!i)return;const l=as(t,e),c=l?l.peerAgent.id:i.orchestratorAgent.id,d=bp(t,"LLM","llmNode",e,n,l,!0);d&&St(c,d.id,e,r,t,o,s,l?"peer-right-output-tools":"orch-right-output-tools","llm-left-input")}function QC(e,t,n,r,o,s){var x;if(e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"&&((x=e.data.toolDecision)!=null&&x.isParallel)){const g=`parallel-${e.id}`;e.data.toolDecision.decisions.filter(v=>v.isPeerDelegation).length>1&&t.parallelFlows.set(g,{subflowFunctionCallIds:e.data.toolDecision.decisions.filter(v=>v.isPeerDelegation).map(v=>v.functionCallId),completedSubflows:new Set,startX:un.MAIN_FLOW-50,startY:t.nextAvailableGlobalY,currentXOffset:0,maxHeight:0})}const i=ft(t);if(!i)return;const l=as(t,e);let c;const f=vp((l||i).toolInstances,"LLM",n,e.functionCallId);if(f)c=f.id;else{console.error(`[Timeline] LLM node not found for step type ${e.type}: ${e.id}. Cannot create edge.`);return}const p=e.target||"UnknownAgent";let m,h;l?(m=l.peerAgent.id,h="peer-right-input-tools"):i.orchestratorAgent.id.startsWith(p.replace(/[^a-zA-Z0-9_]/g,"_")+"_")&&(m=i.orchestratorAgent.id,h="orch-right-input-tools"),c&&m&&h?St(c,m,e,r,t,o,s,"llm-bottom-output",h):console.error(`[Timeline] Could not determine target agent node ID or handle for step type ${e.type}: ${e.id}. Target agent name: ${p}. Edge will be missing.`)}function eE(e,t,n,r,o,s){var f;const i=ft(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"UnknownTool";if(((f=e.data.toolInvocationStart)==null?void 0:f.isPeerInvocation)||c.startsWith("peer_")){const p=c.startsWith("peer_")?c.substring(5):c,m=t.agentRegistry.findAgentByName(l);if(!m){console.error(`[Timeline] Could not find source agent in registry: ${l} for step ${e.id}`);return}const h=m.nodeInstance,x=ci(m.type,"output","bottom"),g=xp(e,t),v=li(t,p,e,n,g);v&&St(h.id,v.peerAgent.id,e,r,t,o,s,x,"peer-top-input")}else{const p=as(t,e);let m,h;if(p)m=p.peerAgent.id,h="peer-right-output-tools";else{const g=t.agentRegistry.findAgentByName(l);g?(m=g.id,h=ci(g.type,"output","right")):(m=i.orchestratorAgent.id,h="orch-right-output-tools")}const x=bp(t,c,"genericToolNode",e,n,p);x&&St(m,x.id,e,r,t,o,s,h,`${x.id}-tool-left-input`)}}function tE(e,t,n,r,o,s){var d,f;const i=ft(t);if(!i)return;const l=e.source||"UnknownSource",c=e.target||"OrchestratorAgent";if((d=e.data.toolResult)!=null&&d.isPeerResponse){const p=(f=e.data.toolResult)==null?void 0:f.functionCallId,m=Array.from(t.parallelFlows.entries()).find(([x,g])=>g.subflowFunctionCallIds.includes(p||""));if(m){const[x,g]=m;if(g.completedSubflows.add(p||""),g.completedSubflows.size<g.subflowFunctionCallIds.length)return;const v=i.subflows.filter(E=>g.subflowFunctionCallIds.includes(E.functionCallId)),b=e.target||"OrchestratorAgent";let w,y;if(fr(b))t.indentationLevel=0,w=dr(t,b,e,n).orchestratorAgent,y="orch-top-input",t.currentSubflowIndex=-1;else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const E=li(t,b,e,n,!1);if(!E)return;w=E.peerAgent,y="peer-top-input"}v.forEach(E=>{var T;St(((T=E.lastSubflow)==null?void 0:T.peerAgent.id)??E.peerAgent.id,w.id,e,r,t,o,s,"peer-bottom-output",y)}),t.parallelFlows.delete(x);return}const h=t.agentRegistry.findAgentByName(l.startsWith("peer_")?l.substring(5):l);if(!h){console.error(`[Timeline] Source peer agent not found for peer response: ${l}.`);return}if(fr(c)){t.indentationLevel=0;const x=dr(t,c,e,n);St(h.id,x.orchestratorAgent.id,e,r,t,o,s,"peer-bottom-output","orch-top-input"),t.currentSubflowIndex=-1}else{t.indentationLevel=Math.max(0,t.indentationLevel-1);const x=xp(e,t)||Array.from(t.parallelFlows.values()).some(v=>v.subflowFunctionCallIds.some(b=>i.subflows.some(w=>w.functionCallId===b))),g=li(t,c,e,n,x);g&&St(h.id,g.peerAgent.id,e,r,t,o,s,"peer-bottom-output","peer-top-input")}}else{let p;const m=as(t,e),x=vp((m||i).toolInstances,l,n,e.functionCallId);if(x&&(p=x.id),p){let g,v;if(m)g=m.peerAgent.id,v="peer-right-input-tools";else{const b=t.agentRegistry.findAgentByName(c);b?(g=b.id,v=ci(b.type,"input","right")):(g=i.orchestratorAgent.id,v="orch-right-input-tools")}St(p,g,e,r,t,o,s,l==="LLM"?"llm-bottom-output":`${p}-tool-bottom-output`,v)}else console.error(`[Timeline] Could not find source tool node for regular tool result: ${e.id}. Step source (tool name): ${l}.`)}}function nE(e,t,n,r,o,s){const i=ft(t);if(!i||e.isSubTaskStep)return;const l=i.orchestratorAgent.id,c=sa(t,i,e,n);St(l,c.id,e,r,t,o,s,"orch-bottom-output","user-top-input")}function rE(e,t,n,r,o,s){const i=ft(t);if(!i)return;const l=Array.from(t.parallelFlows.values()).find(h=>h.subflowFunctionCallIds.includes(e.functionCallId||""));if(l){if(l.completedSubflows.add(e.functionCallId||""),l.completedSubflows.size===l.subflowFunctionCallIds.length){t.indentationLevel=0;const h=dr(t,"OrchestratorAgent",e,n);i.subflows.forEach(x=>{l.subflowFunctionCallIds.includes(x.functionCallId)&&St(x.peerAgent.id,h.orchestratorAgent.id,e,r,t,o,s,"peer-bottom-output","orch-top-input")}),t.currentSubflowIndex=-1}return}if(!e.isSubTaskStep)return;const c=Xr(t);if(!c){console.warn(`[Timeline] TASK_COMPLETED with isSubTaskStep=true but no active subflow. Step ID: ${e.id}`);return}if(!i){console.error(`[Timeline] No current phase found for TASK_COMPLETED. Step ID: ${e.id}`);return}const d=c.peerAgent,f=n.some(h=>typeof h.data.label=="string"&&fr(h.data.label));let p,m;f?(t.indentationLevel=0,p=dr(t,"OrchestratorAgent",e,n).orchestratorAgent.id,m="orch-top-input"):(p=sa(t,i,e,n).id,m="user-top-input"),St(d.id,p,e,r,t,o,s,"peer-bottom-output",m),t.currentSubflowIndex=-1}function oE(e,t,n,r){const o=ft(t);if(!o)return;const s=e.source||"UnknownSource",i=e.target||"User";let l,c="orch-bottom-output";const d=Xr(t);if(d&&d.peerAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_")))l=d.peerAgent,c="peer-bottom-output";else if(o.orchestratorAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_")))l=o.orchestratorAgent,c="orch-bottom-output";else for(const m of o.subflows)if(m.peerAgent.id.includes(s.replace(/[^a-zA-Z0-9_]/g,"_"))){l=m.peerAgent,c="peer-bottom-output";break}if(!l){console.error(`[Timeline] Could not find source agent node for TASK_FAILED: ${s}`);return}let f,p;fr(i)?(t.indentationLevel=0,f=dr(t,i,e,n).orchestratorAgent.id,p="orch-top-input",t.currentSubflowIndex=-1):(f=sa(t,o,e,n).id,p="user-top-input"),sE(l.id,f,e,r,t,c,p)}function sE(e,t,n,r,o,s,i){var p;if(!e||!t||e===t)return;const l=o.allCreatedNodeIds.has(e),c=o.allCreatedNodeIds.has(t);if(!l||!c)return;const d=`error-edge-${e}${s||""}-to-${t}${i||""}-${n.id}`;if(!r.some(m=>m.id===d)){const m=((p=n.data.errorDetails)==null?void 0:p.message)||"Task failed",h=m.length>30?"Error":m,x={id:d,source:e,target:t,label:h,type:"defaultFlowEdge",data:{visualizerStepId:n.id,isAnimated:!1,animationType:"static",isError:!0,errorMessage:m}};s&&(x.sourceHandle=s),i&&(x.targetHandle=i),r.push(x)}}const iE=e=>{const t=[],n=[];if(!e||e.length===0)return{nodes:t,edges:n};const r=new gp,o={phases:[],currentPhaseIndex:-1,currentSubflowIndex:-1,parallelFlows:new Map,nextAvailableGlobalY:UC,nodeIdCounter:0,allCreatedNodeIds:new Set,nodePositions:new Map,allUserNodes:[],userNodeCounter:0,agentRegistry:qC(),indentationLevel:0,indentationStep:50},s=e.filter(c=>XC.includes(c.type)),i=s.findIndex(c=>c.type==="USER_REQUEST");let l=s;i>0&&(l=[s[i],...s.slice(0,i),...s.slice(i+1)]);for(const c of l)switch(c.type){case"USER_REQUEST":ZC(c,o,t,n,r,e);break;case"AGENT_LLM_CALL":JC(c,o,t,n,r,e);break;case"AGENT_LLM_RESPONSE_TO_AGENT":case"AGENT_LLM_RESPONSE_TOOL_DECISION":QC(c,o,t,n,r,e);break;case"AGENT_TOOL_INVOCATION_START":eE(c,o,t,n,r,e);break;case"AGENT_TOOL_EXECUTION_RESULT":tE(c,o,t,n,r,e);break;case"AGENT_RESPONSE_TEXT":nE(c,o,t,n,r,e);break;case"TASK_COMPLETED":rE(c,o,t,n,r,e);break;case"TASK_FAILED":oE(c,o,t,n);break}return o.phases.forEach(c=>{c.subflows.forEach(d=>{const f=t.find(p=>p.id===d.groupNode.id);if(f&&f.style){const m=d.maxY-d.groupNode.yPosition+Vt;f.style.height=`${Math.max(Ye+2*Vt,m)}px`;const h=d.maxContentXRelative+ur,x=_t+2*ur+o.indentationLevel*o.indentationStep;f.style.width=`${Math.max(h,x)}px`}})}),{nodes:t,edges:n}},aE=({id:e,sourceX:t,sourceY:n,targetX:r,targetY:o,sourcePosition:s,targetPosition:i,style:l={},markerEnd:c,data:d})=>{const[f,p]=u.useState(!1),[m]=Yp({sourceX:t,sourceY:n,sourcePosition:s,targetX:r,targetY:o,targetPosition:i}),h=()=>{const v={strokeWidth:f?3:2,stroke:"var(--color-muted-foreground)",...l},b=d;return b!=null&&b.isError?{...v,stroke:f?"var(--color-error-wMain)":"var(--color-error-w70)",strokeWidth:f?3:2}:b!=null&&b.isSelected?{...v,stroke:"#3b82f6",strokeWidth:3}:b!=null&&b.isAnimated?{...v,stroke:f?"#1d4ed8":"#3b82f6",strokeWidth:f?4:3}:f?{...v,stroke:"var(--edge-hover-color)"}:v},x=()=>p(!0),g=()=>p(!1);return a.jsxs(a.Fragment,{children:[a.jsx("path",{id:`${e}-interaction`,style:{strokeWidth:16,stroke:"transparent",fill:"none",cursor:"pointer"},className:"react-flow__edge-interaction",d:m,onMouseEnter:x,onMouseLeave:g}),a.jsx("path",{id:e,style:{...h(),cursor:"pointer",transition:"all 0.2s ease-in-out"},className:"react-flow__edge-path",d:m,markerEnd:c,onMouseEnter:x,onMouseLeave:g})]})},lE=({data:e})=>a.jsxs("div",{className:"cursor-pointer rounded-md border-2 border-blue-700 bg-white px-5 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-blue-600 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"180px",textAlign:"center"},children:[a.jsx(Xe,{type:"target",position:Ze.Top,id:"peer-top-input",className:"!bg-blue-700",isConnectable:!0}),a.jsx(Xe,{type:"source",position:Ze.Right,id:"peer-right-output-tools",className:"!bg-blue-700",style:{top:"25%"},isConnectable:!0}),a.jsx(Xe,{type:"target",position:Ze.Right,id:"peer-right-input-tools",className:"!bg-blue-700",style:{top:"75%"},isConnectable:!0}),a.jsx(Xe,{type:"source",position:Ze.Bottom,id:"peer-bottom-output",className:"!bg-blue-700",isConnectable:!0}),a.jsx(Xe,{type:"target",position:Ze.Left,id:"peer-left-input",className:"!bg-blue-700",isConnectable:!0}),a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"text-md font-semibold",children:e.label})})]}),cE=({data:e,id:t})=>{const n=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-cyan-500"}};return a.jsxs("div",{className:"cursor-pointer rounded-lg border-2 border-cyan-600 bg-white px-3 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-cyan-400 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"100px",textAlign:"center"},children:[a.jsx(Xe,{type:"target",position:Ze.Left,id:`${t}-tool-left-input`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"25%"}}),a.jsxs("div",{className:"flex items-center justify-center",children:[a.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${n()}`}),a.jsx("div",{className:"text-md",children:e.label})]}),a.jsx(Xe,{type:"source",position:Ze.Left,id:`${t}-tool-bottom-output`,className:"!bg-cyan-500",isConnectable:!0,style:{top:"75%"}})]})},uE=({data:e})=>{const t=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-teal-500"}};return a.jsxs("div",{className:"cursor-pointer rounded-lg border-2 border-teal-600 bg-white px-3 py-3 text-gray-800 shadow-md transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-teal-400 dark:bg-gray-800 dark:text-gray-200",style:{minWidth:"100px",textAlign:"center"},children:[a.jsx(Xe,{type:"target",position:Ze.Left,id:"llm-left-input",className:"!bg-teal-500",isConnectable:!0,style:{top:"25%"}}),a.jsxs("div",{className:"flex items-center justify-center",children:[a.jsx("div",{className:`mr-2 h-2 w-2 rounded-full ${t()}`}),a.jsx("div",{className:"text-md",children:e.label})]}),a.jsx(Xe,{type:"source",position:Ze.Left,id:"llm-bottom-output",className:"!bg-teal-500",isConnectable:!0,style:{top:"75%"}})]})},dE=({data:e})=>a.jsxs("div",{className:"cursor-pointer rounded-lg border-indigo-600 bg-gradient-to-r from-indigo-50 to-purple-50 px-5 py-3 text-gray-900 shadow-xl transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-2xl dark:border-indigo-400 dark:bg-gradient-to-r dark:from-indigo-900 dark:to-purple-900 dark:text-gray-100",style:{minWidth:"180px",textAlign:"center",borderWidth:"2px",borderStyle:"solid",boxShadow:"0 0 0 1px rgba(79, 70, 229, 0.3), 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)"},children:[a.jsx(Xe,{type:"source",position:Ze.Right,id:"orch-right-output-tools",className:"!bg-indigo-500",style:{top:"25%"},isConnectable:!0}),a.jsx(Xe,{type:"target",position:Ze.Right,id:"orch-right-input-tools",className:"!bg-indigo-500",style:{top:"75%"},isConnectable:!0}),a.jsx(Xe,{type:"target",position:Ze.Top,id:"orch-top-input",className:"!bg-indigo-500",isConnectable:!0}),a.jsx(Xe,{type:"source",position:Ze.Bottom,id:"orch-bottom-output",className:"!bg-indigo-500",isConnectable:!0}),a.jsx(Xe,{type:"target",position:Ze.Left,id:"orch-left-input",className:"!bg-indigo-500",isConnectable:!0}),a.jsx("div",{className:"flex items-center justify-center",children:a.jsx("div",{className:"text-md flex items-center font-bold",children:e.label})})]}),fE=({data:e})=>{const t=()=>{switch(e.status){case"completed":return"bg-green-500";case"in-progress":return"bg-blue-500";case"error":return"bg-red-500";case"started":return"bg-yellow-400";case"idle":default:return"bg-purple-500"}};return a.jsxs("div",{className:"cursor-pointer rounded-md border-2 border-purple-600 bg-white px-4 py-3 text-gray-800 shadow-lg transition-all duration-200 ease-in-out hover:scale-105 hover:shadow-xl dark:border-purple-400 dark:bg-gray-700 dark:text-gray-200",style:{minWidth:"120px",textAlign:"center"},children:[e.isTopNode&&a.jsx(Xe,{type:"source",position:Ze.Bottom,id:"user-bottom-output",className:"!bg-gray-500",isConnectable:!0}),e.isBottomNode&&a.jsx(Xe,{type:"target",position:Ze.Top,id:"user-top-input",className:"!bg-gray-500",isConnectable:!0}),!e.isTopNode&&!e.isBottomNode&&a.jsx(Xe,{type:"source",position:Ze.Right,id:"user-right-output",className:"!bg-gray-500",isConnectable:!0}),a.jsxs("div",{className:"flex items-center justify-center",children:[a.jsx("div",{className:`mr-2 h-3 w-3 rounded-full ${t()}`}),a.jsx("div",{className:"text-sm font-bold",children:e.label})]})]})},pE=({step:e,isHighlighted:t,onClick:n,variant:r="list"})=>{const o=()=>{var w,y,E;switch(e.type){case"USER_REQUEST":return a.jsx(Zp,{className:"mr-2 text-blue-500 dark:text-blue-400",size:18});case"AGENT_RESPONSE_TEXT":return a.jsx(cs,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"TASK_COMPLETED":return a.jsx(Vl,{className:"mr-2 text-green-500 dark:text-green-400",size:18});case"TASK_FAILED":return a.jsx(Xp,{className:"mr-2 text-red-500 dark:text-red-400",size:18});case"AGENT_LLM_CALL":return a.jsx(cs,{className:"mr-2 text-purple-500 dark:text-purple-400",size:18});case"AGENT_LLM_RESPONSE_TO_AGENT":return a.jsx(cs,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_LLM_RESPONSE_TOOL_DECISION":{const T=(y=(w=e.data.toolDecision)==null?void 0:w.decisions)==null?void 0:y[0];return(T==null?void 0:T.isPeerDelegation)?a.jsx(pa,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18}):a.jsx(ma,{className:"mr-2 text-orange-500 dark:text-orange-400",size:18})}case"AGENT_TOOL_INVOCATION_START":return(E=e.data.toolInvocationStart)!=null&&E.isPeerInvocation?a.jsx(pa,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18}):a.jsx(ma,{className:"mr-2 text-cyan-500 dark:text-cyan-400",size:18});case"AGENT_TOOL_EXECUTION_RESULT":return a.jsx(qp,{className:"mr-2 text-teal-500 dark:text-teal-400",size:18});case"AGENT_ARTIFACT_NOTIFICATION":return a.jsx(sr,{className:"mr-2 text-indigo-500 dark:text-indigo-400",size:18});default:return a.jsx(Kp,{className:"mr-2 text-gray-500 dark:text-gray-400",size:18})}},s=new Date(e.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"}),i=String(new Date(e.timestamp).getMilliseconds()).padStart(3,"0"),l=`${s}.${i}`,c=w=>a.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Model:"})," ",w.modelName]}),a.jsx("p",{className:"mt-1",children:a.jsx("strong",{children:"Prompt Preview:"})}),a.jsx("pre",{className:"max-h-28 overflow-y-auto rounded bg-gray-100 p-1.5 font-mono text-xs break-all whitespace-pre-wrap dark:bg-gray-700",children:w.promptPreview})]}),d=({data:w})=>{const[y,E]=zt.useState(!1),T=_=>{_.stopPropagation(),E(!y)};return y?a.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[a.jsx("strong",{children:"LLM Response Details:"}),a.jsx("button",{onClick:T,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Hide details"})]}),w.modelName&&a.jsxs("p",{children:[a.jsx("strong",{children:"Model:"})," ",w.modelName]}),a.jsxs("div",{className:"mt-1",children:[a.jsx("p",{children:a.jsx("strong",{children:"Response Preview:"})}),a.jsx("pre",{className:"max-h-28 overflow-y-auto rounded bg-gray-100 p-1.5 font-mono text-xs break-all whitespace-pre-wrap dark:bg-gray-700",children:w.responsePreview})]}),w.isFinalResponse!==void 0&&a.jsxs("p",{className:"mt-1",children:[a.jsx("strong",{children:"Final Response:"})," ",w.isFinalResponse?"Yes":"No"]})]}):a.jsxs("div",{className:"mt-1.5 flex items-center justify-between text-xs text-gray-500 dark:text-gray-400",children:[a.jsx("span",{className:"italic",children:"Internal LLM response"}),a.jsx("button",{onClick:T,className:"text-xs text-blue-500 underline hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",children:"Show details"})]})},f=w=>a.jsxs("div",{className:"mt-1.5 rounded-md bg-blue-50 p-2 font-mono text-xs text-blue-700 dark:bg-blue-900 dark:text-blue-300",children:[a.jsx("p",{className:"mb-2",children:a.jsxs("strong",{children:["🔧 ",w.isParallel?"Parallel Tool Calls:":"Tool Call:"]})}),a.jsx("ul",{className:"space-y-1 pl-2",children:w.decisions.map(y=>a.jsxs("li",{className:"flex items-center",children:[a.jsx("span",{className:"mr-2",children:"•"}),a.jsx("code",{children:y.toolName})]},y.functionCallId))})]}),p=w=>a.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Tool:"})," ",w.toolName]}),a.jsx("p",{className:"mt-1",children:a.jsx("strong",{children:"Arguments:"})}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:a.jsx(fi,{data:w.toolArguments})})]}),m=w=>a.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Tool:"})," ",w.toolName]}),a.jsx("p",{className:"mt-1",children:a.jsx("strong",{children:"Result:"})}),a.jsx("div",{className:"max-h-40 overflow-y-auto rounded bg-gray-100 p-1.5 dark:bg-gray-700",children:typeof w.resultData=="object"?a.jsx(fi,{data:w.resultData}):a.jsx("pre",{className:"font-mono text-xs break-all whitespace-pre-wrap",children:String(w.resultData)})})]}),h=w=>a.jsxs("div",{className:"mt-1.5 rounded-md bg-gray-50 p-2 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Artifact:"})," ",w.artifactName,w.version!==void 0&&a.jsxs("span",{className:"text-gray-500 dark:text-gray-400",children:[" (v",w.version,")"]})]}),w.mimeType&&a.jsxs("p",{children:[a.jsx("strong",{children:"Type:"})," ",w.mimeType]}),w.description&&a.jsxs("p",{className:"mt-1",children:[a.jsx("strong",{children:"Description:"})," ",w.description]})]}),x=r==="list"&&e.nestingLevel&&e.nestingLevel>0?{marginLeft:`${e.nestingLevel*24}px`}:{},g=r==="popover"?`
|
|
330
|
-
p-3 bg-transparent hover:bg-gray-50 dark:hover:bg-gray-700/50 transition-colors duration-150
|
|
331
|
-
${n?"cursor-pointer":""}
|
|
332
|
-
`:`
|
|
333
|
-
mb-3 p-3 border rounded-lg shadow-sm
|
|
334
|
-
bg-white dark:bg-gray-800 hover:shadow-md transition-shadow duration-150
|
|
335
|
-
${t?"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500 dark:ring-blue-400":"border-gray-200 dark:border-gray-700"}
|
|
336
|
-
${n?"cursor-pointer":""}
|
|
337
|
-
`,v=()=>e.type==="AGENT_LLM_RESPONSE_TOOL_DECISION"||e.type==="AGENT_TOOL_INVOCATION_START"?"Delegated to: ":e.type==="AGENT_TOOL_EXECUTION_RESULT"?"Response from: ":"Peer Interaction with: ",b=e.title;return a.jsxs("div",{className:g,style:x,onClick:n,children:[a.jsxs("div",{className:"mb-1.5 flex items-center",children:[o(),a.jsx("h4",{className:"flex-grow text-sm font-semibold text-gray-700 dark:text-gray-200",title:e.title,children:b}),a.jsx("span",{className:"font-mono text-xs text-gray-500 dark:text-gray-400",children:l})]}),e.delegationInfo&&e.delegationInfo.length>0&&a.jsx("div",{className:"mt-2 mb-1.5 space-y-2 rounded-r-md border-l-4 border-blue-500 bg-blue-50 p-2 text-sm dark:border-blue-400 dark:bg-gray-700/60",children:e.delegationInfo.map(w=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center font-semibold text-blue-700 dark:text-blue-300",children:[a.jsx(ql,{className:"mr-2 h-4 w-4 flex-shrink-0"}),a.jsxs("span",{children:[v(),w.peerAgentName]})]}),w.subTaskId&&a.jsxs("div",{className:"mt-0.5 ml-[24px] text-xs text-blue-600 dark:text-blue-400",children:["Sub-Task:"," ",a.jsxs("span",{className:"font-mono",title:w.subTaskId,children:[w.subTaskId.substring(0,15),"..."]})]})]},w.functionCallId))}),e.data.text&&a.jsx("div",{className:"max-h-20 overflow-y-auto pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(or,{children:e.data.text})}),e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-800 dark:text-gray-100",children:a.jsx(or,{children:e.data.finalMessage})}),e.type==="TASK_COMPLETED"&&!e.data.finalMessage&&a.jsx("div",{className:"pl-1 text-sm text-gray-600 italic dark:text-gray-300",children:"Task completed successfully."}),e.data.errorDetails&&a.jsxs("div",{className:"mt-1 rounded-md bg-red-50 p-2 pl-1 text-sm text-red-700 dark:bg-red-900/30 dark:text-red-400",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Error:"})," ",e.data.errorDetails.message]}),e.data.errorDetails.code&&a.jsxs("p",{className:"text-xs",children:["Code: ",e.data.errorDetails.code]})]}),e.data.llmCall&&c(e.data.llmCall),e.data.llmResponseToAgent&&a.jsx(d,{data:e.data.llmResponseToAgent}),e.data.toolDecision&&f(e.data.toolDecision),e.data.toolInvocationStart&&p(e.data.toolInvocationStart),e.data.toolResult&&m(e.data.toolResult),e.data.artifactNotification&&h(e.data.artifactNotification)]})},mE={genericAgentNode:lE,userNode:fE,llmNode:uE,orchestratorNode:dE,genericToolNode:cE},hE={defaultFlowEdge:aE},gE={x:16,y:0},xE=({processedSteps:e,isRightPanelVisible:t=!1,isSidePanelTransitioning:n=!1})=>{const[r,o,s]=Qp([]),[i,l,c]=em([]),{fitView:d}=tm(),{highlightedStepId:f,setHighlightedStepId:p}=Vi(),{taskIdInSidePanel:m}=Ue(),h=u.useRef([]),[x,g]=u.useState(!1),[v,b]=u.useState(null),[w,y]=u.useState(!1),E=u.useRef(null),[T,_]=u.useState(null),I=u.useRef(new gp),A=u.useMemo(()=>!e||e.length===0?{nodes:[],edges:[]}:iE(e),[e]),q=u.useMemo(()=>A.edges.length?A.edges.map(R=>{const S=R.data;let F={isAnimated:!1,animationType:"none"};if(S!=null&&S.visualizerStepId){const P=e.length-1;F=I.current.getEdgeAnimationState(S.visualizerStepId,P,e)}let M=R.id===T;return f&&(S==null?void 0:S.visualizerStepId)===f&&(M=!0),{...R,animated:F.isAnimated,data:{...S,isAnimated:F.isAnimated,animationType:F.animationType,isSelected:M}}}):[],[A.edges,e,T,f]),K=u.useCallback(()=>{o(R=>R.map(S=>{var te,oe,se,de;if(S.type!=="group")return S;const F=R.filter(me=>me.parentId===S.id);if(F.length===0)return S;let M=0,P=0;F.forEach(me=>{const Me=me.position.x+_t,Oe=me.position.y+Ye;M=Math.max(M,Me),P=Math.max(P,Oe)});const ee=M+ur,D=P+Vt;let $=0;const L=S.id.split("_");if(L.length>2){const me=L.find(Me=>Me.startsWith("subflow"));if(me){const Me=parseInt(me.replace("subflow",""));isNaN(Me)||($=Me)}}const G=_t+2*ur+$*50,k=Math.max(ee,G),V=parseInt(((oe=(te=S.style)==null?void 0:te.width)==null?void 0:oe.toString().replace("px",""))||"0"),Q=parseInt(((de=(se=S.style)==null?void 0:se.height)==null?void 0:de.toString().replace("px",""))||"0");return V!==k||Q!==D?{...S,style:{...S.style,width:`${k}px`,height:`${D}px`}}:S}))},[o]);u.useEffect(()=>{o(A.nodes),l(q),K()},[A.nodes,q,o,l,K]);const U=u.useCallback((R,S)=>i.find(F=>F.source===R&&(S?F.sourceHandle===S:!0))||null,[i]),Y=u.useCallback((R,S)=>{var M;g(!0);const F=(M=S.data)==null?void 0:M.visualizerStepId;if(F){const P=e.find(ee=>ee.id===F);P&&(_(S.id),t?p(F):(p(F),b(P),y(!0)))}},[e,t,p]),J=u.useCallback(R=>{switch(R.type){case"userNode":{const S=R.data;return S!=null&&S.isTopNode?["user-bottom-output"]:S!=null&&S.isBottomNode?["user-top-input"]:["user-right-output"]}case"orchestratorNode":return["orch-right-output-tools","orch-bottom-output"];case"genericAgentNode":return["peer-right-output-tools","peer-bottom-output"];case"llmNode":return["llm-bottom-output"];case"genericToolNode":return[`${R.id}-tool-bottom-output`];default:return[]}},[]),O=u.useCallback(()=>{y(!1),b(null)},[]),X=u.useCallback((R,S)=>{if(g(!0),S.type==="group"){p(null),_(null),O();return}const F=J(S);let M=null;for(const P of F)if(M=U(S.id,P),M)break;if(!M&&S.type==="userNode"){const P=S.data;P!=null&&P.isBottomNode&&(M=i.find(ee=>ee.target===S.id)||null)}M&&Y(R,M)},[J,p,O,U,i,Y]),N=u.useCallback(R=>{R!=null&&R.isTrusted&&g(!0)},[]);return u.useEffect(()=>{g(!1)},[m]),u.useEffect(()=>{!n&&d&&r.length>0&&h.current!==e&&x===!1&&(d({duration:200,padding:.1,maxZoom:1.2}),h.current=e)},[r.length,d,e,n,x]),u.useEffect(()=>{if(o(R=>R.map(S=>{var ee;const F=((ee=S.data)==null?void 0:ee.visualizerStepId)&&S.data.visualizerStepId===f,M=A.nodes.find(D=>D.id===S.id),P=(M==null?void 0:M.style)||{};return{...S,style:{...P,boxShadow:F?"0px 4px 12px rgba(0, 0, 0, 0.2)":P.boxShadow||"none",transition:"box-shadow 0.2s ease-in-out"}}})),f){const R=q.find(S=>{const F=S.data;return(F==null?void 0:F.visualizerStepId)===f});R&&_(R.id)}else _(null)},[f,o,A.nodes,q]),!e||e.length===0?a.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:Object.keys(e).length>0?"Processing flow data...":"No steps to display in flow chart."}):A.nodes.length===0&&e.length>0?a.jsx("div",{className:"flex h-full items-center justify-center text-gray-500 dark:text-gray-400",children:"Generating flow chart..."}):a.jsxs("div",{style:{height:"100%",width:"100%"},className:"relative",children:[a.jsxs(nm,{nodes:r,edges:i.map(R=>({...R,markerEnd:{type:im.ArrowClosed,color:"#888"}})),onNodesChange:s,onEdgesChange:c,onEdgeClick:Y,onNodeClick:X,onPaneClick:()=>{p(null),_(null),O()},onMoveStart:N,nodeTypes:mE,edgeTypes:hE,fitViewOptions:{padding:.1},className:"bg-gray-50 dark:bg-gray-900 [&>button]:dark:bg-gray-700",proOptions:{hideAttribution:!0},nodesDraggable:!1,elementsSelectable:!1,nodesConnectable:!1,minZoom:.2,children:[a.jsx(rm,{}),a.jsx(om,{className:oh()}),a.jsx(sm,{position:"top-right",className:"flex items-center space-x-4",children:a.jsx("div",{ref:E})})]}),a.jsx(Dw,{isOpen:w,onClose:O,anchorRef:E,offset:gE,placement:"right-start",className:"max-w-[500px] min-w-[400px] p-2",children:v&&a.jsx(pE,{step:v,variant:"popover"})})]})},vE=e=>a.jsx(Jp,{children:a.jsx(xE,{...e})}),yp=e=>{var t,n,r,o;if(e.events&&e.events.length>0){const s=e.events[0];if((o=(r=(n=(t=s.full_payload)==null?void 0:t.params)==null?void 0:n.message)==null?void 0:r.metadata)!=null&&o.parentTaskId)return s.full_payload.params.message.metadata.parentTaskId}},kr=e=>{var t,n,r;return((r=(n=(t=e.full_payload)==null?void 0:t.result)==null?void 0:n.status)==null?void 0:r.timestamp)||e.timestamp},Sp=(e,t,n,r)=>{const o=t[e];if(!o)return console.warn(`[collectAllDescendantEvents] Task not found in allMonitoredTasks: ${e}`),[];n.set(e,r);let s=[...o.events||[]];for(const i in t){const l=t[i];if(l.taskId===e)continue;yp(l)===e&&(s=s.concat(Sp(l.taskId,t,n,r+1)))}return s},wE=(e,t,n)=>{if(!n)return null;const r={overall:{totalTaskDurationMs:0},agents:{}},o=new Map,s=new Map,i=(N,R)=>(r.agents[N]||(r.agents[N]={agentName:R,instanceId:N,displayName:R,llmCalls:[],toolCalls:[],totalLlmTimeMs:0,totalToolTimeMs:0}),r.agents[N]),l=new Map,c=Sp(n.taskId,t,l,0);if(c.length===0)return{taskId:n.taskId,initialRequestText:n.initialRequestText,status:"working",startTime:n.firstSeen.toISOString(),steps:[]};const d=c.sort((N,R)=>new Date(kr(N)).getTime()-new Date(kr(R)).getTime()),f=[];let p,m="",h,x,g=[],v=null,b;const w=new Map,y=new Map,E=new Map,T=N=>{if(m.trim()&&h&&x){const R=m.trim();let S=n.taskId;if(g.length>0){const P=g[0].split("-");P.length>2&&P[1]!=="global"&&(S=P.slice(1,P.length-1).join("-"))}else N&&(S=N);const F=l.get(S)??0,M=w.get(S)||E.get(S);f.push({id:`vstep-agenttext-${f.length}-${g[0]||"unknown"}`,type:"AGENT_RESPONSE_TEXT",timestamp:x,title:`${h}: Response`,source:h,target:"User",data:{text:R},rawEventIds:[...g],isSubTaskStep:F>0,nestingLevel:F,owningTaskId:S,functionCallId:M}),v=R}m="",h=void 0,x=void 0,g=[],b=void 0};d.forEach((N,R)=>{var k,V,Q,te,oe,se,de,me,Me,Oe,Le,je,He,ot,Qe,et,le,pt,tt,mt,jt,wt,Et,Tt,Wt,ht,At,Ke,gt,Mt,Rt,nn,Nt,De,qe,st,rn,on,Pe,xt,sn,Gt,Pt,Lt,Dt;const S=kr(N),F=`raw-${N.task_id||"global"}-${R}`,M=N.full_payload,P=N.task_id||n.taskId,ee=l.get(P)??0;let D=N.source_entity||"UnknownAgent";(Q=(V=(k=M==null?void 0:M.params)==null?void 0:k.message)==null?void 0:V.metadata)!=null&&Q.agent_name?D=M.params.message.metadata.agent_name:(oe=(te=M==null?void 0:M.result)==null?void 0:te.metadata)!=null&&oe.agent_name?D=M.result.metadata.agent_name:(Me=(me=(de=(se=M==null?void 0:M.result)==null?void 0:se.status)==null?void 0:de.message)==null?void 0:me.metadata)!=null&&Me.agent_name?D=M.result.status.message.metadata.agent_name:(je=(Le=(Oe=M==null?void 0:M.result)==null?void 0:Oe.artifact)==null?void 0:Le.metadata)!=null&&je.agent_name&&(D=M.result.artifact.metadata.agent_name);let $;if(ee>0?$=w.get(P):$=E.get(P),N.direction==="request"&&ee>0){const be=(He=M.params)==null?void 0:He.metadata,Ee=be==null?void 0:be.function_call_id,B=N.task_id;if(B&&Ee){w.set(B,Ee);return}}if(N.direction==="request"&&ee===0&&N.task_id===n.taskId){T(P),v=null;const be=M.params;let Ee="User request";if((ot=be==null?void 0:be.message)!=null&&ot.parts){const B=be.message.parts.filter(z=>z.kind==="text"&&z.text);B.length>0&&(Ee=B[B.length-1].text)}f.push({id:`vstep-userreq-${f.length}-${F}`,type:"USER_REQUEST",timestamp:S,title:"User Input",source:"User",target:N.target_entity||D,data:{text:Ee},rawEventIds:[F],isSubTaskStep:!1,nestingLevel:0,owningTaskId:P});return}if(N.direction==="status-update"&&(M!=null&&M.result)){const be=M.result,Ee=(Qe=be.status)==null?void 0:Qe.message,B=Ee==null?void 0:Ee.metadata;let z;const H=!!(B!=null&&B.forwarded_from_peer);H?z=B.forwarded_from_peer:(et=be.metadata)!=null&&et.agent_name?z=be.metadata.agent_name:B!=null&&B.agent_name?z=B.agent_name:z=N.source_entity||"Agent";const ie=`${z}:${P}`;if(!H&&(Ee!=null&&Ee.parts))for(const fe of Ee.parts){if(fe.kind==="data"){const pe=fe.data;pe.type==="agent_progress_update"?p=pe.status_text:pe.type==="artifact_creation_progress"&&(p=`Saving artifact: ${pe.filename} (${pe.bytes_saved} bytes)`)}if(fe.kind==="data"){T(P);const ge=fe.data;switch(ge==null?void 0:ge.type){case"agent_progress_update":{f.push({id:`vstep-progress-${f.length}-${F}`,type:"AGENT_RESPONSE_TEXT",timestamp:S,title:`${z}: Progress Update`,source:z,target:"User",data:{text:ge.status_text},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"llm_invocation":{const ae=ge.request;let ue="System-initiated LLM call";if(ae!=null&&ae.contents&&Array.isArray(ae.contents)&&ae.contents.length>0){const Z=[...ae.contents].reverse().find(C=>C.role==="user");Z&&Z.parts&&(ue=Z.parts.map(C=>C.text||"").join(`
|
|
338
|
-
`).trim())}const Ie={modelName:(ae==null?void 0:ae.model)||"Unknown Model",promptPreview:ue||"No text in user prompt."};i(ie,z),o.set(ie,{timestamp:S,modelName:Ie.modelName}),f.push({id:`vstep-llmcall-${f.length}-${F}`,type:"AGENT_LLM_CALL",timestamp:S,title:`${z}: LLM Call`,source:z,target:"LLM",data:{llmCall:Ie},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"llm_response":{const ae=o.get(ie);if(ae){const C=new Date(S).getTime()-new Date(ae.timestamp).getTime();i(ie,z).llmCalls.push({modelName:ae.modelName,durationMs:C,timestamp:ae.timestamp}),o.delete(ie)}const ue=ge.data,Ie=(le=ue.content)==null?void 0:le.parts,Z=Ie==null?void 0:Ie.filter(C=>C.function_call);if(Z&&Z.length>0){T(P),v=null,E.delete(P);const C=Z.map(xe=>{var it;return{functionCallId:xe.function_call.id,toolName:xe.function_call.name,toolArguments:xe.function_call.args||{},isPeerDelegation:(it=xe.function_call.name)==null?void 0:it.startsWith("peer_")}}),j={decisions:C,isParallel:C.length>1},W=[],he=new Set;C.forEach(xe=>{if(xe.isPeerDelegation){const it=xe.toolName.substring(5);for(const hn in t){const Fe=t[hn];if(he.has(Fe.taskId))continue;if(yp(Fe)===P&&Fe.events&&Fe.events.length>0){const wr=Fe.events.find(br=>{var ia,aa,la,ca;return br.direction==="request"&&((ca=(la=(aa=(ia=br.full_payload)==null?void 0:ia.params)==null?void 0:aa.message)==null?void 0:la.metadata)==null?void 0:ca.function_call_id)===xe.functionCallId});if(wr&&new Date(kr(wr)).getTime()>=new Date(S).getTime()){const br={functionCallId:xe.functionCallId,peerAgentName:it,subTaskId:Fe.taskId};W.push(br),y.set(xe.functionCallId,br),Fe.taskId&&(w.set(Fe.taskId,xe.functionCallId),he.add(Fe.taskId));break}}}}});const ye={id:`vstep-tooldecision-${f.length}-${F}`,type:"AGENT_LLM_RESPONSE_TOOL_DECISION",timestamp:S,title:`LLM: Tool Decision${j.isParallel?" (Parallel)":""}`,source:"LLM",target:z,data:{toolDecision:j},rawEventIds:[F],delegationInfo:W.length>0?W:void 0,isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$};f.push(ye);const Re=j.isParallel?ye.id:void 0,we=ie;i(we,z),C.forEach(xe=>{var hn;const it=xe.isPeerDelegation?(hn=y.get(xe.functionCallId))==null?void 0:hn.subTaskId:void 0;s.has(xe.functionCallId)||s.set(xe.functionCallId,{timestamp:S,toolName:xe.toolName,isPeer:xe.isPeerDelegation,invokingAgentInstanceId:we,subTaskId:it,parallelBlockId:Re})})}else{const C=(Ie==null?void 0:Ie.filter(W=>W.text).map(W=>W.text).join(`
|
|
339
|
-
`))||"",j={responsePreview:C.substring(0,200)+(C.length>200?"...":""),isFinalResponse:(ue==null?void 0:ue.partial)===!1};f.push({id:`vstep-llmrespagent-${f.length}-${F}`,type:"AGENT_LLM_RESPONSE_TO_AGENT",timestamp:S,title:`${z}: LLM Response`,source:"LLM",target:z,data:{llmResponseToAgent:j},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$})}break}case"tool_invocation_start":{const ae={functionCallId:ge.function_call_id,toolName:ge.tool_name,toolArguments:ge.tool_args,isPeerInvocation:(pt=ge.tool_name)==null?void 0:pt.startsWith("peer_")};f.push({id:`vstep-toolinvokestart-${f.length}-${F}`,type:"AGENT_TOOL_INVOCATION_START",timestamp:S,title:`${z}: Executing tool ${ae.toolName}`,source:z,target:ae.toolName,data:{toolInvocationStart:ae},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}case"tool_result":{const ae=ge.function_call_id,ue=s.get(ae);if(ue){const Z=new Date(S).getTime()-new Date(ue.timestamp).getTime(),C=r.agents[ue.invokingAgentInstanceId];if(C){const j={toolName:ue.toolName,durationMs:Z,isPeer:ue.isPeer,timestamp:ue.timestamp,peerAgentName:ue.isPeer?ue.toolName.substring(5):void 0,subTaskId:ue.subTaskId,parallelBlockId:ue.parallelBlockId};C.toolCalls.push(j)}s.delete(ae)}const Ie={toolName:ge.tool_name,functionCallId:ae,resultData:ge.result_data,isPeerResponse:(tt=ge.tool_name)==null?void 0:tt.startsWith("peer_")};f.push({id:`vstep-toolresult-${f.length}-${F}`,type:"AGENT_TOOL_EXECUTION_RESULT",timestamp:S,title:`${z}: Tool Result - ${Ie.toolName}`,source:Ie.toolName,target:z,data:{toolResult:Ie},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});break}}}else fe.kind==="text"&&fe.text&&(h&&h!==z&&(T(P),v=null),h||(h=z,x=S,b=H),m+=fe.text,g.push(F))}return}if(N.direction==="artifact_update"&&((mt=M==null?void 0:M.result)!=null&&mt.artifact)){T(P);const be=M.result.artifact,Ee=((jt=be.metadata)==null?void 0:jt.agent_name)||N.source_entity||"Agent";let B;if(be.parts&&be.parts.length>0){const H=be.parts[0];H.kind==="file"?B=H.file.mimeType||void 0:(wt=H.metadata)!=null&&wt.mime_type&&(B=H.metadata.mime_type)}const z={artifactName:be.name||"Unnamed Artifact",version:typeof((Et=be.metadata)==null?void 0:Et.version)=="number"?be.metadata.version:void 0,description:be.description||void 0,mimeType:B};f.push({id:`vstep-artifactnotify-${f.length}-${F}`,type:"AGENT_ARTIFACT_NOTIFICATION",timestamp:S,title:`${Ee}: Artifact Update - ${z.artifactName}`,source:Ee,target:"User/System",data:{artifactNotification:z},rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$});return}if(["response","task"].includes(N.direction)&&((Wt=(Tt=M==null?void 0:M.result)==null?void 0:Tt.status)!=null&&Wt.state)){m.trim()&&T(P);const be=M.result,Ee=be.status.state,B=((ht=be.metadata)==null?void 0:ht.agent_name)||((gt=(Ke=(At=be.status)==null?void 0:At.message)==null?void 0:Ke.metadata)==null?void 0:gt.agent_name)||N.source_entity||"Agent";if(["completed","failed","canceled"].includes(Ee)&&ee==0){const z=Ee==="completed"?"TASK_COMPLETED":"TASK_FAILED",H=`${B}: Task ${Ee.charAt(0).toUpperCase()+Ee.slice(1)}`;let ie={},fe="";if((Mt=be.status.message)!=null&&Mt.parts){const _e=be.status.message.parts.find(ae=>ae.kind==="text");_e!=null&&_e.text&&(fe=_e.text.trim())}const pe=P===n.taskId,ge=fe&&(!pe||fe!==v);if(z==="TASK_COMPLETED")ie={finalMessage:ge?fe:void 0};else{const ae={message:ge?fe:`Task ${Ee}.`},ue=M.error;ue&&(ae.message=ue.message||ae.message,ae.code=ue.code,ue.data&&(ae.details=ue.data)),be.error&&(ae.message=be.error.message||ae.message,ae.code=be.error.code||ae.code,ae.details=be.error.data||ae.details),ie={errorDetails:ae}}f.push({id:`vstep-${Ee}-${f.length}-${F}`,type:z,timestamp:S,title:H,source:B,target:"User",data:ie,rawEventIds:[F],isSubTaskStep:ee>0,nestingLevel:ee,owningTaskId:P,functionCallId:$}),pe&&(v=null);return}}const L=N.direction==="status-update"&&((De=(Nt=(nn=(Rt=M==null?void 0:M.result)==null?void 0:Rt.status)==null?void 0:nn.message)==null?void 0:Nt.parts)==null?void 0:De.some(be=>be.kind==="text"));let G=N.source_entity;(on=(rn=(st=(qe=M==null?void 0:M.result)==null?void 0:qe.status)==null?void 0:st.message)==null?void 0:rn.metadata)!=null&&on.forwarded_from_peer?G=M.result.status.message.metadata.forwarded_from_peer:(xt=(Pe=M==null?void 0:M.result)==null?void 0:Pe.metadata)!=null&&xt.agent_name?G=M.result.metadata.agent_name:(Lt=(Pt=(Gt=(sn=M==null?void 0:M.result)==null?void 0:sn.status)==null?void 0:Gt.message)==null?void 0:Pt.metadata)!=null&&Lt.agent_name&&(G=M.result.status.message.metadata.agent_name),m.trim()&&h&&(!L||L&&G!==h)&&(T(P),l.get(((Dt=g[0])==null?void 0:Dt.split("-")[1])||n.taskId)===0&&!b&&(v=null))});const _=d.length>0&&d[d.length-1].task_id||n.taskId;T(_);const I=d[0]?kr(d[0]):n.firstSeen.toISOString();let A,q="working";const K=f.filter(N=>N.owningTaskId===n.taskId),U=K.length>0?K[K.length-1]:null;if(U&&(U.type==="TASK_COMPLETED"?(q="completed",A=U.timestamp):U.type==="TASK_FAILED"&&(q="failed",A=U.timestamp)),q==="working"&&d.length>0){const N=d[d.length-1];t[N.task_id||n.taskId]}let Y;I&&A&&(Y=new Date(A).getTime()-new Date(I).getTime()),["completed","failed","canceled","rejected"].includes(q)&&(p=void 0);const J={taskId:n.taskId,initialRequestText:n.initialRequestText,status:q,currentStatusText:p,startTime:I,endTime:A,durationMs:Y,steps:f};J.steps.forEach((N,R)=>{if(N.type==="TASK_COMPLETED"){let S="";for(let F=R-1;F>=0;F--){const M=J.steps[F];if(M.type!=="AGENT_RESPONSE_TEXT"||M.source!==N.source)break;S=M.data.text+S}N.data.finalMessage&&(S+=N.data.finalMessage),N.data.finalMessage=S.trim()||void 0}}),Object.values(r.agents).forEach(N=>{N.totalLlmTimeMs=N.llmCalls.reduce((P,ee)=>P+ee.durationMs,0);const R=N.toolCalls.filter(P=>!P.parallelBlockId),S=new Map;N.toolCalls.forEach(P=>{P.parallelBlockId&&(S.has(P.parallelBlockId)||S.set(P.parallelBlockId,[]),S.get(P.parallelBlockId).push(P))});const F=R.reduce((P,ee)=>P+ee.durationMs,0);let M=0;S.forEach(P=>{if(P.length>0){const ee=Math.min(...P.map($=>new Date($.timestamp).getTime())),D=Math.max(...P.map($=>new Date($.timestamp).getTime()+$.durationMs));M+=D-ee}}),N.totalToolTimeMs=F+M});const O=new Map;Object.values(r.agents).forEach(N=>{O.has(N.agentName)||O.set(N.agentName,[]),O.get(N.agentName).push(N)}),O.forEach(N=>{N.length>1&&(N.sort((R,S)=>{const F=M=>{const P=[...M.llmCalls.map(ee=>new Date(ee.timestamp).getTime()),...M.toolCalls.map(ee=>new Date(ee.timestamp).getTime())];return P.length>0?Math.min(...P):1/0};return F(R)-F(S)}),N.forEach((R,S)=>{R.displayName=`${R.agentName} (${S+1})`}))});const X=new Map;return Object.values(r.agents).forEach(N=>{const R=N.instanceId.split(":").slice(1).join(":");R&&X.set(R,N.displayName)}),Object.values(r.agents).forEach(N=>{N.toolCalls.forEach(R=>{if(R.isPeer&&R.subTaskId){const S=X.get(R.subTaskId);S&&(R.peerAgentName=S)}})}),Y!==void 0&&(r.overall.totalTaskDurationMs=Y),J.performanceReport=r,J},bE=({items:e,bottomItems:t,activeItem:n,onItemChange:r,onHeaderClick:o})=>{const s=i=>{r(i)};return a.jsxs("aside",{className:"flex h-screen w-[100px] flex-col border-r border-[var(--color-secondary-w70)] bg-[var(--color-primary-w100)]",children:[a.jsx(SE,{onClick:o}),a.jsx(EE,{items:e,bottomItems:t,activeItem:n,onItemClick:s})]})},yE=a.jsxs("svg",{id:"header-icon",xmlns:"http://www.w3.org/2000/svg",version:"1.1",viewBox:"0 0 500 150",width:"100%",height:"100%",children:[a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M14.3,82.5c0-4.4,1-8.2,2.9-11.3,1.9-3.1,4.4-5.7,7.5-7.8,3.1-2,6.5-3.6,10.4-4.6,3.8-1,7.7-1.5,11.5-1.5s7.1.3,10.2.9c3.1.6,5.9,1.5,8.2,2.6,2.4,1.1,4.2,2.4,5.6,3.8,1.4,1.4,2,3,2,4.6,0,2.4,0,4.3-.2,5.7-.1,1.4-.3,2.4-.6,3.1-.3.7-.7,1.1-1.1,1.3-.4.2-.9.2-1.6.2-1.8,0-3.2-.7-4.3-2-1.1-1.3-2.3-2.8-3.7-4.4-1.4-1.6-3.1-3.1-5.3-4.4-2.1-1.3-5.3-2-9.3-2s-4.4.3-6,.9c-1.6.6-2.9,1.5-3.8,2.5-.9,1-1.6,2.2-2,3.4-.4,1.2-.6,2.4-.6,3.5,0,2.5,1,4.4,3.1,5.7,2.1,1.3,4.7,2.3,7.8,3.2,3.1.9,6.5,1.7,10.1,2.5,3.6.8,7,1.9,10.1,3.4,3.1,1.5,5.8,3.5,7.9,6.1,2.1,2.6,3.1,6.1,3.1,10.5s-.8,8-2.5,11.3c-1.7,3.4-4,6.2-7,8.5-3,2.3-6.6,4.1-10.8,5.3-4.2,1.3-8.9,1.9-13.9,1.9s-8.8-.6-12.5-1.9c-3.7-1.3-6.9-2.8-9.6-4.6-2.7-1.8-4.7-3.7-6.2-5.6-1.5-1.9-2.2-3.5-2.2-4.7,0-1.8.5-3.6,1.6-5.3,1-1.8,2.6-2.7,4.7-2.7s2.5.4,3.5,1.2c.9.8,1.8,1.7,2.7,2.8.8,1.1,1.7,2.3,2.6,3.7.9,1.4,2,2.6,3.3,3.7,1.3,1.1,2.9,2,4.7,2.8,1.8.8,4.1,1.2,6.8,1.2,4.1,0,7.5-1,10.3-3.1,2.8-2.1,4.2-4.8,4.2-8s-1-4.9-3.1-6.4c-2-1.4-4.6-2.6-7.7-3.5-3.1-.9-6.4-1.7-10-2.4-3.6-.7-7-1.8-10-3.2-3.1-1.4-5.7-3.4-7.7-6-2-2.6-3.1-6.3-3.1-11"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M124.6,66.8c-4,0-7.3.9-9.9,2.7-2.6,1.8-4.7,4.2-6.4,7.1-1.6,2.9-2.8,6.1-3.5,9.7-.7,3.5-1,6.9-1,10.1,0,4.9.5,9.2,1.6,13,1,3.7,2.5,6.8,4.4,9.3,1.9,2.5,4.1,4.3,6.7,5.6,2.6,1.3,5.3,1.9,8.2,1.9s5.7-.6,8.2-1.9c2.6-1.3,4.8-3.1,6.7-5.6,1.9-2.5,3.3-5.5,4.4-9.3,1-3.7,1.6-8,1.6-13,0-9.5-1.9-16.9-5.8-22-3.9-5.1-8.9-7.7-15.2-7.7M82.2,96.5c0-5.8,1.1-11,3.3-15.9,2.2-4.8,5.2-8.9,9.1-12.4,3.9-3.5,8.4-6.1,13.6-8,5.2-1.9,10.7-2.8,16.6-2.8s11.4.9,16.6,2.8c5.2,1.9,9.7,4.6,13.5,8,3.8,3.5,6.9,7.6,9.1,12.4,2.2,4.8,3.4,10.1,3.4,15.9s-1.1,11.2-3.4,15.9c-2.3,4.8-5.3,8.9-9.1,12.3-3.8,3.5-8.3,6.1-13.5,8-5.2,1.9-10.7,2.8-16.6,2.8s-11.4-.9-16.6-2.8c-5.2-1.9-9.7-4.6-13.6-8-3.9-3.5-6.9-7.6-9.1-12.3-2.2-4.8-3.3-10.1-3.3-15.9"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M172.3,23.3c0-.8.9-1.8,2.7-2.8,1.8-1,4-2,6.5-2.9,2.5-.9,5.1-1.6,7.7-2.3,2.6-.6,4.7-.9,6.3-.9s1.3,0,1.9.2c.6.2,1.2.5,1.8,1.2.6.6,1,1.6,1.4,2.9.4,1.3.5,3.1.5,5.4v94.7c0,2.4.4,4.1,1.2,4.9.8.9,1.6,1.5,2.5,2,.9.4,1.7.8,2.5,1.3.8.4,1.2,1.4,1.2,2.8s-.5,2.5-1.6,3.2c-1,.7-2.4,1-3.9,1h-24.2c-1.6,0-2.9-.3-3.9-1-1-.7-1.6-1.8-1.6-3.2s.4-2.3,1.2-2.7c.8-.5,1.6-.9,2.5-1.3.9-.4,1.7-1.1,2.5-2,.8-.9,1.2-2.5,1.2-4.9V34.5c0-2-.4-3.4-1.3-4.2-.9-.8-1.9-1.4-2.9-1.9-1-.5-2-1-2.9-1.6-.9-.6-1.3-1.8-1.3-3.5"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M254.4,93.3c-3.7,1.2-6.8,2.8-9.4,4.7-2.6,1.9-4.6,4.1-6,6.6-1.4,2.5-2.1,5-2.1,7.6s.3,3.6,1,5.3c.7,1.8,1.6,3.4,2.9,4.7,1.3,1.4,2.7,2.5,4.5,3.3,1.7.8,3.6,1.3,5.7,1.3s5.2-.7,7.2-2c2-1.3,3.6-2.9,4.9-4.7,1.3-1.8,2.2-3.7,2.7-5.7.6-1.9.9-3.6.9-4.9v-18.2c-4.5.1-8.6.8-12.2,2M220.5,69.7c0-1.9.9-3.6,2.6-5.1,1.7-1.5,4-2.8,6.8-3.8,2.8-1,6-1.9,9.5-2.4,3.5-.6,7-.9,10.4-.9,7,0,12.9.8,17.6,2.3,4.7,1.5,8.5,3.6,11.5,6.1,2.9,2.6,5,5.5,6.3,8.7,1.3,3.2,1.9,6.6,1.9,10v34.5c0,1.9.4,3.2,1.3,4.1.8.8,1.7,1.5,2.7,2,.9.5,1.8,1,2.7,1.5.8.5,1.3,1.4,1.3,2.7s-.4,2.5-1.2,3.4c-.8.9-2.7,1.3-5.7,1.3h-13.2c-2.4,0-4.1-.5-5.1-1.6-1-1-1.5-2.8-1.5-5.2v-1.7h-.6c-2.4,3.5-5.9,6-10.4,7.6-4.6,1.6-9.3,2.4-14.4,2.4s-8.5-.6-11.9-1.9c-3.4-1.3-6.3-3-8.6-5.1-2.4-2.1-4.1-4.6-5.3-7.5-1.2-2.8-1.8-5.8-1.8-8.8,0-5.2,1.6-9.7,4.8-13.5,3.2-3.8,7.3-6.8,12.2-9.2,5-2.4,10.5-4.1,16.6-5.2,6.1-1.1,12-1.6,17.9-1.6,0-4.7-1.3-8.6-4-11.5-2.7-3-6.6-4.5-11.7-4.5s-5.7.5-7.5,1.4c-1.9.9-3.6,2-5.1,3.1-1.5,1.2-3.1,2.2-4.7,3.1-1.6.9-3.7,1.4-6.2,1.4s-3.8-.5-5-1.6c-1.3-1.1-1.9-2.6-1.9-4.6"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M301.5,97.6c0-5.9,1-11.3,3.1-16.2,2.1-4.9,4.9-9.2,8.6-12.7,3.6-3.6,7.9-6.3,12.9-8.3,5-2,10.4-3,16.2-3s7.2.4,10.8,1.3c3.5.9,6.6,2.1,9.3,3.5,2.7,1.5,4.9,3.2,6.5,5.2,1.6,2,2.4,4.1,2.4,6.3s-.9,4.1-2.7,5.5c-1.8,1.4-4.2,2-7.2,2s-4.1-.8-5.3-2.4c-1.2-1.6-2.4-3.4-3.5-5.3-1.1-1.9-2.4-3.6-4-5.3-1.6-1.6-3.9-2.4-7.1-2.4s-5.2.8-7.5,2.3c-2.3,1.5-4.2,3.7-5.9,6.5-1.7,2.8-3,6.2-3.8,10-.9,3.9-1.3,8.2-1.3,12.9s.6,7.9,1.8,11.2c1.2,3.3,2.8,6.1,4.8,8.4,2,2.3,4.3,4.1,6.9,5.3,2.6,1.2,5.4,1.8,8.3,1.8s6.9-.6,9.4-1.9c2.5-1.3,4.7-2.6,6.4-4.2,1.8-1.5,3.3-2.9,4.6-4.2,1.3-1.3,2.6-1.9,4-1.9s2,.3,2.7,1c.8.7,1.2,1.6,1.2,2.7,0,1.7-.8,3.6-2.5,5.9-1.7,2.3-4,4.4-6.9,6.4-2.9,2-6.4,3.8-10.4,5.2-4,1.4-8.4,2.1-13.1,2.1s-10.7-.9-15.5-2.7c-4.8-1.8-8.9-4.4-12.3-7.8-3.5-3.3-6.2-7.4-8.2-12-2-4.7-3-9.8-3-15.5"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M423.2,65.9c-3.4,0-6.3.7-8.9,2.2-2.6,1.5-4.9,3.5-6.8,6.1-1.9,2.6-3.3,5.8-4.3,9.4-1,3.7-1.5,7.7-1.5,12.1v.9c3.5-.3,7.1-.9,11-1.7,3.9-.8,7.4-2,10.7-3.5,3.2-1.5,5.9-3.4,8.1-5.7,2.1-2.4,3.2-5.3,3.2-8.7s-.9-5.9-2.7-8c-1.8-2.1-4.7-3.1-8.7-3.1M380,98.4c0-5.7.9-11,2.7-15.9,1.8-5,4.5-9.3,8.2-13,3.7-3.7,8.3-6.6,13.9-8.8,5.6-2.1,12.2-3.2,19.9-3.2s6.8.4,10.4,1.2c3.6.8,6.8,2,9.8,3.8,3,1.7,5.4,4,7.4,6.8,1.9,2.8,2.9,6.1,2.9,10s-1.6,9-4.9,12.2c-3.3,3.2-7.5,5.8-12.6,7.7-5.1,1.9-10.8,3.4-16.9,4.3-6.1.9-12,1.6-17.7,1.9.5,3.1,1.5,5.9,2.9,8.3,1.4,2.4,3.1,4.4,5.2,6,2,1.6,4.2,2.8,6.6,3.6,2.4.8,4.7,1.2,7.1,1.2s5-.3,7.2-.9c2.2-.6,4.2-1.3,6-2.3,1.8-.9,3.5-2,4.9-3.1,1.5-1.1,2.8-2.2,3.9-3.2,1-1,2-1.9,2.8-2.4.8-.6,1.8-.9,3-.9,2.4,0,3.6,1.2,3.6,3.6s-1,4-3,6.4c-2,2.4-4.7,4.6-8,6.7-3.4,2-7.2,3.8-11.5,5.2-4.3,1.4-8.9,2.1-13.7,2.1s-10.9-.9-15.8-2.8c-4.9-1.9-9.1-4.5-12.7-7.8-3.6-3.3-6.4-7.2-8.5-11.8-2-4.6-3.1-9.5-3.1-14.8"}),a.jsx("path",{className:"fill-[var(--color-brand-wMain)]",d:"M464.7,123.7c0-6.5,5.3-11.8,11.8-11.8s11.8,5.3,11.8,11.8-5.3,11.8-11.8,11.8-11.8-5.3-11.8-11.8"})]}),SE=({onClick:e})=>a.jsx("div",{className:"flex h-[80px] min-h-[80px] cursor-pointer items-center justify-center border-b",onClick:e,children:a.jsx("div",{className:"flex h-12 w-12 items-center justify-center overflow-hidden rounded-full",children:yE})}),CE=()=>{const{currentTheme:e,toggleTheme:t}=Zu(),n=`Toggle theme (currently ${e})`;return a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:a.jsx("button",{type:"button",onClick:t,className:"relative mx-auto flex w-full cursor-pointer flex-col items-center bg-[var(--color-primary-w100)] px-3 py-5 text-xs text-[var(--color-primary-text-w10)] transition-colors hover:bg-[var(--color-primary-w90)] hover:text-[var(--color-primary-text-w10)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":n,title:n,children:a.jsx(Xl,{className:"mb-1 w-6 h-6"})})}),a.jsx(Oi,{side:"right",children:n})]})},EE=({items:e,bottomItems:t,activeItem:n,onItemClick:r})=>a.jsxs("nav",{className:"flex flex-1 flex-col",role:"navigation","aria-label":"Main navigation",children:[a.jsx("ul",{className:"space-y-1",children:e.map(o=>a.jsxs("li",{children:[a.jsx(Pl,{item:o,isActive:n===o.id,onItemClick:r}),o.showDividerAfter&&a.jsx("div",{className:"mx-4 my-3 border-t border-[var(--color-secondary-w70)]"})]},o.id))}),t&&t.length>0&&a.jsx("div",{className:"flex-1"}),t&&t.length>0&&a.jsx("ul",{className:"space-y-1",children:t.map(o=>a.jsx("li",{className:"my-4",children:o.id==="theme-toggle"?a.jsx(CE,{}):a.jsx(Pl,{item:o,isActive:n===o.id,onItemClick:r},o.id)},o.id))})]}),Pl=({item:e,isActive:t,onItemClick:n})=>{const{id:r,label:o,icon:s,disabled:i}=e,l=()=>{!i&&n&&n(r)},c=d=>{(d.key==="Enter"||d.key===" ")&&l()};return a.jsxs(Li,{children:[a.jsx(Di,{asChild:!0,children:a.jsxs("button",{type:"button",onClick:n?l:void 0,onKeyDown:n?c:void 0,disabled:i,className:Ce("relative mx-auto flex w-full cursor-pointer flex-col items-center border-l-4 border-[var(--color-primary-w100)] px-3 py-5 text-xs transition-colors","bg-[var(--color-primary-w100)] hover:bg-[var(--color-primary-w90)]","text-[var(--color-primary-text-w10)] hover:bg-[var(--color-primary-w90)] hover:text-[var(--color-primary-text-w10)]","disabled:cursor-not-allowed disabled:opacity-50",t?"border-l-4 border-[var(--color-brand-wMain)] bg-[var(--color-primary-w90)]":""),"aria-label":o,"aria-current":t?"page":void 0,children:[a.jsx(s,{className:Ce("mb-1 h-6 w-6",t&&"text-[var(--color-brand-wMain)]")}),a.jsx("span",{className:"text-center text-[13px] leading-tight",children:o})]})}),a.jsx(Oi,{side:"right",children:o})]})},Ll=[{id:"chat",label:"Chat",icon:am},{id:"agentMesh",label:"Agents",icon:Zl}],Dl=[{id:"theme-toggle",label:"Theme",icon:Xl,onClick:()=>{}}],Cp=({title:e,breadcrumbs:t,tabs:n,buttons:r,leadingAction:o})=>a.jsxs("div",{className:"relative flex max-h-[80px] min-h-[80px] w-full items-center border-b px-8",children:[t&&t.length>0&&a.jsx("div",{className:"absolute top-1 left-8 flex items-center h-8",children:t.map((s,i)=>a.jsxs(zt.Fragment,{children:[i>0&&a.jsx("span",{className:"mx-1",children:a.jsx(lm,{size:16})}),s.onClick?a.jsx(Ae,{variant:"link",className:"p-0 m-0",onClick:s.onClick,children:s.label}):a.jsx("div",{children:s.label})]},i))}),o&&a.jsx("div",{className:"mr-4 flex items-center pt-[35px]",children:o}),a.jsx("div",{className:"truncate text-xl text-nowrap pt-[35px]",children:e}),n&&n.length>0&&a.jsx("div",{className:"ml-8 flex items-center pt-[35px]",role:"tablist",children:n.map((s,i)=>a.jsxs("button",{role:"tab","aria-selected":s.isActive,onClick:s.onClick,className:`relative cursor-pointer px-4 py-3 font-medium transition-colors duration-200 ${s.isActive?"border-b-2 border-[var(--color-brand-wMain)] font-semibold":""} ${i>0?"ml-6":""}`,children:[s.label,s.isActive&&a.jsx("div",{className:"absolute right-0 bottom-0 left-0 h-0.5"})]},s.id))}),a.jsx("div",{className:"flex-1"}),r&&r.length>0&&a.jsx("div",{className:"flex items-center gap-2",children:r.map((s,i)=>a.jsx(zt.Fragment,{children:s},i))})]}),lt=({label:e,value:t,icon:n,fullWidthValue:r=!1})=>t==null||typeof t=="string"&&!t.trim()?null:a.jsxs("div",{className:`flex mb-1.5 text-sm ${r?"flex-col items-start":"items-center"}`,children:[a.jsxs("div",{className:"flex w-36 flex-shrink-0 items-center text-sm font-semibold text-nowrap",children:[n&&a.jsx("span",{className:"mr-2",children:n}),e,":"]}),a.jsx("div",{className:`text-accent-foreground text-sm ${r?"mt-1 w-full":"truncate"}`,title:typeof t=="string"?t:void 0,children:t})]}),TE=({agent:e,isExpanded:t,onToggleExpand:n})=>{const r=l=>!l||Object.keys(l).length===0?a.jsx("span",{className:"text-sm",children:"N/A"}):a.jsx("ul",{className:"list-inside list-disc pl-1",children:Object.entries(l).map(([c,d])=>a.jsxs("li",{className:"text-sm",children:[a.jsxs("span",{className:"capitalize",children:[c.replace(/_/g," "),":"]})," ",d?"Yes":"No"]},c))}),o=(l,c="None")=>!l||l.length===0?a.jsx("span",{children:c}):l.map(d=>a.jsx("span",{className:"mr-1 mb-1 inline-block rounded-full px-2 py-0.5 text-xs font-medium",children:d},d)),s=l=>!l||l.length===0?a.jsx("span",{children:"No skills listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold",children:c.name}),a.jsx("p",{children:c.description})]},c.id||c.name))}),i=l=>!l||l.length===0?a.jsx("span",{children:"No tools listed"}):a.jsx("div",{className:"space-y-1",children:l.map(c=>a.jsxs("div",{className:"rounded p-1.5 text-xs",children:[a.jsx("p",{className:"font-semibold text-foreground",children:c.name}),a.jsx("p",{className:"mb-1",children:c.description})]},c.name))});return a.jsx("div",{className:"h-[400px] cursor-pointer w-full sm:w-[380px] flex-shrink-0 bg-card rounded-lg",onClick:n,role:"button",tabIndex:0,"aria-expanded":t,children:a.jsxs("div",{className:`transform-style-preserve-3d relative h-full w-full transition-transform duration-700 ${t?"rotate-y-180":""}`,style:{transformStyle:"preserve-3d"},children:[a.jsxs("div",{className:"absolute flex h-full w-full flex-col overflow-hidden rounded-lg border shadow-xl",style:{backfaceVisibility:"hidden",transform:"rotateY(0deg)"},children:[a.jsx("div",{className:"flex items-center p-4",children:a.jsxs("div",{className:"flex min-w-0 items-center",children:[a.jsx(Zl,{className:"mr-3 h-8 w-8 flex-shrink-0 text-[var(--color-brand-wMain)]"}),a.jsx("div",{className:"min-w-0",children:a.jsx("h2",{className:"truncate text-xl font-semibold",title:e.name,children:e.displayName||e.name})})]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-3 overflow-y-auto p-4",children:[a.jsx("div",{className:"mb-2 line-clamp-4 text-base",children:e.description||"No description provided."}),a.jsx(lt,{label:"Version",value:e.version,icon:a.jsx(ha,{size:14})}),e.capabilities&&Object.keys(e.capabilities).length>0&&a.jsx(lt,{label:"Key Capabilities",value:r(e.capabilities),icon:a.jsx(ga,{size:14}),fullWidthValue:!0})]}),a.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for details"})]}),a.jsxs("div",{className:"absolute flex h-full w-full flex-col overflow-hidden rounded-lg border shadow-xl",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)"},children:[a.jsx("div",{className:"flex items-center p-3",children:a.jsxs("h3",{className:"text-md truncate font-semibold",title:e.name,children:["Details: ",e.displayName||e.name]})}),a.jsxs("div",{className:"scrollbar-themed flex-grow space-y-1.5 overflow-y-auto p-3 text-xs",children:[a.jsx(lt,{label:"Name",value:e.name,icon:a.jsx(wi,{size:14})}),a.jsx(lt,{label:"Description",value:e.description,icon:a.jsx(cm,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Version",value:e.version,icon:a.jsx(ha,{size:14})}),a.jsx(lt,{label:"Endpoint",value:e.url||"N/A",icon:a.jsx(ql,{size:14})}),a.jsx(lt,{label:"Docs",value:e.documentationUrl?a.jsx("a",{href:e.documentationUrl,target:"_blank",rel:"noopener noreferrer",className:"break-all",children:"View Docs"}):"N/A",icon:a.jsx(Ul,{size:14})}),e.provider&&a.jsxs("div",{className:"mt-1.5 border-t pt-1.5",children:[a.jsx("h4",{className:"mb-0.5 text-xs font-semibold",children:"Provider"}),a.jsx(lt,{label:"Name",value:e.provider.organization}),a.jsx(lt,{label:"URL",value:e.provider.url||"N/A"})]}),a.jsx(lt,{label:"Capabilities",value:r(e.capabilities),icon:a.jsx(ga,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Input Modes",value:o(e.defaultInputModes),icon:a.jsx(xa,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Output Modes",value:o(e.defaultOutputModes),icon:a.jsx(xa,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Skills",value:s(e.skills),icon:a.jsx(um,{size:14}),fullWidthValue:!0}),a.jsx(lt,{label:"Tools Info",value:i(e.tools),icon:a.jsx(Wl,{size:14}),fullWidthValue:!0}),a.jsx("div",{className:"text-2xs mt-1.5 pt-1.5",children:a.jsx(lt,{label:"A2A Protocol",value:e.protocolVersion})})]}),a.jsx("div",{className:"border-t p-2 text-center text-sm text-accent-foreground",children:"Click for summary"})]})]})})},ui=({agents:e})=>{const[t,n]=u.useState(null),[r,o]=u.useState(""),s=l=>{n(c=>c===l?null:l)},i=e.filter(l=>{var c;return(c=l.displayName||l.name)==null?void 0:c.toLowerCase().includes(r.toLowerCase())});return a.jsx("div",{children:e.length===0?a.jsx("div",{className:"flex h-[calc(100vh-250px)] items-center justify-center",children:"No agents discovered in the current namespace."}):a.jsxs("div",{className:"mx-auto mt-[50px] ml-[50px]",children:[a.jsx("div",{className:"my-4",children:a.jsx("input",{type:"text","data-testid":"agent-search-input",placeholder:"Search...",value:r,onChange:l=>o(l.target.value),className:"bg-background rounded-md border px-3 py-2"})}),i.length===0&&r?a.jsxs("div",{className:"flex h-[calc(100vh-250px)] flex-col items-center justify-center gap-6",children:["No agents match your search.",a.jsx(Ae,{variant:"outline",title:"Clear Search",onClick:()=>o(""),children:"Clear Search"})]}):a.jsx("div",{className:"max-h-[calc(100vh-250px)] overflow-y-auto",children:a.jsx("div",{className:"flex flex-wrap gap-10",children:i.map(l=>a.jsx(TE,{agent:l,isExpanded:t===l.name,onToggleExpand:()=>s(l.name)},l.name))})})]})})},Ep={LAYOUT:"layout"};class AE{constructor(){ua(this,"_plugins",{});this.registerDefaultPlugins()}get plugins(){return Object.values(this._plugins)}registerPlugin(t){this._plugins[t.id]&&console.warn(`Plugin with ID ${t.id} already exists. Overwriting.`),this._plugins[t.id]=t}getPluginById(t){return this._plugins[t]}getPluginsByType(t){return Object.values(this._plugins).filter(n=>n.type===t)}registerDefaultPlugins(){this.registerPlugin({type:Ep.LAYOUT,id:"cards",label:"Cards",icon:dm,priority:100,render:t=>a.jsx(ui,{agents:t.agents||[]})})}renderPlugin(t,n){const r=this.getPluginById(t);if(r)return r.render(n)}}const Tp=new AE,NE=({currentLayout:e,onLayoutChange:t,className:n=""})=>{const r=Tp.getPluginsByType(Ep.LAYOUT);return r&&r.length>1?a.jsxs("div",{className:`flex items-center space-x-1 ${n}`,children:[a.jsx("span",{className:"text-sm font-semibold",children:"Layout:"}),a.jsx("div",{className:"flex gap-1 rounded-sm p-1",children:r.map(o=>{const s=o.icon,i=e===o.id;return a.jsxs(Ae,{variant:"ghost",size:"sm",onClick:()=>t(o.id),title:o.label,className:i?"bg-[var(--color-secondary-w20)] dark:bg-[var(--color-secondary-w80)]":"",children:[s&&a.jsx(s,{size:14}),a.jsx("span",{children:o.label})]},o.id)})})]}):null},Ol={CARDS:"cards"};function kE(){const{agents:e,agentsLoading:t,agentsError:n,agentsRefetch:r}=Ue(),[o,s]=u.useState("cards");if(t)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx("div",{children:"Loading agents..."})})});if(n)return a.jsx("div",{className:"space-y-6",children:a.jsx("div",{className:"flex h-96 items-center justify-center",children:a.jsx(oa,{variant:"error",message:`Error loading agents. ${n}`})})});const i=()=>{if(o===Ol.CARDS)return a.jsx(ui,{agents:e});const l=Tp.getPluginById(o);return l?l.render({agents:e}):(console.warn(`Layout ${o} not found, falling back to cards layout`),a.jsx(ui,{agents:e}))};return a.jsxs("div",{className:"flex h-full w-full flex-col",children:[a.jsx(Cp,{title:"Agents",buttons:[a.jsxs(Ae,{variant:"ghost",title:"Refresh Agents",onClick:()=>r(),children:[a.jsx(Yl,{className:"size-4"}),"Refresh Agents"]})]}),a.jsxs("div",{className:`relative flex-1 p-4 ${o===Ol.CARDS?"":"bg-[var(--muted)] dark:bg-[var(--color-bg-wMain)]"}`,children:[a.jsx("div",{className:"absolute right-8 z-20 flex items-center space-x-4",children:a.jsx(NE,{currentLayout:o,onLayoutChange:s})}),i()]})]})}const _E=({isOpen:e,onClose:t,onConfirm:n,sessionName:r})=>e?a.jsx(Go,{open:e,onOpenChange:t,children:a.jsxs(Vo,{children:[a.jsxs(Yo,{children:[a.jsx(Ko,{children:"Are you sure?"}),a.jsxs(qo,{children:["This action cannot be undone. This will permanently delete the chat session: ",a.jsx("strong",{children:r}),"."]})]}),a.jsxs(Nv,{children:[a.jsx(Ae,{variant:"outline",onClick:t,children:"Cancel"}),a.jsx(Ae,{variant:"destructive",onClick:n,children:"Delete"})]})]})}):null,co=4,di={chatPanelSizes:{default:50,min:30,max:96},sidePanelSizes:{default:50,min:20,max:70}},IE={chatPanelSizes:{...di.chatPanelSizes,min:50},sidePanelSizes:{...di.sidePanelSizes,max:50}};function jE(){var $;const{agents:e,sessionId:t,messages:n,setMessages:r,selectedAgentName:o,setSelectedAgentName:s,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,openSidePanelTab:c,setTaskIdInSidePanel:d,isResponding:f,latestStatusText:p,sessionToDelete:m,closeSessionDeleteModal:h,confirmSessionDelete:x}=Ue(),{isTaskMonitorConnected:g,isTaskMonitorConnecting:v,taskMonitorSseError:b,connectTaskMonitorStream:w}=Vi(),[y,E]=u.useState(!0),[T,_]=u.useState(!1),I=Xu(),[A,q]=u.useState(!1),K=u.useRef(null),U=u.useRef(null),Y=u.useRef(null),{chatPanelSizes:J,sidePanelSizes:O}=u.useMemo(()=>y?di:IE,[y]),X=u.useCallback(L=>{if(_(!0),U.current)if(L)U.current.resize(co);else{const G=Y.current||O.default;U.current.resize(G)}setTimeout(()=>_(!1),300)},[O.default]),N=u.useCallback(()=>{l(!0)},[l]),R=u.useCallback(()=>{l(!1)},[l]),S=u.useCallback(L=>{L>co+1&&(Y.current=L)},[]),F=u.useCallback(()=>{E(!y)},[y]);u.useEffect(()=>{U.current&&i&&U.current.resize(co);const L=()=>{if(U.current&&i){_(!0);const G=Y.current||O.default;U.current.resize(G),l(!1),setTimeout(()=>_(!1),300)}};return window.addEventListener("expand-side-panel",L),()=>{window.removeEventListener("expand-side-panel",L)}},[i,l,O.default]),u.useEffect(()=>{if(!o&&e.length>0){const L=e.find(Q=>Q.name==="OrchestratorAgent"),G=L?L.name:e[0].name;s(G);const k=e.find(Q=>Q.name===G),V=k!=null&&k.displayName?`Hi! I'm the ${k==null?void 0:k.displayName} Agent. How can I help?`:`Hi! I'm ${G}. How can I help?`;r(Q=>[...Q.filter(oe=>!oe.isStatusBubble),{role:"agent",kind:"message",messageId:`welcome-${Date.now()}`,parts:[{kind:"text",text:V}],isUser:!1,isComplete:!0,metadata:{sessionId:t,lastProcessedEventSequence:0}}])}},[e,o,t,r,s]);const M=u.useMemo(()=>{const L=new Map;return n.forEach((G,k)=>{G.taskId&&L.set(G.taskId,k)}),L},[n]),P=u.useMemo(()=>n.find(L=>L.isStatusBubble),[n]),ee=u.useMemo(()=>{if(!P||!P.parts)return null;const L=P.parts.find(G=>G.kind==="text");return(L==null?void 0:L.text)||null},[P]),D=u.useMemo(()=>{if(P!=null&&P.taskId)return()=>{d(P.taskId),c("workflow")}},[P==null?void 0:P.taskId,d,c]);return u.useEffect(()=>{const L=()=>{!g&&!v&&b&&(console.log("ChatPage: Window focused while disconnected, attempting reconnection..."),w())};return window.addEventListener("focus",L),()=>{window.removeEventListener("focus",L)}},[g,v,b,w]),a.jsxs("div",{className:"relative flex h-screen w-full flex-col overflow-hidden",children:[a.jsx("div",{className:`absolute top-0 left-0 z-20 h-screen transition-transform duration-300 ${y?"-translate-x-full":"translate-x-0"}`,children:a.jsx(zC,{onToggle:F})}),a.jsx("div",{className:`transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:a.jsx(Cp,{title:I,leadingAction:y?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ae,{variant:"ghost",onClick:F,className:"h-10 w-10 p-0",tooltip:"Show Sessions Panel",children:a.jsx(Kl,{className:"size-5"})}),a.jsx("div",{className:"h-6 w-px bg-gray-300 dark:bg-gray-600"}),a.jsx(Ae,{variant:"ghost",onClick:()=>q(!0),className:"h-10 w-10 p-0",tooltip:"Start New Chat Session",children:a.jsx(vi,{className:"size-5"})})]}):null})}),a.jsx("div",{className:"flex min-h-0 flex-1",children:a.jsx("div",{className:`min-h-0 flex-1 overflow-x-auto transition-all duration-300 ${y?"ml-0":"ml-100"}`,children:a.jsxs(nw,{direction:"horizontal",autoSaveId:"chat-side-panel",className:"h-full",children:[a.jsx(ol,{defaultSize:J.default,minSize:J.min,maxSize:J.max,id:"chat-panel",children:a.jsxs("div",{className:"flex h-full w-full flex-col py-6",children:[a.jsx(uf,{className:"text-base",ref:K,children:n.map((L,G)=>{var V;const k=!!(L.taskId&&M.get(L.taskId)===G);return a.jsx(SC,{message:L,isLastWithTaskId:k},`${((V=L.metadata)==null?void 0:V.sessionId)||"session"}-${G}-${L.isUser?"received":"sent"}`)})}),a.jsxs("div",{style:cf,children:[f&&a.jsx(ai,{statusText:(ee||p.current)??void 0,onViewWorkflow:D}),a.jsx(nb,{agents:e,scrollToBottom:($=K.current)==null?void 0:$.scrollToBottom})]})]})}),a.jsx(rw,{}),a.jsx(ol,{ref:U,defaultSize:O.default,minSize:O.min,maxSize:O.max,collapsedSize:co,collapsible:!0,onCollapse:N,onExpand:R,onResize:S,id:"chat-side-panel",className:T?"transition-all duration-300 ease-in-out":"",children:a.jsx("div",{className:"h-full",children:a.jsx(FC,{onCollapsedToggle:X,isSidePanelCollapsed:i,setIsSidePanelCollapsed:l,isSidePanelTransitioning:T})})})]})})}),a.jsx(hp,{isOpen:A,onClose:()=>q(!1)}),a.jsx(_E,{isOpen:!!m,onClose:h,onConfirm:x,sessionName:(m==null?void 0:m.name)||`Session ${m==null?void 0:m.id.substring(0,8)}`})]})}const ME=e=>({displayName:e?"Solace Dark JER":"Solace Light JER",styles:{container:{backgroundColor:"transparent",fontFamily:"monospace",fontSize:"14px"},property:e?"var(--color-primary-text-w10)":"var(--color-primary-text-wMain)",bracket:"var(--color-secondary-text-w50)",itemCount:{color:"var(--color-secondary-text-w50)",fontStyle:"italic"},string:e?"var(--color-success-w70)":"var(--color-success-wMain)",number:"var(--color-accent-n0-wMain)",boolean:e?"var(--color-warning-w70)":"var(--color-warning-wMain)",null:{color:"var(--color-secondary-text-w50)",fontStyle:"italic"},iconCollection:"var(--color-secondary-text-w50)",iconCopy:"var(--color-secondary-text-w50)"}}),fi=({data:e,maxDepth:t=2,className:n=""})=>{const{currentTheme:r}=Zu(),o=u.useMemo(()=>ME(r==="dark"),[r]),s=u.useMemo(()=>t===void 0||t<0?!1:t,[t]),i=u.useMemo(()=>e===null||typeof e!="object"?{value:e}:e,[e]),l=`rounded-lg border overflow-auto ${n}`.trim();return e===void 0?a.jsx("div",{className:l,children:a.jsx("span",{className:"italic",children:"No JSON data"})}):a.jsx("div",{className:l,children:a.jsx(fm,{data:i,theme:o,viewOnly:!0,collapse:s,showStringQuotes:!0,showCollectionCount:"when-closed"})})};let uo=null,fo=null;function RE({children:e}){const{fetchCsrfToken:t}=Ku(),[n,r]=u.useState(uo),[o,s]=u.useState(!uo&&!fo),[i,l]=u.useState(fo);return u.useEffect(()=>{if(uo||fo)return;let c=!0;return(async()=>{s(!0),l(null);try{let f=await ze("/api/v1/config",{credentials:"include",headers:{Accept:"application/json"}}),p;if(f.ok)p=await f.json();else{const x=await f.text();if(console.error("Initial config fetch failed:",f.status,x),f.status===403){console.log("Config fetch failed with 403, attempting to get CSRF token first...");const g=await t();if(!g)throw new Error("Failed to obtain CSRF token after config fetch failed.");if(console.log("Retrying config fetch with CSRF token..."),f=await ze("/api/v1/config",{credentials:"include",headers:{"X-CSRF-TOKEN":g,Accept:"application/json"}}),!f.ok){const v=await f.text();throw console.error("Config fetch retry failed:",f.status,v),new Error(`Failed to fetch config on retry: ${f.status} ${v}`)}p=await f.json()}else throw new Error(`Failed to fetch config: ${f.status} ${x}`)}const m=p.frontend_use_authorization??!1;m&&(console.log("Fetching CSRF token for config-related requests..."),await t());const h={configServerUrl:p.frontend_server_url,configAuthLoginUrl:p.frontend_auth_login_url,configUseAuthorization:m,configWelcomeMessage:p.frontend_welcome_message,configRedirectUrl:p.frontend_redirect_url,configCollectFeedback:p.frontend_collect_feedback,configBotName:p.frontend_bot_name,configFeatureEnablement:p.frontend_feature_enablement??{},frontend_use_authorization:p.frontend_use_authorization,persistenceEnabled:p.persistence_enabled??!0};c&&(uo=h,r(h)),console.log("App config processed and set:",h)}catch(f){if(console.error("Error initializing app:",f),c){const p=f.message||"Failed to load application configuration.";fo=p,l(p)}}finally{c&&s(!1)}})(),()=>{c=!1}},[t]),n?a.jsx(Hu.Provider,{value:n,children:e}):o?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Loading Configuration..."})]})}):i?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-red-100 dark:bg-red-900",children:a.jsxs("div",{className:"rounded border border-red-400 bg-white p-4 text-center dark:bg-gray-800",children:[a.jsx("h1",{className:"text-xl font-bold text-red-700 dark:text-red-300",children:"Configuration Error"}),a.jsx("p",{className:"mt-2 text-red-600 dark:text-red-200",children:i}),a.jsx("p",{className:"mt-2 text-sm text-gray-600 dark:text-gray-400",children:"Please check the backend server and network connection, then refresh the page."})]})}):a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl",children:"Initializing Application..."})]})})}const PE=({children:e})=>{const{configServerUrl:t}=tn(),n=`${t}/api/v1`,[r,o]=u.useState(null),[s,i]=u.useState(!1),[l,c]=u.useState(!1),[d,f]=u.useState(null),[p,m]=u.useState({}),[h,x]=u.useState([]),[g,v]=u.useState(null),[b,w]=u.useState(0),[y,E]=u.useState(!1),T=10,_=u.useRef(null),I=u.useRef(null),A=u.useRef(null);u.useEffect(()=>{I.current=r},[r]);const q=u.useCallback(S=>{m(F=>{var D,$,L;const M=S.task_id;if(!M)return S.direction==="discovery"||console.warn("TaskMonitorContext: Received event without task_id, skipping:",S),F;const P=F[M],ee=new Date(S.timestamp);if(P){const G=[...P.events,S].sort((k,V)=>new Date(k.timestamp).getTime()-new Date(V.timestamp).getTime());return{...F,[M]:{...P,events:G,lastUpdated:ee}}}else{let G="Task started...";if(S.direction==="request"&&(($=(D=S.full_payload)==null?void 0:D.method)!=null&&$.startsWith("message/"))){const V=S.full_payload.params;if((L=V==null?void 0:V.message)!=null&&L.parts){const Q=V.message.parts.filter(te=>te.kind==="text"&&te.text);Q.length>0&&(G=Q[Q.length-1].text)}}const k={taskId:M,initialRequestText:G,events:[S],firstSeen:ee,lastUpdated:ee};return x(V=>[M,...V.filter(Q=>Q!==M)]),{...F,[M]:k}}})},[]),K=u.useCallback(()=>{console.log("TaskMonitorContext: SSE connection opened."),i(!1),c(!0),f(null),w(0),E(!1),A.current&&(clearTimeout(A.current),A.current=null)},[]),U=u.useCallback(S=>{try{const F=JSON.parse(S.data);q(F)}catch(F){console.error("TaskMonitorContext: Failed to parse SSE 'a2a_message' event data:",F,"Raw data:",S.data),f("Received unparseable 'a2a_message' event from server.")}},[q]),Y=u.useCallback(S=>{console.error("TaskMonitorContext: SSE connection error:",S),i(!1),c(!1),_.current&&_.current.readyState===EventSource.CLOSED?f("Task Monitor SSE connection closed by server or network issue."):f("Task Monitor SSE connection error occurred."),_.current&&(_.current.close(),_.current=null),A.current&&(clearTimeout(A.current),A.current=null)},[]),J=u.useCallback(async()=>{if(l||s){console.warn("TaskMonitorContext: Stream is already active or connecting.");return}console.log("TaskMonitorContext: Attempting to connect stream..."),i(!0);try{const S={subscription_targets:[{type:"my_a2a_messages"}]},F=await ze(`${n}/visualization/subscribe`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(S),credentials:"include"});if(!F.ok){const L=await F.json().catch(()=>({detail:"Failed to subscribe"}));if(L.error_type==="authorization_failure"){const G=L.message||"Access denied: insufficient permissions",k=L.suggested_action?` ${L.suggested_action}`:"";throw new Error(`${G}${k}`)}else if(L.error_type==="subscription_failure"){const G=L.message||"Subscription failed",k=L.suggested_action?` ${L.suggested_action}`:"";throw new Error(`${G}${k}`)}else throw new Error(L.detail||L.message||`Subscription failed: ${F.statusText}`)}const M=await F.json();o(M.stream_id);const P=M.sse_endpoint_url.startsWith("/")?`${t||""}${M.sse_endpoint_url}`:M.sse_endpoint_url;_.current&&_.current.close();const ee=bi(),D=`${P}${ee?`?token=${ee}`:""}`,$=new EventSource(D,{withCredentials:!0});_.current=$,$.onopen=K,$.addEventListener("a2a_message",U),$.onerror=Y}catch(S){console.error("TaskMonitorContext: Error connecting stream:",S),f(S instanceof Error?S.message:String(S)),i(!1),c(!1),o(null),_.current&&(_.current.close(),_.current=null),A.current&&(clearTimeout(A.current),A.current=null)}},[n,t,l,s,K,U,Y]),O=u.useCallback(()=>{if(A.current){console.log("TaskMonitorContext: Reconnection already in progress, skipping...");return}if(b>=T){console.warn("TaskMonitorContext: Max reconnection attempts reached. Stopping auto-reconnection."),E(!1),f(`Connection lost. Max reconnection attempts (${T}) reached.`);return}const S=2e3;console.log(`TaskMonitorContext: Attempting reconnection ${b+1}/${T} in ${S}ms...`),E(!0),w(F=>F+1),A.current=setTimeout(()=>{J()},S)},[b,J]),X=u.useCallback(async()=>{console.log("TaskMonitorContext: Disconnecting stream..."),A.current&&(clearTimeout(A.current),A.current=null),_.current&&(_.current.close(),_.current=null);const S=I.current;if(S)try{await ze(`${n}/visualization/${S}/unsubscribe`,{method:"DELETE",credentials:"include"})}catch(F){console.error(`TaskMonitorContext: Error unsubscribing from stream ID: ${S}`,F)}o(null),i(!1),c(!1),f(null),m({}),x([]),v(null),w(0),E(!1)},[n]);u.useEffect(()=>()=>{console.log("TaskMonitorProvider: Unmounting. Cleaning up Task Monitor SSE connection."),_.current&&(_.current.close(),_.current=null);const S=I.current;if(S)if(navigator.sendBeacon){const F=new FormData;navigator.sendBeacon(`${n}/visualization/${S}/unsubscribe`,F)}else ze(`${n}/visualization/${S}/unsubscribe`,{method:"DELETE",credentials:"include",keepalive:!0}).catch(F=>console.error("TaskMonitorProvider: Error in final unsubscribe on unmount (fetch):",F))},[n]),u.useEffect(()=>{!l&&!s&&(console.log("TaskProvider: Auto-connecting to task monitor stream..."),J())},[]),u.useEffect(()=>{!l&&!s&&d&&(console.log("TaskMonitorContext: Connection lost, initiating auto-reconnection..."),O())},[l,s,d,O]),u.useEffect(()=>()=>{A.current&&(clearTimeout(A.current),A.current=null)},[]);const N=u.useCallback(S=>{v(S)},[]),R={isTaskMonitorConnecting:s,isTaskMonitorConnected:l,taskMonitorSseError:d,monitoredTasks:p,monitoredTaskOrder:h,highlightedStepId:g,isReconnecting:y,reconnectionAttempts:b,connectTaskMonitorStream:J,disconnectTaskMonitorStream:X,setHighlightedStepId:N};return a.jsx(Gu.Provider,{value:R,children:e})},LE=({children:e})=>{const{configWelcomeMessage:t,configServerUrl:n}=tn(),r=`${n}/api/v1`,o=1*1024*1024,s=B=>new Promise((z,H)=>{const ie=new FileReader;ie.readAsDataURL(B),ie.onload=()=>z(ie.result.split(",")[1]),ie.onerror=fe=>H(fe)}),[i,l]=u.useState(""),[c,d]=u.useState([]),[f,p]=u.useState(""),[m,h]=u.useState(!1),[x,g]=u.useState([]),[v,b]=u.useState(null),w=u.useRef(null),[y,E]=u.useState(""),[T,_]=u.useState(!1),I=u.useRef(T);u.useEffect(()=>{I.current=T},[T]);const[A,q]=u.useState(null),K=u.useRef(null),U=u.useRef(!1),Y=u.useRef(null),J=u.useRef(0),{agents:O,error:X,isLoading:N,refetch:R}=hw(),{artifacts:S,isLoading:F,refetch:M}=gw(i),[P,ee]=u.useState(!0),[D,$]=u.useState("files"),[L,G]=u.useState(!1),[k,V]=u.useState(null),[Q,te]=u.useState(!1),[oe,se]=u.useState(new Set),[de,me]=u.useState(!1),[Me,Oe]=u.useState(null),[Le,je]=u.useState(null),[He,ot]=u.useState(null),[Qe,et]=u.useState(null),le=u.useCallback((B,z)=>{g(H=>{if(H.find(ge=>ge.message===B))return H;const fe=Date.now().toString(),pe={id:fe,message:B,type:z||"info"};return setTimeout(()=>{g(ge=>ge.filter(_e=>_e.id!==fe))},3e3),[...H,pe]})},[]),pt=u.useCallback(async B=>{const z=await ze(`${r}/sessions/${B}/messages`);if(!z.ok){const H=await z.json().catch(()=>({detail:"Failed to fetch session history"}));throw new Error(H.detail||`HTTP error ${z.status}`)}return z.json()},[r]),tt=u.useCallback(async B=>{const z=new FormData;z.append("file",B);try{const H=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B.name)}`,{method:"POST",body:z,credentials:"include"});if(!H.ok){const fe=await H.json().catch(()=>({detail:`Failed to upload ${B.name}`}));throw new Error(fe.detail||`HTTP error ${H.status}`)}const ie=await H.json();return le(`Artifact "${B.name}" uploaded successfully.`),await M(),ie.uri||null}catch(H){return le(`Error uploading artifact "${B.name}": ${H instanceof Error?H.message:"Unknown error"}`),null}},[r,le,M]),[mt,jt]=u.useState(null),[wt,Et]=u.useState(null),Tt=u.useCallback(async B=>{try{const z=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}`,{method:"DELETE",credentials:"include"});if(!z.ok&&z.status!==204){const H=await z.json().catch(()=>({detail:`Failed to delete ${B}`}));throw new Error(H.detail||`HTTP error ${z.status}`)}le(`File "${B}" deleted successfully.`),M()}catch(z){le(`Error deleting file "${B}": ${z instanceof Error?z.message:"Unknown error"}`)}},[r,le,M]),Wt=u.useCallback(B=>{V(B),G(!0)},[]),ht=u.useCallback(()=>{V(null),G(!1)},[]),At=u.useCallback(async()=>{k&&await Tt(k.filename),ht()},[k,Tt,ht]),Ke=u.useCallback(()=>{if(oe.size===0){le("No files selected for deletion.");return}me(!0)},[oe,le]),gt=u.useCallback(async()=>{me(!1);const B=Array.from(oe);let z=0,H=0;for(const ie of B)try{const fe=await ze(`${r}/artifacts/${encodeURIComponent(ie)}`,{method:"DELETE",credentials:"include"});if(!fe.ok&&fe.status!==204)throw new Error(`Failed to delete ${ie}`);z++}catch(fe){console.error(fe),H++}z>0&&le(`${z} files(s) deleted successfully.`),H>0&&le(`Failed to delete ${H} files(s).`),M(),se(new Set),te(!1)},[oe,r,le,M]),Mt=u.useCallback(async B=>{je(null),ot(null),et(null);try{const z=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions`,{credentials:"include"});if(!z.ok)throw new Error("Error fetching version list");const H=await z.json();if(!H||H.length===0)throw new Error("No versions available");je(H.sort((ue,Ie)=>ue-Ie));const ie=Math.max(...H);ot(ie);const fe=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions/${ie}`,{credentials:"include"});if(!fe.ok)throw new Error("Error fetching latest version content");const pe=await fe.blob(),ge=await new Promise((ue,Ie)=>{const Z=new FileReader;Z.onloadend=()=>{var C;return ue(((C=Z.result)==null?void 0:C.toString().split(",")[1])||"")},Z.onerror=Ie,Z.readAsDataURL(pe)}),_e=S.find(ue=>ue.filename===B),ae={name:B,mime_type:(_e==null?void 0:_e.mime_type)||"application/octet-stream",content:ge,last_modified:(_e==null?void 0:_e.last_modified)||new Date().toISOString()};return et(ae),ae}catch(z){return le(`Error loading preview for ${B}: ${z instanceof Error?z.message:"Unknown error"}`),null}},[r,le,S]),Rt=u.useCallback(async(B,z)=>{if(!Le||!Le.includes(z))return le(`Version ${z} is not available for ${B}.`),null;et(null);try{const H=await ze(`${r}/artifacts/${i}/${encodeURIComponent(B)}/versions/${z}`,{credentials:"include"});if(!H.ok)throw new Error(`Error fetching version ${z}`);const ie=await H.blob(),fe=await new Promise((_e,ae)=>{const ue=new FileReader;ue.onloadend=()=>{var Ie;return _e(((Ie=ue.result)==null?void 0:Ie.toString().split(",")[1])||"")},ue.onerror=ae,ue.readAsDataURL(ie)}),pe=S.find(_e=>_e.filename===B),ge={name:B,mime_type:(pe==null?void 0:pe.mime_type)||"application/octet-stream",content:fe,last_modified:(pe==null?void 0:pe.last_modified)||new Date().toISOString()};return ot(z),et(ge),ge}catch(H){return le(`Error loading version ${z}: ${H instanceof Error?H.message:"Unknown error"}`),null}},[r,le,S,Le]),nn=u.useCallback(B=>{le(`Loading preview for attached file: ${B.name}`),et(B),je(null),ot(null)},[le]),Nt=u.useCallback(B=>{ee(!1),$(B),typeof window<"u"&&window.dispatchEvent(new CustomEvent("expand-side-panel",{detail:{tab:B}}))},[]),De=u.useCallback(()=>{K.current&&(clearTimeout(K.current),K.current=null),w.current&&(w.current.close(),w.current=null),U.current=!1},[]),qe=u.useCallback(B=>{var Z;J.current+=1;const z=J.current;let H;try{console.log("TEST-SSE ChatProvider Raw Message:",B.data),H=JSON.parse(B.data)}catch(C){console.error("Failed to parse SSE message:",C),le("Received unparseable agent update.","error");return}if("error"in H&&H.error){const j=`Error: ${H.error.message}`;d(W=>{const he=W.filter(ye=>!ye.isStatusBubble);return he.push({role:"agent",parts:[{kind:"text",text:j}],isUser:!1,isError:!0,isComplete:!0,metadata:{messageId:`msg-${crypto.randomUUID()}`,lastProcessedEventSequence:z}}),he}),h(!1),De(),b(null);return}if(!("result"in H)||!H.result){console.warn("Received SSE message without a result or error field.",H);return}const ie=H.result;let fe=!1,pe,ge,_e;switch(ie.kind){case"task":fe=!0,pe=void 0,_e=ie.id,ie.artifacts&&ie.artifacts.length>0&&console.log("Final task has artifacts to process:",ie.artifacts);break;case"status-update":fe=ie.final,pe=(Z=ie.status)==null?void 0:Z.message,_e=ie.taskId;break;case"artifact-update":ge=ie.artifact,_e=ie.taskId;break;default:console.warn("Received unknown result kind in SSE message:",ie);return}const ae=[],ue=[];let Ie=null;if(pe!=null&&pe.parts)for(const C of pe.parts)if(C.kind==="data"){const j=C.data;if(j&&typeof j=="object"&&"type"in j)switch(j.type){case"agent_progress_update":Ie=String((j==null?void 0:j.status_text)??"Processing...");break;case"artifact_creation_progress":Ie=`Saving artifact: ${String((j==null?void 0:j.filename)??"unknown file")} (${Number((j==null?void 0:j.bytes_saved)??0)} bytes)`;break;case"tool_invocation_start":break;default:ae.push(C)}}else if(C.kind==="file"){const W=C.file,he={name:W.name||"untitled_file",mime_type:W.mimeType};"bytes"in W&&W.bytes?he.content=W.bytes:"uri"in W&&W.uri&&(he.uri=W.uri),ue.push(he)}else ae.push(C);Ie&&(Y.current=Ie),d(C=>{var Re;const j=[...C];let W=j[j.length-1];W!=null&&W.isStatusBubble&&(j.pop(),W=j[j.length-1]);const he=ae.find(we=>we.kind==="text"),ye=ae.filter(we=>we.kind!=="text");if(W&&!W.isUser&&!W.isComplete&&W.taskId===ie.taskId&&(he||ue.length>0)){const we={...W,parts:[...W.parts],files:W.files?[...W.files]:[],isComplete:fe||ue.length>0,metadata:{...W.metadata,lastProcessedEventSequence:z}};if(he){const xe=we.parts[we.parts.length-1];(xe==null?void 0:xe.kind)==="text"?we.parts[we.parts.length-1]={...xe,text:xe.text+he.text}:we.parts.push(he)}ye.length>0&&we.parts.push(...ye),ue.length>0&&we.files.push(...ue),j[j.length-1]=we}else if(ae.some(xe=>xe.kind==="text"&&xe.text.trim())||ue.length>0||ge){const xe={role:"agent",parts:ae,files:ue.length>0?ue:void 0,taskId:ie.taskId,isUser:!1,isComplete:fe||ue.length>0,metadata:{messageId:((Re=H.id)==null?void 0:Re.toString())||`msg-${crypto.randomUUID()}`,sessionId:ie.contextId,lastProcessedEventSequence:z}};ge&&(xe.artifactNotification={name:ge.name||ge.artifactId}),j.push(xe)}if(!fe&&Y.current)j.push({role:"agent",parts:[{kind:"text",text:Y.current}],taskId:ie.taskId,isUser:!1,isStatusBubble:!0,isComplete:!1,metadata:{messageId:`status-${crypto.randomUUID()}`,lastProcessedEventSequence:z}});else if(fe){Y.current=null;const we=j.findLastIndex(xe=>!xe.isUser&&xe.taskId===_e);we!==-1&&(j[we]={...j[we],isComplete:!0,metadata:{...j[we].metadata,lastProcessedEventSequence:z}})}return j}),fe&&(I.current&&(le("Task successfully cancelled."),K.current&&clearTimeout(K.current),_(!1)),h(!1),De(),b(null),U.current=!0,M(),setTimeout(()=>{U.current=!1},100))},[le,De,M]),st=u.useCallback(async()=>{const B="ChatProvider.handleNewSession:";if(console.log(`${B} Starting new session process...`),De(),m&&v&&y&&!T){console.log(`${B} Cancelling current task ${v}`);try{const H={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}};ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H),credentials:"include"})}catch(H){console.warn(`${B} Failed to cancel current task:`,H)}}K.current&&(clearTimeout(K.current),K.current=null),_(!1),console.log(`${B} Resetting session state - new session will be created when first message is sent`),l(""),d(t?[{parts:[{kind:"text",text:t}],isUser:!1,isComplete:!0,role:"agent",metadata:{sessionId:"",lastProcessedEventSequence:0}}]:[]),p(""),h(!1),b(null),q(null),Oe(null),U.current=!1,Y.current=null,J.current=0,console.log(`${B} Refreshing artifacts for new session...`),await M(),le("New session started successfully."),console.log(`${B} New session setup complete - session will be created on first message.`)},[De,m,v,y,T,t,le,M]),rn=u.useCallback(async B=>{const z="ChatProvider.handleSwitchSession:";if(console.log(`${z} Switching to session ${B}...`),De(),m&&v&&y&&!T){console.log(`${z} Cancelling current task ${v}`);try{const H={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}};await ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H),credentials:"include"})}catch(H){console.warn(`${z} Failed to cancel current task:`,H)}}K.current&&(clearTimeout(K.current),K.current=null),_(!1);try{const ie=(await pt(B)).map(pe=>({parts:[{kind:"text",text:pe.message}],isUser:pe.sender_type==="user",isComplete:!0,role:pe.sender_type==="user"?"user":"agent",metadata:{sessionId:pe.session_id,messageId:pe.id,lastProcessedEventSequence:0}})),fe=await ze(`${r}/sessions/${B}`);if(fe.ok){const pe=await fe.json();jt(pe.name)}l(B),d(ie),p(""),h(!1),b(null),q(null),Oe(null),U.current=!1,Y.current=null,J.current=0}catch(H){console.error(`${z} Failed to fetch session history:`,H),le("Error switching session. Please try again.","error")}},[De,m,v,y,T,r,le,pt]),on=u.useCallback(async(B,z)=>{try{const H=await ze(`${r}/sessions/${B}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:z})});if(!H.ok){const ie=await H.json().catch(()=>({detail:"Failed to update session name"}));throw new Error(ie.detail||`HTTP error ${H.status}`)}le("Session name updated successfully."),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(H){le(`Error updating session name: ${H instanceof Error?H.message:"Unknown error"}`)}},[r,le]),Pe=u.useCallback(async B=>{try{const z=await ze(`${r}/sessions/${B}`,{method:"DELETE"});if(!z.ok){const H=await z.json().catch(()=>({detail:"Failed to delete session"}));throw new Error(H.detail||`HTTP error ${z.status}`)}le("Session deleted successfully."),B===i&&st(),typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}catch(z){le(`Error deleting session: ${z instanceof Error?z.message:"Unknown error"}`)}},[r,le,st,i]),xt=u.useCallback(B=>{Et(B)},[]),sn=u.useCallback(()=>{Et(null)},[]),Gt=u.useCallback(async()=>{wt&&(await Pe(wt.id),Et(null))},[wt,Pe]),Pt=u.useCallback(async()=>{if(!m&&!T||!v){le("No active task to cancel.");return}if(T){le("Cancellation already in progress.");return}le(`Requesting cancellation for task ${v}...`),_(!0);try{const B={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"tasks/cancel",params:{id:v}},z=await ze(`${r}/tasks/${v}:cancel`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(z.status===202)K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{le(`Cancellation for task ${v} timed out. Allowing new input.`),_(!1),h(!1),De(),b(null),K.current=null,d(H=>H.filter(ie=>!ie.isStatusBubble))},15e3);else{const H=await z.json().catch(()=>({detail:"Unknown cancellation error"}));le(`Failed to request cancellation: ${H.detail||z.statusText}`),_(!1)}}catch(B){le(`Error sending cancellation request: ${B instanceof Error?B.message:"Network error"}`),_(!1)}},[m,T,v,r,le,De]),Lt=u.useCallback(()=>{},[]),Dt=u.useCallback(()=>{m&&!U.current&&!I.current&&le("Connection error with agent updates."),U.current||(h(!1),I.current||(De(),b(null)),Y.current=null),d(B=>B.filter(z=>!z.isStatusBubble).map((z,H,ie)=>H===ie.length-1&&!z.isUser?{...z,isComplete:!0}:z))},[le,De,m]),be=u.useCallback(async(B,z,H)=>{console.log("handleSubmit: using sessionId",i),B.preventDefault();const ie=(H==null?void 0:H.trim())||f.trim(),fe=z||[];if(!ie&&fe.length===0||m||T||!y){y||le("Please select an agent first."),T&&le("Cannot send new message while a task is being cancelled.");return}De(),U.current=!1,h(!0),b(null),Y.current=null,J.current=0;const pe={role:"user",parts:[{kind:"text",text:ie}],isUser:!0,uploadedFiles:fe.length>0?fe:void 0,metadata:{messageId:`msg-${crypto.randomUUID()}`,sessionId:i,lastProcessedEventSequence:0}};Y.current="Thinking",d(ge=>[...ge,pe]),p("");try{const ge=fe.map(async ye=>{if(ye.size<o)return{kind:"file",file:{bytes:await s(ye),name:ye.name,mimeType:ye.type}};{const Re=await tt(ye);return Re?{kind:"file",file:{uri:Re,name:ye.name,mimeType:ye.type}}:(le(`Failed to upload large file: ${ye.name}`,"error"),null)}}),_e=(await Promise.all(ge)).filter(ye=>ye!==null),ae=[];if(ie&&ae.push({kind:"text",text:ie}),ae.push(..._e),ae.length===0)throw new Error("Cannot send an empty message.");console.log(`ChatProvider handleSubmit: Using sessionId for contextId: ${i}`);const ue={role:"user",parts:ae,messageId:`msg-${crypto.randomUUID()}`,kind:"message",contextId:i,metadata:{agent_name:y}},Ie={jsonrpc:"2.0",id:`req-${crypto.randomUUID()}`,method:"message/stream",params:{message:ue}};console.log("ChatProvider handleSubmit: Sending POST to /message:stream");const Z=await ze(`${r}/message:stream`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ie)});if(!Z.ok){const ye=await Z.json().catch(()=>({detail:"Unknown error"}));throw console.error("ChatProvider handleSubmit: Error from /message:stream",Z.status,ye),new Error(ye.detail||`HTTP error ${Z.status}`)}const C=await Z.json(),j=C==null?void 0:C.result,W=j==null?void 0:j.id,he=j==null?void 0:j.contextId;if(console.log(`ChatProvider handleSubmit: Extracted responseSessionId: ${he}, current sessionId: ${i}`),console.log("ChatProvider handleSubmit: Full result object:",C),!W)throw console.error("ChatProvider handleSubmit: Backend did not return a valid taskId. Result:",C),new Error("Backend did not return a valid taskId.");if(console.log(`ChatProvider handleSubmit: Checking session update condition - responseSessionId: ${he}, sessionId: ${i}, different: ${he!==i}`),he&&he!==i){console.log(`ChatProvider handleSubmit: Updating sessionId from ${i} to ${he}`);const ye=!i||i==="";l(he),d(Re=>Re.map(we=>{var xe,it;return((xe=we.metadata)==null?void 0:xe.messageId)===((it=pe.metadata)==null?void 0:it.messageId)?{...we,metadata:{...we.metadata,sessionId:he}}:we})),ye&&typeof window<"u"&&window.dispatchEvent(new CustomEvent("new-chat-session"))}console.log(`ChatProvider handleSubmit: Received taskId ${W}. Setting currentTaskId and taskIdInSidePanel.`),b(W),q(W)}catch(ge){console.error("ChatProvider handleSubmit: Catch block error",ge),le(`Error: ${ge instanceof Error?ge.message:"Unknown error"}`),h(!1),d(_e=>_e.filter(ae=>!ae.isStatusBubble)),b(null),U.current=!1,Y.current=null}},[f,m,T,i,y,r,le,De,tt]);u.useEffect(()=>{if(v&&r){console.log(`ChatProvider Effect: currentTaskId is ${v}. Setting up EventSource.`);const B=bi(),z=`${r}/sse/subscribe/${v}${B?`?token=${B}`:""}`,H=new EventSource(z,{withCredentials:!0});return w.current=H,H.onopen=Lt,H.onerror=Dt,H.addEventListener("status_update",qe),H.addEventListener("artifact_update",qe),H.addEventListener("final_response",qe),H.addEventListener("error",qe),()=>{console.log(`ChatProvider Effect Cleanup: currentTaskId was ${v}. Closing EventSource.`),H.removeEventListener("status_update",qe),H.removeEventListener("artifact_update",qe),H.removeEventListener("final_response",qe),H.removeEventListener("error",qe),De()}}else console.log("ChatProvider Effect: currentTaskId is null or apiPrefix missing. Ensuring EventSource is closed."),De()},[v,r,qe,Lt,Dt,De]);const Ee={sessionId:i,setSessionId:l,sessionName:mt,setSessionName:jt,messages:c,setMessages:d,userInput:f,setUserInput:p,isResponding:m,currentTaskId:v,isCancelling:T,latestStatusText:Y,agents:O,agentsLoading:N,agentsError:X,agentsRefetch:R,handleNewSession:st,handleSwitchSession:rn,handleSubmit:be,handleCancel:Pt,notifications:x,addNotification:le,selectedAgentName:y,setSelectedAgentName:E,artifacts:S,artifactsLoading:F,artifactsRefetch:M,uploadArtifactFile:tt,isSidePanelCollapsed:P,activeSidePanelTab:D,setIsSidePanelCollapsed:ee,setActiveSidePanelTab:$,openSidePanelTab:Nt,taskIdInSidePanel:A,setTaskIdInSidePanel:q,isDeleteModalOpen:L,artifactToDelete:k,openDeleteModal:Wt,closeDeleteModal:ht,confirmDelete:At,openSessionDeleteModal:xt,closeSessionDeleteModal:sn,confirmSessionDelete:Gt,sessionToDelete:wt,isArtifactEditMode:Q,setIsArtifactEditMode:te,selectedArtifactFilenames:oe,setSelectedArtifactFilenames:se,handleDeleteSelectedArtifacts:Ke,confirmBatchDeleteArtifacts:gt,isBatchDeleteModalOpen:de,setIsBatchDeleteModalOpen:me,previewedArtifactAvailableVersions:Le,currentPreviewedVersionNumber:He,previewFileContent:Qe,openArtifactForPreview:Mt,navigateArtifactVersion:Rt,openMessageAttachmentForPreview:nn,previewArtifact:Me,setPreviewArtifact:Oe,updateSessionName:on,deleteSession:Pe};return a.jsx(Uu.Provider,{value:Ee,children:e})},DE=({children:e})=>{const{frontend_use_authorization:t,configAuthLoginUrl:n}=tn(),{fetchCsrfToken:r,clearCsrfToken:o}=Ku(),[s,i]=u.useState(!1),[l,c]=u.useState(!0),[d,f]=u.useState(null);u.useEffect(()=>{let h=!0;const x=async()=>{if(!t){h&&(i(!0),c(!1));return}try{const v=await ze("/api/v1/users/me",{credentials:"include",headers:{Accept:"application/json"}});if(v.ok){const b=await v.json();console.log("User is authenticated:",b),h&&(f(b),i(!0)),console.log("Fetching CSRF token for authenticated requests..."),await r()}else v.status===401?(console.log("User is not authenticated"),h&&i(!1)):(console.error("Unexpected response from /users/me:",v.status),h&&i(!1))}catch(v){console.error("Error checking authentication:",v),h&&i(!1)}finally{h&&c(!1)}};x();const g=v=>{v.key==="access_token"&&x()};return window.addEventListener("storage",g),()=>{h=!1,window.removeEventListener("storage",g)}},[t,n,r]);const p=()=>{window.location.href=n},m=()=>{i(!1),f(null),o()};return l?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-white dark:bg-gray-900",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"border-solace-green mx-auto mb-4 h-12 w-12 animate-spin rounded-full border-b-2"}),a.jsx("h1",{className:"text-2xl text-black dark:text-white",children:"Checking Authentication..."})]})}):a.jsx(Bu.Provider,{value:{isAuthenticated:s,useAuthorization:t,login:p,logout:m,userInfo:d},children:e})};function OE(e){var r;if(typeof document>"u")return null;const n=`; ${document.cookie}`.split(`; ${e}=`);return n.length===2&&((r=n.pop())==null?void 0:r.split(";").shift())||null}const FE=e=>new Promise(t=>setTimeout(t,e)),zE=async(e=5,t=50)=>{try{const n=await ze("/api/v1/csrf-token",{credentials:"include"});if(!n.ok)throw new Error(`CSRF endpoint returned status ${n.status}`);const r=await n.json();if(r.csrf_token)return console.log("CSRF token found in response body:",r.csrf_token),r.csrf_token;for(let o=0;o<e;o++){const s=OE("csrf_token");if(s)return console.log(`CSRF token found in cookie after ${o} retries:`,s),s;console.log(`CSRF token not found in cookie, attempt ${o+1}/${e}. Waiting ${t}ms...`),await FE(t)}throw new Error("CSRF token not available in response or cookie after retries")}catch(n){return console.error("Error fetching/reading CSRF token:",n),null}};function $E({children:e}){const[t,n]=u.useState(null),r=u.useCallback(async()=>{if(t)return t;const i=await zE();if(i)n(i);else throw new Error("Failed to obtain CSRF token after config fetch failed.");return i},[t]),o=u.useCallback(()=>{n(null)},[]),s={fetchCsrfToken:r,clearCsrfToken:o};return a.jsx(Wu.Provider,{value:s,children:e})}const BE={brand:{wMain:"#00C895",w30:"#B3EFDF",wMain30:"#00C8954d",w10:"#E6FAF4",w60:"#66DEBF",w100:"#00AD93"},primary:{w100:"#01374E",w90:"#014968",wMain:"#015B82",w60:"#679DB4",w40:"#99BDCD",w20:"#CCDEE6",w10:"#E6EFF2",text:{wMain:"#273749",w100:"#000000",w10:"#CCCCCC"}},secondary:{w70:"#536574",w80:"#354E62",w8040:"#354E6240",w100:"#000000",wMain:"#8790A0",w40:"#CFD3D9",w20:"#E7E9EC",w10:"#F3F4F6",text:{wMain:"#647481",w50:"#B1B9C0"}},background:{w100:"#021B2F",wMain:"#03223B",w20:"#F7F8F9",w10:"#FFFFFF"},info:{w100:"#2B71B1",wMain:"#0591D3",w70:"#7CD3F6",w30:"#B4DEF2",w20:"#CDE9F6",w10:"#E6F4FB"},error:{w100:"#C33135",wMain:"#E94C4E",w70:"#ED9B9D",w30:"#F8C9CA",w20:"#FBDBDC",w10:"#FDEDED"},warning:{w100:"#E1681F",wMain:"#FF8E2B",w70:"#F8C785",w30:"#FFDDBF",w20:"#FFE8D5",w10:"#FFF4EA"},success:{w100:"#006B53",wMain:"#009A80",w70:"#6FCCBC",w30:"#B3E1D9",w20:"#CCEBE6",w10:"#E6F5F2"},stateLayer:{w10:"#03223B1a",w20:"#03223B33"},accent:{n0:{w100:"#2F51AD",wMain:"#3C69E1",w30:"#C5D2F6",w10:"#ECF0FC"},n1:{w100:"#1F284C",wMain:"#3A4880",w30:"#C4C8D9",w60:"#8991B3",w20:"#D8DAE6",w10:"#EBEDF2"},n2:{w100:"#165E64",wMain:"#009193",w30:"#B3DEDF",w20:"#CCE9E9",w10:"#E6F4F4"},n3:{w100:"#542D75",wMain:"#7841A8",w30:"#D7C6E5",w10:"#F2ECF6"},n4:{w100:"#951379",wMain:"#CB1AA5",w30:"#F2C4E8"},n5:{w100:"#D03C1B",wMain:"#F66651",w30:"#FCCEC7",w60:"#FAA397"},n6:{w100:"#DE7E00",wMain:"#FCA829",w30:"#FEE5BF"},n7:{w100:"#2DADE1",wMain:"#7CD3F6",w30:"#CBEDFB"},n8:{w100:"#4F5A63",wMain:"#86939E",w30:"#DBDFE2"},n9:{wMain:"#DA162D"}},learning:{wMain:"#033A6F",w90:"#022E59",w100:"#022343",w20:"#CDD8E2",w10:"#E6EBF1"}},UE={light:{background:"background.w10",foreground:"primary.text.wMain",card:"background.w10","card-foreground":"primary.text.wMain",popover:"background.w10","popover-foreground":"primary.text.wMain",primary:"primary.wMain","primary-foreground":"primary.text.w10",secondary:"secondary.w10","secondary-foreground":"secondary.text.wMain",muted:"secondary.w10","muted-foreground":"secondary.text.wMain",accent:"secondary.w40","accent-foreground":"secondary.text.wMain",destructive:"error.wMain",border:"secondary.w40",input:"secondary.w40",ring:"brand.wMain","ring-offset":"brand.wMain","accent-background":"background.w20","message-background":"secondary.w20","chart-1":"brand.w60","chart-2":"primary.wMain","chart-3":"accent.n3.wMain","chart-4":"accent.n6.wMain","chart-5":"accent.n5.wMain",sidebar:"background.w20","sidebar-foreground":"primary.text.wMain","sidebar-primary":"primary.wMain","sidebar-primary-foreground":"primary.text.w10","sidebar-accent":"secondary.w10","sidebar-accent-foreground":"secondary.text.wMain","sidebar-border":"secondary.w40","sidebar-ring":"brand.wMain"},dark:{background:"background.w100",foreground:"primary.text.w10",card:"background.wMain","card-foreground":"primary.text.w10",popover:"background.wMain","popover-foreground":"primary.text.w10",primary:"primary.w60","primary-foreground":"primary.text.wMain",secondary:"secondary.w80","secondary-foreground":"secondary.text.w50",muted:"secondary.w80","muted-foreground":"secondary.text.w50",accent:"secondary.w80","accent-foreground":"secondary.text.w50",destructive:"error.w70",border:"secondary.w70",input:"secondary.w70",ring:"brand.w60","ring-offset":"brand.w60","accent-background":"primary.w90","message-background":"secondary.w70","chart-1":"brand.w100","chart-2":"primary.wMain","chart-3":"accent.n3.w100","chart-4":"accent.n6.w30","chart-5":"accent.n5.w60",sidebar:"background.wMain","sidebar-foreground":"primary.text.w10","sidebar-primary":"primary.w60","sidebar-primary-foreground":"primary.text.wMain","sidebar-accent":"secondary.w80","sidebar-accent-foreground":"secondary.text.w50","sidebar-border":"secondary.w70","sidebar-ring":"brand.w60"}},HE={"error-text-wMain":"error.wMain","error-text-w50":"error.w70","warning-text-wMain":"warning.wMain","warning-text-w50":"warning.w70","success-text-wMain":"success.wMain","success-text-w50":"success.w70","info-text-wMain":"info.wMain","info-text-w50":"info.w70"};function Fl(e,t){const n=t.split(".");let r=e;for(const o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return console.warn(`Color path not found: ${t}`),"#000000";return typeof r=="string"?r:"#000000"}function WE(e,t){const n={},r=UE[t];for(const[o,s]of Object.entries(r)){const i=Fl(e,s);n[`--${o}`]=i}for(const[o,s]of Object.entries(HE)){const i=Fl(e,s);n[`--color-${o}`]=i}return n}const Mo="sam-theme";function GE(e){var n,r,o,s,i,l,c,d,f,p,m,h,x,g,v,b,w,y,E,T,_,I,A,q,K,U,Y,J,O,X,N,R,S,F,M,P,ee,D,$,L,G,k,V,Q,te,oe,se,de,me,Me,Oe,Le,je,He,ot,Qe,et,le,pt,tt,mt,jt,wt,Et,Tt,Wt,ht,At,Ke,gt,Mt,Rt,nn,Nt,De,qe,st,rn,on,Pe,xt,sn,Gt,Pt,Lt,Dt,be,Ee,B,z,H,ie,fe,pe,ge,_e,ae,ue,Ie,Z,C,j,W;const t={};return e.brand.wMain&&(t["--color-brand-wMain"]=e.brand.wMain),e.brand.wMain30&&(t["--color-brand-wMain30"]=e.brand.wMain30),e.brand.w100&&(t["--color-brand-w100"]=e.brand.w100),e.brand.w60&&(t["--color-brand-w60"]=e.brand.w60),e.brand.w30&&(t["--color-brand-w30"]=e.brand.w30),e.brand.w10&&(t["--color-brand-w10"]=e.brand.w10),e.primary.wMain&&(t["--color-primary-wMain"]=e.primary.wMain),e.primary.w100&&(t["--color-primary-w100"]=e.primary.w100),e.primary.w90&&(t["--color-primary-w90"]=e.primary.w90),e.primary.w60&&(t["--color-primary-w60"]=e.primary.w60),e.primary.w40&&(t["--color-primary-w40"]=e.primary.w40),e.primary.w20&&(t["--color-primary-w20"]=e.primary.w20),e.primary.w10&&(t["--color-primary-w10"]=e.primary.w10),e.primary.text.wMain&&(t["--color-primary-text-wMain"]=e.primary.text.wMain),e.primary.text.w100&&(t["--color-primary-text-w100"]=e.primary.text.w100),e.primary.text.w10&&(t["--color-primary-text-w10"]=e.primary.text.w10),e.secondary.wMain&&(t["--color-secondary-wMain"]=e.secondary.wMain),e.secondary.w100&&(t["--color-secondary-w100"]=e.secondary.w100),e.secondary.w80&&(t["--color-secondary-w80"]=e.secondary.w80),e.secondary.w8040&&(t["--color-secondary-w8040"]=e.secondary.w8040),e.secondary.w70&&(t["--color-secondary-w70"]=e.secondary.w70),e.secondary.w40&&(t["--color-secondary-w40"]=e.secondary.w40),e.secondary.w20&&(t["--color-secondary-w20"]=e.secondary.w20),e.secondary.w10&&(t["--color-secondary-w10"]=e.secondary.w10),e.secondary.text.wMain&&(t["--color-secondary-text-wMain"]=e.secondary.text.wMain),e.secondary.text.w50&&(t["--color-secondary-text-w50"]=e.secondary.text.w50),e.background.wMain&&(t["--color-background-wMain"]=e.background.wMain),e.background.w100&&(t["--color-background-w100"]=e.background.w100),e.background.w20&&(t["--color-background-w20"]=e.background.w20),e.background.w10&&(t["--color-background-w10"]=e.background.w10),(n=e.info)!=null&&n.wMain&&(t["--color-info-wMain"]=e.info.wMain),(r=e.info)!=null&&r.w100&&(t["--color-info-w100"]=e.info.w100),(o=e.info)!=null&&o.w70&&(t["--color-info-w70"]=e.info.w70),(s=e.info)!=null&&s.w30&&(t["--color-info-w30"]=e.info.w30),(i=e.info)!=null&&i.w20&&(t["--color-info-w20"]=e.info.w20),(l=e.info)!=null&&l.w10&&(t["--color-info-w10"]=e.info.w10),(c=e.error)!=null&&c.wMain&&(t["--color-error-wMain"]=e.error.wMain),(d=e.error)!=null&&d.w100&&(t["--color-error-w100"]=e.error.w100),(f=e.error)!=null&&f.w70&&(t["--color-error-w70"]=e.error.w70),(p=e.error)!=null&&p.w30&&(t["--color-error-w30"]=e.error.w30),(m=e.error)!=null&&m.w20&&(t["--color-error-w20"]=e.error.w20),(h=e.error)!=null&&h.w10&&(t["--color-error-w10"]=e.error.w10),(x=e.warning)!=null&&x.wMain&&(t["--color-warning-wMain"]=e.warning.wMain),(g=e.warning)!=null&&g.w100&&(t["--color-warning-w100"]=e.warning.w100),(v=e.warning)!=null&&v.w70&&(t["--color-warning-w70"]=e.warning.w70),(b=e.warning)!=null&&b.w30&&(t["--color-warning-w30"]=e.warning.w30),(w=e.warning)!=null&&w.w20&&(t["--color-warning-w20"]=e.warning.w20),(y=e.warning)!=null&&y.w10&&(t["--color-warning-w10"]=e.warning.w10),(E=e.success)!=null&&E.wMain&&(t["--color-success-wMain"]=e.success.wMain),(T=e.success)!=null&&T.w100&&(t["--color-success-w100"]=e.success.w100),(_=e.success)!=null&&_.w70&&(t["--color-success-w70"]=e.success.w70),(I=e.success)!=null&&I.w30&&(t["--color-success-w30"]=e.success.w30),(A=e.success)!=null&&A.w20&&(t["--color-success-w20"]=e.success.w20),(q=e.success)!=null&&q.w10&&(t["--color-success-w10"]=e.success.w10),(K=e.stateLayer)!=null&&K.w10&&(t["--color-stateLayer-w10"]=e.stateLayer.w10),(U=e.stateLayer)!=null&&U.w20&&(t["--color-stateLayer-w20"]=e.stateLayer.w20),(J=(Y=e.accent)==null?void 0:Y.n0)!=null&&J.wMain&&(t["--color-accent-n0-wMain"]=e.accent.n0.wMain),(X=(O=e.accent)==null?void 0:O.n0)!=null&&X.w100&&(t["--color-accent-n0-w100"]=e.accent.n0.w100),(R=(N=e.accent)==null?void 0:N.n0)!=null&&R.w30&&(t["--color-accent-n0-w30"]=e.accent.n0.w30),(F=(S=e.accent)==null?void 0:S.n0)!=null&&F.w10&&(t["--color-accent-n0-w10"]=e.accent.n0.w10),(P=(M=e.accent)==null?void 0:M.n1)!=null&&P.wMain&&(t["--color-accent-n1-wMain"]=e.accent.n1.wMain),(D=(ee=e.accent)==null?void 0:ee.n1)!=null&&D.w100&&(t["--color-accent-n1-w100"]=e.accent.n1.w100),(L=($=e.accent)==null?void 0:$.n1)!=null&&L.w60&&(t["--color-accent-n1-w60"]=e.accent.n1.w60),(k=(G=e.accent)==null?void 0:G.n1)!=null&&k.w30&&(t["--color-accent-n1-w30"]=e.accent.n1.w30),(Q=(V=e.accent)==null?void 0:V.n1)!=null&&Q.w20&&(t["--color-accent-n1-w20"]=e.accent.n1.w20),(oe=(te=e.accent)==null?void 0:te.n1)!=null&&oe.w10&&(t["--color-accent-n1-w10"]=e.accent.n1.w10),(de=(se=e.accent)==null?void 0:se.n2)!=null&&de.wMain&&(t["--color-accent-n2-wMain"]=e.accent.n2.wMain),(Me=(me=e.accent)==null?void 0:me.n2)!=null&&Me.w100&&(t["--color-accent-n2-w100"]=e.accent.n2.w100),(Le=(Oe=e.accent)==null?void 0:Oe.n2)!=null&&Le.w30&&(t["--color-accent-n2-w30"]=e.accent.n2.w30),(He=(je=e.accent)==null?void 0:je.n2)!=null&&He.w20&&(t["--color-accent-n2-w20"]=e.accent.n2.w20),(Qe=(ot=e.accent)==null?void 0:ot.n2)!=null&&Qe.w10&&(t["--color-accent-n2-w10"]=e.accent.n2.w10),(le=(et=e.accent)==null?void 0:et.n3)!=null&&le.wMain&&(t["--color-accent-n3-wMain"]=e.accent.n3.wMain),(tt=(pt=e.accent)==null?void 0:pt.n3)!=null&&tt.w100&&(t["--color-accent-n3-w100"]=e.accent.n3.w100),(jt=(mt=e.accent)==null?void 0:mt.n3)!=null&&jt.w30&&(t["--color-accent-n3-w30"]=e.accent.n3.w30),(Et=(wt=e.accent)==null?void 0:wt.n3)!=null&&Et.w10&&(t["--color-accent-n3-w10"]=e.accent.n3.w10),(Wt=(Tt=e.accent)==null?void 0:Tt.n4)!=null&&Wt.wMain&&(t["--color-accent-n4-wMain"]=e.accent.n4.wMain),(At=(ht=e.accent)==null?void 0:ht.n4)!=null&&At.w100&&(t["--color-accent-n4-w100"]=e.accent.n4.w100),(gt=(Ke=e.accent)==null?void 0:Ke.n4)!=null&>.w30&&(t["--color-accent-n4-w30"]=e.accent.n4.w30),(Rt=(Mt=e.accent)==null?void 0:Mt.n5)!=null&&Rt.wMain&&(t["--color-accent-n5-wMain"]=e.accent.n5.wMain),(Nt=(nn=e.accent)==null?void 0:nn.n5)!=null&&Nt.w100&&(t["--color-accent-n5-w100"]=e.accent.n5.w100),(qe=(De=e.accent)==null?void 0:De.n5)!=null&&qe.w60&&(t["--color-accent-n5-w60"]=e.accent.n5.w60),(rn=(st=e.accent)==null?void 0:st.n5)!=null&&rn.w30&&(t["--color-accent-n5-w30"]=e.accent.n5.w30),(Pe=(on=e.accent)==null?void 0:on.n6)!=null&&Pe.wMain&&(t["--color-accent-n6-wMain"]=e.accent.n6.wMain),(sn=(xt=e.accent)==null?void 0:xt.n6)!=null&&sn.w100&&(t["--color-accent-n6-w100"]=e.accent.n6.w100),(Pt=(Gt=e.accent)==null?void 0:Gt.n6)!=null&&Pt.w30&&(t["--color-accent-n6-w30"]=e.accent.n6.w30),(Dt=(Lt=e.accent)==null?void 0:Lt.n7)!=null&&Dt.wMain&&(t["--color-accent-n7-wMain"]=e.accent.n7.wMain),(Ee=(be=e.accent)==null?void 0:be.n7)!=null&&Ee.w100&&(t["--color-accent-n7-w100"]=e.accent.n7.w100),(z=(B=e.accent)==null?void 0:B.n7)!=null&&z.w30&&(t["--color-accent-n7-w30"]=e.accent.n7.w30),(ie=(H=e.accent)==null?void 0:H.n8)!=null&&ie.wMain&&(t["--color-accent-n8-wMain"]=e.accent.n8.wMain),(pe=(fe=e.accent)==null?void 0:fe.n8)!=null&&pe.w100&&(t["--color-accent-n8-w100"]=e.accent.n8.w100),(_e=(ge=e.accent)==null?void 0:ge.n8)!=null&&_e.w30&&(t["--color-accent-n8-w30"]=e.accent.n8.w30),(ue=(ae=e.accent)==null?void 0:ae.n9)!=null&&ue.wMain&&(t["--color-accent-n9-wMain"]=e.accent.n9.wMain),(Ie=e.learning)!=null&&Ie.wMain&&(t["--color-learning-wMain"]=e.learning.wMain),(Z=e.learning)!=null&&Z.w100&&(t["--color-learning-w100"]=e.learning.w100),(C=e.learning)!=null&&C.w90&&(t["--color-learning-w90"]=e.learning.w90),(j=e.learning)!=null&&j.w20&&(t["--color-learning-w20"]=e.learning.w20),(W=e.learning)!=null&&W.w10&&(t["--color-learning-w10"]=e.learning.w10),t}function VE(e,t="light"){const n={};if(e){const o=GE(e);Object.assign(n,o)}const r=WE(e,t);return Object.assign(n,r),n}function YE(){const e=localStorage.getItem(Mo);return e==="dark"||e==="light"?e:window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function KE(e,t){const n=VE(e,t),r=document.documentElement;for(const[o,s]of Object.entries(n))r.style.setProperty(o,s);requestAnimationFrame(()=>{console.log(`Applying ${t} theme with palette`),r.classList.remove("light","dark"),r.classList.add(t),localStorage.setItem(Mo,t)})}const qE=({children:e})=>{const t=u.useMemo(()=>BE,[]),[n,r]=u.useState(()=>YE()),o=u.useMemo(()=>({currentTheme:n,toggleTheme:()=>{const s=n==="light"?"dark":"light";r(s),localStorage.setItem(Mo,s)}}),[n]);return u.useEffect(()=>{if(!(localStorage.getItem(Mo)!==null)){const i=window.matchMedia("(prefers-color-scheme: dark)"),l=c=>{r(c.matches?"dark":"light")};return i.addEventListener?i.addEventListener("change",l):i.addListener(l),()=>{i.removeEventListener?i.removeEventListener("change",l):i.removeListener(l)}}},[]),u.useEffect(()=>{document.documentElement.classList.remove("light","dark"),KE(t,n)},[n,t]),a.jsx(Vu.Provider,{value:o,children:e})};function XE(){const[e,t]=u.useState("chat"),{isAuthenticated:n,login:r,useAuthorization:o}=Yu();if(xw(),o&&!n)return a.jsx("div",{className:"bg-background flex h-screen items-center justify-center",children:a.jsx(Ae,{onClick:r,children:"Login"})});const s=c=>{const d=Ll.find(f=>f.id===c)||Dl.find(f=>f.id===c);d!=null&&d.onClick&&c!=="settings"?d.onClick():c!=="settings"&&t(c)},i=()=>{t("chat")},l=()=>{switch(e){case"chat":return a.jsx(jE,{});case"agentMesh":return a.jsx(kE,{})}};return a.jsxs("div",{className:"relative flex h-screen",children:[a.jsx(bE,{items:Ll,bottomItems:Dl,activeItem:e,onItemChange:s,onHeaderClick:i}),a.jsx("main",{className:"h-full w-full flex-1 overflow-auto",children:l()}),a.jsx(Q0,{})]})}function ZE(){return a.jsx(qE,{children:a.jsx($E,{children:a.jsx(RE,{children:a.jsx(DE,{children:a.jsx(LE,{children:a.jsx(PE,{children:a.jsx(XE,{})})})})})})})}kp.createRoot(document.getElementById("root")).render(a.jsx(u.StrictMode,{children:a.jsx(ZE,{})}));
|