sparkecoder 0.1.127 → 0.1.129
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.
- package/dist/cli.js +42 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.js +42 -4
- package/dist/index.js.map +1 -1
- package/dist/server/index.js +42 -4
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
- package/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/web/.next/build-manifest.json +2 -2
- package/web/.next/standalone/web/.next/prerender-manifest.json +3 -3
- package/web/.next/standalone/web/.next/server/app/(main)/session/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.html +2 -2
- package/web/.next/standalone/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.html +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.html +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p/agents.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/agents.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/installation.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs/installation.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/installation.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/skills.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs/skills.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/skills.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs/tools.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs/tools.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs/tools.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.html +2 -2
- package/web/.next/standalone/web/.next/server/app/docs.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/docs.segments/docs.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.html +1 -1
- package/web/.next/standalone/web/.next/server/app/index.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.html +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p/settings.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/!KG1haW4p.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/web/.next/server/chunks/ssr/[root-of-the-server]__e5911ea8._.js +1 -1
- package/web/.next/standalone/web/.next/server/pages/404.html +1 -1
- package/web/.next/standalone/web/.next/server/pages/500.html +2 -2
- package/web/.next/standalone/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/standalone/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/standalone/web/.next/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js} +1 -1
- package/web/.next/standalone/web/.next/static/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js} +1 -1
- package/web/.next/standalone/web/src/components/chat-interface.tsx +59 -7
- package/web/.next/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js} +1 -1
- /package/web/.next/standalone/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_buildManifest.js +0 -0
- /package/web/.next/standalone/web/.next/static/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/standalone/web/.next/static/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_ssgManifest.js +0 -0
- /package/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_buildManifest.js +0 -0
- /package/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_clientMiddlewareManifest.json +0 -0
- /package/web/.next/static/{l63ZK5juWEj8lzzuVVSpx → JrfYXT7oAfEeygDIQ-mGv}/_ssgManifest.js +0 -0
package/web/.next/standalone/web/.next/static/chunks/{4d95c15f712c9e06.js → 3f50fe2a802aa800.js}
RENAMED
|
@@ -4,7 +4,7 @@ ${e.themeCSS}`),void 0!==e.fontFamily&&(r+=`
|
|
|
4
4
|
:root { --mermaid-font-family: ${e.fontFamily}}`),void 0!==e.altFontFamily&&(r+=`
|
|
5
5
|
:root { --mermaid-alt-font-family: ${e.altFontFamily}}`),t instanceof Map){let n=e.htmlLabels??e.flowchart?.htmlLabels?["> *","span"]:["rect","polygon","ellipse","circle","path"];t.forEach(e=>{(0,sc.default)(e.styles)||n.forEach(t=>{r+=as(e.id,t,e.styles)}),(0,sc.default)(e.textStyles)||(r+=as(e.id,"tspan",(e?.textStyles||[]).map(e=>e.replace("color","fill"))))})}return r},"createCssStyles"),aa=(0,nW.__name)((e,t,r,n)=>{var s,i,a;let o=ai(e,r),l=(0,nU.styles_default)(t,o,e.themeVariables);return sa((a=function e(t,r,n,s,i,a,o,l,c){for(var u,d,h,m,p,f,g=0,x=0,y=o,v=0,b=0,w=0,j=1,k=1,N=1,S=0,C="",A=i,_=a,T=s,E=C;k;)switch(w=S,S=se()){case 40:if(108!=w&&58==nQ(E,y-1)){-1!=(p=E+=nZ(sn(S),"&","&\f"),f=nY(g?l[g-1]:0),p.indexOf("&\f",f))&&(N=-1);break}case 34:case 39:case 91:E+=sn(S);break;case 9:case 10:case 13:case 32:E+=function(e){for(;n8=st();)if(n8<33)se();else break;return sr(e)>2||sr(n8)>3?"":" "}(w);break;case 92:E+=function(e,t){for(var r;--t&&se()&&!(n8<48)&&!(n8>102)&&(!(n8>57)||!(n8<65))&&(!(n8>70)||!(n8<97)););return r=n6+(t<6&&32==st()&&32==se()),n0(n9,e,r)}(n6-1,7);continue;case 47:switch(st()){case 42:case 47:n2((u=function(e,t){for(;se();)if(e+n8===57)break;else if(e+n8===84&&47===st())break;return"/*"+n0(n9,t,n6-1)+"*"+nJ(47===e?e:se())}(se(),n6),d=r,h=n,m=c,n7(u,d,h,nH,nJ(n8),n0(u,2,-2),0,m)),c),(5==sr(w||1)||5==sr(st()||1))&&n1(E)&&" "!==n0(E,-1,void 0)&&(E+=" ");break;default:E+="/"}break;case 123*j:l[g++]=n1(E)*N;case 125*j:case 59:case 0:switch(S){case 0:case 125:k=0;case 59+x:-1==N&&(E=nZ(E,/\f/g,"")),b>0&&(n1(E)-y||0===j&&47===w)&&n2(b>32?si(E+";",s,n,y-1,c):si(nZ(E," ","")+";",s,n,y-2,c),c);break;case 59:E+=";";default:if(n2(T=ss(E,r,n,g,x,i,l,C,A=[],_=[],y,a),a),123===S)if(0===x)e(E,r,T,T,A,a,y,l,_);else{switch(v){case 99:if(110===nQ(E,3))break;case 108:if(97===nQ(E,2))break;default:x=0;case 100:case 109:case 115:}x?e(t,T,T,s&&n2(ss(t,T,T,0,0,i,l,C,i,A=[],y,_),_),i,_,y,l,s?A:_):e(E,T,T,T,[""],_,0,l,_)}}g=x=b=0,j=N=1,C=E="",y=o;break;case 58:y=1+n1(E),b=w;default:if(j<1){if(123==S)--j;else if(125==S&&0==j++&&125==(n8=n6>0?nQ(n9,--n6):0,n3--,10===n8&&(n3=1,n5--),n8))continue}switch(E+=nJ(S),S*j){case 38:N=x>0?1:(E+="\f",-1);break;case 44:l[g++]=(n1(E)-1)*N,N=1;break;case 64:45===st()&&(E+=sn(se())),v=st(),x=y=n1(C=E+=function(e){for(;!sr(st());)se();return n0(n9,e,n6)}(n6)),S++;break;case 45:45===w&&2==n1(E)&&(j=0)}}return a}("",null,null,null,[""],(i=s=`${n}{${l}}`,n5=n3=1,n4=n1(n9=i),n6=0,s=[]),0,[0],s),n9="",a),so)},"createUserStyles"),ao=(0,nW.__name)((e="",t,r)=>{let n=e;return r||t||(n=n.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,'marker-end="url(#')),n=(n=(0,nV.decodeEntities)(n)).replace(/<br>/g,"<br/>")},"cleanUpSvgCode"),al=(0,nW.__name)((e="",t)=>{let r=t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+"px":"100%",n=i7(`<body style="margin:0">${e}</body>`);return`<iframe style="width:100%;height:${r};border:0;margin:0;" src="data:text/html;charset=UTF-8;base64,${n}" sandbox="allow-top-navigation-by-user-activation allow-popups">
|
|
6
6
|
The "iframe" tag is not supported by your browser.
|
|
7
|
-
</iframe>`},"putIntoIFrame"),ac=(0,nW.__name)((e,t,r,n,s)=>{let i=e.append("div");i.attr("id",r),n&&i.attr("style",n);let a=i.append("svg").attr("id",t).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return s&&a.attr("xmlns:xlink",s),a.append("g"),e},"appendDivSvgG");function au(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}(0,nW.__name)(au,"sandboxedIframe");var ad=(0,nW.__name)((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),ah=(0,nW.__name)(async function(e,t,r){let n,s;iY();let i=ar(t);t=i.code;let a=(0,nU.getConfig)();nW.log.debug(a),t.length>(a?.maxTextSize??5e4)&&(t="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa");let o="#"+e,l="i"+e,c="#"+l,u="d"+e,d="#"+u,h=(0,nW.__name)(()=>{let e=p?c:d,t=(0,nq.select)(e).node();t&&"remove"in t&&t.remove()},"removeTempElements"),m=(0,nq.select)("body"),p="sandbox"===a.securityLevel,f="loose"===a.securityLevel,g=a.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),p){let e=au((0,nq.select)(r),l);(m=(0,nq.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else m=(0,nq.select)(r);ac(m,e,u,`font-family: ${g}`,"http://www.w3.org/1999/xlink")}else{if(ad(document,e,u,l),p){let e=au((0,nq.select)("body"),l);(m=(0,nq.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else m=(0,nq.select)("body");ac(m,e,u)}try{n=await i0.fromText(t,{title:i.title})}catch(e){if(a.suppressErrorRendering)throw h(),e;n=await i0.fromText("error"),s=e}let x=m.select(d).node(),y=n.type,v=x.firstChild,b=v.firstChild,w=aa(a,y,n.renderer.getClasses?.(t,n),o),j=document.createElement("style");j.innerHTML=w,v.insertBefore(j,b);try{await n.renderer.draw(t,e,nz.package_default.version,n)}catch(r){throw a.suppressErrorRendering?h():ia.draw(t,e,nz.package_default.version),r}af(y,m.select(`${d} svg`),n.db.getAccTitle?.(),n.db.getAccDescription?.()),m.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns","http://www.w3.org/1999/xhtml");let k=m.select(d).node().innerHTML;if(nW.log.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),k=ao(k,p,(0,nU.evaluate)(a.arrowMarkerAbsolute)),p?k=al(k,m.select(d+" svg").node()):f||(k=sl.default.sanitize(k,{ADD_TAGS:ae,ADD_ATTR:at,HTML_INTEGRATION_POINTS:{foreignobject:!0}})),i2(),s)throw s;return h(),{diagramType:y,svg:k,bindFunctions:n.db.bindFunctions}},"render");function am(e={}){let t=(0,nU.assignWithDepth_default)({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),(0,nU.saveConfigFromInitialize)(t),t?.theme&&t.theme in nU.themes_default?t.themeVariables=nU.themes_default[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=nU.themes_default.default.getThemeVariables(t.themeVariables));let r="object"==typeof t?(0,nU.setSiteConfig)(t):(0,nU.getSiteConfig)();(0,nW.setLogLevel)(r.logLevel),iY()}(0,nW.__name)(am,"initialize");var ap=(0,nW.__name)((e,t={})=>{let{code:r}=i9(e);return i0.fromText(r,t)},"getDiagramFromText");function af(e,t,r,n){iZ(t,e),iQ(t,r,n,t.attr("id"))}(0,nW.__name)(af,"addA11yInfo");var ag=Object.freeze({render:ah,parse:an,getDiagramFromText:ap,initialize:am,getConfig:nU.getConfig,setConfig:nU.setConfig,getSiteConfig:nU.getSiteConfig,updateSiteConfig:nU.updateSiteConfig,reset:(0,nW.__name)(()=>{(0,nU.reset)()},"reset"),globalReset:(0,nW.__name)(()=>{(0,nU.reset)(nU.defaultConfig)},"globalReset"),defaultConfig:nU.defaultConfig});(0,nW.setLogLevel)((0,nU.getConfig)().logLevel),(0,nU.reset)((0,nU.getConfig)());var ax=(0,nW.__name)((e,t,r)=>{nW.log.warn(e),(0,nV.isDetailedError)(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),ay=(0,nW.__name)(async function(e={querySelector:".mermaid"}){try{await av(e)}catch(t){if((0,nV.isDetailedError)(t)&&nW.log.error(t.str),aP.parseError&&aP.parseError(t),!e.suppressErrors)throw nW.log.error("Use the suppressErrors option to suppress these errors"),t}},"run"),av=(0,nW.__name)(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n,s,i=ag.getConfig();if(nW.log.debug(`${!e?"No ":""}Callback function found`),r)n=r;else if(t)n=document.querySelectorAll(t);else throw Error("Nodes and querySelector are both undefined");nW.log.debug(`Found ${n.length} diagrams`),i?.startOnLoad!==void 0&&(nW.log.debug("Start On Load: "+i?.startOnLoad),ag.updateSiteConfig({startOnLoad:i?.startOnLoad}));let a=new nV.utils_default.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed),o=[];for(let t of Array.from(n)){if(nW.log.info("Rendering diagram: "+t.id),t.getAttribute("data-processed"))continue;t.setAttribute("data-processed","true");let r=`mermaid-${a.next()}`;s=t.innerHTML,s=(0,nG.dedent)(nV.utils_default.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");let n=nV.utils_default.detectInit(s);n&&nW.log.debug("Detected early reinit: ",n);try{let{svg:n,bindFunctions:i}=await aT(r,s,t);t.innerHTML=n,e&&await e(r),i&&i(t)}catch(e){ax(e,o,aP.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),ab=(0,nW.__name)(function(e){ag.initialize(e)},"initialize"),aw=(0,nW.__name)(async function(e,t,r){nW.log.warn("mermaid.init is deprecated. Please use run instead."),e&&ab(e);let n={postRenderCallback:r,querySelector:".mermaid"};"string"==typeof t?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await ay(n)},"init"),aj=(0,nW.__name)(async(e,{lazyLoad:t=!0}={})=>{iY(),(0,nU.registerLazyLoadedDiagrams)(...e),!1===t&&await iJ()},"registerExternalDiagrams"),ak=(0,nW.__name)(function(){if(aP.startOnLoad){let{startOnLoad:e}=ag.getConfig();e&&aP.run().catch(e=>nW.log.error("Mermaid failed to initialize",e))}},"contentLoaded");"u">typeof document&&window.addEventListener("load",ak,!1);var aN=(0,nW.__name)(function(e){aP.parseError=e},"setParseErrorHandler"),aS=[],aC=!1,aA=(0,nW.__name)(async()=>{if(!aC){for(aC=!0;aS.length>0;){let e=aS.shift();if(e)try{await e()}catch(e){nW.log.error("Error executing queue",e)}}aC=!1}},"executeQueue"),a_=(0,nW.__name)(async(e,t)=>new Promise((r,n)=>{let s=(0,nW.__name)(()=>new Promise((s,i)=>{ag.parse(e,t).then(e=>{s(e),r(e)},e=>{nW.log.error("Error parsing",e),aP.parseError?.(e),i(e),n(e)})}),"performCall");aS.push(s),aA().catch(n)}),"parse"),aT=(0,nW.__name)((e,t,r)=>new Promise((n,s)=>{let i=(0,nW.__name)(()=>new Promise((i,a)=>{ag.render(e,t,r).then(e=>{i(e),n(e)},e=>{nW.log.error("Error parsing",e),aP.parseError?.(e),a(e),s(e)})}),"performCall");aS.push(i),aA().catch(s)}),"render"),aE=(0,nW.__name)(()=>Object.keys(nU.detectors).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),aP={startOnLoad:!0,mermaidAPI:ag,parse:a_,render:aT,init:aw,run:ay,registerExternalDiagrams:aj,registerLayoutLoaders:nF.registerLayoutLoaders,initialize:ab,parseError:void 0,contentLoaded:ak,setParseErrorHandler:aN,detectType:nU.detectType,registerIconPacks:n$.registerIconPacks,getRegisteredDiagramsMetadata:aE},aR={startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0},aM=function(e={}){let t=!1,r={...aR,...e.config},n={initialize(n){r={...aR,...e.config,...n},aP.initialize(r),t=!0},render:async(e,n)=>(t||(aP.initialize(r),t=!0),await aP.render(e,n))};return{name:"mermaid",type:"diagram",language:"mermaid",getMermaid:e=>(e&&n.initialize(e),n)}}(),aI=(e.i(263845),e.i(501253)),aI=aI,aL=e.i(77589),aL=aL,aD=e.i(349416),az=e.i(773340),aO=e.i(991106),aB=aO;let aF=({className:e,from:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("group flex w-full max-w-[95%] flex-col gap-2 transition-all duration-200","user"===t?"is-user ml-auto justify-end":"is-assistant",e),...r}),a$=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-primary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-primary-foreground group-[.is-user]:shadow-sm","group-[.is-assistant]:text-foreground",t),...r,children:e}),aV=({className:e,children:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center gap-1",e),...r,children:t}),aU=({tooltip:e,children:t,label:r,variant:n="ghost",size:s="icon-sm",...i})=>{let a=(0,v.jsxs)(S.Button,{size:s,type:"button",variant:n,...i,children:[t,(0,v.jsx)("span",{className:"sr-only",children:r||e})]});return e?(0,v.jsx)(C.TooltipProvider,{children:(0,v.jsxs)(C.Tooltip,{children:[(0,v.jsx)(C.TooltipTrigger,{asChild:!0,children:a}),(0,v.jsx)(C.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):a},aW=({url:e,isOpen:t,onClose:r,onConfirm:n})=>{let[s,i]=(0,b.useState)(!1);if((0,b.useEffect)(()=>{i(!0)},[]),!s||!t)return null;let a=(()=>{try{return new URL(e).hostname}catch{return e}})();return(0,az.createPortal)((0,v.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,onKeyDown:e=>"Escape"===e.key&&r(),children:(0,v.jsxs)("div",{className:"relative mx-4 max-w-md rounded-lg bg-background p-6 shadow-lg",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("button",{className:"absolute right-3 top-3 rounded-sm p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:r,type:"button",children:[(0,v.jsx)(aD.XIcon,{className:"h-4 w-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Close"})]}),(0,v.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-lg font-semibold",children:[(0,v.jsx)(aL.default,{className:"h-5 w-5"}),(0,v.jsx)("span",{children:"External Link"})]}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"You are about to visit an external website:"}),(0,v.jsx)("p",{className:"break-all rounded bg-muted px-3 py-2 text-sm font-mono",children:a}),(0,v.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,v.jsx)(S.Button,{variant:"outline",onClick:r,children:"Cancel"}),(0,v.jsx)(S.Button,{onClick:n,children:"Continue"})]})]})]})}),document.body)},aG=(0,b.memo)(({className:e,linkSafety:t,...r})=>(0,v.jsx)(aB.j,{className:(0,k.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),plugins:{code:nr,mermaid:aM,math:nD,cjk:ef},linkSafety:{enabled:t?.enabled??!0,onLinkCheck:t?.onLinkCheck,renderModal:t?.renderModal??aW},...r}),(e,t)=>e.children===t.children);aG.displayName="MessageResponse";var aq=e.i(241416),aH=e.i(465488),aK=e.i(995945),aX=e.i(309945),aY=Symbol("radix.slottable");function aJ(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aY}var aZ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(aJ);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),aQ=e.i(395509),a0=e.i(610559),a1="Collapsible",[a2,a5]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(a1),[a3,a4]=a2(a1),a6=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:a,...o}=e,[l,c]=(0,aH.useControllableState)({prop:n,defaultProp:s??!1,onChange:a,caller:a1});return(0,v.jsx)(a3,{scope:r,disabled:i,contentId:(0,a0.useId)(),open:l,onOpenToggle:b.useCallback(()=>c(e=>!e),[c]),children:(0,v.jsx)(aZ.div,{"data-state":or(l),"data-disabled":i?"":void 0,...o,ref:t})})});a6.displayName=a1;var a8="CollapsibleTrigger",a9=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,s=a4(a8,r);return(0,v.jsx)(aZ.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":or(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:(0,aq.composeEventHandlers)(e.onClick,s.onOpenToggle)})});a9.displayName=a8;var a7="CollapsibleContent",oe=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,s=a4(a7,e.__scopeCollapsible);return(0,v.jsx)(aQ.Presence,{present:r||s.open,children:({present:e})=>(0,v.jsx)(ot,{...n,ref:t,present:e})})});oe.displayName=a7;var ot=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:s,...i}=e,a=a4(a7,r),[o,l]=b.useState(n),c=b.useRef(null),u=(0,aX.useComposedRefs)(t,c),d=b.useRef(0),h=d.current,m=b.useRef(0),p=m.current,f=a.open||o,g=b.useRef(f),x=b.useRef(void 0);return b.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,aK.useLayoutEffect)(()=>{let e=c.current;if(e){x.current=x.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,g.current||(e.style.transitionDuration=x.current.transitionDuration,e.style.animationName=x.current.animationName),l(n)}},[a.open,n]),(0,v.jsx)(aZ.div,{"data-state":or(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!f,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:f&&s})});function or(e){return e?"open":"closed"}function on({...e}){return(0,v.jsx)(a6,{"data-slot":"collapsible",...e})}function os({...e}){return(0,v.jsx)(a9,{"data-slot":"collapsible-trigger",...e})}function oi({...e}){return(0,v.jsx)(oe,{"data-slot":"collapsible-content",...e})}let oa=(0,A.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var oo=e.i(100536);let ol=(0,A.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var oc=e.i(191729),oc=oc;let ou=(0,A.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);var od=e.i(715786),od=od,oh=e.i(553880);e.i(196582);var om=e.i(719125),om=om;let op=({token:e})=>{let t,r,n;return(0,v.jsx)("span",{className:"dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)]",style:{color:e.color,backgroundColor:e.bgColor,...e.htmlStyle,fontStyle:(t=e.fontStyle)&&1&t?"italic":void 0,fontWeight:(r=e.fontStyle)&&2&r?"bold":void 0,textDecoration:(n=e.fontStyle)&&4&n?"underline":void 0},children:e.content})},of=({keyedLine:e,showLineNumbers:t})=>(0,v.jsx)("span",{className:t?ow:"block",children:0===e.tokens.length?"\n":e.tokens.map(({token:e,key:t})=>(0,v.jsx)(op,{token:e},t))}),og=(0,b.createContext)({code:""}),ox=new Map,oy=new Map,ov=new Map;function ob(e,t,r){let n,s,i=(n=e.slice(0,100),s=e.length>100?e.slice(-100):"",`${t}:${e.length}:${n}:${s}`),a=oy.get(i);return a||(r&&(ov.has(i)||ov.set(i,new Set),ov.get(i)?.add(r)),(e=>{let t=ox.get(e);if(t)return t;let r=r8({themes:["github-light","github-dark"],langs:[e]});return ox.set(e,r),r})(t).then(r=>{let n=r.getLoadedLanguages().includes(t)?t:"text",s=r.codeToTokens(e,{lang:n,themes:{light:"github-light",dark:"github-dark"}}),a={tokens:s.tokens,fg:s.fg??"",bg:s.bg??""};oy.set(i,a);let o=ov.get(i);if(o){for(let e of o)e(a);ov.delete(i)}}).catch(e=>{console.error("Failed to highlight code:",e),ov.delete(i)}),null)}let ow=(0,k.cn)("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-8","before:mr-4","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),oj=(0,b.memo)(({tokenized:e,showLineNumbers:t,className:r})=>{let n=(0,b.useMemo)(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),s=(0,b.useMemo)(()=>e.tokens.map((e,t)=>({key:`line-${t}`,tokens:e.map((e,r)=>({token:e,key:`line-${t}-${r}`}))})),[e.tokens]);return(0,v.jsx)("pre",{className:(0,k.cn)("dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)] m-0 p-4 text-sm",r),style:n,children:(0,v.jsx)("code",{className:(0,k.cn)("font-mono text-sm",t&&"[counter-increment:line_0] [counter-reset:line]"),children:s.map(e=>(0,v.jsx)(of,{keyedLine:e,showLineNumbers:t},e.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className),ok=({className:e,language:t,style:r,...n})=>(0,v.jsx)("div",{className:(0,k.cn)("group relative w-full overflow-hidden rounded-md border bg-background text-foreground",e),"data-language":t,style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...r},...n}),oN=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center justify-between bg-muted/80 px-3 py-2 text-muted-foreground text-xs",t),...r,children:e}),oS=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center gap-2",t),...r,children:e}),oC=({children:e,className:t,...r})=>(0,v.jsx)("span",{className:(0,k.cn)("font-mono",t),...r,children:e}),oA=({code:e,language:t,showLineNumbers:r=!1})=>{let n=(0,b.useMemo)(()=>({tokens:e.split("\n").map(e=>""===e?[]:[{content:e,color:"inherit"}]),fg:"inherit",bg:"transparent"}),[e]),[s,i]=(0,b.useState)(()=>ob(e,t)??n);return(0,b.useEffect)(()=>{i(ob(e,t)??n),ob(e,t,i)},[e,t,n]),(0,v.jsx)("div",{className:"relative overflow-auto",children:(0,v.jsx)(oj,{showLineNumbers:r,tokenized:s})})},o_=({code:e,language:t,showLineNumbers:r=!1,className:n,children:s,...i})=>(0,v.jsx)(og.Provider,{value:{code:e},children:(0,v.jsxs)(ok,{className:n,language:t,...i,children:[s,(0,v.jsx)(oA,{code:e,language:t,showLineNumbers:r})]})}),oT=({className:e,...t})=>(0,v.jsx)(on,{className:(0,k.cn)("group not-prose mb-4 w-full max-w-full overflow-hidden rounded-md border",e),...t}),oE=({className:e,title:t,type:r,state:n,toolName:s,...i})=>{let a,o="dynamic-tool"===r?s:r.split("-").slice(1).join("-");return(0,v.jsxs)(os,{className:(0,k.cn)("flex w-full items-center justify-between gap-4 p-3",e),...i,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(ou,{className:"size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t??o}),(a={"input-streaming":(0,v.jsx)(ol,{className:"size-4"}),"input-available":(0,v.jsx)(oc.default,{className:"size-4 animate-pulse"}),"approval-requested":(0,v.jsx)(oc.default,{className:"size-4 text-yellow-600"}),"approval-responded":(0,v.jsx)(oa,{className:"size-4 text-blue-600"}),"output-available":(0,v.jsx)(oa,{className:"size-4 text-green-600"}),"output-error":(0,v.jsx)(od.default,{className:"size-4 text-red-600"}),"output-denied":(0,v.jsx)(od.default,{className:"size-4 text-orange-600"})},(0,v.jsxs)(N.Badge,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[a[n],{"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"}[n]]}))]}),(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},oP=({className:e,...t})=>(0,v.jsx)(oi,{className:(0,k.cn)("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),oR=({className:e,input:t,...r})=>(0,v.jsxs)("div",{className:(0,k.cn)("space-y-2 overflow-hidden p-4 max-w-full",e),...r,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,v.jsx)("div",{className:"rounded-md bg-muted/50 overflow-x-auto max-w-full",children:(0,v.jsx)(o_,{code:JSON.stringify(t,null,2),language:"json"})})]}),oM=({className:e,output:t,errorText:r,...n})=>{if(!(t||r))return null;let s=(0,v.jsx)("div",{children:t});return"object"!=typeof t||(0,b.isValidElement)(t)?"string"==typeof t&&(s=(0,v.jsx)(o_,{code:t,language:"json"})):s=(0,v.jsx)(o_,{code:JSON.stringify(t,null,2),language:"json"}),(0,v.jsxs)("div",{className:(0,k.cn)("space-y-2 p-4 max-w-full overflow-hidden",e),...n,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:r?"Error":"Result"}),(0,v.jsxs)("div",{className:(0,k.cn)("overflow-x-auto rounded-md text-xs max-w-full [&_table]:w-full",r?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[r&&(0,v.jsx)("div",{children:r}),s]})]})},oI=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",e),...t}),oL=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center justify-between border-b bg-muted/50 px-4 py-3",e),...t}),oD=({className:e,...t})=>(0,v.jsx)("p",{className:(0,k.cn)("font-medium text-foreground text-sm",e),...t}),oz=({className:e,...t})=>(0,v.jsx)("p",{className:(0,k.cn)("text-muted-foreground text-sm",e),...t}),oO=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center gap-1",e),...t}),oB=({tooltip:e,label:t,icon:r,children:n,className:s,size:i="sm",variant:a="ghost",...o})=>{let l=(0,v.jsxs)(S.Button,{className:(0,k.cn)("size-8 p-0 text-muted-foreground hover:text-foreground",s),size:i,type:"button",variant:a,...o,children:[r?(0,v.jsx)(r,{className:"size-4"}):n,(0,v.jsx)("span",{className:"sr-only",children:t||e})]});return e?(0,v.jsx)(C.TooltipProvider,{children:(0,v.jsxs)(C.Tooltip,{children:[(0,v.jsx)(C.TooltipTrigger,{asChild:!0,children:l}),(0,v.jsx)(C.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):l},oF=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex-1 overflow-auto p-4",e),...t}),o$=(0,U.cva)("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 oV({className:e,variant:t,...r}){return(0,v.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,k.cn)(o$({variant:t}),e),...r})}let oU=(0,b.createContext)(null),oW=()=>{let e=(0,b.useContext)(oU);if(!e)throw Error("Confirmation components must be used within Confirmation");return e},oG=({className:e,approval:t,state:r,...n})=>t&&"input-streaming"!==r&&"input-available"!==r?(0,v.jsx)(oU.Provider,{value:{approval:t,state:r},children:(0,v.jsx)(oV,{className:(0,k.cn)("flex flex-col gap-2",e),...n})}):null,oq=({children:e})=>{let{state:t}=oW();return"approval-requested"!==t?null:e},oH=({className:e,...t})=>{let{state:r}=oW();return"approval-requested"!==r?null:(0,v.jsx)("div",{className:(0,k.cn)("flex items-center justify-end gap-2 self-end",e),...t})},oK=e=>(0,v.jsx)(S.Button,{className:"h-8 px-3 text-sm",type:"button",...e}),oX=({size:e=16})=>(0,v.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,v.jsx)("title",{children:"Loader"}),(0,v.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,v.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,v.jsx)("defs",{children:(0,v.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,v.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),oY=({className:e,size:t=16,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("inline-flex animate-spin items-center justify-center",e),...r,children:(0,v.jsx)(oX,{size:t})}),oJ=(0,A.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);var aB=aO;let oZ=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],oQ=new Set(oZ),o0=(e,t,r)=>r>t?t:r<e?e:r,o1={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},o2={...o1,transform:e=>o0(0,1,e)},o5={...o1,default:1},o3=e=>Math.round(1e5*e)/1e5,o4=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,o6=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,o8=(e,t)=>r=>!!("string"==typeof r&&o6.test(r)&&r.startsWith(e)||t&&null!=r&&Object.prototype.hasOwnProperty.call(r,t)),o9=(e,t,r)=>n=>{if("string"!=typeof n)return n;let[s,i,a,o]=n.match(o4);return{[e]:parseFloat(s),[t]:parseFloat(i),[r]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},o7={...o1,transform:e=>Math.round(o0(0,255,e))},le={test:o8("rgb","red"),parse:o9("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+o7.transform(e)+", "+o7.transform(t)+", "+o7.transform(r)+", "+o3(o2.transform(n))+")"},lt={test:o8("#"),parse:function(e){let t="",r="",n="",s="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),s=e.substring(4,5),t+=t,r+=r,n+=n,s+=s),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}},transform:le.transform},lr=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),ln=lr("deg"),ls=lr("%"),li=lr("px"),la=lr("vh"),lo=lr("vw"),ll={...ls,parse:e=>ls.parse(e)/100,transform:e=>ls.transform(100*e)},lc={test:o8("hsl","hue"),parse:o9("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+ls.transform(o3(t))+", "+ls.transform(o3(r))+", "+o3(o2.transform(n))+")"},lu={test:e=>le.test(e)||lt.test(e)||lc.test(e),parse:e=>le.test(e)?le.parse(e):lc.test(e)?lc.parse(e):lt.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?le.transform(e):lc.transform(e),getAnimatableNone:e=>{let t=lu.parse(e);return t.alpha=0,lu.transform(t)}},ld=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,lh="number",lm="color",lp=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lf(e){let t=e.toString(),r=[],n={color:[],number:[],var:[]},s=[],i=0,a=t.replace(lp,e=>(lu.test(e)?(n.color.push(i),s.push(lm),r.push(lu.parse(e))):e.startsWith("var(")?(n.var.push(i),s.push("var"),r.push(e)):(n.number.push(i),s.push(lh),r.push(parseFloat(e))),++i,"${}")).split("${}");return{values:r,split:a,indexes:n,types:s}}function lg(e){return lf(e).values}function lx(e){let{split:t,types:r}=lf(e),n=t.length;return e=>{let s="";for(let i=0;i<n;i++)if(s+=t[i],void 0!==e[i]){let t=r[i];t===lh?s+=o3(e[i]):t===lm?s+=lu.transform(e[i]):s+=e[i]}return s}}let ly=e=>"number"==typeof e?0:lu.test(e)?lu.getAnimatableNone(e):e,lv={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(o4)?.length||0)+(e.match(ld)?.length||0)>0},parse:lg,createTransformer:lx,getAnimatableNone:function(e){let t=lg(e);return lx(e)(t.map(ly))}},lb=new Set(["brightness","contrast","saturate","opacity"]);function lw(e){let[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[n]=r.match(o4)||[];if(!n)return e;let s=r.replace(n,""),i=+!!lb.has(t);return n!==r&&(i*=100),t+"("+i+s+")"}let lj=/\b([a-z-]*)\(.*?\)/gu,lk={...lv,getAnimatableNone:e=>{let t=e.match(lj);return t?t.map(lw).join(" "):e}},lN={...o1,transform:Math.round},lS={borderWidth:li,borderTopWidth:li,borderRightWidth:li,borderBottomWidth:li,borderLeftWidth:li,borderRadius:li,borderTopLeftRadius:li,borderTopRightRadius:li,borderBottomRightRadius:li,borderBottomLeftRadius:li,width:li,maxWidth:li,height:li,maxHeight:li,top:li,right:li,bottom:li,left:li,inset:li,insetBlock:li,insetBlockStart:li,insetBlockEnd:li,insetInline:li,insetInlineStart:li,insetInlineEnd:li,padding:li,paddingTop:li,paddingRight:li,paddingBottom:li,paddingLeft:li,paddingBlock:li,paddingBlockStart:li,paddingBlockEnd:li,paddingInline:li,paddingInlineStart:li,paddingInlineEnd:li,margin:li,marginTop:li,marginRight:li,marginBottom:li,marginLeft:li,marginBlock:li,marginBlockStart:li,marginBlockEnd:li,marginInline:li,marginInlineStart:li,marginInlineEnd:li,fontSize:li,backgroundPositionX:li,backgroundPositionY:li,rotate:ln,rotateX:ln,rotateY:ln,rotateZ:ln,scale:o5,scaleX:o5,scaleY:o5,scaleZ:o5,skew:ln,skewX:ln,skewY:ln,distance:li,translateX:li,translateY:li,translateZ:li,x:li,y:li,z:li,perspective:li,transformPerspective:li,opacity:o2,originX:ll,originY:ll,originZ:li,zIndex:lN,fillOpacity:o2,strokeOpacity:o2,numOctaves:lN},lC={...lS,color:lu,backgroundColor:lu,outlineColor:lu,fill:lu,stroke:lu,borderColor:lu,borderTopColor:lu,borderRightColor:lu,borderBottomColor:lu,borderLeftColor:lu,filter:lk,WebkitFilter:lk},lA=e=>lC[e],l_=()=>({translate:0,scale:1,origin:0,originPoint:0}),lT=()=>({x:l_(),y:l_()}),lE=()=>({min:0,max:0}),lP=()=>({x:lE(),y:lE()}),lR=e=>!!(e&&e.getVelocity),lM=new Set(["width","height","top","left","right","bottom",...oZ]),lI=e=>t=>t.test(e),lL=[o1,li,ls,ln,lo,la,{test:e=>"auto"===e,parse:e=>e}],lD=e=>lL.find(lI(e)),lz=()=>{},lO=()=>{};ew.default;let lB=e=>t=>"string"==typeof t&&t.startsWith(e),lF=lB("--"),l$=lB("var(--"),lV=e=>!!l$(e)&&lU.test(e.split("/*")[0].trim()),lU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function lW(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let lG=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,lq=e=>180*e/Math.PI,lH=e=>lX(lq(Math.atan2(e[1],e[0]))),lK={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:lH,rotateZ:lH,skewX:e=>lq(Math.atan(e[1])),skewY:e=>lq(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},lX=e=>((e%=360)<0&&(e+=360),e),lY=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lJ=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),lZ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:lY,scaleY:lJ,scale:e=>(lY(e)+lJ(e))/2,rotateX:e=>lX(lq(Math.atan2(e[6],e[5]))),rotateY:e=>lX(lq(Math.atan2(-e[2],e[0]))),rotateZ:lH,rotate:lH,skewX:e=>lq(Math.atan(e[4])),skewY:e=>lq(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function lQ(e){return+!!e.includes("scale")}function l0(e,t){let r,n;if(!e||"none"===e)return lQ(t);let s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(s)r=lZ,n=s;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=lK,n=t}if(!n)return lQ(t);let i=r[t],a=n[1].split(",").map(l1);return"function"==typeof i?i(a):a[i]}function l1(e){return parseFloat(e.trim())}let l2=e=>e===o1||e===li,l5=new Set(["x","y","z"]),l3=oZ.filter(e=>!l5.has(e)),l4={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>l0(t,"x"),y:(e,{transform:t})=>l0(t,"y")};l4.translateX=l4.x,l4.translateY=l4.y;let l6=e=>e,l8={},l9=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function l7(e,t){let r=!1,n=!0,s={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,a=l9.reduce((e,r)=>(e[r]=function(e,t){let r=new Set,n=new Set,s=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(t){a.has(t)&&(u.schedule(t),e()),l++,t(o)}let u={schedule:(e,t=!1,i=!1)=>{let o=i&&s?r:n;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,s){i=!0;return}s=!0,[r,n]=[n,r],r.forEach(c),t,l=0,r.clear(),s=!1,i&&(i=!1,u.process(e))}};return u}(i,t?r:void 0),e),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:m,postRender:p}=a,f=()=>{let i=l8.useManualTiming?s.timestamp:performance.now();r=!1,l8.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(i-s.timestamp,40),1)),s.timestamp=i,s.isProcessing=!0,o.process(s),l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),m.process(s),p.process(s),s.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:l9.reduce((t,i)=>{let o=a[i];return t[i]=(t,i=!1,a=!1)=>(!r&&(r=!0,n=!0,s.isProcessing||e(f)),o.schedule(t,i,a)),t},{}),cancel:e=>{for(let t=0;t<l9.length;t++)a[l9[t]].cancel(e)},state:s,steps:a}}let{schedule:ce,cancel:ct,state:cr,steps:cn}=l7("u">typeof requestAnimationFrame?requestAnimationFrame:l6,!0),cs=new Set,ci=!1,ca=!1,co=!1;function cl(){if(ca){let e=Array.from(cs).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;t.forEach(e=>{let t,n=(t=[],l3.forEach(r=>{let n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(+!!r.startsWith("scale")))}),t);n.length&&(r.set(e,n),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}ca=!1,ci=!1,cs.forEach(e=>e.complete(co)),cs.clear()}function cc(){cs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ca=!0)})}class cu{constructor(e,t,r,n,s,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=s,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(cs.add(this),ci||(ci=!0,ce.read(cc),ce.resolveKeyframes(cl))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){let s=n?.get(),i=e[e.length-1];if(void 0!==s)e[0]=s;else if(r&&t){let n=r.readValue(t,i);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=i),n&&void 0===s&&n.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),cs.delete(this)}cancel(){"scheduled"===this.state&&(cs.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function cd(e,t){let r=lA(e);return r!==lk&&(r=lv),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let ch=new Set(["auto","none","0"]);class cm extends cu{constructor(e,t,r,n,s){super(e,t,r,n,s,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let r=0;r<e.length;r++){let n=e[r];if("string"==typeof n&&lV(n=n.trim())){let s=function e(t,r,n=1){lO(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[s,i]=function(e){let t=lG.exec(e);if(!t)return[,];let[,r,n,s]=t;return[`--${r??n}`,s]}(t);if(!s)return;let a=window.getComputedStyle(r).getPropertyValue(s);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return lV(i)?e(i,r,n+1):i}(n,t.current);void 0!==s&&(e[r]=s),r===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!lM.has(r)||2!==e.length)return;let[n,s]=e,i=lD(n),a=lD(s);if(lW(n)!==lW(s)&&l4[r]){this.needsMeasurement=!0;return}if(i!==a)if(l2(i)&&l2(a))for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r&&(e[t]=parseFloat(r))}else l4[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,r=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&r.push(t);r.length&&function(e,t,r){let n,s=0;for(;s<e.length&&!n;){let t=e[s];"string"==typeof t&&!ch.has(t)&&lf(t).values.length&&(n=e[s]),s++}if(n&&r)for(let s of t)e[s]=cd(r,n)}(e,r,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=l4[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;let n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);let s=r.length-1,i=r[s];r[s]=l4[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==i&&void 0===this.finalKeyframe&&(this.finalKeyframe=i),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}}function cp(e,t){-1===e.indexOf(t)&&e.push(t)}function cf(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1)}class cg{constructor(){this.subscriptions=[]}add(e){return cp(this.subscriptions,e),()=>cf(this.subscriptions,e)}notify(e,t,r){let n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let s=0;s<n;s++){let n=this.subscriptions[s];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:cx}=l7(queueMicrotask,!1);function cy(){n=void 0}let cv={now:()=>(void 0===n&&cv.set(cr.isProcessing||l8.useManualTiming?cr.timestamp:performance.now()),n),set:e=>{n=e,queueMicrotask(cy)}};class cb{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=cv.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=cv.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new cg);let r=this.events[e].add(t);return"change"===e?()=>{r(),ce.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return d&&d.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=cv.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),r?1e3/r*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function cw(e,t){return new cb(e,t)}let cj=[...lL,lu,lv],ck={current:null},cN={current:!1},cS="u">typeof window,cC=new WeakMap;function cA(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function c_(e){return"string"==typeof e||Array.isArray(e)}let cT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cE=["initial",...cT];function cP(e){return cA(e.animate)||cE.some(t=>c_(e[t]))}function cR(e){return!!(cP(e)||e.variants)}function cM(e){let t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function cI(e,t,r,n){if("function"==typeof t){let[s,i]=cM(n);t=t(void 0!==r?r:e.custom,s,i)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[s,i]=cM(n);t=t(void 0!==r?r:e.custom,s,i)}return t}let cL=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],cD={};class cz{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,blockInitialAnimation:s,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=cu,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=cv.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,ce.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=i;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=cP(t),this.isVariantNode=cR(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==o[e]&&lR(t)&&t.set(o[e])}}mount(e){this.current=e,cC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(cN.current||function(){if(cN.current=!0,cS)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ck.current=e.matches;e.addEventListener("change",t),t()}else ck.current=!1}(),this.shouldReduceMotion=ck.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),ct(this.notifyUpdate),ct(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let r;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=oQ.has(e);n&&this.onBindTransform&&this.onBindTransform();let s=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&ce.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{s(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in cD){let t=cD[e];if(!t)continue;let{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lP()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<cL.length;t++){let r=cL[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);let n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){for(let n in t){let s=t[n],i=r[n];if(lR(s))e.addValue(n,s);else if(lR(i))e.addValue(n,cw(s,{owner:e}));else if(i!==s)if(e.hasValue(n)){let t=e.getValue(n);!0===t.liveStyle?t.jump(s):t.hasAnimated||t.set(s)}else{let t=e.getStaticValue(n);e.addValue(n,cw(void 0!==t?t:s,{owner:e}))}}for(let n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=cw(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let n,s;if("string"==typeof r&&(n=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n)||(s=r,/^0[^.\s]+$/u.test(s))))r=parseFloat(r);else{let n;n=r,!cj.find(lI(n))&&lv.test(t)&&(r=cd(e,t))}this.setBaseTarget(e,lR(r)?r.get():r)}return lR(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let n=cI(this.props,r,this.presenceContext?.custom);n&&(t=n[e])}if(r&&void 0!==t)return t;let n=this.getBaseTargetFromProps(this.props,e);return void 0===n||lR(n)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new cg),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){cx.render(this.render)}}class cO extends cz{constructor(){super(...arguments),this.KeyframeResolver=cm}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;lR(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function cB(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let cF=(e,t)=>t&&"number"==typeof e?t.transform(e):e,c$={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cV=oZ.length;function cU(e,t,r){let{style:n,vars:s,transformOrigin:i}=e,a=!1,o=!1;for(let e in t){let r=t[e];if(oQ.has(e)){a=!0;continue}if(lF(e)){s[e]=r;continue}{let t=cF(r,lS[e]);e.startsWith("origin")?(o=!0,i[e]=t):n[e]=t}}if(!t.transform&&(a||r?n.transform=function(e,t,r){let n="",s=!0;for(let i=0;i<cV;i++){let a=oZ[i],o=e[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!a.startsWith("scale");else{let e=parseFloat(o);l=a.startsWith("scale")?1===e:0===e}if(!l||r){let e=cF(o,lS[a]);if(!l){s=!1;let t=c$[a]||a;n+=`${t}(${e}) `}r&&(t[a]=e)}}return n=n.trim(),r?n=r(t,s?"":n):s&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:r=0}=i;n.transformOrigin=`${e} ${t} ${r}`}}let cW={offset:"stroke-dashoffset",array:"stroke-dasharray"},cG={offset:"strokeDashoffset",array:"strokeDasharray"},cq=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function cH(e,{attrX:t,attrY:r,attrScale:n,pathLength:s,pathSpacing:i=1,pathOffset:a=0,...o},l,c,u){if(cU(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete d.transformBox),cq))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==r&&(d.y=r),void 0!==n&&(d.scale=n),void 0!==s&&function(e,t,r=1,n=0,s=!0){e.pathLength=1;let i=s?cW:cG;e[i.offset]=`${-n}`,e[i.array]=`${t} ${r}`}(d,s,i,a,!1)}let cK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),cX=e=>"string"==typeof e&&"svg"===e.toLowerCase();function cY(e,{style:t,vars:r},n,s){let i,a=e.style;for(i in t)a[i]=t[i];for(i in s?.applyProjectionStyles(a,n),r)a.setProperty(i,r[i])}function cJ(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let cZ={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!li.test(e))return e;else e=parseFloat(e);let r=cJ(e,t.target.x),n=cJ(e,t.target.y);return`${r}% ${n}%`}},cQ=(e,t,r)=>e+(t-e)*r,c0={borderRadius:{...cZ,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:cZ,borderTopRightRadius:cZ,borderBottomLeftRadius:cZ,borderBottomRightRadius:cZ,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let n=lv.parse(e);if(n.length>5)return e;let s=lv.createTransformer(e),i=+("number"!=typeof n[0]),a=r.x.scale*t.x,o=r.y.scale*t.y;n[0+i]/=a,n[1+i]/=o;let l=cQ(a,o,.5);return"number"==typeof n[2+i]&&(n[2+i]/=l),"number"==typeof n[3+i]&&(n[3+i]/=l),s(n)}}};function c1(e,{layout:t,layoutId:r}){return oQ.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!c0[e]||"opacity"===e)}function c2(e,t,r){let n=e.style,s=t?.style,i={};if(!n)return i;for(let t in n)(lR(n[t])||s&&lR(s[t])||c1(t,e)||r?.getValue(t)?.liveStyle!==void 0)&&(i[t]=n[t]);return i}function c5(e,t,r){let n=c2(e,t,r);for(let r in e)(lR(e[r])||lR(t[r]))&&(n[-1!==oZ.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]);return n}class c3 extends cO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=lP}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(oQ.has(t)){let e=lA(t);return e&&e.default||0}return t=cK.has(t)?t:cB(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return c5(e,t,r)}build(e,t,r){cH(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){for(let r in cY(e,t,void 0,n),t.attrs)e.setAttribute(cK.has(r)?r:cB(r),t.attrs[r])}mount(e){this.isSVGTag=cX(e.tagName),super.mount(e)}}function c4({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function c6(e){return void 0===e||1===e}function c8({scale:e,scaleX:t,scaleY:r}){return!c6(e)||!c6(t)||!c6(r)}function c9(e){return c8(e)||c7(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function c7(e){var t,r;return(t=e.x)&&"0%"!==t||(r=e.y)&&"0%"!==r}function ue(e,t,r,n,s){return void 0!==s&&(e=n+s*(e-n)),n+r*(e-n)+t}function ut(e,t=0,r=1,n,s){e.min=ue(e.min,t,r,n,s),e.max=ue(e.max,t,r,n,s)}function ur(e,{x:t,y:r}){ut(e.x,t.translate,t.scale,t.originPoint),ut(e.y,r.translate,r.scale,r.originPoint)}function un(e,t){e.min=e.min+t,e.max=e.max+t}function us(e,t,r,n,s=.5){let i=cQ(e.min,e.max,s);ut(e,t,r,i,n)}function ui(e,t){us(e.x,t.x,t.scaleX,t.scale,t.originX),us(e.y,t.y,t.scaleY,t.scale,t.originY)}function ua(e,t){return c4(function(e,t){if(!t)return e;let r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}class uo extends cO{constructor(){super(...arguments),this.type="html",this.renderInstance=cY}readValueFromInstance(e,t){if(oQ.has(t))return this.projection?.isProjecting?lQ(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return l0(r,t)})(e,t);{let r=window.getComputedStyle(e),n=(lF(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return ua(e,t)}build(e,t,r){cU(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return c2(e,t,r)}}let ul=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function uc(e){if("string"!=typeof e||e.includes("-"));else if(ul.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let uu=(0,b.createContext)({}),ud=(0,b.createContext)({strict:!1}),uh=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),um=(0,b.createContext)({});function up(e){return Array.isArray(e)?e.join(" "):e}let uf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ug(e,t,r){for(let n in t)lR(t[n])||c1(n,r)||(e[n]=t[n])}let ux=()=>({...uf(),attrs:{}}),uy=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function uv(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||uy.has(e)}let ub=e=>!uv(e);try{g=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof g&&(ub=e=>e.startsWith("on")?!uv(e):g(e))}catch{}function uw(e){return lR(e)?e.get():e}let uj=(0,b.createContext)(null),uk=e=>(t,r)=>{let n,s=(0,b.useContext)(um),i=(0,b.useContext)(uj),a=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,s){return{latestValues:function(e,t,r,n){let s={},i=n(e,{});for(let e in i)s[e]=uw(i[e]);let{initial:a,animate:o}=e,l=cP(e),c=cR(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let u=!!r&&!1===r.initial,d=(u=u||!1===a)?o:a;if(d&&"boolean"!=typeof d&&!cA(d)){let t=Array.isArray(d)?d:[d];for(let r=0;r<t.length;r++){let n=cI(e,t[r]);if(n){let{transitionEnd:e,transition:t,...r}=n;for(let e in r){let t=r[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}null!==t&&(s[e]=t)}for(let t in e)s[t]=e[t]}}}return s}(r,n,s,e),renderState:t()}})(e,t,s,i);return r?a():(null===(n=(0,b.useRef)(null)).current&&(n.current=a()),n.current)},uN=uk({scrapeMotionValuesFromProps:c2,createRenderState:uf}),uS=uk({scrapeMotionValuesFromProps:c5,createRenderState:ux}),uC="u">typeof window,uA={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},u_=!1;function uT(){return!function(){if(u_)return;let e={};for(let t in uA)e[t]={isEnabled:e=>uA[t].some(t=>!!e[t])};cD=e,u_=!0}(),cD}let uE=Symbol.for("motionComponentSymbol"),uP="data-"+cB("framerAppearId"),uR=(0,b.createContext)({});function uM(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let uI=uC?b.useLayoutEffect:b.useEffect;function uL(e,{forwardMotionProps:t=!1,type:r}={},n,s){n&&function(e){let t=uT();for(let r in e)t[r]={...t[r],...e[r]};cD=t}(n);let i=r?"svg"===r:uc(e),a=i?uS:uN;function o(r,n){var o;let l,c,u,d={...(0,b.useContext)(uh),...r,layoutId:function({layoutId:e}){let t=(0,b.useContext)(uu).id;return t&&void 0!==e?t+"-"+e:e}(r)},{isStatic:h}=d,m=function(e){let{initial:t,animate:r}=function(e,t){if(cP(e)){let{initial:t,animate:r}=e;return{initial:!1===t||c_(t)?t:void 0,animate:c_(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,b.useContext)(um));return(0,b.useMemo)(()=>({initial:t,animate:r}),[up(t),up(r)])}(r),p=a(r,h);if(!h&&uC){(0,b.useContext)(ud).strict;let t=function(e){let{drag:t,layout:r}=uT();if(!t&&!r)return{};let n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(d);l=t.MeasureLayout,m.visualElement=function(e,t,r,n,s,i){let{visualElement:a}=(0,b.useContext)(um),o=(0,b.useContext)(ud),l=(0,b.useContext)(uj),c=(0,b.useContext)(uh).reducedMotion,u=(0,b.useRef)(null),d=(0,b.useRef)(!1);n=n||o.renderer,!u.current&&n&&(u.current=n(e,{visualState:t,parent:a,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,isSVG:i}),d.current&&u.current&&(u.current.manuallyAnimateOnMount=!0));let h=u.current,m=(0,b.useContext)(uR);h&&!h.projection&&s&&("html"===h.type||"svg"===h.type)&&function(e,t,r,n){let{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&uM(o),visualElement:e,animationType:"string"==typeof i?i:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c})}(u.current,r,s,m);let p=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{h&&p.current&&h.update(r,l)});let f=r[uP],g=(0,b.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return uI(()=>{d.current=!0,h&&(p.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),g.current&&h.animationState&&h.animationState.animateChanges())}),(0,b.useEffect)(()=>{h&&(!g.current&&h.animationState&&h.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),g.current=!1),h.enteringChildren=void 0)}),h}(e,p,d,s,t.ProjectionNode,i)}return(0,v.jsxs)(um.Provider,{value:m,children:[l&&m.visualElement?(0,v.jsx)(l,{visualElement:m.visualElement,...d}):null,function(e,t,r,{latestValues:n},s,i=!1,a){let o=(a??uc(e)?function(e,t,r,n){let s=(0,b.useMemo)(()=>{let r=ux();return cH(r,t,cX(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){let t={};ug(t,e.style,e),s.style={...t,...s.style}}return s}:function(e,t){let r,n,s={},i=(r=e.style||{},ug(n={},r,e),Object.assign(n,function({transformTemplate:e},t){return(0,b.useMemo)(()=>{let r=uf();return cU(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),n);return e.drag&&!1!==e.dragListener&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=i,s})(t,n,s,e),l=function(e,t,r){let n={};for(let s in e)("values"!==s||"object"!=typeof e.values)&&(ub(s)||!0===r&&uv(s)||!t&&!uv(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}(t,"string"==typeof e,i),c=e!==b.Fragment?{...l,...o,ref:r}:{},{children:u}=t,d=(0,b.useMemo)(()=>lR(u)?u.get():u,[u]);return(0,b.createElement)(e,{...c,children:d})}(e,r,(o=m.visualElement,c=(0,b.useRef)(n),(0,b.useInsertionEffect)(()=>{c.current=n}),u=(0,b.useRef)(null),(0,b.useCallback)(e=>{e&&p.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=c.current;if("function"==typeof t)if(e){let r=t(e);"function"==typeof r&&(u.current=r)}else u.current?(u.current(),u.current=null):t(e);else t&&(t.current=e)},[o])),p,h,t,i)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,b.forwardRef)(o);return l[uE]=e,l}class uD{constructor(e){this.isMounted=!1,this.node=e}update(){}}function uz(e,t,r){let n=e.getProps();return cI(n,t,void 0!==r?r:n.custom,e)}function uO(e,t){return e?.[t]??e?.default??e}let uB=e=>Array.isArray(e);function uF(e,t){let r=e.getValue("willChange");if(lR(r)&&r.add)return r.add(t);if(!r&&l8.WillChange){let r=new l8.WillChange("auto");e.addValue("willChange",r),r.add(t)}}let u$=e=>1e3*e,uV=(e,t)=>r=>t(e(r)),uU=(...e)=>e.reduce(uV),uW={layout:0,mainThread:0,waapi:0};function uG(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function uq(e,t){return r=>r>0?t:e}let uH=(e,t,r)=>{let n=e*e,s=r*(t*t-n)+n;return s<0?0:Math.sqrt(s)},uK=[lt,le,lc];function uX(e){let t=uK.find(t=>t.test(e));if(lz(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===lc&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let s=0,i=0,a=0;if(t/=100){let n=r<.5?r*(1+t):r+t-r*t,o=2*r-n;s=uG(o,n,e+1/3),i=uG(o,n,e),a=uG(o,n,e-1/3)}else s=i=a=r;return{red:Math.round(255*s),green:Math.round(255*i),blue:Math.round(255*a),alpha:n}}(r)),r}let uY=(e,t)=>{let r=uX(e),n=uX(t);if(!r||!n)return uq(e,t);let s={...r};return e=>(s.red=uH(r.red,n.red,e),s.green=uH(r.green,n.green,e),s.blue=uH(r.blue,n.blue,e),s.alpha=cQ(r.alpha,n.alpha,e),le.transform(s))},uJ=new Set(["none","hidden"]);function uZ(e,t){return r=>cQ(e,t,r)}function uQ(e){return"number"==typeof e?uZ:"string"==typeof e?lV(e)?uq:lu.test(e)?uY:u2:Array.isArray(e)?u0:"object"==typeof e?lu.test(e)?uY:u1:uq}function u0(e,t){let r=[...e],n=r.length,s=e.map((e,r)=>uQ(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=s[t](e);return r}}function u1(e,t){let r={...e,...t},n={};for(let s in r)void 0!==e[s]&&void 0!==t[s]&&(n[s]=uQ(e[s])(e[s],t[s]));return e=>{for(let t in n)r[t]=n[t](e);return r}}let u2=(e,t)=>{let r=lv.createTransformer(t),n=lf(e),s=lf(t);if(!(n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length))return lz(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),uq(e,t);if(uJ.has(e)&&!s.values.length||uJ.has(t)&&!n.values.length)return uJ.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return uU(u0(function(e,t){let r=[],n={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){let i=t.types[s],a=e.indexes[i][n[i]],o=e.values[a]??0;r[s]=o,n[i]++}return r}(n,s),s.values),r)};function u5(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?cQ(e,t,r):uQ(e)(e,t)}let u3=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>ce.update(t,e),stop:()=>ct(t),now:()=>cr.isProcessing?cr.timestamp:cv.now()}},u4=(e,t,r=10)=>{let n="",s=Math.max(Math.round(t/r),2);for(let t=0;t<s;t++)n+=Math.round(1e4*e(t/(s-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function u6(e){let t=0,r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}function u8(e,t,r){var n,s;let i=Math.max(t-5,0);return n=r-e(i),(s=t-i)?1e3/s*n:0}let u9=.01,u7=2,de=.005,dt=.5;function dr(e,t){return e*Math.sqrt(1-t*t)}let dn=["duration","bounce"],ds=["stiffness","damping","mass"];function di(e,t){return t.some(t=>void 0!==e[t])}function da(e=.3,t=.3){let r,n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:s,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:h,velocity:m,isResolvedFromDuration:p}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!di(e,ds)&&di(e,dn))if(e.visualDuration){let r=2*Math.PI/(1.2*e.visualDuration),n=r*r,s=2*o0(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:1,stiffness:n,damping:s}}else{let r=function({duration:e=800,bounce:t=.3,velocity:r=0,mass:n=1}){let s,i;lz(e<=u$(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=o0(.05,1,a),e=o0(.01,10,e/1e3),a<1?(s=t=>{let n=t*a,s=n*e;return .001-(n-r)/dr(t,a)*Math.exp(-s)},i=t=>{let n=t*a*e,i=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-n),l=dr(Math.pow(t,2),a);return(n*r+r-i)*o*(-s(t)+.001>0?-1:1)/l}):(s=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),i=t=>e*e*(r-t)*Math.exp(-t*e));let o=function(e,t,r){let n=r;for(let r=1;r<12;r++)n-=e(n)/t(n);return n}(s,i,5/e);if(e=u$(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}(e);(t={...t,...r,mass:1}).isResolvedFromDuration=!0}return t}({...n,velocity:-((n.velocity||0)/1e3)}),f=m||0,g=u/(2*Math.sqrt(c*d)),x=o-a,y=Math.sqrt(c/d)/1e3,v=5>Math.abs(x);if(s||(s=v?u9:u7),i||(i=v?de:dt),g<1){let e=dr(y,g);r=t=>o-Math.exp(-g*y*t)*((f+g*y*x)/e*Math.sin(e*t)+x*Math.cos(e*t))}else if(1===g)r=e=>o-Math.exp(-y*e)*(x+(f+y*x)*e);else{let e=y*Math.sqrt(g*g-1);r=t=>{let r=Math.exp(-g*y*t),n=Math.min(e*t,300);return o-r*((f+g*y*x)*Math.sinh(n)+e*x*Math.cosh(n))/e}}let b={calculatedDuration:p&&h||null,next:e=>{let t=r(e);if(p)l.done=e>=h;else{let n=0===e?f:0;g<1&&(n=0===e?u$(f):u8(r,e,t));let a=Math.abs(o-t)<=i;l.done=Math.abs(n)<=s&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(u6(b),2e4),t=u4(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function dl({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:u}){let d,h,m=e[0],p={done:!1,value:m},f=r*t,g=m+f,x=void 0===a?g:a(g);x!==g&&(f=x-m);let y=e=>-f*Math.exp(-e/n),v=e=>x+y(e),b=e=>{let t=y(e),r=v(e);p.done=Math.abs(t)<=c,p.value=p.done?x:r},w=e=>{let t;if(t=p.value,void 0!==o&&t<o||void 0!==l&&t>l){var r;d=e,h=da({keyframes:[p.value,(r=p.value,void 0===o?l:void 0===l||Math.abs(o-r)<Math.abs(l-r)?o:l)],velocity:u8(v,e,p.value),damping:s,stiffness:i,restDelta:c,restSpeed:u})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),w(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),p)}}}da.applyToOptions=e=>{let t=function(e,t=100,r){let n=r({...e,keyframes:[0,t]}),s=Math.min(u6(n),2e4);return{type:"keyframes",ease:e=>n.next(s*e).value/t,duration:s/1e3}}(e,100,da);return e.ease=t.ease,e.duration=u$(t.duration),e.type="keyframes",e};let dc=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function du(e,t,r,n){return e===t&&r===n?l6:s=>0===s||1===s?s:dc(function(e,t,r,n,s){let i,a,o=0;do(i=dc(a=t+(r-t)/2,n,s)-e)>0?r=a:t=a;while(Math.abs(i)>1e-7&&++o<12)return a}(s,0,1,e,r),t,n)}let dd=du(.42,0,1,1),dh=du(0,0,.58,1),dm=du(.42,0,.58,1),dp=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,df=e=>t=>1-e(1-t),dg=du(.33,1.53,.69,.99),dx=df(dg),dy=dp(dx),dv=e=>(e*=2)<1?.5*dx(e):.5*(2-Math.pow(2,-10*(e-1))),db=e=>1-Math.sin(Math.acos(e)),dw=df(db),dj=dp(db),dk=e=>Array.isArray(e)&&"number"==typeof e[0],dN={linear:l6,easeIn:dd,easeInOut:dm,easeOut:dh,circIn:db,circInOut:dj,circOut:dw,backIn:dx,backInOut:dy,backOut:dg,anticipate:dv},dS=e=>{if(dk(e)){lO(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,r,n,s]=e;return du(t,r,n,s)}return"string"==typeof e?(lO(void 0!==dN[e],`Invalid easing type '${e}'`,"invalid-easing-type"),dN[e]):e},dC=(e,t,r)=>{let n=t-e;return 0===n?1:(r-e)/n};function dA({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){var s;let i,a=Array.isArray(n)&&"number"!=typeof n[0]?n.map(dS):dS(n),o={done:!1,value:t[0]},l=function(e,t,{clamp:r=!0,ease:n,mixer:s}={}){let i=e.length;if(lO(i===t.length,"Both input and output ranges must be the same length","range-length"),1===i)return()=>t[0];if(2===i&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,r){let n=[],s=r||l8.mix||u5,i=e.length-1;for(let r=0;r<i;r++){let i=s(e[r],e[r+1]);t&&(i=uU(Array.isArray(t)?t[r]||l6:t,i)),n.push(i)}return n}(t,n,s),l=o.length,c=r=>{if(a&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);let s=dC(e[n],e[n+1],r);return o[n](s)};return r?t=>c(o0(e[0],e[i-1],t)):c}((s=r&&r.length===t.length?r:(!function(e,t){let r=e[e.length-1];for(let n=1;n<=t;n++){let s=dC(0,t,n);e.push(cQ(r,1,s))}}(i=[0],t.length-1),i),s.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||dm).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let d_=e=>null!==e;function dT(e,{repeat:t,repeatType:r="loop"},n,s=1){let i=e.filter(d_),a=s<0||t&&"loop"!==r&&t%2==1?0:i.length-1;return a&&void 0!==n?n:i[a]}let dE={decay:dl,inertia:dl,tween:dA,keyframes:dA,spring:da};function dP(e){"string"==typeof e.type&&(e.type=dE[e.type])}class dR{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let dM=e=>e/100;class dI extends dR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==cv.now()&&this.tick(cv.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},uW.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;dP(e);let{type:t=dA,repeat:r=0,repeatDelay:n=0,repeatType:s,velocity:i=0}=e,{keyframes:a}=e,o=t||dA;o!==dA&&"number"!=typeof a[0]&&(this.mixKeyframes=uU(dM,u5(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===s&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-i})),null===l.calculatedDuration&&(l.calculatedDuration=u6(l));let{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:r,totalDuration:n,mixKeyframes:s,mirroredGenerator:i,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return r.next(0);let{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let y=this.currentTime,v=r;if(u){let e=Math.min(this.currentTime,n)/a,t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,(t=Math.min(t,u+1))%2&&("reverse"===d?(r=1-r,h&&(r-=h/a)):"mirror"===d&&(v=i)),y=o0(0,1,r)*a}let b=x?{done:!1,value:c[0]}:v.next(y);s&&(b.value=s(b.value));let{done:w}=b;x||null===o||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let j=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return j&&m!==dl&&(b.value=dT(c,this.options,f,this.speed)),p&&p(b.value),j&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=u$(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(cv.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=u3,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(cv.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,uW.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function dL(e){let t;return()=>(void 0===t&&(t=e()),t)}let dD=dL(()=>void 0!==window.ScrollTimeline),dz={},dO=(u=dL(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>dz.linearEasing??u()),dB=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,dF={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dB([0,.65,.55,1]),circOut:dB([.55,0,1,.45]),backIn:dB([.31,.01,.66,-.59]),backOut:dB([.33,1.53,.69,.99])};function d$(e){return"function"==typeof e&&"applyToOptions"in e}class dV extends dR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:s,allowFlatten:i=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!s,this.allowFlatten=i,this.options=e,lO("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return d$(e)&&dO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,r,{delay:n=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c){let u={[t]:r};l&&(u.offset=l);let d=function e(t,r){if(t)return"function"==typeof t?dO()?u4(t,r):"ease-out":dk(t)?dB(t):Array.isArray(t)?t.map(t=>e(t,r)||dF.easeOut):dF[t]}(o,s);Array.isArray(d)&&(u.easing=d);let h={delay:n,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"};c&&(h.pseudoElement=c);let m=e.animate(u,h);return m}(t,r,n,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){let e=dT(n,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):r.startsWith("--")?t.style.setProperty(r,e):t.style[r]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=u$(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&dD())?(this.animation.timeline=e,l6):t(this)}}let dU={anticipate:dv,backInOut:dy,circInOut:dj};class dW extends dV{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in dU&&(e.ease=dU[e.ease])}(e),dP(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:r,onComplete:n,element:s,...i}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new dI({...i,autoplay:!1}),o=Math.max(10,cv.now()-this.startTime),l=o0(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let dG=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(lv.test(e)||"0"===e)&&!e.startsWith("url("));function dq(e){e.duration=0,e.type="keyframes"}let dH=new Set(["opacity","clipPath","filter","transform"]),dK=dL(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class dX extends dR{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:i="loop",keyframes:a,name:o,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=cv.now();const d={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:s,repeatType:i,name:o,motionValue:l,element:c,...u},h=c?.KeyframeResolver||cu;this.keyframeResolver=new h(a,(e,t,r)=>this.onKeyframesResolved(e,t,d,!r),o,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;let{name:s,type:i,velocity:a,delay:o,isHandoff:l,onUpdate:c}=r;this.resolvedAt=cv.now(),!function(e,t,r,n){let s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;let i=e[e.length-1],a=dG(s,t),o=dG(i,t);return lz(a===o,`You are trying to animate ${t} from "${s}" to "${i}". "${a?i:s}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||d$(r))&&n)}(e,s,i,a)&&((l8.instantAnimations||!o)&&c?.(dT(e,r,t)),e[0]=e[e.length-1],dq(r),r.repeat=0);let u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},d=!l&&function(e){let{motionValue:t,name:r,repeatDelay:n,repeatType:s,damping:i,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return dK()&&r&&dH.has(r)&&("transform"!==r||!l)&&!o&&!n&&"mirror"!==s&&0!==i&&"inertia"!==a}(u),h=u.motionValue?.owner?.current,m=d?new dW({...u,element:h}):new dI(u);m.finished.then(()=>{this.notifyFinished()}).catch(l6),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),co=!0,cc(),cl(),co=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let dY={type:"spring",stiffness:500,damping:25,restSpeed:10},dJ={type:"keyframes",duration:.8},dZ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dQ=e=>null!==e,d0=(e,t,r,n={},s,i)=>a=>{let o=uO(n,e)||{},l=o.delay||n.delay||0,{elapsed:c=0}=n;c-=u$(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};!function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)&&Object.assign(u,((e,{keyframes:t})=>t.length>2?dJ:oQ.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:dY:dZ)(e,u)),u.duration&&(u.duration=u$(u.duration)),u.repeatDelay&&(u.repeatDelay=u$(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if(!1!==u.type&&(0!==u.duration||u.repeatDelay)||(dq(u),0===u.delay&&(d=!0)),(l8.instantAnimations||l8.skipAnimations)&&(d=!0,dq(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,d&&!i&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:r="loop"},n){let s=e.filter(dQ),i=t&&"loop"!==r&&t%2==1?0:s.length-1;return s[i]}(u.keyframes,o);if(void 0!==e)return void ce.update(()=>{u.onUpdate(e),u.onComplete()})}return o.isSync?new dI(u):new dX(u)};function d1(e,t,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:i=e.getDefaultTransition(),transitionEnd:a,...o}=t;n&&(i=n);let l=[],c=s&&e.animationState&&e.animationState.getState()[s];for(let t in o){let n=e.getValue(t,e.latestValues[t]??null),s=o[t];if(void 0===s||c&&function({protectedKeys:e,needsAnimating:t},r){let n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}(c,t))continue;let a={delay:r,...uO(i||{},t)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(s)&&s===u&&!a.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let r=e.props[uP];if(r){let e=window.MotionHandoffAnimation(r,t,ce);null!==e&&(a.startTime=e,d=!0)}}uF(e,t),n.start(d0(t,n,s,e.shouldReduceMotion&&lM.has(t)?{type:!1}:a,e,d));let h=n.animation;h&&l.push(h)}return a&&Promise.all(l).then(()=>{ce.update(()=>{a&&function(e,t){let{transitionEnd:r={},transition:n={},...s}=uz(e,t)||{};for(let t in s={...s,...r}){var i;let r=uB(i=s[t])?i[i.length-1]||0:i;e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,cw(r))}}(e,a)})}),l}function d2(e,t,r,n=0,s=1){let i=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*n;return"function"==typeof r?r(i,a):1===s?i*n:o-i*n}function d5(e,t,r={}){let n=uz(e,t,"exit"===r.type?e.presenceContext?.custom:void 0),{transition:s=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);let i=n?()=>Promise.all(d1(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(n=0)=>{let{delayChildren:i=0,staggerChildren:a,staggerDirection:o}=s;return function(e,t,r=0,n=0,s=0,i=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(d5(l,t,{...a,delay:r+("function"==typeof n?0:n)+d2(e.variantChildren,l,n,s,i)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,n,i,a,o,r)}:()=>Promise.resolve(),{when:o}=s;if(!o)return Promise.all([i(),a(r.delay)]);{let[e,t]="beforeChildren"===o?[i,a]:[a,i];return e().then(()=>t())}}let d3=cE.length;function d4(e,t){if(!Array.isArray(t))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}let d6=[...cT].reverse(),d8=cT.length;function d9(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function d7(){return{animate:d9(!0),whileInView:d9(),whileHover:d9(),whileTap:d9(),whileDrag:d9(),whileFocus:d9(),exit:d9()}}let he=0;function ht(e){return[e("x"),e("y")]}let hr=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hn(e){return hr.has(e.tagName)||!0===e.isContentEditable}function hs(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}let hi={x:!1,y:!1};function ha(e){return e.max-e.min}function ho(e,t,r,n=.5){e.origin=n,e.originPoint=cQ(t.min,t.max,e.origin),e.scale=ha(r)/ha(t),e.translate=cQ(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function hl(e,t,r,n){ho(e.x,t.x,r.x,n?n.originX:void 0),ho(e.y,t.y,r.y,n?n.originY:void 0)}function hc(e,t,r){e.min=r.min+t.min,e.max=e.min+ha(t)}function hu(e,t,r){e.min=t.min-r.min,e.max=e.min+ha(t)}function hd(e,t,r){hu(e.x,t.x,r.x),hu(e.y,t.y,r.y)}let hh=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function hm(e){return{point:{x:e.pageX,y:e.pageY}}}function hp(e,t,r,n){return hs(e,t,e=>hh(e)&&r(e,hm(e)),n)}let hf=({current:e})=>e?e.ownerDocument.defaultView:null,hg=(e,t)=>Math.abs(e-t),hx=new Set(["auto","scroll"]);class hy{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=hw(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,s=(e=r.offset,t={x:0,y:0},Math.sqrt(hg(e.x,t.x)**2+hg(e.y,t.y)**2)>=this.distanceThreshold);if(!n&&!s)return;let{point:i}=r,{timestamp:a}=cr;this.history.push({...i,timestamp:a});let{onStart:o,onMove:l}=this.handlers;n||(o&&o(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,r)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=hv(t,this.transformPagePoint),ce.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:r,onSessionEnd:n,resumeAnimation:s}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&s&&s(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let i=hw("pointercancel"===e.type?this.lastMoveEventInfo:hv(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,i),n&&n(e,i)},!hh(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=n||window;const o=hv(hm(e),this.transformPagePoint),{point:l}=o,{timestamp:c}=cr;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,hw(o,this.history)),this.removeListeners=uU(hp(this.contextWindow,"pointermove",this.handlePointerMove),hp(this.contextWindow,"pointerup",this.handlePointerUp),hp(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(hx.has(e.overflowX)||hx.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:n.x-t.x,y:n.y-t.y};(0!==s.x||0!==s.y)&&(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,n),ce.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ct(this.updatePoint)}}function hv(e,t){return t?{point:t(e.point)}:e}function hb(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hw({point:e},t){return{point:e,delta:hb(e,hj(t)),offset:hb(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null,s=hj(e);for(;r>=0&&(n=e[r],!(s.timestamp-n.timestamp>u$(.1)));)r--;if(!n)return{x:0,y:0};let i=(s.timestamp-n.timestamp)/1e3;if(0===i)return{x:0,y:0};let a={x:(s.x-n.x)/i,y:(s.y-n.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function hj(e){return e[e.length-1]}function hk(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function hN(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function hS(e,t,r){return{min:hC(e,t),max:hC(e,r)}}function hC(e,t){return"number"==typeof e?e:e[t]||0}let hA=new WeakMap;class h_{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lP(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){let{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;let s=e=>{t?(this.stopAnimation(),this.snapToCursor(hm(e).point)):this.pauseAnimation()},i=(e,t)=>{this.stopAnimation();let{drag:r,dragPropagation:n,onDragStart:s}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(hi[e])return null;else return hi[e]=!0,()=>{hi[e]=!1};return hi.x||hi.y?null:(hi.x=hi.y=!0,()=>{hi.x=hi.y=!1})}(r),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ht(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ls.test(t)){let{projection:r}=this.visualElement;if(r&&r.layout){let n=r.layout.layoutBox[e];n&&(t=ha(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),s&&ce.postRender(()=>s(e,t)),uF(this.visualElement,"transform");let{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:r,dragDirectionLock:n,onDirectionLock:s,onDrag:i}=this.getProps();if(!r&&!this.openDragLock)return;let{offset:a}=t;if(n&&null===this.currentDirection){this.currentDirection=function(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}(a),null!==this.currentDirection&&s&&s(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),i&&i(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>ht(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new hy(e,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:hf(this.visualElement),element:this.visualElement.current})}stop(e,t){let r=e||this.latestPointerEvent,n=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!n||!r)return;let{velocity:i}=n;this.startAnimation(i);let{onDragEnd:a}=this.getProps();a&&ce.postRender(()=>a(r,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){let{drag:n}=this.getProps();if(!r||!hT(e,n,this.currentDirection))return;let s=this.getAxisMotionValue(e),i=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(i=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?cQ(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?cQ(r,e,n.max):Math.min(e,r)),e}(i,this.constraints[e],this.elastic[e])),s.set(i)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&uM(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=function(e,{top:t,left:r,bottom:n,right:s}){return{x:hk(e.x,r,s),y:hk(e.y,t,n)}}(r.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:hS(e,"left","right"),y:hS(e,"top","bottom")}}(t),n!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ht(e=>{var t,n;let s;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],n=this.constraints[e],s={},void 0!==n.min&&(s.min=n.min-t.min),void 0!==n.max&&(s.max=n.max-t.min),s))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!uM(t))return!1;let n=t.current;lO(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:s}=this.visualElement;if(!s||!s.layout)return!1;let i=function(e,t,r){let n=ua(e,r),{scroll:s}=t;return s&&(un(n.x,s.offset.x),un(n.y,s.offset.y)),n}(n,s.root,this.visualElement.getTransformPagePoint()),a=(e=s.layout.layoutBox,{x:hN(e.x,i.x),y:hN(e.y,i.y)});if(r){let e=r(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=c4(e))}return a}startAnimation(e){let{drag:t,dragMomentum:r,dragElastic:n,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(ht(a=>{if(!hT(a,t,this.currentDirection))return;let l=o&&o[a]||{};i&&(l={min:0,max:0});let c={type:"inertia",velocity:r?e[a]:0,bounceStiffness:n?200:1e6,bounceDamping:n?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(a,c)})).then(a)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return uF(this.visualElement,e),r.start(d0(e,r,0,t,this.visualElement,!1))}stopAnimation(){ht(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ht(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps();return r[t]||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){ht(t=>{let{drag:r}=this.getProps();if(!hT(t,r,this.currentDirection))return;let{projection:n}=this.visualElement,s=this.getAxisMotionValue(t);if(n&&n.layout){let{min:r,max:i}=n.layout.layoutBox[t],a=s.get()||0;s.set(e[t]-cQ(r,i,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!uM(t)||!r||!this.constraints)return;this.stopAnimation();let n={x:0,y:0};ht(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var r,s;let i,a,o,l=t.get();n[e]=(r={min:l,max:l},s=this.constraints[e],i=.5,a=ha(r),(o=ha(s))>a?i=dC(s.min,s.max-a,r.min):a>o&&(i=dC(r.min,r.max-o,s.min)),o0(0,1,i))}});let{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ht(t=>{if(!hT(t,e,null))return;let r=this.getAxisMotionValue(t),{min:s,max:i}=this.constraints[t];r.set(cQ(s,i,n[t]))})}addListeners(){if(!this.visualElement.current)return;hA.set(this.visualElement,this);let e=this.visualElement.current,t=hp(e,"pointerdown",t=>{let{drag:r,dragListener:n=!0}=this.getProps(),s=t.target,i=s!==e&&hn(s);r&&n&&!i&&this.start(t)}),r=()=>{let{dragConstraints:e}=this.getProps();uM(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,s=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),ce.read(r);let i=hs(window,"resize",()=>this.scalePositionWithinConstraints()),a=n.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(ht(t=>{let r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),t(),s(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:i=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:s,dragElastic:i,dragMomentum:a}}}function hT(e,t,r){return(!0===t||t===e)&&(null===r||r===e)}let hE=e=>(t,r)=>{e&&ce.postRender(()=>e(t,r))},hP={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var hR=b;let hM=!1;class hI extends hR.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),r&&r.register&&n&&r.register(s),hM&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hP.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:r,drag:n,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,e.layoutDependency!==t&&i.setOptions({...i.options,layoutDependency:t}),hM=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==s?i.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?i.promote():i.relegate()||ce.postRender(()=>{let e=i.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),cx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;hM=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function hL(e){let[t,r]=function(e=!0){let t=(0,b.useContext)(uj);if(null===t)return[!0,null];let{isPresent:r,onExitComplete:n,register:s}=t,i=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return s(i)},[e]);let a=(0,b.useCallback)(()=>e&&n&&n(i),[i,n,e]);return!r&&n?[!1,a]:[!0]}(),n=(0,hR.useContext)(uu);return(0,v.jsx)(hI,{...e,layoutGroup:n,switchLayoutGroup:(0,hR.useContext)(uR),isPresent:t,safeToRemove:r})}function hD(e,t,r,n,s){return e-=t,e=n+1/r*(e-n),void 0!==s&&(e=n+1/s*(e-n)),e}function hz(e,t,[r,n,s],i,a){!function(e,t=0,r=1,n=.5,s,i=e,a=e){if(ls.test(t)&&(t=parseFloat(t),t=cQ(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=cQ(i.min,i.max,n);e===i&&(o-=t),e.min=hD(e.min,t,r,o,s),e.max=hD(e.max,t,r,o,s)}(e,t[r],t[n],t[s],t.scale,i,a)}let hO=["x","scaleX","originX"],hB=["y","scaleY","originY"];function hF(e,t,r,n){hz(e.x,t,hO,r?r.x:void 0,n?n.x:void 0),hz(e.y,t,hB,r?r.y:void 0,n?n.y:void 0)}function h$(e,t){e.min=t.min,e.max=t.max}function hV(e,t){h$(e.x,t.x),h$(e.y,t.y)}function hU(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function hW(e){return 0===e.translate&&1===e.scale}function hG(e){return hW(e.x)&&hW(e.y)}function hq(e,t){return e.min===t.min&&e.max===t.max}function hH(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function hK(e,t){return hH(e.x,t.x)&&hH(e.y,t.y)}function hX(e){return ha(e.x)/ha(e.y)}function hY(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let hJ=["TopLeft","TopRight","BottomLeft","BottomRight"],hZ=hJ.length,hQ=e=>"string"==typeof e?parseFloat(e):e,h0=e=>"number"==typeof e||li.test(e);function h1(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let h2=h3(0,.5,dw),h5=h3(.5,.95,l6);function h3(e,t,r){return n=>n<e?0:n>t?1:r(dC(e,t,n))}function h4(e){return"object"==typeof e&&null!==e}function h6(e){return h4(e)&&"ownerSVGElement"in e}let h8=(e,t)=>e.depth-t.depth;class h9{constructor(){this.children=[],this.isDirty=!1}add(e){cp(this.children,e),this.isDirty=!0}remove(e){cf(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h8),this.isDirty=!1,this.children.forEach(e)}}class h7{constructor(){this.members=[]}add(e){cp(this.members,e),e.scheduleRender()}remove(e){if(cf(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,r=this.members.findIndex(t=>e===t);if(0===r)return!1;for(let e=r;e>=0;e--){let r=this.members[e];if(!1!==r.isPresent){t=r;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();let n=r.options.layoutDependency,s=e.options.layoutDependency;(void 0===n||void 0===s||n!==s)&&(e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:i}=e.options;!1===i&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let me=["","X","Y","Z"],mt=0;function mr(e,t,r,n){let{latestValues:s}=t;s[e]&&(r[e]=s[e],t.setStaticValue(e,0),n&&(n[e]=0))}function mn({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(e={},r=t?.()){this.id=mt++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(ma),this.nodes.forEach(mm),this.nodes.forEach(mp),this.nodes.forEach(mo)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new h9)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cg),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=h6(t)&&!(h6(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:r,layout:n,visualElement:s}=this.options;if(s&&!s.current&&s.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(n||r)&&(this.isLayoutDirty=!0),e){let r,n=0,s=()=>this.root.updateBlockedByResize=!1;ce.read(()=>{n=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==n){let t,i;n=e,this.root.updateBlockedByResize=!0,r&&r(),t=cv.now(),i=({timestamp:e})=>{let r=e-t;r>=250&&(ct(i),s(r-250))},ce.setup(i,!0),r=()=>ct(i),hP.hasAnimatedSinceResize&&(hP.hasAnimatedSinceResize=!1,this.nodes.forEach(mh))}})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&s&&(r||n)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let i=this.options.transition||s.getDefaultTransition()||mb,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=s.getProps(),l=!this.targetLayout||!hK(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...uO(i,"layout"),onPlay:a,onComplete:o};(s.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||mh(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ct(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mf),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:r}=t.options;if(!r)return;let n=r.props[uP];if(window.MotionHasOptimisedAnimation(n,"transform")){let{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",ce,!(e||r))}let{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&e(s)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;let n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(mc);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(mu);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(md),this.nodes.forEach(ms),this.nodes.forEach(mi)):this.nodes.forEach(mu),this.clearAllSnapshots();let e=cv.now();cr.delta=o0(0,1e3/60,e-cr.timestamp),cr.timestamp=e,cr.isProcessing=!0,cn.update.process(cr),cn.preRender.process(cr),cn.render.process(cr),cr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ml),this.sharedNodes.forEach(mg)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ce.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ce.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||ha(this.snapshot.measuredBox.x)||ha(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=lP(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!s)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!hG(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,i=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||c9(this.latestValues)||i)&&(s(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let r=this.measurePageBox(),n=this.removeElementScroll(r);return e&&(n=this.removeTransform(n)),mk((t=n).x),mk(t.y),{animationId:this.root.animationId,measuredBox:r,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return lP();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(mS))){let{scroll:e}=this.root;e&&(un(t.x,e.offset.x),un(t.y,e.offset.y))}return t}removeElementScroll(e){let t=lP();if(hV(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){let n=this.path[r],{scroll:s,options:i}=n;n!==this.root&&s&&i.layoutScroll&&(s.wasRoot&&hV(t,e),un(t.x,s.offset.x),un(t.y,s.offset.y))}return t}applyTransform(e,t=!1){let r=lP();hV(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&ui(r,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),c9(n.latestValues)&&ui(r,n.latestValues)}return c9(this.latestValues)&&ui(r,this.latestValues),r}removeTransform(e){let t=lP();hV(t,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];if(!r.instance||!c9(r.latestValues))continue;c8(r.latestValues)&&r.updateSnapshot();let n=lP();hV(n,r.measurePageBox()),hF(t,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,n)}return c9(this.latestValues)&&hF(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==cr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let r=!!this.resumingFrom||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:n,layoutId:s}=this.options;if(!this.layout||!(n||s))return;this.resolvedRelativeTargetAt=cr.timestamp;let i=this.getClosestProjectingParent();if(i&&this.linkedParentVersion!==i.layoutVersion&&!i.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(i&&i.layout?this.createRelativeTarget(i,this.layout.layoutBox,i.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=lP(),this.targetWithTransforms=lP()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,hc(a.x,o.x,l.x),hc(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hV(this.target,this.layout.layoutBox),ur(this.target,this.targetDelta)):hV(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,i&&!!i.resumingFrom==!!this.resumingFrom&&!i.options.layoutScroll&&i.target&&1!==this.animationProgress?this.createRelativeTarget(i,this.target,i.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||c8(this.parent.latestValues)||c7(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lP(),this.relativeTargetOrigin=lP(),hd(this.relativeTargetOrigin,t,r),hV(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===cr.timestamp&&(r=!1),r)return;let{layout:n,layoutId:s}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(n||s))return;hV(this.layoutCorrected,this.layout.layoutBox);let i=this.treeScale.x,a=this.treeScale.y;!function(e,t,r,n=!1){let s,i,a=r.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){i=(s=r[o]).projectionDelta;let{visualElement:a}=s.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(n&&s.options.layoutScroll&&s.scroll&&s!==s.root&&ui(e,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,ur(e,i)),n&&c9(s.latestValues)&&ui(e,s.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=lP());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(hU(this.prevProjectionDelta.x,this.projectionDelta.x),hU(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),hl(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===i&&this.treeScale.y===a&&hY(this.projectionDelta.x,this.prevProjectionDelta.x)&&hY(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lT(),this.projectionDelta=lT(),this.projectionDeltaWithTransform=lT()}setAnimationOrigin(e,t=!1){let r,n=this.snapshot,s=n?n.latestValues:{},i={...this.latestValues},a=lT();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=lP(),l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,d=!!(l&&!u&&!0===this.options.crossfade&&!this.path.some(mv));this.animationProgress=0,this.mixTargetDelta=t=>{let n=t/1e3;if(mx(a.x,e.x,n),mx(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,m,p,f,g;hd(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,f=o,g=n,my(m.x,p.x,f.x,g),my(m.y,p.y,f.y,g),r&&(c=this.relativeTarget,h=r,hq(c.x,h.x)&&hq(c.y,h.y))&&(this.isProjectionDirty=!1),r||(r=lP()),hV(r,this.relativeTarget)}l&&(this.animationValues=i,function(e,t,r,n,s,i){s?(e.opacity=cQ(0,r.opacity??1,h2(n)),e.opacityExit=cQ(t.opacity??1,0,h5(n))):i&&(e.opacity=cQ(t.opacity??1,r.opacity??1,n));for(let s=0;s<hZ;s++){let i=`border${hJ[s]}Radius`,a=h1(t,i),o=h1(r,i);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||h0(a)===h0(o)?(e[i]=Math.max(cQ(hQ(a),hQ(o),n),0),(ls.test(o)||ls.test(a))&&(e[i]+="%")):e[i]=o)}(t.rotate||r.rotate)&&(e.rotate=cQ(t.rotate||0,r.rotate||0,n))}(i,s,this.latestValues,n,d,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ct(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ce.update(()=>{var t,r,n;let s;hP.hasAnimatedSinceResize=!0,uW.layout++,this.motionValue||(this.motionValue=cw(0)),this.currentAnimation=(t=this.motionValue,r=[0,1e3],n={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{uW.layout--},onComplete:()=>{uW.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(s=lR(t)?t:cw(t)).start(d0("",s,r,n)),s.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:r,layout:n,latestValues:s}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&mN(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||lP();let t=ha(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;let n=ha(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}hV(t,r),ui(t,s),hl(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new h7),this.sharedNodes.get(e).add(t);let r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){let n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;let n={};r.z&&mr("z",e,n,this.animationValues);for(let t=0;t<me.length;t++)mr(`rotate${me[t]}`,e,n,this.animationValues),mr(`skew${me[t]}`,e,n,this.animationValues);for(let t in e.render(),n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=uw(t?.pointerEvents)||"",e.transform=r?r(this.latestValues,""):"none";return}let n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=uw(t?.pointerEvents)||""),this.hasProjected&&!c9(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1);return}e.visibility="";let s=n.animationValues||n.latestValues;this.applyTransformsToTarget();let i=function(e,t,r){let n="",s=e.x.translate/t.x,i=e.y.translate/t.y,a=r?.z||0;if((s||i||a)&&(n=`translate3d(${s}px, ${i}px, ${a}px) `),(1!==t.x||1!==t.y)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){let{transformPerspective:e,rotate:t,rotateX:s,rotateY:i,skewX:a,skewY:o}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),s&&(n+=`rotateX(${s}deg) `),i&&(n+=`rotateY(${i}deg) `),a&&(n+=`skewX(${a}deg) `),o&&(n+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(n+=`scale(${o}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,s);r&&(i=r(s,i)),e.transform=i;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,n.animationValues?e.opacity=n===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:e.opacity=n===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0,c0){if(void 0===s[t])continue;let{correct:r,applyTo:a,isCSSVariable:o}=c0[t],l="none"===i?s[t]:r(s[t],n);if(a){let t=a.length;for(let r=0;r<t;r++)e[a[r]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=n===this?uw(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(mc),this.root.sharedNodes.clear()}}}function ms(e){e.updateLayout()}function mi(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:n}=e.layout,{animationType:s}=e.options,i=t.source!==e.layout.source;"size"===s?ht(e=>{let n=i?t.measuredBox[e]:t.layoutBox[e],s=ha(n);n.min=r[e].min,n.max=n.min+s}):mN(s,t.layoutBox,r)&&ht(n=>{let s=i?t.measuredBox[n]:t.layoutBox[n],a=ha(r[n]);s.max=s.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+a)});let a=lT();hl(a,r,t.layoutBox);let o=lT();i?hl(o,e.applyTransform(n,!0),t.measuredBox):hl(o,r,t.layoutBox);let l=!hG(a),c=!1;if(!e.resumeFrom){let n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){let{snapshot:s,layout:i}=n;if(s&&i){let a=lP();hd(a,t.layoutBox,s.layoutBox);let o=lP();hd(o,r,i.layoutBox),hK(a,o)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function ma(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function mo(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ml(e){e.clearSnapshot()}function mc(e){e.clearMeasurements()}function mu(e){e.isLayoutDirty=!1}function md(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function mh(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function mm(e){e.resolveTargetDelta()}function mp(e){e.calcProjection()}function mf(e){e.resetSkewAndRotation()}function mg(e){e.removeLeadSnapshot()}function mx(e,t,r){e.translate=cQ(t.translate,0,r),e.scale=cQ(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function my(e,t,r,n){e.min=cQ(t.min,r.min,n),e.max=cQ(t.max,r.max,n)}function mv(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let mb={duration:.45,ease:[.4,0,.1,1]},mw=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),mj=mw("applewebkit/")&&!mw("chrome/")?Math.round:l6;function mk(e){e.min=mj(e.min),e.max=mj(e.max)}function mN(e,t,r){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(hX(t)-hX(r)))}function mS(e){return e!==e.root&&e.scroll?.wasRoot}let mC=mn({attachResizeListener:(e,t)=>hs(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),mA={current:void 0},m_=mn({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!mA.current){let e=new mC({});e.mount(window),e.setOptions({layoutScroll:!0}),mA.current=e}return mA.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function mT(e,t){let r=function(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,r=(void 0)??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function mE(e){return!("touch"===e.pointerType||hi.x||hi.y)}function mP(e,t,r){let{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);let s=n["onHover"+r];s&&ce.postRender(()=>s(t,hm(t)))}let mR=(e,t)=>!!t&&(e===t||mR(e,t.parentElement)),mM=new WeakSet;function mI(e){return t=>{"Enter"===t.key&&e(t)}}function mL(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function mD(e){return hh(e)&&!(hi.x||hi.y)}function mz(e,t,r){let{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);let s=n["onTap"+("End"===r?"":r)];s&&ce.postRender(()=>s(t,hm(t)))}let mO=new WeakMap,mB=new WeakMap,mF=e=>{let t=mO.get(e.target);t&&t(e)},m$=e=>{e.forEach(mF)},mV={some:0,all:1},mU=function(e,t){if("u"<typeof Proxy)return uL;let r=new Map,n=(r,n)=>uL(r,n,e,t);return new Proxy((e,t)=>n(e,t),{get:(s,i)=>"create"===i?n:(r.has(i)||r.set(i,uL(i,void 0,e,t)),r.get(i))})}({animation:{Feature:class extends uD{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:r})=>(function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t))n=Promise.all(t.map(t=>d5(e,t,r)));else if("string"==typeof t)n=d5(e,t,r);else{let s="function"==typeof t?uz(e,t,r.custom):t;n=Promise.all(d1(e,s,r))}return n.then(()=>{e.notify("AnimationComplete",t)})})(e,t,r))),r=d7(),n=!0,s=t=>(r,n)=>{let s=uz(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(s){let{transition:e,transitionEnd:t,...n}=s;r={...r,...n,...t}}return r};function i(i){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(r.initial=t.props.initial),r}let r={};for(let e=0;e<d3;e++){let n=cE[e],s=t.props[n];(c_(s)||!1===s)&&(r[n]=s)}return r}(e.parent)||{},l=[],c=new Set,u={},d=1/0;for(let t=0;t<d8;t++){var h,m;let p=d6[t],f=r[p],g=void 0!==a[p]?a[p]:o[p],x=c_(g),y=p===i?f.isActive:null;!1===y&&(d=t);let v=g===o[p]&&g!==a[p]&&x;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),f.protectedKeys={...u},!f.isActive&&null===y||!g&&!f.prevProp||cA(g)||"boolean"==typeof g)continue;let b=(h=f.prevProp,"string"==typeof(m=g)?m!==h:!!Array.isArray(m)&&!d4(m,h)),w=b||p===i&&f.isActive&&!v&&x||t>d&&x,j=!1,k=Array.isArray(g)?g:[g],N=k.reduce(s(p),{});!1===y&&(N={});let{prevResolvedValues:S={}}=f,C={...S,...N},A=t=>{w=!0,c.has(t)&&(j=!0,c.delete(t)),f.needsAnimating[t]=!0;let r=e.getValue(t);r&&(r.liveStyle=!1)};for(let e in C){let t=N[e],r=S[e];if(!u.hasOwnProperty(e))(uB(t)&&uB(r)?d4(t,r):t===r)?void 0!==t&&c.has(e)?A(e):f.protectedKeys[e]=!0:null!=t?A(e):c.add(e)}f.prevProp=g,f.prevResolvedValues=N,f.isActive&&(u={...u,...N}),n&&e.blockInitialAnimation&&(w=!1);let _=v&&b,T=!_||j;w&&T&&l.push(...k.map(t=>{let r={type:p};if("string"==typeof t&&n&&!_&&e.manuallyAnimateOnMount&&e.parent){let{parent:n}=e,s=uz(n,t);if(n.enteringChildren&&s){let{delayChildren:t}=s.transition||{};r.delay=d2(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(c.size){let t={};if("boolean"!=typeof a.initial){let r=uz(e,Array.isArray(a.initial)?a.initial[0]:a.initial);r&&r.transition&&(t.transition=r.transition)}c.forEach(r=>{let n=e.getBaseTarget(r),s=e.getValue(r);s&&(s.liveStyle=!0),t[r]=n??null}),l.push({animation:t})}let p=!!l.length;return n&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(p=!1),n=!1,p?t(l):Promise.resolve()}return{animateChanges:i,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;let s=i(t);for(let e in r)r[e].protectedKeys={};return s},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=d7()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();cA(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends uD{constructor(){super(...arguments),this.id=he++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends uD{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:r={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:a}=r,o={root:n?n.current:void 0,rootMargin:s,threshold:"number"==typeof i?i:mV[i]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),s=t?r:n;s&&s(e)};return e=this.node.current,t=function({root:e,...t}){let r=e||document;mB.has(r)||mB.set(r,{});let n=mB.get(r),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(m$,{root:e,...t})),n[s]}(o),mO.set(e,l),t.observe(e),()=>{mO.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends uD{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,s,i]=mT(e,r),a=e=>{let n=e.currentTarget;if(!mD(e))return;mM.add(n);let i=t(n,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),mM.has(n)&&mM.delete(n),mD(e)&&"function"==typeof i&&i(e,{success:t})},o=e=>{a(e,n===window||n===document||r.useGlobalTarget||mR(n,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,s),window.addEventListener("pointercancel",l,s)};return n.forEach(e=>{(r.useGlobalTarget?window:e).addEventListener("pointerdown",a,s),h4(e)&&"offsetHeight"in e&&(e.addEventListener("focus",e=>((e,t)=>{let r=e.currentTarget;if(!r)return;let n=mI(()=>{if(mM.has(r))return;mL(r,"down");let e=mI(()=>{mL(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>mL(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,s)),hn(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),i}(e,(e,t)=>(mz(this.node,t,"Start"),(e,{success:t})=>mz(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends uD{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=uU(hs(this.node.current,"focus",()=>this.onFocus()),hs(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends uD{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,s,i]=mT(e,r),a=e=>{if(!mE(e))return;let{target:r}=e,n=t(r,e);if("function"!=typeof n||!r)return;let i=e=>{mE(e)&&(n(e),r.removeEventListener("pointerleave",i))};r.addEventListener("pointerleave",i,s)};return n.forEach(e=>{e.addEventListener("pointerenter",a,s)}),i}(e,(e,t)=>(mP(this.node,t,"Start"),e=>mP(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends uD{constructor(){super(...arguments),this.removePointerDownListener=l6}onPointerDown(e){this.session=new hy(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hf(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:hE(e),onStart:hE(t),onMove:r,onEnd:(e,t)=>{delete this.session,n&&ce.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=hp(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends uD{constructor(e){super(e),this.removeGroupControls=l6,this.removeListeners=l6,this.controls=new h_(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||l6}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:m_,MeasureLayout:hL},layout:{ProjectionNode:m_,MeasureLayout:hL}},(e,t)=>t.isSVG??uc(e)?new c3(t):new uo(t,{allowProjection:e!==b.Fragment})),mW=(0,b.memo)(({children:e,as:t="p",className:r,duration:n=2,spread:s=2})=>{let i=mU.create(t),a=(0,b.useMemo)(()=>(e?.length??0)*s,[e,s]);return(0,v.jsx)(i,{animate:{backgroundPosition:"0% center"},className:(0,k.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",r),initial:{backgroundPosition:"100% center"},style:{"--spread":`${a}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:1/0,duration:n,ease:"linear"},children:e})}),mG=(0,b.createContext)(null),mq=(0,b.memo)(({className:e,isStreaming:t=!1,open:r,defaultOpen:n=!0,onOpenChange:s,duration:i,children:a,...o})=>{let[l,c]=(0,aH.useControllableState)({prop:r,defaultProp:n,onChange:s}),[u,d]=(0,aH.useControllableState)({prop:i,defaultProp:void 0}),[h,m]=(0,b.useState)(!1),[p,f]=(0,b.useState)(null);return(0,b.useEffect)(()=>{t?null===p&&f(Date.now()):null!==p&&(d(Math.ceil((Date.now()-p)/1e3)),f(null))},[t,p,d]),(0,b.useEffect)(()=>{if(n&&!t&&l&&!h){let e=setTimeout(()=>{c(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,n,c,h]),(0,v.jsx)(mG.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:c,duration:u},children:(0,v.jsx)(on,{className:(0,k.cn)("not-prose mb-4",e),onOpenChange:e=>{c(e)},open:l,...o,children:a})})}),mH=(e,t)=>e||0===t?(0,v.jsx)(mW,{duration:1,children:"Thinking..."}):void 0===t?(0,v.jsx)("p",{children:"Thought for a few seconds"}):(0,v.jsxs)("p",{children:["Thought for ",t," seconds"]}),mK=(0,b.memo)(({className:e,children:t,getThinkingMessage:r=mH,...n})=>{let{isStreaming:s,isOpen:i,duration:a}=(()=>{let e=(0,b.useContext)(mG);if(!e)throw Error("Reasoning components must be used within Reasoning");return e})();return(0,v.jsx)(os,{className:(0,k.cn)("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:t??(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oJ,{className:"size-4"}),r(s,a),(0,v.jsx)(oo.ChevronDownIcon,{className:(0,k.cn)("size-4 transition-transform",i?"rotate-180":"rotate-0")})]})})}),mX=(0,b.memo)(({className:e,children:t,...r})=>(0,v.jsx)(oi,{className:(0,k.cn)("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...r,children:(0,v.jsx)(aB.j,{plugins:{code:nr,mermaid:aM,math:nD,cjk:ef},linkSafety:{enabled:!0,renderModal:aW},...r,children:t})}));mq.displayName="Reasoning",mK.displayName="ReasoningTrigger",mX.displayName="ReasoningContent";var mY=/[\\\/_+.#"@\[\(\{&]/,mJ=/[\\\/_+.#"@\[\(\{&]/g,mZ=/[\s-]/,mQ=/[\s-]/g;function m0(e){return e.toLowerCase().replace(mQ," ")}var m1=e.i(7631),m2=e.i(408744),m5='[cmdk-group=""]',m3='[cmdk-group-items=""]',m4='[cmdk-item=""]',m6=`${m4}:not([aria-disabled="true"])`,m8="cmdk-item-select",m9="data-value",m7=(e,t,r)=>{var n;return n=e,function e(t,r,n,s,i,a,o){if(a===r.length)return i===t.length?1:.99;var l=`${i},${a}`;if(void 0!==o[l])return o[l];for(var c,u,d,h,m=s.charAt(a),p=n.indexOf(m,i),f=0;p>=0;)(c=e(t,r,n,s,p+1,a+1,o))>f&&(p===i?c*=1:mY.test(t.charAt(p-1))?(c*=.8,(d=t.slice(i,p-1).match(mJ))&&i>0&&(c*=Math.pow(.999,d.length))):mZ.test(t.charAt(p-1))?(c*=.9,(h=t.slice(i,p-1).match(mQ))&&i>0&&(c*=Math.pow(.999,h.length))):(c*=.17,i>0&&(c*=Math.pow(.999,p-i))),t.charAt(p)!==r.charAt(a)&&(c*=.9999)),(c<.1&&n.charAt(p-1)===s.charAt(a+1)||s.charAt(a+1)===s.charAt(a)&&n.charAt(p-1)!==s.charAt(a))&&.1*(u=e(t,r,n,s,p+1,a+2,o))>c&&(c=.1*u),c>f&&(f=c),p=n.indexOf(m,p+1);return o[l]=f,f}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,m0(n),m0(t),0,0,{})},pe=b.createContext(void 0),pt=b.createContext(void 0),pr=b.createContext(void 0),pn=b.forwardRef((e,t)=>{let r=pm(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=pm(()=>new Set),s=pm(()=>new Map),i=pm(()=>new Map),a=pm(()=>new Set),o=pd(e),{label:l,children:c,value:u,onValueChange:d,filter:h,shouldFilter:m,loop:p,disablePointerSelection:f=!1,vimBindings:g=!0,...x}=e,y=(0,a0.useId)(),v=(0,a0.useId)(),w=(0,a0.useId)(),j=b.useRef(null),k=pg();ph(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,N.emit()}},[u]),ph(()=>{k(6,E)},[]);let N=b.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var s,i,a,l;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),A(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(s=document.getElementById(y))||s.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,N.emit()}),n||k(5,E),(null==(i=o.current)?void 0:i.value)!==void 0){null==(l=(a=o.current).onValueChange)||l.call(a,null!=t?t:"");return}}N.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),S=b.useMemo(()=>({value:(e,t,n)=>{var s;t!==(null==(s=i.current.get(e))?void 0:s.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{A(),N.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),k(3,()=>{T(),A(),r.current.value||_(),N.emit()}),()=>{i.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),N.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{i.current.delete(e),s.current.delete(e)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:y,inputId:w,labelId:v,listInnerRef:j}),[]);function C(e,t){var n,s;let i=null!=(s=null==(n=o.current)?void 0:n.filter)?s:m7;return e?i(e,r.current.search,t):0}function A(){if(!r.current.search||!1===o.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),i=0;n.forEach(t=>{i=Math.max(e.get(t),i)}),t.push([r,i])});let n=j.current;R().sort((t,r)=>{var n,s;let i=t.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(s=e.get(i))?s:0)}).forEach(e=>{let t=e.closest(m3);t?t.appendChild(e.parentElement===t?e:e.closest(`${m3} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${m3} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=j.current)?void 0:t.querySelector(`${m5}[${m9}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=R().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(m9);N.setState("value",t||void 0)}function T(){var e,t,a,l;if(!r.current.search||!1===o.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=C(null!=(t=null==(e=i.current.get(s))?void 0:e.value)?t:"",null!=(l=null==(a=i.current.get(s))?void 0:a.keywords)?l:[]);r.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function E(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(m5))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=j.current)?void 0:e.querySelector(`${m4}[aria-selected="true"]`)}function R(){var e;return Array.from((null==(e=j.current)?void 0:e.querySelectorAll(m6))||[])}function M(e){let t=R()[e];t&&N.setState("value",t.getAttribute(m9))}function I(e){var t;let r=P(),n=R(),s=n.findIndex(e=>e===r),i=n[s+e];null!=(t=o.current)&&t.loop&&(i=s+e<0?n[n.length-1]:s+e===n.length?n[0]:n[s+e]),i&&N.setState("value",i.getAttribute(m9))}function L(e){let t=P(),r=null==t?void 0:t.closest(m5),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,m5):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,m5))?void 0:r.querySelector(m6);n?N.setState("value",n.getAttribute(m9)):I(e)}let D=()=>M(R().length-1),z=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):I(1)},O=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?L(-1):I(-1)};return b.createElement(m2.Primitive.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=x.onKeyDown)||t.call(x,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":g&&e.ctrlKey&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":g&&e.ctrlKey&&O(e);break;case"ArrowUp":O(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),D();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(m8);t.dispatchEvent(e)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:py},l),px(e,e=>b.createElement(pt.Provider,{value:N},b.createElement(pe.Provider,{value:S},e))))}),ps=b.forwardRef((e,t)=>{var r,n;let s=(0,a0.useId)(),i=b.useRef(null),a=b.useContext(pr),o=b.useContext(pe),l=pd(e),c=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;ph(()=>{if(!c)return o.item(s,null==a?void 0:a.id)},[c]);let u=pf(s,i,[e.value,e.children,i],e.keywords),d=b.useContext(pt),h=pp(e=>e.value&&e.value===u.current),m=pp(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(s)>0);function p(){var e,t;f(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function f(){d.setState("value",u.current,!0)}if(b.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(m8,p),()=>t.removeEventListener(m8,p)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:g,value:x,onSelect:y,forceMount:v,keywords:w,...j}=e;return b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(i,t),...j,id:s,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!h,"data-disabled":!!g,"data-selected":!!h,onPointerMove:g||o.getDisablePointerSelection()?void 0:f,onClick:g?void 0:p},e.children)}),pi=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,a=(0,a0.useId)(),o=b.useRef(null),l=b.useRef(null),c=(0,a0.useId)(),u=b.useContext(pe),d=pp(e=>!!s||!1===u.filter()||!e.search||e.filtered.groups.has(a));ph(()=>u.group(a),[]),pf(a,o,[e.value,e.heading,l]);let h=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(o,t),...i,"cmdk-group":"",role:"presentation",hidden:!d||void 0},r&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),px(e,e=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(pr.Provider,{value:h},e))))}),pa=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=b.useRef(null),i=pp(e=>!e.search);return r||i?b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),po=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,i=b.useContext(pt),a=pp(e=>e.search),o=pp(e=>e.selectedItemId),l=b.useContext(pe);return b.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),b.createElement(m2.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:s?e.value:a,onChange:e=>{s||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),pl=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=b.useRef(null),a=b.useRef(null),o=pp(e=>e.selectedItemId),l=b.useContext(pe);return b.useEffect(()=>{if(a.current&&i.current){let e=a.current,t=i.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:l.listId},px(e,e=>b.createElement("div",{ref:(0,aX.composeRefs)(a,l.listInnerRef),"cmdk-list-sizer":""},e)))}),pc=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:a,...o}=e;return b.createElement(m1.Root,{open:r,onOpenChange:n},b.createElement(m1.Portal,{container:a},b.createElement(m1.Overlay,{"cmdk-overlay":"",className:s}),b.createElement(m1.Content,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(pn,{ref:t,...o}))))}),pu=Object.assign(pn,{List:pl,Item:ps,Input:po,Group:pi,Separator:pa,Dialog:pc,Empty:b.forwardRef((e,t)=>pp(e=>0===e.filtered.count)?b.createElement(m2.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:b.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return b.createElement(m2.Primitive.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},px(e,e=>b.createElement("div",{"aria-hidden":!0},e)))})});function pd(e){let t=b.useRef(e);return ph(()=>{t.current=e}),t}var ph="u"<typeof window?b.useEffect:b.useLayoutEffect;function pm(e){let t=b.useRef();return void 0===t.current&&(t.current=e()),t}function pp(e){let t=b.useContext(pt),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function pf(e,t,r,n=[]){let s=b.useRef(),i=b.useContext(pe);return ph(()=>{var a;let o=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),l=n.map(e=>e.trim());i.value(e,o,l),null==(a=t.current)||a.setAttribute(m9,o),s.current=o}),s}var pg=()=>{let[e,t]=b.useState(),r=pm(()=>new Map);return ph(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function px({asChild:e,children:t},r){let n;return e&&b.isValidElement(t)?b.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var py={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},pv=e.i(210162),pv=pv,pb=e.i(836191);function pw({className:e,...t}){return(0,v.jsx)(pu,{"data-slot":"command",className:(0,k.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function pj({className:e,...t}){return(0,v.jsx)(pu.List,{"data-slot":"command-list",className:(0,k.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function pk({...e}){return(0,v.jsx)(pu.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function pN({className:e,...t}){return(0,v.jsx)(pu.Group,{"data-slot":"command-group",className:(0,k.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function pS({className:e,...t}){return(0,v.jsx)(pu.Item,{"data-slot":"command-item",className:(0,k.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var pC=Symbol("radix.slottable");function pA(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pC}var p_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(pA);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),pT=e.i(736180),pE=e.i(542899),pP=e.i(272741),pR=e.i(721648),pM=e.i(498101),pI=e.i(874057),pL=e.i(383044);function pD(e){var t;let r,n=(t=e,(r=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${t}.SlotClone`,r),s=b.forwardRef((e,t)=>{let{children:r,...s}=e,i=b.Children.toArray(r),a=i.find(pO);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(n,{...s,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(n,{...s,ref:t,children:r})});return s.displayName=`${e}.Slot`,s}var pz=Symbol("radix.slottable");function pO(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pz}var pB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=pD(`Primitive.${t}`),n=b.forwardRef((e,n)=>{let{asChild:s,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(s?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),pF=Symbol("radix.slottable");function p$(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pF}var pV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(p$);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),pU=e.i(897462),pW="rovingFocusGroup.onEntryFocus",pG={bubbles:!1,cancelable:!0},pq="RovingFocusGroup",[pH,pK,pX]=(0,pT.createCollection)(pq),[pY,pJ]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(pq,[pX]),[pZ,pQ]=pY(pq),p0=b.forwardRef((e,t)=>(0,v.jsx)(pH.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(pH.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(p1,{...e,ref:t})})}));p0.displayName=pq;var p1=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=b.useRef(null),m=(0,aX.useComposedRefs)(t,h),p=(0,pE.useDirection)(i),[f,g]=(0,aH.useControllableState)({prop:a,defaultProp:o??null,onChange:l,caller:pq}),[x,y]=b.useState(!1),w=(0,pU.useCallbackRef)(c),j=pK(r),k=b.useRef(!1),[N,S]=b.useState(0);return b.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(pW,w),()=>e.removeEventListener(pW,w)},[w]),(0,v.jsx)(pZ,{scope:r,orientation:n,dir:p,loop:s,currentTabStopId:f,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>y(!0),[]),onFocusableItemAdd:b.useCallback(()=>S(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>S(e=>e-1),[]),children:(0,v.jsx)(pV.div,{tabIndex:x||0===N?-1:0,"data-orientation":n,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:(0,aq.composeEventHandlers)(e.onMouseDown,()=>{k.current=!0}),onFocus:(0,aq.composeEventHandlers)(e.onFocus,e=>{let t=!k.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(pW,pG);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=j().filter(e=>e.focusable);p4([e.find(e=>e.active),e.find(e=>e.id===f),...e].filter(Boolean).map(e=>e.ref.current),u)}}k.current=!1}),onBlur:(0,aq.composeEventHandlers)(e.onBlur,()=>y(!1))})})}),p2="RovingFocusGroupItem",p5=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,children:a,...o}=e,l=(0,a0.useId)(),c=i||l,u=pQ(p2,r),d=u.currentTabStopId===c,h=pK(r),{onFocusableItemAdd:m,onFocusableItemRemove:p,currentTabStopId:f}=u;return b.useEffect(()=>{if(n)return m(),()=>p()},[n,m,p]),(0,v.jsx)(pH.ItemSlot,{scope:r,id:c,focusable:n,active:s,children:(0,v.jsx)(pV.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:(0,aq.composeEventHandlers)(e.onMouseDown,e=>{n?u.onItemFocus(c):e.preventDefault()}),onFocus:(0,aq.composeEventHandlers)(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let s=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(s))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(s)))return p3[s]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let s=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)s.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&s.reverse();let i=s.indexOf(e.currentTarget);s=u.loop?(r=s,n=i+1,r.map((e,t)=>r[(n+t)%r.length])):s.slice(i+1)}setTimeout(()=>p4(s))}}),children:"function"==typeof a?a({isCurrentTabStop:d,hasTabStop:null!=f}):a})})});p5.displayName=p2;var p3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function p4(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var p6=e.i(567706),p8=e.i(883944),p9=["Enter"," "],p7=["ArrowUp","PageDown","End"],fe=["ArrowDown","PageUp","Home",...p7],ft={ltr:[...p9,"ArrowRight"],rtl:[...p9,"ArrowLeft"]},fr={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fn="Menu",[fs,fi,fa]=(0,pT.createCollection)(fn),[fo,fl]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(fn,[fa,pI.createPopperScope,pJ]),fc=(0,pI.createPopperScope)(),fu=pJ(),[fd,fh]=fo(fn),[fm,fp]=fo(fn),ff=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:i,modal:a=!0}=e,o=fc(t),[l,c]=b.useState(null),u=b.useRef(!1),d=(0,pU.useCallbackRef)(i),h=(0,pE.useDirection)(s);return b.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,v.jsx)(pI.Root,{...o,children:(0,v.jsx)(fd,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:c,children:(0,v.jsx)(fm,{scope:t,onClose:b.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:a,children:n})})})};ff.displayName=fn;var fg=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,s=fc(r);return(0,v.jsx)(pI.Anchor,{...s,...n,ref:t})});fg.displayName="MenuAnchor";var fx="MenuPortal",[fy,fv]=fo(fx,{forceMount:void 0}),fb=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:s}=e,i=fh(fx,t);return(0,v.jsx)(fy,{scope:t,forceMount:r,children:(0,v.jsx)(aQ.Presence,{present:r||i.open,children:(0,v.jsx)(pL.Portal,{asChild:!0,container:s,children:n})})})};fb.displayName=fx;var fw="MenuContent",[fj,fk]=fo(fw),fN=b.forwardRef((e,t)=>{let r=fv(fw,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,i=fh(fw,e.__scopeMenu),a=fp(fw,e.__scopeMenu);return(0,v.jsx)(fs.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(aQ.Presence,{present:n||i.open,children:(0,v.jsx)(fs.Slot,{scope:e.__scopeMenu,children:a.modal?(0,v.jsx)(fS,{...s,ref:t}):(0,v.jsx)(fC,{...s,ref:t})})})})}),fS=b.forwardRef((e,t)=>{let r=fh(fw,e.__scopeMenu),n=b.useRef(null),s=(0,aX.useComposedRefs)(t,n);return b.useEffect(()=>{let e=n.current;if(e)return(0,p6.hideOthers)(e)},[]),(0,v.jsx)(f_,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,aq.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),fC=b.forwardRef((e,t)=>{let r=fh(fw,e.__scopeMenu);return(0,v.jsx)(f_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),fA=pD("MenuContent.ScrollLock"),f_=b.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:m,disableOutsideScroll:p,...f}=e,g=fh(fw,r),x=fp(fw,r),y=fc(r),w=fu(r),j=fi(r),[k,N]=b.useState(null),S=b.useRef(null),C=(0,aX.useComposedRefs)(t,S,g.onContentChange),A=b.useRef(0),_=b.useRef(""),T=b.useRef(0),E=b.useRef(null),P=b.useRef("right"),R=b.useRef(0),M=p?p8.RemoveScroll:b.Fragment;b.useEffect(()=>()=>window.clearTimeout(A.current),[]),(0,pR.useFocusGuards)();let I=b.useCallback(e=>{var t,r;return P.current===E.current?.side&&(t=e,!!(r=E.current?.area)&&function(e,t){let{x:r,y:n}=e,s=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let a=t[e],o=t[i],l=a.x,c=a.y,u=o.x,d=o.y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(s=!s)}return s}({x:t.clientX,y:t.clientY},r))},[]);return(0,v.jsx)(fj,{scope:r,searchRef:_,onItemEnter:b.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:b.useCallback(e=>{I(e)||(S.current?.focus(),N(null))},[I]),onTriggerLeave:b.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:T,onPointerGraceIntentChange:b.useCallback(e=>{E.current=e},[]),children:(0,v.jsx)(M,{...p?{as:fA,allowPinchZoom:!0}:void 0,children:(0,v.jsx)(pM.FocusScope,{asChild:!0,trapped:s,onMountAutoFocus:(0,aq.composeEventHandlers)(i,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,v.jsx)(pP.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:m,children:(0,v.jsx)(p0,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:N,onEntryFocus:(0,aq.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,v.jsx)(pI.Content,{role:"menu","aria-orientation":"vertical","data-state":f0(g.open),"data-radix-menu-content":"",dir:x.dir,...y,...f,ref:C,style:{outline:"none",...f.style},onKeyDown:(0,aq.composeEventHandlers)(f.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;if(t){var s;let t,i,a,o,l,c;"Tab"===e.key&&e.preventDefault(),!r&&n&&(s=e.key,t=_.current+s,i=j().filter(e=>!e.disabled),a=document.activeElement,o=i.find(e=>e.ref.current===a)?.textValue,l=function(e,t,r){var n;let s=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=r?e.indexOf(r):-1,a=(n=Math.max(i,0),e.map((t,r)=>e[(n+r)%e.length]));1===s.length&&(a=a.filter(e=>e!==r));let o=a.find(e=>e.toLowerCase().startsWith(s.toLowerCase()));return o!==r?o:void 0}(i.map(e=>e.textValue),t,o),c=i.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(A.current),""!==t&&(A.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let i=S.current;if(e.target!==i||!fe.includes(e.key))return;e.preventDefault();let a=j().filter(e=>!e.disabled).map(e=>e.ref.current);p7.includes(e.key)&&a.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(a)}),onBlur:(0,aq.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),_.current="")}),onPointerMove:(0,aq.composeEventHandlers)(e.onPointerMove,f5(e=>{let t=e.target,r=R.current!==e.clientX;e.currentTarget.contains(t)&&r&&(P.current=e.clientX>R.current?"right":"left",R.current=e.clientX)}))})})})})})})});fN.displayName=fw;var fT=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(pB.div,{role:"group",...n,ref:t})});fT.displayName="MenuGroup";var fE=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(pB.div,{...n,ref:t})});fE.displayName="MenuLabel";var fP="MenuItem",fR="menu.itemSelect",fM=b.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...s}=e,i=b.useRef(null),a=fp(fP,e.__scopeMenu),o=fk(fP,e.__scopeMenu),l=(0,aX.useComposedRefs)(t,i),c=b.useRef(!1);return(0,v.jsx)(fI,{...s,ref:l,disabled:r,onClick:(0,aq.composeEventHandlers)(e.onClick,()=>{let e=i.current;if(!r&&e){let t=new CustomEvent(fR,{bubbles:!0,cancelable:!0});e.addEventListener(fR,e=>n?.(e),{once:!0}),e&&az.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?c.current=!1:a.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,aq.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==o.searchRef.current;r||t&&" "===e.key||p9.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});fM.displayName=fP;var fI=b.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=e,a=fk(fP,r),o=fu(r),l=b.useRef(null),c=(0,aX.useComposedRefs)(t,l),[u,d]=b.useState(!1),[h,m]=b.useState("");return b.useEffect(()=>{let e=l.current;e&&m((e.textContent??"").trim())},[i.children]),(0,v.jsx)(fs.ItemSlot,{scope:r,disabled:n,textValue:s??h,children:(0,v.jsx)(p5,{asChild:!0,...o,focusable:!n,children:(0,v.jsx)(pB.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:c,onPointerMove:(0,aq.composeEventHandlers)(e.onPointerMove,f5(e=>{n?a.onItemLeave(e):(a.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,f5(e=>a.onItemLeave(e))),onFocus:(0,aq.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,aq.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),fL=b.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...s}=e;return(0,v.jsx)(fU,{scope:e.__scopeMenu,checked:r,children:(0,v.jsx)(fM,{role:"menuitemcheckbox","aria-checked":f1(r)?"mixed":r,...s,ref:t,"data-state":f2(r),onSelect:(0,aq.composeEventHandlers)(s.onSelect,()=>n?.(!!f1(r)||!r),{checkForDefaultPrevented:!1})})})});fL.displayName="MenuCheckboxItem";var fD="MenuRadioGroup",[fz,fO]=fo(fD,{value:void 0,onValueChange:()=>{}}),fB=b.forwardRef((e,t)=>{let{value:r,onValueChange:n,...s}=e,i=(0,pU.useCallbackRef)(n);return(0,v.jsx)(fz,{scope:e.__scopeMenu,value:r,onValueChange:i,children:(0,v.jsx)(fT,{...s,ref:t})})});fB.displayName=fD;var fF="MenuRadioItem",f$=b.forwardRef((e,t)=>{let{value:r,...n}=e,s=fO(fF,e.__scopeMenu),i=r===s.value;return(0,v.jsx)(fU,{scope:e.__scopeMenu,checked:i,children:(0,v.jsx)(fM,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":f2(i),onSelect:(0,aq.composeEventHandlers)(n.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});f$.displayName=fF;var fV="MenuItemIndicator",[fU,fW]=fo(fV,{checked:!1}),fG=b.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...s}=e,i=fW(fV,r);return(0,v.jsx)(aQ.Presence,{present:n||f1(i.checked)||!0===i.checked,children:(0,v.jsx)(pB.span,{...s,ref:t,"data-state":f2(i.checked)})})});fG.displayName=fV;var fq=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(pB.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});fq.displayName="MenuSeparator";var fH=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,s=fc(r);return(0,v.jsx)(pI.Arrow,{...s,...n,ref:t})});fH.displayName="MenuArrow";var[fK,fX]=fo("MenuSub"),fY="MenuSubTrigger",fJ=b.forwardRef((e,t)=>{let r=fh(fY,e.__scopeMenu),n=fp(fY,e.__scopeMenu),s=fX(fY,e.__scopeMenu),i=fk(fY,e.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{let e=o.current;return()=>{window.clearTimeout(e),l(null)}},[o,l]),(0,v.jsx)(fg,{asChild:!0,...c,children:(0,v.jsx)(fI,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":f0(r.open),...e,ref:(0,aX.composeRefs)(t,s.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,aq.composeEventHandlers)(e.onPointerMove,f5(t=>{i.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||a.current||(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,f5(e=>{u();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,s="right"===n,a=t[s?"left":"right"],l=t[s?"right":"left"];i.onPointerGraceIntentChange({area:[{x:e.clientX+(s?-5:5),y:e.clientY},{x:a,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:a,y:t.bottom}],side:n}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(e),e.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,t=>{let s=""!==i.searchRef.current;e.disabled||s&&" "===t.key||ft[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});fJ.displayName=fY;var fZ="MenuSubContent",fQ=b.forwardRef((e,t)=>{let r=fv(fw,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,i=fh(fw,e.__scopeMenu),a=fp(fw,e.__scopeMenu),o=fX(fZ,e.__scopeMenu),l=b.useRef(null),c=(0,aX.useComposedRefs)(t,l);return(0,v.jsx)(fs.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(aQ.Presence,{present:n||i.open,children:(0,v.jsx)(fs.Slot,{scope:e.__scopeMenu,children:(0,v.jsx)(f_,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:c,align:"start",side:"rtl"===a.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{a.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,aq.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:(0,aq.composeEventHandlers)(e.onEscapeKeyDown,e=>{a.onClose(),e.preventDefault()}),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=fr[a.dir].includes(e.key);t&&r&&(i.onOpenChange(!1),o.trigger?.focus(),e.preventDefault())})})})})})});function f0(e){return e?"open":"closed"}function f1(e){return"indeterminate"===e}function f2(e){return f1(e)?"indeterminate":e?"checked":"unchecked"}function f5(e){return t=>"mouse"===t.pointerType?e(t):void 0}fQ.displayName=fZ;var f3="DropdownMenu",[f4,f6]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(f3,[fl]),f8=fl(),[f9,f7]=f4(f3),ge=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,l=f8(t),c=b.useRef(null),[u,d]=(0,aH.useControllableState)({prop:s,defaultProp:i??!1,onChange:a,caller:f3});return(0,v.jsx)(f9,{scope:t,triggerId:(0,a0.useId)(),triggerRef:c,contentId:(0,a0.useId)(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:o,children:(0,v.jsx)(ff,{...l,open:u,onOpenChange:d,dir:n,modal:o,children:r})})};ge.displayName=f3;var gt="DropdownMenuTrigger",gr=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,i=f7(gt,r),a=f8(r);return(0,v.jsx)(fg,{asChild:!0,...a,children:(0,v.jsx)(p_.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:(0,aX.composeRefs)(t,i.triggerRef),onPointerDown:(0,aq.composeEventHandlers)(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(i.onOpenToggle(),i.open||e.preventDefault())}),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&i.onOpenToggle(),"ArrowDown"===e.key&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});gr.displayName=gt;var gn=e=>{let{__scopeDropdownMenu:t,...r}=e,n=f8(t);return(0,v.jsx)(fb,{...n,...r})};gn.displayName="DropdownMenuPortal";var gs="DropdownMenuContent",gi=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f7(gs,r),i=f8(r),a=b.useRef(!1);return(0,v.jsx)(fN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:t,onCloseAutoFocus:(0,aq.composeEventHandlers)(e.onCloseAutoFocus,e=>{a.current||s.triggerRef.current?.focus(),a.current=!1,e.preventDefault()}),onInteractOutside:(0,aq.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!s.modal||n)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gi.displayName=gs,b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fT,{...s,...n,ref:t})}).displayName="DropdownMenuGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fE,{...s,...n,ref:t})}).displayName="DropdownMenuLabel";var ga=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fM,{...s,...n,ref:t})});ga.displayName="DropdownMenuItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fL,{...s,...n,ref:t})}).displayName="DropdownMenuCheckboxItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fB,{...s,...n,ref:t})}).displayName="DropdownMenuRadioGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(f$,{...s,...n,ref:t})}).displayName="DropdownMenuRadioItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fG,{...s,...n,ref:t})}).displayName="DropdownMenuItemIndicator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fq,{...s,...n,ref:t})}).displayName="DropdownMenuSeparator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fH,{...s,...n,ref:t})}).displayName="DropdownMenuArrow",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fJ,{...s,...n,ref:t})}).displayName="DropdownMenuSubTrigger",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fQ,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}).displayName="DropdownMenuSubContent";var aI=aI;function go({...e}){return(0,v.jsx)(ge,{"data-slot":"dropdown-menu",...e})}function gl({...e}){return(0,v.jsx)(gr,{"data-slot":"dropdown-menu-trigger",...e})}function gc({className:e,sideOffset:t=4,...r}){return(0,v.jsx)(gn,{children:(0,v.jsx)(gi,{"data-slot":"dropdown-menu-content",sideOffset:t,className:(0,k.cn)("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function gu({className:e,inset:t,variant:r="default",...n}){return(0,v.jsx)(ga,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:(0,k.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}var gd=Symbol("radix.slottable");function gh(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===gd}var gm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(gh);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),gp="HoverCard",[gf,gg]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(gp,[pI.createPopperScope]),gx=(0,pI.createPopperScope)(),[gy,gv]=gf(gp),gb="HoverCardTrigger";b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,s=gv(gb,r),i=gx(r);return(0,v.jsx)(pI.Anchor,{asChild:!0,...i,children:(0,v.jsx)(gm.a,{"data-state":s.open?"open":"closed",...n,ref:t,onPointerEnter:(0,aq.composeEventHandlers)(e.onPointerEnter,gS(s.onOpen)),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,gS(s.onClose)),onFocus:(0,aq.composeEventHandlers)(e.onFocus,s.onOpen),onBlur:(0,aq.composeEventHandlers)(e.onBlur,s.onClose),onTouchStart:(0,aq.composeEventHandlers)(e.onTouchStart,e=>e.preventDefault())})})}).displayName=gb;var[gw,gj]=gf("HoverCardPortal",{forceMount:void 0}),gk="HoverCardContent";b.forwardRef((e,t)=>{let r=gj(gk,e.__scopeHoverCard),{forceMount:n=r.forceMount,...s}=e,i=gv(gk,e.__scopeHoverCard);return(0,v.jsx)(aQ.Presence,{present:n||i.open,children:(0,v.jsx)(gN,{"data-state":i.open?"open":"closed",...s,onPointerEnter:(0,aq.composeEventHandlers)(e.onPointerEnter,gS(i.onOpen)),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,gS(i.onClose)),ref:t})})}).displayName=gk;var gN=b.forwardRef((e,t)=>{let{__scopeHoverCard:r,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,...o}=e,l=gv(gk,r),c=gx(r),u=b.useRef(null),d=(0,aX.useComposedRefs)(t,u),[h,m]=b.useState(!1);return b.useEffect(()=>{if(h){let e=document.body;return y=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=y,e.style.webkitUserSelect=y}}},[h]),b.useEffect(()=>{if(u.current){let e=()=>{m(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),b.useEffect(()=>{u.current&&(function(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)t.push(r.currentNode);return t})(u.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,v.jsx)(pP.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:(0,aq.composeEventHandlers)(i,e=>{e.preventDefault()}),onDismiss:l.onDismiss,children:(0,v.jsx)(pI.Content,{...c,...o,onPointerDown:(0,aq.composeEventHandlers)(o.onPointerDown,e=>{e.currentTarget.contains(e.target)&&m(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...o.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function gS(e){return t=>"touch"===t.pointerType?void 0:e()}b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,s=gx(r);return(0,v.jsx)(pI.Arrow,{...s,...n,ref:t})}).displayName="HoverCardArrow";var gC=e.i(77982);function gA({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,k.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}e.i(455706);let g_=(0,U.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function gT({className:e,align:t="inline-start",...r}){return(0,v.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,k.cn)(g_({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}let gE=(0,U.cva)("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function gP({className:e,type:t="button",variant:r="ghost",size:n="xs",...s}){return(0,v.jsx)(S.Button,{type:t,"data-size":n,variant:r,className:(0,k.cn)(gE({size:n}),e),...s})}let gR=(0,A.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),gM=(0,A.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var gI=e.i(675182),gI=gI,gL=e.i(257868),gL=gL;let gD=(0,A.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),gz=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t},gO=(0,b.createContext)(null),gB=(0,b.createContext)(null),gF=(0,b.createContext)(null),g$=()=>{let e=(0,b.useContext)(gB),t=(0,b.useContext)(gF)??e;if(!t)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return t},gV=(0,b.createContext)(null),gU=({className:e,accept:t,multiple:r,globalDrop:n,syncHiddenInput:s,maxFiles:i,maxFileSize:a,onError:o,onSubmit:l,children:c,...u})=>{let d=(0,b.useContext)(gO),h=!!d,m=(0,b.useRef)(null),p=(0,b.useRef)(null),[f,g]=(0,b.useState)([]),x=h?d.attachments.files:f,[y,w]=(0,b.useState)([]),j=(0,b.useRef)(x);j.current=x;let N=(0,b.useCallback)(()=>{m.current?.click()},[]),S=(0,b.useCallback)(e=>!t||""===t.trim()||t.split(",").map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith("/*")){let r=t.slice(0,-1);return e.type.startsWith(r)}return e.type===t}),[t]),C=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>S(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);r.length>0&&0===n.length?o?.({code:"max_file_size",message:"All files exceed the maximum size."}):g(e=>{let t="number"==typeof i?Math.max(0,i-e.length):void 0,r="number"==typeof t?n.slice(0,t):n;"number"==typeof t&&n.length>t&&o?.({code:"max_files",message:"Too many files. Some were not added."});let s=[];for(let e of r)s.push({id:gz(),type:"file",url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(s)})},[S,i,a,o]),A=(0,b.useCallback)(e=>g(t=>{let r=t.find(t=>t.id===e);return r?.url&&URL.revokeObjectURL(r.url),t.filter(t=>t.id!==e)}),[]),_=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>S(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);if(r.length>0&&0===n.length)return void o?.({code:"max_file_size",message:"All files exceed the maximum size."});let s=x.length,l="number"==typeof i?Math.max(0,i-s):void 0,c="number"==typeof l?n.slice(0,l):n;"number"==typeof l&&n.length>l&&o?.({code:"max_files",message:"Too many files. Some were not added."}),c.length>0&&d?.attachments.add(c)},[S,a,i,o,x.length,d]),T=(0,b.useCallback)(()=>h?d?.attachments.clear():g(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[h,d]),E=(0,b.useCallback)(()=>w([]),[]),P=h?_:C,R=h?d.attachments.remove:A,M=h?d.attachments.openFileDialog:N,I=(0,b.useCallback)(()=>{T(),E()},[T,E]);(0,b.useEffect)(()=>{h&&d.__registerFileInput(m,()=>m.current?.click())},[h,d]),(0,b.useEffect)(()=>{s&&m.current&&0===x.length&&(m.current.value="")},[x,s]),(0,b.useEffect)(()=>{let e=p.current;if(!e||n)return;let t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return e.addEventListener("dragover",t),e.addEventListener("drop",r),()=>{e.removeEventListener("dragover",t),e.removeEventListener("drop",r)}},[P,n]),(0,b.useEffect)(()=>{if(!n)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",t)}},[P,n]),(0,b.useEffect)(()=>()=>{if(!h)for(let e of j.current)e.url&&URL.revokeObjectURL(e.url)},[h]);let L=async e=>{try{let t=await fetch(e),r=await t.blob();return new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(r)})}catch{return null}},D=(0,b.useMemo)(()=>({files:x.map(e=>({...e,id:e.id})),add:P,remove:R,clear:T,openFileDialog:M,fileInputRef:m}),[x,P,R,T,M]),z=(0,b.useMemo)(()=>({sources:y,add:e=>{let t=Array.isArray(e)?e:[e];w(e=>e.concat(t.map(e=>({...e,id:gz()}))))},remove:e=>{w(t=>t.filter(t=>t.id!==e))},clear:E}),[y,E]),O=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:r,onChange:e=>{e.currentTarget.files&&P(e.currentTarget.files),e.currentTarget.value=""},ref:m,title:"Upload files",type:"file"}),(0,v.jsx)("form",{className:(0,k.cn)("w-full",e),onSubmit:e=>{e.preventDefault();let t=e.currentTarget,r=h?d.textInput.value:new FormData(t).get("message")||"";h||t.reset(),Promise.all(x.map(async({id:e,...t})=>{if(t.url?.startsWith("blob:")){let e=await L(t.url);return{...t,url:e??t.url}}return t})).then(t=>{try{let n=l({text:r,files:t},e);n instanceof Promise?n.then(()=>{I(),h&&d.textInput.clear()}).catch(()=>{}):(I(),h&&d.textInput.clear())}catch{}}).catch(()=>{})},ref:p,...u,children:(0,v.jsx)(gA,{className:"overflow-hidden",children:c})})]}),B=(0,v.jsx)(gV.Provider,{value:z,children:O});return(0,v.jsx)(gF.Provider,{value:D,children:B})},gW=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("contents",e),...t}),gG=({className:e,...t})=>(0,v.jsx)(gT,{align:"block-end",className:(0,k.cn)("order-first flex-wrap gap-1",e),...t}),gq=({className:e,...t})=>(0,v.jsx)(gT,{align:"block-end",className:(0,k.cn)("justify-between gap-1",e),...t}),gH=({className:e,variant:t="default",size:r="icon-sm",status:n,onStop:s,onClick:i,children:a,...o})=>{let l="submitted"===n||"streaming"===n,c=(0,v.jsx)(gR,{className:"size-4"});return"submitted"===n?c=(0,v.jsx)(gI.default,{className:"size-4 animate-spin"}):"streaming"===n?c=(0,v.jsx)(gD,{className:"size-4"}):"error"===n&&(c=(0,v.jsx)(aD.XIcon,{className:"size-4"})),(0,v.jsx)(gP,{"aria-label":l?"Stop":"Submit",className:(0,k.cn)(e),onClick:e=>{if(l&&s){e.preventDefault(),s();return}i?.(e)},size:r,type:l&&s?"button":"submit",variant:t,...o,children:a??c})};var gK=e.i(681711),gK=gK;let gX=(0,A.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),gY=(0,A.default)("music-2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]),gJ=(0,A.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),gZ=(0,A.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),gQ=e=>{if("source-document"===e.type)return"source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},g0=(0,b.createContext)(null),g1=(0,b.createContext)(null),g2=()=>{let e=(0,b.useContext)(g1);if(!e)throw Error("Attachment components must be used within <Attachment>");return e},g5=({variant:e="grid",className:t,children:r,...n})=>{let s=(0,b.useMemo)(()=>({variant:e}),[e]);return(0,v.jsx)(g0.Provider,{value:s,children:(0,v.jsx)("div",{className:(0,k.cn)("flex items-start","list"===e?"flex-col gap-2":"flex-wrap gap-2","grid"===e&&"ml-auto w-fit",t),...n,children:r})})},g3=({data:e,onRemove:t,className:r,children:n,...s})=>{let{variant:i}=(0,b.useContext)(g0)??{variant:"grid"},a=gQ(e),o=(0,b.useMemo)(()=>({data:e,mediaCategory:a,onRemove:t,variant:i}),[e,a,t,i]);return(0,v.jsx)(g1.Provider,{value:o,children:(0,v.jsx)("div",{className:(0,k.cn)("group relative","grid"===i&&"size-24 overflow-hidden rounded-lg","inline"===i&&["flex h-8 cursor-pointer select-none items-center gap-1.5","rounded-md border border-border px-1.5","font-medium text-sm transition-all","hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"],"list"===i&&["flex w-full items-center gap-3 rounded-lg border p-3","hover:bg-accent/50"],r),...s,children:n})})},g4=({fallbackIcon:e,className:t,...r})=>{let{data:n,mediaCategory:s,variant:i}=g2(),a="inline"===i?"size-3":"size-4";return(0,v.jsx)("div",{className:(0,k.cn)("flex shrink-0 items-center justify-center overflow-hidden","grid"===i&&"size-full bg-muted","inline"===i&&"size-5 rounded bg-background","list"===i&&"size-12 rounded bg-muted",t),...r,children:(()=>{if("image"===s&&"file"===n.type&&n.url){let e,t;return e=n.url,t=n.filename,"grid"===i?(0,v.jsx)("img",{alt:t||"Image",className:"size-full object-cover",height:96,src:e,width:96}):(0,v.jsx)("img",{alt:t||"Image",className:"size-full rounded object-cover",height:20,src:e,width:20})}if("video"===s&&"file"===n.type&&n.url)return(0,v.jsx)("video",{className:"size-full object-cover",muted:!0,src:n.url});let t={image:gM,video:gZ,audio:gY,source:gX,document:gK.default,unknown:gJ}[s];return e??(0,v.jsx)(t,{className:(0,k.cn)(a,"text-muted-foreground")})})()})},g6=({showMediaType:e=!1,className:t,...r})=>{let{data:n,variant:s}=g2(),i=(e=>{if("source-document"===e.type)return e.title||e.filename||"Source";let t=gQ(e);return e.filename||("image"===t?"Image":"Attachment")})(n);return"grid"===s?null:(0,v.jsxs)("div",{className:(0,k.cn)("min-w-0 flex-1",t),...r,children:[(0,v.jsx)("span",{className:"block truncate",children:i}),e&&n.mediaType&&(0,v.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:n.mediaType})]})},g8=({label:e="Remove",className:t,children:r,...n})=>{let{onRemove:s,variant:i}=g2();return s?(0,v.jsxs)(S.Button,{"aria-label":e,className:(0,k.cn)("grid"===i&&["absolute top-2 right-2 size-6 rounded-full p-0","bg-background/80 backdrop-blur-sm","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-background","[&>svg]:size-3"],"inline"===i&&["size-5 rounded p-0","opacity-0 transition-opacity group-hover:opacity-100","[&>svg]:size-2.5"],"list"===i&&["size-8 shrink-0 rounded p-0","[&>svg]:size-4"],t),onClick:e=>{e.stopPropagation(),s()},type:"button",variant:"ghost",...n,children:[r??(0,v.jsx)(aD.XIcon,{}),(0,v.jsx)("span",{className:"sr-only",children:e})]}):null};var g9=e.i(772857);let g7=({className:e,children:t,...r})=>(0,v.jsxs)(g9.ScrollArea,{className:"w-full overflow-x-auto whitespace-nowrap",...r,children:[(0,v.jsx)("div",{className:(0,k.cn)("flex w-max flex-nowrap items-center gap-2",e),children:t}),(0,v.jsx)(g9.ScrollBar,{className:"hidden",orientation:"horizontal"})]}),xe=({suggestion:e,onClick:t,className:r,variant:n="outline",size:s="sm",children:i,...a})=>(0,v.jsx)(S.Button,{className:(0,k.cn)("cursor-pointer rounded-full px-4 transition-all duration-200","hover:scale-[1.02] hover:shadow-md hover:border-primary/50",r),onClick:()=>{t?.(e)},size:s,type:"button",variant:n,...a,children:i||e});var xt=e.i(524741),xr=e.i(280105),xr=xr;let xn=(0,A.default)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var od=od,aI=aI;let xs=(0,A.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var gK=gK;let xi={pending:ol,in_progress:xn,completed:xr.default,cancelled:od.default},xa={pending:"text-muted-foreground",in_progress:"text-primary",completed:"text-green-500",cancelled:"text-muted-foreground/50"};function xo({todosData:e,plans:t,isLoading:r,className:n}){let[s,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null),l=e&&e.todos.length>0,c=t&&t.length>0;if(!l&&!c)return null;let u=e?.todos||[],d=e?.stats||{total:0,pending:0,inProgress:0,completed:0,cancelled:0},h=e?.nextTodo||null,m=[...u].sort((e,t)=>{let r={in_progress:0,pending:1,completed:2,cancelled:3};return(r[e.status]??4)-(r[t.status]??4)}),p=d.total>0?Math.round(d.completed/d.total*100):0;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border bg-card/50 backdrop-blur-sm overflow-hidden",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(xs,{className:"size-4 text-primary shrink-0"}),!s&&h?(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(xn,{className:"size-3.5 text-primary shrink-0"}),(0,v.jsx)("span",{className:"text-sm truncate",children:h.content})]}):(0,v.jsx)("span",{className:"font-medium text-sm",children:"Tasks"}),d.total>0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[d.completed,"/",d.total]}),c&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0 flex items-center gap-1",children:[(0,v.jsx)(gK.default,{className:"size-3"}),t.length," plan",1!==t.length?"s":""]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[d.total>0&&(0,v.jsx)("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,v.jsx)("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${p}%`}})}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[c&&(0,v.jsx)("div",{className:"border-b",children:t.map(e=>(0,v.jsxs)("button",{onClick:()=>o(e),className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-muted/30 transition-colors text-left",children:[(0,v.jsx)(gK.default,{className:"size-4 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"text-sm font-medium flex-1 min-w-0 truncate",children:e.name}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"View"})]},e.name))}),h&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-primary/5 border-b flex items-center gap-2",children:[(0,v.jsx)(xn,{className:"size-4 text-primary shrink-0"}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("span",{className:"text-xs text-primary font-medium uppercase tracking-wide",children:"Current"}),(0,v.jsx)("p",{className:"text-sm font-medium truncate",children:h.content})]})]}),m.length>0&&(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:m.map(e=>{let t=xi[e.status]||ol,r=xa[e.status]||"text-muted-foreground",n=e.id===h?.id;return(0,v.jsxs)(C.Tooltip,{children:[(0,v.jsx)(C.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("div",{className:(0,k.cn)("flex items-start gap-2 px-3 py-1.5 hover:bg-muted/30 transition-colors cursor-default",n&&"bg-primary/5"),children:[(0,v.jsx)(t,{className:(0,k.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,k.cn)("text-sm flex-1 min-w-0 truncate","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]})}),(0,v.jsxs)(C.TooltipContent,{side:"left",className:"max-w-xs",children:[(0,v.jsx)("p",{className:"text-sm",children:e.content}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground capitalize mt-1",children:e.status.replace("_"," ")})]})]},e.id)})}),d.total>0&&(0,v.jsxs)("div",{className:"px-3 py-1.5 border-t bg-muted/30 flex items-center gap-3 text-xs text-muted-foreground",children:[d.inProgress>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(xn,{className:"size-3 text-primary"}),d.inProgress," active"]}),d.pending>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(ol,{className:"size-3"}),d.pending," pending"]}),d.completed>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(xr.default,{className:"size-3 text-green-500"}),d.completed," done"]})]})]})]}),a&&(0,v.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:()=>o(null),children:(0,v.jsxs)("div",{className:"bg-background rounded-xl border shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col mx-4",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(gK.default,{className:"size-5 text-blue-500 shrink-0"}),(0,v.jsx)("h2",{className:"font-semibold text-lg truncate",children:a.name})]}),(0,v.jsx)("button",{onClick:()=>o(null),className:"p-1 rounded-md hover:bg-muted transition-colors shrink-0",children:(0,v.jsx)(aD.XIcon,{className:"size-5"})})]}),(0,v.jsx)("div",{className:"overflow-auto flex-1 px-5 py-4",children:(0,v.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-mono text-sm leading-relaxed",children:a.content})}),(0,v.jsxs)("div",{className:"px-5 py-3 border-t bg-muted/30 flex items-center justify-between text-xs text-muted-foreground shrink-0",children:[(0,v.jsxs)("span",{children:[a.sizeChars.toLocaleString()," characters"]}),(0,v.jsx)("button",{onClick:()=>o(null),className:"px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-xs font-medium hover:bg-primary/90 transition-colors",children:"Close"})]})]})})]})}var xl=e.i(739963),xc=e.i(300739),xu=e.i(335130),xd=e.i(367887),xh=e.i(482306);let xm=(0,A.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),xp=(0,A.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);var xf=e.i(865373),xg=e.i(719583),xx=e.i(816187);let xy=(0,A.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var xv=e.i(99027),xb=e.i(220563);let xw=(0,A.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),xj=(0,A.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var xk=e.i(707387),xN=e.i(372379),xS=e.i(101513),xS=xS;let xC=(0,A.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),xA=(0,A.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var x_=e.i(904781);let xT=(0,A.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var xE=e.i(79092);let xP=(0,A.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),xR=(0,A.default)("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]);var xM=e.i(529757),xI=e.i(865259),xL=e.i(634066),aI=aI,om=om;let xD=(0,A.default)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);var xz=e.i(398049),xz=xz,od=od;let xO=(0,b.memo)(({line:e,type:t})=>(0,v.jsxs)("div",{className:(0,k.cn)("font-mono text-xs leading-5 px-2","add"===t?"bg-green-500/10":"remove"===t?"bg-red-500/10":"","add"===t?"text-green-600 dark:text-green-400":"remove"===t?"text-red-600 dark:text-red-400":"text-muted-foreground"),children:[(0,v.jsx)("span",{className:"select-none w-4 inline-block",children:"add"===t?"+":"remove"===t?"-":" "}),(0,v.jsx)("span",{className:"whitespace-pre-wrap break-all",children:e||" "})]}));function xB({input:e,output:t,status:r,streamingArgsText:n,liveContent:s,liveOldString:i,liveNewString:a,className:o}){let[l,c]=(0,b.useState)(!0),u=e?.path||"",d=u.split("/").pop()||"file",h=e?.mode||t?.mode||"full",m={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[u.split(".").pop()?.toLowerCase()||""]||"plaintext",p=(0,b.useMemo)(()=>{if(!n)return null;try{return JSON.parse(n)}catch{let e=n.match(/"content"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(e)try{return{content:JSON.parse(`"${e[1]}"`)}}catch{return{content:e[1]}}let t=n.match(/"old_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/),r=n.match(/"new_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(t||r)return{old_string:t?t[1]:void 0,new_string:r?r[1]:void 0};return null}},[n]),f=s||e?.content||p?.content||"",g=i||e?.old_string||p?.old_string||"",x=a||e?.new_string||p?.new_string||"",y="streaming"===r||"pending"===r||"running"===r&&!!(s||i||a),w="completed"===r,j="error"===r||t?.success===!1,C=w&&t?.success?oa:j?od.default:y?xp:xw,A=w&&t?.success?"text-green-600 dark:text-green-500":j?"text-red-600 dark:text-red-500":y?"text-blue-600 dark:text-blue-500":"text-muted-foreground",_="str_replace"===h?xz.default:t?.action==="created"?xD:xp;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",o),children:[(0,v.jsxs)("button",{onClick:()=>c(!l),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(C,{className:(0,k.cn)("size-4 shrink-0",A)}),(0,v.jsx)(_,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs shrink-0",children:"write_file"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:d}),"str_replace"===h&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"text-xs shrink-0",children:"edit"}),t?.action==="created"&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"text-xs shrink-0",children:"new"}),y&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"streaming..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.success&&void 0!==t.lineDelta&&(0,v.jsxs)("span",{className:(0,k.cn)("text-xs font-mono",t.lineDelta>=0?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:[t.lineDelta>=0?"+":"",t.lineDelta]}),l?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),l&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:u}),f&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>navigator.clipboard.writeText(f),children:(0,v.jsx)(om.default,{className:"size-3"})})]}),"str_replace"===h?(0,v.jsxs)("div",{className:"max-h-[200px] overflow-auto",children:[g&&(0,v.jsxs)("div",{className:"border-b",children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-red-500/5 border-b text-xs text-red-600 dark:text-red-400 font-medium",children:"Removed"}),(0,v.jsx)("div",{className:"py-1",children:g.split("\n").map((e,t)=>(0,v.jsx)(xO,{line:e,type:"remove"},`old-${t}`))})]}),x&&(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-green-500/5 border-b text-xs text-green-600 dark:text-green-400 font-medium",children:"Added"}),(0,v.jsx)("div",{className:"py-1",children:x.split("\n").map((e,t)=>(0,v.jsx)(xO,{line:e,type:"add"},`new-${t}`))})]}),!g&&!x&&y&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Receiving changes..."})})]}):(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:f?(0,v.jsx)(o_,{code:f,language:m,showLineNumbers:!0}):y?(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Writing file..."})}):null}),(t?.success===!0||t?.success===!1||j)&&(0,v.jsx)("div",{className:(0,k.cn)("px-3 py-2 border-t text-xs flex items-center gap-2",t?.success===!0?"bg-green-500/5 text-green-600 dark:text-green-400":"bg-red-500/5 text-red-600 dark:text-red-400"),children:t?.success===!0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oa,{className:"size-3.5"}),(0,v.jsx)("span",{children:"str_replace"===h?`Replaced ${t.linesRemoved||0} → ${t.linesAdded||0} lines`:`${"created"===t.action?"Created":"Updated"} (${t.lineCount||0} lines)`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(od.default,{className:"size-3.5"}),(0,v.jsx)("span",{children:t?.error||"Failed to write file"})]})})]})]})}xO.displayName="DiffLine";var aI=aI,om=om,gK=gK,xF=e.i(416667),xF=xF;let x$=(0,A.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);function xV({input:e,output:t,status:r,className:n}){var s;let[i,a]=(0,b.useState)(!0),o=e?.path||t?.relativePath||t?.path||"",l=o.split("/").pop()||"file",c={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[o.split(".").pop()?.toLowerCase()||""]||"plaintext",u=t?.content||"",d=!!(t?.imageData&&t?.mediaType),h="pending"===r||"streaming"===r||"running"===r,m="completed"===r&&t?.success===!0,p="error"===r||t?.success===!1,f=(0,b.useMemo)(()=>e?.startLine&&e?.endLine?`lines ${e.startLine}-${e.endLine}`:e?.startLine?`from line ${e.startLine}`:e?.endLine?`to line ${e.endLine}`:null,[e?.startLine,e?.endLine]),g=m?oa:p?xF.default:xw;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>a(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(g,{className:(0,k.cn)("size-4 shrink-0",m?"text-green-600 dark:text-green-500":p?"text-red-600 dark:text-red-500":"text-muted-foreground")}),d?(0,v.jsx)(gM,{className:"size-3.5 text-muted-foreground shrink-0"}):(0,v.jsx)(gK.default,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:l}),f&&(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs shrink-0",children:f}),t?.wasTruncated&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs shrink-0 gap-1",children:[(0,v.jsx)(x$,{className:"size-3"}),"truncated"]}),h&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"reading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.lineCount!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.lineCount," lines"]}),i?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:o}),t?.sizeBytes!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:["(",(s=t.sizeBytes)<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`,")"]})]}),u&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(u)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),(0,v.jsx)("div",{className:(0,k.cn)(d?"max-h-[400px]":"max-h-[200px]","overflow-auto"),children:h?(0,v.jsx)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Reading file..."})}):p?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(xF.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t?.error||"Failed to read file"})]}):d&&t?.imageData?(0,v.jsx)("div",{className:"p-3 flex justify-center bg-muted/20",children:(0,v.jsx)("img",{src:`data:${t.mediaType};base64,${t.imageData}`,alt:l,className:"max-w-full max-h-[350px] object-contain rounded"})}):u?(0,v.jsx)(o_,{code:u,language:c,showLineNumbers:!0}):(0,v.jsx)("div",{className:"px-3 py-4 text-muted-foreground text-sm italic",children:"File is empty"})}),t?.wasTruncated&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-amber-500/5 text-xs text-amber-600 dark:text-amber-400 flex items-center gap-2",children:[(0,v.jsx)(x$,{className:"size-3.5"}),(0,v.jsx)("span",{children:"Content was truncated. Use startLine/endLine to read specific sections."})]})]})]})}var aI=aI,om=om;let xU=(0,A.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);var od=od;let xW=(0,A.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var oc=oc;let xG=(0,A.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);function xq({input:e,output:t,status:r,terminalId:n,liveOutput:s,className:i}){let[a,o]=(0,b.useState)(!0),l=(0,b.useRef)(null);(0,b.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[s,t?.output]);let c=e?.command||"",u=e?.background||!1,d=e?.kill===!0,h=e?.id&&(e?.input!==void 0||e?.key!==void 0),m=e?.id&&!e?.command&&!e?.kill&&!h,p="pending"===r||"streaming"===r||"running"===r,f=p&&n&&void 0!==s,g="completed"===r,x="error"===r||t?.success===!1,y=t?.exitCode,w=(()=>{if(f)return s||"";if(t){let e=t.output||t.stdout||"",r=t.stderr||"";return r?e+(e?"\n":"")+r:e}return""})(),j=c.length>50?c.slice(0,50)+"...":c,{Icon:C,color:A,label:_}=(()=>{if(d)return{Icon:xG,color:"text-amber-600 dark:text-amber-500",label:t?.status==="stopped"?"Stopped":"Stopping..."};if(h){let t=e?.key?`key: ${e.key}`:`input: "${e?.input?.slice(0,20)}..."`;return{Icon:xU,color:"text-purple-600 dark:text-purple-500",label:p?"Sending...":t}}return m?{Icon:xU,color:"text-blue-600 dark:text-blue-500",label:"Logs"}:f?{Icon:xW,color:"text-green-600 dark:text-green-500 animate-pulse",label:"Live"}:p?{Icon:oc.default,color:"text-muted-foreground animate-pulse",label:"Executing..."}:g&&0===y?{Icon:oa,color:"text-green-600 dark:text-green-500",label:"Completed"}:g&&0!==y?{Icon:od.default,color:"text-red-600 dark:text-red-500",label:`Exit ${y}`}:x?{Icon:od.default,color:"text-red-600 dark:text-red-500",label:"Error"}:{Icon:xU,color:"text-muted-foreground",label:""}})();return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",i),children:[(0,v.jsxs)("button",{onClick:()=>o(!a),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(C,{className:(0,k.cn)("size-4 shrink-0",A)}),(0,v.jsx)(xU,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("code",{className:"font-mono text-sm truncate",title:c,children:j||(d?`kill ${e?.id}`:m?`logs ${e?.id}`:"bash")}),u&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"text-xs shrink-0",children:"background"}),f&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs shrink-0 bg-green-500/10 text-green-600 dark:text-green-400 gap-1",children:[(0,v.jsx)(xW,{className:"size-2 animate-pulse"}),"live"]}),_&&!f&&(0,v.jsx)("span",{className:(0,k.cn)("text-xs shrink-0",A),children:_})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[void 0!==y&&g&&(0,v.jsxs)(N.Badge,{variant:0===y?"secondary":"destructive",className:(0,k.cn)("text-xs",0===y?"bg-green-500/10 text-green-600 dark:text-green-400":""),children:["exit ",y]}),a?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),a&&(0,v.jsxs)("div",{className:"border-t",children:[c&&(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-muted-foreground text-xs",children:"$"}),(0,v.jsx)("code",{className:"text-xs font-mono truncate",children:c})]}),(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(c)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),(0,v.jsxs)("div",{ref:l,className:"bg-zinc-950 dark:bg-zinc-950 relative max-h-[300px] overflow-auto",children:[(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-zinc-300 whitespace-pre-wrap break-all min-h-[40px]",children:[w||(0,v.jsx)("span",{className:"text-muted-foreground italic",children:p?"Waiting for output...":"(no output)"}),f&&(0,v.jsx)("span",{className:"inline-block w-2 h-4 bg-green-500 animate-pulse ml-0.5"})]}),w&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 size-6 text-zinc-500 hover:text-zinc-300 bg-zinc-900/80",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(w)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(od.default,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}),t?.message&&!t?.error&&(0,v.jsx)("div",{className:"px-3 py-2 border-t bg-muted/30 text-muted-foreground text-xs",children:t.message})]})]})}var aI=aI,pv=pv,od=od;let xH=(0,A.default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var gK=gK,xK=e.i(101291),xK=xK,xX=e.i(481298),xX=xX;let xY=(0,A.default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);var pv=pv,gK=gK,od=od,gI=gI,xK=xK,aI=aI;let xJ=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"";function xZ({open:e,onOpenChange:t,title:r="Explore Agent",steps:n,status:s,query:i}){let a=(0,b.useRef)(null),o=(0,b.useRef)(null),l="running"===s,c="completed"===s,u="error"===s;return(0,b.useEffect)(()=>{o.current&&l&&o.current.scrollIntoView({behavior:"smooth",block:"end"})},[n,l]),(0,v.jsx)(pb.Dialog,{open:e,onOpenChange:t,children:(0,v.jsxs)(pb.DialogContent,{className:"sm:max-w-xl max-h-[80vh] flex flex-col gap-0 p-0 overflow-hidden",children:[(0,v.jsxs)("div",{className:"px-4 py-3 border-b flex items-center gap-3",children:[(0,v.jsx)("div",{className:"shrink-0",children:l?(0,v.jsx)(gI.default,{className:"size-4 text-blue-500 animate-spin"}):c?(0,v.jsx)(oa,{className:"size-4 text-green-500"}):(0,v.jsx)(od.default,{className:"size-4 text-red-500"})}),(0,v.jsx)(pb.DialogHeader,{className:"flex-1 space-y-0",children:(0,v.jsx)(pb.DialogTitle,{className:"text-sm font-medium",children:l?"SparkeCoder is exploring...":c?"Exploration complete":"Exploration failed"})}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[n.length," steps"]})]}),i&&(0,v.jsx)("div",{className:"px-4 py-2 border-b bg-muted/30",children:(0,v.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,v.jsx)(pv.default,{className:"size-3 shrink-0"}),(0,v.jsx)("span",{className:"truncate",title:i,children:xJ(i,80)})]})}),(0,v.jsx)("div",{ref:a,className:"flex-1 overflow-auto bg-zinc-950 font-mono text-xs",children:0===n.length&&l?(0,v.jsxs)("div",{className:"flex items-center justify-center py-12 text-zinc-500",children:[(0,v.jsx)(gI.default,{className:"size-4 animate-spin mr-2"}),"Initializing..."]}):0===n.length?(0,v.jsx)("div",{className:"flex items-center justify-center py-12 text-zinc-500",children:c?(0,v.jsx)("span",{children:"Exploration completed. Expand the result below to see findings."}):u?(0,v.jsx)("span",{className:"text-red-400",children:"Exploration failed."}):(0,v.jsx)("span",{children:"No steps recorded."})}):(0,v.jsxs)("div",{className:"py-2",children:[n.map((e,t)=>(0,v.jsx)(xQ,{step:e},e.id||t)),(0,v.jsx)("div",{ref:o}),l&&(0,v.jsxs)("div",{className:"px-3 py-1 flex items-center gap-2 text-zinc-500",children:[(0,v.jsx)(gI.default,{className:"size-3 animate-spin"}),(0,v.jsx)("span",{className:"animate-pulse",children:"_"})]})]})}),(0,v.jsxs)("div",{className:"px-4 py-2 border-t bg-zinc-950 flex items-center gap-2",children:[(0,v.jsx)("div",{className:(0,k.cn)("size-2 rounded-full",l&&"bg-blue-500 animate-pulse",c&&"bg-green-500",u&&"bg-red-500")}),(0,v.jsx)("span",{className:"text-xs text-zinc-500",children:l?"Running":c?"Done":"Failed"})]})]})})}function xQ({step:e}){let t=(e=>{switch(e){case"grep":return pv.default;case"glob":case"list_dir":return xH;case"read_file":return gK.default;case"semantic_search":return xK.default;default:return xU}})(e.toolName);if("tool_call"===e.type){let r=function(e){try{if(null==e)return"";if("string"==typeof e)return e;return JSON.stringify(e)}catch{return String(e)}}(e.toolInput);return(0,v.jsxs)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:[(0,v.jsx)(aI.default,{className:"size-3 text-blue-400 mt-0.5 shrink-0"}),(0,v.jsx)(t,{className:"size-3 text-blue-400 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-blue-400",children:e.toolName}),r&&(0,v.jsx)("span",{className:"text-zinc-600 truncate",children:xJ(r,60)})]})}return"tool_result"===e.type?(0,v.jsxs)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:[(0,v.jsx)(oa,{className:"size-3 text-green-500 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-500 truncate",children:xJ(e.content,80)})]}):"thought"===e.type?(0,v.jsxs)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:[(0,v.jsx)(xK.default,{className:"size-3 text-amber-400 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-400 italic",children:xJ(e.content,80)})]}):(0,v.jsx)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:(0,v.jsx)("span",{className:"text-zinc-300",children:xJ(e.content,100)})})}let x0=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"";function x1({input:e,output:t,status:r,steps:n=[],className:s}){let[i,a]=(0,b.useState)(!1),[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),h=(0,b.useRef)(!1),m="pending"===r||"streaming"===r||"running"===r,p="completed"===r,f="error"===r||t?.success===!1;(0,b.useEffect)(()=>{m&&(h.current=!0),p&&!i&&(h.current||t?.formattedResult||t?.summary)&&(a(!0),h.current=!1)},[m,p,i,t]);let g=(0,b.useMemo)(()=>(e=>{let t=e.filter(e=>"tool_call"===e.type),r=new Set;for(let e of t)if("read_file"===e.toolName&&e.toolInput){let t=e.toolInput;t.path&&r.add(t.path)}return{toolCallCount:t.length,filesExplored:r.size}})(n),[n]);(0,b.useEffect)(()=>{d.current&&m&&i&&(d.current.scrollTop=d.current.scrollHeight)},[n,m,i]);let x=e?.query||"",y=(e=>{if(0===e.length)return null;let t=e[e.length-1];return"tool_call"===t.type&&t.toolName?{type:"tool",name:t.toolName}:"thought"===t.type||"text"===t.type?{type:"text",content:x0(t.content,40)}:null})(n),w=(0,b.useMemo)(()=>t?"string"==typeof t?t:t.result?t.result:t.formattedResult?t.formattedResult:t.summary?t.summary:t.text?String(t.text):t.content?String(t.content):"":"",[t]),j=(e=>{if(!e)return"";let t=e.split("\n")[0].trim(),r=t.match(/^[^.!?]+[.!?]/);return r?r[0]:x0(t,100)})(w),N=w.length>200;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",s),children:[(0,v.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[(0,v.jsx)("div",{className:"shrink-0",children:m?(0,v.jsx)(xY,{className:"size-3.5 text-muted-foreground animate-spin"}):p&&!f?(0,v.jsx)(oa,{className:"size-4 text-green-500"}):f?(0,v.jsx)(od.default,{className:"size-4 text-red-500"}):(0,v.jsx)(pv.default,{className:"size-4 text-muted-foreground"})}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsx)("div",{className:"text-xs",children:m?(0,v.jsx)("span",{className:"text-muted-foreground",children:"Exploring the codebase"}):p&&!f?(0,v.jsx)("span",{className:"text-muted-foreground",children:"Exploration complete"}):f?(0,v.jsx)("span",{className:"text-red-500 text-xs",children:"Exploration failed"}):(0,v.jsx)("span",{className:"text-muted-foreground",children:"Exploring..."})}),m&&y&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-0.5",children:"tool"===y.type?(0,v.jsx)("span",{className:"font-mono",children:y.name}):(0,v.jsx)("span",{className:"italic",children:y.content})}),p&&!f&&j&&(0,v.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:j}),p&&!f&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:(t?.matchCount??0)>0||(t?.filesSearched??0)>0?`${t?.matchCount??0} matches \xb7 ${t?.filesSearched??0} files`:g.toolCallCount>0?`${g.toolCallCount} actions \xb7 ${g.filesExplored} files explored`:null})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,v.jsxs)(S.Button,{variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs gap-1.5",onClick:()=>u(!0),children:[(0,v.jsx)(xX.default,{className:"size-3"}),"View Progress"]}),(0,v.jsx)("button",{onClick:()=>a(!i),className:"p-1 hover:bg-muted rounded transition-colors",children:i?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/30 border-b",children:(0,v.jsxs)("div",{className:"flex items-start gap-2",children:[(0,v.jsx)(pv.default,{className:"size-3 text-muted-foreground mt-0.5 shrink-0"}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:x,children:x0(x,100)})]})}),w&&(0,v.jsxs)("div",{className:"border-b",children:[(0,v.jsx)("div",{className:"px-3 py-2",children:o?(0,v.jsx)("div",{className:"text-sm text-foreground whitespace-pre-wrap break-words max-h-[300px] overflow-auto",children:w}):(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:j})}),N&&(0,v.jsx)("button",{onClick:()=>l(!o),className:"w-full px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 flex items-center justify-center gap-1 border-t",children:o?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oo.ChevronDownIcon,{className:"size-3"}),"Show less"]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(aI.default,{className:"size-3"}),"Show full result"]})})]}),f&&t&&(0,v.jsx)("div",{className:"px-3 py-2 text-xs text-red-400 border-b",children:t.error||"Exploration failed"}),n.length>0&&(0,v.jsxs)("div",{ref:d,className:"max-h-[100px] overflow-auto bg-zinc-950/50",children:[n.slice(-6).map((e,t)=>(0,v.jsx)(x2,{step:e},e.id||t)),n.length>6&&(0,v.jsxs)("div",{className:"px-3 py-1 text-xs text-zinc-500",children:["+",n.length-6," more steps"]})]})]}),(0,v.jsx)(xZ,{open:c,onOpenChange:u,title:"Explore Agent",description:"Exploring your codebase to find relevant information",query:x,steps:n,status:m?"running":f?"error":"completed"})]})}function x2({step:e}){let t=(e=>{switch(e){case"grep":return pv.default;case"glob":case"list_dir":return xH;case"read_file":return gK.default;case"semantic_search":return xK.default;default:return xU}})(e.toolName);return(0,v.jsxs)("div",{className:"px-3 py-1 text-xs font-mono border-b border-zinc-800/50 last:border-0 flex items-center gap-2",children:["tool_call"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t,{className:"size-2.5 text-blue-400 shrink-0"}),(0,v.jsx)("span",{className:"text-blue-400 truncate",children:e.toolName})]}),"tool_result"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oa,{className:"size-2.5 text-green-400 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-500 truncate",children:x0(e.content,50)})]}),"text"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(xK.default,{className:"size-2.5 text-purple-400 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-400 truncate",children:x0(e.content,50)})]}),"thought"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(xK.default,{className:"size-2.5 text-amber-400 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-500 italic truncate",children:x0(e.content,50)})]})]})}var aI=aI,gL=gL;let x5=(0,A.default)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var od=od,oc=oc,gK=gK,x3=e.i(261527),x3=x3,xX=xX,x4=e.i(231181),x4=x4;let x6={pending:ol,in_progress:xn,completed:oa,cancelled:od.default},x8={pending:"text-muted-foreground",in_progress:"text-blue-600 dark:text-blue-400",completed:"text-green-600 dark:text-green-400",cancelled:"text-muted-foreground/50"},x9={add:"Add Tasks",list:"List Tasks",mark:"Update Task",clear:"Clear Tasks",save_plan:"Save Plan",list_plans:"List Plans",get_plan:"View Plan",delete_plan:"Delete Plan"},x7=({action:e})=>{switch(e){case"add":return(0,v.jsx)(gL.default,{className:"size-3.5"});case"list":default:return(0,v.jsx)(xs,{className:"size-3.5"});case"mark":return(0,v.jsx)(oa,{className:"size-3.5"});case"clear":return(0,v.jsx)(x5,{className:"size-3.5"});case"save_plan":return(0,v.jsx)(gK.default,{className:"size-3.5"});case"list_plans":return(0,v.jsx)(x3.default,{className:"size-3.5"});case"get_plan":return(0,v.jsx)(xX.default,{className:"size-3.5"});case"delete_plan":return(0,v.jsx)(x4.default,{className:"size-3.5"})}};function ye({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),a=e?.action||"list",o="pending"===r||"streaming"===r||"running"===r,l="completed"===r,c="error"===r||t?.success===!1,u=l&&t?.success?oa:c?od.default:o?oc.default:xs,d=l&&t?.success?"text-green-600 dark:text-green-500":c?"text-red-600 dark:text-red-500":o?"text-muted-foreground animate-pulse":"text-muted-foreground",h=e=>{let t=x6[e.status]||ol,r=x8[e.status]||"text-muted-foreground";return(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1",children:[(0,v.jsx)(t,{className:(0,k.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,k.cn)("text-sm","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]},e.id)};return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(u,{className:(0,k.cn)("size-4 shrink-0",d)}),(0,v.jsx)(x7,{action:a}),(0,v.jsx)("span",{className:"font-medium text-sm",children:x9[a]||a}),o&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"running..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.stats&&(0,v.jsx)("div",{className:"flex items-center gap-1.5 text-xs",children:(0,v.jsxs)("span",{className:"text-muted-foreground",children:[t.stats.completed,"/",t.stats.total]})}),t?.itemsAdded!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs bg-green-500/10 text-green-600 dark:text-green-400",children:["+",t.itemsAdded]}),t?.itemsRemoved!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs",children:["cleared ",t.itemsRemoved]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[t?.stats&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30 border-b flex items-center gap-4 text-xs",children:[(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(ol,{className:"size-3 text-muted-foreground"}),(0,v.jsxs)("span",{children:[t.stats.pending," pending"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(xn,{className:"size-3 text-blue-500"}),(0,v.jsxs)("span",{children:[t.stats.inProgress," active"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(oa,{className:"size-3 text-green-500"}),(0,v.jsxs)("span",{children:[t.stats.completed," done"]})]})]}),t?.items&&t.items.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:t.items.map(h)}),t?.item&&!t.items&&(0,v.jsx)("div",{className:"px-3 py-2",children:h(t.item)}),"add"===a&&e?.items&&!t?.items&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:e.items.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1 text-muted-foreground",children:[(0,v.jsx)(ol,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-sm",children:e.content})]},t))}),t?.action==="save_plan"&&t.planName&&(0,v.jsxs)("div",{className:"px-3 py-2 space-y-1",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,v.jsx)(gK.default,{className:"size-4 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"font-medium",children:t.planName}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(t.sizeChars??0).toLocaleString()," chars)"]})]}),t.autoCreatedTodos&&t.autoCreatedTodos.length>0&&(0,v.jsx)("div",{className:"mt-2 pt-2 border-t",children:(0,v.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:["Auto-created ",t.autoCreatedTodos.length," todo(s) from plan"]})})]}),t?.action==="list_plans"&&t.plans&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:0===t.plans.length?(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"No plans yet"}):t.plans.map(e=>(0,v.jsxs)("div",{className:"flex items-center gap-2 py-1",children:[(0,v.jsx)(gK.default,{className:"size-4 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"text-sm font-medium",children:e.title||e.name}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.sizeChars.toLocaleString()," chars)"]})]},e.name))}),t?.action==="get_plan"&&t.content&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[300px] overflow-auto",children:(0,v.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap leading-relaxed text-muted-foreground",children:t.content.length>2e3?t.content.slice(0,2e3)+"\n... (truncated in UI)":t.content})}),t?.action==="delete_plan"&&t.planName&&(0,v.jsxs)("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:["Deleted plan: ",t.planName]}),"list"===a&&t?.items?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No tasks yet"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(od.default,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}var yt=e.i(978964),yt=yt,aI=aI,oc=oc,om=om,yr=e.i(114507),yr=yr,xK=xK,od=od;function yn({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),a=e?.action||"list",o=e?.skillName||t?.skillName,l="pending"===r||"streaming"===r||"running"===r,c="completed"===r,u="error"===r||t?.success===!1,d=c&&t?.success?oa:u?od.default:l?oc.default:yt.default,h=c&&t?.success?"text-green-600 dark:text-green-500":u?"text-red-600 dark:text-red-500":l?"text-muted-foreground animate-pulse":"text-muted-foreground",m="load"===a?o?`Load: ${o}`:"Load Skill":"List Skills";return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(d,{className:(0,k.cn)("size-4 shrink-0",h)}),"list"===a?(0,v.jsx)(yr.default,{className:"size-3.5 text-muted-foreground"}):(0,v.jsx)(xK.default,{className:"size-3.5 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:m}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.skillCount!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs",children:[t.skillCount," skills"]}),t?.contentLength!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs",children:[Math.round(t.contentLength/1e3),"k chars"]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[t?.skills&&t.skills.length>0&&(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:t.skills.map((e,r)=>(0,v.jsxs)("div",{className:(0,k.cn)("px-3 py-2 flex items-start gap-2",r<t.skills.length-1&&"border-b"),children:[(0,v.jsx)(yt.default,{className:"size-4 mt-0.5 shrink-0 text-muted-foreground"}),(0,v.jsxs)("div",{className:"min-w-0",children:[(0,v.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.description&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.description})]})]},e.name))}),"load"===a&&t?.success&&t.skillName&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(xK.default,{className:"size-4 text-green-600 dark:text-green-400"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t.skillName})]}),t.content&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t.content)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),t.description&&(0,v.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description})]}),t?.content&&(0,v.jsx)("div",{className:"max-h-[150px] overflow-auto border-t",children:(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-muted-foreground whitespace-pre-wrap",children:[t.content.slice(0,500),t.content.length>500&&"..."]})}),t?.availableSkills&&t.availableSkills.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/30 border-t",children:(0,v.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Available: ",t.availableSkills.join(", ")]})}),"list"===a&&t?.skills?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No skills available"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(od.default,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}var xF=xF,aI=aI;let ys=(0,A.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),yi=(0,A.default)("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);function ya({severity:e,className:t}){switch(e){case"error":return(0,v.jsx)(xF.default,{className:(0,k.cn)("text-red-500",t)});case"warning":return(0,v.jsx)(xm,{className:(0,k.cn)("text-yellow-500",t)});case"info":return(0,v.jsx)(ys,{className:(0,k.cn)("text-blue-500",t)});default:return(0,v.jsx)(ys,{className:(0,k.cn)("text-muted-foreground",t)})}}function yo({file:e,isExpanded:t,onToggle:r}){let n=e.errors>0,s=e.warnings>0;return(0,v.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,v.jsxs)("button",{onClick:r,className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors text-left",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(xw,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-mono text-sm truncate",children:e.relativePath}),n&&(0,v.jsxs)(N.Badge,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(xF.default,{className:"size-3"}),e.errors]}),s&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(xm,{className:"size-3"}),e.warnings]})]}),t?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground shrink-0"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground shrink-0"})]}),t&&e.diagnostics.length>0&&(0,v.jsx)("div",{className:"bg-muted/30 px-3 py-2 space-y-1",children:e.diagnostics.map((e,t)=>(0,v.jsxs)("div",{className:(0,k.cn)("flex items-start gap-2 px-2 py-1.5 rounded text-sm","error"===e.severity&&"bg-red-500/5","warning"===e.severity&&"bg-yellow-500/5"),children:[(0,v.jsx)(ya,{severity:e.severity,className:"size-4 mt-0.5 shrink-0"}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,v.jsxs)("span",{className:"font-mono text-xs text-muted-foreground shrink-0",children:[e.line,":",e.column]}),e.source&&(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs",children:e.source}),e.code&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground font-mono",children:["[",e.code,"]"]})]}),(0,v.jsx)("p",{className:"text-sm mt-0.5 break-words",children:e.message})]})]},t))})]})}function yl({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(new Set),l="pending"===r||"streaming"===r||"running"===r||"completed"===r&&!t,c="completed"===r&&t?.success===!0,u="error"===r||t?.success===!1,d=t?.totalErrors??0,h=t?.totalWarnings??0,m=d>0||h>0,p=t?.files?.length??0,f=(0,b.useMemo)(()=>e.paths&&0!==e.paths.length?1===e.paths.length?e.paths[0]:`${e.paths.length} paths`:"all files",[e.paths]),g=(0,b.useMemo)(()=>t?.files?.filter(e=>e.errors>0)||[],[t?.files]);(0,b.useMemo)(()=>{g.length>0&&0===a.size&&o(new Set(g.slice(0,5).map(e=>e.path)))},[g]);let x=m?xF.default:c?oa:u?xF.default:yi,y=m?"text-red-500":c?"text-green-500":u?"text-red-500":"text-muted-foreground";return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(x,{className:(0,k.cn)("size-4 shrink-0",y)}),(0,v.jsx)("span",{className:"font-medium text-sm",children:"Linter"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground truncate",children:[c?"checked":"checking"," ",f]}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"analyzing..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[c&&(0,v.jsxs)(v.Fragment,{children:[d>0&&(0,v.jsxs)(N.Badge,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(xF.default,{className:"size-3"}),d," error",1!==d?"s":""]}),h>0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(xm,{className:"size-3"}),h," warning",1!==h?"s":""]}),!m&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,v.jsx)(oa,{className:"size-3"}),"No issues"]})]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[l?(0,v.jsxs)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:[(0,v.jsx)(yi,{className:"size-6 mx-auto mb-2 animate-pulse"}),(0,v.jsx)("span",{children:"Analyzing files for lint errors..."})]}):u&&t?.error?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(xF.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}):t?.files&&t.files.length>0?(0,v.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:t.files.map(e=>(0,v.jsx)(yo,{file:e,isExpanded:a.has(e.path),onToggle:()=>{var t;return t=e.path,void o(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})}},e.path))}):(0,v.jsx)("div",{className:"px-3 py-4 text-sm",children:t?.message?(0,v.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,v.jsx)(oa,{className:"size-4"}),(0,v.jsx)("span",{children:t.message})]}):(0,v.jsx)("div",{className:"text-muted-foreground italic",children:"No files analyzed yet."})}),c&&p>0&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-muted/30 text-xs text-muted-foreground",children:["Checked ",p," file",1!==p?"s":"",m&&(0,v.jsxs)("span",{children:[" • ",(0,v.jsxs)("span",{className:d>0?"text-red-500":"",children:[d," error",1!==d?"s":""]})," • ",(0,v.jsxs)("span",{className:h>0?"text-yellow-500":"",children:[h," warning",1!==h?"s":""]})]})]})]})]})}var xF=xF,aI=aI;let yc=(0,A.default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),yu=(0,A.default)("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]),yd=(0,A.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);function yh({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),a="pending"===r||"streaming"===r||"running"===r||"completed"===r&&!t,o="completed"===r&&t?.success===!0,l="error"===r||t?.success===!1,c=t?.referenceCount??0,u=t?.referenceFiles??0,d=t?.pages?.length??0;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yd,{className:(0,k.cn)("size-4 shrink-0",o?"text-blue-500":l?"text-red-500":"text-muted-foreground")}),(0,v.jsx)("span",{className:"font-medium text-sm",children:"Code Graph"}),(0,v.jsx)("span",{className:"font-mono text-xs text-muted-foreground truncate",children:e.symbol}),a&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"analyzing..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[o&&(0,v.jsxs)(v.Fragment,{children:[c>0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1",children:[(0,v.jsx)(yc,{className:"size-3"}),c," ref",1!==c?"s":""]}),d>0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,v.jsx)(yu,{className:"size-3"}),d," page",1!==d?"s":""]}),0===c&&0===d&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,v.jsx)(oa,{className:"size-3"}),"Found"]})]}),l&&(0,v.jsxs)(N.Badge,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(xF.default,{className:"size-3"}),"Error"]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[a?(0,v.jsxs)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:[(0,v.jsx)(yd,{className:"size-6 mx-auto mb-2 animate-pulse"}),(0,v.jsx)("span",{children:"Inspecting symbol graph..."})]}):l&&t?.error?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(xF.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}):t?.formattedResult?(0,v.jsxs)("div",{className:"max-h-[500px] overflow-y-auto",children:[(t.filePath||t.kind||t.typeInfo)&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30 border-b space-y-1",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,v.jsx)(xw,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[t.filePath,t.line?`:${t.line}`:""]}),t.kind&&(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs",children:t.kind})]}),t.typeInfo&&(0,v.jsx)("pre",{className:"font-mono text-xs text-foreground/80 whitespace-pre-wrap break-words leading-relaxed",children:t.typeInfo})]}),t.pages&&t.pages.length>0&&(0,v.jsxs)("div",{className:"px-3 py-2 border-b",children:[(0,v.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Pages"}),t.pages.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-center gap-2 py-0.5 text-sm",children:[(0,v.jsx)(yu,{className:"size-3 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"font-mono text-xs",children:e.path}),e.route&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:["→ ",e.route]})]},t))]}),(0,v.jsx)("pre",{className:"px-3 py-3 text-xs font-mono whitespace-pre-wrap break-words leading-relaxed text-foreground/80",children:t.formattedResult})]}):(0,v.jsx)("div",{className:"px-3 py-4 text-muted-foreground text-sm italic",children:"No result yet."}),o&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-muted/30 text-xs text-muted-foreground",children:[c>0?`${c} reference${1!==c?"s":""} across ${u} file${1!==u?"s":""}`:"No external references",d>0&&` \xb7 ${d} page${1!==d?"s":""}`,e.depth&&e.depth>1&&` \xb7 depth ${e.depth}`]})]})]})}var ym=e.i(29343),yp=e.i(573656),yf=e.i(743053);function yg({toolName:e,input:t,output:r}){let n="complete_task"===e,s="task_failed"===e,i=r&&"validation_error"===r.status;return(0,v.jsxs)("div",{className:(0,k.cn)("mb-4 w-full max-w-full overflow-hidden rounded-lg border transition-colors",n&&!i&&"border-emerald-500/30",s&&"border-red-500/30",i&&"border-amber-500/30"),children:[(0,v.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2.5 px-4 py-3",n&&!i&&"bg-emerald-500/5",s&&"bg-red-500/5",i&&"bg-amber-500/5"),children:[i?(0,v.jsx)(xm,{className:"size-4 text-amber-500 shrink-0"}):n?(0,v.jsx)(ym.CheckCircle2,{className:"size-4 text-emerald-500 shrink-0"}):(0,v.jsx)(yp.XCircle,{className:"size-4 text-red-500 shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:i?"Schema mismatch":n?"Task completed":"Task failed"}),i&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"ml-auto text-[10px] bg-amber-500/10 text-amber-600 dark:text-amber-400",children:"Retry needed"})]}),(0,v.jsxs)("div",{className:"p-4",children:[n&&t.result&&(0,v.jsx)("div",{className:"rounded-md border bg-muted/30 overflow-hidden",children:(0,v.jsx)(yf.VisualJson,{value:t.result,children:(0,v.jsx)(yf.TreeView,{className:"max-h-64 text-sm"})})}),s&&t.reason&&(0,v.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:String(t.reason)}),i&&r.errors&&(0,v.jsx)("div",{className:"space-y-2",children:(0,v.jsx)("div",{className:"rounded-md bg-amber-500/5 border border-amber-500/20 p-3 space-y-1.5",children:r.errors.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-baseline gap-2 text-sm",children:[(0,v.jsx)("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded shrink-0 font-mono",children:e.path}),(0,v.jsx)("span",{className:"text-amber-700 dark:text-amber-300",children:e.message})]},t))})})]})]})}let yx=(0,A.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),yy=(0,A.default)("mic-off",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]]),yv=({className:e,onTranscriptionChange:t,onInterimTranscription:r,onAudioRecorded:n,lang:s="en-US",disabled:i,...a})=>{let[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),[d,h]=(0,b.useState)("none"),m=(0,b.useRef)(null),p=(0,b.useRef)(null),f=(0,b.useRef)([]),g=(0,b.useRef)("");(0,b.useEffect)(()=>{h("SpeechRecognition"in window||"webkitSpeechRecognition"in window?"speech-recognition":"MediaRecorder"in window&&"mediaDevices"in navigator?"media-recorder":"none")},[]),(0,b.useEffect)(()=>{if("speech-recognition"!==d)return;let e=new(window.SpeechRecognition||window.webkitSpeechRecognition);return e.continuous=!0,e.interimResults=!0,e.lang=s,e.onstart=()=>{l(!0),g.current=""},e.onend=()=>{l(!1),r?.("")},e.onresult=e=>{let n="",s="";for(let t=e.resultIndex;t<e.results.length;t++){let r=e.results[t],i=r[0]?.transcript??"";r.isFinal?s+=i:n+=i}s&&(g.current+=s,t?.(s),r?.("")),n&&r?.(n)},e.onerror=e=>{console.error("Speech recognition error:",e.error),l(!1),r?.("")},m.current=e,()=>{m.current&&m.current.abort()}},[d,s,t,r]);let x=(0,b.useCallback)(async()=>{if(!n)return void console.warn("SpeechInput: onAudioRecorded callback is required for MediaRecorder fallback");try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),r=new MediaRecorder(e);f.current=[],r.ondataavailable=e=>{e.data.size>0&&f.current.push(e.data)},r.onstop=async()=>{for(let t of e.getTracks())t.stop();let r=new Blob(f.current,{type:"audio/webm"});if(r.size>0){u(!0);try{let e=await n(r);e&&t?.(e)}catch(e){console.error("Transcription error:",e)}finally{u(!1)}}},r.onerror=t=>{for(let r of(console.error("MediaRecorder error:",t),l(!1),e.getTracks()))r.stop()},p.current=r,r.start(),l(!0)}catch(e){console.error("Failed to start MediaRecorder:",e),l(!1)}},[n,t]),y=(0,b.useCallback)(()=>{p.current?.state==="recording"&&p.current.stop(),l(!1)},[]),w=(0,b.useCallback)(()=>{if("speech-recognition"===d&&m.current)if(o)m.current.stop();else try{m.current.start()}catch(e){console.warn("Speech recognition start error:",e)}else"media-recorder"===d&&(o?y():x())},[d,o,x,y]),j=i||"none"===d||"speech-recognition"===d&&!m.current||"media-recorder"===d&&!n||c;return"none"===d?(0,v.jsx)(S.Button,{type:"button",className:(0,k.cn)("relative rounded-full opacity-50 cursor-not-allowed",e),disabled:!0,title:"Speech recognition not supported in this browser",...a,children:(0,v.jsx)(yy,{className:"size-4"})}):(0,v.jsxs)("div",{className:"relative inline-flex items-center justify-center",children:[o&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{className:"absolute inset-0 rounded-full bg-red-500/20 animate-ping"}),(0,v.jsx)("span",{className:"absolute inset-0 rounded-full bg-red-500/10 animate-ping",style:{animationDelay:"0.2s"}})]}),(0,v.jsxs)(S.Button,{type:"button",className:(0,k.cn)("relative z-10 rounded-full transition-all duration-200",o?"bg-red-500 text-white hover:bg-red-600 shadow-lg shadow-red-500/25":"hover:bg-muted",e),disabled:j,onClick:w,title:o?"Stop recording":"Start voice input",variant:o?"default":"ghost",...a,children:[c&&(0,v.jsx)(xY,{className:"size-4 animate-spin"}),!c&&o&&(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsx)(yx,{className:"size-4"}),(0,v.jsx)("span",{className:"absolute -top-0.5 -right-0.5 size-2 bg-white rounded-full animate-pulse"})]}),!(c||o)&&(0,v.jsx)(yx,{className:"size-4"})]})]})},yb=(0,A.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);function yw({sessionId:e,frame:t,metadata:r,active:n,onDismiss:s}){let[i,a]=(0,b.useState)(!1),[o,l]=(0,b.useState)({x:0,y:0}),[c,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),h=(0,b.useRef)({x:0,y:0,posX:0,posY:0}),m=(0,b.useCallback)(e=>{i||(u(!0),h.current={x:e.clientX,y:e.clientY,posX:o.x,posY:o.y},e.preventDefault())},[i,o]);(0,b.useEffect)(()=>{if(!c)return;let e=e=>{l({x:h.current.posX+(e.clientX-h.current.x),y:h.current.posY+(e.clientY-h.current.y)})},t=()=>u(!1);return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[c]);let p=(0,b.useCallback)(t=>{if(!r)return;let n=t.currentTarget.getBoundingClientRect(),s=Math.round((t.clientX-n.left)*(r.deviceWidth/n.width)),i=Math.round((t.clientY-n.top)*(r.deviceHeight/n.height));(0,xt.sendBrowserInput)(e,{type:"input_mouse",eventType:"mousePressed",x:s,y:i,button:"left",clickCount:1}).catch(()=>{}),setTimeout(()=>{(0,xt.sendBrowserInput)(e,{type:"input_mouse",eventType:"mouseReleased",x:s,y:i,button:"left"}).catch(()=>{})},50)},[e,r]);return n&&t?i?(0,v.jsx)(pb.Dialog,{open:!0,onOpenChange:e=>!e&&a(!1),children:(0,v.jsxs)(pb.DialogContent,{className:"max-w-4xl w-full p-0 overflow-hidden rounded-xl",children:[(0,v.jsx)(pb.DialogHeader,{className:"px-5 pt-5 pb-3",children:(0,v.jsxs)(pb.DialogTitle,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,v.jsx)(gX,{className:"size-4 text-muted-foreground"}),"Live Browser",r&&(0,v.jsxs)("span",{className:"text-xs font-normal text-muted-foreground",children:[r.deviceWidth," x ",r.deviceHeight]})]})}),(0,v.jsx)("div",{className:"px-5 pb-5",children:(0,v.jsx)("img",{src:`data:image/jpeg;base64,${t}`,alt:"Browser preview",className:"w-full h-auto rounded-lg cursor-crosshair",onClick:p,draggable:!1})})]})}):(0,v.jsxs)("div",{ref:d,className:(0,k.cn)("fixed z-50 overflow-hidden rounded-xl","border border-border/60 bg-background/95 backdrop-blur-xl","shadow-[0_8px_30px_rgba(0,0,0,0.12)] dark:shadow-[0_8px_30px_rgba(0,0,0,0.4)]","transition-all duration-200",c?"scale-[0.98] shadow-[0_4px_20px_rgba(0,0,0,0.08)]":"hover:shadow-[0_12px_40px_rgba(0,0,0,0.15)]"),style:{bottom:`calc(1.25rem - ${o.y}px)`,right:`calc(1.25rem - ${o.x}px)`,width:300},children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 cursor-grab active:cursor-grabbing select-none",onMouseDown:m,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("div",{className:"flex items-center justify-center size-5 rounded-md bg-blue-500/10 dark:bg-blue-400/10",children:(0,v.jsx)(gX,{className:"size-3 text-blue-600 dark:text-blue-400"})}),(0,v.jsx)("span",{className:"text-xs font-medium text-foreground/80",children:"Live Browser"}),(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-emerald-500 shadow-[0_0_4px_rgba(16,185,129,0.5)]"})]}),(0,v.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,v.jsx)(S.Button,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground rounded-md",onClick:()=>a(!0),children:(0,v.jsx)(yb,{className:"size-3"})}),(0,v.jsx)(S.Button,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground rounded-md",onClick:s,children:(0,v.jsx)(xk.X,{className:"size-3"})})]})]}),(0,v.jsxs)("div",{className:"relative px-2 pb-2",children:[(0,v.jsx)("div",{className:"overflow-hidden rounded-lg ring-1 ring-border/40",children:(0,v.jsx)("img",{src:`data:image/jpeg;base64,${t}`,alt:"Browser preview",className:"w-full h-auto cursor-crosshair",onClick:p,draggable:!1})}),r&&(0,v.jsxs)("div",{className:"absolute bottom-3 right-3 text-[10px] font-mono text-white/60 bg-black/40 backdrop-blur-sm px-1.5 py-0.5 rounded",children:[r.deviceWidth,"x",r.deviceHeight]})]})]}):null}function yj(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function yk({fileName:e,downloadUrl:t,sizeBytes:r,createdAt:n,className:s}){let[i,a]=(0,b.useState)(!1);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("button",{onClick:()=>a(!0),className:(0,k.cn)("inline-flex items-center gap-1.5 px-2 py-1 rounded-md","text-xs text-muted-foreground","bg-muted/40 hover:bg-muted/70","border border-transparent hover:border-border/50","transition-all duration-150",s),title:"View browser recording",children:[(0,v.jsx)("div",{className:"flex items-center justify-center size-4 rounded bg-violet-500/10 dark:bg-violet-400/10",children:(0,v.jsx)(xC,{className:"size-2.5 text-violet-600 dark:text-violet-400 ml-[1px]"})}),(0,v.jsx)("span",{className:"font-medium text-foreground/70",children:"Recording"}),null!=r&&(0,v.jsx)("span",{className:"text-muted-foreground/50",children:yj(r)})]}),(0,v.jsx)(pb.Dialog,{open:i,onOpenChange:a,children:(0,v.jsxs)(pb.DialogContent,{className:"max-w-4xl w-full p-0 overflow-hidden rounded-xl",children:[(0,v.jsx)(pb.DialogHeader,{className:"px-5 pt-5 pb-3",children:(0,v.jsxs)(pb.DialogTitle,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,v.jsx)("div",{className:"flex items-center justify-center size-6 rounded-lg bg-violet-500/10 dark:bg-violet-400/10",children:(0,v.jsx)(gX,{className:"size-3.5 text-violet-600 dark:text-violet-400"})}),"Browser Recording",n&&(0,v.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),null!=r&&(0,v.jsx)("span",{className:"text-xs font-normal text-muted-foreground/50",children:yj(r)})]})}),(0,v.jsx)("div",{className:"px-5 pb-5",children:(0,v.jsx)("div",{className:"overflow-hidden rounded-lg bg-black ring-1 ring-border/20",children:(0,v.jsx)("video",{src:t,controls:!0,autoPlay:!0,className:"w-full",playsInline:!0})})})]})})]})}function yN(e){var t;let r,n=(t=e,(r=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${t}.SlotClone`,r),s=b.forwardRef((e,t)=>{let{children:r,...s}=e,i=b.Children.toArray(r),a=i.find(yC);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(n,{...s,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(n,{...s,ref:t,children:r})});return s.displayName=`${e}.Slot`,s}var yS=Symbol("radix.slottable");function yC(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===yS}var yA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=yN(`Primitive.${t}`),n=b.forwardRef((e,n)=>{let{asChild:s,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(s?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),y_="Popover",[yT,yE]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(y_,[pI.createPopperScope]),yP=(0,pI.createPopperScope)(),[yR,yM]=yT(y_),yI=e=>{let{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:a=!1}=e,o=yP(t),l=b.useRef(null),[c,u]=b.useState(!1),[d,h]=(0,aH.useControllableState)({prop:n,defaultProp:s??!1,onChange:i,caller:y_});return(0,v.jsx)(pI.Root,{...o,children:(0,v.jsx)(yR,{scope:t,contentId:(0,a0.useId)(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(e=>!e),[h]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>u(!0),[]),onCustomAnchorRemove:b.useCallback(()=>u(!1),[]),modal:a,children:r})})};yI.displayName=y_;var yL="PopoverAnchor",yD=b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yM(yL,r),i=yP(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return b.useEffect(()=>(a(),()=>o()),[a,o]),(0,v.jsx)(pI.Anchor,{...i,...n,ref:t})});yD.displayName=yL;var yz="PopoverTrigger";b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yM(yz,r),i=yP(r),a=(0,aX.useComposedRefs)(t,s.triggerRef),o=(0,v.jsx)(yA.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":yX(s.open),...n,ref:a,onClick:(0,aq.composeEventHandlers)(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:(0,v.jsx)(pI.Anchor,{asChild:!0,...i,children:o})}).displayName=yz;var yO="PopoverPortal",[yB,yF]=yT(yO,{forceMount:void 0}),y$=e=>{let{__scopePopover:t,forceMount:r,children:n,container:s}=e,i=yM(yO,t);return(0,v.jsx)(yB,{scope:t,forceMount:r,children:(0,v.jsx)(aQ.Presence,{present:r||i.open,children:(0,v.jsx)(pL.Portal,{asChild:!0,container:s,children:n})})})};y$.displayName=yO;var yV="PopoverContent",yU=b.forwardRef((e,t)=>{let r=yF(yV,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,i=yM(yV,e.__scopePopover);return(0,v.jsx)(aQ.Presence,{present:n||i.open,children:i.modal?(0,v.jsx)(yG,{...s,ref:t}):(0,v.jsx)(yq,{...s,ref:t})})});yU.displayName=yV;var yW=yN("PopoverContent.RemoveScroll"),yG=b.forwardRef((e,t)=>{let r=yM(yV,e.__scopePopover),n=b.useRef(null),s=(0,aX.useComposedRefs)(t,n),i=b.useRef(!1);return b.useEffect(()=>{let e=n.current;if(e)return(0,p6.hideOthers)(e)},[]),(0,v.jsx)(p8.RemoveScroll,{as:yW,allowPinchZoom:!0,children:(0,v.jsx)(yH,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,aq.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:(0,aq.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;i.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,aq.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),yq=b.forwardRef((e,t)=>{let r=yM(yV,e.__scopePopover),n=b.useRef(!1),s=b.useRef(!1);return(0,v.jsx)(yH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||r.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let i=t.target;r.triggerRef.current?.contains(i)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),yH=b.forwardRef((e,t)=>{let{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,h=yM(yV,r),m=yP(r);return(0,pR.useFocusGuards)(),(0,v.jsx)(pM.FocusScope,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:(0,v.jsx)(pP.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:u,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:(0,v.jsx)(pI.Content,{"data-state":yX(h.open),role:"dialog",id:h.contentId,...m,...d,ref:t,style:{...d.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)"}})})})}),yK="PopoverClose";function yX(e){return e?"open":"closed"}function yY({...e}){return(0,v.jsx)(yI,{"data-slot":"popover",...e})}function yJ({className:e,align:t="center",sideOffset:r=4,...n}){return(0,v.jsx)(y$,{children:(0,v.jsx)(yU,{"data-slot":"popover-content",align:t,sideOffset:r,className:(0,k.cn)("bg-popover text-popover-foreground 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-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}function yZ({...e}){return(0,v.jsx)(yD,{"data-slot":"popover-anchor",...e})}b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yM(yK,r);return(0,v.jsx)(yA.button,{type:"button",...n,ref:t,onClick:(0,aq.composeEventHandlers)(e.onClick,()=>s.onOpenChange(!1))})}).displayName=yK,b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yP(r);return(0,v.jsx)(pI.Arrow,{...s,...n,ref:t})}).displayName="PopoverArrow";let yQ=(0,A.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]),y0=(0,A.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),y1=(0,b.createContext)(null),y2=/@(mcp\/[\w-]+|[\w./-]+\/?)/g,y5=[{id:"help",name:"help",description:"Ask about available features",icon:(0,v.jsx)(y0,{className:"size-4"}),prompt:"What commands and features are available? How can you help me?"},{id:"terminal",name:"terminal",description:"Open a new terminal",icon:(0,v.jsx)(xU,{className:"size-4"}),prompt:"Please open a new terminal session for me."},{id:"explain",name:"explain",description:"Explain a file or code",icon:(0,v.jsx)(xw,{className:"size-4"}),prompt:"Please explain this code: "},{id:"fix",name:"fix",description:"Fix a bug or issue",icon:(0,v.jsx)(yQ,{className:"size-4"}),prompt:"Please help me fix this issue: "},{id:"refactor",name:"refactor",description:"Refactor code",icon:(0,v.jsx)(yQ,{className:"size-4"}),prompt:"Please refactor this code to be cleaner and more maintainable: "},{id:"test",name:"test",description:"Write tests",icon:(0,v.jsx)(yQ,{className:"size-4"}),prompt:"Please write tests for: "}];function y3({children:e}){let t=(0,b.useCallback)(e=>{let t,r=[],n=RegExp(y2.source,"g");for(;null!==(t=n.exec(e));){let e=t[1],n=e.endsWith("/");r.push({id:`mention-${t.index}`,type:n?"folder":"file",path:n?e.slice(0,-1):e,name:e.split("/").pop()?.replace(/\/$/,"")||e})}return r},[]),r=(0,b.useCallback)(()=>{},[]),n=(0,b.useMemo)(()=>({extractMentions:t,clear:r}),[t,r]);return(0,v.jsx)(y1.Provider,{value:n,children:e})}function y4({sessionId:t,value:r,onChange:n,onSlashCommand:s,slashCommands:i=y5,showHighlights:a=!0,className:o,onKeyDown:l,disabled:c,...u}){let d=(0,b.useRef)(null),h=(0,b.useRef)(null),[m,p]=(0,b.useState)(null),[f,g]=(0,b.useState)(0),[x,y]=(0,b.useState)({top:0,left:0}),[w,j]=(0,b.useState)(!1),N=g$(),{files:S,isLoading:C}=function({sessionId:e,query:t,enabled:r=!0,limit:n=20,debounceMs:s=150}){let[i,a]=(0,b.useState)([]),[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(null),[d,h]=(0,b.useState)(null),m=(0,b.useRef)(null),p=(0,b.useRef)(null),f=(0,b.useCallback)(async t=>{p.current&&p.current.abort(),p.current=new AbortController;try{l(!0),u(null);let r=await (0,xt.getWorkspaceFiles)(e,t,n);a(r.files),h(r.workingDirectory),r.error&&u(r.error)}catch(e){e instanceof Error&&"AbortError"!==e.name&&(u(e.message),a([]))}finally{l(!1)}},[e,n]);return(0,b.useEffect)(()=>r&&e?(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{f(t)},s),()=>{m.current&&clearTimeout(m.current)}):void a([]),[t,r,e,s,f]),(0,b.useEffect)(()=>()=>{p.current&&p.current.abort(),m.current&&clearTimeout(m.current)},[]),{files:i,isLoading:o,error:c,workingDirectory:d}}({sessionId:t,query:m?.type==="file"?m.query:"",enabled:m?.type==="file",limit:15}),[A,_]=(0,b.useState)([]);(0,b.useEffect)(()=>{if(m?.type!=="mcp"&&m?.type!=="file")return void _([]);let t=!1;return(async()=>{try{let{getApiUrl:r}=await e.A(596066),n=await fetch(`${r()}/api/mcp`);if(!n.ok)return;let s=await n.json();if(t)return;let i=(m.query||"").toLowerCase(),a=(s.servers||[]).filter(e=>e.enabled).filter(e=>!i||e.name.toLowerCase().includes(i));_(a)}catch{t||_([])}})(),()=>{t=!0}},[m]);let T=(0,b.useMemo)(()=>{if(m?.type!=="command")return[];let e=m.query.toLowerCase();return i.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))},[m,i]),E=m?.type==="file"?[...A,...S]:m?.type==="mcp"?A:T,P=null!==m&&(E.length>0||C),R=(0,b.useCallback)(()=>{let e=d.current;if(!e||!m)return;let t=document.createElement("div"),n=window.getComputedStyle(e);["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingLeft","paddingTop","border","borderWidth","boxSizing","whiteSpace","wordWrap","wordBreak"].forEach(e=>{t.style[e]=n[e]}),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto",t.style.width=`${e.clientWidth}px`,t.style.overflow="hidden",t.textContent=r.substring(0,m.startIndex);let s=document.createElement("span");s.textContent="|",t.appendChild(s),document.body.appendChild(t);let i=e.getBoundingClientRect(),a=s.getBoundingClientRect(),o=t.getBoundingClientRect(),l=a.left-o.left,c=a.top-o.top+parseInt(n.lineHeight),u=e.scrollTop;document.body.removeChild(t),y({left:Math.min(l,i.width-250),top:c-u+4})},[m,r]);(0,b.useEffect)(()=>{R()},[R]);let M=(0,b.useCallback)((e,t)=>{if(0===t)return void p(null);let r=e.slice(0,t),n=r.match(/@mcp(?:[\/:]([^\s@]*))?$/i);if(n){p({type:"mcp",query:n[1]??"",startIndex:t-n[0].length,endIndex:t}),g(0);return}let s=r.match(/@([^\s@]*)$/);if(s){p({type:"file",query:s[1],startIndex:t-s[0].length,endIndex:t}),g(0);return}let i=r.match(/(?:^|\s)\/([^\s]*)$/);if(i){p({type:"command",query:i[1],startIndex:t-i[1].length-1,endIndex:t}),g(0);return}p(null)},[]),I=(0,b.useCallback)(e=>{let t=e.target.value,r=e.target.selectionStart??0;n(t),M(t,r)},[n,M]),L=(0,b.useCallback)(e=>{if(m&&d.current){if("name"in e&&"transport"in e){let t=r.slice(0,m.startIndex),s=r.slice(m.endIndex),i=`@mcp/${e.name} `;n(t+i+s),setTimeout(()=>{if(d.current){let e=m.startIndex+i.length;d.current.selectionStart=e,d.current.selectionEnd=e,d.current.focus()}},0),p(null);return}if("file"===m.type&&"path"in e){let t=r.slice(0,m.startIndex),s=r.slice(m.endIndex),i=`@${e.path}${"folder"===e.type?"/":""} `;n(t+i+s),setTimeout(()=>{if(d.current){let e=m.startIndex+i.length;d.current.selectionStart=e,d.current.selectionEnd=e,d.current.focus()}},0)}else if("command"===m.type&&"description"in e){if(e.action)e.action(),s?.(e),n((r.slice(0,m.startIndex)+r.slice(m.endIndex)).trim());else if(e.prompt){let t=r.slice(0,m.startIndex),s=r.slice(m.endIndex);n(t+e.prompt+s),setTimeout(()=>{if(d.current){let t=m.startIndex+e.prompt.length;d.current.selectionStart=t,d.current.selectionEnd=t,d.current.focus()}},0)}else s?.(e),n((r.slice(0,m.startIndex)+r.slice(m.endIndex)).trim());setTimeout(()=>{d.current?.focus()},0)}p(null)}},[m,r,n,s]),D=(0,b.useCallback)(e=>{if(l?.(e),!e.defaultPrevented){if(P)switch(e.key){case"ArrowDown":e.preventDefault(),g(e=>(e+1)%E.length);return;case"ArrowUp":e.preventDefault(),g(e=>(e-1+E.length)%E.length);return;case"Tab":case"Enter":E.length>0&&(e.preventDefault(),L(E[f]));return;case"Escape":e.preventDefault(),p(null);return}if("Enter"===e.key){if(w||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget,r=t.form||t.closest("form");if(r){let e=r.querySelector('button[type="submit"]');if(e?.disabled)return;e?e.click():r.requestSubmit()}}if("Backspace"===e.key&&""===r&&N.files.length>0){e.preventDefault();let t=N.files.at(-1);t&&N.remove(t.id)}}},[P,E,f,L,l,w,r,N]),z=(0,b.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of t)if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),N.add(r))},[N]),O=(0,b.useCallback)(()=>{let e=d.current;e&&M(r,e.selectionStart??0)},[r,M]),B=(0,b.useCallback)(()=>{d.current&&h.current&&(h.current.scrollTop=d.current.scrollTop)},[]);return(0,v.jsxs)("div",{className:"relative w-full",children:[(0,v.jsxs)(yY,{open:P,onOpenChange:()=>p(null),children:[(0,v.jsx)(yZ,{style:{position:"absolute",left:x.left,top:x.top,width:0,height:0}}),(0,v.jsx)(yJ,{align:"start",side:"top",className:"w-64 p-0",onOpenAutoFocus:e=>e.preventDefault(),children:(0,v.jsx)(pw,{children:(0,v.jsxs)(pj,{children:[C&&m?.type==="file"&&(0,v.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:"Loading..."}),!C&&0===E.length&&(0,v.jsx)(pk,{children:m?.type==="file"?"No files found":m?.type==="mcp"?"No MCP servers configured. Add one in Settings → MCP.":"No commands found"}),(m?.type==="mcp"||m?.type==="file")&&A.length>0&&(0,v.jsx)(pN,{heading:"MCP servers",children:A.map((e,t)=>(0,v.jsxs)(pS,{onSelect:()=>L(e),className:(0,k.cn)("cursor-pointer",t===f&&"bg-accent"),children:[(0,v.jsx)(yQ,{className:"mr-2 size-4 text-emerald-500"}),(0,v.jsxs)("div",{className:"flex flex-col",children:[(0,v.jsx)("span",{className:"font-medium",children:e.name}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.transport," · tools: mcp_",e.name,"_*"]})]})]},e.id))}),m?.type==="file"&&S.length>0&&(0,v.jsx)(pN,{heading:"Files & Folders",children:S.map((e,t)=>{let r=A.length+t;return(0,v.jsxs)(pS,{onSelect:()=>L(e),className:(0,k.cn)("cursor-pointer",r===f&&"bg-accent"),children:["folder"===e.type?(0,v.jsx)(xH,{className:"mr-2 size-4 text-blue-500"}):(0,v.jsx)(xw,{className:"mr-2 size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"truncate",children:e.path})]},e.path)})}),m?.type==="command"&&T.length>0&&(0,v.jsx)(pN,{heading:"Commands",children:T.map((e,t)=>(0,v.jsxs)(pS,{onSelect:()=>L(e),className:(0,k.cn)("cursor-pointer",t===f&&"bg-accent"),children:[e.icon||(0,v.jsx)(yQ,{className:"mr-2 size-4"}),(0,v.jsxs)("div",{className:"flex flex-col ml-2",children:[(0,v.jsxs)("span",{className:"font-medium",children:["/",e.name]}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})]},e.id))})]})})})]}),a&&(0,v.jsx)("div",{ref:h,"aria-hidden":"true",className:"absolute inset-0 pointer-events-none overflow-hidden whitespace-pre-wrap break-words px-3 py-3 text-sm",style:{color:"transparent"},children:(()=>{let e,t=[],n=RegExp(y2.source,"g"),s=0;for(;null!==(e=n.exec(r));)e.index>s&&t.push((0,v.jsx)("span",{children:r.slice(s,e.index)},`text-${s}`)),t.push((0,v.jsx)("mark",{className:"bg-primary/20 text-transparent rounded-sm",children:e[0]},`mention-${e.index}`)),s=e.index+e[0].length;return s<r.length&&t.push((0,v.jsx)("span",{children:r.slice(s)},`text-${s}`)),t.push((0,v.jsx)("span",{children:"\n"},"trailing")),t})()}),(0,v.jsx)("textarea",{ref:d,name:"message","data-slot":"input-group-control",value:r,onChange:I,onKeyDown:D,onClick:O,onScroll:B,onPaste:z,onCompositionStart:()=>j(!0),onCompositionEnd:()=>j(!1),disabled:c,className:(0,k.cn)("flex-1 w-full resize-none rounded-none border-0 py-3 px-3 text-sm shadow-none","placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50","bg-transparent dark:bg-transparent",o),...u})]})}let y6=/\s*<devtools-context>[\s\S]*?<\/devtools-context>\s*/,y8={SLACK:"bg-purple-500/10 text-purple-600 dark:text-purple-300 border-purple-500/30",SYSTEM:"bg-blue-500/10 text-blue-600 dark:text-blue-300 border-blue-500/30",SCHEDULE:"bg-amber-500/10 text-amber-600 dark:text-amber-300 border-amber-500/30",WEBHOOK:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-300 border-emerald-500/30"};function y9({channel:e,detail:t}){if("WEB"===e)return null;let r=y8[e]||"bg-muted text-muted-foreground border-border";return(0,v.jsxs)("span",{className:`inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide px-1.5 py-0.5 rounded border mr-2 mb-1 ${r}`,children:[(0,v.jsx)("span",{children:e}),t&&(0,v.jsx)("span",{className:"font-normal normal-case opacity-80",children:t})]})}let y7=new Set(["SYSTEM","SCHEDULE","WEBHOOK"]);function ve({input:e,output:t,status:r}){if(!e||"post"!==e.action)return null;let n=String(e.channel||"unknown").toUpperCase(),s=y8[n]||"bg-muted text-muted-foreground border-border",i=String(e.to||""),a=e.threadTs?String(e.threadTs):null,o=String(e.text||""),l=t&&"object"==typeof t&&!1!==t.ok,c=t&&"object"==typeof t?t.error:void 0,u="streaming"===r||"running"===r||"pending"===r||"input-available"===r;return(0,v.jsxs)("div",{className:"flex flex-col items-start gap-1 my-2 max-w-[80%]",children:[(0,v.jsxs)("div",{className:`inline-flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide px-2 py-0.5 rounded-md border ${s}`,children:[(0,v.jsxs)("span",{children:["→ Sent via ",n]}),i&&(0,v.jsxs)("span",{className:"font-normal normal-case opacity-80",children:["to ",i]}),a&&(0,v.jsxs)("span",{className:"font-normal normal-case opacity-60",children:["thread ",a]})]}),(0,v.jsx)("div",{className:`rounded-2xl border bg-card/40 px-3 py-2 ${u?"opacity-60":""}`,children:o?(0,v.jsx)("p",{className:"text-sm whitespace-pre-wrap",children:o}):(0,v.jsx)("p",{className:"text-xs italic text-muted-foreground",children:"(empty message)"})}),(0,v.jsx)("div",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:u?(0,v.jsx)("span",{className:"opacity-70",children:"sending…"}):l?(0,v.jsx)("span",{className:"text-emerald-500",children:"✓ delivered"}):(0,v.jsxs)("span",{className:"text-rose-500",children:["✗ failed",c?`: ${c}`:""]})})]})}function vt({pill:e,body:t}){let[r,n]=b.useState(!1),s=y8[e.channel]||"bg-muted text-muted-foreground border-border",i=t.split("\n").find(e=>e.trim().length>0)||"",a=i.length>140?i.slice(0,140)+"…":i,o=t.includes("\n")||t.length>140;return(0,v.jsx)("div",{className:"flex justify-center my-1.5",children:(0,v.jsxs)("button",{type:"button",onClick:()=>o&&n(e=>!e),className:`group max-w-[80%] text-left rounded-md border px-2 py-1 transition-colors ${s} ${o?"cursor-pointer hover:opacity-90":"cursor-default"}`,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-wide",children:[(0,v.jsx)("span",{className:"font-medium",children:e.channel}),e.detail&&(0,v.jsx)("span",{className:"font-normal normal-case opacity-80 truncate",children:e.detail}),o&&(0,v.jsx)(xN.ChevronDown,{className:`h-3 w-3 ml-auto shrink-0 transition-transform ${r?"rotate-180":""}`})]}),r?(0,v.jsx)("pre",{className:"mt-1 text-[11px] whitespace-pre-wrap font-mono opacity-90 max-h-[400px] overflow-y-auto",children:t}):(0,v.jsx)("p",{className:"mt-0.5 text-[11px] opacity-80 truncate",children:a})]})})}function vr(){let{toggleSidebar:e,isMobile:t}=(0,xM.useSidebar)();return t?(0,v.jsxs)(S.Button,{size:"icon",variant:"ghost",onClick:e,className:"size-7 shrink-0",children:[(0,v.jsx)(xb.PanelLeft,{className:"size-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Toggle sidebar"})]}):null}function vn(){let e=g$();return 0===e.files.length?null:(0,v.jsx)(g5,{variant:"inline",children:e.files.map(t=>(0,v.jsxs)(g3,{data:t,onRemove:()=>e.remove(t.id),children:[(0,v.jsx)(g4,{}),(0,v.jsx)(g6,{}),(0,v.jsx)(g8,{})]},t.id))})}function vs({input:e,isRunning:t,onStop:r,hasExtraContent:n}){let s=g$(),i=e.trim()||s.files.length>0||!!n;return t&&i?(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(gH,{disabled:!1,status:"ready",className:"bg-primary hover:bg-primary/90 transition-colors"}),(0,v.jsx)(gH,{disabled:!1,status:"streaming",onStop:r,className:"bg-destructive/80 hover:bg-destructive transition-colors"})]}):(0,v.jsx)(gH,{disabled:!t&&!i,status:t?"streaming":"ready",onStop:r,className:"bg-primary hover:bg-primary/90 transition-colors"})}async function vi(e){let t=async(e,t)=>{try{return await t()}catch(e){return{__error:e?.message??String(e)}}},[r,n,s,i,a,o,l,c,u,d,h,m]=await Promise.all([t("session",()=>(0,xt.getSession)(e)),t("messages",()=>(0,xt.getSessionMessages)(e)),t("todos",()=>(0,xt.getSessionTodos)(e)),t("plans",()=>(0,xt.getSessionPlans)(e)),t("checkpoints",()=>(0,xt.getSessionCheckpoints)(e)),t("diff",()=>(0,xt.getSessionDiff)(e)),t("attachments",()=>(0,xt.getSessionAttachments)(e)),t("files",()=>(0,xt.getSessionFiles)(e)),t("pendingApprovals",()=>(0,xt.getPendingApprovals)(e)),t("pendingInput",()=>(0,xt.getPendingInput)(e)),t("browserStream",()=>(0,xt.getBrowserStreamStatus)(e)),t("browserRecordings",()=>(0,xt.getBrowserRecordings)(e))]);return JSON.stringify({__meta:{kind:"sparkecoder-session-debug-dump",version:1,capturedAt:new Date().toISOString(),sessionId:e,origin:window.location.origin,userAgent:"u">typeof navigator?navigator.userAgent:null},session:r,messages:n,todos:s,plans:i,checkpoints:a,diff:o,attachments:l,files:c,pendingApprovals:u,pendingInput:d,browserStream:h,browserRecordings:m},null,2)}function va({session:t,isEmbed:r=!1}){let n,s,i,a,{toggleSidebar:o}=(0,xM.useSidebar)(),[l,c]=(0,b.useState)([]),[u,d]=(0,b.useState)(""),[h,m]=(0,b.useState)(""),[p,f]=(0,b.useState)(null),[g,x]=(0,b.useState)(!1),[y,w]=(0,b.useState)([]),A=(0,b.useRef)([]);A.current=y;let[_,T]=(0,b.useState)(null),[E,P]=(0,b.useState)(""),[R,M]=(0,b.useState)(!0),[I,L]=(0,b.useState)(!1),[D,z]=(0,b.useState)([]),[O,U]=(0,b.useState)([]),[W,G]=(0,b.useState)(!1),[q,H]=(0,b.useState)(null),[K,X]=(0,b.useState)(""),[Y,J]=(0,b.useState)(""),[Z,Q]=(0,b.useState)(!1),[ee,et]=(0,b.useState)([]),[er,en]=(0,b.useState)([]),[es,ei]=(0,b.useState)(null),[ea,eo]=(0,b.useState)([]),[el,ec]=(0,b.useState)([]),[eu,ed]=(0,b.useState)(!1),eh=(0,b.useRef)(""),em=(0,b.useRef)(""),ep=(0,b.useRef)([]),[ef,eg]=(0,b.useState)(!1),ex=(0,b.useRef)(null),ey=(0,b.useRef)(null),ev=(0,b.useRef)(!1),eb=(0,b.useRef)(!1),ew=(0,b.useRef)(new Map),[ej,ek]=(0,b.useState)(t.model),[eN,eS]=(0,b.useState)(t.name||""),[eC,eA]=(0,b.useState)(!1),[e_,eT]=(0,b.useState)(null),[eE,eP]=(0,b.useState)(t.config||{}),[eR,eM]=(0,b.useState)(!1),eI=(0,b.useRef)(null),eL=(0,b.useRef)(t.id);eL.current=t.id;let{playDing:eD}=(0,xu.useNotificationSound)(),[ez,eO]=(0,b.useState)(null),[eB,eF]=(0,b.useState)(!1),[e$,eV]=(0,b.useState)(!1),[eU,eW]=(0,b.useState)(!1),[eG,eq]=(0,b.useState)(null),[eH,eK]=(0,b.useState)(null),[eX,eY]=(0,b.useState)(!1),eJ=(0,b.useRef)(null),eZ=(0,b.useRef)(0),[eQ,e0]=(0,b.useState)([]),[e1,e2]=(0,b.useState)(!1),[e5,e3]=(0,b.useState)([]),[e4,e6]=(0,b.useState)("idle");(0,b.useEffect)(()=>{(0,xl.getConfig)().then(eT)},[]),(0,b.useEffect)(()=>{let e=localStorage.getItem("sparkecoder-dismissed-version");(0,xt.checkVersion)().then(t=>{t.updateAvailable&&t.latestVersion!==e&&eO(t)}).catch(e=>{console.error("Failed to check version:",e)})},[]),(0,b.useEffect)(()=>{ek(t.model),eS(t.name||""),eP(t.config||{})},[t.id,t.model,t.name,t.config]),(0,b.useEffect)(()=>{eC&&eI.current&&(eI.current.focus(),eI.current.select())},[eC]);let e8=async e=>{ek(e);try{await (0,xt.updateSession)(t.id,{model:e}),(0,xc.mutateSessions)()}catch(e){console.error("Failed to update model:",e),ek(t.model)}},e9=async()=>{eA(!1);let e=eN.trim()||"Session";if(e!==t.name)try{await (0,xt.updateSession)(t.id,{name:e}),(0,xc.mutateSessions)()}catch(e){console.error("Failed to update name:",e),eS(t.name||"")}},e7=async()=>{if(ez?.updateCommand&&!g){eV(!0);try{let e=`Run this update command:
|
|
7
|
+
</iframe>`},"putIntoIFrame"),ac=(0,nW.__name)((e,t,r,n,s)=>{let i=e.append("div");i.attr("id",r),n&&i.attr("style",n);let a=i.append("svg").attr("id",t).attr("width","100%").attr("xmlns","http://www.w3.org/2000/svg");return s&&a.attr("xmlns:xlink",s),a.append("g"),e},"appendDivSvgG");function au(e,t){return e.append("iframe").attr("id",t).attr("style","width: 100%; height: 100%;").attr("sandbox","")}(0,nW.__name)(au,"sandboxedIframe");var ad=(0,nW.__name)((e,t,r,n)=>{e.getElementById(t)?.remove(),e.getElementById(r)?.remove(),e.getElementById(n)?.remove()},"removeExistingElements"),ah=(0,nW.__name)(async function(e,t,r){let n,s;iY();let i=ar(t);t=i.code;let a=(0,nU.getConfig)();nW.log.debug(a),t.length>(a?.maxTextSize??5e4)&&(t="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa");let o="#"+e,l="i"+e,c="#"+l,u="d"+e,d="#"+u,h=(0,nW.__name)(()=>{let e=p?c:d,t=(0,nq.select)(e).node();t&&"remove"in t&&t.remove()},"removeTempElements"),m=(0,nq.select)("body"),p="sandbox"===a.securityLevel,f="loose"===a.securityLevel,g=a.fontFamily;if(void 0!==r){if(r&&(r.innerHTML=""),p){let e=au((0,nq.select)(r),l);(m=(0,nq.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else m=(0,nq.select)(r);ac(m,e,u,`font-family: ${g}`,"http://www.w3.org/1999/xlink")}else{if(ad(document,e,u,l),p){let e=au((0,nq.select)("body"),l);(m=(0,nq.select)(e.nodes()[0].contentDocument.body)).node().style.margin=0}else m=(0,nq.select)("body");ac(m,e,u)}try{n=await i0.fromText(t,{title:i.title})}catch(e){if(a.suppressErrorRendering)throw h(),e;n=await i0.fromText("error"),s=e}let x=m.select(d).node(),y=n.type,v=x.firstChild,b=v.firstChild,w=aa(a,y,n.renderer.getClasses?.(t,n),o),j=document.createElement("style");j.innerHTML=w,v.insertBefore(j,b);try{await n.renderer.draw(t,e,nz.package_default.version,n)}catch(r){throw a.suppressErrorRendering?h():ia.draw(t,e,nz.package_default.version),r}af(y,m.select(`${d} svg`),n.db.getAccTitle?.(),n.db.getAccDescription?.()),m.select(`[id="${e}"]`).selectAll("foreignobject > *").attr("xmlns","http://www.w3.org/1999/xhtml");let k=m.select(d).node().innerHTML;if(nW.log.debug("config.arrowMarkerAbsolute",a.arrowMarkerAbsolute),k=ao(k,p,(0,nU.evaluate)(a.arrowMarkerAbsolute)),p?k=al(k,m.select(d+" svg").node()):f||(k=sl.default.sanitize(k,{ADD_TAGS:ae,ADD_ATTR:at,HTML_INTEGRATION_POINTS:{foreignobject:!0}})),i2(),s)throw s;return h(),{diagramType:y,svg:k,bindFunctions:n.db.bindFunctions}},"render");function am(e={}){let t=(0,nU.assignWithDepth_default)({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||(t.themeVariables={}),t.themeVariables.fontFamily=t.fontFamily),(0,nU.saveConfigFromInitialize)(t),t?.theme&&t.theme in nU.themes_default?t.themeVariables=nU.themes_default[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=nU.themes_default.default.getThemeVariables(t.themeVariables));let r="object"==typeof t?(0,nU.setSiteConfig)(t):(0,nU.getSiteConfig)();(0,nW.setLogLevel)(r.logLevel),iY()}(0,nW.__name)(am,"initialize");var ap=(0,nW.__name)((e,t={})=>{let{code:r}=i9(e);return i0.fromText(r,t)},"getDiagramFromText");function af(e,t,r,n){iZ(t,e),iQ(t,r,n,t.attr("id"))}(0,nW.__name)(af,"addA11yInfo");var ag=Object.freeze({render:ah,parse:an,getDiagramFromText:ap,initialize:am,getConfig:nU.getConfig,setConfig:nU.setConfig,getSiteConfig:nU.getSiteConfig,updateSiteConfig:nU.updateSiteConfig,reset:(0,nW.__name)(()=>{(0,nU.reset)()},"reset"),globalReset:(0,nW.__name)(()=>{(0,nU.reset)(nU.defaultConfig)},"globalReset"),defaultConfig:nU.defaultConfig});(0,nW.setLogLevel)((0,nU.getConfig)().logLevel),(0,nU.reset)((0,nU.getConfig)());var ax=(0,nW.__name)((e,t,r)=>{nW.log.warn(e),(0,nV.isDetailedError)(e)?(r&&r(e.str,e.hash),t.push({...e,message:e.str,error:e})):(r&&r(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},"handleError"),ay=(0,nW.__name)(async function(e={querySelector:".mermaid"}){try{await av(e)}catch(t){if((0,nV.isDetailedError)(t)&&nW.log.error(t.str),aP.parseError&&aP.parseError(t),!e.suppressErrors)throw nW.log.error("Use the suppressErrors option to suppress these errors"),t}},"run"),av=(0,nW.__name)(async function({postRenderCallback:e,querySelector:t,nodes:r}={querySelector:".mermaid"}){let n,s,i=ag.getConfig();if(nW.log.debug(`${!e?"No ":""}Callback function found`),r)n=r;else if(t)n=document.querySelectorAll(t);else throw Error("Nodes and querySelector are both undefined");nW.log.debug(`Found ${n.length} diagrams`),i?.startOnLoad!==void 0&&(nW.log.debug("Start On Load: "+i?.startOnLoad),ag.updateSiteConfig({startOnLoad:i?.startOnLoad}));let a=new nV.utils_default.InitIDGenerator(i.deterministicIds,i.deterministicIDSeed),o=[];for(let t of Array.from(n)){if(nW.log.info("Rendering diagram: "+t.id),t.getAttribute("data-processed"))continue;t.setAttribute("data-processed","true");let r=`mermaid-${a.next()}`;s=t.innerHTML,s=(0,nG.dedent)(nV.utils_default.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,"<br/>");let n=nV.utils_default.detectInit(s);n&&nW.log.debug("Detected early reinit: ",n);try{let{svg:n,bindFunctions:i}=await aT(r,s,t);t.innerHTML=n,e&&await e(r),i&&i(t)}catch(e){ax(e,o,aP.parseError)}}if(o.length>0)throw o[0]},"runThrowsErrors"),ab=(0,nW.__name)(function(e){ag.initialize(e)},"initialize"),aw=(0,nW.__name)(async function(e,t,r){nW.log.warn("mermaid.init is deprecated. Please use run instead."),e&&ab(e);let n={postRenderCallback:r,querySelector:".mermaid"};"string"==typeof t?n.querySelector=t:t&&(t instanceof HTMLElement?n.nodes=[t]:n.nodes=t),await ay(n)},"init"),aj=(0,nW.__name)(async(e,{lazyLoad:t=!0}={})=>{iY(),(0,nU.registerLazyLoadedDiagrams)(...e),!1===t&&await iJ()},"registerExternalDiagrams"),ak=(0,nW.__name)(function(){if(aP.startOnLoad){let{startOnLoad:e}=ag.getConfig();e&&aP.run().catch(e=>nW.log.error("Mermaid failed to initialize",e))}},"contentLoaded");"u">typeof document&&window.addEventListener("load",ak,!1);var aN=(0,nW.__name)(function(e){aP.parseError=e},"setParseErrorHandler"),aS=[],aC=!1,aA=(0,nW.__name)(async()=>{if(!aC){for(aC=!0;aS.length>0;){let e=aS.shift();if(e)try{await e()}catch(e){nW.log.error("Error executing queue",e)}}aC=!1}},"executeQueue"),a_=(0,nW.__name)(async(e,t)=>new Promise((r,n)=>{let s=(0,nW.__name)(()=>new Promise((s,i)=>{ag.parse(e,t).then(e=>{s(e),r(e)},e=>{nW.log.error("Error parsing",e),aP.parseError?.(e),i(e),n(e)})}),"performCall");aS.push(s),aA().catch(n)}),"parse"),aT=(0,nW.__name)((e,t,r)=>new Promise((n,s)=>{let i=(0,nW.__name)(()=>new Promise((i,a)=>{ag.render(e,t,r).then(e=>{i(e),n(e)},e=>{nW.log.error("Error parsing",e),aP.parseError?.(e),a(e),s(e)})}),"performCall");aS.push(i),aA().catch(s)}),"render"),aE=(0,nW.__name)(()=>Object.keys(nU.detectors).map(e=>({id:e})),"getRegisteredDiagramsMetadata"),aP={startOnLoad:!0,mermaidAPI:ag,parse:a_,render:aT,init:aw,run:ay,registerExternalDiagrams:aj,registerLayoutLoaders:nF.registerLayoutLoaders,initialize:ab,parseError:void 0,contentLoaded:ak,setParseErrorHandler:aN,detectType:nU.detectType,registerIconPacks:n$.registerIconPacks,getRegisteredDiagramsMetadata:aE},aR={startOnLoad:!1,theme:"default",securityLevel:"strict",fontFamily:"monospace",suppressErrorRendering:!0},aM=function(e={}){let t=!1,r={...aR,...e.config},n={initialize(n){r={...aR,...e.config,...n},aP.initialize(r),t=!0},render:async(e,n)=>(t||(aP.initialize(r),t=!0),await aP.render(e,n))};return{name:"mermaid",type:"diagram",language:"mermaid",getMermaid:e=>(e&&n.initialize(e),n)}}(),aI=(e.i(263845),e.i(501253)),aI=aI,aL=e.i(77589),aL=aL,aD=e.i(349416),az=e.i(773340),aO=e.i(991106),aB=aO;let aF=({className:e,from:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("group flex w-full max-w-[95%] flex-col gap-2 transition-all duration-200","user"===t?"is-user ml-auto justify-end":"is-assistant",e),...r}),a$=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-primary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-primary-foreground group-[.is-user]:shadow-sm","group-[.is-assistant]:text-foreground",t),...r,children:e}),aV=({className:e,children:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center gap-1",e),...r,children:t}),aU=({tooltip:e,children:t,label:r,variant:n="ghost",size:s="icon-sm",...i})=>{let a=(0,v.jsxs)(S.Button,{size:s,type:"button",variant:n,...i,children:[t,(0,v.jsx)("span",{className:"sr-only",children:r||e})]});return e?(0,v.jsx)(C.TooltipProvider,{children:(0,v.jsxs)(C.Tooltip,{children:[(0,v.jsx)(C.TooltipTrigger,{asChild:!0,children:a}),(0,v.jsx)(C.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):a},aW=({url:e,isOpen:t,onClose:r,onConfirm:n})=>{let[s,i]=(0,b.useState)(!1);if((0,b.useEffect)(()=>{i(!0)},[]),!s||!t)return null;let a=(()=>{try{return new URL(e).hostname}catch{return e}})();return(0,az.createPortal)((0,v.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",onClick:r,onKeyDown:e=>"Escape"===e.key&&r(),children:(0,v.jsxs)("div",{className:"relative mx-4 max-w-md rounded-lg bg-background p-6 shadow-lg",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("button",{className:"absolute right-3 top-3 rounded-sm p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:r,type:"button",children:[(0,v.jsx)(aD.XIcon,{className:"h-4 w-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Close"})]}),(0,v.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-lg font-semibold",children:[(0,v.jsx)(aL.default,{className:"h-5 w-5"}),(0,v.jsx)("span",{children:"External Link"})]}),(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"You are about to visit an external website:"}),(0,v.jsx)("p",{className:"break-all rounded bg-muted px-3 py-2 text-sm font-mono",children:a}),(0,v.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,v.jsx)(S.Button,{variant:"outline",onClick:r,children:"Cancel"}),(0,v.jsx)(S.Button,{onClick:n,children:"Continue"})]})]})]})}),document.body)},aG=(0,b.memo)(({className:e,linkSafety:t,...r})=>(0,v.jsx)(aB.j,{className:(0,k.cn)("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),plugins:{code:nr,mermaid:aM,math:nD,cjk:ef},linkSafety:{enabled:t?.enabled??!0,onLinkCheck:t?.onLinkCheck,renderModal:t?.renderModal??aW},...r}),(e,t)=>e.children===t.children);aG.displayName="MessageResponse";var aq=e.i(241416),aH=e.i(465488),aK=e.i(995945),aX=e.i(309945),aY=Symbol("radix.slottable");function aJ(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===aY}var aZ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(aJ);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),aQ=e.i(395509),a0=e.i(610559),a1="Collapsible",[a2,a5]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(a1),[a3,a4]=a2(a1),a6=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,open:n,defaultOpen:s,disabled:i,onOpenChange:a,...o}=e,[l,c]=(0,aH.useControllableState)({prop:n,defaultProp:s??!1,onChange:a,caller:a1});return(0,v.jsx)(a3,{scope:r,disabled:i,contentId:(0,a0.useId)(),open:l,onOpenToggle:b.useCallback(()=>c(e=>!e),[c]),children:(0,v.jsx)(aZ.div,{"data-state":or(l),"data-disabled":i?"":void 0,...o,ref:t})})});a6.displayName=a1;var a8="CollapsibleTrigger",a9=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,...n}=e,s=a4(a8,r);return(0,v.jsx)(aZ.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":or(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...n,ref:t,onClick:(0,aq.composeEventHandlers)(e.onClick,s.onOpenToggle)})});a9.displayName=a8;var a7="CollapsibleContent",oe=b.forwardRef((e,t)=>{let{forceMount:r,...n}=e,s=a4(a7,e.__scopeCollapsible);return(0,v.jsx)(aQ.Presence,{present:r||s.open,children:({present:e})=>(0,v.jsx)(ot,{...n,ref:t,present:e})})});oe.displayName=a7;var ot=b.forwardRef((e,t)=>{let{__scopeCollapsible:r,present:n,children:s,...i}=e,a=a4(a7,r),[o,l]=b.useState(n),c=b.useRef(null),u=(0,aX.useComposedRefs)(t,c),d=b.useRef(0),h=d.current,m=b.useRef(0),p=m.current,f=a.open||o,g=b.useRef(f),x=b.useRef(void 0);return b.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,aK.useLayoutEffect)(()=>{let e=c.current;if(e){x.current=x.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,m.current=t.width,g.current||(e.style.transitionDuration=x.current.transitionDuration,e.style.animationName=x.current.animationName),l(n)}},[a.open,n]),(0,v.jsx)(aZ.div,{"data-state":or(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!f,...i,ref:u,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:f&&s})});function or(e){return e?"open":"closed"}function on({...e}){return(0,v.jsx)(a6,{"data-slot":"collapsible",...e})}function os({...e}){return(0,v.jsx)(a9,{"data-slot":"collapsible-trigger",...e})}function oi({...e}){return(0,v.jsx)(oe,{"data-slot":"collapsible-content",...e})}let oa=(0,A.default)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);var oo=e.i(100536);let ol=(0,A.default)("circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var oc=e.i(191729),oc=oc;let ou=(0,A.default)("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);var od=e.i(715786),od=od,oh=e.i(553880);e.i(196582);var om=e.i(719125),om=om;let op=({token:e})=>{let t,r,n;return(0,v.jsx)("span",{className:"dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)]",style:{color:e.color,backgroundColor:e.bgColor,...e.htmlStyle,fontStyle:(t=e.fontStyle)&&1&t?"italic":void 0,fontWeight:(r=e.fontStyle)&&2&r?"bold":void 0,textDecoration:(n=e.fontStyle)&&4&n?"underline":void 0},children:e.content})},of=({keyedLine:e,showLineNumbers:t})=>(0,v.jsx)("span",{className:t?ow:"block",children:0===e.tokens.length?"\n":e.tokens.map(({token:e,key:t})=>(0,v.jsx)(op,{token:e},t))}),og=(0,b.createContext)({code:""}),ox=new Map,oy=new Map,ov=new Map;function ob(e,t,r){let n,s,i=(n=e.slice(0,100),s=e.length>100?e.slice(-100):"",`${t}:${e.length}:${n}:${s}`),a=oy.get(i);return a||(r&&(ov.has(i)||ov.set(i,new Set),ov.get(i)?.add(r)),(e=>{let t=ox.get(e);if(t)return t;let r=r8({themes:["github-light","github-dark"],langs:[e]});return ox.set(e,r),r})(t).then(r=>{let n=r.getLoadedLanguages().includes(t)?t:"text",s=r.codeToTokens(e,{lang:n,themes:{light:"github-light",dark:"github-dark"}}),a={tokens:s.tokens,fg:s.fg??"",bg:s.bg??""};oy.set(i,a);let o=ov.get(i);if(o){for(let e of o)e(a);ov.delete(i)}}).catch(e=>{console.error("Failed to highlight code:",e),ov.delete(i)}),null)}let ow=(0,k.cn)("block","before:content-[counter(line)]","before:inline-block","before:[counter-increment:line]","before:w-8","before:mr-4","before:text-right","before:text-muted-foreground/50","before:font-mono","before:select-none"),oj=(0,b.memo)(({tokenized:e,showLineNumbers:t,className:r})=>{let n=(0,b.useMemo)(()=>({backgroundColor:e.bg,color:e.fg}),[e.bg,e.fg]),s=(0,b.useMemo)(()=>e.tokens.map((e,t)=>({key:`line-${t}`,tokens:e.map((e,r)=>({token:e,key:`line-${t}-${r}`}))})),[e.tokens]);return(0,v.jsx)("pre",{className:(0,k.cn)("dark:!bg-[var(--shiki-dark-bg)] dark:!text-[var(--shiki-dark)] m-0 p-4 text-sm",r),style:n,children:(0,v.jsx)("code",{className:(0,k.cn)("font-mono text-sm",t&&"[counter-increment:line_0] [counter-reset:line]"),children:s.map(e=>(0,v.jsx)(of,{keyedLine:e,showLineNumbers:t},e.key))})})},(e,t)=>e.tokenized===t.tokenized&&e.showLineNumbers===t.showLineNumbers&&e.className===t.className),ok=({className:e,language:t,style:r,...n})=>(0,v.jsx)("div",{className:(0,k.cn)("group relative w-full overflow-hidden rounded-md border bg-background text-foreground",e),"data-language":t,style:{contentVisibility:"auto",containIntrinsicSize:"auto 200px",...r},...n}),oN=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center justify-between bg-muted/80 px-3 py-2 text-muted-foreground text-xs",t),...r,children:e}),oS=({children:e,className:t,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center gap-2",t),...r,children:e}),oC=({children:e,className:t,...r})=>(0,v.jsx)("span",{className:(0,k.cn)("font-mono",t),...r,children:e}),oA=({code:e,language:t,showLineNumbers:r=!1})=>{let n=(0,b.useMemo)(()=>({tokens:e.split("\n").map(e=>""===e?[]:[{content:e,color:"inherit"}]),fg:"inherit",bg:"transparent"}),[e]),[s,i]=(0,b.useState)(()=>ob(e,t)??n);return(0,b.useEffect)(()=>{i(ob(e,t)??n),ob(e,t,i)},[e,t,n]),(0,v.jsx)("div",{className:"relative overflow-auto",children:(0,v.jsx)(oj,{showLineNumbers:r,tokenized:s})})},o_=({code:e,language:t,showLineNumbers:r=!1,className:n,children:s,...i})=>(0,v.jsx)(og.Provider,{value:{code:e},children:(0,v.jsxs)(ok,{className:n,language:t,...i,children:[s,(0,v.jsx)(oA,{code:e,language:t,showLineNumbers:r})]})}),oT=({className:e,...t})=>(0,v.jsx)(on,{className:(0,k.cn)("group not-prose mb-4 w-full max-w-full overflow-hidden rounded-md border",e),...t}),oE=({className:e,title:t,type:r,state:n,toolName:s,...i})=>{let a,o="dynamic-tool"===r?s:r.split("-").slice(1).join("-");return(0,v.jsxs)(os,{className:(0,k.cn)("flex w-full items-center justify-between gap-4 p-3",e),...i,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(ou,{className:"size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t??o}),(a={"input-streaming":(0,v.jsx)(ol,{className:"size-4"}),"input-available":(0,v.jsx)(oc.default,{className:"size-4 animate-pulse"}),"approval-requested":(0,v.jsx)(oc.default,{className:"size-4 text-yellow-600"}),"approval-responded":(0,v.jsx)(oa,{className:"size-4 text-blue-600"}),"output-available":(0,v.jsx)(oa,{className:"size-4 text-green-600"}),"output-error":(0,v.jsx)(od.default,{className:"size-4 text-red-600"}),"output-denied":(0,v.jsx)(od.default,{className:"size-4 text-orange-600"})},(0,v.jsxs)(N.Badge,{className:"gap-1.5 rounded-full text-xs",variant:"secondary",children:[a[n],{"input-streaming":"Pending","input-available":"Running","approval-requested":"Awaiting Approval","approval-responded":"Responded","output-available":"Completed","output-error":"Error","output-denied":"Denied"}[n]]}))]}),(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180"})]})},oP=({className:e,...t})=>(0,v.jsx)(oi,{className:(0,k.cn)("data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...t}),oR=({className:e,input:t,...r})=>(0,v.jsxs)("div",{className:(0,k.cn)("space-y-2 overflow-hidden p-4 max-w-full",e),...r,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:"Parameters"}),(0,v.jsx)("div",{className:"rounded-md bg-muted/50 overflow-x-auto max-w-full",children:(0,v.jsx)(o_,{code:JSON.stringify(t,null,2),language:"json"})})]}),oM=({className:e,output:t,errorText:r,...n})=>{if(!(t||r))return null;let s=(0,v.jsx)("div",{children:t});return"object"!=typeof t||(0,b.isValidElement)(t)?"string"==typeof t&&(s=(0,v.jsx)(o_,{code:t,language:"json"})):s=(0,v.jsx)(o_,{code:JSON.stringify(t,null,2),language:"json"}),(0,v.jsxs)("div",{className:(0,k.cn)("space-y-2 p-4 max-w-full overflow-hidden",e),...n,children:[(0,v.jsx)("h4",{className:"font-medium text-muted-foreground text-xs uppercase tracking-wide",children:r?"Error":"Result"}),(0,v.jsxs)("div",{className:(0,k.cn)("overflow-x-auto rounded-md text-xs max-w-full [&_table]:w-full",r?"bg-destructive/10 text-destructive":"bg-muted/50 text-foreground"),children:[r&&(0,v.jsx)("div",{children:r}),s]})]})},oI=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex flex-col overflow-hidden rounded-lg border bg-background shadow-sm",e),...t}),oL=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center justify-between border-b bg-muted/50 px-4 py-3",e),...t}),oD=({className:e,...t})=>(0,v.jsx)("p",{className:(0,k.cn)("font-medium text-foreground text-sm",e),...t}),oz=({className:e,...t})=>(0,v.jsx)("p",{className:(0,k.cn)("text-muted-foreground text-sm",e),...t}),oO=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex items-center gap-1",e),...t}),oB=({tooltip:e,label:t,icon:r,children:n,className:s,size:i="sm",variant:a="ghost",...o})=>{let l=(0,v.jsxs)(S.Button,{className:(0,k.cn)("size-8 p-0 text-muted-foreground hover:text-foreground",s),size:i,type:"button",variant:a,...o,children:[r?(0,v.jsx)(r,{className:"size-4"}):n,(0,v.jsx)("span",{className:"sr-only",children:t||e})]});return e?(0,v.jsx)(C.TooltipProvider,{children:(0,v.jsxs)(C.Tooltip,{children:[(0,v.jsx)(C.TooltipTrigger,{asChild:!0,children:l}),(0,v.jsx)(C.TooltipContent,{children:(0,v.jsx)("p",{children:e})})]})}):l},oF=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("flex-1 overflow-auto p-4",e),...t}),o$=(0,U.cva)("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 oV({className:e,variant:t,...r}){return(0,v.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,k.cn)(o$({variant:t}),e),...r})}let oU=(0,b.createContext)(null),oW=()=>{let e=(0,b.useContext)(oU);if(!e)throw Error("Confirmation components must be used within Confirmation");return e},oG=({className:e,approval:t,state:r,...n})=>t&&"input-streaming"!==r&&"input-available"!==r?(0,v.jsx)(oU.Provider,{value:{approval:t,state:r},children:(0,v.jsx)(oV,{className:(0,k.cn)("flex flex-col gap-2",e),...n})}):null,oq=({children:e})=>{let{state:t}=oW();return"approval-requested"!==t?null:e},oH=({className:e,...t})=>{let{state:r}=oW();return"approval-requested"!==r?null:(0,v.jsx)("div",{className:(0,k.cn)("flex items-center justify-end gap-2 self-end",e),...t})},oK=e=>(0,v.jsx)(S.Button,{className:"h-8 px-3 text-sm",type:"button",...e}),oX=({size:e=16})=>(0,v.jsxs)("svg",{height:e,strokeLinejoin:"round",style:{color:"currentcolor"},viewBox:"0 0 16 16",width:e,children:[(0,v.jsx)("title",{children:"Loader"}),(0,v.jsxs)("g",{clipPath:"url(#clip0_2393_1490)",children:[(0,v.jsx)("path",{d:"M8 0V4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M8 16V12",opacity:"0.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 1.52783L5.64887 4.7639",opacity:"0.9",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 1.52783L10.3511 4.7639",opacity:"0.1",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M12.7023 14.472L10.3511 11.236",opacity:"0.4",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M3.29773 14.472L5.64887 11.236",opacity:"0.6",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 5.52783L11.8043 6.7639",opacity:"0.2",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 10.472L4.19583 9.23598",opacity:"0.7",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M15.6085 10.4722L11.8043 9.2361",opacity:"0.3",stroke:"currentColor",strokeWidth:"1.5"}),(0,v.jsx)("path",{d:"M0.391602 5.52783L4.19583 6.7639",opacity:"0.8",stroke:"currentColor",strokeWidth:"1.5"})]}),(0,v.jsx)("defs",{children:(0,v.jsx)("clipPath",{id:"clip0_2393_1490",children:(0,v.jsx)("rect",{fill:"white",height:"16",width:"16"})})})]}),oY=({className:e,size:t=16,...r})=>(0,v.jsx)("div",{className:(0,k.cn)("inline-flex animate-spin items-center justify-center",e),...r,children:(0,v.jsx)(oX,{size:t})}),oJ=(0,A.default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);var aB=aO;let oZ=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],oQ=new Set(oZ),o0=(e,t,r)=>r>t?t:r<e?e:r,o1={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},o2={...o1,transform:e=>o0(0,1,e)},o5={...o1,default:1},o3=e=>Math.round(1e5*e)/1e5,o4=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,o6=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,o8=(e,t)=>r=>!!("string"==typeof r&&o6.test(r)&&r.startsWith(e)||t&&null!=r&&Object.prototype.hasOwnProperty.call(r,t)),o9=(e,t,r)=>n=>{if("string"!=typeof n)return n;let[s,i,a,o]=n.match(o4);return{[e]:parseFloat(s),[t]:parseFloat(i),[r]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},o7={...o1,transform:e=>Math.round(o0(0,255,e))},le={test:o8("rgb","red"),parse:o9("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+o7.transform(e)+", "+o7.transform(t)+", "+o7.transform(r)+", "+o3(o2.transform(n))+")"},lt={test:o8("#"),parse:function(e){let t="",r="",n="",s="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),s=e.substring(4,5),t+=t,r+=r,n+=n,s+=s),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}},transform:le.transform},lr=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),ln=lr("deg"),ls=lr("%"),li=lr("px"),la=lr("vh"),lo=lr("vw"),ll={...ls,parse:e=>ls.parse(e)/100,transform:e=>ls.transform(100*e)},lc={test:o8("hsl","hue"),parse:o9("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+ls.transform(o3(t))+", "+ls.transform(o3(r))+", "+o3(o2.transform(n))+")"},lu={test:e=>le.test(e)||lt.test(e)||lc.test(e),parse:e=>le.test(e)?le.parse(e):lc.test(e)?lc.parse(e):lt.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?le.transform(e):lc.transform(e),getAnimatableNone:e=>{let t=lu.parse(e);return t.alpha=0,lu.transform(t)}},ld=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,lh="number",lm="color",lp=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function lf(e){let t=e.toString(),r=[],n={color:[],number:[],var:[]},s=[],i=0,a=t.replace(lp,e=>(lu.test(e)?(n.color.push(i),s.push(lm),r.push(lu.parse(e))):e.startsWith("var(")?(n.var.push(i),s.push("var"),r.push(e)):(n.number.push(i),s.push(lh),r.push(parseFloat(e))),++i,"${}")).split("${}");return{values:r,split:a,indexes:n,types:s}}function lg(e){return lf(e).values}function lx(e){let{split:t,types:r}=lf(e),n=t.length;return e=>{let s="";for(let i=0;i<n;i++)if(s+=t[i],void 0!==e[i]){let t=r[i];t===lh?s+=o3(e[i]):t===lm?s+=lu.transform(e[i]):s+=e[i]}return s}}let ly=e=>"number"==typeof e?0:lu.test(e)?lu.getAnimatableNone(e):e,lv={test:function(e){return isNaN(e)&&"string"==typeof e&&(e.match(o4)?.length||0)+(e.match(ld)?.length||0)>0},parse:lg,createTransformer:lx,getAnimatableNone:function(e){let t=lg(e);return lx(e)(t.map(ly))}},lb=new Set(["brightness","contrast","saturate","opacity"]);function lw(e){let[t,r]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[n]=r.match(o4)||[];if(!n)return e;let s=r.replace(n,""),i=+!!lb.has(t);return n!==r&&(i*=100),t+"("+i+s+")"}let lj=/\b([a-z-]*)\(.*?\)/gu,lk={...lv,getAnimatableNone:e=>{let t=e.match(lj);return t?t.map(lw).join(" "):e}},lN={...o1,transform:Math.round},lS={borderWidth:li,borderTopWidth:li,borderRightWidth:li,borderBottomWidth:li,borderLeftWidth:li,borderRadius:li,borderTopLeftRadius:li,borderTopRightRadius:li,borderBottomRightRadius:li,borderBottomLeftRadius:li,width:li,maxWidth:li,height:li,maxHeight:li,top:li,right:li,bottom:li,left:li,inset:li,insetBlock:li,insetBlockStart:li,insetBlockEnd:li,insetInline:li,insetInlineStart:li,insetInlineEnd:li,padding:li,paddingTop:li,paddingRight:li,paddingBottom:li,paddingLeft:li,paddingBlock:li,paddingBlockStart:li,paddingBlockEnd:li,paddingInline:li,paddingInlineStart:li,paddingInlineEnd:li,margin:li,marginTop:li,marginRight:li,marginBottom:li,marginLeft:li,marginBlock:li,marginBlockStart:li,marginBlockEnd:li,marginInline:li,marginInlineStart:li,marginInlineEnd:li,fontSize:li,backgroundPositionX:li,backgroundPositionY:li,rotate:ln,rotateX:ln,rotateY:ln,rotateZ:ln,scale:o5,scaleX:o5,scaleY:o5,scaleZ:o5,skew:ln,skewX:ln,skewY:ln,distance:li,translateX:li,translateY:li,translateZ:li,x:li,y:li,z:li,perspective:li,transformPerspective:li,opacity:o2,originX:ll,originY:ll,originZ:li,zIndex:lN,fillOpacity:o2,strokeOpacity:o2,numOctaves:lN},lC={...lS,color:lu,backgroundColor:lu,outlineColor:lu,fill:lu,stroke:lu,borderColor:lu,borderTopColor:lu,borderRightColor:lu,borderBottomColor:lu,borderLeftColor:lu,filter:lk,WebkitFilter:lk},lA=e=>lC[e],l_=()=>({translate:0,scale:1,origin:0,originPoint:0}),lT=()=>({x:l_(),y:l_()}),lE=()=>({min:0,max:0}),lP=()=>({x:lE(),y:lE()}),lR=e=>!!(e&&e.getVelocity),lM=new Set(["width","height","top","left","right","bottom",...oZ]),lI=e=>t=>t.test(e),lL=[o1,li,ls,ln,lo,la,{test:e=>"auto"===e,parse:e=>e}],lD=e=>lL.find(lI(e)),lz=()=>{},lO=()=>{};ew.default;let lB=e=>t=>"string"==typeof t&&t.startsWith(e),lF=lB("--"),l$=lB("var(--"),lV=e=>!!l$(e)&&lU.test(e.split("/*")[0].trim()),lU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function lW(e){return"string"==typeof e&&e.split("/*")[0].includes("var(--")}let lG=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,lq=e=>180*e/Math.PI,lH=e=>lX(lq(Math.atan2(e[1],e[0]))),lK={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:lH,rotateZ:lH,skewX:e=>lq(Math.atan(e[1])),skewY:e=>lq(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},lX=e=>((e%=360)<0&&(e+=360),e),lY=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),lJ=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),lZ={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:lY,scaleY:lJ,scale:e=>(lY(e)+lJ(e))/2,rotateX:e=>lX(lq(Math.atan2(e[6],e[5]))),rotateY:e=>lX(lq(Math.atan2(-e[2],e[0]))),rotateZ:lH,rotate:lH,skewX:e=>lq(Math.atan(e[4])),skewY:e=>lq(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function lQ(e){return+!!e.includes("scale")}function l0(e,t){let r,n;if(!e||"none"===e)return lQ(t);let s=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(s)r=lZ,n=s;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=lK,n=t}if(!n)return lQ(t);let i=r[t],a=n[1].split(",").map(l1);return"function"==typeof i?i(a):a[i]}function l1(e){return parseFloat(e.trim())}let l2=e=>e===o1||e===li,l5=new Set(["x","y","z"]),l3=oZ.filter(e=>!l5.has(e)),l4={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>l0(t,"x"),y:(e,{transform:t})=>l0(t,"y")};l4.translateX=l4.x,l4.translateY=l4.y;let l6=e=>e,l8={},l9=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function l7(e,t){let r=!1,n=!0,s={delta:0,timestamp:0,isProcessing:!1},i=()=>r=!0,a=l9.reduce((e,r)=>(e[r]=function(e,t){let r=new Set,n=new Set,s=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1},l=0;function c(t){a.has(t)&&(u.schedule(t),e()),l++,t(o)}let u={schedule:(e,t=!1,i=!1)=>{let o=i&&s?r:n;return t&&a.add(e),o.has(e)||o.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,s){i=!0;return}s=!0,[r,n]=[n,r],r.forEach(c),t,l=0,r.clear(),s=!1,i&&(i=!1,u.process(e))}};return u}(i,t?r:void 0),e),{}),{setup:o,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:h,render:m,postRender:p}=a,f=()=>{let i=l8.useManualTiming?s.timestamp:performance.now();r=!1,l8.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(i-s.timestamp,40),1)),s.timestamp=i,s.isProcessing=!0,o.process(s),l.process(s),c.process(s),u.process(s),d.process(s),h.process(s),m.process(s),p.process(s),s.isProcessing=!1,r&&t&&(n=!1,e(f))};return{schedule:l9.reduce((t,i)=>{let o=a[i];return t[i]=(t,i=!1,a=!1)=>(!r&&(r=!0,n=!0,s.isProcessing||e(f)),o.schedule(t,i,a)),t},{}),cancel:e=>{for(let t=0;t<l9.length;t++)a[l9[t]].cancel(e)},state:s,steps:a}}let{schedule:ce,cancel:ct,state:cr,steps:cn}=l7("u">typeof requestAnimationFrame?requestAnimationFrame:l6,!0),cs=new Set,ci=!1,ca=!1,co=!1;function cl(){if(ca){let e=Array.from(cs).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),r=new Map;t.forEach(e=>{let t,n=(t=[],l3.forEach(r=>{let n=e.getValue(r);void 0!==n&&(t.push([r,n.get()]),n.set(+!!r.startsWith("scale")))}),t);n.length&&(r.set(e,n),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=r.get(e);t&&t.forEach(([t,r])=>{e.getValue(t)?.set(r)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}ca=!1,ci=!1,cs.forEach(e=>e.complete(co)),cs.clear()}function cc(){cs.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(ca=!0)})}class cu{constructor(e,t,r,n,s,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=n,this.element=s,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(cs.add(this),ci||(ci=!0,ce.read(cc),ce.resolveKeyframes(cl))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:r,motionValue:n}=this;if(null===e[0]){let s=n?.get(),i=e[e.length-1];if(void 0!==s)e[0]=s;else if(r&&t){let n=r.readValue(t,i);null!=n&&(e[0]=n)}void 0===e[0]&&(e[0]=i),n&&void 0===s&&n.set(e[0])}for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),cs.delete(this)}cancel(){"scheduled"===this.state&&(cs.delete(this),this.state="pending")}resume(){"pending"===this.state&&this.scheduleResolve()}}function cd(e,t){let r=lA(e);return r!==lk&&(r=lv),r.getAnimatableNone?r.getAnimatableNone(t):void 0}let ch=new Set(["auto","none","0"]);class cm extends cu{constructor(e,t,r,n,s){super(e,t,r,n,s,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:r}=this;if(!t||!t.current)return;super.readKeyframes();for(let r=0;r<e.length;r++){let n=e[r];if("string"==typeof n&&lV(n=n.trim())){let s=function e(t,r,n=1){lO(n<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");let[s,i]=function(e){let t=lG.exec(e);if(!t)return[,];let[,r,n,s]=t;return[`--${r??n}`,s]}(t);if(!s)return;let a=window.getComputedStyle(r).getPropertyValue(s);if(a){let e=a.trim();return/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)?parseFloat(e):e}return lV(i)?e(i,r,n+1):i}(n,t.current);void 0!==s&&(e[r]=s),r===e.length-1&&(this.finalKeyframe=n)}}if(this.resolveNoneKeyframes(),!lM.has(r)||2!==e.length)return;let[n,s]=e,i=lD(n),a=lD(s);if(lW(n)!==lW(s)&&l4[r]){this.needsMeasurement=!0;return}if(i!==a)if(l2(i)&&l2(a))for(let t=0;t<e.length;t++){let r=e[t];"string"==typeof r&&(e[t]=parseFloat(r))}else l4[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,r=[];for(let t=0;t<e.length;t++)(null===e[t]||function(e){if("number"==typeof e)return 0===e;if(null===e)return!0;return"none"===e||"0"===e||/^0[^.\s]+$/u.test(e)}(e[t]))&&r.push(t);r.length&&function(e,t,r){let n,s=0;for(;s<e.length&&!n;){let t=e[s];"string"==typeof t&&!ch.has(t)&&lf(t).values.length&&(n=e[s]),s++}if(n&&r)for(let s of t)e[s]=cd(r,n)}(e,r,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:r}=this;if(!e||!e.current)return;"height"===r&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=l4[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let n=t[t.length-1];void 0!==n&&e.getValue(r,n).jump(n,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:r}=this;if(!e||!e.current)return;let n=e.getValue(t);n&&n.jump(this.measuredOrigin,!1);let s=r.length-1,i=r[s];r[s]=l4[t](e.measureViewportBox(),window.getComputedStyle(e.current)),null!==i&&void 0===this.finalKeyframe&&(this.finalKeyframe=i),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,r])=>{e.getValue(t).set(r)}),this.resolveNoneKeyframes()}}function cp(e,t){-1===e.indexOf(t)&&e.push(t)}function cf(e,t){let r=e.indexOf(t);r>-1&&e.splice(r,1)}class cg{constructor(){this.subscriptions=[]}add(e){return cp(this.subscriptions,e),()=>cf(this.subscriptions,e)}notify(e,t,r){let n=this.subscriptions.length;if(n)if(1===n)this.subscriptions[0](e,t,r);else for(let s=0;s<n;s++){let n=this.subscriptions[s];n&&n(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}let{schedule:cx}=l7(queueMicrotask,!1);function cy(){n=void 0}let cv={now:()=>(void 0===n&&cv.set(cr.isProcessing||l8.useManualTiming?cr.timestamp:performance.now()),n),set:e=>{n=e,queueMicrotask(cy)}};class cb{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=cv.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=cv.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new cg);let r=this.events[e].add(t);return"change"===e?()=>{r(),ce.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return d&&d.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var e;let t=cv.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||t-this.updatedAt>30)return 0;let r=Math.min(this.updatedAt-this.prevUpdatedAt,30);return e=parseFloat(this.current)-parseFloat(this.prevFrameValue),r?1e3/r*e:0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function cw(e,t){return new cb(e,t)}let cj=[...lL,lu,lv],ck={current:null},cN={current:!1},cS="u">typeof window,cC=new WeakMap;function cA(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}function c_(e){return"string"==typeof e||Array.isArray(e)}let cT=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],cE=["initial",...cT];function cP(e){return cA(e.animate)||cE.some(t=>c_(e[t]))}function cR(e){return!!(cP(e)||e.variants)}function cM(e){let t=[{},{}];return e?.values.forEach((e,r)=>{t[0][r]=e.get(),t[1][r]=e.getVelocity()}),t}function cI(e,t,r,n){if("function"==typeof t){let[s,i]=cM(n);t=t(void 0!==r?r:e.custom,s,i)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[s,i]=cM(n);t=t(void 0!==r?r:e.custom,s,i)}return t}let cL=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],cD={};class cz{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:n,blockInitialAnimation:s,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=cu,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=cv.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,ce.render(this.render,!1,!0))};const{latestValues:o,renderState:l}=i;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=n,this.options=a,this.blockInitialAnimation=!!s,this.isControllingVariants=cP(t),this.isVariantNode=cR(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:c,...u}=this.scrapeMotionValuesFromProps(t,{},this);for(const e in u){const t=u[e];void 0!==o[e]&&lR(t)&&t.set(o[e])}}mount(e){this.current=e,cC.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),"never"===this.reducedMotionConfig?this.shouldReduceMotion=!1:"always"===this.reducedMotionConfig?this.shouldReduceMotion=!0:(cN.current||function(){if(cN.current=!0,cS)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>ck.current=e.matches;e.addEventListener("change",t),t()}else ck.current=!1}(),this.shouldReduceMotion=ck.current),this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in this.projection&&this.projection.unmount(),ct(this.notifyUpdate),ct(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){let r;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let n=oQ.has(e);n&&this.onBindTransform&&this.onBindTransform();let s=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&ce.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});"u">typeof window&&window.MotionCheckAppearSync&&(r=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{s(),r&&r(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in cD){let t=cD[e];if(!t)continue;let{isEnabled:r,Feature:n}=t;if(!this.features[e]&&n&&r(this.props)&&(this.features[e]=new n(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lP()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<cL.length;t++){let r=cL[t];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);let n=e["on"+r];n&&(this.propEventSubscriptions[r]=this.on(r,n))}this.prevMotionValues=function(e,t,r){for(let n in t){let s=t[n],i=r[n];if(lR(s))e.addValue(n,s);else if(lR(i))e.addValue(n,cw(s,{owner:e}));else if(i!==s)if(e.hasValue(n)){let t=e.getValue(n);!0===t.liveStyle?t.jump(s):t.hasAnimated||t.set(s)}else{let t=e.getStaticValue(n);e.addValue(n,cw(void 0!==t?t:s,{owner:e}))}}for(let n in r)void 0===t[n]&&e.removeValue(n);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return void 0===r&&void 0!==t&&(r=cw(null===t?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){let r=void 0===this.latestValues[e]&&this.current?this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){let n,s;if("string"==typeof r&&(n=r,/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n)||(s=r,/^0[^.\s]+$/u.test(s))))r=parseFloat(r);else{let n;n=r,!cj.find(lI(n))&&lv.test(t)&&(r=cd(e,t))}this.setBaseTarget(e,lR(r)?r.get():r)}return lR(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let t,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let n=cI(this.props,r,this.presenceContext?.custom);n&&(t=n[e])}if(r&&void 0!==t)return t;let n=this.getBaseTargetFromProps(this.props,e);return void 0===n||lR(n)?void 0!==this.initialValues[e]&&void 0===t?void 0:this.baseTarget[e]:n}on(e,t){return this.events[e]||(this.events[e]=new cg),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){cx.render(this.render)}}class cO extends cz{constructor(){super(...arguments),this.KeyframeResolver=cm}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){let r=e.style;return r?r[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;lR(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function cB(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}let cF=(e,t)=>t&&"number"==typeof e?t.transform(e):e,c$={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},cV=oZ.length;function cU(e,t,r){let{style:n,vars:s,transformOrigin:i}=e,a=!1,o=!1;for(let e in t){let r=t[e];if(oQ.has(e)){a=!0;continue}if(lF(e)){s[e]=r;continue}{let t=cF(r,lS[e]);e.startsWith("origin")?(o=!0,i[e]=t):n[e]=t}}if(!t.transform&&(a||r?n.transform=function(e,t,r){let n="",s=!0;for(let i=0;i<cV;i++){let a=oZ[i],o=e[a];if(void 0===o)continue;let l=!0;if("number"==typeof o)l=o===+!!a.startsWith("scale");else{let e=parseFloat(o);l=a.startsWith("scale")?1===e:0===e}if(!l||r){let e=cF(o,lS[a]);if(!l){s=!1;let t=c$[a]||a;n+=`${t}(${e}) `}r&&(t[a]=e)}}return n=n.trim(),r?n=r(t,s?"":n):s&&(n="none"),n}(t,e.transform,r):n.transform&&(n.transform="none")),o){let{originX:e="50%",originY:t="50%",originZ:r=0}=i;n.transformOrigin=`${e} ${t} ${r}`}}let cW={offset:"stroke-dashoffset",array:"stroke-dasharray"},cG={offset:"strokeDashoffset",array:"strokeDasharray"},cq=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function cH(e,{attrX:t,attrY:r,attrScale:n,pathLength:s,pathSpacing:i=1,pathOffset:a=0,...o},l,c,u){if(cU(e,o,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:h}=e;for(let e of(d.transform&&(h.transform=d.transform,delete d.transform),(h.transform||d.transformOrigin)&&(h.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),h.transform&&(h.transformBox=u?.transformBox??"fill-box",delete d.transformBox),cq))void 0!==d[e]&&(h[e]=d[e],delete d[e]);void 0!==t&&(d.x=t),void 0!==r&&(d.y=r),void 0!==n&&(d.scale=n),void 0!==s&&function(e,t,r=1,n=0,s=!0){e.pathLength=1;let i=s?cW:cG;e[i.offset]=`${-n}`,e[i.array]=`${t} ${r}`}(d,s,i,a,!1)}let cK=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),cX=e=>"string"==typeof e&&"svg"===e.toLowerCase();function cY(e,{style:t,vars:r},n,s){let i,a=e.style;for(i in t)a[i]=t[i];for(i in s?.applyProjectionStyles(a,n),r)a.setProperty(i,r[i])}function cJ(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let cZ={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!li.test(e))return e;else e=parseFloat(e);let r=cJ(e,t.target.x),n=cJ(e,t.target.y);return`${r}% ${n}%`}},cQ=(e,t,r)=>e+(t-e)*r,c0={borderRadius:{...cZ,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:cZ,borderTopRightRadius:cZ,borderBottomLeftRadius:cZ,borderBottomRightRadius:cZ,boxShadow:{correct:(e,{treeScale:t,projectionDelta:r})=>{let n=lv.parse(e);if(n.length>5)return e;let s=lv.createTransformer(e),i=+("number"!=typeof n[0]),a=r.x.scale*t.x,o=r.y.scale*t.y;n[0+i]/=a,n[1+i]/=o;let l=cQ(a,o,.5);return"number"==typeof n[2+i]&&(n[2+i]/=l),"number"==typeof n[3+i]&&(n[3+i]/=l),s(n)}}};function c1(e,{layout:t,layoutId:r}){return oQ.has(e)||e.startsWith("origin")||(t||void 0!==r)&&(!!c0[e]||"opacity"===e)}function c2(e,t,r){let n=e.style,s=t?.style,i={};if(!n)return i;for(let t in n)(lR(n[t])||s&&lR(s[t])||c1(t,e)||r?.getValue(t)?.liveStyle!==void 0)&&(i[t]=n[t]);return i}function c5(e,t,r){let n=c2(e,t,r);for(let r in e)(lR(e[r])||lR(t[r]))&&(n[-1!==oZ.indexOf(r)?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r]=e[r]);return n}class c3 extends cO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=lP}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(oQ.has(t)){let e=lA(t);return e&&e.default||0}return t=cK.has(t)?t:cB(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,r){return c5(e,t,r)}build(e,t,r){cH(e,t,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,t,r,n){for(let r in cY(e,t,void 0,n),t.attrs)e.setAttribute(cK.has(r)?r:cB(r),t.attrs[r])}mount(e){this.isSVGTag=cX(e.tagName),super.mount(e)}}function c4({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function c6(e){return void 0===e||1===e}function c8({scale:e,scaleX:t,scaleY:r}){return!c6(e)||!c6(t)||!c6(r)}function c9(e){return c8(e)||c7(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function c7(e){var t,r;return(t=e.x)&&"0%"!==t||(r=e.y)&&"0%"!==r}function ue(e,t,r,n,s){return void 0!==s&&(e=n+s*(e-n)),n+r*(e-n)+t}function ut(e,t=0,r=1,n,s){e.min=ue(e.min,t,r,n,s),e.max=ue(e.max,t,r,n,s)}function ur(e,{x:t,y:r}){ut(e.x,t.translate,t.scale,t.originPoint),ut(e.y,r.translate,r.scale,r.originPoint)}function un(e,t){e.min=e.min+t,e.max=e.max+t}function us(e,t,r,n,s=.5){let i=cQ(e.min,e.max,s);ut(e,t,r,i,n)}function ui(e,t){us(e.x,t.x,t.scaleX,t.scale,t.originX),us(e.y,t.y,t.scaleY,t.scale,t.originY)}function ua(e,t){return c4(function(e,t){if(!t)return e;let r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}(e.getBoundingClientRect(),t))}class uo extends cO{constructor(){super(...arguments),this.type="html",this.renderInstance=cY}readValueFromInstance(e,t){if(oQ.has(t))return this.projection?.isProjecting?lQ(t):((e,t)=>{let{transform:r="none"}=getComputedStyle(e);return l0(r,t)})(e,t);{let r=window.getComputedStyle(e),n=(lF(t)?r.getPropertyValue(t):r[t])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return ua(e,t)}build(e,t,r){cU(e,t,r.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return c2(e,t,r)}}let ul=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function uc(e){if("string"!=typeof e||e.includes("-"));else if(ul.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}let uu=(0,b.createContext)({}),ud=(0,b.createContext)({strict:!1}),uh=(0,b.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),um=(0,b.createContext)({});function up(e){return Array.isArray(e)?e.join(" "):e}let uf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function ug(e,t,r){for(let n in t)lR(t[n])||c1(n,r)||(e[n]=t[n])}let ux=()=>({...uf(),attrs:{}}),uy=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function uv(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||uy.has(e)}let ub=e=>!uv(e);try{g=(()=>{let e=Error("Cannot find module '@emotion/is-prop-valid'");throw e.code="MODULE_NOT_FOUND",e})().default,"function"==typeof g&&(ub=e=>e.startsWith("on")?!uv(e):g(e))}catch{}function uw(e){return lR(e)?e.get():e}let uj=(0,b.createContext)(null),uk=e=>(t,r)=>{let n,s=(0,b.useContext)(um),i=(0,b.useContext)(uj),a=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,s){return{latestValues:function(e,t,r,n){let s={},i=n(e,{});for(let e in i)s[e]=uw(i[e]);let{initial:a,animate:o}=e,l=cP(e),c=cR(e);t&&c&&!l&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===o&&(o=t.animate));let u=!!r&&!1===r.initial,d=(u=u||!1===a)?o:a;if(d&&"boolean"!=typeof d&&!cA(d)){let t=Array.isArray(d)?d:[d];for(let r=0;r<t.length;r++){let n=cI(e,t[r]);if(n){let{transitionEnd:e,transition:t,...r}=n;for(let e in r){let t=r[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}null!==t&&(s[e]=t)}for(let t in e)s[t]=e[t]}}}return s}(r,n,s,e),renderState:t()}})(e,t,s,i);return r?a():(null===(n=(0,b.useRef)(null)).current&&(n.current=a()),n.current)},uN=uk({scrapeMotionValuesFromProps:c2,createRenderState:uf}),uS=uk({scrapeMotionValuesFromProps:c5,createRenderState:ux}),uC="u">typeof window,uA={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},u_=!1;function uT(){return!function(){if(u_)return;let e={};for(let t in uA)e[t]={isEnabled:e=>uA[t].some(t=>!!e[t])};cD=e,u_=!0}(),cD}let uE=Symbol.for("motionComponentSymbol"),uP="data-"+cB("framerAppearId"),uR=(0,b.createContext)({});function uM(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}let uI=uC?b.useLayoutEffect:b.useEffect;function uL(e,{forwardMotionProps:t=!1,type:r}={},n,s){n&&function(e){let t=uT();for(let r in e)t[r]={...t[r],...e[r]};cD=t}(n);let i=r?"svg"===r:uc(e),a=i?uS:uN;function o(r,n){var o;let l,c,u,d={...(0,b.useContext)(uh),...r,layoutId:function({layoutId:e}){let t=(0,b.useContext)(uu).id;return t&&void 0!==e?t+"-"+e:e}(r)},{isStatic:h}=d,m=function(e){let{initial:t,animate:r}=function(e,t){if(cP(e)){let{initial:t,animate:r}=e;return{initial:!1===t||c_(t)?t:void 0,animate:c_(r)?r:void 0}}return!1!==e.inherit?t:{}}(e,(0,b.useContext)(um));return(0,b.useMemo)(()=>({initial:t,animate:r}),[up(t),up(r)])}(r),p=a(r,h);if(!h&&uC){(0,b.useContext)(ud).strict;let t=function(e){let{drag:t,layout:r}=uT();if(!t&&!r)return{};let n={...t,...r};return{MeasureLayout:t?.isEnabled(e)||r?.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}(d);l=t.MeasureLayout,m.visualElement=function(e,t,r,n,s,i){let{visualElement:a}=(0,b.useContext)(um),o=(0,b.useContext)(ud),l=(0,b.useContext)(uj),c=(0,b.useContext)(uh).reducedMotion,u=(0,b.useRef)(null),d=(0,b.useRef)(!1);n=n||o.renderer,!u.current&&n&&(u.current=n(e,{visualState:t,parent:a,props:r,presenceContext:l,blockInitialAnimation:!!l&&!1===l.initial,reducedMotionConfig:c,isSVG:i}),d.current&&u.current&&(u.current.manuallyAnimateOnMount=!0));let h=u.current,m=(0,b.useContext)(uR);h&&!h.projection&&s&&("html"===h.type||"svg"===h.type)&&function(e,t,r,n){let{layoutId:s,layout:i,drag:a,dragConstraints:o,layoutScroll:l,layoutRoot:c,layoutCrossfade:u}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!a||o&&uM(o),visualElement:e,animationType:"string"==typeof i?i:"both",initialPromotionConfig:n,crossfade:u,layoutScroll:l,layoutRoot:c})}(u.current,r,s,m);let p=(0,b.useRef)(!1);(0,b.useInsertionEffect)(()=>{h&&p.current&&h.update(r,l)});let f=r[uP],g=(0,b.useRef)(!!f&&!window.MotionHandoffIsComplete?.(f)&&window.MotionHasOptimisedAnimation?.(f));return uI(()=>{d.current=!0,h&&(p.current=!0,window.MotionIsMounted=!0,h.updateFeatures(),h.scheduleRenderMicrotask(),g.current&&h.animationState&&h.animationState.animateChanges())}),(0,b.useEffect)(()=>{h&&(!g.current&&h.animationState&&h.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(f)}),g.current=!1),h.enteringChildren=void 0)}),h}(e,p,d,s,t.ProjectionNode,i)}return(0,v.jsxs)(um.Provider,{value:m,children:[l&&m.visualElement?(0,v.jsx)(l,{visualElement:m.visualElement,...d}):null,function(e,t,r,{latestValues:n},s,i=!1,a){let o=(a??uc(e)?function(e,t,r,n){let s=(0,b.useMemo)(()=>{let r=ux();return cH(r,t,cX(n),e.transformTemplate,e.style),{...r.attrs,style:{...r.style}}},[t]);if(e.style){let t={};ug(t,e.style,e),s.style={...t,...s.style}}return s}:function(e,t){let r,n,s={},i=(r=e.style||{},ug(n={},r,e),Object.assign(n,function({transformTemplate:e},t){return(0,b.useMemo)(()=>{let r=uf();return cU(r,t,e),Object.assign({},r.vars,r.style)},[t])}(e,t)),n);return e.drag&&!1!==e.dragListener&&(s.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(s.tabIndex=0),s.style=i,s})(t,n,s,e),l=function(e,t,r){let n={};for(let s in e)("values"!==s||"object"!=typeof e.values)&&(ub(s)||!0===r&&uv(s)||!t&&!uv(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}(t,"string"==typeof e,i),c=e!==b.Fragment?{...l,...o,ref:r}:{},{children:u}=t,d=(0,b.useMemo)(()=>lR(u)?u.get():u,[u]);return(0,b.createElement)(e,{...c,children:d})}(e,r,(o=m.visualElement,c=(0,b.useRef)(n),(0,b.useInsertionEffect)(()=>{c.current=n}),u=(0,b.useRef)(null),(0,b.useCallback)(e=>{e&&p.onMount?.(e),o&&(e?o.mount(e):o.unmount());let t=c.current;if("function"==typeof t)if(e){let r=t(e);"function"==typeof r&&(u.current=r)}else u.current?(u.current(),u.current=null):t(e);else t&&(t.current=e)},[o])),p,h,t,i)]})}o.displayName=`motion.${"string"==typeof e?e:`create(${e.displayName??e.name??""})`}`;let l=(0,b.forwardRef)(o);return l[uE]=e,l}class uD{constructor(e){this.isMounted=!1,this.node=e}update(){}}function uz(e,t,r){let n=e.getProps();return cI(n,t,void 0!==r?r:n.custom,e)}function uO(e,t){return e?.[t]??e?.default??e}let uB=e=>Array.isArray(e);function uF(e,t){let r=e.getValue("willChange");if(lR(r)&&r.add)return r.add(t);if(!r&&l8.WillChange){let r=new l8.WillChange("auto");e.addValue("willChange",r),r.add(t)}}let u$=e=>1e3*e,uV=(e,t)=>r=>t(e(r)),uU=(...e)=>e.reduce(uV),uW={layout:0,mainThread:0,waapi:0};function uG(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function uq(e,t){return r=>r>0?t:e}let uH=(e,t,r)=>{let n=e*e,s=r*(t*t-n)+n;return s<0?0:Math.sqrt(s)},uK=[lt,le,lc];function uX(e){let t=uK.find(t=>t.test(e));if(lz(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let r=t.parse(e);return t===lc&&(r=function({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,r/=100;let s=0,i=0,a=0;if(t/=100){let n=r<.5?r*(1+t):r+t-r*t,o=2*r-n;s=uG(o,n,e+1/3),i=uG(o,n,e),a=uG(o,n,e-1/3)}else s=i=a=r;return{red:Math.round(255*s),green:Math.round(255*i),blue:Math.round(255*a),alpha:n}}(r)),r}let uY=(e,t)=>{let r=uX(e),n=uX(t);if(!r||!n)return uq(e,t);let s={...r};return e=>(s.red=uH(r.red,n.red,e),s.green=uH(r.green,n.green,e),s.blue=uH(r.blue,n.blue,e),s.alpha=cQ(r.alpha,n.alpha,e),le.transform(s))},uJ=new Set(["none","hidden"]);function uZ(e,t){return r=>cQ(e,t,r)}function uQ(e){return"number"==typeof e?uZ:"string"==typeof e?lV(e)?uq:lu.test(e)?uY:u2:Array.isArray(e)?u0:"object"==typeof e?lu.test(e)?uY:u1:uq}function u0(e,t){let r=[...e],n=r.length,s=e.map((e,r)=>uQ(e)(e,t[r]));return e=>{for(let t=0;t<n;t++)r[t]=s[t](e);return r}}function u1(e,t){let r={...e,...t},n={};for(let s in r)void 0!==e[s]&&void 0!==t[s]&&(n[s]=uQ(e[s])(e[s],t[s]));return e=>{for(let t in n)r[t]=n[t](e);return r}}let u2=(e,t)=>{let r=lv.createTransformer(t),n=lf(e),s=lf(t);if(!(n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length))return lz(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),uq(e,t);if(uJ.has(e)&&!s.values.length||uJ.has(t)&&!n.values.length)return uJ.has(e)?r=>r<=0?e:t:r=>r>=1?t:e;return uU(u0(function(e,t){let r=[],n={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){let i=t.types[s],a=e.indexes[i][n[i]],o=e.values[a]??0;r[s]=o,n[i]++}return r}(n,s),s.values),r)};function u5(e,t,r){return"number"==typeof e&&"number"==typeof t&&"number"==typeof r?cQ(e,t,r):uQ(e)(e,t)}let u3=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>ce.update(t,e),stop:()=>ct(t),now:()=>cr.isProcessing?cr.timestamp:cv.now()}},u4=(e,t,r=10)=>{let n="",s=Math.max(Math.round(t/r),2);for(let t=0;t<s;t++)n+=Math.round(1e4*e(t/(s-1)))/1e4+", ";return`linear(${n.substring(0,n.length-2)})`};function u6(e){let t=0,r=e.next(t);for(;!r.done&&t<2e4;)t+=50,r=e.next(t);return t>=2e4?1/0:t}function u8(e,t,r){var n,s;let i=Math.max(t-5,0);return n=r-e(i),(s=t-i)?1e3/s*n:0}let u9=.01,u7=2,de=.005,dt=.5;function dr(e,t){return e*Math.sqrt(1-t*t)}let dn=["duration","bounce"],ds=["stiffness","damping","mass"];function di(e,t){return t.some(t=>void 0!==e[t])}function da(e=.3,t=.3){let r,n="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:s,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:c,damping:u,mass:d,duration:h,velocity:m,isResolvedFromDuration:p}=function(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!di(e,ds)&&di(e,dn))if(e.visualDuration){let r=2*Math.PI/(1.2*e.visualDuration),n=r*r,s=2*o0(.05,1,1-(e.bounce||0))*Math.sqrt(n);t={...t,mass:1,stiffness:n,damping:s}}else{let r=function({duration:e=800,bounce:t=.3,velocity:r=0,mass:n=1}){let s,i;lz(e<=u$(10),"Spring duration must be 10 seconds or less","spring-duration-limit");let a=1-t;a=o0(.05,1,a),e=o0(.01,10,e/1e3),a<1?(s=t=>{let n=t*a,s=n*e;return .001-(n-r)/dr(t,a)*Math.exp(-s)},i=t=>{let n=t*a*e,i=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-n),l=dr(Math.pow(t,2),a);return(n*r+r-i)*o*(-s(t)+.001>0?-1:1)/l}):(s=t=>-.001+Math.exp(-t*e)*((t-r)*e+1),i=t=>e*e*(r-t)*Math.exp(-t*e));let o=function(e,t,r){let n=r;for(let r=1;r<12;r++)n-=e(n)/t(n);return n}(s,i,5/e);if(e=u$(e),isNaN(o))return{stiffness:100,damping:10,duration:e};{let t=Math.pow(o,2)*n;return{stiffness:t,damping:2*a*Math.sqrt(n*t),duration:e}}}(e);(t={...t,...r,mass:1}).isResolvedFromDuration=!0}return t}({...n,velocity:-((n.velocity||0)/1e3)}),f=m||0,g=u/(2*Math.sqrt(c*d)),x=o-a,y=Math.sqrt(c/d)/1e3,v=5>Math.abs(x);if(s||(s=v?u9:u7),i||(i=v?de:dt),g<1){let e=dr(y,g);r=t=>o-Math.exp(-g*y*t)*((f+g*y*x)/e*Math.sin(e*t)+x*Math.cos(e*t))}else if(1===g)r=e=>o-Math.exp(-y*e)*(x+(f+y*x)*e);else{let e=y*Math.sqrt(g*g-1);r=t=>{let r=Math.exp(-g*y*t),n=Math.min(e*t,300);return o-r*((f+g*y*x)*Math.sinh(n)+e*x*Math.cosh(n))/e}}let b={calculatedDuration:p&&h||null,next:e=>{let t=r(e);if(p)l.done=e>=h;else{let n=0===e?f:0;g<1&&(n=0===e?u$(f):u8(r,e,t));let a=Math.abs(o-t)<=i;l.done=Math.abs(n)<=s&&a}return l.value=l.done?o:t,l},toString:()=>{let e=Math.min(u6(b),2e4),t=u4(t=>b.next(e*t).value,e,30);return e+"ms "+t},toTransition:()=>{}};return b}function dl({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:a,min:o,max:l,restDelta:c=.5,restSpeed:u}){let d,h,m=e[0],p={done:!1,value:m},f=r*t,g=m+f,x=void 0===a?g:a(g);x!==g&&(f=x-m);let y=e=>-f*Math.exp(-e/n),v=e=>x+y(e),b=e=>{let t=y(e),r=v(e);p.done=Math.abs(t)<=c,p.value=p.done?x:r},w=e=>{let t;if(t=p.value,void 0!==o&&t<o||void 0!==l&&t>l){var r;d=e,h=da({keyframes:[p.value,(r=p.value,void 0===o?l:void 0===l||Math.abs(o-r)<Math.abs(l-r)?o:l)],velocity:u8(v,e,p.value),damping:s,stiffness:i,restDelta:c,restSpeed:u})}};return w(0),{calculatedDuration:null,next:e=>{let t=!1;return(h||void 0!==d||(t=!0,b(e),w(e)),void 0!==d&&e>=d)?h.next(e-d):(t||b(e),p)}}}da.applyToOptions=e=>{let t=function(e,t=100,r){let n=r({...e,keyframes:[0,t]}),s=Math.min(u6(n),2e4);return{type:"keyframes",ease:e=>n.next(s*e).value/t,duration:s/1e3}}(e,100,da);return e.ease=t.ease,e.duration=u$(t.duration),e.type="keyframes",e};let dc=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e;function du(e,t,r,n){return e===t&&r===n?l6:s=>0===s||1===s?s:dc(function(e,t,r,n,s){let i,a,o=0;do(i=dc(a=t+(r-t)/2,n,s)-e)>0?r=a:t=a;while(Math.abs(i)>1e-7&&++o<12)return a}(s,0,1,e,r),t,n)}let dd=du(.42,0,1,1),dh=du(0,0,.58,1),dm=du(.42,0,.58,1),dp=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,df=e=>t=>1-e(1-t),dg=du(.33,1.53,.69,.99),dx=df(dg),dy=dp(dx),dv=e=>(e*=2)<1?.5*dx(e):.5*(2-Math.pow(2,-10*(e-1))),db=e=>1-Math.sin(Math.acos(e)),dw=df(db),dj=dp(db),dk=e=>Array.isArray(e)&&"number"==typeof e[0],dN={linear:l6,easeIn:dd,easeInOut:dm,easeOut:dh,circIn:db,circInOut:dj,circOut:dw,backIn:dx,backInOut:dy,backOut:dg,anticipate:dv},dS=e=>{if(dk(e)){lO(4===e.length,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");let[t,r,n,s]=e;return du(t,r,n,s)}return"string"==typeof e?(lO(void 0!==dN[e],`Invalid easing type '${e}'`,"invalid-easing-type"),dN[e]):e},dC=(e,t,r)=>{let n=t-e;return 0===n?1:(r-e)/n};function dA({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){var s;let i,a=Array.isArray(n)&&"number"!=typeof n[0]?n.map(dS):dS(n),o={done:!1,value:t[0]},l=function(e,t,{clamp:r=!0,ease:n,mixer:s}={}){let i=e.length;if(lO(i===t.length,"Both input and output ranges must be the same length","range-length"),1===i)return()=>t[0];if(2===i&&t[0]===t[1])return()=>t[1];let a=e[0]===e[1];e[0]>e[i-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=function(e,t,r){let n=[],s=r||l8.mix||u5,i=e.length-1;for(let r=0;r<i;r++){let i=s(e[r],e[r+1]);t&&(i=uU(Array.isArray(t)?t[r]||l6:t,i)),n.push(i)}return n}(t,n,s),l=o.length,c=r=>{if(a&&r<e[0])return t[0];let n=0;if(l>1)for(;n<e.length-2&&!(r<e[n+1]);n++);let s=dC(e[n],e[n+1],r);return o[n](s)};return r?t=>c(o0(e[0],e[i-1],t)):c}((s=r&&r.length===t.length?r:(!function(e,t){let r=e[e.length-1];for(let n=1;n<=t;n++){let s=dC(0,t,n);e.push(cQ(r,1,s))}}(i=[0],t.length-1),i),s.map(t=>t*e)),t,{ease:Array.isArray(a)?a:t.map(()=>a||dm).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=l(t),o.done=t>=e,o)}}let d_=e=>null!==e;function dT(e,{repeat:t,repeatType:r="loop"},n,s=1){let i=e.filter(d_),a=s<0||t&&"loop"!==r&&t%2==1?0:i.length-1;return a&&void 0!==n?n:i[a]}let dE={decay:dl,inertia:dl,tween:dA,keyframes:dA,spring:da};function dP(e){"string"==typeof e.type&&(e.type=dE[e.type])}class dR{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}let dM=e=>e/100;class dI extends dR{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==cv.now()&&this.tick(cv.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},uW.mainThread++,this.options=e,this.initAnimation(),this.play(),!1===e.autoplay&&this.pause()}initAnimation(){let{options:e}=this;dP(e);let{type:t=dA,repeat:r=0,repeatDelay:n=0,repeatType:s,velocity:i=0}=e,{keyframes:a}=e,o=t||dA;o!==dA&&"number"!=typeof a[0]&&(this.mixKeyframes=uU(dM,u5(a[0],a[1])),a=[0,100]);let l=o({...e,keyframes:a});"mirror"===s&&(this.mirroredGenerator=o({...e,keyframes:[...a].reverse(),velocity:-i})),null===l.calculatedDuration&&(l.calculatedDuration=u6(l));let{calculatedDuration:c}=l;this.calculatedDuration=c,this.resolvedDuration=c+n,this.totalDuration=this.resolvedDuration*(r+1)-n,this.generator=l}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){let{generator:r,totalDuration:n,mixKeyframes:s,mirroredGenerator:i,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return r.next(0);let{delay:l=0,keyframes:c,repeat:u,repeatType:d,repeatDelay:h,type:m,onUpdate:p,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-n/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-l*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?g<0:g>n;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let y=this.currentTime,v=r;if(u){let e=Math.min(this.currentTime,n)/a,t=Math.floor(e),r=e%1;!r&&e>=1&&(r=1),1===r&&t--,(t=Math.min(t,u+1))%2&&("reverse"===d?(r=1-r,h&&(r-=h/a)):"mirror"===d&&(v=i)),y=o0(0,1,r)*a}let b=x?{done:!1,value:c[0]}:v.next(y);s&&(b.value=s(b.value));let{done:w}=b;x||null===o||(w=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let j=null===this.holdTime&&("finished"===this.state||"running"===this.state&&w);return j&&m!==dl&&(b.value=dT(c,this.options,f,this.speed)),p&&p(b.value),j&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return this.calculatedDuration/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return this.currentTime/1e3}set time(e){e=u$(e),this.currentTime=e,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(cv.now());let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=this.currentTime/1e3)}play(){if(this.isStopped)return;let{driver:e=u3,startTime:t}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),this.options.onPlay?.();let r=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=r):null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime||(this.startTime=t??r),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(cv.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,uW.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function dL(e){let t;return()=>(void 0===t&&(t=e()),t)}let dD=dL(()=>void 0!==window.ScrollTimeline),dz={},dO=(u=dL(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(e){return!1}return!0}),()=>dz.linearEasing??u()),dB=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,dF={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:dB([0,.65,.55,1]),circOut:dB([.55,0,1,.45]),backIn:dB([.31,.01,.66,-.59]),backOut:dB([.33,1.53,.69,.99])};function d$(e){return"function"==typeof e&&"applyToOptions"in e}class dV extends dR{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:r,keyframes:n,pseudoElement:s,allowFlatten:i=!1,finalKeyframe:a,onComplete:o}=e;this.isPseudoElement=!!s,this.allowFlatten=i,this.options=e,lO("string"!=typeof e.type,'Mini animate() doesn\'t support "type" as a string.',"mini-spring");const l=function({type:e,...t}){return d$(e)&&dO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}(e);this.animation=function(e,t,r,{delay:n=0,duration:s=300,repeat:i=0,repeatType:a="loop",ease:o="easeOut",times:l}={},c){let u={[t]:r};l&&(u.offset=l);let d=function e(t,r){if(t)return"function"==typeof t?dO()?u4(t,r):"ease-out":dk(t)?dB(t):Array.isArray(t)?t.map(t=>e(t,r)||dF.easeOut):dF[t]}(o,s);Array.isArray(d)&&(u.easing=d);let h={delay:n,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:i+1,direction:"reverse"===a?"alternate":"normal"};c&&(h.pseudoElement=c);let m=e.animate(u,h);return m}(t,r,n,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){let e=dT(n,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(e):r.startsWith("--")?t.style.setProperty(r,e):t.style[r]=e,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(e){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;"idle"!==e&&"finished"!==e&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return Number(this.animation.effect?.getComputedTiming?.().duration||0)/1e3}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+e/1e3}get time(){return(Number(this.animation.currentTime)||0)/1e3}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=u$(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&dD())?(this.animation.timeline=e,l6):t(this)}}let dU={anticipate:dv,backInOut:dy,circInOut:dj};class dW extends dV{constructor(e){!function(e){"string"==typeof e.ease&&e.ease in dU&&(e.ease=dU[e.ease])}(e),dP(e),super(e),void 0!==e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:r,onComplete:n,element:s,...i}=this.options;if(!t)return;if(void 0!==e)return void t.set(e);let a=new dI({...i,autoplay:!1}),o=Math.max(10,cv.now()-this.startTime),l=o0(0,10,o-10);t.setWithVelocity(a.sample(Math.max(0,o-l)).value,a.sample(o).value,l),a.stop()}}let dG=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(lv.test(e)||"0"===e)&&!e.startsWith("url("));function dq(e){e.duration=0,e.type="keyframes"}let dH=new Set(["opacity","clipPath","filter","transform"]),dK=dL(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class dX extends dR{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:i="loop",keyframes:a,name:o,motionValue:l,element:c,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=cv.now();const d={autoplay:e,delay:t,type:r,repeat:n,repeatDelay:s,repeatType:i,name:o,motionValue:l,element:c,...u},h=c?.KeyframeResolver||cu;this.keyframeResolver=new h(a,(e,t,r)=>this.onKeyframesResolved(e,t,d,!r),o,l,c),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,r,n){this.keyframeResolver=void 0;let{name:s,type:i,velocity:a,delay:o,isHandoff:l,onUpdate:c}=r;this.resolvedAt=cv.now(),!function(e,t,r,n){let s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;let i=e[e.length-1],a=dG(s,t),o=dG(i,t);return lz(a===o,`You are trying to animate ${t} from "${s}" to "${i}". "${a?i:s}" is not an animatable value.`,"value-not-animatable"),!!a&&!!o&&(function(e){let t=e[0];if(1===e.length)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}(e)||("spring"===r||d$(r))&&n)}(e,s,i,a)&&((l8.instantAnimations||!o)&&c?.(dT(e,r,t)),e[0]=e[e.length-1],dq(r),r.repeat=0);let u={startTime:n?this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...r,keyframes:e},d=!l&&function(e){let{motionValue:t,name:r,repeatDelay:n,repeatType:s,damping:i,type:a}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:o,transformTemplate:l}=t.owner.getProps();return dK()&&r&&dH.has(r)&&("transform"!==r||!l)&&!o&&!n&&"mirror"!==s&&0!==i&&"inertia"!==a}(u),h=u.motionValue?.owner?.current,m=d?new dW({...u,element:h}):new dI(u);m.finished.then(()=>{this.notifyFinished()}).catch(l6),this.pendingTimeline&&(this.stopTimeline=m.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),co=!0,cc(),cl(),co=!1),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let dY={type:"spring",stiffness:500,damping:25,restSpeed:10},dJ={type:"keyframes",duration:.8},dZ={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dQ=e=>null!==e,d0=(e,t,r,n={},s,i)=>a=>{let o=uO(n,e)||{},l=o.delay||n.delay||0,{elapsed:c=0}=n;c-=u$(l);let u={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...o,delay:-c,onUpdate:e=>{t.set(e),o.onUpdate&&o.onUpdate(e)},onComplete:()=>{a(),o.onComplete&&o.onComplete()},name:e,motionValue:t,element:i?void 0:s};!function({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:i,repeatType:a,repeatDelay:o,from:l,elapsed:c,...u}){return!!Object.keys(u).length}(o)&&Object.assign(u,((e,{keyframes:t})=>t.length>2?dJ:oQ.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:dY:dZ)(e,u)),u.duration&&(u.duration=u$(u.duration)),u.repeatDelay&&(u.repeatDelay=u$(u.repeatDelay)),void 0!==u.from&&(u.keyframes[0]=u.from);let d=!1;if(!1!==u.type&&(0!==u.duration||u.repeatDelay)||(dq(u),0===u.delay&&(d=!0)),(l8.instantAnimations||l8.skipAnimations)&&(d=!0,dq(u),u.delay=0),u.allowFlatten=!o.type&&!o.ease,d&&!i&&void 0!==t.get()){let e=function(e,{repeat:t,repeatType:r="loop"},n){let s=e.filter(dQ),i=t&&"loop"!==r&&t%2==1?0:s.length-1;return s[i]}(u.keyframes,o);if(void 0!==e)return void ce.update(()=>{u.onUpdate(e),u.onComplete()})}return o.isSync?new dI(u):new dX(u)};function d1(e,t,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:i=e.getDefaultTransition(),transitionEnd:a,...o}=t;n&&(i=n);let l=[],c=s&&e.animationState&&e.animationState.getState()[s];for(let t in o){let n=e.getValue(t,e.latestValues[t]??null),s=o[t];if(void 0===s||c&&function({protectedKeys:e,needsAnimating:t},r){let n=e.hasOwnProperty(r)&&!0!==t[r];return t[r]=!1,n}(c,t))continue;let a={delay:r,...uO(i||{},t)},u=n.get();if(void 0!==u&&!n.isAnimating&&!Array.isArray(s)&&s===u&&!a.velocity)continue;let d=!1;if(window.MotionHandoffAnimation){let r=e.props[uP];if(r){let e=window.MotionHandoffAnimation(r,t,ce);null!==e&&(a.startTime=e,d=!0)}}uF(e,t),n.start(d0(t,n,s,e.shouldReduceMotion&&lM.has(t)?{type:!1}:a,e,d));let h=n.animation;h&&l.push(h)}return a&&Promise.all(l).then(()=>{ce.update(()=>{a&&function(e,t){let{transitionEnd:r={},transition:n={},...s}=uz(e,t)||{};for(let t in s={...s,...r}){var i;let r=uB(i=s[t])?i[i.length-1]||0:i;e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,cw(r))}}(e,a)})}),l}function d2(e,t,r,n=0,s=1){let i=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),a=e.size,o=(a-1)*n;return"function"==typeof r?r(i,a):1===s?i*n:o-i*n}function d5(e,t,r={}){let n=uz(e,t,"exit"===r.type?e.presenceContext?.custom:void 0),{transition:s=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);let i=n?()=>Promise.all(d1(e,n,r)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(n=0)=>{let{delayChildren:i=0,staggerChildren:a,staggerDirection:o}=s;return function(e,t,r=0,n=0,s=0,i=1,a){let o=[];for(let l of e.variantChildren)l.notify("AnimationStart",t),o.push(d5(l,t,{...a,delay:r+("function"==typeof n?0:n)+d2(e.variantChildren,l,n,s,i)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(o)}(e,t,n,i,a,o,r)}:()=>Promise.resolve(),{when:o}=s;if(!o)return Promise.all([i(),a(r.delay)]);{let[e,t]="beforeChildren"===o?[i,a]:[a,i];return e().then(()=>t())}}let d3=cE.length;function d4(e,t){if(!Array.isArray(t))return!1;let r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}let d6=[...cT].reverse(),d8=cT.length;function d9(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function d7(){return{animate:d9(!0),whileInView:d9(),whileHover:d9(),whileTap:d9(),whileDrag:d9(),whileFocus:d9(),exit:d9()}}let he=0;function ht(e){return[e("x"),e("y")]}let hr=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function hn(e){return hr.has(e.tagName)||!0===e.isContentEditable}function hs(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}let hi={x:!1,y:!1};function ha(e){return e.max-e.min}function ho(e,t,r,n=.5){e.origin=n,e.originPoint=cQ(t.min,t.max,e.origin),e.scale=ha(r)/ha(t),e.translate=cQ(r.min,r.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function hl(e,t,r,n){ho(e.x,t.x,r.x,n?n.originX:void 0),ho(e.y,t.y,r.y,n?n.originY:void 0)}function hc(e,t,r){e.min=r.min+t.min,e.max=e.min+ha(t)}function hu(e,t,r){e.min=t.min-r.min,e.max=e.min+ha(t)}function hd(e,t,r){hu(e.x,t.x,r.x),hu(e.y,t.y,r.y)}let hh=e=>"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary;function hm(e){return{point:{x:e.pageX,y:e.pageY}}}function hp(e,t,r,n){return hs(e,t,e=>hh(e)&&r(e,hm(e)),n)}let hf=({current:e})=>e?e.ownerDocument.defaultView:null,hg=(e,t)=>Math.abs(e-t),hx=new Set(["auto","scroll"]);class hy{constructor(e,t,{transformPagePoint:r,contextWindow:n=window,dragSnapToOrigin:s=!1,distanceThreshold:i=3,element:a}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{var e,t;if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let r=hw(this.lastMoveEventInfo,this.history),n=null!==this.startEvent,s=(e=r.offset,t={x:0,y:0},Math.sqrt(hg(e.x,t.x)**2+hg(e.y,t.y)**2)>=this.distanceThreshold);if(!n&&!s)return;let{point:i}=r,{timestamp:a}=cr;this.history.push({...i,timestamp:a});let{onStart:o,onMove:l}=this.handlers;n||(o&&o(this.lastMoveEvent,r),this.startEvent=this.lastMoveEvent),l&&l(this.lastMoveEvent,r)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=hv(t,this.transformPagePoint),ce.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:r,onSessionEnd:n,resumeAnimation:s}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&s&&s(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let i=hw("pointercancel"===e.type?this.lastMoveEventInfo:hv(t,this.transformPagePoint),this.history);this.startEvent&&r&&r(e,i),n&&n(e,i)},!hh(e))return;this.dragSnapToOrigin=s,this.handlers=t,this.transformPagePoint=r,this.distanceThreshold=i,this.contextWindow=n||window;const o=hv(hm(e),this.transformPagePoint),{point:l}=o,{timestamp:c}=cr;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,hw(o,this.history)),this.removeListeners=uU(hp(this.contextWindow,"pointermove",this.handlePointerMove),hp(this.contextWindow,"pointerup",this.handlePointerUp),hp(this.contextWindow,"pointercancel",this.handlePointerUp)),a&&this.startScrollTracking(a)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(hx.has(e.overflowX)||hx.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let r=e===window,n=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},s={x:n.x-t.x,y:n.y-t.y};(0!==s.x||0!==s.y)&&(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=s.x,this.lastMoveEventInfo.point.y+=s.y):this.history.length>0&&(this.history[0].x-=s.x,this.history[0].y-=s.y),this.scrollPositions.set(e,n),ce.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),ct(this.updatePoint)}}function hv(e,t){return t?{point:t(e.point)}:e}function hb(e,t){return{x:e.x-t.x,y:e.y-t.y}}function hw({point:e},t){return{point:e,delta:hb(e,hj(t)),offset:hb(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null,s=hj(e);for(;r>=0&&(n=e[r],!(s.timestamp-n.timestamp>u$(.1)));)r--;if(!n)return{x:0,y:0};let i=(s.timestamp-n.timestamp)/1e3;if(0===i)return{x:0,y:0};let a={x:(s.x-n.x)/i,y:(s.y-n.y)/i};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}(t,.1)}}function hj(e){return e[e.length-1]}function hk(e,t,r){return{min:void 0!==t?e.min+t:void 0,max:void 0!==r?e.max+r-(e.max-e.min):void 0}}function hN(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function hS(e,t,r){return{min:hC(e,t),max:hC(e,r)}}function hC(e,t){return"number"==typeof e?e:e[t]||0}let hA=new WeakMap;class h_{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lP(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:r}={}){let{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;let s=e=>{t?(this.stopAnimation(),this.snapToCursor(hm(e).point)):this.pauseAnimation()},i=(e,t)=>{this.stopAnimation();let{drag:r,dragPropagation:n,onDragStart:s}=this.getProps();if(r&&!n&&(this.openDragLock&&this.openDragLock(),this.openDragLock=function(e){if("x"===e||"y"===e)if(hi[e])return null;else return hi[e]=!0,()=>{hi[e]=!1};return hi.x||hi.y?null:(hi.x=hi.y=!0,()=>{hi.x=hi.y=!1})}(r),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),ht(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ls.test(t)){let{projection:r}=this.visualElement;if(r&&r.layout){let n=r.layout.layoutBox[e];n&&(t=ha(n)*(parseFloat(t)/100))}}this.originPoint[e]=t}),s&&ce.postRender(()=>s(e,t)),uF(this.visualElement,"transform");let{animationState:i}=this.visualElement;i&&i.setActive("whileDrag",!0)},a=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:r,dragDirectionLock:n,onDirectionLock:s,onDrag:i}=this.getProps();if(!r&&!this.openDragLock)return;let{offset:a}=t;if(n&&null===this.currentDirection){this.currentDirection=function(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}(a),null!==this.currentDirection&&s&&s(this.currentDirection);return}this.updateAxis("x",t.point,a),this.updateAxis("y",t.point,a),this.visualElement.render(),i&&i(e,t)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},l=()=>ht(e=>"paused"===this.getAnimationState(e)&&this.getAxisMotionValue(e).animation?.play()),{dragSnapToOrigin:c}=this.getProps();this.panSession=new hy(e,{onSessionStart:s,onStart:i,onMove:a,onSessionEnd:o,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,distanceThreshold:r,contextWindow:hf(this.visualElement),element:this.visualElement.current})}stop(e,t){let r=e||this.latestPointerEvent,n=t||this.latestPanInfo,s=this.isDragging;if(this.cancel(),!s||!n||!r)return;let{velocity:i}=n;this.startAnimation(i);let{onDragEnd:a}=this.getProps();a&&ce.postRender(()=>a(r,n))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,r){let{drag:n}=this.getProps();if(!r||!hT(e,n,this.currentDirection))return;let s=this.getAxisMotionValue(e),i=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(i=function(e,{min:t,max:r},n){return void 0!==t&&e<t?e=n?cQ(t,e,n.min):Math.max(e,t):void 0!==r&&e>r&&(e=n?cQ(r,e,n.max):Math.min(e,r)),e}(i,this.constraints[e],this.elastic[e])),s.set(i)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,n=this.constraints;e&&uM(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=function(e,{top:t,left:r,bottom:n,right:s}){return{x:hk(e.x,r,s),y:hk(e.y,t,n)}}(r.layoutBox,e):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:hS(e,"left","right"),y:hS(e,"top","bottom")}}(t),n!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&ht(e=>{var t,n;let s;!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=(t=r.layoutBox[e],n=this.constraints[e],s={},void 0!==n.min&&(s.min=n.min-t.min),void 0!==n.max&&(s.max=n.max-t.min),s))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!uM(t))return!1;let n=t.current;lO(null!==n,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");let{projection:s}=this.visualElement;if(!s||!s.layout)return!1;let i=function(e,t,r){let n=ua(e,r),{scroll:s}=t;return s&&(un(n.x,s.offset.x),un(n.y,s.offset.y)),n}(n,s.root,this.visualElement.getTransformPagePoint()),a=(e=s.layout.layoutBox,{x:hN(e.x,i.x),y:hN(e.y,i.y)});if(r){let e=r(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(a));this.hasMutatedConstraints=!!e,e&&(a=c4(e))}return a}startAnimation(e){let{drag:t,dragMomentum:r,dragElastic:n,dragTransition:s,dragSnapToOrigin:i,onDragTransitionEnd:a}=this.getProps(),o=this.constraints||{};return Promise.all(ht(a=>{if(!hT(a,t,this.currentDirection))return;let l=o&&o[a]||{};i&&(l={min:0,max:0});let c={type:"inertia",velocity:r?e[a]:0,bounceStiffness:n?200:1e6,bounceDamping:n?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...s,...l};return this.startAxisValueAnimation(a,c)})).then(a)}startAxisValueAnimation(e,t){let r=this.getAxisMotionValue(e);return uF(this.visualElement,e),r.start(d0(e,r,0,t,this.visualElement,!1))}stopAnimation(){ht(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){ht(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps();return r[t]||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){ht(t=>{let{drag:r}=this.getProps();if(!hT(t,r,this.currentDirection))return;let{projection:n}=this.visualElement,s=this.getAxisMotionValue(t);if(n&&n.layout){let{min:r,max:i}=n.layout.layoutBox[t],a=s.get()||0;s.set(e[t]-cQ(r,i,.5)+a)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!uM(t)||!r||!this.constraints)return;this.stopAnimation();let n={x:0,y:0};ht(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){var r,s;let i,a,o,l=t.get();n[e]=(r={min:l,max:l},s=this.constraints[e],i=.5,a=ha(r),(o=ha(s))>a?i=dC(s.min,s.max-a,r.min):a>o&&(i=dC(r.min,r.max-o,s.min)),o0(0,1,i))}});let{transformTemplate:s}=this.visualElement.getProps();this.visualElement.current.style.transform=s?s({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),ht(t=>{if(!hT(t,e,null))return;let r=this.getAxisMotionValue(t),{min:s,max:i}=this.constraints[t];r.set(cQ(s,i,n[t]))})}addListeners(){if(!this.visualElement.current)return;hA.set(this.visualElement,this);let e=this.visualElement.current,t=hp(e,"pointerdown",t=>{let{drag:r,dragListener:n=!0}=this.getProps(),s=t.target,i=s!==e&&hn(s);r&&n&&!i&&this.start(t)}),r=()=>{let{dragConstraints:e}=this.getProps();uM(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,s=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),ce.read(r);let i=hs(window,"resize",()=>this.scalePositionWithinConstraints()),a=n.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(ht(t=>{let r=this.getAxisMotionValue(t);r&&(this.originPoint[t]+=e[t].translate,r.set(r.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),t(),s(),a&&a()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:n=!1,dragConstraints:s=!1,dragElastic:i=.35,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:n,dragConstraints:s,dragElastic:i,dragMomentum:a}}}function hT(e,t,r){return(!0===t||t===e)&&(null===r||r===e)}let hE=e=>(t,r)=>{e&&ce.postRender(()=>e(t,r))},hP={hasAnimatedSinceResize:!0,hasEverUpdated:!1};var hR=b;let hM=!1;class hI extends hR.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:n}=this.props,{projection:s}=e;s&&(t.group&&t.group.add(s),r&&r.register&&n&&r.register(s),hM&&s.root.didUpdate(),s.addEventListener("animationComplete",()=>{this.safeToRemove()}),s.setOptions({...s.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),hP.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:r,drag:n,isPresent:s}=this.props,{projection:i}=r;return i&&(i.isPresent=s,e.layoutDependency!==t&&i.setOptions({...i.options,layoutDependency:t}),hM=!0,n||e.layoutDependency!==t||void 0===t||e.isPresent!==s?i.willUpdate():this.safeToRemove(),e.isPresent!==s&&(s?i.promote():i.relegate()||ce.postRender(()=>{let e=i.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),cx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:n}=e;hM=!0,n&&(n.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(n),r&&r.deregister&&r.deregister(n))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function hL(e){let[t,r]=function(e=!0){let t=(0,b.useContext)(uj);if(null===t)return[!0,null];let{isPresent:r,onExitComplete:n,register:s}=t,i=(0,b.useId)();(0,b.useEffect)(()=>{if(e)return s(i)},[e]);let a=(0,b.useCallback)(()=>e&&n&&n(i),[i,n,e]);return!r&&n?[!1,a]:[!0]}(),n=(0,hR.useContext)(uu);return(0,v.jsx)(hI,{...e,layoutGroup:n,switchLayoutGroup:(0,hR.useContext)(uR),isPresent:t,safeToRemove:r})}function hD(e,t,r,n,s){return e-=t,e=n+1/r*(e-n),void 0!==s&&(e=n+1/s*(e-n)),e}function hz(e,t,[r,n,s],i,a){!function(e,t=0,r=1,n=.5,s,i=e,a=e){if(ls.test(t)&&(t=parseFloat(t),t=cQ(a.min,a.max,t/100)-a.min),"number"!=typeof t)return;let o=cQ(i.min,i.max,n);e===i&&(o-=t),e.min=hD(e.min,t,r,o,s),e.max=hD(e.max,t,r,o,s)}(e,t[r],t[n],t[s],t.scale,i,a)}let hO=["x","scaleX","originX"],hB=["y","scaleY","originY"];function hF(e,t,r,n){hz(e.x,t,hO,r?r.x:void 0,n?n.x:void 0),hz(e.y,t,hB,r?r.y:void 0,n?n.y:void 0)}function h$(e,t){e.min=t.min,e.max=t.max}function hV(e,t){h$(e.x,t.x),h$(e.y,t.y)}function hU(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function hW(e){return 0===e.translate&&1===e.scale}function hG(e){return hW(e.x)&&hW(e.y)}function hq(e,t){return e.min===t.min&&e.max===t.max}function hH(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function hK(e,t){return hH(e.x,t.x)&&hH(e.y,t.y)}function hX(e){return ha(e.x)/ha(e.y)}function hY(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}let hJ=["TopLeft","TopRight","BottomLeft","BottomRight"],hZ=hJ.length,hQ=e=>"string"==typeof e?parseFloat(e):e,h0=e=>"number"==typeof e||li.test(e);function h1(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let h2=h3(0,.5,dw),h5=h3(.5,.95,l6);function h3(e,t,r){return n=>n<e?0:n>t?1:r(dC(e,t,n))}function h4(e){return"object"==typeof e&&null!==e}function h6(e){return h4(e)&&"ownerSVGElement"in e}let h8=(e,t)=>e.depth-t.depth;class h9{constructor(){this.children=[],this.isDirty=!1}add(e){cp(this.children,e),this.isDirty=!0}remove(e){cf(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(h8),this.isDirty=!1,this.children.forEach(e)}}class h7{constructor(){this.members=[]}add(e){cp(this.members,e),e.scheduleRender()}remove(e){if(cf(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,r=this.members.findIndex(t=>e===t);if(0===r)return!1;for(let e=r;e>=0;e--){let r=this.members[e];if(!1!==r.isPresent){t=r;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();let n=r.options.layoutDependency,s=e.options.layoutDependency;(void 0===n||void 0===s||n!==s)&&(e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0));let{crossfade:i}=e.options;!1===i&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let me=["","X","Y","Z"],mt=0;function mr(e,t,r,n){let{latestValues:s}=t;s[e]&&(r[e]=s[e],t.setStaticValue(e,0),n&&(n[e]=0))}function mn({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(e={},r=t?.()){this.id=mt++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(ma),this.nodes.forEach(mm),this.nodes.forEach(mp),this.nodes.forEach(mo)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=r?r.root||r:this,this.path=r?[...r.path,r]:[],this.parent=r,this.depth=r?r.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new h9)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new cg),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let r=this.eventHandlers.get(e);r&&r.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=h6(t)&&!(h6(t)&&"svg"===t.tagName),this.instance=t;let{layoutId:r,layout:n,visualElement:s}=this.options;if(s&&!s.current&&s.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(n||r)&&(this.isLayoutDirty=!0),e){let r,n=0,s=()=>this.root.updateBlockedByResize=!1;ce.read(()=>{n=window.innerWidth}),e(t,()=>{let e=window.innerWidth;if(e!==n){let t,i;n=e,this.root.updateBlockedByResize=!0,r&&r(),t=cv.now(),i=({timestamp:e})=>{let r=e-t;r>=250&&(ct(i),s(r-250))},ce.setup(i,!0),r=()=>ct(i),hP.hasAnimatedSinceResize&&(hP.hasAnimatedSinceResize=!1,this.nodes.forEach(mh))}})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&s&&(r||n)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:r,layout:n})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let i=this.options.transition||s.getDefaultTransition()||mb,{onLayoutAnimationStart:a,onLayoutAnimationComplete:o}=s.getProps(),l=!this.targetLayout||!hK(this.targetLayout,n),c=!t&&r;if(this.options.layoutRoot||this.resumeFrom||c||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...uO(i,"layout"),onPlay:a,onComplete:o};(s.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,c)}else t||mh(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=n})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),ct(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(mf),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:r}=t.options;if(!r)return;let n=r.props[uP];if(window.MotionHasOptimisedAnimation(n,"transform")){let{layout:e,layoutId:r}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",ce,!(e||r))}let{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&e(s)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:r}=this.options;if(void 0===t&&!r)return;let n=this.getTransformTemplate();this.prevTransformTemplateValue=n?n(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(mc);return}if(this.animationId<=this.animationCommitId)return void this.nodes.forEach(mu);this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(md),this.nodes.forEach(ms),this.nodes.forEach(mi)):this.nodes.forEach(mu),this.clearAllSnapshots();let e=cv.now();cr.delta=o0(0,1e3/60,e-cr.timestamp),cr.timestamp=e,cr.isProcessing=!0,cn.update.process(cr),cn.preRender.process(cr),cn.render.process(cr),cr.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,cx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(ml),this.sharedNodes.forEach(mg)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ce.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ce.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure(),!this.snapshot||ha(this.snapshot.measuredBox.x)||ha(this.snapshot.measuredBox.y)||(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=lP(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=n(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!s)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!hG(this.projectionDelta),r=this.getTransformTemplate(),n=r?r(this.latestValues,""):void 0,i=n!==this.prevTransformTemplateValue;e&&this.instance&&(t||c9(this.latestValues)||i)&&(s(this.instance,n),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let r=this.measurePageBox(),n=this.removeElementScroll(r);return e&&(n=this.removeTransform(n)),mk((t=n).x),mk(t.y),{animationId:this.root.animationId,measuredBox:r,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return lP();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(mS))){let{scroll:e}=this.root;e&&(un(t.x,e.offset.x),un(t.y,e.offset.y))}return t}removeElementScroll(e){let t=lP();if(hV(t,e),this.scroll?.wasRoot)return t;for(let r=0;r<this.path.length;r++){let n=this.path[r],{scroll:s,options:i}=n;n!==this.root&&s&&i.layoutScroll&&(s.wasRoot&&hV(t,e),un(t.x,s.offset.x),un(t.y,s.offset.y))}return t}applyTransform(e,t=!1){let r=lP();hV(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&ui(r,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),c9(n.latestValues)&&ui(r,n.latestValues)}return c9(this.latestValues)&&ui(r,this.latestValues),r}removeTransform(e){let t=lP();hV(t,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];if(!r.instance||!c9(r.latestValues))continue;c8(r.latestValues)&&r.updateSnapshot();let n=lP();hV(n,r.measurePageBox()),hF(t,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,n)}return c9(this.latestValues)&&hF(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==cr.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=t.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=t.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=t.isSharedProjectionDirty);let r=!!this.resumingFrom||this!==t;if(!(e||r&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:n,layoutId:s}=this.options;if(!this.layout||!(n||s))return;this.resolvedRelativeTargetAt=cr.timestamp;let i=this.getClosestProjectingParent();if(i&&this.linkedParentVersion!==i.layoutVersion&&!i.options.layoutRoot&&this.removeRelativeTarget(),this.targetDelta||this.relativeTarget||(i&&i.layout?this.createRelativeTarget(i,this.layout.layoutBox,i.layout.layoutBox):this.removeRelativeTarget()),this.relativeTarget||this.targetDelta){if(this.target||(this.target=lP(),this.targetWithTransforms=lP()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target){var a,o,l;this.forceRelativeParentToResolveTarget(),a=this.target,o=this.relativeTarget,l=this.relativeParent.target,hc(a.x,o.x,l.x),hc(a.y,o.y,l.y)}else this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hV(this.target,this.layout.layoutBox),ur(this.target,this.targetDelta)):hV(this.target,this.layout.layoutBox);this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,i&&!!i.resumingFrom==!!this.resumingFrom&&!i.options.layoutScroll&&i.target&&1!==this.animationProgress?this.createRelativeTarget(i,this.target,i.target):this.relativeParent=this.relativeTarget=void 0)}}getClosestProjectingParent(){if(!(!this.parent||c8(this.parent.latestValues)||c7(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,r){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lP(),this.relativeTargetOrigin=lP(),hd(this.relativeTargetOrigin,t,r),hV(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,r=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(r=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===cr.timestamp&&(r=!1),r)return;let{layout:n,layoutId:s}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(n||s))return;hV(this.layoutCorrected,this.layout.layoutBox);let i=this.treeScale.x,a=this.treeScale.y;!function(e,t,r,n=!1){let s,i,a=r.length;if(a){t.x=t.y=1;for(let o=0;o<a;o++){i=(s=r[o]).projectionDelta;let{visualElement:a}=s.options;(!a||!a.props.style||"contents"!==a.props.style.display)&&(n&&s.options.layoutScroll&&s.scroll&&s!==s.root&&ui(e,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,ur(e,i)),n&&c9(s.latestValues)&&ui(e,s.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=lP());let{target:o}=e;if(!o){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(hU(this.prevProjectionDelta.x,this.projectionDelta.x),hU(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),hl(this.projectionDelta,this.layoutCorrected,o,this.latestValues),this.treeScale.x===i&&this.treeScale.y===a&&hY(this.projectionDelta.x,this.prevProjectionDelta.x)&&hY(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",o))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lT(),this.projectionDelta=lT(),this.projectionDeltaWithTransform=lT()}setAnimationOrigin(e,t=!1){let r,n=this.snapshot,s=n?n.latestValues:{},i={...this.latestValues},a=lT();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let o=lP(),l=(n?n.source:void 0)!==(this.layout?this.layout.source:void 0),c=this.getStack(),u=!c||c.members.length<=1,d=!!(l&&!u&&!0===this.options.crossfade&&!this.path.some(mv));this.animationProgress=0,this.mixTargetDelta=t=>{let n=t/1e3;if(mx(a.x,e.x,n),mx(a.y,e.y,n),this.setTargetDelta(a),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var c,h,m,p,f,g;hd(o,this.layout.layoutBox,this.relativeParent.layout.layoutBox),m=this.relativeTarget,p=this.relativeTargetOrigin,f=o,g=n,my(m.x,p.x,f.x,g),my(m.y,p.y,f.y,g),r&&(c=this.relativeTarget,h=r,hq(c.x,h.x)&&hq(c.y,h.y))&&(this.isProjectionDirty=!1),r||(r=lP()),hV(r,this.relativeTarget)}l&&(this.animationValues=i,function(e,t,r,n,s,i){s?(e.opacity=cQ(0,r.opacity??1,h2(n)),e.opacityExit=cQ(t.opacity??1,0,h5(n))):i&&(e.opacity=cQ(t.opacity??1,r.opacity??1,n));for(let s=0;s<hZ;s++){let i=`border${hJ[s]}Radius`,a=h1(t,i),o=h1(r,i);(void 0!==a||void 0!==o)&&(a||(a=0),o||(o=0),0===a||0===o||h0(a)===h0(o)?(e[i]=Math.max(cQ(hQ(a),hQ(o),n),0),(ls.test(o)||ls.test(a))&&(e[i]+="%")):e[i]=o)}(t.rotate||r.rotate)&&(e.rotate=cQ(t.rotate||0,r.rotate||0,n))}(i,s,this.latestValues,n,d,u)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(ct(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ce.update(()=>{var t,r,n;let s;hP.hasAnimatedSinceResize=!0,uW.layout++,this.motionValue||(this.motionValue=cw(0)),this.currentAnimation=(t=this.motionValue,r=[0,1e3],n={...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onStop:()=>{uW.layout--},onComplete:()=>{uW.layout--,e.onComplete&&e.onComplete(),this.completeAnimation()}},(s=lR(t)?t:cw(t)).start(d0("",s,r,n)),s.animation),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:r,layout:n,latestValues:s}=e;if(t&&r&&n){if(this!==e&&this.layout&&n&&mN(this.options.animationType,this.layout.layoutBox,n.layoutBox)){r=this.target||lP();let t=ha(this.layout.layoutBox.x);r.x.min=e.target.x.min,r.x.max=r.x.min+t;let n=ha(this.layout.layoutBox.y);r.y.min=e.target.y.min,r.y.max=r.y.min+n}hV(t,r),ui(t,s),hl(this.projectionDeltaWithTransform,this.layoutCorrected,t,s)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new h7),this.sharedNodes.get(e).add(t);let r=t.options.initialPromotionConfig;t.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:r}={}){let n=this.getStack();n&&n.promote(this,r),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:r}=e;if((r.z||r.rotate||r.rotateX||r.rotateY||r.rotateZ||r.skewX||r.skewY)&&(t=!0),!t)return;let n={};r.z&&mr("z",e,n,this.animationValues);for(let t=0;t<me.length;t++)mr(`rotate${me[t]}`,e,n,this.animationValues),mr(`skew${me[t]}`,e,n,this.animationValues);for(let t in e.render(),n)e.setStaticValue(t,n[t]),this.animationValues&&(this.animationValues[t]=n[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility="hidden";return}let r=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility="",e.opacity="",e.pointerEvents=uw(t?.pointerEvents)||"",e.transform=r?r(this.latestValues,""):"none";return}let n=this.getLead();if(!this.projectionDelta||!this.layout||!n.target){this.options.layoutId&&(e.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,e.pointerEvents=uw(t?.pointerEvents)||""),this.hasProjected&&!c9(this.latestValues)&&(e.transform=r?r({},""):"none",this.hasProjected=!1);return}e.visibility="";let s=n.animationValues||n.latestValues;this.applyTransformsToTarget();let i=function(e,t,r){let n="",s=e.x.translate/t.x,i=e.y.translate/t.y,a=r?.z||0;if((s||i||a)&&(n=`translate3d(${s}px, ${i}px, ${a}px) `),(1!==t.x||1!==t.y)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){let{transformPerspective:e,rotate:t,rotateX:s,rotateY:i,skewX:a,skewY:o}=r;e&&(n=`perspective(${e}px) ${n}`),t&&(n+=`rotate(${t}deg) `),s&&(n+=`rotateX(${s}deg) `),i&&(n+=`rotateY(${i}deg) `),a&&(n+=`skewX(${a}deg) `),o&&(n+=`skewY(${o}deg) `)}let o=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==o||1!==l)&&(n+=`scale(${o}, ${l})`),n||"none"}(this.projectionDeltaWithTransform,this.treeScale,s);r&&(i=r(s,i)),e.transform=i;let{x:a,y:o}=this.projectionDelta;for(let t in e.transformOrigin=`${100*a.origin}% ${100*o.origin}% 0`,n.animationValues?e.opacity=n===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:e.opacity=n===this?void 0!==s.opacity?s.opacity:"":void 0!==s.opacityExit?s.opacityExit:0,c0){if(void 0===s[t])continue;let{correct:r,applyTo:a,isCSSVariable:o}=c0[t],l="none"===i?s[t]:r(s[t],n);if(a){let t=a.length;for(let r=0;r<t;r++)e[a[r]]=l}else o?this.options.visualElement.renderState.vars[t]=l:e[t]=l}this.options.layoutId&&(e.pointerEvents=n===this?uw(t?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(mc),this.root.sharedNodes.clear()}}}function ms(e){e.updateLayout()}function mi(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){let{layoutBox:r,measuredBox:n}=e.layout,{animationType:s}=e.options,i=t.source!==e.layout.source;"size"===s?ht(e=>{let n=i?t.measuredBox[e]:t.layoutBox[e],s=ha(n);n.min=r[e].min,n.max=n.min+s}):mN(s,t.layoutBox,r)&&ht(n=>{let s=i?t.measuredBox[n]:t.layoutBox[n],a=ha(r[n]);s.max=s.min+a,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[n].max=e.relativeTarget[n].min+a)});let a=lT();hl(a,r,t.layoutBox);let o=lT();i?hl(o,e.applyTransform(n,!0),t.measuredBox):hl(o,r,t.layoutBox);let l=!hG(a),c=!1;if(!e.resumeFrom){let n=e.getClosestProjectingParent();if(n&&!n.resumeFrom){let{snapshot:s,layout:i}=n;if(s&&i){let a=lP();hd(a,t.layoutBox,s.layoutBox);let o=lP();hd(o,r,i.layoutBox),hK(a,o)||(c=!0),n.options.layoutRoot&&(e.relativeTarget=o,e.relativeTargetOrigin=a,e.relativeParent=n)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:o,layoutDelta:a,hasLayoutChanged:l,hasRelativeLayoutChanged:c})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function ma(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function mo(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function ml(e){e.clearSnapshot()}function mc(e){e.clearMeasurements()}function mu(e){e.isLayoutDirty=!1}function md(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function mh(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function mm(e){e.resolveTargetDelta()}function mp(e){e.calcProjection()}function mf(e){e.resetSkewAndRotation()}function mg(e){e.removeLeadSnapshot()}function mx(e,t,r){e.translate=cQ(t.translate,0,r),e.scale=cQ(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function my(e,t,r,n){e.min=cQ(t.min,r.min,n),e.max=cQ(t.max,r.max,n)}function mv(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let mb={duration:.45,ease:[.4,0,.1,1]},mw=e=>"u">typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),mj=mw("applewebkit/")&&!mw("chrome/")?Math.round:l6;function mk(e){e.min=mj(e.min),e.max=mj(e.max)}function mN(e,t,r){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(hX(t)-hX(r)))}function mS(e){return e!==e.root&&e.scroll?.wasRoot}let mC=mn({attachResizeListener:(e,t)=>hs(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),mA={current:void 0},m_=mn({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!mA.current){let e=new mC({});e.mount(window),e.setOptions({layoutScroll:!0}),mA.current=e}return mA.current},resetTransform:(e,t)=>{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function mT(e,t){let r=function(e,t,r){if(null==e)return[];if(e instanceof EventTarget)return[e];if("string"==typeof e){let t=document,r=(void 0)??t.querySelectorAll(e);return r?Array.from(r):[]}return Array.from(e).filter(e=>null!=e)}(e),n=new AbortController;return[r,{passive:!0,...t,signal:n.signal},()=>n.abort()]}function mE(e){return!("touch"===e.pointerType||hi.x||hi.y)}function mP(e,t,r){let{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover","Start"===r);let s=n["onHover"+r];s&&ce.postRender(()=>s(t,hm(t)))}let mR=(e,t)=>!!t&&(e===t||mR(e,t.parentElement)),mM=new WeakSet;function mI(e){return t=>{"Enter"===t.key&&e(t)}}function mL(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function mD(e){return hh(e)&&!(hi.x||hi.y)}function mz(e,t,r){let{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap","Start"===r);let s=n["onTap"+("End"===r?"":r)];s&&ce.postRender(()=>s(t,hm(t)))}let mO=new WeakMap,mB=new WeakMap,mF=e=>{let t=mO.get(e.target);t&&t(e)},m$=e=>{e.forEach(mF)},mV={some:0,all:1},mU=function(e,t){if("u"<typeof Proxy)return uL;let r=new Map,n=(r,n)=>uL(r,n,e,t);return new Proxy((e,t)=>n(e,t),{get:(s,i)=>"create"===i?n:(r.has(i)||r.set(i,uL(i,void 0,e,t)),r.get(i))})}({animation:{Feature:class extends uD{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:r})=>(function(e,t,r={}){let n;if(e.notify("AnimationStart",t),Array.isArray(t))n=Promise.all(t.map(t=>d5(e,t,r)));else if("string"==typeof t)n=d5(e,t,r);else{let s="function"==typeof t?uz(e,t,r.custom):t;n=Promise.all(d1(e,s,r))}return n.then(()=>{e.notify("AnimationComplete",t)})})(e,t,r))),r=d7(),n=!0,s=t=>(r,n)=>{let s=uz(e,n,"exit"===t?e.presenceContext?.custom:void 0);if(s){let{transition:e,transitionEnd:t,...n}=s;r={...r,...n,...t}}return r};function i(i){let{props:a}=e,o=function e(t){if(!t)return;if(!t.isControllingVariants){let r=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(r.initial=t.props.initial),r}let r={};for(let e=0;e<d3;e++){let n=cE[e],s=t.props[n];(c_(s)||!1===s)&&(r[n]=s)}return r}(e.parent)||{},l=[],c=new Set,u={},d=1/0;for(let t=0;t<d8;t++){var h,m;let p=d6[t],f=r[p],g=void 0!==a[p]?a[p]:o[p],x=c_(g),y=p===i?f.isActive:null;!1===y&&(d=t);let v=g===o[p]&&g!==a[p]&&x;if(v&&n&&e.manuallyAnimateOnMount&&(v=!1),f.protectedKeys={...u},!f.isActive&&null===y||!g&&!f.prevProp||cA(g)||"boolean"==typeof g)continue;let b=(h=f.prevProp,"string"==typeof(m=g)?m!==h:!!Array.isArray(m)&&!d4(m,h)),w=b||p===i&&f.isActive&&!v&&x||t>d&&x,j=!1,k=Array.isArray(g)?g:[g],N=k.reduce(s(p),{});!1===y&&(N={});let{prevResolvedValues:S={}}=f,C={...S,...N},A=t=>{w=!0,c.has(t)&&(j=!0,c.delete(t)),f.needsAnimating[t]=!0;let r=e.getValue(t);r&&(r.liveStyle=!1)};for(let e in C){let t=N[e],r=S[e];if(!u.hasOwnProperty(e))(uB(t)&&uB(r)?d4(t,r):t===r)?void 0!==t&&c.has(e)?A(e):f.protectedKeys[e]=!0:null!=t?A(e):c.add(e)}f.prevProp=g,f.prevResolvedValues=N,f.isActive&&(u={...u,...N}),n&&e.blockInitialAnimation&&(w=!1);let _=v&&b,T=!_||j;w&&T&&l.push(...k.map(t=>{let r={type:p};if("string"==typeof t&&n&&!_&&e.manuallyAnimateOnMount&&e.parent){let{parent:n}=e,s=uz(n,t);if(n.enteringChildren&&s){let{delayChildren:t}=s.transition||{};r.delay=d2(n.enteringChildren,e,t)}}return{animation:t,options:r}}))}if(c.size){let t={};if("boolean"!=typeof a.initial){let r=uz(e,Array.isArray(a.initial)?a.initial[0]:a.initial);r&&r.transition&&(t.transition=r.transition)}c.forEach(r=>{let n=e.getBaseTarget(r),s=e.getValue(r);s&&(s.liveStyle=!0),t[r]=n??null}),l.push({animation:t})}let p=!!l.length;return n&&(!1===a.initial||a.initial===a.animate)&&!e.manuallyAnimateOnMount&&(p=!1),n=!1,p?t(l):Promise.resolve()}return{animateChanges:i,setActive:function(t,n){if(r[t].isActive===n)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,n)),r[t].isActive=n;let s=i(t);for(let e in r)r[e].protectedKeys={};return s},setAnimateFunction:function(r){t=r(e)},getState:()=>r,reset:()=>{r=d7()}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();cA(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}},exit:{Feature:class extends uD{constructor(){super(...arguments),this.id=he++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let n=this.node.animationState.setActive("exit",!e);t&&!e&&n.then(()=>{t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}},inView:{Feature:class extends uD{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){var e;let t;this.unmount();let{viewport:r={}}=this.node.getProps(),{root:n,margin:s,amount:i="some",once:a}=r,o={root:n?n.current:void 0,rootMargin:s,threshold:"number"==typeof i?i:mV[i]},l=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,a&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:r,onViewportLeave:n}=this.node.getProps(),s=t?r:n;s&&s(e)};return e=this.node.current,t=function({root:e,...t}){let r=e||document;mB.has(r)||mB.set(r,{});let n=mB.get(r),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(m$,{root:e,...t})),n[s]}(o),mO.set(e,l),t.observe(e),()=>{mO.delete(e),t.unobserve(e)}}mount(){this.startObserver()}update(){if("u"<typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}(e,t))&&this.startObserver()}unmount(){}}},tap:{Feature:class extends uD{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,s,i]=mT(e,r),a=e=>{let n=e.currentTarget;if(!mD(e))return;mM.add(n);let i=t(n,e),a=(e,t)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),mM.has(n)&&mM.delete(n),mD(e)&&"function"==typeof i&&i(e,{success:t})},o=e=>{a(e,n===window||n===document||r.useGlobalTarget||mR(n,e.target))},l=e=>{a(e,!1)};window.addEventListener("pointerup",o,s),window.addEventListener("pointercancel",l,s)};return n.forEach(e=>{(r.useGlobalTarget?window:e).addEventListener("pointerdown",a,s),h4(e)&&"offsetHeight"in e&&(e.addEventListener("focus",e=>((e,t)=>{let r=e.currentTarget;if(!r)return;let n=mI(()=>{if(mM.has(r))return;mL(r,"down");let e=mI(()=>{mL(r,"up")});r.addEventListener("keyup",e,t),r.addEventListener("blur",()=>mL(r,"cancel"),t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)})(e,s)),hn(e)||e.hasAttribute("tabindex")||(e.tabIndex=0))}),i}(e,(e,t)=>(mz(this.node,t,"Start"),(e,{success:t})=>mz(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}},focus:{Feature:class extends uD{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=uU(hs(this.node.current,"focus",()=>this.onFocus()),hs(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}},hover:{Feature:class extends uD{mount(){let{current:e}=this.node;e&&(this.unmount=function(e,t,r={}){let[n,s,i]=mT(e,r),a=e=>{if(!mE(e))return;let{target:r}=e,n=t(r,e);if("function"!=typeof n||!r)return;let i=e=>{mE(e)&&(n(e),r.removeEventListener("pointerleave",i))};r.addEventListener("pointerleave",i,s)};return n.forEach(e=>{e.addEventListener("pointerenter",a,s)}),i}(e,(e,t)=>(mP(this.node,t,"Start"),e=>mP(this.node,e,"End"))))}unmount(){}}},pan:{Feature:class extends uD{constructor(){super(...arguments),this.removePointerDownListener=l6}onPointerDown(e){this.session=new hy(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:hf(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:n}=this.node.getProps();return{onSessionStart:hE(e),onStart:hE(t),onMove:r,onEnd:(e,t)=>{delete this.session,n&&ce.postRender(()=>n(e,t))}}}mount(){this.removePointerDownListener=hp(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}},drag:{Feature:class extends uD{constructor(e){super(e),this.removeGroupControls=l6,this.removeListeners=l6,this.controls=new h_(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||l6}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},ProjectionNode:m_,MeasureLayout:hL},layout:{ProjectionNode:m_,MeasureLayout:hL}},(e,t)=>t.isSVG??uc(e)?new c3(t):new uo(t,{allowProjection:e!==b.Fragment})),mW=(0,b.memo)(({children:e,as:t="p",className:r,duration:n=2,spread:s=2})=>{let i=mU.create(t),a=(0,b.useMemo)(()=>(e?.length??0)*s,[e,s]);return(0,v.jsx)(i,{animate:{backgroundPosition:"0% center"},className:(0,k.cn)("relative inline-block bg-[length:250%_100%,auto] bg-clip-text text-transparent","[--bg:linear-gradient(90deg,#0000_calc(50%-var(--spread)),var(--color-background),#0000_calc(50%+var(--spread)))] [background-repeat:no-repeat,padding-box]",r),initial:{backgroundPosition:"100% center"},style:{"--spread":`${a}px`,backgroundImage:"var(--bg), linear-gradient(var(--color-muted-foreground), var(--color-muted-foreground))"},transition:{repeat:1/0,duration:n,ease:"linear"},children:e})}),mG=(0,b.createContext)(null),mq=(0,b.memo)(({className:e,isStreaming:t=!1,open:r,defaultOpen:n=!0,onOpenChange:s,duration:i,children:a,...o})=>{let[l,c]=(0,aH.useControllableState)({prop:r,defaultProp:n,onChange:s}),[u,d]=(0,aH.useControllableState)({prop:i,defaultProp:void 0}),[h,m]=(0,b.useState)(!1),[p,f]=(0,b.useState)(null);return(0,b.useEffect)(()=>{t?null===p&&f(Date.now()):null!==p&&(d(Math.ceil((Date.now()-p)/1e3)),f(null))},[t,p,d]),(0,b.useEffect)(()=>{if(n&&!t&&l&&!h){let e=setTimeout(()=>{c(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,n,c,h]),(0,v.jsx)(mG.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:c,duration:u},children:(0,v.jsx)(on,{className:(0,k.cn)("not-prose mb-4",e),onOpenChange:e=>{c(e)},open:l,...o,children:a})})}),mH=(e,t)=>e||0===t?(0,v.jsx)(mW,{duration:1,children:"Thinking..."}):void 0===t?(0,v.jsx)("p",{children:"Thought for a few seconds"}):(0,v.jsxs)("p",{children:["Thought for ",t," seconds"]}),mK=(0,b.memo)(({className:e,children:t,getThinkingMessage:r=mH,...n})=>{let{isStreaming:s,isOpen:i,duration:a}=(()=>{let e=(0,b.useContext)(mG);if(!e)throw Error("Reasoning components must be used within Reasoning");return e})();return(0,v.jsx)(os,{className:(0,k.cn)("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:t??(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oJ,{className:"size-4"}),r(s,a),(0,v.jsx)(oo.ChevronDownIcon,{className:(0,k.cn)("size-4 transition-transform",i?"rotate-180":"rotate-0")})]})})}),mX=(0,b.memo)(({className:e,children:t,...r})=>(0,v.jsx)(oi,{className:(0,k.cn)("mt-4 text-sm","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...r,children:(0,v.jsx)(aB.j,{plugins:{code:nr,mermaid:aM,math:nD,cjk:ef},linkSafety:{enabled:!0,renderModal:aW},...r,children:t})}));mq.displayName="Reasoning",mK.displayName="ReasoningTrigger",mX.displayName="ReasoningContent";var mY=/[\\\/_+.#"@\[\(\{&]/,mJ=/[\\\/_+.#"@\[\(\{&]/g,mZ=/[\s-]/,mQ=/[\s-]/g;function m0(e){return e.toLowerCase().replace(mQ," ")}var m1=e.i(7631),m2=e.i(408744),m5='[cmdk-group=""]',m3='[cmdk-group-items=""]',m4='[cmdk-item=""]',m6=`${m4}:not([aria-disabled="true"])`,m8="cmdk-item-select",m9="data-value",m7=(e,t,r)=>{var n;return n=e,function e(t,r,n,s,i,a,o){if(a===r.length)return i===t.length?1:.99;var l=`${i},${a}`;if(void 0!==o[l])return o[l];for(var c,u,d,h,m=s.charAt(a),p=n.indexOf(m,i),f=0;p>=0;)(c=e(t,r,n,s,p+1,a+1,o))>f&&(p===i?c*=1:mY.test(t.charAt(p-1))?(c*=.8,(d=t.slice(i,p-1).match(mJ))&&i>0&&(c*=Math.pow(.999,d.length))):mZ.test(t.charAt(p-1))?(c*=.9,(h=t.slice(i,p-1).match(mQ))&&i>0&&(c*=Math.pow(.999,h.length))):(c*=.17,i>0&&(c*=Math.pow(.999,p-i))),t.charAt(p)!==r.charAt(a)&&(c*=.9999)),(c<.1&&n.charAt(p-1)===s.charAt(a+1)||s.charAt(a+1)===s.charAt(a)&&n.charAt(p-1)!==s.charAt(a))&&.1*(u=e(t,r,n,s,p+1,a+2,o))>c&&(c=.1*u),c>f&&(f=c),p=n.indexOf(m,p+1);return o[l]=f,f}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,m0(n),m0(t),0,0,{})},pe=b.createContext(void 0),pt=b.createContext(void 0),pr=b.createContext(void 0),pn=b.forwardRef((e,t)=>{let r=pm(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),n=pm(()=>new Set),s=pm(()=>new Map),i=pm(()=>new Map),a=pm(()=>new Set),o=pd(e),{label:l,children:c,value:u,onValueChange:d,filter:h,shouldFilter:m,loop:p,disablePointerSelection:f=!1,vimBindings:g=!0,...x}=e,y=(0,a0.useId)(),v=(0,a0.useId)(),w=(0,a0.useId)(),j=b.useRef(null),k=pg();ph(()=>{if(void 0!==u){let e=u.trim();r.current.value=e,N.emit()}},[u]),ph(()=>{k(6,E)},[]);let N=b.useMemo(()=>({subscribe:e=>(a.current.add(e),()=>a.current.delete(e)),snapshot:()=>r.current,setState:(e,t,n)=>{var s,i,a,l;if(!Object.is(r.current[e],t)){if(r.current[e]=t,"search"===e)T(),A(),k(1,_);else if("value"===e){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let e=document.getElementById(w);e?e.focus():null==(s=document.getElementById(y))||s.focus()}if(k(7,()=>{var e;r.current.selectedItemId=null==(e=P())?void 0:e.id,N.emit()}),n||k(5,E),(null==(i=o.current)?void 0:i.value)!==void 0){null==(l=(a=o.current).onValueChange)||l.call(a,null!=t?t:"");return}}N.emit()}},emit:()=>{a.current.forEach(e=>e())}}),[]),S=b.useMemo(()=>({value:(e,t,n)=>{var s;t!==(null==(s=i.current.get(e))?void 0:s.value)&&(i.current.set(e,{value:t,keywords:n}),r.current.filtered.items.set(e,C(t,n)),k(2,()=>{A(),N.emit()}))},item:(e,t)=>(n.current.add(e),t&&(s.current.has(t)?s.current.get(t).add(e):s.current.set(t,new Set([e]))),k(3,()=>{T(),A(),r.current.value||_(),N.emit()}),()=>{i.current.delete(e),n.current.delete(e),r.current.filtered.items.delete(e);let t=P();k(4,()=>{T(),(null==t?void 0:t.getAttribute("id"))===e&&_(),N.emit()})}),group:e=>(s.current.has(e)||s.current.set(e,new Set),()=>{i.current.delete(e),s.current.delete(e)}),filter:()=>o.current.shouldFilter,label:l||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:y,inputId:w,labelId:v,listInnerRef:j}),[]);function C(e,t){var n,s;let i=null!=(s=null==(n=o.current)?void 0:n.filter)?s:m7;return e?i(e,r.current.search,t):0}function A(){if(!r.current.search||!1===o.current.shouldFilter)return;let e=r.current.filtered.items,t=[];r.current.filtered.groups.forEach(r=>{let n=s.current.get(r),i=0;n.forEach(t=>{i=Math.max(e.get(t),i)}),t.push([r,i])});let n=j.current;R().sort((t,r)=>{var n,s;let i=t.getAttribute("id"),a=r.getAttribute("id");return(null!=(n=e.get(a))?n:0)-(null!=(s=e.get(i))?s:0)}).forEach(e=>{let t=e.closest(m3);t?t.appendChild(e.parentElement===t?e:e.closest(`${m3} > *`)):n.appendChild(e.parentElement===n?e:e.closest(`${m3} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=j.current)?void 0:t.querySelector(`${m5}[${m9}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function _(){let e=R().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(m9);N.setState("value",t||void 0)}function T(){var e,t,a,l;if(!r.current.search||!1===o.current.shouldFilter){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let c=0;for(let s of n.current){let n=C(null!=(t=null==(e=i.current.get(s))?void 0:e.value)?t:"",null!=(l=null==(a=i.current.get(s))?void 0:a.keywords)?l:[]);r.current.filtered.items.set(s,n),n>0&&c++}for(let[e,t]of s.current)for(let n of t)if(r.current.filtered.items.get(n)>0){r.current.filtered.groups.add(e);break}r.current.filtered.count=c}function E(){var e,t,r;let n=P();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(m5))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function P(){var e;return null==(e=j.current)?void 0:e.querySelector(`${m4}[aria-selected="true"]`)}function R(){var e;return Array.from((null==(e=j.current)?void 0:e.querySelectorAll(m6))||[])}function M(e){let t=R()[e];t&&N.setState("value",t.getAttribute(m9))}function I(e){var t;let r=P(),n=R(),s=n.findIndex(e=>e===r),i=n[s+e];null!=(t=o.current)&&t.loop&&(i=s+e<0?n[n.length-1]:s+e===n.length?n[0]:n[s+e]),i&&N.setState("value",i.getAttribute(m9))}function L(e){let t=P(),r=null==t?void 0:t.closest(m5),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,m5):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,m5))?void 0:r.querySelector(m6);n?N.setState("value",n.getAttribute(m9)):I(e)}let D=()=>M(R().length-1),z=e=>{e.preventDefault(),e.metaKey?D():e.altKey?L(1):I(1)},O=e=>{e.preventDefault(),e.metaKey?M(0):e.altKey?L(-1):I(-1)};return b.createElement(m2.Primitive.div,{ref:t,tabIndex:-1,...x,"cmdk-root":"",onKeyDown:e=>{var t;null==(t=x.onKeyDown)||t.call(x,e);let r=e.nativeEvent.isComposing||229===e.keyCode;if(!(e.defaultPrevented||r))switch(e.key){case"n":case"j":g&&e.ctrlKey&&z(e);break;case"ArrowDown":z(e);break;case"p":case"k":g&&e.ctrlKey&&O(e);break;case"ArrowUp":O(e);break;case"Home":e.preventDefault(),M(0);break;case"End":e.preventDefault(),D();break;case"Enter":{e.preventDefault();let t=P();if(t){let e=new Event(m8);t.dispatchEvent(e)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:S.inputId,id:S.labelId,style:py},l),px(e,e=>b.createElement(pt.Provider,{value:N},b.createElement(pe.Provider,{value:S},e))))}),ps=b.forwardRef((e,t)=>{var r,n;let s=(0,a0.useId)(),i=b.useRef(null),a=b.useContext(pr),o=b.useContext(pe),l=pd(e),c=null!=(n=null==(r=l.current)?void 0:r.forceMount)?n:null==a?void 0:a.forceMount;ph(()=>{if(!c)return o.item(s,null==a?void 0:a.id)},[c]);let u=pf(s,i,[e.value,e.children,i],e.keywords),d=b.useContext(pt),h=pp(e=>e.value&&e.value===u.current),m=pp(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(s)>0);function p(){var e,t;f(),null==(t=(e=l.current).onSelect)||t.call(e,u.current)}function f(){d.setState("value",u.current,!0)}if(b.useEffect(()=>{let t=i.current;if(!(!t||e.disabled))return t.addEventListener(m8,p),()=>t.removeEventListener(m8,p)},[m,e.onSelect,e.disabled]),!m)return null;let{disabled:g,value:x,onSelect:y,forceMount:v,keywords:w,...j}=e;return b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(i,t),...j,id:s,"cmdk-item":"",role:"option","aria-disabled":!!g,"aria-selected":!!h,"data-disabled":!!g,"data-selected":!!h,onPointerMove:g||o.getDisablePointerSelection()?void 0:f,onClick:g?void 0:p},e.children)}),pi=b.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,a=(0,a0.useId)(),o=b.useRef(null),l=b.useRef(null),c=(0,a0.useId)(),u=b.useContext(pe),d=pp(e=>!!s||!1===u.filter()||!e.search||e.filtered.groups.has(a));ph(()=>u.group(a),[]),pf(a,o,[e.value,e.heading,l]);let h=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(o,t),...i,"cmdk-group":"",role:"presentation",hidden:!d||void 0},r&&b.createElement("div",{ref:l,"cmdk-group-heading":"","aria-hidden":!0,id:c},r),px(e,e=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?c:void 0},b.createElement(pr.Provider,{value:h},e))))}),pa=b.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=b.useRef(null),i=pp(e=>!e.search);return r||i?b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(s,t),...n,"cmdk-separator":"",role:"separator"}):null}),po=b.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=null!=e.value,i=b.useContext(pt),a=pp(e=>e.search),o=pp(e=>e.selectedItemId),l=b.useContext(pe);return b.useEffect(()=>{null!=e.value&&i.setState("search",e.value)},[e.value]),b.createElement(m2.Primitive.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":l.listId,"aria-labelledby":l.labelId,"aria-activedescendant":o,id:l.inputId,type:"text",value:s?e.value:a,onChange:e=>{s||i.setState("search",e.target.value),null==r||r(e.target.value)}})}),pl=b.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=b.useRef(null),a=b.useRef(null),o=pp(e=>e.selectedItemId),l=b.useContext(pe);return b.useEffect(()=>{if(a.current&&i.current){let e=a.current,t=i.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),b.createElement(m2.Primitive.div,{ref:(0,aX.composeRefs)(i,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":n,id:l.listId},px(e,e=>b.createElement("div",{ref:(0,aX.composeRefs)(a,l.listInnerRef),"cmdk-list-sizer":""},e)))}),pc=b.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:a,...o}=e;return b.createElement(m1.Root,{open:r,onOpenChange:n},b.createElement(m1.Portal,{container:a},b.createElement(m1.Overlay,{"cmdk-overlay":"",className:s}),b.createElement(m1.Content,{"aria-label":e.label,"cmdk-dialog":"",className:i},b.createElement(pn,{ref:t,...o}))))}),pu=Object.assign(pn,{List:pl,Item:ps,Input:po,Group:pi,Separator:pa,Dialog:pc,Empty:b.forwardRef((e,t)=>pp(e=>0===e.filtered.count)?b.createElement(m2.Primitive.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:b.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return b.createElement(m2.Primitive.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},px(e,e=>b.createElement("div",{"aria-hidden":!0},e)))})});function pd(e){let t=b.useRef(e);return ph(()=>{t.current=e}),t}var ph="u"<typeof window?b.useEffect:b.useLayoutEffect;function pm(e){let t=b.useRef();return void 0===t.current&&(t.current=e()),t}function pp(e){let t=b.useContext(pt),r=()=>e(t.snapshot());return b.useSyncExternalStore(t.subscribe,r,r)}function pf(e,t,r,n=[]){let s=b.useRef(),i=b.useContext(pe);return ph(()=>{var a;let o=(()=>{var e;for(let t of r){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():s.current}})(),l=n.map(e=>e.trim());i.value(e,o,l),null==(a=t.current)||a.setAttribute(m9,o),s.current=o}),s}var pg=()=>{let[e,t]=b.useState(),r=pm(()=>new Map);return ph(()=>{r.current.forEach(e=>e()),r.current=new Map},[e]),(e,n)=>{r.current.set(e,n),t({})}};function px({asChild:e,children:t},r){let n;return e&&b.isValidElement(t)?b.cloneElement("function"==typeof(n=t.type)?n(t.props):"render"in n?n.render(t.props):t,{ref:t.ref},r(t.props.children)):r(t)}var py={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},pv=e.i(210162),pv=pv,pb=e.i(836191);function pw({className:e,...t}){return(0,v.jsx)(pu,{"data-slot":"command",className:(0,k.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function pj({className:e,...t}){return(0,v.jsx)(pu.List,{"data-slot":"command-list",className:(0,k.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function pk({...e}){return(0,v.jsx)(pu.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function pN({className:e,...t}){return(0,v.jsx)(pu.Group,{"data-slot":"command-group",className:(0,k.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function pS({className:e,...t}){return(0,v.jsx)(pu.Item,{"data-slot":"command-item",className:(0,k.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}var pC=Symbol("radix.slottable");function pA(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pC}var p_=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(pA);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),pT=e.i(736180),pE=e.i(542899),pP=e.i(272741),pR=e.i(721648),pM=e.i(498101),pI=e.i(874057),pL=e.i(383044);function pD(e){var t;let r,n=(t=e,(r=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${t}.SlotClone`,r),s=b.forwardRef((e,t)=>{let{children:r,...s}=e,i=b.Children.toArray(r),a=i.find(pO);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(n,{...s,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(n,{...s,ref:t,children:r})});return s.displayName=`${e}.Slot`,s}var pz=Symbol("radix.slottable");function pO(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pz}var pB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=pD(`Primitive.${t}`),n=b.forwardRef((e,n)=>{let{asChild:s,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(s?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),pF=Symbol("radix.slottable");function p$(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===pF}var pV=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(p$);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),pU=e.i(897462),pW="rovingFocusGroup.onEntryFocus",pG={bubbles:!1,cancelable:!0},pq="RovingFocusGroup",[pH,pK,pX]=(0,pT.createCollection)(pq),[pY,pJ]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(pq,[pX]),[pZ,pQ]=pY(pq),p0=b.forwardRef((e,t)=>(0,v.jsx)(pH.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(pH.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,v.jsx)(p1,{...e,ref:t})})}));p0.displayName=pq;var p1=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,h=b.useRef(null),m=(0,aX.useComposedRefs)(t,h),p=(0,pE.useDirection)(i),[f,g]=(0,aH.useControllableState)({prop:a,defaultProp:o??null,onChange:l,caller:pq}),[x,y]=b.useState(!1),w=(0,pU.useCallbackRef)(c),j=pK(r),k=b.useRef(!1),[N,S]=b.useState(0);return b.useEffect(()=>{let e=h.current;if(e)return e.addEventListener(pW,w),()=>e.removeEventListener(pW,w)},[w]),(0,v.jsx)(pZ,{scope:r,orientation:n,dir:p,loop:s,currentTabStopId:f,onItemFocus:b.useCallback(e=>g(e),[g]),onItemShiftTab:b.useCallback(()=>y(!0),[]),onFocusableItemAdd:b.useCallback(()=>S(e=>e+1),[]),onFocusableItemRemove:b.useCallback(()=>S(e=>e-1),[]),children:(0,v.jsx)(pV.div,{tabIndex:x||0===N?-1:0,"data-orientation":n,...d,ref:m,style:{outline:"none",...e.style},onMouseDown:(0,aq.composeEventHandlers)(e.onMouseDown,()=>{k.current=!0}),onFocus:(0,aq.composeEventHandlers)(e.onFocus,e=>{let t=!k.current;if(e.target===e.currentTarget&&t&&!x){let t=new CustomEvent(pW,pG);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=j().filter(e=>e.focusable);p4([e.find(e=>e.active),e.find(e=>e.id===f),...e].filter(Boolean).map(e=>e.ref.current),u)}}k.current=!1}),onBlur:(0,aq.composeEventHandlers)(e.onBlur,()=>y(!1))})})}),p2="RovingFocusGroupItem",p5=b.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:i,children:a,...o}=e,l=(0,a0.useId)(),c=i||l,u=pQ(p2,r),d=u.currentTabStopId===c,h=pK(r),{onFocusableItemAdd:m,onFocusableItemRemove:p,currentTabStopId:f}=u;return b.useEffect(()=>{if(n)return m(),()=>p()},[n,m,p]),(0,v.jsx)(pH.ItemSlot,{scope:r,id:c,focusable:n,active:s,children:(0,v.jsx)(pV.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:(0,aq.composeEventHandlers)(e.onMouseDown,e=>{n?u.onItemFocus(c):e.preventDefault()}),onFocus:(0,aq.composeEventHandlers)(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void u.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=function(e,t,r){var n;let s=(n=e.key,"rtl"!==r?n:"ArrowLeft"===n?"ArrowRight":"ArrowRight"===n?"ArrowLeft":n);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(s))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(s)))return p3[s]}(e,u.orientation,u.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let s=h().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)s.reverse();else if("prev"===t||"next"===t){var r,n;"prev"===t&&s.reverse();let i=s.indexOf(e.currentTarget);s=u.loop?(r=s,n=i+1,r.map((e,t)=>r[(n+t)%r.length])):s.slice(i+1)}setTimeout(()=>p4(s))}}),children:"function"==typeof a?a({isCurrentTabStop:d,hasTabStop:null!=f}):a})})});p5.displayName=p2;var p3={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function p4(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}var p6=e.i(567706),p8=e.i(883944),p9=["Enter"," "],p7=["ArrowUp","PageDown","End"],fe=["ArrowDown","PageUp","Home",...p7],ft={ltr:[...p9,"ArrowRight"],rtl:[...p9,"ArrowLeft"]},fr={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fn="Menu",[fs,fi,fa]=(0,pT.createCollection)(fn),[fo,fl]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(fn,[fa,pI.createPopperScope,pJ]),fc=(0,pI.createPopperScope)(),fu=pJ(),[fd,fh]=fo(fn),[fm,fp]=fo(fn),ff=e=>{let{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:i,modal:a=!0}=e,o=fc(t),[l,c]=b.useState(null),u=b.useRef(!1),d=(0,pU.useCallbackRef)(i),h=(0,pE.useDirection)(s);return b.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener("pointerdown",t,{capture:!0,once:!0}),document.addEventListener("pointermove",t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener("keydown",e,{capture:!0}),()=>{document.removeEventListener("keydown",e,{capture:!0}),document.removeEventListener("pointerdown",t,{capture:!0}),document.removeEventListener("pointermove",t,{capture:!0})}},[]),(0,v.jsx)(pI.Root,{...o,children:(0,v.jsx)(fd,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:c,children:(0,v.jsx)(fm,{scope:t,onClose:b.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:h,modal:a,children:n})})})};ff.displayName=fn;var fg=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,s=fc(r);return(0,v.jsx)(pI.Anchor,{...s,...n,ref:t})});fg.displayName="MenuAnchor";var fx="MenuPortal",[fy,fv]=fo(fx,{forceMount:void 0}),fb=e=>{let{__scopeMenu:t,forceMount:r,children:n,container:s}=e,i=fh(fx,t);return(0,v.jsx)(fy,{scope:t,forceMount:r,children:(0,v.jsx)(aQ.Presence,{present:r||i.open,children:(0,v.jsx)(pL.Portal,{asChild:!0,container:s,children:n})})})};fb.displayName=fx;var fw="MenuContent",[fj,fk]=fo(fw),fN=b.forwardRef((e,t)=>{let r=fv(fw,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,i=fh(fw,e.__scopeMenu),a=fp(fw,e.__scopeMenu);return(0,v.jsx)(fs.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(aQ.Presence,{present:n||i.open,children:(0,v.jsx)(fs.Slot,{scope:e.__scopeMenu,children:a.modal?(0,v.jsx)(fS,{...s,ref:t}):(0,v.jsx)(fC,{...s,ref:t})})})})}),fS=b.forwardRef((e,t)=>{let r=fh(fw,e.__scopeMenu),n=b.useRef(null),s=(0,aX.useComposedRefs)(t,n);return b.useEffect(()=>{let e=n.current;if(e)return(0,p6.hideOthers)(e)},[]),(0,v.jsx)(f_,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:(0,aq.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),fC=b.forwardRef((e,t)=>{let r=fh(fw,e.__scopeMenu);return(0,v.jsx)(f_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),fA=pD("MenuContent.ScrollLock"),f_=b.forwardRef((e,t)=>{let{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:m,disableOutsideScroll:p,...f}=e,g=fh(fw,r),x=fp(fw,r),y=fc(r),w=fu(r),j=fi(r),[k,N]=b.useState(null),S=b.useRef(null),C=(0,aX.useComposedRefs)(t,S,g.onContentChange),A=b.useRef(0),_=b.useRef(""),T=b.useRef(0),E=b.useRef(null),P=b.useRef("right"),R=b.useRef(0),M=p?p8.RemoveScroll:b.Fragment;b.useEffect(()=>()=>window.clearTimeout(A.current),[]),(0,pR.useFocusGuards)();let I=b.useCallback(e=>{var t,r;return P.current===E.current?.side&&(t=e,!!(r=E.current?.area)&&function(e,t){let{x:r,y:n}=e,s=!1;for(let e=0,i=t.length-1;e<t.length;i=e++){let a=t[e],o=t[i],l=a.x,c=a.y,u=o.x,d=o.y;c>n!=d>n&&r<(u-l)*(n-c)/(d-c)+l&&(s=!s)}return s}({x:t.clientX,y:t.clientY},r))},[]);return(0,v.jsx)(fj,{scope:r,searchRef:_,onItemEnter:b.useCallback(e=>{I(e)&&e.preventDefault()},[I]),onItemLeave:b.useCallback(e=>{I(e)||(S.current?.focus(),N(null))},[I]),onTriggerLeave:b.useCallback(e=>{I(e)&&e.preventDefault()},[I]),pointerGraceTimerRef:T,onPointerGraceIntentChange:b.useCallback(e=>{E.current=e},[]),children:(0,v.jsx)(M,{...p?{as:fA,allowPinchZoom:!0}:void 0,children:(0,v.jsx)(pM.FocusScope,{asChild:!0,trapped:s,onMountAutoFocus:(0,aq.composeEventHandlers)(i,e=>{e.preventDefault(),S.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:(0,v.jsx)(pP.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:h,onDismiss:m,children:(0,v.jsx)(p0,{asChild:!0,...w,dir:x.dir,orientation:"vertical",loop:n,currentTabStopId:k,onCurrentTabStopIdChange:N,onEntryFocus:(0,aq.composeEventHandlers)(l,e=>{x.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,v.jsx)(pI.Content,{role:"menu","aria-orientation":"vertical","data-state":f0(g.open),"data-radix-menu-content":"",dir:x.dir,...y,...f,ref:C,style:{outline:"none",...f.style},onKeyDown:(0,aq.composeEventHandlers)(f.onKeyDown,e=>{let t=e.target.closest("[data-radix-menu-content]")===e.currentTarget,r=e.ctrlKey||e.altKey||e.metaKey,n=1===e.key.length;if(t){var s;let t,i,a,o,l,c;"Tab"===e.key&&e.preventDefault(),!r&&n&&(s=e.key,t=_.current+s,i=j().filter(e=>!e.disabled),a=document.activeElement,o=i.find(e=>e.ref.current===a)?.textValue,l=function(e,t,r){var n;let s=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=r?e.indexOf(r):-1,a=(n=Math.max(i,0),e.map((t,r)=>e[(n+r)%e.length]));1===s.length&&(a=a.filter(e=>e!==r));let o=a.find(e=>e.toLowerCase().startsWith(s.toLowerCase()));return o!==r?o:void 0}(i.map(e=>e.textValue),t,o),c=i.find(e=>e.textValue===l)?.ref.current,function e(t){_.current=t,window.clearTimeout(A.current),""!==t&&(A.current=window.setTimeout(()=>e(""),1e3))}(t),c&&setTimeout(()=>c.focus()))}let i=S.current;if(e.target!==i||!fe.includes(e.key))return;e.preventDefault();let a=j().filter(e=>!e.disabled).map(e=>e.ref.current);p7.includes(e.key)&&a.reverse(),function(e){let t=document.activeElement;for(let r of e)if(r===t||(r.focus(),document.activeElement!==t))return}(a)}),onBlur:(0,aq.composeEventHandlers)(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(A.current),_.current="")}),onPointerMove:(0,aq.composeEventHandlers)(e.onPointerMove,f5(e=>{let t=e.target,r=R.current!==e.clientX;e.currentTarget.contains(t)&&r&&(P.current=e.clientX>R.current?"right":"left",R.current=e.clientX)}))})})})})})})});fN.displayName=fw;var fT=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(pB.div,{role:"group",...n,ref:t})});fT.displayName="MenuGroup";var fE=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(pB.div,{...n,ref:t})});fE.displayName="MenuLabel";var fP="MenuItem",fR="menu.itemSelect",fM=b.forwardRef((e,t)=>{let{disabled:r=!1,onSelect:n,...s}=e,i=b.useRef(null),a=fp(fP,e.__scopeMenu),o=fk(fP,e.__scopeMenu),l=(0,aX.useComposedRefs)(t,i),c=b.useRef(!1);return(0,v.jsx)(fI,{...s,ref:l,disabled:r,onClick:(0,aq.composeEventHandlers)(e.onClick,()=>{let e=i.current;if(!r&&e){let t=new CustomEvent(fR,{bubbles:!0,cancelable:!0});e.addEventListener(fR,e=>n?.(e),{once:!0}),e&&az.flushSync(()=>e.dispatchEvent(t)),t.defaultPrevented?c.current=!1:a.onClose()}}),onPointerDown:t=>{e.onPointerDown?.(t),c.current=!0},onPointerUp:(0,aq.composeEventHandlers)(e.onPointerUp,e=>{c.current||e.currentTarget?.click()}),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{let t=""!==o.searchRef.current;r||t&&" "===e.key||p9.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});fM.displayName=fP;var fI=b.forwardRef((e,t)=>{let{__scopeMenu:r,disabled:n=!1,textValue:s,...i}=e,a=fk(fP,r),o=fu(r),l=b.useRef(null),c=(0,aX.useComposedRefs)(t,l),[u,d]=b.useState(!1),[h,m]=b.useState("");return b.useEffect(()=>{let e=l.current;e&&m((e.textContent??"").trim())},[i.children]),(0,v.jsx)(fs.ItemSlot,{scope:r,disabled:n,textValue:s??h,children:(0,v.jsx)(p5,{asChild:!0,...o,focusable:!n,children:(0,v.jsx)(pB.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...i,ref:c,onPointerMove:(0,aq.composeEventHandlers)(e.onPointerMove,f5(e=>{n?a.onItemLeave(e):(a.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,f5(e=>a.onItemLeave(e))),onFocus:(0,aq.composeEventHandlers)(e.onFocus,()=>d(!0)),onBlur:(0,aq.composeEventHandlers)(e.onBlur,()=>d(!1))})})})}),fL=b.forwardRef((e,t)=>{let{checked:r=!1,onCheckedChange:n,...s}=e;return(0,v.jsx)(fU,{scope:e.__scopeMenu,checked:r,children:(0,v.jsx)(fM,{role:"menuitemcheckbox","aria-checked":f1(r)?"mixed":r,...s,ref:t,"data-state":f2(r),onSelect:(0,aq.composeEventHandlers)(s.onSelect,()=>n?.(!!f1(r)||!r),{checkForDefaultPrevented:!1})})})});fL.displayName="MenuCheckboxItem";var fD="MenuRadioGroup",[fz,fO]=fo(fD,{value:void 0,onValueChange:()=>{}}),fB=b.forwardRef((e,t)=>{let{value:r,onValueChange:n,...s}=e,i=(0,pU.useCallbackRef)(n);return(0,v.jsx)(fz,{scope:e.__scopeMenu,value:r,onValueChange:i,children:(0,v.jsx)(fT,{...s,ref:t})})});fB.displayName=fD;var fF="MenuRadioItem",f$=b.forwardRef((e,t)=>{let{value:r,...n}=e,s=fO(fF,e.__scopeMenu),i=r===s.value;return(0,v.jsx)(fU,{scope:e.__scopeMenu,checked:i,children:(0,v.jsx)(fM,{role:"menuitemradio","aria-checked":i,...n,ref:t,"data-state":f2(i),onSelect:(0,aq.composeEventHandlers)(n.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});f$.displayName=fF;var fV="MenuItemIndicator",[fU,fW]=fo(fV,{checked:!1}),fG=b.forwardRef((e,t)=>{let{__scopeMenu:r,forceMount:n,...s}=e,i=fW(fV,r);return(0,v.jsx)(aQ.Presence,{present:n||f1(i.checked)||!0===i.checked,children:(0,v.jsx)(pB.span,{...s,ref:t,"data-state":f2(i.checked)})})});fG.displayName=fV;var fq=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e;return(0,v.jsx)(pB.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});fq.displayName="MenuSeparator";var fH=b.forwardRef((e,t)=>{let{__scopeMenu:r,...n}=e,s=fc(r);return(0,v.jsx)(pI.Arrow,{...s,...n,ref:t})});fH.displayName="MenuArrow";var[fK,fX]=fo("MenuSub"),fY="MenuSubTrigger",fJ=b.forwardRef((e,t)=>{let r=fh(fY,e.__scopeMenu),n=fp(fY,e.__scopeMenu),s=fX(fY,e.__scopeMenu),i=fk(fY,e.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:l}=i,c={__scopeMenu:e.__scopeMenu},u=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>u,[u]),b.useEffect(()=>{let e=o.current;return()=>{window.clearTimeout(e),l(null)}},[o,l]),(0,v.jsx)(fg,{asChild:!0,...c,children:(0,v.jsx)(fI,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":f0(r.open),...e,ref:(0,aX.composeRefs)(t,s.onTriggerChange),onClick:t=>{e.onClick?.(t),e.disabled||t.defaultPrevented||(t.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:(0,aq.composeEventHandlers)(e.onPointerMove,f5(t=>{i.onItemEnter(t),!t.defaultPrevented&&(e.disabled||r.open||a.current||(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),u()},100)))})),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,f5(e=>{u();let t=r.content?.getBoundingClientRect();if(t){let n=r.content?.dataset.side,s="right"===n,a=t[s?"left":"right"],l=t[s?"right":"left"];i.onPointerGraceIntentChange({area:[{x:e.clientX+(s?-5:5),y:e.clientY},{x:a,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:a,y:t.bottom}],side:n}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(e),e.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,t=>{let s=""!==i.searchRef.current;e.disabled||s&&" "===t.key||ft[n.dir].includes(t.key)&&(r.onOpenChange(!0),r.content?.focus(),t.preventDefault())})})})});fJ.displayName=fY;var fZ="MenuSubContent",fQ=b.forwardRef((e,t)=>{let r=fv(fw,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,i=fh(fw,e.__scopeMenu),a=fp(fw,e.__scopeMenu),o=fX(fZ,e.__scopeMenu),l=b.useRef(null),c=(0,aX.useComposedRefs)(t,l);return(0,v.jsx)(fs.Provider,{scope:e.__scopeMenu,children:(0,v.jsx)(aQ.Presence,{present:n||i.open,children:(0,v.jsx)(fs.Slot,{scope:e.__scopeMenu,children:(0,v.jsx)(f_,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:c,align:"start",side:"rtl"===a.dir?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{a.isUsingKeyboardRef.current&&l.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:(0,aq.composeEventHandlers)(e.onFocusOutside,e=>{e.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:(0,aq.composeEventHandlers)(e.onEscapeKeyDown,e=>{a.onClose(),e.preventDefault()}),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),r=fr[a.dir].includes(e.key);t&&r&&(i.onOpenChange(!1),o.trigger?.focus(),e.preventDefault())})})})})})});function f0(e){return e?"open":"closed"}function f1(e){return"indeterminate"===e}function f2(e){return f1(e)?"indeterminate":e?"checked":"unchecked"}function f5(e){return t=>"mouse"===t.pointerType?e(t):void 0}fQ.displayName=fZ;var f3="DropdownMenu",[f4,f6]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(f3,[fl]),f8=fl(),[f9,f7]=f4(f3),ge=e=>{let{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,l=f8(t),c=b.useRef(null),[u,d]=(0,aH.useControllableState)({prop:s,defaultProp:i??!1,onChange:a,caller:f3});return(0,v.jsx)(f9,{scope:t,triggerId:(0,a0.useId)(),triggerRef:c,contentId:(0,a0.useId)(),open:u,onOpenChange:d,onOpenToggle:b.useCallback(()=>d(e=>!e),[d]),modal:o,children:(0,v.jsx)(ff,{...l,open:u,onOpenChange:d,dir:n,modal:o,children:r})})};ge.displayName=f3;var gt="DropdownMenuTrigger",gr=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,i=f7(gt,r),a=f8(r);return(0,v.jsx)(fg,{asChild:!0,...a,children:(0,v.jsx)(p_.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:(0,aX.composeRefs)(t,i.triggerRef),onPointerDown:(0,aq.composeEventHandlers)(e.onPointerDown,e=>{!n&&0===e.button&&!1===e.ctrlKey&&(i.onOpenToggle(),i.open||e.preventDefault())}),onKeyDown:(0,aq.composeEventHandlers)(e.onKeyDown,e=>{!n&&(["Enter"," "].includes(e.key)&&i.onOpenToggle(),"ArrowDown"===e.key&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(e.key)&&e.preventDefault())})})})});gr.displayName=gt;var gn=e=>{let{__scopeDropdownMenu:t,...r}=e,n=f8(t);return(0,v.jsx)(fb,{...n,...r})};gn.displayName="DropdownMenuPortal";var gs="DropdownMenuContent",gi=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f7(gs,r),i=f8(r),a=b.useRef(!1);return(0,v.jsx)(fN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...n,ref:t,onCloseAutoFocus:(0,aq.composeEventHandlers)(e.onCloseAutoFocus,e=>{a.current||s.triggerRef.current?.focus(),a.current=!1,e.preventDefault()}),onInteractOutside:(0,aq.composeEventHandlers)(e.onInteractOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey,n=2===t.button||r;(!s.modal||n)&&(a.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});gi.displayName=gs,b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fT,{...s,...n,ref:t})}).displayName="DropdownMenuGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fE,{...s,...n,ref:t})}).displayName="DropdownMenuLabel";var ga=b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fM,{...s,...n,ref:t})});ga.displayName="DropdownMenuItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fL,{...s,...n,ref:t})}).displayName="DropdownMenuCheckboxItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fB,{...s,...n,ref:t})}).displayName="DropdownMenuRadioGroup",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(f$,{...s,...n,ref:t})}).displayName="DropdownMenuRadioItem",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fG,{...s,...n,ref:t})}).displayName="DropdownMenuItemIndicator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fq,{...s,...n,ref:t})}).displayName="DropdownMenuSeparator",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fH,{...s,...n,ref:t})}).displayName="DropdownMenuArrow",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fJ,{...s,...n,ref:t})}).displayName="DropdownMenuSubTrigger",b.forwardRef((e,t)=>{let{__scopeDropdownMenu:r,...n}=e,s=f8(r);return(0,v.jsx)(fQ,{...s,...n,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})}).displayName="DropdownMenuSubContent";var aI=aI;function go({...e}){return(0,v.jsx)(ge,{"data-slot":"dropdown-menu",...e})}function gl({...e}){return(0,v.jsx)(gr,{"data-slot":"dropdown-menu-trigger",...e})}function gc({className:e,sideOffset:t=4,...r}){return(0,v.jsx)(gn,{children:(0,v.jsx)(gi,{"data-slot":"dropdown-menu-content",sideOffset:t,className:(0,k.cn)("bg-popover text-popover-foreground 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 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function gu({className:e,inset:t,variant:r="default",...n}){return(0,v.jsx)(ga,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:(0,k.cn)("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...n})}var gd=Symbol("radix.slottable");function gh(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===gd}var gm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var r,n;let s,i,a,o=(n=r=`Primitive.${t}`,(s=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${n}.SlotClone`,i=s,(a=b.forwardRef((e,t)=>{let{children:r,...n}=e,s=b.Children.toArray(r),a=s.find(gh);if(a){let e=a.props.children,r=s.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(i,{...n,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(i,{...n,ref:t,children:r})})).displayName=`${r}.Slot`,a),l=b.forwardRef((e,r)=>{let{asChild:n,...s}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(n?o:t,{...s,ref:r})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{}),gp="HoverCard",[gf,gg]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(gp,[pI.createPopperScope]),gx=(0,pI.createPopperScope)(),[gy,gv]=gf(gp),gb="HoverCardTrigger";b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,s=gv(gb,r),i=gx(r);return(0,v.jsx)(pI.Anchor,{asChild:!0,...i,children:(0,v.jsx)(gm.a,{"data-state":s.open?"open":"closed",...n,ref:t,onPointerEnter:(0,aq.composeEventHandlers)(e.onPointerEnter,gS(s.onOpen)),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,gS(s.onClose)),onFocus:(0,aq.composeEventHandlers)(e.onFocus,s.onOpen),onBlur:(0,aq.composeEventHandlers)(e.onBlur,s.onClose),onTouchStart:(0,aq.composeEventHandlers)(e.onTouchStart,e=>e.preventDefault())})})}).displayName=gb;var[gw,gj]=gf("HoverCardPortal",{forceMount:void 0}),gk="HoverCardContent";b.forwardRef((e,t)=>{let r=gj(gk,e.__scopeHoverCard),{forceMount:n=r.forceMount,...s}=e,i=gv(gk,e.__scopeHoverCard);return(0,v.jsx)(aQ.Presence,{present:n||i.open,children:(0,v.jsx)(gN,{"data-state":i.open?"open":"closed",...s,onPointerEnter:(0,aq.composeEventHandlers)(e.onPointerEnter,gS(i.onOpen)),onPointerLeave:(0,aq.composeEventHandlers)(e.onPointerLeave,gS(i.onClose)),ref:t})})}).displayName=gk;var gN=b.forwardRef((e,t)=>{let{__scopeHoverCard:r,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,...o}=e,l=gv(gk,r),c=gx(r),u=b.useRef(null),d=(0,aX.useComposedRefs)(t,u),[h,m]=b.useState(!1);return b.useEffect(()=>{if(h){let e=document.body;return y=e.style.userSelect||e.style.webkitUserSelect,e.style.userSelect="none",e.style.webkitUserSelect="none",()=>{e.style.userSelect=y,e.style.webkitUserSelect=y}}},[h]),b.useEffect(()=>{if(u.current){let e=()=>{m(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointerup",e),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),b.useEffect(()=>{u.current&&(function(e){let t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;r.nextNode();)t.push(r.currentNode);return t})(u.current).forEach(e=>e.setAttribute("tabindex","-1"))}),(0,v.jsx)(pP.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:(0,aq.composeEventHandlers)(i,e=>{e.preventDefault()}),onDismiss:l.onDismiss,children:(0,v.jsx)(pI.Content,{...c,...o,onPointerDown:(0,aq.composeEventHandlers)(o.onPointerDown,e=>{e.currentTarget.contains(e.target)&&m(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...o.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})});function gS(e){return t=>"touch"===t.pointerType?void 0:e()}b.forwardRef((e,t)=>{let{__scopeHoverCard:r,...n}=e,s=gx(r);return(0,v.jsx)(pI.Arrow,{...s,...n,ref:t})}).displayName="HoverCardArrow";var gC=e.i(77982);function gA({className:e,...t}){return(0,v.jsx)("div",{"data-slot":"input-group",role:"group",className:(0,k.cn)("group/input-group border-input dark:bg-input/30 relative flex w-full items-center rounded-md border shadow-xs transition-[color,box-shadow] outline-none","h-9 min-w-0 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot=input-group-control]:focus-visible]:ring-[3px]","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}e.i(455706);let g_=(0,U.cva)("text-muted-foreground flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium select-none [&>svg:not([class*='size-'])]:size-4 [&>kbd]:rounded-[calc(var(--radius)-5px)] group-data-[disabled=true]/input-group:opacity-50",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.45rem] has-[>kbd]:mr-[-0.35rem]","block-start":"order-first w-full justify-start px-3 pt-3 [.border-b]:pb-3 group-has-[>input]/input-group:pt-2.5","block-end":"order-last w-full justify-start px-3 pb-3 [.border-t]:pt-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function gT({className:e,align:t="inline-start",...r}){return(0,v.jsx)("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:(0,k.cn)(g_({align:t}),e),onClick:e=>{e.target.closest("button")||e.currentTarget.parentElement?.querySelector("input")?.focus()},...r})}let gE=(0,U.cva)("text-sm shadow-none flex gap-2 items-center",{variants:{size:{xs:"h-6 gap-1 px-2 rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-3.5 has-[>svg]:px-2",sm:"h-8 px-2.5 gap-1.5 rounded-md has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function gP({className:e,type:t="button",variant:r="ghost",size:n="xs",...s}){return(0,v.jsx)(S.Button,{type:t,"data-size":n,variant:r,className:(0,k.cn)(gE({size:n}),e),...s})}let gR=(0,A.default)("corner-down-left",[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]),gM=(0,A.default)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);var gI=e.i(675182),gI=gI,gL=e.i(257868),gL=gL;let gD=(0,A.default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]),gz=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t},gO=(0,b.createContext)(null),gB=(0,b.createContext)(null),gF=(0,b.createContext)(null),g$=()=>{let e=(0,b.useContext)(gB),t=(0,b.useContext)(gF)??e;if(!t)throw Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return t},gV=(0,b.createContext)(null),gU=({className:e,accept:t,multiple:r,globalDrop:n,syncHiddenInput:s,maxFiles:i,maxFileSize:a,onError:o,onSubmit:l,children:c,...u})=>{let d=(0,b.useContext)(gO),h=!!d,m=(0,b.useRef)(null),p=(0,b.useRef)(null),[f,g]=(0,b.useState)([]),x=h?d.attachments.files:f,[y,w]=(0,b.useState)([]),j=(0,b.useRef)(x);j.current=x;let N=(0,b.useCallback)(()=>{m.current?.click()},[]),S=(0,b.useCallback)(e=>!t||""===t.trim()||t.split(",").map(e=>e.trim()).filter(Boolean).some(t=>{if(t.endsWith("/*")){let r=t.slice(0,-1);return e.type.startsWith(r)}return e.type===t}),[t]),C=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>S(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);r.length>0&&0===n.length?o?.({code:"max_file_size",message:"All files exceed the maximum size."}):g(e=>{let t="number"==typeof i?Math.max(0,i-e.length):void 0,r="number"==typeof t?n.slice(0,t):n;"number"==typeof t&&n.length>t&&o?.({code:"max_files",message:"Too many files. Some were not added."});let s=[];for(let e of r)s.push({id:gz(),type:"file",url:URL.createObjectURL(e),mediaType:e.type,filename:e.name});return e.concat(s)})},[S,i,a,o]),A=(0,b.useCallback)(e=>g(t=>{let r=t.find(t=>t.id===e);return r?.url&&URL.revokeObjectURL(r.url),t.filter(t=>t.id!==e)}),[]),_=(0,b.useCallback)(e=>{let t=Array.from(e),r=t.filter(e=>S(e));if(t.length&&0===r.length)return void o?.({code:"accept",message:"No files match the accepted types."});let n=r.filter(e=>!a||e.size<=a);if(r.length>0&&0===n.length)return void o?.({code:"max_file_size",message:"All files exceed the maximum size."});let s=x.length,l="number"==typeof i?Math.max(0,i-s):void 0,c="number"==typeof l?n.slice(0,l):n;"number"==typeof l&&n.length>l&&o?.({code:"max_files",message:"Too many files. Some were not added."}),c.length>0&&d?.attachments.add(c)},[S,a,i,o,x.length,d]),T=(0,b.useCallback)(()=>h?d?.attachments.clear():g(e=>{for(let t of e)t.url&&URL.revokeObjectURL(t.url);return[]}),[h,d]),E=(0,b.useCallback)(()=>w([]),[]),P=h?_:C,R=h?d.attachments.remove:A,M=h?d.attachments.openFileDialog:N,I=(0,b.useCallback)(()=>{T(),E()},[T,E]);(0,b.useEffect)(()=>{h&&d.__registerFileInput(m,()=>m.current?.click())},[h,d]),(0,b.useEffect)(()=>{s&&m.current&&0===x.length&&(m.current.value="")},[x,s]),(0,b.useEffect)(()=>{let e=p.current;if(!e||n)return;let t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},r=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return e.addEventListener("dragover",t),e.addEventListener("drop",r),()=>{e.removeEventListener("dragover",t),e.removeEventListener("drop",r)}},[P,n]),(0,b.useEffect)(()=>{if(!n)return;let e=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault()},t=e=>{e.dataTransfer?.types?.includes("Files")&&e.preventDefault(),e.dataTransfer?.files&&e.dataTransfer.files.length>0&&P(e.dataTransfer.files)};return document.addEventListener("dragover",e),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",e),document.removeEventListener("drop",t)}},[P,n]),(0,b.useEffect)(()=>()=>{if(!h)for(let e of j.current)e.url&&URL.revokeObjectURL(e.url)},[h]);let L=async e=>{try{let t=await fetch(e),r=await t.blob();return new Promise(e=>{let t=new FileReader;t.onloadend=()=>e(t.result),t.onerror=()=>e(null),t.readAsDataURL(r)})}catch{return null}},D=(0,b.useMemo)(()=>({files:x.map(e=>({...e,id:e.id})),add:P,remove:R,clear:T,openFileDialog:M,fileInputRef:m}),[x,P,R,T,M]),z=(0,b.useMemo)(()=>({sources:y,add:e=>{let t=Array.isArray(e)?e:[e];w(e=>e.concat(t.map(e=>({...e,id:gz()}))))},remove:e=>{w(t=>t.filter(t=>t.id!==e))},clear:E}),[y,E]),O=(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:r,onChange:e=>{e.currentTarget.files&&P(e.currentTarget.files),e.currentTarget.value=""},ref:m,title:"Upload files",type:"file"}),(0,v.jsx)("form",{className:(0,k.cn)("w-full",e),onSubmit:e=>{e.preventDefault();let t=e.currentTarget,r=h?d.textInput.value:new FormData(t).get("message")||"";h||t.reset(),Promise.all(x.map(async({id:e,...t})=>{if(t.url?.startsWith("blob:")){let e=await L(t.url);return{...t,url:e??t.url}}return t})).then(t=>{try{let n=l({text:r,files:t},e);n instanceof Promise?n.then(()=>{I(),h&&d.textInput.clear()}).catch(()=>{}):(I(),h&&d.textInput.clear())}catch{}}).catch(()=>{})},ref:p,...u,children:(0,v.jsx)(gA,{className:"overflow-hidden",children:c})})]}),B=(0,v.jsx)(gV.Provider,{value:z,children:O});return(0,v.jsx)(gF.Provider,{value:D,children:B})},gW=({className:e,...t})=>(0,v.jsx)("div",{className:(0,k.cn)("contents",e),...t}),gG=({className:e,...t})=>(0,v.jsx)(gT,{align:"block-end",className:(0,k.cn)("order-first flex-wrap gap-1",e),...t}),gq=({className:e,...t})=>(0,v.jsx)(gT,{align:"block-end",className:(0,k.cn)("justify-between gap-1",e),...t}),gH=({className:e,variant:t="default",size:r="icon-sm",status:n,onStop:s,onClick:i,children:a,...o})=>{let l="submitted"===n||"streaming"===n,c=(0,v.jsx)(gR,{className:"size-4"});return"submitted"===n?c=(0,v.jsx)(gI.default,{className:"size-4 animate-spin"}):"streaming"===n?c=(0,v.jsx)(gD,{className:"size-4"}):"error"===n&&(c=(0,v.jsx)(aD.XIcon,{className:"size-4"})),(0,v.jsx)(gP,{"aria-label":l?"Stop":"Submit",className:(0,k.cn)(e),onClick:e=>{if(l&&s){e.preventDefault(),s();return}i?.(e)},size:r,type:l&&s?"button":"submit",variant:t,...o,children:a??c})};var gK=e.i(681711),gK=gK;let gX=(0,A.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),gY=(0,A.default)("music-2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]),gJ=(0,A.default)("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),gZ=(0,A.default)("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]),gQ=e=>{if("source-document"===e.type)return"source";let t=e.mediaType??"";return t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/")||t.startsWith("text/")?"document":"unknown"},g0=(0,b.createContext)(null),g1=(0,b.createContext)(null),g2=()=>{let e=(0,b.useContext)(g1);if(!e)throw Error("Attachment components must be used within <Attachment>");return e},g5=({variant:e="grid",className:t,children:r,...n})=>{let s=(0,b.useMemo)(()=>({variant:e}),[e]);return(0,v.jsx)(g0.Provider,{value:s,children:(0,v.jsx)("div",{className:(0,k.cn)("flex items-start","list"===e?"flex-col gap-2":"flex-wrap gap-2","grid"===e&&"ml-auto w-fit",t),...n,children:r})})},g3=({data:e,onRemove:t,className:r,children:n,...s})=>{let{variant:i}=(0,b.useContext)(g0)??{variant:"grid"},a=gQ(e),o=(0,b.useMemo)(()=>({data:e,mediaCategory:a,onRemove:t,variant:i}),[e,a,t,i]);return(0,v.jsx)(g1.Provider,{value:o,children:(0,v.jsx)("div",{className:(0,k.cn)("group relative","grid"===i&&"size-24 overflow-hidden rounded-lg","inline"===i&&["flex h-8 cursor-pointer select-none items-center gap-1.5","rounded-md border border-border px-1.5","font-medium text-sm transition-all","hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50"],"list"===i&&["flex w-full items-center gap-3 rounded-lg border p-3","hover:bg-accent/50"],r),...s,children:n})})},g4=({fallbackIcon:e,className:t,...r})=>{let{data:n,mediaCategory:s,variant:i}=g2(),a="inline"===i?"size-3":"size-4";return(0,v.jsx)("div",{className:(0,k.cn)("flex shrink-0 items-center justify-center overflow-hidden","grid"===i&&"size-full bg-muted","inline"===i&&"size-5 rounded bg-background","list"===i&&"size-12 rounded bg-muted",t),...r,children:(()=>{if("image"===s&&"file"===n.type&&n.url){let e,t;return e=n.url,t=n.filename,"grid"===i?(0,v.jsx)("img",{alt:t||"Image",className:"size-full object-cover",height:96,src:e,width:96}):(0,v.jsx)("img",{alt:t||"Image",className:"size-full rounded object-cover",height:20,src:e,width:20})}if("video"===s&&"file"===n.type&&n.url)return(0,v.jsx)("video",{className:"size-full object-cover",muted:!0,src:n.url});let t={image:gM,video:gZ,audio:gY,source:gX,document:gK.default,unknown:gJ}[s];return e??(0,v.jsx)(t,{className:(0,k.cn)(a,"text-muted-foreground")})})()})},g6=({showMediaType:e=!1,className:t,...r})=>{let{data:n,variant:s}=g2(),i=(e=>{if("source-document"===e.type)return e.title||e.filename||"Source";let t=gQ(e);return e.filename||("image"===t?"Image":"Attachment")})(n);return"grid"===s?null:(0,v.jsxs)("div",{className:(0,k.cn)("min-w-0 flex-1",t),...r,children:[(0,v.jsx)("span",{className:"block truncate",children:i}),e&&n.mediaType&&(0,v.jsx)("span",{className:"block truncate text-muted-foreground text-xs",children:n.mediaType})]})},g8=({label:e="Remove",className:t,children:r,...n})=>{let{onRemove:s,variant:i}=g2();return s?(0,v.jsxs)(S.Button,{"aria-label":e,className:(0,k.cn)("grid"===i&&["absolute top-2 right-2 size-6 rounded-full p-0","bg-background/80 backdrop-blur-sm","opacity-0 transition-opacity group-hover:opacity-100","hover:bg-background","[&>svg]:size-3"],"inline"===i&&["size-5 rounded p-0","opacity-0 transition-opacity group-hover:opacity-100","[&>svg]:size-2.5"],"list"===i&&["size-8 shrink-0 rounded p-0","[&>svg]:size-4"],t),onClick:e=>{e.stopPropagation(),s()},type:"button",variant:"ghost",...n,children:[r??(0,v.jsx)(aD.XIcon,{}),(0,v.jsx)("span",{className:"sr-only",children:e})]}):null};var g9=e.i(772857);let g7=({className:e,children:t,...r})=>(0,v.jsxs)(g9.ScrollArea,{className:"w-full overflow-x-auto whitespace-nowrap",...r,children:[(0,v.jsx)("div",{className:(0,k.cn)("flex w-max flex-nowrap items-center gap-2",e),children:t}),(0,v.jsx)(g9.ScrollBar,{className:"hidden",orientation:"horizontal"})]}),xe=({suggestion:e,onClick:t,className:r,variant:n="outline",size:s="sm",children:i,...a})=>(0,v.jsx)(S.Button,{className:(0,k.cn)("cursor-pointer rounded-full px-4 transition-all duration-200","hover:scale-[1.02] hover:shadow-md hover:border-primary/50",r),onClick:()=>{t?.(e)},size:s,type:"button",variant:n,...a,children:i||e});var xt=e.i(524741),xr=e.i(280105),xr=xr;let xn=(0,A.default)("circle-dot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);var od=od,aI=aI;let xs=(0,A.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var gK=gK;let xi={pending:ol,in_progress:xn,completed:xr.default,cancelled:od.default},xa={pending:"text-muted-foreground",in_progress:"text-primary",completed:"text-green-500",cancelled:"text-muted-foreground/50"};function xo({todosData:e,plans:t,isLoading:r,className:n}){let[s,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(null),l=e&&e.todos.length>0,c=t&&t.length>0;if(!l&&!c)return null;let u=e?.todos||[],d=e?.stats||{total:0,pending:0,inProgress:0,completed:0,cancelled:0},h=e?.nextTodo||null,m=[...u].sort((e,t)=>{let r={in_progress:0,pending:1,completed:2,cancelled:3};return(r[e.status]??4)-(r[t.status]??4)}),p=d.total>0?Math.round(d.completed/d.total*100):0;return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border bg-card/50 backdrop-blur-sm overflow-hidden",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(xs,{className:"size-4 text-primary shrink-0"}),!s&&h?(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,v.jsx)(xn,{className:"size-3.5 text-primary shrink-0"}),(0,v.jsx)("span",{className:"text-sm truncate",children:h.content})]}):(0,v.jsx)("span",{className:"font-medium text-sm",children:"Tasks"}),d.total>0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0",children:[d.completed,"/",d.total]}),c&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground shrink-0 flex items-center gap-1",children:[(0,v.jsx)(gK.default,{className:"size-3"}),t.length," plan",1!==t.length?"s":""]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[d.total>0&&(0,v.jsx)("div",{className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:(0,v.jsx)("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${p}%`}})}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[c&&(0,v.jsx)("div",{className:"border-b",children:t.map(e=>(0,v.jsxs)("button",{onClick:()=>o(e),className:"flex items-center gap-2 w-full px-3 py-1.5 hover:bg-muted/30 transition-colors text-left",children:[(0,v.jsx)(gK.default,{className:"size-4 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"text-sm font-medium flex-1 min-w-0 truncate",children:e.name}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"View"})]},e.name))}),h&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-primary/5 border-b flex items-center gap-2",children:[(0,v.jsx)(xn,{className:"size-4 text-primary shrink-0"}),(0,v.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,v.jsx)("span",{className:"text-xs text-primary font-medium uppercase tracking-wide",children:"Current"}),(0,v.jsx)("p",{className:"text-sm font-medium truncate",children:h.content})]})]}),m.length>0&&(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:m.map(e=>{let t=xi[e.status]||ol,r=xa[e.status]||"text-muted-foreground",n=e.id===h?.id;return(0,v.jsxs)(C.Tooltip,{children:[(0,v.jsx)(C.TooltipTrigger,{asChild:!0,children:(0,v.jsxs)("div",{className:(0,k.cn)("flex items-start gap-2 px-3 py-1.5 hover:bg-muted/30 transition-colors cursor-default",n&&"bg-primary/5"),children:[(0,v.jsx)(t,{className:(0,k.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,k.cn)("text-sm flex-1 min-w-0 truncate","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]})}),(0,v.jsxs)(C.TooltipContent,{side:"left",className:"max-w-xs",children:[(0,v.jsx)("p",{className:"text-sm",children:e.content}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground capitalize mt-1",children:e.status.replace("_"," ")})]})]},e.id)})}),d.total>0&&(0,v.jsxs)("div",{className:"px-3 py-1.5 border-t bg-muted/30 flex items-center gap-3 text-xs text-muted-foreground",children:[d.inProgress>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(xn,{className:"size-3 text-primary"}),d.inProgress," active"]}),d.pending>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(ol,{className:"size-3"}),d.pending," pending"]}),d.completed>0&&(0,v.jsxs)("span",{className:"flex items-center gap-1",children:[(0,v.jsx)(xr.default,{className:"size-3 text-green-500"}),d.completed," done"]})]})]})]}),a&&(0,v.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm",onClick:()=>o(null),children:(0,v.jsxs)("div",{className:"bg-background rounded-xl border shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col mx-4",onClick:e=>e.stopPropagation(),children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b shrink-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(gK.default,{className:"size-5 text-blue-500 shrink-0"}),(0,v.jsx)("h2",{className:"font-semibold text-lg truncate",children:a.name})]}),(0,v.jsx)("button",{onClick:()=>o(null),className:"p-1 rounded-md hover:bg-muted transition-colors shrink-0",children:(0,v.jsx)(aD.XIcon,{className:"size-5"})})]}),(0,v.jsx)("div",{className:"overflow-auto flex-1 px-5 py-4",children:(0,v.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none whitespace-pre-wrap font-mono text-sm leading-relaxed",children:a.content})}),(0,v.jsxs)("div",{className:"px-5 py-3 border-t bg-muted/30 flex items-center justify-between text-xs text-muted-foreground shrink-0",children:[(0,v.jsxs)("span",{children:[a.sizeChars.toLocaleString()," characters"]}),(0,v.jsx)("button",{onClick:()=>o(null),className:"px-3 py-1.5 rounded-md bg-primary text-primary-foreground text-xs font-medium hover:bg-primary/90 transition-colors",children:"Close"})]})]})})]})}var xl=e.i(739963),xc=e.i(300739),xu=e.i(335130),xd=e.i(367887),xh=e.i(482306);let xm=(0,A.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),xp=(0,A.default)("file-code",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]);var xf=e.i(865373),xg=e.i(719583),xx=e.i(816187);let xy=(0,A.default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);var xv=e.i(99027),xb=e.i(220563);let xw=(0,A.default)("file",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]]),xj=(0,A.default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);var xk=e.i(707387),xN=e.i(372379),xS=e.i(101513),xS=xS;let xC=(0,A.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]),xA=(0,A.default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);var x_=e.i(904781);let xT=(0,A.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);var xE=e.i(79092);let xP=(0,A.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]),xR=(0,A.default)("bug",[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]);var xM=e.i(529757),xI=e.i(865259),xL=e.i(634066),aI=aI,om=om;let xD=(0,A.default)("file-plus",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);var xz=e.i(398049),xz=xz,od=od;let xO=(0,b.memo)(({line:e,type:t})=>(0,v.jsxs)("div",{className:(0,k.cn)("font-mono text-xs leading-5 px-2","add"===t?"bg-green-500/10":"remove"===t?"bg-red-500/10":"","add"===t?"text-green-600 dark:text-green-400":"remove"===t?"text-red-600 dark:text-red-400":"text-muted-foreground"),children:[(0,v.jsx)("span",{className:"select-none w-4 inline-block",children:"add"===t?"+":"remove"===t?"-":" "}),(0,v.jsx)("span",{className:"whitespace-pre-wrap break-all",children:e||" "})]}));function xB({input:e,output:t,status:r,streamingArgsText:n,liveContent:s,liveOldString:i,liveNewString:a,className:o}){let[l,c]=(0,b.useState)(!0),u=e?.path||"",d=u.split("/").pop()||"file",h=e?.mode||t?.mode||"full",m={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[u.split(".").pop()?.toLowerCase()||""]||"plaintext",p=(0,b.useMemo)(()=>{if(!n)return null;try{return JSON.parse(n)}catch{let e=n.match(/"content"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(e)try{return{content:JSON.parse(`"${e[1]}"`)}}catch{return{content:e[1]}}let t=n.match(/"old_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/),r=n.match(/"new_string"\s*:\s*"((?:[^"\\]|\\[\s\S])*)(?:"|$)/);if(t||r)return{old_string:t?t[1]:void 0,new_string:r?r[1]:void 0};return null}},[n]),f=s||e?.content||p?.content||"",g=i||e?.old_string||p?.old_string||"",x=a||e?.new_string||p?.new_string||"",y="streaming"===r||"pending"===r||"running"===r&&!!(s||i||a),w="completed"===r,j="error"===r||t?.success===!1,C=w&&t?.success?oa:j?od.default:y?xp:xw,A=w&&t?.success?"text-green-600 dark:text-green-500":j?"text-red-600 dark:text-red-500":y?"text-blue-600 dark:text-blue-500":"text-muted-foreground",_="str_replace"===h?xz.default:t?.action==="created"?xD:xp;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",o),children:[(0,v.jsxs)("button",{onClick:()=>c(!l),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(C,{className:(0,k.cn)("size-4 shrink-0",A)}),(0,v.jsx)(_,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs shrink-0",children:"write_file"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:d}),"str_replace"===h&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"text-xs shrink-0",children:"edit"}),t?.action==="created"&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"text-xs shrink-0",children:"new"}),y&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"streaming..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.success&&void 0!==t.lineDelta&&(0,v.jsxs)("span",{className:(0,k.cn)("text-xs font-mono",t.lineDelta>=0?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400"),children:[t.lineDelta>=0?"+":"",t.lineDelta]}),l?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),l&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:u}),f&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:()=>navigator.clipboard.writeText(f),children:(0,v.jsx)(om.default,{className:"size-3"})})]}),"str_replace"===h?(0,v.jsxs)("div",{className:"max-h-[200px] overflow-auto",children:[g&&(0,v.jsxs)("div",{className:"border-b",children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-red-500/5 border-b text-xs text-red-600 dark:text-red-400 font-medium",children:"Removed"}),(0,v.jsx)("div",{className:"py-1",children:g.split("\n").map((e,t)=>(0,v.jsx)(xO,{line:e,type:"remove"},`old-${t}`))})]}),x&&(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"px-3 py-1 bg-green-500/5 border-b text-xs text-green-600 dark:text-green-400 font-medium",children:"Added"}),(0,v.jsx)("div",{className:"py-1",children:x.split("\n").map((e,t)=>(0,v.jsx)(xO,{line:e,type:"add"},`new-${t}`))})]}),!g&&!x&&y&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Receiving changes..."})})]}):(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:f?(0,v.jsx)(o_,{code:f,language:m,showLineNumbers:!0}):y?(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Writing file..."})}):null}),(t?.success===!0||t?.success===!1||j)&&(0,v.jsx)("div",{className:(0,k.cn)("px-3 py-2 border-t text-xs flex items-center gap-2",t?.success===!0?"bg-green-500/5 text-green-600 dark:text-green-400":"bg-red-500/5 text-red-600 dark:text-red-400"),children:t?.success===!0?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oa,{className:"size-3.5"}),(0,v.jsx)("span",{children:"str_replace"===h?`Replaced ${t.linesRemoved||0} → ${t.linesAdded||0} lines`:`${"created"===t.action?"Created":"Updated"} (${t.lineCount||0} lines)`})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(od.default,{className:"size-3.5"}),(0,v.jsx)("span",{children:t?.error||"Failed to write file"})]})})]})]})}xO.displayName="DiffLine";var aI=aI,om=om,gK=gK,xF=e.i(416667),xF=xF;let x$=(0,A.default)("scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);function xV({input:e,output:t,status:r,className:n}){var s;let[i,a]=(0,b.useState)(!0),o=e?.path||t?.relativePath||t?.path||"",l=o.split("/").pop()||"file",c={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",php:"php",swift:"swift",kt:"kotlin",scala:"scala",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",ps1:"powershell",sql:"sql",html:"html",htm:"html",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",yaml:"yaml",yml:"yaml",xml:"xml",md:"markdown",markdown:"markdown",txt:"plaintext",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",dockerfile:"dockerfile",makefile:"makefile"}[o.split(".").pop()?.toLowerCase()||""]||"plaintext",u=t?.content||"",d=!!(t?.imageData&&t?.mediaType),h="pending"===r||"streaming"===r||"running"===r,m="completed"===r&&t?.success===!0,p="error"===r||t?.success===!1,f=(0,b.useMemo)(()=>e?.startLine&&e?.endLine?`lines ${e.startLine}-${e.endLine}`:e?.startLine?`from line ${e.startLine}`:e?.endLine?`to line ${e.endLine}`:null,[e?.startLine,e?.endLine]),g=m?oa:p?xF.default:xw;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>a(!i),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(g,{className:(0,k.cn)("size-4 shrink-0",m?"text-green-600 dark:text-green-500":p?"text-red-600 dark:text-red-500":"text-muted-foreground")}),d?(0,v.jsx)(gM,{className:"size-3.5 text-muted-foreground shrink-0"}):(0,v.jsx)(gK.default,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:l}),f&&(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs shrink-0",children:f}),t?.wasTruncated&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs shrink-0 gap-1",children:[(0,v.jsx)(x$,{className:"size-3"}),"truncated"]}),h&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"reading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.lineCount!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.lineCount," lines"]}),i?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-xs text-muted-foreground font-mono truncate",children:o}),t?.sizeBytes!==void 0&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground/60 shrink-0",children:["(",(s=t.sizeBytes)<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`,")"]})]}),u&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(u)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),(0,v.jsx)("div",{className:(0,k.cn)(d?"max-h-[400px]":"max-h-[200px]","overflow-auto"),children:h?(0,v.jsx)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:(0,v.jsx)("span",{className:"animate-pulse",children:"Reading file..."})}):p?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(xF.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t?.error||"Failed to read file"})]}):d&&t?.imageData?(0,v.jsx)("div",{className:"p-3 flex justify-center bg-muted/20",children:(0,v.jsx)("img",{src:`data:${t.mediaType};base64,${t.imageData}`,alt:l,className:"max-w-full max-h-[350px] object-contain rounded"})}):u?(0,v.jsx)(o_,{code:u,language:c,showLineNumbers:!0}):(0,v.jsx)("div",{className:"px-3 py-4 text-muted-foreground text-sm italic",children:"File is empty"})}),t?.wasTruncated&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-amber-500/5 text-xs text-amber-600 dark:text-amber-400 flex items-center gap-2",children:[(0,v.jsx)(x$,{className:"size-3.5"}),(0,v.jsx)("span",{children:"Content was truncated. Use startLine/endLine to read specific sections."})]})]})]})}var aI=aI,om=om;let xU=(0,A.default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);var od=od;let xW=(0,A.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);var oc=oc;let xG=(0,A.default)("circle-stop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);function xq({input:e,output:t,status:r,terminalId:n,liveOutput:s,className:i}){let[a,o]=(0,b.useState)(!0),l=(0,b.useRef)(null);(0,b.useEffect)(()=>{l.current&&(l.current.scrollTop=l.current.scrollHeight)},[s,t?.output]);let c=e?.command||"",u=e?.background||!1,d=e?.kill===!0,h=e?.id&&(e?.input!==void 0||e?.key!==void 0),m=e?.id&&!e?.command&&!e?.kill&&!h,p="pending"===r||"streaming"===r||"running"===r,f=p&&n&&void 0!==s,g="completed"===r,x="error"===r||t?.success===!1,y=t?.exitCode,w=(()=>{if(f)return s||"";if(t){let e=t.output||t.stdout||"",r=t.stderr||"";return r?e+(e?"\n":"")+r:e}return""})(),j=c.length>50?c.slice(0,50)+"...":c,{Icon:C,color:A,label:_}=(()=>{if(d)return{Icon:xG,color:"text-amber-600 dark:text-amber-500",label:t?.status==="stopped"?"Stopped":"Stopping..."};if(h){let t=e?.key?`key: ${e.key}`:`input: "${e?.input?.slice(0,20)}..."`;return{Icon:xU,color:"text-purple-600 dark:text-purple-500",label:p?"Sending...":t}}return m?{Icon:xU,color:"text-blue-600 dark:text-blue-500",label:"Logs"}:f?{Icon:xW,color:"text-green-600 dark:text-green-500 animate-pulse",label:"Live"}:p?{Icon:oc.default,color:"text-muted-foreground animate-pulse",label:"Executing..."}:g&&0===y?{Icon:oa,color:"text-green-600 dark:text-green-500",label:"Completed"}:g&&0!==y?{Icon:od.default,color:"text-red-600 dark:text-red-500",label:`Exit ${y}`}:x?{Icon:od.default,color:"text-red-600 dark:text-red-500",label:"Error"}:{Icon:xU,color:"text-muted-foreground",label:""}})();return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",i),children:[(0,v.jsxs)("button",{onClick:()=>o(!a),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(C,{className:(0,k.cn)("size-4 shrink-0",A)}),(0,v.jsx)(xU,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("code",{className:"font-mono text-sm truncate",title:c,children:j||(d?`kill ${e?.id}`:m?`logs ${e?.id}`:"bash")}),u&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"text-xs shrink-0",children:"background"}),f&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs shrink-0 bg-green-500/10 text-green-600 dark:text-green-400 gap-1",children:[(0,v.jsx)(xW,{className:"size-2 animate-pulse"}),"live"]}),_&&!f&&(0,v.jsx)("span",{className:(0,k.cn)("text-xs shrink-0",A),children:_})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[void 0!==y&&g&&(0,v.jsxs)(N.Badge,{variant:0===y?"secondary":"destructive",className:(0,k.cn)("text-xs",0===y?"bg-green-500/10 text-green-600 dark:text-green-400":""),children:["exit ",y]}),a?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),a&&(0,v.jsxs)("div",{className:"border-t",children:[c&&(0,v.jsxs)("div",{className:"px-3 py-1.5 bg-muted/30 border-b flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)("span",{className:"text-muted-foreground text-xs",children:"$"}),(0,v.jsx)("code",{className:"text-xs font-mono truncate",children:c})]}),(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(c)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),(0,v.jsxs)("div",{ref:l,className:"bg-zinc-950 dark:bg-zinc-950 relative max-h-[300px] overflow-auto",children:[(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-zinc-300 whitespace-pre-wrap break-all min-h-[40px]",children:[w||(0,v.jsx)("span",{className:"text-muted-foreground italic",children:p?"Waiting for output...":"(no output)"}),f&&(0,v.jsx)("span",{className:"inline-block w-2 h-4 bg-green-500 animate-pulse ml-0.5"})]}),w&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 size-6 text-zinc-500 hover:text-zinc-300 bg-zinc-900/80",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(w)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(od.default,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}),t?.message&&!t?.error&&(0,v.jsx)("div",{className:"px-3 py-2 border-t bg-muted/30 text-muted-foreground text-xs",children:t.message})]})]})}var aI=aI,pv=pv,od=od;let xH=(0,A.default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);var gK=gK,xK=e.i(101291),xK=xK,xX=e.i(481298),xX=xX;let xY=(0,A.default)("loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);var pv=pv,gK=gK,od=od,gI=gI,xK=xK,aI=aI;let xJ=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"";function xZ({open:e,onOpenChange:t,title:r="Explore Agent",steps:n,status:s,query:i}){let a=(0,b.useRef)(null),o=(0,b.useRef)(null),l="running"===s,c="completed"===s,u="error"===s;return(0,b.useEffect)(()=>{o.current&&l&&o.current.scrollIntoView({behavior:"smooth",block:"end"})},[n,l]),(0,v.jsx)(pb.Dialog,{open:e,onOpenChange:t,children:(0,v.jsxs)(pb.DialogContent,{className:"sm:max-w-xl max-h-[80vh] flex flex-col gap-0 p-0 overflow-hidden",children:[(0,v.jsxs)("div",{className:"px-4 py-3 border-b flex items-center gap-3",children:[(0,v.jsx)("div",{className:"shrink-0",children:l?(0,v.jsx)(gI.default,{className:"size-4 text-blue-500 animate-spin"}):c?(0,v.jsx)(oa,{className:"size-4 text-green-500"}):(0,v.jsx)(od.default,{className:"size-4 text-red-500"})}),(0,v.jsx)(pb.DialogHeader,{className:"flex-1 space-y-0",children:(0,v.jsx)(pb.DialogTitle,{className:"text-sm font-medium",children:l?"SparkeCoder is exploring...":c?"Exploration complete":"Exploration failed"})}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[n.length," steps"]})]}),i&&(0,v.jsx)("div",{className:"px-4 py-2 border-b bg-muted/30",children:(0,v.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,v.jsx)(pv.default,{className:"size-3 shrink-0"}),(0,v.jsx)("span",{className:"truncate",title:i,children:xJ(i,80)})]})}),(0,v.jsx)("div",{ref:a,className:"flex-1 overflow-auto bg-zinc-950 font-mono text-xs",children:0===n.length&&l?(0,v.jsxs)("div",{className:"flex items-center justify-center py-12 text-zinc-500",children:[(0,v.jsx)(gI.default,{className:"size-4 animate-spin mr-2"}),"Initializing..."]}):0===n.length?(0,v.jsx)("div",{className:"flex items-center justify-center py-12 text-zinc-500",children:c?(0,v.jsx)("span",{children:"Exploration completed. Expand the result below to see findings."}):u?(0,v.jsx)("span",{className:"text-red-400",children:"Exploration failed."}):(0,v.jsx)("span",{children:"No steps recorded."})}):(0,v.jsxs)("div",{className:"py-2",children:[n.map((e,t)=>(0,v.jsx)(xQ,{step:e},e.id||t)),(0,v.jsx)("div",{ref:o}),l&&(0,v.jsxs)("div",{className:"px-3 py-1 flex items-center gap-2 text-zinc-500",children:[(0,v.jsx)(gI.default,{className:"size-3 animate-spin"}),(0,v.jsx)("span",{className:"animate-pulse",children:"_"})]})]})}),(0,v.jsxs)("div",{className:"px-4 py-2 border-t bg-zinc-950 flex items-center gap-2",children:[(0,v.jsx)("div",{className:(0,k.cn)("size-2 rounded-full",l&&"bg-blue-500 animate-pulse",c&&"bg-green-500",u&&"bg-red-500")}),(0,v.jsx)("span",{className:"text-xs text-zinc-500",children:l?"Running":c?"Done":"Failed"})]})]})})}function xQ({step:e}){let t=(e=>{switch(e){case"grep":return pv.default;case"glob":case"list_dir":return xH;case"read_file":return gK.default;case"semantic_search":return xK.default;default:return xU}})(e.toolName);if("tool_call"===e.type){let r=function(e){try{if(null==e)return"";if("string"==typeof e)return e;return JSON.stringify(e)}catch{return String(e)}}(e.toolInput);return(0,v.jsxs)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:[(0,v.jsx)(aI.default,{className:"size-3 text-blue-400 mt-0.5 shrink-0"}),(0,v.jsx)(t,{className:"size-3 text-blue-400 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-blue-400",children:e.toolName}),r&&(0,v.jsx)("span",{className:"text-zinc-600 truncate",children:xJ(r,60)})]})}return"tool_result"===e.type?(0,v.jsxs)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:[(0,v.jsx)(oa,{className:"size-3 text-green-500 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-500 truncate",children:xJ(e.content,80)})]}):"thought"===e.type?(0,v.jsxs)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:[(0,v.jsx)(xK.default,{className:"size-3 text-amber-400 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-400 italic",children:xJ(e.content,80)})]}):(0,v.jsx)("div",{className:"px-3 py-0.5 hover:bg-zinc-900/50 flex items-start gap-2",children:(0,v.jsx)("span",{className:"text-zinc-300",children:xJ(e.content,100)})})}let x0=(e,t)=>e?e.length>t?e.slice(0,t)+"...":e:"";function x1({input:e,output:t,status:r,steps:n=[],className:s}){let[i,a]=(0,b.useState)(!1),[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),h=(0,b.useRef)(!1),m="pending"===r||"streaming"===r||"running"===r,p="completed"===r,f="error"===r||t?.success===!1;(0,b.useEffect)(()=>{m&&(h.current=!0),p&&!i&&(h.current||t?.formattedResult||t?.summary)&&(a(!0),h.current=!1)},[m,p,i,t]);let g=(0,b.useMemo)(()=>(e=>{let t=e.filter(e=>"tool_call"===e.type),r=new Set;for(let e of t)if("read_file"===e.toolName&&e.toolInput){let t=e.toolInput;t.path&&r.add(t.path)}return{toolCallCount:t.length,filesExplored:r.size}})(n),[n]);(0,b.useEffect)(()=>{d.current&&m&&i&&(d.current.scrollTop=d.current.scrollHeight)},[n,m,i]);let x=e?.query||"",y=(e=>{if(0===e.length)return null;let t=e[e.length-1];return"tool_call"===t.type&&t.toolName?{type:"tool",name:t.toolName}:"thought"===t.type||"text"===t.type?{type:"text",content:x0(t.content,40)}:null})(n),w=(0,b.useMemo)(()=>t?"string"==typeof t?t:t.result?t.result:t.formattedResult?t.formattedResult:t.summary?t.summary:t.text?String(t.text):t.content?String(t.content):"":"",[t]),j=(e=>{if(!e)return"";let t=e.split("\n")[0].trim(),r=t.match(/^[^.!?]+[.!?]/);return r?r[0]:x0(t,100)})(w),N=w.length>200;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",s),children:[(0,v.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[(0,v.jsx)("div",{className:"shrink-0",children:m?(0,v.jsx)(xY,{className:"size-3.5 text-muted-foreground animate-spin"}):p&&!f?(0,v.jsx)(oa,{className:"size-4 text-green-500"}):f?(0,v.jsx)(od.default,{className:"size-4 text-red-500"}):(0,v.jsx)(pv.default,{className:"size-4 text-muted-foreground"})}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsx)("div",{className:"text-xs",children:m?(0,v.jsx)("span",{className:"text-muted-foreground",children:"Exploring the codebase"}):p&&!f?(0,v.jsx)("span",{className:"text-muted-foreground",children:"Exploration complete"}):f?(0,v.jsx)("span",{className:"text-red-500 text-xs",children:"Exploration failed"}):(0,v.jsx)("span",{className:"text-muted-foreground",children:"Exploring..."})}),m&&y&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground truncate mt-0.5",children:"tool"===y.type?(0,v.jsx)("span",{className:"font-mono",children:y.name}):(0,v.jsx)("span",{className:"italic",children:y.content})}),p&&!f&&j&&(0,v.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:j}),p&&!f&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground/60 mt-0.5",children:(t?.matchCount??0)>0||(t?.filesSearched??0)>0?`${t?.matchCount??0} matches \xb7 ${t?.filesSearched??0} files`:g.toolCallCount>0?`${g.toolCallCount} actions \xb7 ${g.filesExplored} files explored`:null})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[(0,v.jsxs)(S.Button,{variant:"ghost",size:"sm",className:"h-7 px-2.5 text-xs gap-1.5",onClick:()=>u(!0),children:[(0,v.jsx)(xX.default,{className:"size-3"}),"View Progress"]}),(0,v.jsx)("button",{onClick:()=>a(!i),className:"p-1 hover:bg-muted rounded transition-colors",children:i?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})})]})]}),i&&(0,v.jsxs)("div",{className:"border-t",children:[(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/30 border-b",children:(0,v.jsxs)("div",{className:"flex items-start gap-2",children:[(0,v.jsx)(pv.default,{className:"size-3 text-muted-foreground mt-0.5 shrink-0"}),(0,v.jsx)("p",{className:"text-xs text-muted-foreground truncate",title:x,children:x0(x,100)})]})}),w&&(0,v.jsxs)("div",{className:"border-b",children:[(0,v.jsx)("div",{className:"px-3 py-2",children:o?(0,v.jsx)("div",{className:"text-sm text-foreground whitespace-pre-wrap break-words max-h-[300px] overflow-auto",children:w}):(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:j})}),N&&(0,v.jsx)("button",{onClick:()=>l(!o),className:"w-full px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 flex items-center justify-center gap-1 border-t",children:o?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oo.ChevronDownIcon,{className:"size-3"}),"Show less"]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(aI.default,{className:"size-3"}),"Show full result"]})})]}),f&&t&&(0,v.jsx)("div",{className:"px-3 py-2 text-xs text-red-400 border-b",children:t.error||"Exploration failed"}),n.length>0&&(0,v.jsxs)("div",{ref:d,className:"max-h-[100px] overflow-auto bg-zinc-950/50",children:[n.slice(-6).map((e,t)=>(0,v.jsx)(x2,{step:e},e.id||t)),n.length>6&&(0,v.jsxs)("div",{className:"px-3 py-1 text-xs text-zinc-500",children:["+",n.length-6," more steps"]})]})]}),(0,v.jsx)(xZ,{open:c,onOpenChange:u,title:"Explore Agent",description:"Exploring your codebase to find relevant information",query:x,steps:n,status:m?"running":f?"error":"completed"})]})}function x2({step:e}){let t=(e=>{switch(e){case"grep":return pv.default;case"glob":case"list_dir":return xH;case"read_file":return gK.default;case"semantic_search":return xK.default;default:return xU}})(e.toolName);return(0,v.jsxs)("div",{className:"px-3 py-1 text-xs font-mono border-b border-zinc-800/50 last:border-0 flex items-center gap-2",children:["tool_call"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(t,{className:"size-2.5 text-blue-400 shrink-0"}),(0,v.jsx)("span",{className:"text-blue-400 truncate",children:e.toolName})]}),"tool_result"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(oa,{className:"size-2.5 text-green-400 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-500 truncate",children:x0(e.content,50)})]}),"text"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(xK.default,{className:"size-2.5 text-purple-400 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-400 truncate",children:x0(e.content,50)})]}),"thought"===e.type&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(xK.default,{className:"size-2.5 text-amber-400 shrink-0"}),(0,v.jsx)("span",{className:"text-zinc-500 italic truncate",children:x0(e.content,50)})]})]})}var aI=aI,gL=gL;let x5=(0,A.default)("trash",[["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);var od=od,oc=oc,gK=gK,x3=e.i(261527),x3=x3,xX=xX,x4=e.i(231181),x4=x4;let x6={pending:ol,in_progress:xn,completed:oa,cancelled:od.default},x8={pending:"text-muted-foreground",in_progress:"text-blue-600 dark:text-blue-400",completed:"text-green-600 dark:text-green-400",cancelled:"text-muted-foreground/50"},x9={add:"Add Tasks",list:"List Tasks",mark:"Update Task",clear:"Clear Tasks",save_plan:"Save Plan",list_plans:"List Plans",get_plan:"View Plan",delete_plan:"Delete Plan"},x7=({action:e})=>{switch(e){case"add":return(0,v.jsx)(gL.default,{className:"size-3.5"});case"list":default:return(0,v.jsx)(xs,{className:"size-3.5"});case"mark":return(0,v.jsx)(oa,{className:"size-3.5"});case"clear":return(0,v.jsx)(x5,{className:"size-3.5"});case"save_plan":return(0,v.jsx)(gK.default,{className:"size-3.5"});case"list_plans":return(0,v.jsx)(x3.default,{className:"size-3.5"});case"get_plan":return(0,v.jsx)(xX.default,{className:"size-3.5"});case"delete_plan":return(0,v.jsx)(x4.default,{className:"size-3.5"})}};function ye({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),a=e?.action||"list",o="pending"===r||"streaming"===r||"running"===r,l="completed"===r,c="error"===r||t?.success===!1,u=l&&t?.success?oa:c?od.default:o?oc.default:xs,d=l&&t?.success?"text-green-600 dark:text-green-500":c?"text-red-600 dark:text-red-500":o?"text-muted-foreground animate-pulse":"text-muted-foreground",h=e=>{let t=x6[e.status]||ol,r=x8[e.status]||"text-muted-foreground";return(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1",children:[(0,v.jsx)(t,{className:(0,k.cn)("size-4 mt-0.5 shrink-0",r)}),(0,v.jsx)("span",{className:(0,k.cn)("text-sm","cancelled"===e.status&&"line-through text-muted-foreground/50","completed"===e.status&&"text-muted-foreground"),children:e.content})]},e.id)};return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(u,{className:(0,k.cn)("size-4 shrink-0",d)}),(0,v.jsx)(x7,{action:a}),(0,v.jsx)("span",{className:"font-medium text-sm",children:x9[a]||a}),o&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"running..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.stats&&(0,v.jsx)("div",{className:"flex items-center gap-1.5 text-xs",children:(0,v.jsxs)("span",{className:"text-muted-foreground",children:[t.stats.completed,"/",t.stats.total]})}),t?.itemsAdded!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs bg-green-500/10 text-green-600 dark:text-green-400",children:["+",t.itemsAdded]}),t?.itemsRemoved!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs",children:["cleared ",t.itemsRemoved]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[t?.stats&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30 border-b flex items-center gap-4 text-xs",children:[(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(ol,{className:"size-3 text-muted-foreground"}),(0,v.jsxs)("span",{children:[t.stats.pending," pending"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(xn,{className:"size-3 text-blue-500"}),(0,v.jsxs)("span",{children:[t.stats.inProgress," active"]})]}),(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(oa,{className:"size-3 text-green-500"}),(0,v.jsxs)("span",{children:[t.stats.completed," done"]})]})]}),t?.items&&t.items.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:t.items.map(h)}),t?.item&&!t.items&&(0,v.jsx)("div",{className:"px-3 py-2",children:h(t.item)}),"add"===a&&e?.items&&!t?.items&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:e.items.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-start gap-2 py-1 text-muted-foreground",children:[(0,v.jsx)(ol,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{className:"text-sm",children:e.content})]},t))}),t?.action==="save_plan"&&t.planName&&(0,v.jsxs)("div",{className:"px-3 py-2 space-y-1",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,v.jsx)(gK.default,{className:"size-4 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"font-medium",children:t.planName}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",(t.sizeChars??0).toLocaleString()," chars)"]})]}),t.autoCreatedTodos&&t.autoCreatedTodos.length>0&&(0,v.jsx)("div",{className:"mt-2 pt-2 border-t",children:(0,v.jsxs)("span",{className:"text-xs text-green-600 dark:text-green-400 font-medium",children:["Auto-created ",t.autoCreatedTodos.length," todo(s) from plan"]})})]}),t?.action==="list_plans"&&t.plans&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[200px] overflow-auto",children:0===t.plans.length?(0,v.jsx)("p",{className:"text-sm text-muted-foreground",children:"No plans yet"}):t.plans.map(e=>(0,v.jsxs)("div",{className:"flex items-center gap-2 py-1",children:[(0,v.jsx)(gK.default,{className:"size-4 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"text-sm font-medium",children:e.title||e.name}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:["(",e.sizeChars.toLocaleString()," chars)"]})]},e.name))}),t?.action==="get_plan"&&t.content&&(0,v.jsx)("div",{className:"px-3 py-2 max-h-[300px] overflow-auto",children:(0,v.jsx)("pre",{className:"text-xs font-mono whitespace-pre-wrap leading-relaxed text-muted-foreground",children:t.content.length>2e3?t.content.slice(0,2e3)+"\n... (truncated in UI)":t.content})}),t?.action==="delete_plan"&&t.planName&&(0,v.jsxs)("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:["Deleted plan: ",t.planName]}),"list"===a&&t?.items?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No tasks yet"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(od.default,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}var yt=e.i(978964),yt=yt,aI=aI,oc=oc,om=om,yr=e.i(114507),yr=yr,xK=xK,od=od;function yn({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),a=e?.action||"list",o=e?.skillName||t?.skillName,l="pending"===r||"streaming"===r||"running"===r,c="completed"===r,u="error"===r||t?.success===!1,d=c&&t?.success?oa:u?od.default:l?oc.default:yt.default,h=c&&t?.success?"text-green-600 dark:text-green-500":u?"text-red-600 dark:text-red-500":l?"text-muted-foreground animate-pulse":"text-muted-foreground",m="load"===a?o?`Load: ${o}`:"Load Skill":"List Skills";return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(d,{className:(0,k.cn)("size-4 shrink-0",h)}),"list"===a?(0,v.jsx)(yr.default,{className:"size-3.5 text-muted-foreground"}):(0,v.jsx)(xK.default,{className:"size-3.5 text-muted-foreground"}),(0,v.jsx)("span",{className:"font-medium text-sm truncate",children:m}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"loading..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[t?.skillCount!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs",children:[t.skillCount," skills"]}),t?.contentLength!==void 0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs",children:[Math.round(t.contentLength/1e3),"k chars"]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[t?.skills&&t.skills.length>0&&(0,v.jsx)("div",{className:"max-h-[200px] overflow-auto",children:t.skills.map((e,r)=>(0,v.jsxs)("div",{className:(0,k.cn)("px-3 py-2 flex items-start gap-2",r<t.skills.length-1&&"border-b"),children:[(0,v.jsx)(yt.default,{className:"size-4 mt-0.5 shrink-0 text-muted-foreground"}),(0,v.jsxs)("div",{className:"min-w-0",children:[(0,v.jsx)("div",{className:"font-medium text-sm",children:e.name}),e.description&&(0,v.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.description})]})]},e.name))}),"load"===a&&t?.success&&t.skillName&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30",children:[(0,v.jsxs)("div",{className:"flex items-center justify-between",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)(xK.default,{className:"size-4 text-green-600 dark:text-green-400"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:t.skillName})]}),t.content&&(0,v.jsx)(S.Button,{variant:"ghost",size:"icon",className:"size-6",onClick:e=>{e.stopPropagation(),navigator.clipboard.writeText(t.content)},children:(0,v.jsx)(om.default,{className:"size-3"})})]}),t.description&&(0,v.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:t.description})]}),t?.content&&(0,v.jsx)("div",{className:"max-h-[150px] overflow-auto border-t",children:(0,v.jsxs)("pre",{className:"px-3 py-2 text-xs font-mono text-muted-foreground whitespace-pre-wrap",children:[t.content.slice(0,500),t.content.length>500&&"..."]})}),t?.availableSkills&&t.availableSkills.length>0&&(0,v.jsx)("div",{className:"px-3 py-2 bg-muted/30 border-t",children:(0,v.jsxs)("div",{className:"text-xs text-muted-foreground",children:["Available: ",t.availableSkills.join(", ")]})}),"list"===a&&t?.skills?.length===0&&(0,v.jsx)("div",{className:"px-3 py-4 text-center text-muted-foreground text-sm",children:"No skills available"}),t?.error&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-red-500/5 text-red-600 dark:text-red-400 text-xs flex items-start gap-2",children:[(0,v.jsx)(od.default,{className:"size-3.5 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]})]})]})}var xF=xF,aI=aI;let ys=(0,A.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),yi=(0,A.default)("search-code",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);function ya({severity:e,className:t}){switch(e){case"error":return(0,v.jsx)(xF.default,{className:(0,k.cn)("text-red-500",t)});case"warning":return(0,v.jsx)(xm,{className:(0,k.cn)("text-yellow-500",t)});case"info":return(0,v.jsx)(ys,{className:(0,k.cn)("text-blue-500",t)});default:return(0,v.jsx)(ys,{className:(0,k.cn)("text-muted-foreground",t)})}}function yo({file:e,isExpanded:t,onToggle:r}){let n=e.errors>0,s=e.warnings>0;return(0,v.jsxs)("div",{className:"border-b last:border-b-0",children:[(0,v.jsxs)("button",{onClick:r,className:"flex items-center justify-between w-full px-3 py-2 hover:bg-muted/50 transition-colors text-left",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(xw,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsx)("span",{className:"font-mono text-sm truncate",children:e.relativePath}),n&&(0,v.jsxs)(N.Badge,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(xF.default,{className:"size-3"}),e.errors]}),s&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(xm,{className:"size-3"}),e.warnings]})]}),t?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground shrink-0"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground shrink-0"})]}),t&&e.diagnostics.length>0&&(0,v.jsx)("div",{className:"bg-muted/30 px-3 py-2 space-y-1",children:e.diagnostics.map((e,t)=>(0,v.jsxs)("div",{className:(0,k.cn)("flex items-start gap-2 px-2 py-1.5 rounded text-sm","error"===e.severity&&"bg-red-500/5","warning"===e.severity&&"bg-yellow-500/5"),children:[(0,v.jsx)(ya,{severity:e.severity,className:"size-4 mt-0.5 shrink-0"}),(0,v.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,v.jsxs)("span",{className:"font-mono text-xs text-muted-foreground shrink-0",children:[e.line,":",e.column]}),e.source&&(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs",children:e.source}),e.code&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground font-mono",children:["[",e.code,"]"]})]}),(0,v.jsx)("p",{className:"text-sm mt-0.5 break-words",children:e.message})]})]},t))})]})}function yl({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)(new Set),l="pending"===r||"streaming"===r||"running"===r||"completed"===r&&!t,c="completed"===r&&t?.success===!0,u="error"===r||t?.success===!1,d=t?.totalErrors??0,h=t?.totalWarnings??0,m=d>0||h>0,p=t?.files?.length??0,f=(0,b.useMemo)(()=>e.paths&&0!==e.paths.length?1===e.paths.length?e.paths[0]:`${e.paths.length} paths`:"all files",[e.paths]),g=(0,b.useMemo)(()=>t?.files?.filter(e=>e.errors>0)||[],[t?.files]);(0,b.useMemo)(()=>{g.length>0&&0===a.size&&o(new Set(g.slice(0,5).map(e=>e.path)))},[g]);let x=m?xF.default:c?oa:u?xF.default:yi,y=m?"text-red-500":c?"text-green-500":u?"text-red-500":"text-muted-foreground";return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(x,{className:(0,k.cn)("size-4 shrink-0",y)}),(0,v.jsx)("span",{className:"font-medium text-sm",children:"Linter"}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground truncate",children:[c?"checked":"checking"," ",f]}),l&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"analyzing..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[c&&(0,v.jsxs)(v.Fragment,{children:[d>0&&(0,v.jsxs)(N.Badge,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(xF.default,{className:"size-3"}),d," error",1!==d?"s":""]}),h>0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",children:[(0,v.jsx)(xm,{className:"size-3"}),h," warning",1!==h?"s":""]}),!m&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,v.jsx)(oa,{className:"size-3"}),"No issues"]})]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[l?(0,v.jsxs)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:[(0,v.jsx)(yi,{className:"size-6 mx-auto mb-2 animate-pulse"}),(0,v.jsx)("span",{children:"Analyzing files for lint errors..."})]}):u&&t?.error?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(xF.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}):t?.files&&t.files.length>0?(0,v.jsx)("div",{className:"max-h-[400px] overflow-y-auto",children:t.files.map(e=>(0,v.jsx)(yo,{file:e,isExpanded:a.has(e.path),onToggle:()=>{var t;return t=e.path,void o(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})}},e.path))}):(0,v.jsx)("div",{className:"px-3 py-4 text-sm",children:t?.message?(0,v.jsxs)("div",{className:"flex items-center gap-2 text-green-600 dark:text-green-400",children:[(0,v.jsx)(oa,{className:"size-4"}),(0,v.jsx)("span",{children:t.message})]}):(0,v.jsx)("div",{className:"text-muted-foreground italic",children:"No files analyzed yet."})}),c&&p>0&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-muted/30 text-xs text-muted-foreground",children:["Checked ",p," file",1!==p?"s":"",m&&(0,v.jsxs)("span",{children:[" • ",(0,v.jsxs)("span",{className:d>0?"text-red-500":"",children:[d," error",1!==d?"s":""]})," • ",(0,v.jsxs)("span",{className:h>0?"text-yellow-500":"",children:[h," warning",1!==h?"s":""]})]})]})]})]})}var xF=xF,aI=aI;let yc=(0,A.default)("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]),yu=(0,A.default)("panels-top-left",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]),yd=(0,A.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);function yh({input:e,output:t,status:r,className:n}){let[s,i]=(0,b.useState)(!0),a="pending"===r||"streaming"===r||"running"===r||"completed"===r&&!t,o="completed"===r&&t?.success===!0,l="error"===r||t?.success===!1,c=t?.referenceCount??0,u=t?.referenceFiles??0,d=t?.pages?.length??0;return(0,v.jsxs)("div",{className:(0,k.cn)("rounded-lg border overflow-hidden bg-background",n),children:[(0,v.jsxs)("button",{onClick:()=>i(!s),className:"flex items-center justify-between w-full px-3 py-2.5 bg-muted/50 hover:bg-muted/70 transition-colors",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,v.jsx)(yd,{className:(0,k.cn)("size-4 shrink-0",o?"text-blue-500":l?"text-red-500":"text-muted-foreground")}),(0,v.jsx)("span",{className:"font-medium text-sm",children:"Code Graph"}),(0,v.jsx)("span",{className:"font-mono text-xs text-muted-foreground truncate",children:e.symbol}),a&&(0,v.jsx)("span",{className:"text-xs text-muted-foreground animate-pulse",children:"analyzing..."})]}),(0,v.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[o&&(0,v.jsxs)(v.Fragment,{children:[c>0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1",children:[(0,v.jsx)(yc,{className:"size-3"}),c," ref",1!==c?"s":""]}),d>0&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-blue-500/10 text-blue-600 dark:text-blue-400",children:[(0,v.jsx)(yu,{className:"size-3"}),d," page",1!==d?"s":""]}),0===c&&0===d&&(0,v.jsxs)(N.Badge,{variant:"secondary",className:"text-xs gap-1 bg-green-500/10 text-green-600 dark:text-green-400",children:[(0,v.jsx)(oa,{className:"size-3"}),"Found"]})]}),l&&(0,v.jsxs)(N.Badge,{variant:"destructive",className:"text-xs gap-1",children:[(0,v.jsx)(xF.default,{className:"size-3"}),"Error"]}),s?(0,v.jsx)(oo.ChevronDownIcon,{className:"size-4 text-muted-foreground"}):(0,v.jsx)(aI.default,{className:"size-4 text-muted-foreground"})]})]}),s&&(0,v.jsxs)("div",{className:"border-t",children:[a?(0,v.jsxs)("div",{className:"px-3 py-8 text-center text-muted-foreground text-sm",children:[(0,v.jsx)(yd,{className:"size-6 mx-auto mb-2 animate-pulse"}),(0,v.jsx)("span",{children:"Inspecting symbol graph..."})]}):l&&t?.error?(0,v.jsxs)("div",{className:"px-3 py-4 text-red-600 dark:text-red-400 text-sm flex items-start gap-2",children:[(0,v.jsx)(xF.default,{className:"size-4 mt-0.5 shrink-0"}),(0,v.jsx)("span",{children:t.error})]}):t?.formattedResult?(0,v.jsxs)("div",{className:"max-h-[500px] overflow-y-auto",children:[(t.filePath||t.kind||t.typeInfo)&&(0,v.jsxs)("div",{className:"px-3 py-2 bg-muted/30 border-b space-y-1",children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,v.jsx)(xw,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,v.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[t.filePath,t.line?`:${t.line}`:""]}),t.kind&&(0,v.jsx)(N.Badge,{variant:"outline",className:"text-xs",children:t.kind})]}),t.typeInfo&&(0,v.jsx)("pre",{className:"font-mono text-xs text-foreground/80 whitespace-pre-wrap break-words leading-relaxed",children:t.typeInfo})]}),t.pages&&t.pages.length>0&&(0,v.jsxs)("div",{className:"px-3 py-2 border-b",children:[(0,v.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-1",children:"Pages"}),t.pages.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-center gap-2 py-0.5 text-sm",children:[(0,v.jsx)(yu,{className:"size-3 text-blue-500 shrink-0"}),(0,v.jsx)("span",{className:"font-mono text-xs",children:e.path}),e.route&&(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:["→ ",e.route]})]},t))]}),(0,v.jsx)("pre",{className:"px-3 py-3 text-xs font-mono whitespace-pre-wrap break-words leading-relaxed text-foreground/80",children:t.formattedResult})]}):(0,v.jsx)("div",{className:"px-3 py-4 text-muted-foreground text-sm italic",children:"No result yet."}),o&&(0,v.jsxs)("div",{className:"px-3 py-2 border-t bg-muted/30 text-xs text-muted-foreground",children:[c>0?`${c} reference${1!==c?"s":""} across ${u} file${1!==u?"s":""}`:"No external references",d>0&&` \xb7 ${d} page${1!==d?"s":""}`,e.depth&&e.depth>1&&` \xb7 depth ${e.depth}`]})]})]})}var ym=e.i(29343),yp=e.i(573656),yf=e.i(743053);function yg({toolName:e,input:t,output:r}){let n="complete_task"===e,s="task_failed"===e,i=r&&"validation_error"===r.status;return(0,v.jsxs)("div",{className:(0,k.cn)("mb-4 w-full max-w-full overflow-hidden rounded-lg border transition-colors",n&&!i&&"border-emerald-500/30",s&&"border-red-500/30",i&&"border-amber-500/30"),children:[(0,v.jsxs)("div",{className:(0,k.cn)("flex items-center gap-2.5 px-4 py-3",n&&!i&&"bg-emerald-500/5",s&&"bg-red-500/5",i&&"bg-amber-500/5"),children:[i?(0,v.jsx)(xm,{className:"size-4 text-amber-500 shrink-0"}):n?(0,v.jsx)(ym.CheckCircle2,{className:"size-4 text-emerald-500 shrink-0"}):(0,v.jsx)(yp.XCircle,{className:"size-4 text-red-500 shrink-0"}),(0,v.jsx)("span",{className:"font-medium text-sm",children:i?"Schema mismatch":n?"Task completed":"Task failed"}),i&&(0,v.jsx)(N.Badge,{variant:"secondary",className:"ml-auto text-[10px] bg-amber-500/10 text-amber-600 dark:text-amber-400",children:"Retry needed"})]}),(0,v.jsxs)("div",{className:"p-4",children:[n&&t.result&&(0,v.jsx)("div",{className:"rounded-md border bg-muted/30 overflow-hidden",children:(0,v.jsx)(yf.VisualJson,{value:t.result,children:(0,v.jsx)(yf.TreeView,{className:"max-h-64 text-sm"})})}),s&&t.reason&&(0,v.jsx)("p",{className:"text-sm text-red-600 dark:text-red-400",children:String(t.reason)}),i&&r.errors&&(0,v.jsx)("div",{className:"space-y-2",children:(0,v.jsx)("div",{className:"rounded-md bg-amber-500/5 border border-amber-500/20 p-3 space-y-1.5",children:r.errors.map((e,t)=>(0,v.jsxs)("div",{className:"flex items-baseline gap-2 text-sm",children:[(0,v.jsx)("code",{className:"text-[11px] bg-muted px-1.5 py-0.5 rounded shrink-0 font-mono",children:e.path}),(0,v.jsx)("span",{className:"text-amber-700 dark:text-amber-300",children:e.message})]},t))})})]})]})}let yx=(0,A.default)("mic",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["rect",{x:"9",y:"2",width:"6",height:"13",rx:"3",key:"s6n7sd"}]]),yy=(0,A.default)("mic-off",[["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M16.95 16.95A7 7 0 0 1 5 12v-2",key:"cqa7eg"}],["path",{d:"M18.89 13.23A7 7 0 0 0 19 12v-2",key:"16hl24"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}]]),yv=({className:e,onTranscriptionChange:t,onInterimTranscription:r,onAudioRecorded:n,lang:s="en-US",disabled:i,...a})=>{let[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(!1),[d,h]=(0,b.useState)("none"),m=(0,b.useRef)(null),p=(0,b.useRef)(null),f=(0,b.useRef)([]),g=(0,b.useRef)("");(0,b.useEffect)(()=>{h("SpeechRecognition"in window||"webkitSpeechRecognition"in window?"speech-recognition":"MediaRecorder"in window&&"mediaDevices"in navigator?"media-recorder":"none")},[]),(0,b.useEffect)(()=>{if("speech-recognition"!==d)return;let e=new(window.SpeechRecognition||window.webkitSpeechRecognition);return e.continuous=!0,e.interimResults=!0,e.lang=s,e.onstart=()=>{l(!0),g.current=""},e.onend=()=>{l(!1),r?.("")},e.onresult=e=>{let n="",s="";for(let t=e.resultIndex;t<e.results.length;t++){let r=e.results[t],i=r[0]?.transcript??"";r.isFinal?s+=i:n+=i}s&&(g.current+=s,t?.(s),r?.("")),n&&r?.(n)},e.onerror=e=>{console.error("Speech recognition error:",e.error),l(!1),r?.("")},m.current=e,()=>{m.current&&m.current.abort()}},[d,s,t,r]);let x=(0,b.useCallback)(async()=>{if(!n)return void console.warn("SpeechInput: onAudioRecorded callback is required for MediaRecorder fallback");try{let e=await navigator.mediaDevices.getUserMedia({audio:!0}),r=new MediaRecorder(e);f.current=[],r.ondataavailable=e=>{e.data.size>0&&f.current.push(e.data)},r.onstop=async()=>{for(let t of e.getTracks())t.stop();let r=new Blob(f.current,{type:"audio/webm"});if(r.size>0){u(!0);try{let e=await n(r);e&&t?.(e)}catch(e){console.error("Transcription error:",e)}finally{u(!1)}}},r.onerror=t=>{for(let r of(console.error("MediaRecorder error:",t),l(!1),e.getTracks()))r.stop()},p.current=r,r.start(),l(!0)}catch(e){console.error("Failed to start MediaRecorder:",e),l(!1)}},[n,t]),y=(0,b.useCallback)(()=>{p.current?.state==="recording"&&p.current.stop(),l(!1)},[]),w=(0,b.useCallback)(()=>{if("speech-recognition"===d&&m.current)if(o)m.current.stop();else try{m.current.start()}catch(e){console.warn("Speech recognition start error:",e)}else"media-recorder"===d&&(o?y():x())},[d,o,x,y]),j=i||"none"===d||"speech-recognition"===d&&!m.current||"media-recorder"===d&&!n||c;return"none"===d?(0,v.jsx)(S.Button,{type:"button",className:(0,k.cn)("relative rounded-full opacity-50 cursor-not-allowed",e),disabled:!0,title:"Speech recognition not supported in this browser",...a,children:(0,v.jsx)(yy,{className:"size-4"})}):(0,v.jsxs)("div",{className:"relative inline-flex items-center justify-center",children:[o&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("span",{className:"absolute inset-0 rounded-full bg-red-500/20 animate-ping"}),(0,v.jsx)("span",{className:"absolute inset-0 rounded-full bg-red-500/10 animate-ping",style:{animationDelay:"0.2s"}})]}),(0,v.jsxs)(S.Button,{type:"button",className:(0,k.cn)("relative z-10 rounded-full transition-all duration-200",o?"bg-red-500 text-white hover:bg-red-600 shadow-lg shadow-red-500/25":"hover:bg-muted",e),disabled:j,onClick:w,title:o?"Stop recording":"Start voice input",variant:o?"default":"ghost",...a,children:[c&&(0,v.jsx)(xY,{className:"size-4 animate-spin"}),!c&&o&&(0,v.jsxs)("div",{className:"relative",children:[(0,v.jsx)(yx,{className:"size-4"}),(0,v.jsx)("span",{className:"absolute -top-0.5 -right-0.5 size-2 bg-white rounded-full animate-pulse"})]}),!(c||o)&&(0,v.jsx)(yx,{className:"size-4"})]})]})},yb=(0,A.default)("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);function yw({sessionId:e,frame:t,metadata:r,active:n,onDismiss:s}){let[i,a]=(0,b.useState)(!1),[o,l]=(0,b.useState)({x:0,y:0}),[c,u]=(0,b.useState)(!1),d=(0,b.useRef)(null),h=(0,b.useRef)({x:0,y:0,posX:0,posY:0}),m=(0,b.useCallback)(e=>{i||(u(!0),h.current={x:e.clientX,y:e.clientY,posX:o.x,posY:o.y},e.preventDefault())},[i,o]);(0,b.useEffect)(()=>{if(!c)return;let e=e=>{l({x:h.current.posX+(e.clientX-h.current.x),y:h.current.posY+(e.clientY-h.current.y)})},t=()=>u(!1);return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[c]);let p=(0,b.useCallback)(t=>{if(!r)return;let n=t.currentTarget.getBoundingClientRect(),s=Math.round((t.clientX-n.left)*(r.deviceWidth/n.width)),i=Math.round((t.clientY-n.top)*(r.deviceHeight/n.height));(0,xt.sendBrowserInput)(e,{type:"input_mouse",eventType:"mousePressed",x:s,y:i,button:"left",clickCount:1}).catch(()=>{}),setTimeout(()=>{(0,xt.sendBrowserInput)(e,{type:"input_mouse",eventType:"mouseReleased",x:s,y:i,button:"left"}).catch(()=>{})},50)},[e,r]);return n&&t?i?(0,v.jsx)(pb.Dialog,{open:!0,onOpenChange:e=>!e&&a(!1),children:(0,v.jsxs)(pb.DialogContent,{className:"max-w-4xl w-full p-0 overflow-hidden rounded-xl",children:[(0,v.jsx)(pb.DialogHeader,{className:"px-5 pt-5 pb-3",children:(0,v.jsxs)(pb.DialogTitle,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,v.jsx)(gX,{className:"size-4 text-muted-foreground"}),"Live Browser",r&&(0,v.jsxs)("span",{className:"text-xs font-normal text-muted-foreground",children:[r.deviceWidth," x ",r.deviceHeight]})]})}),(0,v.jsx)("div",{className:"px-5 pb-5",children:(0,v.jsx)("img",{src:`data:image/jpeg;base64,${t}`,alt:"Browser preview",className:"w-full h-auto rounded-lg cursor-crosshair",onClick:p,draggable:!1})})]})}):(0,v.jsxs)("div",{ref:d,className:(0,k.cn)("fixed z-50 overflow-hidden rounded-xl","border border-border/60 bg-background/95 backdrop-blur-xl","shadow-[0_8px_30px_rgba(0,0,0,0.12)] dark:shadow-[0_8px_30px_rgba(0,0,0,0.4)]","transition-all duration-200",c?"scale-[0.98] shadow-[0_4px_20px_rgba(0,0,0,0.08)]":"hover:shadow-[0_12px_40px_rgba(0,0,0,0.15)]"),style:{bottom:`calc(1.25rem - ${o.y}px)`,right:`calc(1.25rem - ${o.x}px)`,width:300},children:[(0,v.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 cursor-grab active:cursor-grabbing select-none",onMouseDown:m,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[(0,v.jsx)("div",{className:"flex items-center justify-center size-5 rounded-md bg-blue-500/10 dark:bg-blue-400/10",children:(0,v.jsx)(gX,{className:"size-3 text-blue-600 dark:text-blue-400"})}),(0,v.jsx)("span",{className:"text-xs font-medium text-foreground/80",children:"Live Browser"}),(0,v.jsx)("span",{className:"size-1.5 rounded-full bg-emerald-500 shadow-[0_0_4px_rgba(16,185,129,0.5)]"})]}),(0,v.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,v.jsx)(S.Button,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground rounded-md",onClick:()=>a(!0),children:(0,v.jsx)(yb,{className:"size-3"})}),(0,v.jsx)(S.Button,{variant:"ghost",size:"icon-xs",className:"text-muted-foreground hover:text-foreground rounded-md",onClick:s,children:(0,v.jsx)(xk.X,{className:"size-3"})})]})]}),(0,v.jsxs)("div",{className:"relative px-2 pb-2",children:[(0,v.jsx)("div",{className:"overflow-hidden rounded-lg ring-1 ring-border/40",children:(0,v.jsx)("img",{src:`data:image/jpeg;base64,${t}`,alt:"Browser preview",className:"w-full h-auto cursor-crosshair",onClick:p,draggable:!1})}),r&&(0,v.jsxs)("div",{className:"absolute bottom-3 right-3 text-[10px] font-mono text-white/60 bg-black/40 backdrop-blur-sm px-1.5 py-0.5 rounded",children:[r.deviceWidth,"x",r.deviceHeight]})]})]}):null}function yj(e){return e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(0)} KB`:`${e} B`}function yk({fileName:e,downloadUrl:t,sizeBytes:r,createdAt:n,className:s}){let[i,a]=(0,b.useState)(!1);return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)("button",{onClick:()=>a(!0),className:(0,k.cn)("inline-flex items-center gap-1.5 px-2 py-1 rounded-md","text-xs text-muted-foreground","bg-muted/40 hover:bg-muted/70","border border-transparent hover:border-border/50","transition-all duration-150",s),title:"View browser recording",children:[(0,v.jsx)("div",{className:"flex items-center justify-center size-4 rounded bg-violet-500/10 dark:bg-violet-400/10",children:(0,v.jsx)(xC,{className:"size-2.5 text-violet-600 dark:text-violet-400 ml-[1px]"})}),(0,v.jsx)("span",{className:"font-medium text-foreground/70",children:"Recording"}),null!=r&&(0,v.jsx)("span",{className:"text-muted-foreground/50",children:yj(r)})]}),(0,v.jsx)(pb.Dialog,{open:i,onOpenChange:a,children:(0,v.jsxs)(pb.DialogContent,{className:"max-w-4xl w-full p-0 overflow-hidden rounded-xl",children:[(0,v.jsx)(pb.DialogHeader,{className:"px-5 pt-5 pb-3",children:(0,v.jsxs)(pb.DialogTitle,{className:"flex items-center gap-2 text-sm font-medium",children:[(0,v.jsx)("div",{className:"flex items-center justify-center size-6 rounded-lg bg-violet-500/10 dark:bg-violet-400/10",children:(0,v.jsx)(gX,{className:"size-3.5 text-violet-600 dark:text-violet-400"})}),"Browser Recording",n&&(0,v.jsx)("span",{className:"text-xs font-normal text-muted-foreground",children:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),null!=r&&(0,v.jsx)("span",{className:"text-xs font-normal text-muted-foreground/50",children:yj(r)})]})}),(0,v.jsx)("div",{className:"px-5 pb-5",children:(0,v.jsx)("div",{className:"overflow-hidden rounded-lg bg-black ring-1 ring-border/20",children:(0,v.jsx)("video",{src:t,controls:!0,autoPlay:!0,className:"w-full",playsInline:!0})})})]})})]})}function yN(e){var t;let r,n=(t=e,(r=b.forwardRef((e,t)=>{let{children:r,...n}=e;if(b.isValidElement(r)){var s;let e,i,a=(s=r,(i=(e=Object.getOwnPropertyDescriptor(s.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.ref:(i=(e=Object.getOwnPropertyDescriptor(s,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?s.props.ref:s.props.ref||s.ref),o=function(e,t){let r={...t};for(let n in t){let s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...e)=>{let t=i(...e);return s(...e),t}:s&&(r[n]=s):"style"===n?r[n]={...s,...i}:"className"===n&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}(n,r.props);return r.type!==b.Fragment&&(o.ref=t?(0,aX.composeRefs)(t,a):a),b.cloneElement(r,o)}return b.Children.count(r)>1?b.Children.only(null):null})).displayName=`${t}.SlotClone`,r),s=b.forwardRef((e,t)=>{let{children:r,...s}=e,i=b.Children.toArray(r),a=i.find(yC);if(a){let e=a.props.children,r=i.map(t=>t!==a?t:b.Children.count(e)>1?b.Children.only(null):b.isValidElement(e)?e.props.children:null);return(0,v.jsx)(n,{...s,ref:t,children:b.isValidElement(e)?b.cloneElement(e,void 0,r):null})}return(0,v.jsx)(n,{...s,ref:t,children:r})});return s.displayName=`${e}.Slot`,s}var yS=Symbol("radix.slottable");function yC(e){return b.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===yS}var yA=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let r=yN(`Primitive.${t}`),n=b.forwardRef((e,n)=>{let{asChild:s,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,v.jsx)(s?r:t,{...i,ref:n})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),y_="Popover",[yT,yE]=function(e,t=[]){let r=[],n=()=>{let t=r.map(e=>b.createContext(e));return function(r){let n=r?.[e]||t;return b.useMemo(()=>({[`__scope${e}`]:{...r,[e]:n}}),[r,n])}};return n.scopeName=e,[function(t,n){let s=b.createContext(n),i=r.length;r=[...r,n];let a=t=>{let{scope:r,children:n,...a}=t,o=r?.[e]?.[i]||s,l=b.useMemo(()=>a,Object.values(a));return(0,v.jsx)(o.Provider,{value:l,children:n})};return a.displayName=t+"Provider",[a,function(r,a){let o=a?.[e]?.[i]||s,l=b.useContext(o);if(l)return l;if(void 0!==n)return n;throw Error(`\`${r}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let r=()=>{let r=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let n=r.reduce((t,{useScope:r,scopeName:n})=>{let s=r(e)[`__scope${n}`];return{...t,...s}},{});return b.useMemo(()=>({[`__scope${t.scopeName}`]:n}),[n])}};return r.scopeName=t.scopeName,r}(n,...t)]}(y_,[pI.createPopperScope]),yP=(0,pI.createPopperScope)(),[yR,yM]=yT(y_),yI=e=>{let{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:i,modal:a=!1}=e,o=yP(t),l=b.useRef(null),[c,u]=b.useState(!1),[d,h]=(0,aH.useControllableState)({prop:n,defaultProp:s??!1,onChange:i,caller:y_});return(0,v.jsx)(pI.Root,{...o,children:(0,v.jsx)(yR,{scope:t,contentId:(0,a0.useId)(),triggerRef:l,open:d,onOpenChange:h,onOpenToggle:b.useCallback(()=>h(e=>!e),[h]),hasCustomAnchor:c,onCustomAnchorAdd:b.useCallback(()=>u(!0),[]),onCustomAnchorRemove:b.useCallback(()=>u(!1),[]),modal:a,children:r})})};yI.displayName=y_;var yL="PopoverAnchor",yD=b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yM(yL,r),i=yP(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return b.useEffect(()=>(a(),()=>o()),[a,o]),(0,v.jsx)(pI.Anchor,{...i,...n,ref:t})});yD.displayName=yL;var yz="PopoverTrigger";b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yM(yz,r),i=yP(r),a=(0,aX.useComposedRefs)(t,s.triggerRef),o=(0,v.jsx)(yA.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":yX(s.open),...n,ref:a,onClick:(0,aq.composeEventHandlers)(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:(0,v.jsx)(pI.Anchor,{asChild:!0,...i,children:o})}).displayName=yz;var yO="PopoverPortal",[yB,yF]=yT(yO,{forceMount:void 0}),y$=e=>{let{__scopePopover:t,forceMount:r,children:n,container:s}=e,i=yM(yO,t);return(0,v.jsx)(yB,{scope:t,forceMount:r,children:(0,v.jsx)(aQ.Presence,{present:r||i.open,children:(0,v.jsx)(pL.Portal,{asChild:!0,container:s,children:n})})})};y$.displayName=yO;var yV="PopoverContent",yU=b.forwardRef((e,t)=>{let r=yF(yV,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,i=yM(yV,e.__scopePopover);return(0,v.jsx)(aQ.Presence,{present:n||i.open,children:i.modal?(0,v.jsx)(yG,{...s,ref:t}):(0,v.jsx)(yq,{...s,ref:t})})});yU.displayName=yV;var yW=yN("PopoverContent.RemoveScroll"),yG=b.forwardRef((e,t)=>{let r=yM(yV,e.__scopePopover),n=b.useRef(null),s=(0,aX.useComposedRefs)(t,n),i=b.useRef(!1);return b.useEffect(()=>{let e=n.current;if(e)return(0,p6.hideOthers)(e)},[]),(0,v.jsx)(p8.RemoveScroll,{as:yW,allowPinchZoom:!0,children:(0,v.jsx)(yH,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,aq.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),i.current||r.triggerRef.current?.focus()}),onPointerDownOutside:(0,aq.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;i.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,aq.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),yq=b.forwardRef((e,t)=>{let r=yM(yV,e.__scopePopover),n=b.useRef(!1),s=b.useRef(!1);return(0,v.jsx)(yH,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(n.current||r.triggerRef.current?.focus(),t.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(n.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let i=t.target;r.triggerRef.current?.contains(i)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),yH=b.forwardRef((e,t)=>{let{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,h=yM(yV,r),m=yP(r);return(0,pR.useFocusGuards)(),(0,v.jsx)(pM.FocusScope,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:i,children:(0,v.jsx)(pP.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:u,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>h.onOpenChange(!1),children:(0,v.jsx)(pI.Content,{"data-state":yX(h.open),role:"dialog",id:h.contentId,...m,...d,ref:t,style:{...d.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)"}})})})}),yK="PopoverClose";function yX(e){return e?"open":"closed"}function yY({...e}){return(0,v.jsx)(yI,{"data-slot":"popover",...e})}function yJ({className:e,align:t="center",sideOffset:r=4,...n}){return(0,v.jsx)(y$,{children:(0,v.jsx)(yU,{"data-slot":"popover-content",align:t,sideOffset:r,className:(0,k.cn)("bg-popover text-popover-foreground 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-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...n})})}function yZ({...e}){return(0,v.jsx)(yD,{"data-slot":"popover-anchor",...e})}b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yM(yK,r);return(0,v.jsx)(yA.button,{type:"button",...n,ref:t,onClick:(0,aq.composeEventHandlers)(e.onClick,()=>s.onOpenChange(!1))})}).displayName=yK,b.forwardRef((e,t)=>{let{__scopePopover:r,...n}=e,s=yP(r);return(0,v.jsx)(pI.Arrow,{...s,...n,ref:t})}).displayName="PopoverArrow";let yQ=(0,A.default)("hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]),y0=(0,A.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),y1=(0,b.createContext)(null),y2=/@(mcp\/[\w-]+|[\w./-]+\/?)/g,y5=[{id:"help",name:"help",description:"Ask about available features",icon:(0,v.jsx)(y0,{className:"size-4"}),prompt:"What commands and features are available? How can you help me?"},{id:"terminal",name:"terminal",description:"Open a new terminal",icon:(0,v.jsx)(xU,{className:"size-4"}),prompt:"Please open a new terminal session for me."},{id:"explain",name:"explain",description:"Explain a file or code",icon:(0,v.jsx)(xw,{className:"size-4"}),prompt:"Please explain this code: "},{id:"fix",name:"fix",description:"Fix a bug or issue",icon:(0,v.jsx)(yQ,{className:"size-4"}),prompt:"Please help me fix this issue: "},{id:"refactor",name:"refactor",description:"Refactor code",icon:(0,v.jsx)(yQ,{className:"size-4"}),prompt:"Please refactor this code to be cleaner and more maintainable: "},{id:"test",name:"test",description:"Write tests",icon:(0,v.jsx)(yQ,{className:"size-4"}),prompt:"Please write tests for: "}];function y3({children:e}){let t=(0,b.useCallback)(e=>{let t,r=[],n=RegExp(y2.source,"g");for(;null!==(t=n.exec(e));){let e=t[1],n=e.endsWith("/");r.push({id:`mention-${t.index}`,type:n?"folder":"file",path:n?e.slice(0,-1):e,name:e.split("/").pop()?.replace(/\/$/,"")||e})}return r},[]),r=(0,b.useCallback)(()=>{},[]),n=(0,b.useMemo)(()=>({extractMentions:t,clear:r}),[t,r]);return(0,v.jsx)(y1.Provider,{value:n,children:e})}function y4({sessionId:t,value:r,onChange:n,onSlashCommand:s,slashCommands:i=y5,showHighlights:a=!0,className:o,onKeyDown:l,disabled:c,...u}){let d=(0,b.useRef)(null),h=(0,b.useRef)(null),[m,p]=(0,b.useState)(null),[f,g]=(0,b.useState)(0),[x,y]=(0,b.useState)({top:0,left:0}),[w,j]=(0,b.useState)(!1),N=g$(),{files:S,isLoading:C}=function({sessionId:e,query:t,enabled:r=!0,limit:n=20,debounceMs:s=150}){let[i,a]=(0,b.useState)([]),[o,l]=(0,b.useState)(!1),[c,u]=(0,b.useState)(null),[d,h]=(0,b.useState)(null),m=(0,b.useRef)(null),p=(0,b.useRef)(null),f=(0,b.useCallback)(async t=>{p.current&&p.current.abort(),p.current=new AbortController;try{l(!0),u(null);let r=await (0,xt.getWorkspaceFiles)(e,t,n);a(r.files),h(r.workingDirectory),r.error&&u(r.error)}catch(e){e instanceof Error&&"AbortError"!==e.name&&(u(e.message),a([]))}finally{l(!1)}},[e,n]);return(0,b.useEffect)(()=>r&&e?(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{f(t)},s),()=>{m.current&&clearTimeout(m.current)}):void a([]),[t,r,e,s,f]),(0,b.useEffect)(()=>()=>{p.current&&p.current.abort(),m.current&&clearTimeout(m.current)},[]),{files:i,isLoading:o,error:c,workingDirectory:d}}({sessionId:t,query:m?.type==="file"?m.query:"",enabled:m?.type==="file",limit:15}),[A,_]=(0,b.useState)([]);(0,b.useEffect)(()=>{if(m?.type!=="mcp"&&m?.type!=="file")return void _([]);let t=!1;return(async()=>{try{let{getApiUrl:r}=await e.A(596066),n=await fetch(`${r()}/api/mcp`);if(!n.ok)return;let s=await n.json();if(t)return;let i=(m.query||"").toLowerCase(),a=(s.servers||[]).filter(e=>e.enabled).filter(e=>!i||e.name.toLowerCase().includes(i));_(a)}catch{t||_([])}})(),()=>{t=!0}},[m]);let T=(0,b.useMemo)(()=>{if(m?.type!=="command")return[];let e=m.query.toLowerCase();return i.filter(t=>t.name.toLowerCase().includes(e)||t.description.toLowerCase().includes(e))},[m,i]),E=m?.type==="file"?[...A,...S]:m?.type==="mcp"?A:T,P=null!==m&&(E.length>0||C),R=(0,b.useCallback)(()=>{let e=d.current;if(!e||!m)return;let t=document.createElement("div"),n=window.getComputedStyle(e);["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingLeft","paddingTop","border","borderWidth","boxSizing","whiteSpace","wordWrap","wordBreak"].forEach(e=>{t.style[e]=n[e]}),t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto",t.style.width=`${e.clientWidth}px`,t.style.overflow="hidden",t.textContent=r.substring(0,m.startIndex);let s=document.createElement("span");s.textContent="|",t.appendChild(s),document.body.appendChild(t);let i=e.getBoundingClientRect(),a=s.getBoundingClientRect(),o=t.getBoundingClientRect(),l=a.left-o.left,c=a.top-o.top+parseInt(n.lineHeight),u=e.scrollTop;document.body.removeChild(t),y({left:Math.min(l,i.width-250),top:c-u+4})},[m,r]);(0,b.useEffect)(()=>{R()},[R]);let M=(0,b.useCallback)((e,t)=>{if(0===t)return void p(null);let r=e.slice(0,t),n=r.match(/@mcp(?:[\/:]([^\s@]*))?$/i);if(n){p({type:"mcp",query:n[1]??"",startIndex:t-n[0].length,endIndex:t}),g(0);return}let s=r.match(/@([^\s@]*)$/);if(s){p({type:"file",query:s[1],startIndex:t-s[0].length,endIndex:t}),g(0);return}let i=r.match(/(?:^|\s)\/([^\s]*)$/);if(i){p({type:"command",query:i[1],startIndex:t-i[1].length-1,endIndex:t}),g(0);return}p(null)},[]),I=(0,b.useCallback)(e=>{let t=e.target.value,r=e.target.selectionStart??0;n(t),M(t,r)},[n,M]),L=(0,b.useCallback)(e=>{if(m&&d.current){if("name"in e&&"transport"in e){let t=r.slice(0,m.startIndex),s=r.slice(m.endIndex),i=`@mcp/${e.name} `;n(t+i+s),setTimeout(()=>{if(d.current){let e=m.startIndex+i.length;d.current.selectionStart=e,d.current.selectionEnd=e,d.current.focus()}},0),p(null);return}if("file"===m.type&&"path"in e){let t=r.slice(0,m.startIndex),s=r.slice(m.endIndex),i=`@${e.path}${"folder"===e.type?"/":""} `;n(t+i+s),setTimeout(()=>{if(d.current){let e=m.startIndex+i.length;d.current.selectionStart=e,d.current.selectionEnd=e,d.current.focus()}},0)}else if("command"===m.type&&"description"in e){if(e.action)e.action(),s?.(e),n((r.slice(0,m.startIndex)+r.slice(m.endIndex)).trim());else if(e.prompt){let t=r.slice(0,m.startIndex),s=r.slice(m.endIndex);n(t+e.prompt+s),setTimeout(()=>{if(d.current){let t=m.startIndex+e.prompt.length;d.current.selectionStart=t,d.current.selectionEnd=t,d.current.focus()}},0)}else s?.(e),n((r.slice(0,m.startIndex)+r.slice(m.endIndex)).trim());setTimeout(()=>{d.current?.focus()},0)}p(null)}},[m,r,n,s]),D=(0,b.useCallback)(e=>{if(l?.(e),!e.defaultPrevented){if(P)switch(e.key){case"ArrowDown":e.preventDefault(),g(e=>(e+1)%E.length);return;case"ArrowUp":e.preventDefault(),g(e=>(e-1+E.length)%E.length);return;case"Tab":case"Enter":E.length>0&&(e.preventDefault(),L(E[f]));return;case"Escape":e.preventDefault(),p(null);return}if("Enter"===e.key){if(w||e.nativeEvent.isComposing||e.shiftKey)return;e.preventDefault();let t=e.currentTarget,r=t.form||t.closest("form");if(r){let e=r.querySelector('button[type="submit"]');if(e?.disabled)return;e?e.click():r.requestSubmit()}}if("Backspace"===e.key&&""===r&&N.files.length>0){e.preventDefault();let t=N.files.at(-1);t&&N.remove(t.id)}}},[P,E,f,L,l,w,r,N]),z=(0,b.useCallback)(e=>{let t=e.clipboardData?.items;if(!t)return;let r=[];for(let e of t)if("file"===e.kind){let t=e.getAsFile();t&&r.push(t)}r.length>0&&(e.preventDefault(),N.add(r))},[N]),O=(0,b.useCallback)(()=>{let e=d.current;e&&M(r,e.selectionStart??0)},[r,M]),B=(0,b.useCallback)(()=>{d.current&&h.current&&(h.current.scrollTop=d.current.scrollTop)},[]);return(0,v.jsxs)("div",{className:"relative w-full",children:[(0,v.jsxs)(yY,{open:P,onOpenChange:()=>p(null),children:[(0,v.jsx)(yZ,{style:{position:"absolute",left:x.left,top:x.top,width:0,height:0}}),(0,v.jsx)(yJ,{align:"start",side:"top",className:"w-64 p-0",onOpenAutoFocus:e=>e.preventDefault(),children:(0,v.jsx)(pw,{children:(0,v.jsxs)(pj,{children:[C&&m?.type==="file"&&(0,v.jsx)("div",{className:"p-2 text-sm text-muted-foreground text-center",children:"Loading..."}),!C&&0===E.length&&(0,v.jsx)(pk,{children:m?.type==="file"?"No files found":m?.type==="mcp"?"No MCP servers configured. Add one in Settings → MCP.":"No commands found"}),(m?.type==="mcp"||m?.type==="file")&&A.length>0&&(0,v.jsx)(pN,{heading:"MCP servers",children:A.map((e,t)=>(0,v.jsxs)(pS,{onSelect:()=>L(e),className:(0,k.cn)("cursor-pointer",t===f&&"bg-accent"),children:[(0,v.jsx)(yQ,{className:"mr-2 size-4 text-emerald-500"}),(0,v.jsxs)("div",{className:"flex flex-col",children:[(0,v.jsx)("span",{className:"font-medium",children:e.name}),(0,v.jsxs)("span",{className:"text-xs text-muted-foreground",children:[e.transport," · tools: mcp_",e.name,"_*"]})]})]},e.id))}),m?.type==="file"&&S.length>0&&(0,v.jsx)(pN,{heading:"Files & Folders",children:S.map((e,t)=>{let r=A.length+t;return(0,v.jsxs)(pS,{onSelect:()=>L(e),className:(0,k.cn)("cursor-pointer",r===f&&"bg-accent"),children:["folder"===e.type?(0,v.jsx)(xH,{className:"mr-2 size-4 text-blue-500"}):(0,v.jsx)(xw,{className:"mr-2 size-4 text-muted-foreground"}),(0,v.jsx)("span",{className:"truncate",children:e.path})]},e.path)})}),m?.type==="command"&&T.length>0&&(0,v.jsx)(pN,{heading:"Commands",children:T.map((e,t)=>(0,v.jsxs)(pS,{onSelect:()=>L(e),className:(0,k.cn)("cursor-pointer",t===f&&"bg-accent"),children:[e.icon||(0,v.jsx)(yQ,{className:"mr-2 size-4"}),(0,v.jsxs)("div",{className:"flex flex-col ml-2",children:[(0,v.jsxs)("span",{className:"font-medium",children:["/",e.name]}),(0,v.jsx)("span",{className:"text-xs text-muted-foreground",children:e.description})]})]},e.id))})]})})})]}),a&&(0,v.jsx)("div",{ref:h,"aria-hidden":"true",className:"absolute inset-0 pointer-events-none overflow-hidden whitespace-pre-wrap break-words px-3 py-3 text-sm",style:{color:"transparent"},children:(()=>{let e,t=[],n=RegExp(y2.source,"g"),s=0;for(;null!==(e=n.exec(r));)e.index>s&&t.push((0,v.jsx)("span",{children:r.slice(s,e.index)},`text-${s}`)),t.push((0,v.jsx)("mark",{className:"bg-primary/20 text-transparent rounded-sm",children:e[0]},`mention-${e.index}`)),s=e.index+e[0].length;return s<r.length&&t.push((0,v.jsx)("span",{children:r.slice(s)},`text-${s}`)),t.push((0,v.jsx)("span",{children:"\n"},"trailing")),t})()}),(0,v.jsx)("textarea",{ref:d,name:"message","data-slot":"input-group-control",value:r,onChange:I,onKeyDown:D,onClick:O,onScroll:B,onPaste:z,onCompositionStart:()=>j(!0),onCompositionEnd:()=>j(!1),disabled:c,className:(0,k.cn)("flex-1 w-full resize-none rounded-none border-0 py-3 px-3 text-sm shadow-none","placeholder:text-muted-foreground focus-visible:ring-0 focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50","bg-transparent dark:bg-transparent",o),...u})]})}let y6=/\s*<devtools-context>[\s\S]*?<\/devtools-context>\s*/,y8={SLACK:"bg-purple-500/10 text-purple-600 dark:text-purple-300 border-purple-500/30",SYSTEM:"bg-blue-500/10 text-blue-600 dark:text-blue-300 border-blue-500/30",SCHEDULE:"bg-amber-500/10 text-amber-600 dark:text-amber-300 border-amber-500/30",WEBHOOK:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-300 border-emerald-500/30"};function y9({channel:e,detail:t}){if("WEB"===e)return null;let r=y8[e]||"bg-muted text-muted-foreground border-border";return(0,v.jsxs)("span",{className:`inline-flex items-center gap-1 text-[10px] font-medium uppercase tracking-wide px-1.5 py-0.5 rounded border mr-2 mb-1 ${r}`,children:[(0,v.jsx)("span",{children:e}),t&&(0,v.jsx)("span",{className:"font-normal normal-case opacity-80",children:t})]})}let y7=new Set(["SYSTEM","SCHEDULE","WEBHOOK"]);function ve({input:e,output:t,status:r}){if(!e||"post"!==e.action)return null;let n=String(e.channel||"unknown").toUpperCase(),s=y8[n]||"bg-muted text-muted-foreground border-border",i=String(e.to||""),a=e.threadTs?String(e.threadTs):null,o=String(e.text||""),l=t&&"object"==typeof t&&!1!==t.ok,c=t&&"object"==typeof t?t.error:void 0,u="streaming"===r||"running"===r||"pending"===r||"input-available"===r;return(0,v.jsxs)("div",{className:"flex flex-col items-start gap-1 my-2 max-w-[80%]",children:[(0,v.jsxs)("div",{className:`inline-flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-wide px-2 py-0.5 rounded-md border ${s}`,children:[(0,v.jsxs)("span",{children:["→ Sent via ",n]}),i&&(0,v.jsxs)("span",{className:"font-normal normal-case opacity-80",children:["to ",i]}),a&&(0,v.jsxs)("span",{className:"font-normal normal-case opacity-60",children:["thread ",a]})]}),(0,v.jsx)("div",{className:`rounded-2xl border bg-card/40 px-3 py-2 ${u?"opacity-60":""}`,children:o?(0,v.jsx)("p",{className:"text-sm whitespace-pre-wrap",children:o}):(0,v.jsx)("p",{className:"text-xs italic text-muted-foreground",children:"(empty message)"})}),(0,v.jsx)("div",{className:"text-[10px] text-muted-foreground flex items-center gap-1",children:u?(0,v.jsx)("span",{className:"opacity-70",children:"sending…"}):l?(0,v.jsx)("span",{className:"text-emerald-500",children:"✓ delivered"}):(0,v.jsxs)("span",{className:"text-rose-500",children:["✗ failed",c?`: ${c}`:""]})})]})}function vt({pill:e,body:t}){let[r,n]=b.useState(!1),s=y8[e.channel]||"bg-muted text-muted-foreground border-border",i=t.split("\n").find(e=>e.trim().length>0)||"",a=i.length>140?i.slice(0,140)+"…":i,o=t.includes("\n")||t.length>140;return(0,v.jsx)("div",{className:"flex justify-center my-1.5",children:(0,v.jsxs)("button",{type:"button",onClick:()=>o&&n(e=>!e),className:`group max-w-[80%] text-left rounded-md border px-2 py-1 transition-colors ${s} ${o?"cursor-pointer hover:opacity-90":"cursor-default"}`,children:[(0,v.jsxs)("div",{className:"flex items-center gap-2 text-[10px] uppercase tracking-wide",children:[(0,v.jsx)("span",{className:"font-medium",children:e.channel}),e.detail&&(0,v.jsx)("span",{className:"font-normal normal-case opacity-80 truncate",children:e.detail}),o&&(0,v.jsx)(xN.ChevronDown,{className:`h-3 w-3 ml-auto shrink-0 transition-transform ${r?"rotate-180":""}`})]}),r?(0,v.jsx)("pre",{className:"mt-1 text-[11px] whitespace-pre-wrap font-mono opacity-90 max-h-[400px] overflow-y-auto",children:t}):(0,v.jsx)("p",{className:"mt-0.5 text-[11px] opacity-80 truncate",children:a})]})})}function vr(){let{toggleSidebar:e,isMobile:t}=(0,xM.useSidebar)();return t?(0,v.jsxs)(S.Button,{size:"icon",variant:"ghost",onClick:e,className:"size-7 shrink-0",children:[(0,v.jsx)(xb.PanelLeft,{className:"size-4"}),(0,v.jsx)("span",{className:"sr-only",children:"Toggle sidebar"})]}):null}function vn(){let e=g$();return 0===e.files.length?null:(0,v.jsx)(g5,{variant:"inline",children:e.files.map(t=>(0,v.jsxs)(g3,{data:t,onRemove:()=>e.remove(t.id),children:[(0,v.jsx)(g4,{}),(0,v.jsx)(g6,{}),(0,v.jsx)(g8,{})]},t.id))})}function vs({input:e,isRunning:t,onStop:r,hasExtraContent:n}){let s=g$(),i=e.trim()||s.files.length>0||!!n;return t&&i?(0,v.jsxs)("div",{className:"flex items-center gap-1",children:[(0,v.jsx)(gH,{disabled:!1,status:"ready",className:"bg-primary hover:bg-primary/90 transition-colors"}),(0,v.jsx)(gH,{disabled:!1,status:"streaming",onStop:r,className:"bg-destructive/80 hover:bg-destructive transition-colors"})]}):(0,v.jsx)(gH,{disabled:!t&&!i,status:t?"streaming":"ready",onStop:r,className:"bg-primary hover:bg-primary/90 transition-colors"})}async function vi(e){let t=async(e,t)=>{try{return await t()}catch(e){return{__error:e?.message??String(e)}}},[r,n,s,i,a,o,l,c,u,d,h,m]=await Promise.all([t("session",()=>(0,xt.getSession)(e)),t("messages",()=>(0,xt.getSessionMessages)(e)),t("todos",()=>(0,xt.getSessionTodos)(e)),t("plans",()=>(0,xt.getSessionPlans)(e)),t("checkpoints",()=>(0,xt.getSessionCheckpoints)(e)),t("diff",()=>(0,xt.getSessionDiff)(e)),t("attachments",()=>(0,xt.getSessionAttachments)(e)),t("files",()=>(0,xt.getSessionFiles)(e)),t("pendingApprovals",()=>(0,xt.getPendingApprovals)(e)),t("pendingInput",()=>(0,xt.getPendingInput)(e)),t("browserStream",()=>(0,xt.getBrowserStreamStatus)(e)),t("browserRecordings",()=>(0,xt.getBrowserRecordings)(e))]);return JSON.stringify(function e(t,r=0){if(r>100)return"[max depth]";if(null==t)return t;if("string"==typeof t)return t.length>8192&&/^(data:[^;]+;base64,)?[A-Za-z0-9+/=]{1000,}$/.test(t)?`[stripped: ~${(t.length/1024).toFixed(1)}KB base64]`:t;if(Array.isArray(t))return t.map(t=>e(t,r+1));if("object"==typeof t){let n=t.type;if("image-data"===n||"image"===n||"file"===n){let e="string"==typeof t.data?t.data.length:0,r="string"==typeof t.image?t.image.length:0;return{type:n,mediaType:t.mediaType,filename:t.filename,__strippedBytes:e||r||0}}let s={};for(let[n,i]of Object.entries(t)){if(("data"===n||"image"===n||"base64"===n)&&"string"==typeof i&&i.length>4096){s[n]=`[stripped: ~${(i.length/1024).toFixed(1)}KB]`;continue}s[n]=e(i,r+1)}return s}return t}({__meta:{kind:"sparkecoder-session-debug-dump",version:2,capturedAt:new Date().toISOString(),sessionId:e,origin:window.location.origin,userAgent:"u">typeof navigator?navigator.userAgent:null,stripping:"binary blobs (images, file uploads, base64 > 8KB) are replaced with size markers"},session:r,messages:n,todos:s,plans:i,checkpoints:a,diff:o,attachments:l,files:c,pendingApprovals:u,pendingInput:d,browserStream:h,browserRecordings:m}),null,2)}function va({session:t,isEmbed:r=!1}){let n,s,i,a,{toggleSidebar:o}=(0,xM.useSidebar)(),[l,c]=(0,b.useState)([]),[u,d]=(0,b.useState)(""),[h,m]=(0,b.useState)(""),[p,f]=(0,b.useState)(null),[g,x]=(0,b.useState)(!1),[y,w]=(0,b.useState)([]),A=(0,b.useRef)([]);A.current=y;let[_,T]=(0,b.useState)(null),[E,P]=(0,b.useState)(""),[R,M]=(0,b.useState)(!0),[I,L]=(0,b.useState)(!1),[D,z]=(0,b.useState)([]),[O,U]=(0,b.useState)([]),[W,G]=(0,b.useState)(!1),[q,H]=(0,b.useState)(null),[K,X]=(0,b.useState)(""),[Y,J]=(0,b.useState)(""),[Z,Q]=(0,b.useState)(!1),[ee,et]=(0,b.useState)([]),[er,en]=(0,b.useState)([]),[es,ei]=(0,b.useState)(null),[ea,eo]=(0,b.useState)([]),[el,ec]=(0,b.useState)([]),[eu,ed]=(0,b.useState)(!1),eh=(0,b.useRef)(""),em=(0,b.useRef)(""),ep=(0,b.useRef)([]),[ef,eg]=(0,b.useState)(!1),ex=(0,b.useRef)(null),ey=(0,b.useRef)(null),ev=(0,b.useRef)(!1),eb=(0,b.useRef)(!1),ew=(0,b.useRef)(new Map),[ej,ek]=(0,b.useState)(t.model),[eN,eS]=(0,b.useState)(t.name||""),[eC,eA]=(0,b.useState)(!1),[e_,eT]=(0,b.useState)(null),[eE,eP]=(0,b.useState)(t.config||{}),[eR,eM]=(0,b.useState)(!1),eI=(0,b.useRef)(null),eL=(0,b.useRef)(t.id);eL.current=t.id;let{playDing:eD}=(0,xu.useNotificationSound)(),[ez,eO]=(0,b.useState)(null),[eB,eF]=(0,b.useState)(!1),[e$,eV]=(0,b.useState)(!1),[eU,eW]=(0,b.useState)(!1),[eG,eq]=(0,b.useState)(null),[eH,eK]=(0,b.useState)(null),[eX,eY]=(0,b.useState)(!1),eJ=(0,b.useRef)(null),eZ=(0,b.useRef)(0),[eQ,e0]=(0,b.useState)([]),[e1,e2]=(0,b.useState)(!1),[e5,e3]=(0,b.useState)([]),[e4,e6]=(0,b.useState)("idle");(0,b.useEffect)(()=>{(0,xl.getConfig)().then(eT)},[]),(0,b.useEffect)(()=>{let e=localStorage.getItem("sparkecoder-dismissed-version");(0,xt.checkVersion)().then(t=>{t.updateAvailable&&t.latestVersion!==e&&eO(t)}).catch(e=>{console.error("Failed to check version:",e)})},[]),(0,b.useEffect)(()=>{ek(t.model),eS(t.name||""),eP(t.config||{})},[t.id,t.model,t.name,t.config]),(0,b.useEffect)(()=>{eC&&eI.current&&(eI.current.focus(),eI.current.select())},[eC]);let e8=async e=>{ek(e);try{await (0,xt.updateSession)(t.id,{model:e}),(0,xc.mutateSessions)()}catch(e){console.error("Failed to update model:",e),ek(t.model)}},e9=async()=>{eA(!1);let e=eN.trim()||"Session";if(e!==t.name)try{await (0,xt.updateSession)(t.id,{name:e}),(0,xc.mutateSessions)()}catch(e){console.error("Failed to update name:",e),eS(t.name||"")}},e7=async()=>{if(ez?.updateCommand&&!g){eV(!0);try{let e=`Run this update command:
|
|
8
8
|
|
|
9
9
|
${ez.updateCommand}`;ti(e),eF(!0)}catch(e){console.error("Failed to start update:",e)}finally{eV(!1)}}},te=e=>{if(e&&"object"==typeof e&&"type"in e&&"value"in e){if("json"===e.type||"text"===e.type)return e.value;if("content"===e.type&&Array.isArray(e.value)){let t=e.value,r=t.find(e=>"text"===e.type),n=t.find(e=>"image-data"===e.type);return n?{success:!0,content:r?.text||"",imageData:n.data,mediaType:n.mediaType}:r?.text||e.value}}return e},tt=e=>{let t=[],r=new Map;for(let t of e)if("tool"===t.role&&Array.isArray(t.content)){for(let e of t.content)if("tool-result"===e.type){let t=e.output??e.result;r.set(e.toolCallId,te(t))}}let n=0;for(let s of e){if("user"===s.role){let e="",r=[];if("string"==typeof s.content)e=s.content;else if(Array.isArray(s.content))for(let t of s.content)"text"===t.type&&"text"in t?e+=t.text:"image"===t.type&&"image"in t?r.push({type:"image",data:t.image,mediaType:t.mediaType}):"file"===t.type&&"data"in t&&r.push({type:"file",data:t.data,mediaType:t.mediaType});t.push({id:s.id,type:"user-message",content:e,messageSequence:n,attachments:r.length>0?r:void 0})}else if("assistant"===s.role){if("string"==typeof s.content)s.content.trim()&&t.push({id:s.id,type:"assistant-text",content:s.content});else if(Array.isArray(s.content))for(let e=0;e<s.content.length;e++){let n=s.content[e];if("reasoning"===n.type&&n.text?.trim())t.push({id:`${s.id}-reasoning-${e}`,type:"reasoning",content:n.text});else if("text"===n.type&&n.text?.trim())t.push({id:`${s.id}-text-${e}`,type:"assistant-text",content:n.text});else if("tool-call"===n.type){let i=r.get(n.toolCallId),a=i?.rejected===!0||i?.status==="rejected";t.push({id:`${s.id}-tool-${e}`,type:"tool-call",toolCall:{toolCallId:n.toolCallId,toolName:n.toolName,input:n.input??n.args,output:i,status:a?"rejected":void 0!==i?"completed":"pending"}})}}}n++}return t},tr=async(e,r)=>{let n=el.find(t=>t.messageSequence===e);if(!n)return void console.error("No checkpoint found for message sequence:",e);if(window.confirm("Revert to before this message? This will undo all file changes and delete messages from this point.")){ed(!0);try{await (0,xt.revertToCheckpoint)(t.id,n.id);let[e,s]=await Promise.all([(0,xt.getSessionMessages)(t.id),(0,xt.getSessionCheckpoints)(t.id).catch(()=>({checkpoints:[]}))]),i=[...e].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),a=tt(i);c(a),ec(s.checkpoints||[]),X(""),J(""),et([]),eh.current="",em.current="",ep.current=[],r&&d(r)}catch(e){console.error("Failed to revert:",e),alert("Failed to revert: "+(e instanceof Error?e.message:"Unknown error"))}finally{ed(!1)}}},tn=e=>{if("tool-progress"===e.type){if("bash"===e.toolName&&"started"===e.data.status){let t="string"==typeof e.data.terminalId?e.data.terminalId:void 0;if(!t)return;if(ep.current=ep.current.map(e=>"bash"!==e.toolName||e.terminalId||"running"!==e.status&&"streaming"!==e.status?e:{...e,terminalId:t,liveOutput:""}),et([...ep.current]),!ew.current.has(t)){let e=(0,xt.streamTerminal)(t,e=>{ep.current=ep.current.map(r=>r.terminalId===t?{...r,liveOutput:(r.liveOutput||"")+e}:r),et([...ep.current])},()=>{ew.current.delete(t)});ew.current.set(t,e)}}if("write_file"===e.toolName){let t=e.data;console.log("[FRONTEND] tool-progress received:",e.toolName,t.status,t.isChunked?`chunk=${t.chunkIndex}/${t.chunkCount}`:"",`contentLength=${t.content?.length||0}`,"currentToolCalls:",ep.current.length);let r=ep.current.find(e=>"write_file"===e.toolName&&("running"===e.status||"streaming"===e.status));if("started"===t.status){if(r)ep.current=ep.current.map(e=>"write_file"===e.toolName&&("running"===e.status||"streaming"===e.status)?{...e,liveContent:"",liveOldString:"",liveNewString:""}:e);else{console.log("[FRONTEND] Creating placeholder write_file tool call for:",t.path);let e={toolCallId:`write_file_pending_${Date.now()}`,toolName:"write_file",input:{path:t.relativePath||t.path,mode:t.mode||"full"},status:"streaming",liveContent:"",liveOldString:"",liveNewString:""};ep.current=[...ep.current,e],console.log("[FRONTEND] After adding placeholder, toolCallsRef.current:",ep.current.length)}et([...ep.current])}else if("content"===t.status){if(console.log("[FRONTEND] Received content for write_file, length:",t.content?.length||0,"existingWriteFile:",!!r),r)console.log("[FRONTEND] Updating existing write_file with content"),ep.current=ep.current.map(e=>{if("write_file"===e.toolName&&("running"===e.status||"streaming"===e.status))if("str_replace"===t.mode)return{...e,liveOldString:t.oldString||"",liveNewString:t.newString||""};else{let r=t.isChunked||void 0!==t.chunkIndex||void 0!==t.chunkCount,n=t.content||"";return{...e,liveContent:r?(e.liveContent||"")+n:n}}return e});else{console.log("[FRONTEND] Creating placeholder with content");let e={toolCallId:`write_file_pending_${Date.now()}`,toolName:"write_file",input:{path:t.relativePath||t.path,mode:t.mode||"full"},status:"streaming",liveContent:"str_replace"!==t.mode&&t.content||"",liveOldString:"str_replace"===t.mode&&t.oldString||"",liveNewString:"str_replace"===t.mode&&t.newString||""};ep.current=[...ep.current,e]}et([...ep.current])}}if("explore_agent"===e.toolName){let t=e.data;console.log("[FRONTEND] Explore agent tool-progress:",t.status,t.stepType||"");let r=ep.current.find(e=>"explore_agent"===e.toolName&&("running"===e.status||"streaming"===e.status));if("started"===t.status){if(r)ep.current=ep.current.map(e=>"explore_agent"===e.toolName&&("running"===e.status||"streaming"===e.status)?{...e,exploreSteps:[]}:e);else{let e={toolCallId:`explore_agent_pending_${Date.now()}`,toolName:"explore_agent",input:{},status:"streaming",exploreSteps:[]};ep.current=[...ep.current,e]}et([...ep.current])}else if("step"===t.status&&t.stepType){let e={id:`step_${Date.now()}_${Math.random().toString(36).slice(2,6)}`,type:t.stepType,content:t.stepContent||"",toolName:t.toolName,toolInput:t.toolInput,toolOutput:t.toolOutput,timestamp:Date.now()};ep.current=ep.current.map(t=>"explore_agent"===t.toolName&&("running"===t.status||"streaming"===t.status)?{...t,exploreSteps:[...t.exploreSteps||[],e]}:t),et([...ep.current])}}return}if("browser-frame"===e.type){eZ.current||(eZ.current=0),eZ.current++,1===eZ.current?console.log(`[BROWSER-UI] First browser frame received! dataSize=${e.data?.length??0}, dismissed=${eX}`):eZ.current%50==0&&console.log(`[BROWSER-UI] Browser frame #${eZ.current}`),eq(e.data),eK(e.metadata||null),eX||eW(!0),eJ.current&&clearTimeout(eJ.current),eJ.current=setTimeout(()=>{console.log("[BROWSER-UI] Frame timeout (30s no frames), deactivating preview"),eW(!1)},3e4);return}if("browser-status"===e.type){console.log(`[BROWSER-UI] Browser status: connected=${e.connected} screencasting=${e.screencasting}`),!1===e.connected&&(eJ.current&&clearTimeout(eJ.current),eJ.current=setTimeout(()=>{console.log("[BROWSER-UI] Browser disconnect timeout (5s), clearing preview"),eW(!1),eq(null),eY(!1)},5e3));return}switch(e.type){case"start":case"data-session":case"text-start":case"text-end":break;case"data-stream-id":H(e.streamId),ey.current=e.streamId;break;case"data-user-message":e.data?.content&&!eb.current&&c(t=>{let r="",n=[],s=e.data.content;if("string"==typeof s)r=s;else if(Array.isArray(s))for(let e of s)"text"===e.type&&e.text?r+=e.text:"image"===e.type&&e.image?n.push({type:"image",data:e.image,mediaType:e.mediaType}):"file"===e.type&&e.data&&n.push({type:"file",data:e.data,mediaType:e.mediaType});return t.some(e=>"user-message"===e.type&&e.content===r)?t:[...t,{id:e.data.id||`user-${Date.now()}`,type:"user-message",content:r,attachments:n.length>0?n:void 0}]});break;case"text-delta":eh.current+=e.delta,X(eh.current);break;case"reasoning-start":Q(!0),em.current="",J("");break;case"reasoning-delta":em.current+=e.delta,J(em.current);break;case"reasoning-end":if(Q(!1),em.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:em.current};c(t=>[...t,e])}em.current="",J("");break;case"tool-input-start":if(eh.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:eh.current};c(t=>[...t,e]),eh.current="",X("")}{let t=`${e.toolName}_pending_`,r=ep.current.find(r=>r.toolName===e.toolName&&r.toolCallId.startsWith(t)),n=ep.current.some(t=>t.toolCallId===e.toolCallId);if(r)ep.current=ep.current.map(t=>t.toolCallId!==r.toolCallId?t:{...t,toolCallId:e.toolCallId,toolName:e.toolName,status:"streaming",streamingArgsText:""});else if(!n){let t={toolCallId:e.toolCallId,toolName:e.toolName,input:{},status:"streaming",streamingArgsText:""};ep.current=[...ep.current,t]}}et([...ep.current]);break;case"tool-input-delta":ep.current=ep.current.map(t=>t.toolCallId!==e.toolCallId?t:{...t,streamingArgsText:(t.streamingArgsText||"")+e.argsTextDelta}),et([...ep.current]);break;case"tool-input-available":let r=ep.current.find(t=>t.toolCallId===e.toolCallId),n="write_file"===e.toolName?ep.current.find(e=>"write_file"===e.toolName&&e.toolCallId.startsWith("write_file_pending_")&&"streaming"===e.status):void 0,s="explore_agent"===e.toolName?ep.current.find(e=>"explore_agent"===e.toolName&&e.toolCallId.startsWith("explore_agent_pending_")&&"streaming"===e.status):void 0;if(eh.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:eh.current};c(t=>[...t,e]),eh.current="",X("")}let i={toolCallId:e.toolCallId,toolName:e.toolName,input:e.input,status:"running",streamingArgsText:r?.streamingArgsText,liveContent:n?.liveContent||r?.liveContent,liveOldString:n?.liveOldString||r?.liveOldString,liveNewString:n?.liveNewString||r?.liveNewString,exploreSteps:s?.exploreSteps||r?.exploreSteps};n?ep.current=ep.current.map(e=>e.toolCallId===n.toolCallId?i:e):s?ep.current=ep.current.map(e=>e.toolCallId===s.toolCallId?i:e):r?ep.current=ep.current.map(t=>t.toolCallId!==e.toolCallId?t:i):ep.current=[...ep.current,i],et([...ep.current]);break;case"tool-output-available":let a=ep.current.find(t=>t.toolCallId===e.toolCallId);if(a?.terminalId){let e=ew.current.get(a.terminalId);e&&(e(),ew.current.delete(a.terminalId))}let o=te(e.output),l=o?.rejected===!0||o?.status==="rejected",u=ep.current.find(t=>t.toolCallId===e.toolCallId);ep.current=ep.current.filter(t=>t.toolCallId!==e.toolCallId),et([...ep.current]);let d={id:`tool-${e.toolCallId}`,type:"tool-call",toolCall:{...u||{},toolCallId:e.toolCallId,toolName:u?.toolName||"unknown",input:u?.input||{},output:o,status:l?"rejected":"completed"}};c(t=>{let r=t.findIndex(t=>"tool-call"===t.type&&t.toolCall?.toolCallId===e.toolCallId);if(r>=0){let e=[...t];return e[r]=d,e}return[...t,d]});break;case"data-approval-required":en(t=>t.some(t=>t.id===e.data.id)?t:[...t,e.data]);break;case"finish-step":if(eh.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:eh.current};c(t=>[...t,e]),eh.current="",X("")}break;case"finish":if(eh.current.trim()){let e={id:`text-finish-${Date.now()}`,type:"assistant-text",content:eh.current};c(t=>[...t,e])}if(em.current.trim()){let e={id:`reasoning-finish-${Date.now()}`,type:"reasoning",content:em.current};c(t=>[...t,e])}if(ep.current.length>0){let e=ep.current.map(e=>({id:`tool-${e.toolCallId}`,type:"tool-call",toolCall:{...e,status:"streaming"===e.status||"running"===e.status?"completed":e.status}}));c(t=>{let r=new Set(t.filter(e=>"tool-call"===e.type).map(e=>e.toolCall?.toolCallId)),n=e.filter(e=>!r.has(e.toolCall?.toolCallId));return n.length>0?[...t,...n]:t})}X(""),J(""),Q(!1),et([]),H(null),eh.current="",em.current="",ep.current=[],ex.current=null,ev.current=!1,eb.current=!1,x(!1),G(!1),eD();{let e=t.id;(0,xt.getSessionCheckpoints)(e).then(t=>{eL.current===e&&ec(t.checkpoints||[])}).catch(()=>{}),setTimeout(()=>{eL.current===e&&(0,xt.getSessionFiles)(e).then(t=>{eL.current===e&&e0(t)}).catch(()=>{})},3e3)}{let e=A.current;if(e.length>0){let t=e[0];w(e=>e.slice(1)),setTimeout(()=>{tl.current(t.text,t.attachments,t.selectedElements)},50)}}break;case"abort":if(em.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:em.current};c(t=>[...t,e])}if(eh.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:eh.current+" [stopped]"};c(t=>[...t,e])}X(""),J(""),Q(!1),et([]),H(null),eh.current="",em.current="",ep.current=[],ex.current=null,ev.current=!1,eb.current=!1,x(!1),G(!1);break;case"error":console.error("Agent error:",e.errorText),ex.current=null,x(!1),G(!1)}};(0,b.useEffect)(()=>{let r=!1;(async()=>{eg(!0),c([]),X(""),J(""),et([]),en([]),x(!1),G(!1),H(null),eh.current="",em.current="",ep.current=[],eW(!1),eq(null),eY(!1),eZ.current=0,e0([]);try{let[n,s,i]=await Promise.all([(0,xt.getSessionMessages)(t.id),(0,xt.getSessionCheckpoints)(t.id).catch(()=>({checkpoints:[]})),(0,xt.getSessionFiles)(t.id).catch(()=>[])]);if(r)return;let a=[...n].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),o=tt(a);c(o),ec(s.checkpoints||[]),e0(i);let l=await (0,xt.getActiveStream)(t.id);if(r)return;l.hasActiveStream&&l.stream&&(console.log("Found active stream, connecting...",l.stream.streamId),eb.current=!1,G(!0),x(!0),H(l.stream.streamId),ex.current=(0,xt.watchStream)(t.id,tn,{streamId:l.stream.streamId,onStreamId:e=>H(e)}));try{let{getApiUrl:n}=await e.A(596066),s=`${n()}/sessions/${t.id}/updates`,i=new EventSource(s);i.onmessage=async e=>{try{let n=JSON.parse(e.data);if("turn-complete"===n.type){let e=await (0,xt.getSessionMessages)(t.id);if(r)return;let n=[...e].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime());c(tt(n))}}catch{}},i.onerror=()=>{};let a=ex.current;ex.current=()=>{a?.(),i.close()}}catch(e){console.warn("Failed to open session-updates EventSource:",e)}}catch(e){r||console.error("Failed to load messages:",e)}finally{r||eg(!1)}})();let n=ew.current;return()=>{r=!0,ex.current&&(ex.current(),ex.current=null),n.forEach(e=>e()),n.clear()}},[t.id]),(0,b.useEffect)(()=>{let e=!1,r=t.id,n=async()=>{try{let t=await (0,xt.getPendingApprovals)(r);if(e)return;en(t)}catch{}};n();let s=setInterval(n,2e3);return()=>{e=!0,clearInterval(s)}},[t.id]),(0,b.useEffect)(()=>{let e=!1,r=t.id,n=async()=>{try{let[t,n]=await Promise.all([(0,xt.getSessionTodos)(r),(0,xt.getSessionPlans)(r).catch(()=>({plans:[]}))]);if(e)return;ei(t),eo(n.plans||[])}catch{}};n();let s=setInterval(n,g?1e3:5e3);return()=>{e=!0,clearInterval(s)}},[t.id,g]),(0,b.useEffect)(()=>{let e="1"===new URLSearchParams(window.location.search).get("debugSSE");if(L(e),!e)return;window.__sparkeSseDebug=!0;let t=e=>{let t=e.detail,r=[t?.label,t?.toolName].filter(Boolean).join(" "),n=t?.type?`${t.type}${r?` ${r}`:""} (${t?.size??0}b)`:"unknown";z(e=>[...e.slice(-49),n])},r=e=>{let t=e.detail,r=`parse-error: ${t?.error||"unknown"} (${t?.size??0}b)`;U(e=>[...e.slice(-49),r])};return window.addEventListener("sparke:sse-event",t),window.addEventListener("sparke:sse-parse-error",r),()=>{window.removeEventListener("sparke:sse-event",t),window.removeEventListener("sparke:sse-parse-error",r),window.__sparkeSseDebug=!1}},[]),(0,b.useEffect)(()=>{let e=!1,r=t.id,n=setInterval(async()=>{if(!g&&!ev.current)try{let t=await (0,xt.getActiveStream)(r);if(e)return;if(t.hasActiveStream&&t.stream){let n=t.stream.streamId;if(n!==ey.current){if(console.log("New active stream detected, connecting...",n),ev.current=!0,eb.current=!1,em.current.trim()){let e={id:`reasoning-${Date.now()}`,type:"reasoning",content:em.current};c(t=>[...t,e]),em.current="",J("")}if(eh.current.trim()){let e={id:`text-${Date.now()}`,type:"assistant-text",content:eh.current};c(t=>[...t,e]),eh.current="",X("")}for(let e of ep.current){let t={id:`tool-${e.toolCallId}`,type:"tool-call",toolCall:e};c(r=>r.some(t=>"tool-call"===t.type&&t.toolCall?.toolCallId===e.toolCallId)?r:[...r,t])}ep.current=[],et([]),Q(!1);try{let t=await (0,xt.getSessionMessages)(r);if(e){ev.current=!1;return}let n=[...t].sort((e,t)=>new Date(e.createdAt).getTime()-new Date(t.createdAt).getTime()),s=tt(n);c(s)}catch(e){console.error("Failed to refresh messages:",e)}if(e){ev.current=!1;return}G(!0),x(!0),H(n),ey.current=n,ex.current=(0,xt.watchStream)(r,tn,{streamId:n,onStreamId:e=>{H(e),ey.current=e}}),ev.current=!1}}}catch(e){console.error("Failed to check for new stream:",e),ev.current=!1}},1e3);return()=>{e=!0,clearInterval(n)}},[t.id,g]),(0,b.useEffect)(()=>{let e=!1,r=t.id,n=setInterval(async()=>{if(!g)try{let t=await (0,xt.getPendingInput)(r);if(e||g)return;t.hasPendingInput&&t.text&&(f(e=>e&&e.trim()?e+"\n\n"+t.text:t.text||""),setTimeout(()=>{let e=document.querySelector('textarea[placeholder*="SparkECoder"], textarea[placeholder*="queue"]');e&&(e.focus(),e.selectionStart=e.value.length,e.selectionEnd=e.value.length)},100))}catch(e){}},500);return()=>{e=!0,clearInterval(n)}},[t.id,g]);let ts=async(e,r,n)=>{let s=!!(n&&n.trim());if(!e.trim()&&(!r||0===r.length)&&!s)return;let i=e;if(n&&n.trim()){let e=`<sparkecoder-user-selected-elements>
|
|
10
10
|
${n.trim()}
|