From b5f20d13f06d682a84d87a5d598ba21e86d35898 Mon Sep 17 00:00:00 2001 From: Shubham Naik Date: Mon, 14 Oct 2024 10:06:13 -0700 Subject: [PATCH 1/2] chore: update devportal to comply with new memgpt api --- .../{ => static-files}/assets/index-3ab03d5b.css | 0 .../assets/index-dc228d4a.js} | 8 ++++---- .../static_files/{ => static-files}/favicon.ico | Bin .../static_files/{ => static-files}/index.html | 2 +- .../{ => static-files}/memgpt_logo_transparent.png | Bin 5 files changed, 5 insertions(+), 5 deletions(-) rename letta/server/static_files/{ => static-files}/assets/index-3ab03d5b.css (100%) rename letta/server/static_files/{assets/index-9a9c449b.js => static-files/assets/index-dc228d4a.js} (93%) rename letta/server/static_files/{ => static-files}/favicon.ico (100%) rename letta/server/static_files/{ => static-files}/index.html (94%) rename letta/server/static_files/{ => static-files}/memgpt_logo_transparent.png (100%) diff --git a/letta/server/static_files/assets/index-3ab03d5b.css b/letta/server/static_files/static-files/assets/index-3ab03d5b.css similarity index 100% rename from letta/server/static_files/assets/index-3ab03d5b.css rename to letta/server/static_files/static-files/assets/index-3ab03d5b.css diff --git a/letta/server/static_files/assets/index-9a9c449b.js b/letta/server/static_files/static-files/assets/index-dc228d4a.js similarity index 93% rename from letta/server/static_files/assets/index-9a9c449b.js rename to letta/server/static_files/static-files/assets/index-dc228d4a.js index bbeae879de..cb73be7f48 100644 --- a/letta/server/static_files/assets/index-9a9c449b.js +++ b/letta/server/static_files/static-files/assets/index-dc228d4a.js @@ -86,7 +86,7 @@ Error generating stack: `+o.message+` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(a=>r.set(a)),r}static accessor(t){const r=(this[a2]=this[a2]={accessors:{}}).accessors,a=this.prototype;function o(i){const s=su(i);r[s]||(uZ(a,i),r[s]=!0)}return J.isArray(t)?t.forEach(o):o(t),this}}Km.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);J.reduceDescriptors(Km.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});J.freezeMethods(Km);const fo=Km;function Ab(e,t){const n=this||u_,r=t||n,a=fo.from(r.headers);let o=r.data;return J.forEach(e,function(s){o=s.call(n,o,a.normalize(),t?t.status:void 0)}),a.normalize(),o}function l6(e){return!!(e&&e.__CANCEL__)}function af(e,t,n){lt.call(this,e??"canceled",lt.ERR_CANCELED,t,n),this.name="CanceledError"}J.inherits(af,lt,{__CANCEL__:!0});function dZ(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new lt("Request failed with status code "+n.status,[lt.ERR_BAD_REQUEST,lt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const fZ=Ia.hasStandardBrowserEnv?{write(e,t,n,r,a,o){const i=[e+"="+encodeURIComponent(t)];J.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),J.isString(r)&&i.push("path="+r),J.isString(a)&&i.push("domain="+a),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pZ(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function gZ(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function c6(e,t){return e&&!pZ(t)?gZ(e,t):t}const mZ=Ia.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function a(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=a(window.location.href),function(i){const s=J.isString(i)?a(i):i;return s.protocol===r.protocol&&s.host===r.host}}():function(){return function(){return!0}}();function hZ(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function bZ(e,t){e=e||10;const n=new Array(e),r=new Array(e);let a=0,o=0,i;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[o];i||(i=c),n[a]=l,r[a]=c;let d=o,g=0;for(;d!==a;)g+=n[d++],d=d%e;if(a=(a+1)%e,a===o&&(o=(o+1)%e),c-i{const o=a.loaded,i=a.lengthComputable?a.total:void 0,s=o-n,l=r(s),c=o<=i;n=o;const u={loaded:o,total:i,progress:i?o/i:void 0,bytes:s,rate:l||void 0,estimated:l&&i&&c?(i-o)/l:void 0,event:a};u[t?"download":"upload"]=!0,e(u)}}const yZ=typeof XMLHttpRequest<"u",vZ=yZ&&function(e){return new Promise(function(n,r){let a=e.data;const o=fo.from(e.headers).normalize();let{responseType:i,withXSRFToken:s}=e,l;function c(){e.cancelToken&&e.cancelToken.unsubscribe(l),e.signal&&e.signal.removeEventListener("abort",l)}let u;if(J.isFormData(a)){if(Ia.hasStandardBrowserEnv||Ia.hasStandardBrowserWebWorkerEnv)o.setContentType(!1);else if((u=o.getContentType())!==!1){const[b,...w]=u?u.split(";").map(v=>v.trim()).filter(Boolean):[];o.setContentType([b||"multipart/form-data",...w].join("; "))}}let d=new XMLHttpRequest;if(e.auth){const b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.set("Authorization","Basic "+btoa(b+":"+w))}const g=c6(e.baseURL,e.url);d.open(e.method.toUpperCase(),a6(g,e.params,e.paramsSerializer),!0),d.timeout=e.timeout;function m(){if(!d)return;const b=fo.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders()),v={data:!i||i==="text"||i==="json"?d.responseText:d.response,status:d.status,statusText:d.statusText,headers:b,config:e,request:d};dZ(function(S){n(S),c()},function(S){r(S),c()},v),d=null}if("onloadend"in d?d.onloadend=m:d.onreadystatechange=function(){!d||d.readyState!==4||d.status===0&&!(d.responseURL&&d.responseURL.indexOf("file:")===0)||setTimeout(m)},d.onabort=function(){d&&(r(new lt("Request aborted",lt.ECONNABORTED,e,d)),d=null)},d.onerror=function(){r(new lt("Network Error",lt.ERR_NETWORK,e,d)),d=null},d.ontimeout=function(){let w=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const v=e.transitional||o6;e.timeoutErrorMessage&&(w=e.timeoutErrorMessage),r(new lt(w,v.clarifyTimeoutError?lt.ETIMEDOUT:lt.ECONNABORTED,e,d)),d=null},Ia.hasStandardBrowserEnv&&(s&&J.isFunction(s)&&(s=s(e)),s||s!==!1&&mZ(g))){const b=e.xsrfHeaderName&&e.xsrfCookieName&&fZ.read(e.xsrfCookieName);b&&o.set(e.xsrfHeaderName,b)}a===void 0&&o.setContentType(null),"setRequestHeader"in d&&J.forEach(o.toJSON(),function(w,v){d.setRequestHeader(v,w)}),J.isUndefined(e.withCredentials)||(d.withCredentials=!!e.withCredentials),i&&i!=="json"&&(d.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&d.addEventListener("progress",o2(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&d.upload&&d.upload.addEventListener("progress",o2(e.onUploadProgress)),(e.cancelToken||e.signal)&&(l=b=>{d&&(r(!b||b.type?new af(null,e,d):b),d.abort(),d=null)},e.cancelToken&&e.cancelToken.subscribe(l),e.signal&&(e.signal.aborted?l():e.signal.addEventListener("abort",l)));const y=hZ(g);if(y&&Ia.protocols.indexOf(y)===-1){r(new lt("Unsupported protocol "+y+":",lt.ERR_BAD_REQUEST,e));return}d.send(a||null)})},q1={http:HY,xhr:vZ};J.forEach(q1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const i2=e=>`- ${e}`,SZ=e=>J.isFunction(e)||e===null||e===!1,u6={getAdapter:e=>{e=J.isArray(e)?e:[e];const{length:t}=e;let n,r;const a={};for(let o=0;o`adapter ${s} `+(l===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : `+o.map(i2).join(` `):" "+i2(o[0]):"as no adapter specified";throw new lt("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:q1};function Tb(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new af(null,e)}function s2(e){return Tb(e),e.headers=fo.from(e.headers),e.data=Ab.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),u6.getAdapter(e.adapter||u_.adapter)(e).then(function(r){return Tb(e),r.data=Ab.call(e,e.transformResponse,r),r.headers=fo.from(r.headers),r},function(r){return l6(r)||(Tb(e),r&&r.response&&(r.response.data=Ab.call(e,e.transformResponse,r.response),r.response.headers=fo.from(r.response.headers))),Promise.reject(r)})}const l2=e=>e instanceof fo?{...e}:e;function hc(e,t){t=t||{};const n={};function r(c,u,d){return J.isPlainObject(c)&&J.isPlainObject(u)?J.merge.call({caseless:d},c,u):J.isPlainObject(u)?J.merge({},u):J.isArray(u)?u.slice():u}function a(c,u,d){if(J.isUndefined(u)){if(!J.isUndefined(c))return r(void 0,c,d)}else return r(c,u,d)}function o(c,u){if(!J.isUndefined(u))return r(void 0,u)}function i(c,u){if(J.isUndefined(u)){if(!J.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function s(c,u,d){if(d in t)return r(c,u);if(d in e)return r(void 0,c)}const l={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:s,headers:(c,u)=>a(l2(c),l2(u),!0)};return J.forEach(Object.keys(Object.assign({},e,t)),function(u){const d=l[u]||a,g=d(e[u],t[u],u);J.isUndefined(g)&&d!==s||(n[u]=g)}),n}const d6="1.6.8",d_={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{d_[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const c2={};d_.transitional=function(t,n,r){function a(o,i){return"[Axios v"+d6+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,s)=>{if(t===!1)throw new lt(a(i," has been removed"+(n?" in "+n:"")),lt.ERR_DEPRECATED);return n&&!c2[i]&&(c2[i]=!0,console.warn(a(i," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,i,s):!0}};function wZ(e,t,n){if(typeof e!="object")throw new lt("options must be an object",lt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let a=r.length;for(;a-- >0;){const o=r[a],i=t[o];if(i){const s=e[o],l=s===void 0||i(s,o,e);if(l!==!0)throw new lt("option "+o+" must be "+l,lt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new lt("Unknown option "+o,lt.ERR_BAD_OPTION)}}const G1={assertOptions:wZ,validators:d_},Mo=G1.validators;class Tg{constructor(t){this.defaults=t,this.interceptors={request:new r2,response:new r2}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let a;Error.captureStackTrace?Error.captureStackTrace(a={}):a=new Error;const o=a.stack?a.stack.replace(/^.+\n/,""):"";r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=hc(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&G1.assertOptions(r,{silentJSONParsing:Mo.transitional(Mo.boolean),forcedJSONParsing:Mo.transitional(Mo.boolean),clarifyTimeoutError:Mo.transitional(Mo.boolean)},!1),a!=null&&(J.isFunction(a)?n.paramsSerializer={serialize:a}:G1.assertOptions(a,{encode:Mo.function,serialize:Mo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&J.merge(o.common,o[n.method]);o&&J.forEach(["delete","get","head","post","put","patch","common"],y=>{delete o[y]}),n.headers=fo.concat(i,o);const s=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(l=l&&b.synchronous,s.unshift(b.fulfilled,b.rejected))});const c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,d=0,g;if(!l){const y=[s2.bind(this),void 0];for(y.unshift.apply(y,s),y.push.apply(y,c),g=y.length,u=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(s=>{r.subscribe(s),o=s}).then(a);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,s){r.reason||(r.reason=new af(o,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new f_(function(a){t=a}),cancel:t}}}const EZ=f_;function xZ(e){return function(n){return e.apply(null,n)}}function kZ(e){return J.isObject(e)&&e.isAxiosError===!0}const W1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(W1).forEach(([e,t])=>{W1[t]=e});const CZ=W1;function f6(e){const t=new Hp(e),n=G4(Hp.prototype.request,t);return J.extend(n,Hp.prototype,t,{allOwnKeys:!0}),J.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return f6(hc(e,a))},n}const rn=f6(u_);rn.Axios=Hp;rn.CanceledError=af;rn.CancelToken=EZ;rn.isCancel=l6;rn.VERSION=d6;rn.toFormData=Wm;rn.AxiosError=lt;rn.Cancel=rn.CanceledError;rn.all=function(t){return Promise.all(t)};rn.spread=xZ;rn.isAxiosError=kZ;rn.mergeConfig=hc;rn.AxiosHeaders=fo;rn.formToJSON=e=>s6(J.isHTMLForm(e)?new FormData(e):e);rn.getAdapter=u6.getAdapter;rn.HttpStatusCode=CZ;rn.default=rn;const p6=rn,_Z={baseURL:lY,headers:{"Content-Type":"application/json","Cache-Control":"no-cache"}},ll=p6.create(_Z),AZ=()=>ll,TZ=({children:e})=>{const[t,n]=p.useState(!1),r=Mi(),a=q4();return p.useEffect(()=>{const o=s=>s,i=s=>Promise.reject(s);ll.interceptors.response.use(o,i)},[r,ll]),p.useEffect(()=>{const o=s=>(s.headers.Authorization=a||"",s),i=ll.interceptors.request.use(o);return()=>{ll.interceptors.request.eject(i)}},[a,ll]),p.useEffect(()=>{t||setTimeout(()=>n(!0),10)},[t]),t?e:f.jsx("div",{className:"sr-only",children:"Re-authenticating..."})},RZ="ToolsServiceListTools",p_=e=>[RZ,...e??[]],NZ="SourcesServiceListSources",of=e=>[NZ,...e??[]],IZ="AgentsServiceListAgents",g6=e=>[IZ,...e??[]],OZ="AgentsServiceGetAgent",sf=({agentId:e},t)=>[OZ,...t??[{agentId:e}]],DZ="AgentsServiceGetAgentSources",m6=({agentId:e},t)=>[DZ,...t??[{agentId:e}]],LZ="AgentsServiceListAgentArchivalMemory",h6=({after:e,agentId:t,before:n,limit:r},a)=>[LZ,...a??[{after:e,agentId:t,before:n,limit:r}]],MZ="AgentsServiceListAgentMessages",PZ=({agentId:e,before:t,limit:n,msgObject:r},a)=>[MZ,...a??[{agentId:e,before:t,limit:n,msgObject:r}]],$Z="ModelsServiceListModels",FZ=e=>[$Z,...e??[]],jZ="LlmsServiceListEmbeddingModels",zZ=e=>[jZ,...e??[]],UZ="BlocksServiceListMemoryBlocks",lf=({label:e,name:t,templatesOnly:n}={},r)=>[UZ,...r??[{label:e,name:t,templatesOnly:n}]],BZ="JobsServiceListJobs",HZ=e=>[BZ,...e??[]],VZ="JobsServiceListActiveJobs",b6=e=>[VZ,...e??[]];class u2{constructor(){this._fns=[]}eject(t){const n=this._fns.indexOf(t);n!==-1&&(this._fns=[...this._fns.slice(0,n),...this._fns.slice(n+1)])}use(t){this._fns=[...this._fns,t]}}const Oe={BASE:"http://memgpt.localhost",CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"0.1.0",WITH_CREDENTIALS:!1,interceptors:{request:new u2,response:new u2}};class d2 extends Error{constructor(t,n,r){super(r),this.name="ApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.body=n.body,this.request=t}}class qZ extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}class GZ{constructor(t){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((n,r)=>{this._resolve=n,this._reject=r;const a=s=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(s))},o=s=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(s))},i=s=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(s)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),t(a,o,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,n){return this.promise.then(t,n)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(const t of this.cancelHandlers)t()}catch(t){console.warn("Cancellation threw an error",t);return}this.cancelHandlers.length=0,this._reject&&this._reject(new qZ("Request aborted"))}}get isCancelled(){return this._isCancelled}}const Ym=e=>typeof e=="string",Rb=e=>Ym(e)&&e!=="",y6=e=>e instanceof Blob,WZ=e=>e instanceof FormData,f2=e=>e>=200&&e<300,KZ=e=>{try{return btoa(e)}catch{return Buffer.from(e).toString("base64")}},YZ=e=>{const t=[],n=(a,o)=>{t.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(o))}`)},r=(a,o)=>{o!=null&&(o instanceof Date?n(a,o.toISOString()):Array.isArray(o)?o.forEach(i=>r(a,i)):typeof o=="object"?Object.entries(o).forEach(([i,s])=>r(`${a}[${i}]`,s)):n(a,o))};return Object.entries(e).forEach(([a,o])=>r(a,o)),t.length?`?${t.join("&")}`:""},ZZ=(e,t)=>{const n=e.ENCODE_PATH||encodeURI,r=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(o,i)=>{var s;return(s=t.path)!=null&&s.hasOwnProperty(i)?n(String(t.path[i])):o}),a=e.BASE+r;return t.query?a+YZ(t.query):a},XZ=e=>{if(e.formData){const t=new FormData,n=(r,a)=>{Ym(a)||y6(a)?t.append(r,a):t.append(r,JSON.stringify(a))};return Object.entries(e.formData).filter(([,r])=>r!=null).forEach(([r,a])=>{Array.isArray(a)?a.forEach(o=>n(r,o)):n(r,a)}),t}},Kf=async(e,t)=>typeof t=="function"?t(e):t,QZ=async(e,t)=>{const[n,r,a,o]=await Promise.all([Kf(t,e.TOKEN),Kf(t,e.USERNAME),Kf(t,e.PASSWORD),Kf(t,e.HEADERS)]),i=Object.entries({Accept:"application/json",...o,...t.headers}).filter(([,s])=>s!=null).reduce((s,[l,c])=>({...s,[l]:String(c)}),{});if(Rb(n)&&(i.Authorization=`Bearer ${n}`),Rb(r)&&Rb(a)){const s=KZ(`${r}:${a}`);i.Authorization=`Basic ${s}`}return t.body!==void 0?t.mediaType?i["Content-Type"]=t.mediaType:y6(t.body)?i["Content-Type"]=t.body.type||"application/octet-stream":Ym(t.body)?i["Content-Type"]="text/plain":WZ(t.body)||(i["Content-Type"]="application/json"):t.formData!==void 0&&t.mediaType&&(i["Content-Type"]=t.mediaType),i},JZ=e=>{if(e.body)return e.body},eX=async(e,t,n,r,a,o,i,s)=>{const l=new AbortController;let c={data:r??a,headers:o,method:t.method,signal:l.signal,url:n,withCredentials:e.WITH_CREDENTIALS};i(()=>l.abort());for(const u of e.interceptors.request._fns)c=await u(c);try{return await s.request(c)}catch(u){const d=u;if(d.response)return d.response;throw u}},tX=(e,t)=>{if(t){const n=e.headers[t];if(Ym(n))return n}},nX=e=>{if(e.status!==204)return e.data},rX=(e,t)=>{const r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...e.errors}[t.status];if(r)throw new d2(e,t,r);if(!t.ok){const a=t.status??"unknown",o=t.statusText??"unknown",i=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new d2(e,t,`Generic Error: status: ${a}; status text: ${o}; body: ${i}`)}},je=(e,t,n=p6)=>new GZ(async(r,a,o)=>{try{const i=ZZ(e,t),s=XZ(t),l=JZ(t),c=await QZ(e,t);if(!o.isCancelled){let u=await eX(e,t,i,l,s,c,o,n);for(const b of e.interceptors.response._fns)u=await b(u);const d=nX(u),g=tX(u,t.responseHeader);let m=d;t.responseTransformer&&f2(u.status)&&(m=await t.responseTransformer(d));const y={url:i,ok:f2(u.status),status:u.status,statusText:u.statusText,body:g??m};rX(t,y),r(y.body)}}catch(i){a(i)}});class g_{static deleteTool(t){return je(Oe,{method:"DELETE",url:"/v1/tools/{tool_id}",path:{tool_id:t.toolId},errors:{422:"Validation Error"}})}static getTool(t){return je(Oe,{method:"GET",url:"/v1/tools/{tool_id}",path:{tool_id:t.toolId},errors:{422:"Validation Error"}})}static updateTool(t){return je(Oe,{method:"PATCH",url:"/v1/tools/{tool_id}",path:{tool_id:t.toolId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static getToolIdByName(t){return je(Oe,{method:"GET",url:"/v1/tools/name/{tool_name}",path:{tool_name:t.toolName},errors:{422:"Validation Error"}})}static listTools(){return je(Oe,{method:"GET",url:"/v1/tools/"})}static createTool(t){return je(Oe,{method:"POST",url:"/v1/tools/",query:{update:t.update},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}}class Mc{static getSource(t){return je(Oe,{method:"GET",url:"/v1/sources/{source_id}",path:{source_id:t.sourceId},errors:{422:"Validation Error"}})}static updateSource(t){return je(Oe,{method:"PATCH",url:"/v1/sources/{source_id}",path:{source_id:t.sourceId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static deleteSource(t){return je(Oe,{method:"DELETE",url:"/v1/sources/{source_id}",path:{source_id:t.sourceId},errors:{422:"Validation Error"}})}static getSourceIdByName(t){return je(Oe,{method:"GET",url:"/v1/sources/name/{source_name}",path:{source_name:t.sourceName},errors:{422:"Validation Error"}})}static listSources(){return je(Oe,{method:"GET",url:"/v1/sources/"})}static createSource(t){return je(Oe,{method:"POST",url:"/v1/sources/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static attachAgentToSource(t){return je(Oe,{method:"POST",url:"/v1/sources/{source_id}/attach",path:{source_id:t.sourceId},query:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static detachAgentFromSource(t){return je(Oe,{method:"POST",url:"/v1/sources/{source_id}/detach",path:{source_id:t.sourceId},query:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static uploadFileToSource(t){return je(Oe,{method:"POST",url:"/v1/sources/{source_id}/upload",path:{source_id:t.sourceId},formData:t.formData,mediaType:"multipart/form-data",errors:{422:"Validation Error"}})}static listSourcePassages(t){return je(Oe,{method:"GET",url:"/v1/sources/{source_id}/passages",path:{source_id:t.sourceId},errors:{422:"Validation Error"}})}static listSourceDocuments(t){return je(Oe,{method:"GET",url:"/v1/sources/{source_id}/documents",path:{source_id:t.sourceId},errors:{422:"Validation Error"}})}}class Va{static listAgents(){return je(Oe,{method:"GET",url:"/v1/agents/"})}static createAgent(t){return je(Oe,{method:"POST",url:"/v1/agents/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static updateAgent(t){return je(Oe,{method:"PATCH",url:"/v1/agents/{agent_id}",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static getAgent(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static deleteAgent(t){return je(Oe,{method:"DELETE",url:"/v1/agents/{agent_id}",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static getAgentSources(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/sources",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static listAgentInContextMessages(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory/messages",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static getAgentMemory(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static updateAgentMemory(t){return je(Oe,{method:"PATCH",url:"/v1/agents/{agent_id}/memory",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static getAgentRecallMemorySummary(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory/recall",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static getAgentArchivalMemorySummary(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory/archival",path:{agent_id:t.agentId},errors:{422:"Validation Error"}})}static listAgentArchivalMemory(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/archival",path:{agent_id:t.agentId},query:{after:t.after,before:t.before,limit:t.limit},errors:{422:"Validation Error"}})}static createAgentArchivalMemory(t){return je(Oe,{method:"POST",url:"/v1/agents/{agent_id}/archival",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static deleteAgentArchivalMemory(t){return je(Oe,{method:"DELETE",url:"/v1/agents/{agent_id}/archival/{memory_id}",path:{agent_id:t.agentId,memory_id:t.memoryId},errors:{422:"Validation Error"}})}static listAgentMessages(t){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/messages",path:{agent_id:t.agentId},query:{before:t.before,limit:t.limit,msg_object:t.msgObject},errors:{422:"Validation Error"}})}static createAgentMessage(t){return je(Oe,{method:"POST",url:"/v1/agents/{agent_id}/messages",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static updateAgentMessage(t){return je(Oe,{method:"PATCH",url:"/v1/agents/{agent_id}/messages/{message_id}",path:{agent_id:t.agentId,message_id:t.messageId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}}class aX{static listModels(){return je(Oe,{method:"GET",url:"/v1/models/"})}static listEmbeddingModels(){return je(Oe,{method:"GET",url:"/v1/models/embedding"})}}class oX{static listModels(){return je(Oe,{method:"GET",url:"/v1/models/"})}static listEmbeddingModels(){return je(Oe,{method:"GET",url:"/v1/models/embedding"})}}class m_{static listMemoryBlocks(t={}){return je(Oe,{method:"GET",url:"/v1/blocks/",query:{label:t.label,templates_only:t.templatesOnly,name:t.name},errors:{422:"Validation Error"}})}static createMemoryBlock(t){return je(Oe,{method:"POST",url:"/v1/blocks/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static updateMemoryBlock(t){return je(Oe,{method:"PATCH",url:"/v1/blocks/{block_id}",path:{block_id:t.blockId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"}})}static deleteMemoryBlock(t){return je(Oe,{method:"DELETE",url:"/v1/blocks/{block_id}",path:{block_id:t.blockId},errors:{422:"Validation Error"}})}static getMemoryBlock(t){return je(Oe,{method:"GET",url:"/v1/blocks/{block_id}",path:{block_id:t.blockId},errors:{422:"Validation Error"}})}}class iX{static listJobs(){return je(Oe,{method:"GET",url:"/v1/jobs/"})}static listActiveJobs(){return je(Oe,{method:"GET",url:"/v1/jobs/active"})}static getJob(t){return je(Oe,{method:"GET",url:"/v1/jobs/{job_id}",path:{job_id:t.jobId},errors:{422:"Validation Error"}})}}const Zm=(e,t)=>Jr({queryKey:p_(e),queryFn:()=>g_.listTools(),...t}),h_=(e,t)=>Jr({queryKey:of(e),queryFn:()=>Mc.listSources(),...t}),Xm=(e,t)=>Jr({queryKey:g6(e),queryFn:()=>Va.listAgents(),...t}),b_=({agentId:e},t,n)=>Jr({queryKey:sf({agentId:e},t),queryFn:()=>Va.getAgent({agentId:e}),...n}),v6=({agentId:e},t,n)=>Jr({queryKey:m6({agentId:e},t),queryFn:()=>Va.getAgentSources({agentId:e}),...n}),S6=({after:e,agentId:t,before:n,limit:r},a,o)=>Jr({queryKey:h6({after:e,agentId:t,before:n,limit:r},a),queryFn:()=>Va.listAgentArchivalMemory({after:e,agentId:t,before:n,limit:r}),...o}),sX=({agentId:e,before:t,limit:n,msgObject:r},a,o)=>Jr({queryKey:PZ({agentId:e,before:t,limit:n,msgObject:r},a),queryFn:()=>Va.listAgentMessages({agentId:e,before:t,limit:n,msgObject:r}),...o}),w6=(e,t)=>Jr({queryKey:FZ(e),queryFn:()=>aX.listModels(),...t}),E6=(e,t)=>Jr({queryKey:zZ(e),queryFn:()=>oX.listEmbeddingModels(),...t}),Rg=({label:e,name:t,templatesOnly:n}={},r,a)=>Jr({queryKey:lf({label:e,name:t,templatesOnly:n},r),queryFn:()=>m_.listMemoryBlocks({label:e,name:t,templatesOnly:n}),...a}),lX=(e,t)=>Jr({queryKey:b6(e),queryFn:()=>iX.listActiveJobs(),...t}),cX=e=>gr({mutationFn:({requestBody:t,update:n})=>g_.createTool({requestBody:t,update:n}),...e}),uX=e=>gr({mutationFn:({requestBody:t})=>Mc.createSource({requestBody:t}),...e}),x6=e=>gr({mutationFn:({agentId:t,sourceId:n})=>Mc.attachAgentToSource({agentId:t,sourceId:n}),...e}),k6=e=>gr({mutationFn:({agentId:t,sourceId:n})=>Mc.detachAgentFromSource({agentId:t,sourceId:n}),...e}),C6=e=>gr({mutationFn:({formData:t,sourceId:n})=>Mc.uploadFileToSource({formData:t,sourceId:n}),...e}),dX=e=>gr({mutationFn:({requestBody:t})=>Va.createAgent({requestBody:t}),...e}),fX=e=>gr({mutationFn:({agentId:t,requestBody:n})=>Va.createAgentArchivalMemory({agentId:t,requestBody:n}),...e}),_6=e=>gr({mutationFn:({requestBody:t})=>m_.createMemoryBlock({requestBody:t}),...e}),pX=e=>gr({mutationFn:({requestBody:t,toolId:n})=>g_.updateTool({requestBody:t,toolId:n}),...e}),gX=e=>gr({mutationFn:({requestBody:t,sourceId:n})=>Mc.updateSource({requestBody:t,sourceId:n}),...e}),Qm=e=>gr({mutationFn:({agentId:t,requestBody:n})=>Va.updateAgent({agentId:t,requestBody:n}),...e}),y_=e=>gr({mutationFn:({blockId:t,requestBody:n})=>m_.updateMemoryBlock({blockId:t,requestBody:n}),...e}),mX=e=>gr({mutationFn:({agentId:t})=>Va.deleteAgent({agentId:t}),...e}),hX=e=>gr({mutationFn:({agentId:t,memoryId:n})=>Va.deleteAgentArchivalMemory({agentId:t,memoryId:n}),...e});Oe.BASE="";Oe.HEADERS={"Content-Type":"application/json","Cache-Control":"no-cache"};const bX=({children:e})=>{const[t,n]=p.useState(!1),r=q4(),a=Mi();return p.useEffect(()=>{const o=i=>i;return Oe.interceptors.response.use(o),()=>{Oe.interceptors.response.eject(o)}},[a]),p.useEffect(()=>{const o=i=>(i.headers={...i.headers,Authorization:"Bearer password"},i);return Oe.interceptors.request.use(o),()=>{Oe.interceptors.request.eject(o)}},[r]),p.useEffect(()=>{t||setTimeout(()=>n(!0),10)},[t]),t?e:f.jsx("div",{className:"sr-only",children:"Re-authenticating..."})},bc=Jd("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",xs:"text-xs h-7 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",iconSm:"h-9 w-9",iconXs:"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}});function p2({isBusy:e,icon:t}){return e?f.jsx(un,{className:"h-4 w-4 animate-spin"}):t||null}const ue=p.forwardRef(({className:e,children:t,label:n,isBusy:r,icon:a,iconPosition:o="left",disabled:i,variant:s,size:l,asChild:c=!1,...u},d)=>{const g=c?$a:"button",m=p.useMemo(()=>i||r,[i,r]),y=p.useMemo(()=>a||o?"flex items-center gap-1":"",[a,o]);return f.jsxs(g,{className:ee(y,bc({variant:s,size:l,className:e})),disabled:m,ref:d,...u,children:[o==="left"&&f.jsx(p2,{isBusy:r??!1,icon:a??null}),f.jsx(Tm,{children:t}),o==="right"&&f.jsx(p2,{isBusy:r??!1,icon:a??null})]})});ue.displayName="Button";const $s=({children:e,className:t})=>f.jsx("div",{className:ee("h-full w-full overflow-auto",t),children:e});function Yf({children:e,className:t}){return f.jsx("div",{className:ee("flex justify-center text-muted-foreground",t),children:e})}function yX(e){return f.jsxs("svg",{viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M5.21875 8.90625H3.84375C3.46875 8.90625 3.125 9.21875 3.125 9.625C3.125 10.0313 3.4375 10.3437 3.84375 10.3437H5.21875C5.59375 10.3437 5.9375 10.0313 5.9375 9.625C5.9375 9.21875 5.59375 8.90625 5.21875 8.90625Z",fill:"currentColor"}),f.jsx("path",{d:"M12.875 8.90625H11.5C11.125 8.90625 10.7812 9.21875 10.7812 9.625C10.7812 10.0313 11.0937 10.3437 11.5 10.3437H12.875C13.25 10.3437 13.5938 10.0313 13.5938 9.625C13.5938 9.21875 13.25 8.90625 12.875 8.90625Z",fill:"currentColor"}),f.jsx("path",{d:"M17.7187 8.09375V3.9375C18.5 3.65625 19.0312 2.90625 19.0312 2.0625C19.0312 0.9375 18.125 0.03125 17 0.03125C15.875 0.03125 14.9687 0.9375 14.9687 2.0625C14.9687 2.9375 15.5312 3.65625 16.2812 3.9375V8.0625H15.9375V7.84375C15.9375 6.59375 14.9062 5.5625 13.6562 5.5625H11.875V4.875C11.875 3.84375 11.0312 3.03125 10.0312 3.03125H9.0625V0.96875C9.0625 0.59375 8.75 0.25 8.34375 0.25C7.9375 0.25 7.625 0.5625 7.625 0.96875V3.03125H6.625C5.59375 3.03125 4.78125 3.875 4.78125 4.875V5.5625H2.8125C1.5625 5.5625 0.53125 6.59375 0.53125 7.84375V13.6875C0.53125 14.9375 1.5625 15.9688 2.8125 15.9688H13.6875C14.9375 15.9688 15.9687 14.9375 15.9687 13.6875V13.4688H17.625C18.6562 13.4688 19.4687 12.625 19.4687 11.625V9.96875C19.4687 8.9375 18.6875 8.15625 17.7187 8.09375ZM17 1.4375C17.3437 1.4375 17.625 1.71875 17.625 2.0625C17.625 2.40625 17.3437 2.6875 17 2.6875C16.6562 2.6875 16.375 2.40625 16.375 2.0625C16.375 1.71875 16.6562 1.4375 17 1.4375ZM6.21875 4.875C6.21875 4.625 6.40625 4.4375 6.65625 4.4375H10.0312C10.2812 4.4375 10.4687 4.625 10.4687 4.875V5.5625H6.21875V4.875ZM14.5312 13.6875C14.5312 14.1562 14.1562 14.5625 13.6562 14.5625H2.8125C2.34375 14.5625 1.9375 14.1875 1.9375 13.6875V7.84375C1.9375 7.375 2.3125 6.96875 2.8125 6.96875H13.6875C14.1562 6.96875 14.5625 7.34375 14.5625 7.84375V13.6875H14.5312ZM18.0625 11.5938C18.0625 11.8438 17.875 12.0312 17.625 12.0312H15.9375V9.46875H17.5937C17.8437 9.46875 18.0312 9.65625 18.0312 9.90625V11.5938H18.0625Z",fill:"currentColor"}),f.jsx("path",{d:"M9.5 11.125C9.125 11.125 8.78125 11.4375 8.78125 11.8437C8.78125 12.0937 8.59375 12.2813 8.34375 12.2813C8.09375 12.2813 7.90625 12.0937 7.90625 11.8437C7.90625 11.4687 7.59375 11.125 7.1875 11.125C6.78125 11.125 6.46875 11.4375 6.46875 11.8437C6.46875 12.875 7.3125 13.6875 8.3125 13.6875C9.3125 13.6875 10.1562 12.8437 10.1562 11.8437C10.1875 11.4375 9.875 11.125 9.5 11.125Z",fill:"currentColor"})]})}function vX(e){return f.jsx("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M8.00039 11.3998C7.85039 11.3998 7.72539 11.3498 7.60039 11.2498L1.85039 5.5998C1.62539 5.3748 1.62539 5.0248 1.85039 4.7998C2.07539 4.5748 2.42539 4.5748 2.65039 4.7998L8.00039 10.0248L13.3504 4.7498C13.5754 4.5248 13.9254 4.5248 14.1504 4.7498C14.3754 4.9748 14.3754 5.3248 14.1504 5.5498L8.40039 11.1998C8.27539 11.3248 8.15039 11.3998 8.00039 11.3998Z",fill:"currentColor"})})}function SX(e){return f.jsx("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M13.7504 11.4002C13.6004 11.4002 13.4754 11.3502 13.3504 11.2502L8.00039 5.9752L2.65039 11.2252C2.42539 11.4502 2.07539 11.4502 1.85039 11.2252C1.62539 11.0002 1.62539 10.6502 1.85039 10.4252L7.60039 4.7752C7.82539 4.5502 8.17539 4.5502 8.40039 4.7752L14.1504 10.4252C14.3754 10.6502 14.3754 11.0002 14.1504 11.2252C14.0504 11.3252 13.9004 11.4002 13.7504 11.4002Z",fill:"currentColor"})})}function wX(e){return f.jsxs("svg",{viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M10 9.5C12.5938 9.5 14.6875 7.40625 14.6875 4.8125C14.6875 2.21875 12.5938 0.125 10 0.125C7.40625 0.125 5.3125 2.21875 5.3125 4.8125C5.3125 7.40625 7.40625 9.5 10 9.5ZM10 1.53125C11.8125 1.53125 13.2812 3 13.2812 4.8125C13.2812 6.625 11.8125 8.09375 10 8.09375C8.1875 8.09375 6.71875 6.625 6.71875 4.8125C6.71875 3 8.1875 1.53125 10 1.53125Z",fill:"currentColor"}),f.jsx("path",{d:"M19.2191 14.625C16.6566 12.4688 13.4066 11.2812 10.0004 11.2812C6.59412 11.2812 3.34412 12.4688 0.781616 14.625C0.500366 14.875 0.437866 15.3125 0.687866 15.625C0.937866 15.9063 1.37537 15.9688 1.68787 15.7188C4.00037 13.75 6.93787 12.6875 10.0004 12.6875C13.0629 12.6875 16.0004 13.75 18.2816 15.6875C18.4066 15.8125 18.5629 15.8438 18.7504 15.8438C18.9379 15.8438 19.1566 15.75 19.2816 15.5938C19.5316 15.3125 19.5004 14.875 19.2191 14.625Z",fill:"currentColor"})]})}function EX(e){return f.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M17.875 2.9375H11C10.625 2.9375 10.2812 3.0625 10 3.25C9.71875 3.0625 9.375 2.9375 9 2.9375H2.125C1.25 2.9375 0.5625 3.65625 0.5625 4.5V14.6875C0.5625 15.5625 1.28125 16.25 2.125 16.25H9.3125V16.3437C9.3125 16.7187 9.625 17.0625 10.0312 17.0625C10.4062 17.0625 10.75 16.75 10.75 16.3437V16.25H17.9375C18.8125 16.25 19.5 15.5312 19.5 14.6875V4.5C19.4688 3.625 18.75 2.9375 17.875 2.9375ZM2.125 14.875C2.03125 14.875 1.96875 14.8125 1.96875 14.7187V4.5C1.96875 4.40625 2.03125 4.34375 2.125 4.34375H9.03125C9.1875 4.34375 9.3125 4.46875 9.3125 4.625V14.875H2.125ZM18.0625 14.6875C18.0625 14.7812 18 14.8437 17.9062 14.8437H10.7188V4.625C10.7188 4.46875 10.8438 4.34375 11 4.34375H17.9062C18 4.34375 18.0625 4.40625 18.0625 4.5V14.6875Z",fill:"currentColor"}),f.jsx("path",{d:"M4.46875 7.40625H6.78125C7.15625 7.40625 7.5 7.09375 7.5 6.6875C7.5 6.28125 7.1875 5.96875 6.78125 5.96875H4.46875C4.09375 5.96875 3.75 6.28125 3.75 6.6875C3.75 7.09375 4.0625 7.40625 4.46875 7.40625Z",fill:"currentColor"}),f.jsx("path",{d:"M13.125 7.40625H15.4375C15.8125 7.40625 16.1562 7.09375 16.1562 6.6875C16.1562 6.28125 15.8438 5.96875 15.4375 5.96875H13.125C12.75 5.96875 12.4062 6.28125 12.4062 6.6875C12.4062 7.09375 12.75 7.40625 13.125 7.40625Z",fill:"currentColor"}),f.jsx("path",{d:"M15.5 8.5625H13.1875C12.8125 8.5625 12.4688 8.875 12.4688 9.28125C12.4688 9.6875 12.7812 10 13.1875 10H15.5C15.875 10 16.2188 9.6875 16.2188 9.28125C16.2188 8.875 15.875 8.5625 15.5 8.5625Z",fill:"currentColor"}),f.jsx("path",{d:"M6.8125 8.5625H4.5C4.125 8.5625 3.78125 8.875 3.78125 9.28125C3.78125 9.6875 4.09375 10 4.5 10H6.8125C7.1875 10 7.53125 9.6875 7.53125 9.28125C7.53125 8.875 7.21875 8.5625 6.8125 8.5625Z",fill:"currentColor"}),f.jsx("path",{d:"M6.8125 11.3125H4.5C4.125 11.3125 3.78125 11.625 3.78125 12.0312C3.78125 12.4375 4.09375 12.75 4.5 12.75H6.8125C7.1875 12.75 7.53125 12.4375 7.53125 12.0312C7.53125 11.625 7.21875 11.3125 6.8125 11.3125Z",fill:"currentColor"}),f.jsx("path",{d:"M15.5 11.3125H13.1875C12.8125 11.3125 12.4688 11.625 12.4688 12.0312C12.4688 12.4375 12.7812 12.75 13.1875 12.75H15.5C15.875 12.75 16.2188 12.4375 16.2188 12.0312C16.2188 11.625 15.875 11.3125 15.5 11.3125Z",fill:"currentColor"})]})}function xX(e){return f.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M17.5625 2.28125H2.4375C1.40625 2.28125 0.5625 3.125 0.5625 4.15625V12.875C0.5625 13.9063 1.40625 14.75 2.4375 14.75H6.9375L9.4375 17.5C9.5625 17.6563 9.75 17.7188 9.96875 17.7188C10.1562 17.7188 10.3438 17.625 10.5 17.5L13.0625 14.7188H17.5938C18.625 14.7188 19.4688 13.875 19.4688 12.8438V4.15625C19.4688 3.125 18.5938 2.28125 17.5625 2.28125ZM18.0625 12.8438C18.0625 13.0938 17.8438 13.3125 17.5938 13.3125H12.7188C12.5312 13.3125 12.3438 13.4063 12.1875 13.5313L9.9375 15.9688L7.75 13.5625C7.625 13.4063 7.4375 13.3438 7.21875 13.3438H2.4375C2.1875 13.3438 1.96875 13.125 1.96875 12.875V4.15625C1.96875 3.90625 2.1875 3.6875 2.4375 3.6875H17.5625C17.8125 3.6875 18.0312 3.90625 18.0312 4.15625V12.8438H18.0625Z",fill:"currentColor"}),f.jsx("path",{d:"M5.5625 7.59375C5.15625 7.59375 4.8125 7.9375 4.8125 8.34375C4.8125 8.75 5.15625 9.09375 5.5625 9.09375C5.96875 9.09375 6.3125 8.75 6.3125 8.34375C6.3125 7.9375 6 7.59375 5.5625 7.59375Z",fill:"currentColor"}),f.jsx("path",{d:"M10 7.59375C9.59375 7.59375 9.25 7.9375 9.25 8.34375C9.25 8.75 9.59375 9.09375 10 9.09375C10.4062 9.09375 10.75 8.75 10.75 8.34375C10.75 7.9375 10.4062 7.59375 10 7.59375Z",fill:"currentColor"}),f.jsx("path",{d:"M14.4375 7.59375C14.0313 7.59375 13.6875 7.9375 13.6875 8.34375C13.6875 8.75 14.0313 9.09375 14.4375 9.09375C14.8438 9.09375 15.1875 8.75 15.1875 8.34375C15.1875 7.9375 14.8438 7.59375 14.4375 7.59375Z",fill:"currentColor"})]})}function kX(e){return f.jsx("svg",{viewBox:"0 0 14 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M7 0.5625C3.34375 0.5625 0.46875 2.28125 0.46875 4.4375V15.5625C0.46875 17.7188 3.40625 19.4375 6.96875 19.4375C10.5625 19.4375 13.5 17.6875 13.5 15.5625V4.4375C13.5312 2.25 10.6562 0.5625 7 0.5625ZM7 1.96875C10 1.96875 12.125 3.28125 12.125 4.4375C12.125 5.625 10.0312 6.90625 7 6.90625C3.96875 6.90625 1.875 5.59375 1.875 4.4375C1.875 3.25 4 1.96875 7 1.96875ZM7 18.0625C4.0625 18.0625 1.90625 16.75 1.90625 15.5938V14.375C3.09375 15.25 4.90625 15.7813 7 15.7813C9.09375 15.7813 10.9375 15.2188 12.125 14.375V15.5938C12.125 16.75 9.9375 18.0625 7 18.0625ZM7 14.375C4 14.375 1.90625 13.125 1.90625 12V10.5625C3.125 11.4375 5.03125 11.9688 7 11.9688C9.0625 11.9688 10.9063 11.4375 12.125 10.5625V12C12.125 13.125 10 14.375 7 14.375ZM11.3125 9.40625C10.3437 10.125 8.75 10.5625 7 10.5625C5.28125 10.5625 3.65625 10.125 2.6875 9.40625C2.3125 9.15625 1.90625 8.71875 1.90625 8.1875V6.875C3.09375 7.75 4.9375 8.3125 7.03125 8.3125C9.125 8.3125 10.9688 7.75 12.1562 6.875V8.1875C12.125 8.6875 11.6875 9.125 11.3125 9.40625Z",fill:"currentColor"})})}function CX(e){return f.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("g",{clipPath:"url(#clip0_6318_531)",children:f.jsx("path",{d:"M18.7505 13.7189L16.813 11.7814C16.0317 11.0002 14.7505 11.0002 13.9692 11.7814L13.438 12.3127L11.7192 10.5939L13.3442 8.96891L16.5317 8.12515C17.2192 7.93765 17.7817 7.37515 17.9692 6.68765L18.8755 3.3439C18.9692 2.9689 18.7505 2.5939 18.3755 2.4689C18.0005 2.37515 17.6255 2.5939 17.5005 2.9689L16.5942 6.31265C16.5317 6.5314 16.3755 6.68765 16.1567 6.75015L12.813 7.6564C12.688 7.68765 12.5942 7.75015 12.5005 7.8439L10.7505 9.59391L9.68799 8.5314L11.438 6.7814C11.5317 6.68765 11.5942 6.5939 11.6255 6.4689L12.5005 3.12515C12.563 2.9064 12.7192 2.75015 12.938 2.68765L16.2817 1.7814C16.6567 1.68765 16.8755 1.2814 16.7817 0.906405C16.688 0.531405 16.313 0.312655 15.938 0.437655L12.5942 1.31265C11.9067 1.50015 11.3442 2.06265 11.1567 2.75015L10.313 5.9064L8.68799 7.5314L7.063 5.9064C7.688 5.18765 7.7505 4.12515 7.188 3.3439L5.84425 1.56265C5.5005 1.0939 4.96925 0.812655 4.3755 0.781405C3.78175 0.750155 3.21925 0.937655 2.813 1.37515L1.53175 2.6564C1.1255 3.06265 0.906746 3.62515 0.937996 4.2189C0.969246 4.81265 1.2505 5.3439 1.71925 5.68765L3.5005 7.0314C3.84425 7.31265 4.28175 7.43765 4.71925 7.43765C5.21925 7.43765 5.688 7.25015 6.063 6.9064L7.688 8.5314L5.59425 10.6252L2.438 11.4689C1.7505 11.6564 1.188 12.2189 1.0005 12.9064L0.312996 15.5002C0.125496 16.1877 0.312996 16.9377 0.844246 17.4689L1.813 18.4377C2.188 18.8127 2.71925 19.0314 3.2505 19.0314C3.438 19.0314 3.59425 19.0002 3.78175 18.9689L6.3755 18.2814C7.063 18.0939 7.6255 17.5314 7.813 16.8439L8.65675 13.6877L10.7505 11.5939L12.4692 13.3127L11.938 13.8439C11.1567 14.6252 11.1567 15.9064 11.938 16.6877L13.8755 18.6252C14.5317 19.2814 15.3755 19.6252 16.313 19.6252C17.2505 19.6252 18.0942 19.2814 18.7505 18.6252C19.4067 17.9689 19.7505 17.1252 19.7505 16.1877C19.7505 15.2502 19.4067 14.3752 18.7505 13.7189ZM4.34425 5.87515L2.563 4.5314C2.3755 4.37515 2.34425 4.18765 2.313 4.0939C2.313 4.00015 2.313 3.7814 2.5005 3.62515L3.78175 2.3439C3.938 2.18765 4.09425 2.1564 4.21925 2.1564H4.2505C4.34425 2.1564 4.53175 2.2189 4.688 2.4064L6.03175 4.18765C6.21925 4.43765 6.188 4.75015 5.96925 4.9689L5.1255 5.81265C4.938 6.0314 4.59425 6.06265 4.34425 5.87515ZM7.53175 12.8127C7.438 12.9064 7.3755 13.0002 7.34425 13.1252L6.438 16.4689C6.3755 16.6877 6.21925 16.8439 6.0005 16.9064L3.40675 17.5939C3.188 17.6564 2.96925 17.5939 2.813 17.4377L1.84425 16.4689C1.688 16.3127 1.6255 16.0939 1.688 15.8752L2.3755 13.2814C2.438 13.0627 2.59425 12.9064 2.813 12.8439L6.15675 11.9377C6.28175 11.9064 6.3755 11.8439 6.46925 11.7502L8.71924 9.50015L9.78174 10.5627L7.53175 12.8127ZM17.7505 17.5939C17.3755 17.9689 16.8442 18.1877 16.313 18.1877C15.7817 18.1877 15.2505 17.9689 14.8755 17.5939L12.938 15.6564C12.7192 15.4377 12.7192 15.0314 12.938 14.8127L13.4692 14.2814L13.9067 14.7189C14.0317 14.8439 14.2192 14.9377 14.4067 14.9377C14.5942 14.9377 14.7817 14.8752 14.9067 14.7189C15.188 14.4377 15.188 14.0002 14.9067 13.7189L14.4692 13.2814L15.0005 12.7502C15.1255 12.6252 15.2505 12.5627 15.438 12.5627C15.5942 12.5627 15.7505 12.6252 15.8755 12.7502L17.813 14.6877C18.188 15.0627 18.4067 15.5939 18.4067 16.1252C18.4067 16.6564 18.1567 17.2189 17.7505 17.5939Z",fill:"currentColor"})}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6318_531",children:f.jsx("rect",{width:"20",height:"20",fill:"white"})})})]})}/** +`+o):r.stack=o}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=hc(this.defaults,n);const{transitional:r,paramsSerializer:a,headers:o}=n;r!==void 0&&G1.assertOptions(r,{silentJSONParsing:Mo.transitional(Mo.boolean),forcedJSONParsing:Mo.transitional(Mo.boolean),clarifyTimeoutError:Mo.transitional(Mo.boolean)},!1),a!=null&&(J.isFunction(a)?n.paramsSerializer={serialize:a}:G1.assertOptions(a,{encode:Mo.function,serialize:Mo.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&J.merge(o.common,o[n.method]);o&&J.forEach(["delete","get","head","post","put","patch","common"],y=>{delete o[y]}),n.headers=fo.concat(i,o);const s=[];let l=!0;this.interceptors.request.forEach(function(b){typeof b.runWhen=="function"&&b.runWhen(n)===!1||(l=l&&b.synchronous,s.unshift(b.fulfilled,b.rejected))});const c=[];this.interceptors.response.forEach(function(b){c.push(b.fulfilled,b.rejected)});let u,d=0,g;if(!l){const y=[s2.bind(this),void 0];for(y.unshift.apply(y,s),y.push.apply(y,c),g=y.length,u=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](a);r._listeners=null}),this.promise.then=a=>{let o;const i=new Promise(s=>{r.subscribe(s),o=s}).then(a);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,s){r.reason||(r.reason=new af(o,i,s),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new f_(function(a){t=a}),cancel:t}}}const EZ=f_;function xZ(e){return function(n){return e.apply(null,n)}}function kZ(e){return J.isObject(e)&&e.isAxiosError===!0}const W1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(W1).forEach(([e,t])=>{W1[t]=e});const CZ=W1;function f6(e){const t=new Hp(e),n=G4(Hp.prototype.request,t);return J.extend(n,Hp.prototype,t,{allOwnKeys:!0}),J.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return f6(hc(e,a))},n}const rn=f6(u_);rn.Axios=Hp;rn.CanceledError=af;rn.CancelToken=EZ;rn.isCancel=l6;rn.VERSION=d6;rn.toFormData=Wm;rn.AxiosError=lt;rn.Cancel=rn.CanceledError;rn.all=function(t){return Promise.all(t)};rn.spread=xZ;rn.isAxiosError=kZ;rn.mergeConfig=hc;rn.AxiosHeaders=fo;rn.formToJSON=e=>s6(J.isHTMLForm(e)?new FormData(e):e);rn.getAdapter=u6.getAdapter;rn.HttpStatusCode=CZ;rn.default=rn;const p6=rn,_Z={baseURL:lY,headers:{"Content-Type":"application/json","Cache-Control":"no-cache"}},ll=p6.create(_Z),AZ=()=>ll,TZ=({children:e})=>{const[t,n]=p.useState(!1),r=Mi(),a=q4();return p.useEffect(()=>{const o=s=>s,i=s=>Promise.reject(s);ll.interceptors.response.use(o,i)},[r,ll]),p.useEffect(()=>{const o=s=>(s.headers.Authorization=a||"",s),i=ll.interceptors.request.use(o);return()=>{ll.interceptors.request.eject(i)}},[a,ll]),p.useEffect(()=>{t||setTimeout(()=>n(!0),10)},[t]),t?e:f.jsx("div",{className:"sr-only",children:"Re-authenticating..."})},RZ="ToolsServiceListTools",p_=({userId:e}={},t)=>[RZ,...t??[{userId:e}]],NZ="SourcesServiceListSources",of=({userId:e}={},t)=>[NZ,...t??[{userId:e}]],IZ="AgentsServiceListAgents",g6=({userId:e}={},t)=>[IZ,...t??[{userId:e}]],OZ="AgentsServiceGetAgent",sf=({agentId:e,userId:t},n)=>[OZ,...n??[{agentId:e,userId:t}]],DZ="AgentsServiceGetAgentSources",m6=({agentId:e},t)=>[DZ,...t??[{agentId:e}]],LZ="AgentsServiceListAgentArchivalMemory",h6=({after:e,agentId:t,before:n,limit:r,userId:a},o)=>[LZ,...o??[{after:e,agentId:t,before:n,limit:r,userId:a}]],MZ="AgentsServiceListAgentMessages",PZ=({agentId:e,assistantMessageFunctionKwarg:t,assistantMessageFunctionName:n,before:r,limit:a,msgObject:o,useAssistantMessage:i,userId:s},l)=>[MZ,...l??[{agentId:e,assistantMessageFunctionKwarg:t,assistantMessageFunctionName:n,before:r,limit:a,msgObject:o,useAssistantMessage:i,userId:s}]],$Z="ModelsServiceListModels",FZ=e=>[$Z,...e??[]],jZ="LlmsServiceListEmbeddingModels",zZ=e=>[jZ,...e??[]],UZ="BlocksServiceListMemoryBlocks",lf=({label:e,name:t,templatesOnly:n,userId:r}={},a)=>[UZ,...a??[{label:e,name:t,templatesOnly:n,userId:r}]],BZ="JobsServiceListJobs",HZ=({sourceId:e,userId:t}={},n)=>[BZ,...n??[{sourceId:e,userId:t}]],VZ="JobsServiceListActiveJobs",b6=({userId:e}={},t)=>[VZ,...t??[{userId:e}]];class u2{constructor(){this._fns=[]}eject(t){const n=this._fns.indexOf(t);n!==-1&&(this._fns=[...this._fns.slice(0,n),...this._fns.slice(n+1)])}use(t){this._fns=[...this._fns,t]}}const Oe={CREDENTIALS:"include",ENCODE_PATH:void 0,HEADERS:void 0,PASSWORD:void 0,TOKEN:void 0,USERNAME:void 0,VERSION:"1.0.0",WITH_CREDENTIALS:!1,interceptors:{request:new u2,response:new u2},BASE:""};class d2 extends Error{constructor(t,n,r){super(r),this.name="ApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.body=n.body,this.request=t}}class qZ extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}class GZ{constructor(t){this._isResolved=!1,this._isRejected=!1,this._isCancelled=!1,this.cancelHandlers=[],this.promise=new Promise((n,r)=>{this._resolve=n,this._reject=r;const a=s=>{this._isResolved||this._isRejected||this._isCancelled||(this._isResolved=!0,this._resolve&&this._resolve(s))},o=s=>{this._isResolved||this._isRejected||this._isCancelled||(this._isRejected=!0,this._reject&&this._reject(s))},i=s=>{this._isResolved||this._isRejected||this._isCancelled||this.cancelHandlers.push(s)};return Object.defineProperty(i,"isResolved",{get:()=>this._isResolved}),Object.defineProperty(i,"isRejected",{get:()=>this._isRejected}),Object.defineProperty(i,"isCancelled",{get:()=>this._isCancelled}),t(a,o,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,n){return this.promise.then(t,n)}catch(t){return this.promise.catch(t)}finally(t){return this.promise.finally(t)}cancel(){if(!(this._isResolved||this._isRejected||this._isCancelled)){if(this._isCancelled=!0,this.cancelHandlers.length)try{for(const t of this.cancelHandlers)t()}catch(t){console.warn("Cancellation threw an error",t);return}this.cancelHandlers.length=0,this._reject&&this._reject(new qZ("Request aborted"))}}get isCancelled(){return this._isCancelled}}const Ym=e=>typeof e=="string",Rb=e=>Ym(e)&&e!=="",y6=e=>e instanceof Blob,WZ=e=>e instanceof FormData,f2=e=>e>=200&&e<300,KZ=e=>{try{return btoa(e)}catch{return Buffer.from(e).toString("base64")}},YZ=e=>{const t=[],n=(a,o)=>{t.push(`${encodeURIComponent(a)}=${encodeURIComponent(String(o))}`)},r=(a,o)=>{o!=null&&(o instanceof Date?n(a,o.toISOString()):Array.isArray(o)?o.forEach(i=>r(a,i)):typeof o=="object"?Object.entries(o).forEach(([i,s])=>r(`${a}[${i}]`,s)):n(a,o))};return Object.entries(e).forEach(([a,o])=>r(a,o)),t.length?`?${t.join("&")}`:""},ZZ=(e,t)=>{const n=e.ENCODE_PATH||encodeURI,r=t.url.replace("{api-version}",e.VERSION).replace(/{(.*?)}/g,(o,i)=>{var s;return(s=t.path)!=null&&s.hasOwnProperty(i)?n(String(t.path[i])):o}),a=e.BASE+r;return t.query?a+YZ(t.query):a},XZ=e=>{if(e.formData){const t=new FormData,n=(r,a)=>{Ym(a)||y6(a)?t.append(r,a):t.append(r,JSON.stringify(a))};return Object.entries(e.formData).filter(([,r])=>r!=null).forEach(([r,a])=>{Array.isArray(a)?a.forEach(o=>n(r,o)):n(r,a)}),t}},Kf=async(e,t)=>typeof t=="function"?t(e):t,QZ=async(e,t)=>{const[n,r,a,o]=await Promise.all([Kf(t,e.TOKEN),Kf(t,e.USERNAME),Kf(t,e.PASSWORD),Kf(t,e.HEADERS)]),i=Object.entries({Accept:"application/json",...o,...t.headers}).filter(([,s])=>s!=null).reduce((s,[l,c])=>({...s,[l]:String(c)}),{});if(Rb(n)&&(i.Authorization=`Bearer ${n}`),Rb(r)&&Rb(a)){const s=KZ(`${r}:${a}`);i.Authorization=`Basic ${s}`}return t.body!==void 0?t.mediaType?i["Content-Type"]=t.mediaType:y6(t.body)?i["Content-Type"]=t.body.type||"application/octet-stream":Ym(t.body)?i["Content-Type"]="text/plain":WZ(t.body)||(i["Content-Type"]="application/json"):t.formData!==void 0&&t.mediaType&&(i["Content-Type"]=t.mediaType),i},JZ=e=>{if(e.body)return e.body},eX=async(e,t,n,r,a,o,i,s)=>{const l=new AbortController;let c={data:r??a,headers:o,method:t.method,signal:l.signal,url:n,withCredentials:e.WITH_CREDENTIALS};i(()=>l.abort());for(const u of e.interceptors.request._fns)c=await u(c);try{return await s.request(c)}catch(u){const d=u;if(d.response)return d.response;throw u}},tX=(e,t)=>{if(t){const n=e.headers[t];if(Ym(n))return n}},nX=e=>{if(e.status!==204)return e.data},rX=(e,t)=>{const r={400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"Im a teapot",421:"Misdirected Request",422:"Unprocessable Content",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",510:"Not Extended",511:"Network Authentication Required",...e.errors}[t.status];if(r)throw new d2(e,t,r);if(!t.ok){const a=t.status??"unknown",o=t.statusText??"unknown",i=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new d2(e,t,`Generic Error: status: ${a}; status text: ${o}; body: ${i}`)}},je=(e,t,n=p6)=>new GZ(async(r,a,o)=>{try{const i=ZZ(e,t),s=XZ(t),l=JZ(t),c=await QZ(e,t);if(!o.isCancelled){let u=await eX(e,t,i,l,s,c,o,n);for(const b of e.interceptors.response._fns)u=await b(u);const d=nX(u),g=tX(u,t.responseHeader);let m=d;t.responseTransformer&&f2(u.status)&&(m=await t.responseTransformer(d));const y={url:i,ok:f2(u.status),status:u.status,statusText:u.statusText,body:g??m};rX(t,y),r(y.body)}}catch(i){a(i)}});class g_{static deleteTool(t,n){return je(Oe,{method:"DELETE",url:"/v1/tools/{tool_id}",path:{tool_id:t.toolId},errors:{422:"Validation Error"},headers:n})}static getTool(t,n){return je(Oe,{method:"GET",url:"/v1/tools/{tool_id}",path:{tool_id:t.toolId},errors:{422:"Validation Error"},headers:n})}static updateTool(t,n){return je(Oe,{method:"PATCH",url:"/v1/tools/{tool_id}",path:{tool_id:t.toolId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static getToolIdByName(t,n){return je(Oe,{method:"GET",url:"/v1/tools/name/{tool_name}",path:{tool_name:t.toolName},errors:{422:"Validation Error"},headers:n})}static listTools(t={},n){return je(Oe,{method:"GET",url:"/v1/tools/",errors:{422:"Validation Error"},headers:n})}static createTool(t,n){return je(Oe,{method:"POST",url:"/v1/tools/",query:{update:t.update},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}}class Mc{static getSource(t,n){return je(Oe,{method:"GET",url:"/v1/sources/{source_id}",path:{source_id:t.sourceId},errors:{422:"Validation Error"},headers:n})}static updateSource(t,n){return je(Oe,{method:"PATCH",url:"/v1/sources/{source_id}",path:{source_id:t.sourceId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static deleteSource(t,n){return je(Oe,{method:"DELETE",url:"/v1/sources/{source_id}",path:{source_id:t.sourceId},errors:{422:"Validation Error"},headers:n})}static getSourceIdByName(t,n){return je(Oe,{method:"GET",url:"/v1/sources/name/{source_name}",path:{source_name:t.sourceName},errors:{422:"Validation Error"},headers:n})}static listSources(t={},n){return je(Oe,{method:"GET",url:"/v1/sources/",errors:{422:"Validation Error"},headers:n})}static createSource(t,n){return je(Oe,{method:"POST",url:"/v1/sources/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static attachAgentToSource(t,n){return je(Oe,{method:"POST",url:"/v1/sources/{source_id}/attach",path:{source_id:t.sourceId},query:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static detachAgentFromSource(t,n){return je(Oe,{method:"POST",url:"/v1/sources/{source_id}/detach",path:{source_id:t.sourceId},query:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static uploadFileToSource(t,n){return je(Oe,{method:"POST",url:"/v1/sources/{source_id}/upload",path:{source_id:t.sourceId},formData:t.formData,mediaType:"multipart/form-data",errors:{422:"Validation Error"},headers:n})}static listSourcePassages(t,n){return je(Oe,{method:"GET",url:"/v1/sources/{source_id}/passages",path:{source_id:t.sourceId},errors:{422:"Validation Error"},headers:n})}static listSourceDocuments(t,n){return je(Oe,{method:"GET",url:"/v1/sources/{source_id}/documents",path:{source_id:t.sourceId},errors:{422:"Validation Error"},headers:n})}}class Va{static listAgents(t={},n){return je(Oe,{method:"GET",url:"/v1/agents/",errors:{422:"Validation Error"},headers:n})}static createAgent(t,n){return je(Oe,{method:"POST",url:"/v1/agents/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static updateAgent(t,n){return je(Oe,{method:"PATCH",url:"/v1/agents/{agent_id}",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static getAgent(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static deleteAgent(t,n){return je(Oe,{method:"DELETE",url:"/v1/agents/{agent_id}",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static getAgentSources(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/sources",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static listAgentInContextMessages(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory/messages",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static getAgentMemory(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static updateAgentMemory(t,n){return je(Oe,{method:"PATCH",url:"/v1/agents/{agent_id}/memory",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static getAgentRecallMemorySummary(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory/recall",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static getAgentArchivalMemorySummary(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/memory/archival",path:{agent_id:t.agentId},errors:{422:"Validation Error"},headers:n})}static listAgentArchivalMemory(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/archival",path:{agent_id:t.agentId},query:{after:t.after,before:t.before,limit:t.limit},errors:{422:"Validation Error"},headers:n})}static createAgentArchivalMemory(t,n){return je(Oe,{method:"POST",url:"/v1/agents/{agent_id}/archival",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static deleteAgentArchivalMemory(t,n){return je(Oe,{method:"DELETE",url:"/v1/agents/{agent_id}/archival/{memory_id}",path:{agent_id:t.agentId,memory_id:t.memoryId},errors:{422:"Validation Error"},headers:n})}static listAgentMessages(t,n){return je(Oe,{method:"GET",url:"/v1/agents/{agent_id}/messages",path:{agent_id:t.agentId},query:{before:t.before,limit:t.limit,msg_object:t.msgObject,use_assistant_message:t.useAssistantMessage,assistant_message_function_name:t.assistantMessageFunctionName,assistant_message_function_kwarg:t.assistantMessageFunctionKwarg},errors:{422:"Validation Error"},headers:n})}static createAgentMessage(t,n){return je(Oe,{method:"POST",url:"/v1/agents/{agent_id}/messages",path:{agent_id:t.agentId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static updateAgentMessage(t,n){return je(Oe,{method:"PATCH",url:"/v1/agents/{agent_id}/messages/{message_id}",path:{agent_id:t.agentId,message_id:t.messageId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}}class aX{static listModels(t){return je(Oe,{method:"GET",url:"/v1/models/",headers:t})}static listEmbeddingModels(t){return je(Oe,{method:"GET",url:"/v1/models/embedding",headers:t})}}class oX{static listModels(t){return je(Oe,{method:"GET",url:"/v1/models/",headers:t})}static listEmbeddingModels(t){return je(Oe,{method:"GET",url:"/v1/models/embedding",headers:t})}}class m_{static listMemoryBlocks(t={},n){return je(Oe,{method:"GET",url:"/v1/blocks/",query:{label:t.label,templates_only:t.templatesOnly,name:t.name},errors:{422:"Validation Error"},headers:n})}static createMemoryBlock(t,n){return je(Oe,{method:"POST",url:"/v1/blocks/",body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static updateMemoryBlock(t,n){return je(Oe,{method:"PATCH",url:"/v1/blocks/{block_id}",path:{block_id:t.blockId},body:t.requestBody,mediaType:"application/json",errors:{422:"Validation Error"},headers:n})}static deleteMemoryBlock(t,n){return je(Oe,{method:"DELETE",url:"/v1/blocks/{block_id}",path:{block_id:t.blockId},errors:{422:"Validation Error"},headers:n})}static getMemoryBlock(t,n){return je(Oe,{method:"GET",url:"/v1/blocks/{block_id}",path:{block_id:t.blockId},errors:{422:"Validation Error"},headers:n})}}class iX{static listJobs(t={},n){return je(Oe,{method:"GET",url:"/v1/jobs/",query:{source_id:t.sourceId},errors:{422:"Validation Error"},headers:n})}static listActiveJobs(t={},n){return je(Oe,{method:"GET",url:"/v1/jobs/active",errors:{422:"Validation Error"},headers:n})}static getJob(t,n){return je(Oe,{method:"GET",url:"/v1/jobs/{job_id}",path:{job_id:t.jobId},errors:{422:"Validation Error"},headers:n})}}const Zm=({userId:e}={},t,n)=>Jr({queryKey:p_({userId:e},t),queryFn:()=>g_.listTools({userId:e}),...n}),h_=({userId:e}={},t,n)=>Jr({queryKey:of({userId:e},t),queryFn:()=>Mc.listSources({userId:e}),...n}),Xm=({userId:e}={},t,n)=>Jr({queryKey:g6({userId:e},t),queryFn:()=>Va.listAgents({userId:e}),...n}),b_=({agentId:e,userId:t},n,r)=>Jr({queryKey:sf({agentId:e,userId:t},n),queryFn:()=>Va.getAgent({agentId:e,userId:t}),...r}),v6=({agentId:e},t,n)=>Jr({queryKey:m6({agentId:e},t),queryFn:()=>Va.getAgentSources({agentId:e}),...n}),S6=({after:e,agentId:t,before:n,limit:r,userId:a},o,i)=>Jr({queryKey:h6({after:e,agentId:t,before:n,limit:r,userId:a},o),queryFn:()=>Va.listAgentArchivalMemory({after:e,agentId:t,before:n,limit:r,userId:a}),...i}),sX=({agentId:e,assistantMessageFunctionKwarg:t,assistantMessageFunctionName:n,before:r,limit:a,msgObject:o,useAssistantMessage:i,userId:s},l,c)=>Jr({queryKey:PZ({agentId:e,assistantMessageFunctionKwarg:t,assistantMessageFunctionName:n,before:r,limit:a,msgObject:o,useAssistantMessage:i,userId:s},l),queryFn:()=>Va.listAgentMessages({agentId:e,assistantMessageFunctionKwarg:t,assistantMessageFunctionName:n,before:r,limit:a,msgObject:o,useAssistantMessage:i,userId:s}),...c}),w6=(e,t)=>Jr({queryKey:FZ(e),queryFn:()=>aX.listModels(),...t}),E6=(e,t)=>Jr({queryKey:zZ(e),queryFn:()=>oX.listEmbeddingModels(),...t}),Rg=({label:e,name:t,templatesOnly:n,userId:r}={},a,o)=>Jr({queryKey:lf({label:e,name:t,templatesOnly:n,userId:r},a),queryFn:()=>m_.listMemoryBlocks({label:e,name:t,templatesOnly:n,userId:r}),...o}),lX=({userId:e}={},t,n)=>Jr({queryKey:b6({userId:e},t),queryFn:()=>iX.listActiveJobs({userId:e}),...n}),cX=e=>gr({mutationFn:({requestBody:t,update:n,userId:r})=>g_.createTool({requestBody:t,update:n,userId:r}),...e}),uX=e=>gr({mutationFn:({requestBody:t,userId:n})=>Mc.createSource({requestBody:t,userId:n}),...e}),x6=e=>gr({mutationFn:({agentId:t,sourceId:n,userId:r})=>Mc.attachAgentToSource({agentId:t,sourceId:n,userId:r}),...e}),k6=e=>gr({mutationFn:({agentId:t,sourceId:n,userId:r})=>Mc.detachAgentFromSource({agentId:t,sourceId:n,userId:r}),...e}),C6=e=>gr({mutationFn:({formData:t,sourceId:n,userId:r})=>Mc.uploadFileToSource({formData:t,sourceId:n,userId:r}),...e}),dX=e=>gr({mutationFn:({requestBody:t,userId:n})=>Va.createAgent({requestBody:t,userId:n}),...e}),fX=e=>gr({mutationFn:({agentId:t,requestBody:n,userId:r})=>Va.createAgentArchivalMemory({agentId:t,requestBody:n,userId:r}),...e}),_6=e=>gr({mutationFn:({requestBody:t,userId:n})=>m_.createMemoryBlock({requestBody:t,userId:n}),...e}),pX=e=>gr({mutationFn:({requestBody:t,toolId:n,userId:r})=>g_.updateTool({requestBody:t,toolId:n,userId:r}),...e}),gX=e=>gr({mutationFn:({requestBody:t,sourceId:n,userId:r})=>Mc.updateSource({requestBody:t,sourceId:n,userId:r}),...e}),Qm=e=>gr({mutationFn:({agentId:t,requestBody:n,userId:r})=>Va.updateAgent({agentId:t,requestBody:n,userId:r}),...e}),y_=e=>gr({mutationFn:({blockId:t,requestBody:n})=>m_.updateMemoryBlock({blockId:t,requestBody:n}),...e}),mX=e=>gr({mutationFn:({agentId:t,userId:n})=>Va.deleteAgent({agentId:t,userId:n}),...e}),hX=e=>gr({mutationFn:({agentId:t,memoryId:n,userId:r})=>Va.deleteAgentArchivalMemory({agentId:t,memoryId:n,userId:r}),...e});Oe.BASE="";Oe.HEADERS={"Content-Type":"application/json","Cache-Control":"no-cache"};const bX=({children:e})=>{const[t,n]=p.useState(!1),r=q4(),a=Mi();return p.useEffect(()=>{const o=i=>i;return Oe.interceptors.response.use(o),()=>{Oe.interceptors.response.eject(o)}},[a]),p.useEffect(()=>{const o=i=>(i.headers={...i.headers,Authorization:"Bearer password"},i);return Oe.interceptors.request.use(o),()=>{Oe.interceptors.request.eject(o)}},[r]),p.useEffect(()=>{t||setTimeout(()=>n(!0),10)},[t]),t?e:f.jsx("div",{className:"sr-only",children:"Re-authenticating..."})},bc=Jd("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",xs:"text-xs h-7 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10",iconSm:"h-9 w-9",iconXs:"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}});function p2({isBusy:e,icon:t}){return e?f.jsx(un,{className:"h-4 w-4 animate-spin"}):t||null}const ue=p.forwardRef(({className:e,children:t,label:n,isBusy:r,icon:a,iconPosition:o="left",disabled:i,variant:s,size:l,asChild:c=!1,...u},d)=>{const g=c?$a:"button",m=p.useMemo(()=>i||r,[i,r]),y=p.useMemo(()=>a||o?"flex items-center gap-1":"",[a,o]);return f.jsxs(g,{className:ee(y,bc({variant:s,size:l,className:e})),disabled:m,ref:d,...u,children:[o==="left"&&f.jsx(p2,{isBusy:r??!1,icon:a??null}),f.jsx(Tm,{children:t}),o==="right"&&f.jsx(p2,{isBusy:r??!1,icon:a??null})]})});ue.displayName="Button";const $s=({children:e,className:t})=>f.jsx("div",{className:ee("h-full w-full overflow-auto",t),children:e});function Yf({children:e,className:t}){return f.jsx("div",{className:ee("flex justify-center text-muted-foreground",t),children:e})}function yX(e){return f.jsxs("svg",{viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M5.21875 8.90625H3.84375C3.46875 8.90625 3.125 9.21875 3.125 9.625C3.125 10.0313 3.4375 10.3437 3.84375 10.3437H5.21875C5.59375 10.3437 5.9375 10.0313 5.9375 9.625C5.9375 9.21875 5.59375 8.90625 5.21875 8.90625Z",fill:"currentColor"}),f.jsx("path",{d:"M12.875 8.90625H11.5C11.125 8.90625 10.7812 9.21875 10.7812 9.625C10.7812 10.0313 11.0937 10.3437 11.5 10.3437H12.875C13.25 10.3437 13.5938 10.0313 13.5938 9.625C13.5938 9.21875 13.25 8.90625 12.875 8.90625Z",fill:"currentColor"}),f.jsx("path",{d:"M17.7187 8.09375V3.9375C18.5 3.65625 19.0312 2.90625 19.0312 2.0625C19.0312 0.9375 18.125 0.03125 17 0.03125C15.875 0.03125 14.9687 0.9375 14.9687 2.0625C14.9687 2.9375 15.5312 3.65625 16.2812 3.9375V8.0625H15.9375V7.84375C15.9375 6.59375 14.9062 5.5625 13.6562 5.5625H11.875V4.875C11.875 3.84375 11.0312 3.03125 10.0312 3.03125H9.0625V0.96875C9.0625 0.59375 8.75 0.25 8.34375 0.25C7.9375 0.25 7.625 0.5625 7.625 0.96875V3.03125H6.625C5.59375 3.03125 4.78125 3.875 4.78125 4.875V5.5625H2.8125C1.5625 5.5625 0.53125 6.59375 0.53125 7.84375V13.6875C0.53125 14.9375 1.5625 15.9688 2.8125 15.9688H13.6875C14.9375 15.9688 15.9687 14.9375 15.9687 13.6875V13.4688H17.625C18.6562 13.4688 19.4687 12.625 19.4687 11.625V9.96875C19.4687 8.9375 18.6875 8.15625 17.7187 8.09375ZM17 1.4375C17.3437 1.4375 17.625 1.71875 17.625 2.0625C17.625 2.40625 17.3437 2.6875 17 2.6875C16.6562 2.6875 16.375 2.40625 16.375 2.0625C16.375 1.71875 16.6562 1.4375 17 1.4375ZM6.21875 4.875C6.21875 4.625 6.40625 4.4375 6.65625 4.4375H10.0312C10.2812 4.4375 10.4687 4.625 10.4687 4.875V5.5625H6.21875V4.875ZM14.5312 13.6875C14.5312 14.1562 14.1562 14.5625 13.6562 14.5625H2.8125C2.34375 14.5625 1.9375 14.1875 1.9375 13.6875V7.84375C1.9375 7.375 2.3125 6.96875 2.8125 6.96875H13.6875C14.1562 6.96875 14.5625 7.34375 14.5625 7.84375V13.6875H14.5312ZM18.0625 11.5938C18.0625 11.8438 17.875 12.0312 17.625 12.0312H15.9375V9.46875H17.5937C17.8437 9.46875 18.0312 9.65625 18.0312 9.90625V11.5938H18.0625Z",fill:"currentColor"}),f.jsx("path",{d:"M9.5 11.125C9.125 11.125 8.78125 11.4375 8.78125 11.8437C8.78125 12.0937 8.59375 12.2813 8.34375 12.2813C8.09375 12.2813 7.90625 12.0937 7.90625 11.8437C7.90625 11.4687 7.59375 11.125 7.1875 11.125C6.78125 11.125 6.46875 11.4375 6.46875 11.8437C6.46875 12.875 7.3125 13.6875 8.3125 13.6875C9.3125 13.6875 10.1562 12.8437 10.1562 11.8437C10.1875 11.4375 9.875 11.125 9.5 11.125Z",fill:"currentColor"})]})}function vX(e){return f.jsx("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M8.00039 11.3998C7.85039 11.3998 7.72539 11.3498 7.60039 11.2498L1.85039 5.5998C1.62539 5.3748 1.62539 5.0248 1.85039 4.7998C2.07539 4.5748 2.42539 4.5748 2.65039 4.7998L8.00039 10.0248L13.3504 4.7498C13.5754 4.5248 13.9254 4.5248 14.1504 4.7498C14.3754 4.9748 14.3754 5.3248 14.1504 5.5498L8.40039 11.1998C8.27539 11.3248 8.15039 11.3998 8.00039 11.3998Z",fill:"currentColor"})})}function SX(e){return f.jsx("svg",{viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M13.7504 11.4002C13.6004 11.4002 13.4754 11.3502 13.3504 11.2502L8.00039 5.9752L2.65039 11.2252C2.42539 11.4502 2.07539 11.4502 1.85039 11.2252C1.62539 11.0002 1.62539 10.6502 1.85039 10.4252L7.60039 4.7752C7.82539 4.5502 8.17539 4.5502 8.40039 4.7752L14.1504 10.4252C14.3754 10.6502 14.3754 11.0002 14.1504 11.2252C14.0504 11.3252 13.9004 11.4002 13.7504 11.4002Z",fill:"currentColor"})})}function wX(e){return f.jsxs("svg",{viewBox:"0 0 20 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M10 9.5C12.5938 9.5 14.6875 7.40625 14.6875 4.8125C14.6875 2.21875 12.5938 0.125 10 0.125C7.40625 0.125 5.3125 2.21875 5.3125 4.8125C5.3125 7.40625 7.40625 9.5 10 9.5ZM10 1.53125C11.8125 1.53125 13.2812 3 13.2812 4.8125C13.2812 6.625 11.8125 8.09375 10 8.09375C8.1875 8.09375 6.71875 6.625 6.71875 4.8125C6.71875 3 8.1875 1.53125 10 1.53125Z",fill:"currentColor"}),f.jsx("path",{d:"M19.2191 14.625C16.6566 12.4688 13.4066 11.2812 10.0004 11.2812C6.59412 11.2812 3.34412 12.4688 0.781616 14.625C0.500366 14.875 0.437866 15.3125 0.687866 15.625C0.937866 15.9063 1.37537 15.9688 1.68787 15.7188C4.00037 13.75 6.93787 12.6875 10.0004 12.6875C13.0629 12.6875 16.0004 13.75 18.2816 15.6875C18.4066 15.8125 18.5629 15.8438 18.7504 15.8438C18.9379 15.8438 19.1566 15.75 19.2816 15.5938C19.5316 15.3125 19.5004 14.875 19.2191 14.625Z",fill:"currentColor"})]})}function EX(e){return f.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M17.875 2.9375H11C10.625 2.9375 10.2812 3.0625 10 3.25C9.71875 3.0625 9.375 2.9375 9 2.9375H2.125C1.25 2.9375 0.5625 3.65625 0.5625 4.5V14.6875C0.5625 15.5625 1.28125 16.25 2.125 16.25H9.3125V16.3437C9.3125 16.7187 9.625 17.0625 10.0312 17.0625C10.4062 17.0625 10.75 16.75 10.75 16.3437V16.25H17.9375C18.8125 16.25 19.5 15.5312 19.5 14.6875V4.5C19.4688 3.625 18.75 2.9375 17.875 2.9375ZM2.125 14.875C2.03125 14.875 1.96875 14.8125 1.96875 14.7187V4.5C1.96875 4.40625 2.03125 4.34375 2.125 4.34375H9.03125C9.1875 4.34375 9.3125 4.46875 9.3125 4.625V14.875H2.125ZM18.0625 14.6875C18.0625 14.7812 18 14.8437 17.9062 14.8437H10.7188V4.625C10.7188 4.46875 10.8438 4.34375 11 4.34375H17.9062C18 4.34375 18.0625 4.40625 18.0625 4.5V14.6875Z",fill:"currentColor"}),f.jsx("path",{d:"M4.46875 7.40625H6.78125C7.15625 7.40625 7.5 7.09375 7.5 6.6875C7.5 6.28125 7.1875 5.96875 6.78125 5.96875H4.46875C4.09375 5.96875 3.75 6.28125 3.75 6.6875C3.75 7.09375 4.0625 7.40625 4.46875 7.40625Z",fill:"currentColor"}),f.jsx("path",{d:"M13.125 7.40625H15.4375C15.8125 7.40625 16.1562 7.09375 16.1562 6.6875C16.1562 6.28125 15.8438 5.96875 15.4375 5.96875H13.125C12.75 5.96875 12.4062 6.28125 12.4062 6.6875C12.4062 7.09375 12.75 7.40625 13.125 7.40625Z",fill:"currentColor"}),f.jsx("path",{d:"M15.5 8.5625H13.1875C12.8125 8.5625 12.4688 8.875 12.4688 9.28125C12.4688 9.6875 12.7812 10 13.1875 10H15.5C15.875 10 16.2188 9.6875 16.2188 9.28125C16.2188 8.875 15.875 8.5625 15.5 8.5625Z",fill:"currentColor"}),f.jsx("path",{d:"M6.8125 8.5625H4.5C4.125 8.5625 3.78125 8.875 3.78125 9.28125C3.78125 9.6875 4.09375 10 4.5 10H6.8125C7.1875 10 7.53125 9.6875 7.53125 9.28125C7.53125 8.875 7.21875 8.5625 6.8125 8.5625Z",fill:"currentColor"}),f.jsx("path",{d:"M6.8125 11.3125H4.5C4.125 11.3125 3.78125 11.625 3.78125 12.0312C3.78125 12.4375 4.09375 12.75 4.5 12.75H6.8125C7.1875 12.75 7.53125 12.4375 7.53125 12.0312C7.53125 11.625 7.21875 11.3125 6.8125 11.3125Z",fill:"currentColor"}),f.jsx("path",{d:"M15.5 11.3125H13.1875C12.8125 11.3125 12.4688 11.625 12.4688 12.0312C12.4688 12.4375 12.7812 12.75 13.1875 12.75H15.5C15.875 12.75 16.2188 12.4375 16.2188 12.0312C16.2188 11.625 15.875 11.3125 15.5 11.3125Z",fill:"currentColor"})]})}function xX(e){return f.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("path",{d:"M17.5625 2.28125H2.4375C1.40625 2.28125 0.5625 3.125 0.5625 4.15625V12.875C0.5625 13.9063 1.40625 14.75 2.4375 14.75H6.9375L9.4375 17.5C9.5625 17.6563 9.75 17.7188 9.96875 17.7188C10.1562 17.7188 10.3438 17.625 10.5 17.5L13.0625 14.7188H17.5938C18.625 14.7188 19.4688 13.875 19.4688 12.8438V4.15625C19.4688 3.125 18.5938 2.28125 17.5625 2.28125ZM18.0625 12.8438C18.0625 13.0938 17.8438 13.3125 17.5938 13.3125H12.7188C12.5312 13.3125 12.3438 13.4063 12.1875 13.5313L9.9375 15.9688L7.75 13.5625C7.625 13.4063 7.4375 13.3438 7.21875 13.3438H2.4375C2.1875 13.3438 1.96875 13.125 1.96875 12.875V4.15625C1.96875 3.90625 2.1875 3.6875 2.4375 3.6875H17.5625C17.8125 3.6875 18.0312 3.90625 18.0312 4.15625V12.8438H18.0625Z",fill:"currentColor"}),f.jsx("path",{d:"M5.5625 7.59375C5.15625 7.59375 4.8125 7.9375 4.8125 8.34375C4.8125 8.75 5.15625 9.09375 5.5625 9.09375C5.96875 9.09375 6.3125 8.75 6.3125 8.34375C6.3125 7.9375 6 7.59375 5.5625 7.59375Z",fill:"currentColor"}),f.jsx("path",{d:"M10 7.59375C9.59375 7.59375 9.25 7.9375 9.25 8.34375C9.25 8.75 9.59375 9.09375 10 9.09375C10.4062 9.09375 10.75 8.75 10.75 8.34375C10.75 7.9375 10.4062 7.59375 10 7.59375Z",fill:"currentColor"}),f.jsx("path",{d:"M14.4375 7.59375C14.0313 7.59375 13.6875 7.9375 13.6875 8.34375C13.6875 8.75 14.0313 9.09375 14.4375 9.09375C14.8438 9.09375 15.1875 8.75 15.1875 8.34375C15.1875 7.9375 14.8438 7.59375 14.4375 7.59375Z",fill:"currentColor"})]})}function kX(e){return f.jsx("svg",{viewBox:"0 0 14 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:f.jsx("path",{d:"M7 0.5625C3.34375 0.5625 0.46875 2.28125 0.46875 4.4375V15.5625C0.46875 17.7188 3.40625 19.4375 6.96875 19.4375C10.5625 19.4375 13.5 17.6875 13.5 15.5625V4.4375C13.5312 2.25 10.6562 0.5625 7 0.5625ZM7 1.96875C10 1.96875 12.125 3.28125 12.125 4.4375C12.125 5.625 10.0312 6.90625 7 6.90625C3.96875 6.90625 1.875 5.59375 1.875 4.4375C1.875 3.25 4 1.96875 7 1.96875ZM7 18.0625C4.0625 18.0625 1.90625 16.75 1.90625 15.5938V14.375C3.09375 15.25 4.90625 15.7813 7 15.7813C9.09375 15.7813 10.9375 15.2188 12.125 14.375V15.5938C12.125 16.75 9.9375 18.0625 7 18.0625ZM7 14.375C4 14.375 1.90625 13.125 1.90625 12V10.5625C3.125 11.4375 5.03125 11.9688 7 11.9688C9.0625 11.9688 10.9063 11.4375 12.125 10.5625V12C12.125 13.125 10 14.375 7 14.375ZM11.3125 9.40625C10.3437 10.125 8.75 10.5625 7 10.5625C5.28125 10.5625 3.65625 10.125 2.6875 9.40625C2.3125 9.15625 1.90625 8.71875 1.90625 8.1875V6.875C3.09375 7.75 4.9375 8.3125 7.03125 8.3125C9.125 8.3125 10.9688 7.75 12.1562 6.875V8.1875C12.125 8.6875 11.6875 9.125 11.3125 9.40625Z",fill:"currentColor"})})}function CX(e){return f.jsxs("svg",{viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("g",{clipPath:"url(#clip0_6318_531)",children:f.jsx("path",{d:"M18.7505 13.7189L16.813 11.7814C16.0317 11.0002 14.7505 11.0002 13.9692 11.7814L13.438 12.3127L11.7192 10.5939L13.3442 8.96891L16.5317 8.12515C17.2192 7.93765 17.7817 7.37515 17.9692 6.68765L18.8755 3.3439C18.9692 2.9689 18.7505 2.5939 18.3755 2.4689C18.0005 2.37515 17.6255 2.5939 17.5005 2.9689L16.5942 6.31265C16.5317 6.5314 16.3755 6.68765 16.1567 6.75015L12.813 7.6564C12.688 7.68765 12.5942 7.75015 12.5005 7.8439L10.7505 9.59391L9.68799 8.5314L11.438 6.7814C11.5317 6.68765 11.5942 6.5939 11.6255 6.4689L12.5005 3.12515C12.563 2.9064 12.7192 2.75015 12.938 2.68765L16.2817 1.7814C16.6567 1.68765 16.8755 1.2814 16.7817 0.906405C16.688 0.531405 16.313 0.312655 15.938 0.437655L12.5942 1.31265C11.9067 1.50015 11.3442 2.06265 11.1567 2.75015L10.313 5.9064L8.68799 7.5314L7.063 5.9064C7.688 5.18765 7.7505 4.12515 7.188 3.3439L5.84425 1.56265C5.5005 1.0939 4.96925 0.812655 4.3755 0.781405C3.78175 0.750155 3.21925 0.937655 2.813 1.37515L1.53175 2.6564C1.1255 3.06265 0.906746 3.62515 0.937996 4.2189C0.969246 4.81265 1.2505 5.3439 1.71925 5.68765L3.5005 7.0314C3.84425 7.31265 4.28175 7.43765 4.71925 7.43765C5.21925 7.43765 5.688 7.25015 6.063 6.9064L7.688 8.5314L5.59425 10.6252L2.438 11.4689C1.7505 11.6564 1.188 12.2189 1.0005 12.9064L0.312996 15.5002C0.125496 16.1877 0.312996 16.9377 0.844246 17.4689L1.813 18.4377C2.188 18.8127 2.71925 19.0314 3.2505 19.0314C3.438 19.0314 3.59425 19.0002 3.78175 18.9689L6.3755 18.2814C7.063 18.0939 7.6255 17.5314 7.813 16.8439L8.65675 13.6877L10.7505 11.5939L12.4692 13.3127L11.938 13.8439C11.1567 14.6252 11.1567 15.9064 11.938 16.6877L13.8755 18.6252C14.5317 19.2814 15.3755 19.6252 16.313 19.6252C17.2505 19.6252 18.0942 19.2814 18.7505 18.6252C19.4067 17.9689 19.7505 17.1252 19.7505 16.1877C19.7505 15.2502 19.4067 14.3752 18.7505 13.7189ZM4.34425 5.87515L2.563 4.5314C2.3755 4.37515 2.34425 4.18765 2.313 4.0939C2.313 4.00015 2.313 3.7814 2.5005 3.62515L3.78175 2.3439C3.938 2.18765 4.09425 2.1564 4.21925 2.1564H4.2505C4.34425 2.1564 4.53175 2.2189 4.688 2.4064L6.03175 4.18765C6.21925 4.43765 6.188 4.75015 5.96925 4.9689L5.1255 5.81265C4.938 6.0314 4.59425 6.06265 4.34425 5.87515ZM7.53175 12.8127C7.438 12.9064 7.3755 13.0002 7.34425 13.1252L6.438 16.4689C6.3755 16.6877 6.21925 16.8439 6.0005 16.9064L3.40675 17.5939C3.188 17.6564 2.96925 17.5939 2.813 17.4377L1.84425 16.4689C1.688 16.3127 1.6255 16.0939 1.688 15.8752L2.3755 13.2814C2.438 13.0627 2.59425 12.9064 2.813 12.8439L6.15675 11.9377C6.28175 11.9064 6.3755 11.8439 6.46925 11.7502L8.71924 9.50015L9.78174 10.5627L7.53175 12.8127ZM17.7505 17.5939C17.3755 17.9689 16.8442 18.1877 16.313 18.1877C15.7817 18.1877 15.2505 17.9689 14.8755 17.5939L12.938 15.6564C12.7192 15.4377 12.7192 15.0314 12.938 14.8127L13.4692 14.2814L13.9067 14.7189C14.0317 14.8439 14.2192 14.9377 14.4067 14.9377C14.5942 14.9377 14.7817 14.8752 14.9067 14.7189C15.188 14.4377 15.188 14.0002 14.9067 13.7189L14.4692 13.2814L15.0005 12.7502C15.1255 12.6252 15.2505 12.5627 15.438 12.5627C15.5942 12.5627 15.7505 12.6252 15.8755 12.7502L17.813 14.6877C18.188 15.0627 18.4067 15.5939 18.4067 16.1252C18.4067 16.6564 18.1567 17.2189 17.7505 17.5939Z",fill:"currentColor"})}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_6318_531",children:f.jsx("rect",{width:"20",height:"20",fill:"white"})})})]})}/** * table-core * * Copyright (c) TanStack @@ -147,7 +147,7 @@ Error generating stack: `+o.message+` `)},g7=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,a=r===void 0?"margin":r,o=p.useMemo(function(){return WJ(a)},[a]);return p.createElement(KJ,{styles:YJ(o,!t,a,n?"":"!important")})},nk=!1;if(typeof window<"u")try{var np=Object.defineProperty({},"passive",{get:function(){return nk=!0,!0}});window.addEventListener("test",np,np),window.removeEventListener("test",np,np)}catch{nk=!1}var Qs=nk?{passive:!1}:!1,ZJ=function(e){return e.tagName==="TEXTAREA"},m7=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!ZJ(e)&&n[t]==="visible")},XJ=function(e){return m7(e,"overflowY")},QJ=function(e){return m7(e,"overflowX")},O2=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=h7(e,n);if(r){var a=b7(e,n),o=a[1],i=a[2];if(o>i)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},JJ=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},eee=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},h7=function(e,t){return e==="v"?XJ(t):QJ(t)},b7=function(e,t){return e==="v"?JJ(t):eee(t)},tee=function(e,t){return e==="h"&&t==="rtl"?-1:1},nee=function(e,t,n,r,a){var o=tee(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,g=0;do{var m=b7(e,s),y=m[0],b=m[1],w=m[2],v=b-w-o*y;(y||v)&&h7(e,s)&&(d+=v,g+=y),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(a&&d===0||!a&&i>d)||!u&&(a&&g===0||!a&&-i>g))&&(c=!0),c},rp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},D2=function(e){return[e.deltaX,e.deltaY]},L2=function(e){return e&&"current"in e?e.current:e},ree=function(e,t){return e[0]===t[0]&&e[1]===t[1]},aee=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},oee=0,Js=[];function iee(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),a=p.useState(oee++)[0],o=p.useState(function(){return D_()})[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=l7([e.lockRef.current],(e.shards||[]).map(L2),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(b,w){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var v=rp(b),h=n.current,S="deltaX"in b?b.deltaX:h[0]-v[0],E="deltaY"in b?b.deltaY:h[1]-v[1],k,x=b.target,C=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in b&&C==="h"&&x.type==="range")return!1;var _=O2(C,x);if(!_)return!0;if(_?k=C:(k=C==="v"?"h":"v",_=O2(C,x)),!_)return!1;if(!r.current&&"changedTouches"in b&&(S||E)&&(r.current=k),!k)return!0;var T=r.current||k;return nee(T,w,b,T==="h"?S:E,!0)},[]),l=p.useCallback(function(b){var w=b;if(!(!Js.length||Js[Js.length-1]!==o)){var v="deltaY"in w?D2(w):rp(w),h=t.current.filter(function(k){return k.name===w.type&&k.target===w.target&&ree(k.delta,v)})[0];if(h&&h.should){w.cancelable&&w.preventDefault();return}if(!h){var S=(i.current.shards||[]).map(L2).filter(Boolean).filter(function(k){return k.contains(w.target)}),E=S.length>0?s(w,S[0]):!i.current.noIsolation;E&&w.cancelable&&w.preventDefault()}}},[]),c=p.useCallback(function(b,w,v,h){var S={name:b,delta:w,target:v,should:h};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(E){return E!==S})},1)},[]),u=p.useCallback(function(b){n.current=rp(b),r.current=void 0},[]),d=p.useCallback(function(b){c(b.type,D2(b),b.target,s(b,e.lockRef.current))},[]),g=p.useCallback(function(b){c(b.type,rp(b),b.target,s(b,e.lockRef.current))},[]);p.useEffect(function(){return Js.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Qs),document.addEventListener("touchmove",l,Qs),document.addEventListener("touchstart",u,Qs),function(){Js=Js.filter(function(b){return b!==o}),document.removeEventListener("wheel",l,Qs),document.removeEventListener("touchmove",l,Qs),document.removeEventListener("touchstart",u,Qs)}},[]);var m=e.removeScrollBar,y=e.inert;return p.createElement(p.Fragment,null,y?p.createElement(o,{styles:aee(a)}):null,m?p.createElement(g7,{gapMode:"margin"}):null)}const see=f7(p7,iee);var y7=p.forwardRef(function(e,t){return p.createElement(oh,Pn({},e,{ref:t,sideCar:see}))});y7.classNames=oh.classNames;const ih=y7,rk=["Enter"," "],lee=["ArrowDown","PageUp","Home"],v7=["ArrowUp","PageDown","End"],cee=[...lee,...v7],uee={ltr:[...rk,"ArrowRight"],rtl:[...rk,"ArrowLeft"]},dee={ltr:["ArrowLeft"],rtl:["ArrowRight"]},sh="Menu",[wd,fee,pee]=Rm(sh),[Fs,S7]=zn(sh,[pee,qa,ah]),w7=qa(),E7=ah(),[pTe,js]=Fs(sh),[gTe,mf]=Fs(sh),gee=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=w7(n);return p.createElement(ff,W({},a,r,{ref:t}))}),x7="MenuPortal",[mee,k7]=Fs(x7,{forceMount:void 0}),hee=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,o=js(x7,t);return p.createElement(mee,{scope:t,forceMount:n},p.createElement(pr,{present:n||o.open},p.createElement(Qd,{asChild:!0,container:a},r)))},ga="MenuContent",[bee,L_]=Fs(ga),yee=p.forwardRef((e,t)=>{const n=k7(ga,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=js(ga,e.__scopeMenu),i=mf(ga,e.__scopeMenu);return p.createElement(wd.Provider,{scope:e.__scopeMenu},p.createElement(pr,{present:r||o.open},p.createElement(wd.Slot,{scope:e.__scopeMenu},i.modal?p.createElement(vee,W({},a,{ref:t})):p.createElement(See,W({},a,{ref:t})))))}),vee=p.forwardRef((e,t)=>{const n=js(ga,e.__scopeMenu),r=p.useRef(null),a=rt(t,r);return p.useEffect(()=>{const o=r.current;if(o)return gf(o)},[]),p.createElement(M_,W({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),See=p.forwardRef((e,t)=>{const n=js(ga,e.__scopeMenu);return p.createElement(M_,W({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),M_=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:g,onDismiss:m,disableOutsideScroll:y,...b}=e,w=js(ga,n),v=mf(ga,n),h=w7(n),S=E7(n),E=fee(n),[k,x]=p.useState(null),C=p.useRef(null),_=rt(t,C,w.onContentChange),T=p.useRef(0),R=p.useRef(""),L=p.useRef(0),D=p.useRef(null),H=p.useRef("right"),z=p.useRef(0),M=y?ih:p.Fragment,U=y?{as:$a,allowPinchZoom:!0}:void 0,X=O=>{var A,V;const P=R.current+O,N=E().filter(he=>!he.disabled),K=document.activeElement,ae=(A=N.find(he=>he.ref.current===K))===null||A===void 0?void 0:A.textValue,ne=N.map(he=>he.textValue),Q=Pee(ne,P,ae),pe=(V=N.find(he=>he.textValue===Q))===null||V===void 0?void 0:V.ref.current;(function he(re){R.current=re,window.clearTimeout(T.current),re!==""&&(T.current=window.setTimeout(()=>he(""),1e3))})(P),pe&&setTimeout(()=>pe.focus())};p.useEffect(()=>()=>window.clearTimeout(T.current),[]),Jm();const j=p.useCallback(O=>{var A,V;return H.current===((A=D.current)===null||A===void 0?void 0:A.side)&&Fee(O,(V=D.current)===null||V===void 0?void 0:V.area)},[]);return p.createElement(bee,{scope:n,searchRef:R,onItemEnter:p.useCallback(O=>{j(O)&&O.preventDefault()},[j]),onItemLeave:p.useCallback(O=>{var A;j(O)||((A=C.current)===null||A===void 0||A.focus(),x(null))},[j]),onTriggerLeave:p.useCallback(O=>{j(O)&&O.preventDefault()},[j]),pointerGraceTimerRef:L,onPointerGraceIntentChange:p.useCallback(O=>{D.current=O},[])},p.createElement(M,U,p.createElement(eh,{asChild:!0,trapped:a,onMountAutoFocus:fe(o,O=>{var A;O.preventDefault(),(A=C.current)===null||A===void 0||A.focus()}),onUnmountAutoFocus:i},p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:g,onDismiss:m},p.createElement(o7,W({asChild:!0},S,{dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:x,onEntryFocus:fe(l,O=>{v.isUsingKeyboardRef.current||O.preventDefault()})}),p.createElement(pf,W({role:"menu","aria-orientation":"vertical","data-state":R7(w.open),"data-radix-menu-content":"",dir:v.dir},h,b,{ref:_,style:{outline:"none",...b.style},onKeyDown:fe(b.onKeyDown,O=>{const V=O.target.closest("[data-radix-menu-content]")===O.currentTarget,P=O.ctrlKey||O.altKey||O.metaKey,N=O.key.length===1;V&&(O.key==="Tab"&&O.preventDefault(),!P&&N&&X(O.key));const K=C.current;if(O.target!==K||!cee.includes(O.key))return;O.preventDefault();const ne=E().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);v7.includes(O.key)&&ne.reverse(),Lee(ne)}),onBlur:fe(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(T.current),R.current="")}),onPointerMove:fe(e.onPointerMove,Ed(O=>{const A=O.target,V=z.current!==O.clientX;if(O.currentTarget.contains(A)&&V){const P=O.clientX>z.current?"right":"left";H.current=P,z.current=O.clientX}}))})))))))}),wee=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.createElement(ze.div,W({},r,{ref:t}))}),ak="MenuItem",M2="menu.itemSelect",P_=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,o=p.useRef(null),i=mf(ak,e.__scopeMenu),s=L_(ak,e.__scopeMenu),l=rt(t,o),c=p.useRef(!1),u=()=>{const d=o.current;if(!n&&d){const g=new CustomEvent(M2,{bubbles:!0,cancelable:!0});d.addEventListener(M2,m=>r==null?void 0:r(m),{once:!0}),WC(d,g),g.defaultPrevented?c.current=!1:i.onClose()}};return p.createElement(C7,W({},a,{ref:l,disabled:n,onClick:fe(e.onClick,u),onPointerDown:d=>{var g;(g=e.onPointerDown)===null||g===void 0||g.call(e,d),c.current=!0},onPointerUp:fe(e.onPointerUp,d=>{var g;c.current||(g=d.currentTarget)===null||g===void 0||g.click()}),onKeyDown:fe(e.onKeyDown,d=>{const g=s.searchRef.current!=="";n||g&&d.key===" "||rk.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})}))}),C7=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,i=L_(ak,n),s=E7(n),l=p.useRef(null),c=rt(t,l),[u,d]=p.useState(!1),[g,m]=p.useState("");return p.useEffect(()=>{const y=l.current;if(y){var b;m(((b=y.textContent)!==null&&b!==void 0?b:"").trim())}},[o.children]),p.createElement(wd.ItemSlot,{scope:n,disabled:r,textValue:a??g},p.createElement(i7,W({asChild:!0},s,{focusable:!r}),p.createElement(ze.div,W({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},o,{ref:c,onPointerMove:fe(e.onPointerMove,Ed(y=>{r?i.onItemLeave(y):(i.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus())})),onPointerLeave:fe(e.onPointerLeave,Ed(y=>i.onItemLeave(y))),onFocus:fe(e.onFocus,()=>d(!0)),onBlur:fe(e.onBlur,()=>d(!1))}))))}),Eee=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return p.createElement(A7,{scope:e.__scopeMenu,checked:n},p.createElement(P_,W({role:"menuitemcheckbox","aria-checked":Mg(n)?"mixed":n},a,{ref:t,"data-state":$_(n),onSelect:fe(a.onSelect,()=>r==null?void 0:r(Mg(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),xee="MenuRadioGroup",[mTe,kee]=Fs(xee,{value:void 0,onValueChange:()=>{}}),Cee="MenuRadioItem",_ee=p.forwardRef((e,t)=>{const{value:n,...r}=e,a=kee(Cee,e.__scopeMenu),o=n===a.value;return p.createElement(A7,{scope:e.__scopeMenu,checked:o},p.createElement(P_,W({role:"menuitemradio","aria-checked":o},r,{ref:t,"data-state":$_(o),onSelect:fe(r.onSelect,()=>{var i;return(i=a.onValueChange)===null||i===void 0?void 0:i.call(a,n)},{checkForDefaultPrevented:!1})})))}),_7="MenuItemIndicator",[A7,Aee]=Fs(_7,{checked:!1}),Tee=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,o=Aee(_7,n);return p.createElement(pr,{present:r||Mg(o.checked)||o.checked===!0},p.createElement(ze.span,W({},a,{ref:t,"data-state":$_(o.checked)})))}),Ree=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.createElement(ze.div,W({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Nee="MenuSub",[hTe,T7]=Fs(Nee),ap="MenuSubTrigger",Iee=p.forwardRef((e,t)=>{const n=js(ap,e.__scopeMenu),r=mf(ap,e.__scopeMenu),a=T7(ap,e.__scopeMenu),o=L_(ap,e.__scopeMenu),i=p.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},u=p.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return p.useEffect(()=>u,[u]),p.useEffect(()=>{const d=s.current;return()=>{window.clearTimeout(d),l(null)}},[s,l]),p.createElement(gee,W({asChild:!0},c),p.createElement(C7,W({id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":R7(n.open)},e,{ref:GC(t,a.onTriggerChange),onClick:d=>{var g;(g=e.onClick)===null||g===void 0||g.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(e.onPointerMove,Ed(d=>{o.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:fe(e.onPointerLeave,Ed(d=>{var g;u();const m=(g=n.content)===null||g===void 0?void 0:g.getBoundingClientRect();if(m){var y;const b=(y=n.content)===null||y===void 0?void 0:y.dataset.side,w=b==="right",v=w?-5:5,h=m[w?"left":"right"],S=m[w?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+v,y:d.clientY},{x:h,y:m.top},{x:S,y:m.top},{x:S,y:m.bottom},{x:h,y:m.bottom}],side:b}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:fe(e.onKeyDown,d=>{const g=o.searchRef.current!=="";if(!(e.disabled||g&&d.key===" ")&&uee[r.dir].includes(d.key)){var m;n.onOpenChange(!0),(m=n.content)===null||m===void 0||m.focus(),d.preventDefault()}})})))}),Oee="MenuSubContent",Dee=p.forwardRef((e,t)=>{const n=k7(ga,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=js(ga,e.__scopeMenu),i=mf(ga,e.__scopeMenu),s=T7(Oee,e.__scopeMenu),l=p.useRef(null),c=rt(t,l);return p.createElement(wd.Provider,{scope:e.__scopeMenu},p.createElement(pr,{present:r||o.open},p.createElement(wd.Slot,{scope:e.__scopeMenu},p.createElement(M_,W({id:s.contentId,"aria-labelledby":s.triggerId},a,{ref:c,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;i.isUsingKeyboardRef.current&&((d=l.current)===null||d===void 0||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:fe(e.onFocusOutside,u=>{u.target!==s.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:fe(e.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:fe(e.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),g=dee[i.dir].includes(u.key);if(d&&g){var m;o.onOpenChange(!1),(m=s.trigger)===null||m===void 0||m.focus(),u.preventDefault()}})})))))});function R7(e){return e?"open":"closed"}function Mg(e){return e==="indeterminate"}function $_(e){return Mg(e)?"indeterminate":e?"checked":"unchecked"}function Lee(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Mee(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Pee(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Mee(e,Math.max(o,0));a.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function $ee(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,i=t.length-1;or!=u>r&&n<(c-s)*(r-l)/(u-l)+s&&(a=!a)}return a}function Fee(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $ee(n,t)}function Ed(e){return t=>t.pointerType==="mouse"?e(t):void 0}const jee=hee,zee=yee,Uee=wee,Bee=P_,Hee=Eee,Vee=_ee,qee=Tee,Gee=Ree,Wee=Iee,Kee=Dee,N7="DropdownMenu",[Yee,bTe]=zn(N7,[S7]),Ga=S7(),[yTe,Zee]=Yee(N7),Xee=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ga(t);return p.createElement(jee,W({},r,n))},Qee="DropdownMenuContent",Jee=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Zee(Qee,n),o=Ga(n),i=p.useRef(!1);return p.createElement(zee,W({id:a.contentId,"aria-labelledby":a.triggerId},o,r,{ref:t,onCloseAutoFocus:fe(e.onCloseAutoFocus,s=>{var l;i.current||(l=a.triggerRef.current)===null||l===void 0||l.focus(),i.current=!1,s.preventDefault()}),onInteractOutside:fe(e.onInteractOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!a.modal||u)&&(i.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)"}}))}),ete=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Uee,W({},a,r,{ref:t}))}),tte=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Bee,W({},a,r,{ref:t}))}),nte=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Hee,W({},a,r,{ref:t}))}),rte=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Vee,W({},a,r,{ref:t}))}),ate=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(qee,W({},a,r,{ref:t}))}),ote=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Gee,W({},a,r,{ref:t}))}),ite=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Wee,W({},a,r,{ref:t}))}),ste=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Kee,W({},a,r,{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)"}}))}),lte=Xee,I7=Jee,O7=ete,D7=tte,L7=nte,M7=rte,P7=ate,$7=ote,F7=ite,j7=ste,cte=p.forwardRef(({className:e,inset:t,children:n,...r},a)=>f.jsxs(F7,{ref:a,className:ee("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,f.jsx(Pm,{className:"ml-auto h-4 w-4"})]}));cte.displayName=F7.displayName;const ute=p.forwardRef(({className:e,...t},n)=>f.jsx(j7,{ref:n,className:ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t}));ute.displayName=j7.displayName;const dte=p.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(lte,{children:f.jsx(I7,{ref:r,sideOffset:t,className:ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",e),...n})}));dte.displayName=I7.displayName;const fte=p.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(D7,{ref:r,className:ee("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));fte.displayName=D7.displayName;const pte=p.forwardRef(({className:e,children:t,checked:n,...r},a)=>f.jsxs(L7,{ref:a,className:ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(P7,{children:f.jsx(Mm,{className:"h-4 w-4"})})}),t]}));pte.displayName=L7.displayName;const gte=p.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(M7,{ref:r,className:ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(P7,{children:f.jsx(QF,{className:"h-2 w-2 fill-current"})})}),t]}));gte.displayName=M7.displayName;const mte=p.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(O7,{ref:r,className:ee("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));mte.displayName=O7.displayName;const hte=p.forwardRef(({className:e,...t},n)=>f.jsx($7,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",e),...t}));hte.displayName=$7.displayName;function P2(e,[t,n]){return Math.min(n,Math.max(t,e))}function F_(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const bte=[" ","Enter","ArrowUp","ArrowDown"],yte=[" ","Enter"],lh="Select",[ch,j_,vte]=Rm(lh),[Fc,vTe]=zn(lh,[vte,qa]),z_=qa(),[Ste,zs]=Fc(lh),[wte,Ete]=Fc(lh),xte=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:i,defaultValue:s,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:g,required:m}=e,y=z_(t),[b,w]=p.useState(null),[v,h]=p.useState(null),[S,E]=p.useState(!1),k=x_(c),[x=!1,C]=Fa({prop:r,defaultProp:a,onChange:o}),[_,T]=Fa({prop:i,defaultProp:s,onChange:l}),R=p.useRef(null),L=b?!!b.closest("form"):!0,[D,H]=p.useState(new Set),z=Array.from(D).map(M=>M.props.value).join(";");return p.createElement(rh,y,p.createElement(Ste,{required:m,scope:t,trigger:b,onTriggerChange:w,valueNode:v,onValueNodeChange:h,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:bi(),value:_,onValueChange:T,open:x,onOpenChange:C,dir:k,triggerPointerDownPosRef:R,disabled:g},p.createElement(ch.Provider,{scope:t},p.createElement(wte,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(M=>{H(U=>new Set(U).add(M))},[]),onNativeOptionRemove:p.useCallback(M=>{H(U=>{const X=new Set(U);return X.delete(M),X})},[])},n)),L?p.createElement(H7,{key:z,"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:d,value:_,onChange:M=>T(M.target.value),disabled:g},_===void 0?p.createElement("option",{value:""}):null,Array.from(D)):null))},kte="SelectTrigger",Cte=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,o=z_(n),i=zs(kte,n),s=i.disabled||r,l=rt(t,i.onTriggerChange),c=j_(n),[u,d,g]=V7(y=>{const b=c().filter(h=>!h.disabled),w=b.find(h=>h.value===i.value),v=q7(b,y,w);v!==void 0&&i.onValueChange(v.value)}),m=()=>{s||(i.onOpenChange(!0),g())};return p.createElement(ff,W({asChild:!0},o),p.createElement(ze.button,W({type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":B7(i.value)?"":void 0},a,{ref:l,onClick:fe(a.onClick,y=>{y.currentTarget.focus()}),onPointerDown:fe(a.onPointerDown,y=>{const b=y.target;b.hasPointerCapture(y.pointerId)&&b.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&(m(),i.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)},y.preventDefault())}),onKeyDown:fe(a.onKeyDown,y=>{const b=u.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&d(y.key),!(b&&y.key===" ")&&bte.includes(y.key)&&(m(),y.preventDefault())})})))}),_te="SelectValue",Ate=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...s}=e,l=zs(_te,n),{onValueNodeHasChildrenChange:c}=l,u=o!==void 0,d=rt(t,l.onValueNodeChange);return Zr(()=>{c(u)},[c,u]),p.createElement(ze.span,W({},s,{ref:d,style:{pointerEvents:"none"}}),B7(l.value)?p.createElement(p.Fragment,null,i):o)}),Tte=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return p.createElement(ze.span,W({"aria-hidden":!0},a,{ref:t}),r||"▼")}),Rte=e=>p.createElement(Qd,W({asChild:!0},e)),vc="SelectContent",Nte=p.forwardRef((e,t)=>{const n=zs(vc,e.__scopeSelect),[r,a]=p.useState();if(Zr(()=>{a(new DocumentFragment)},[]),!n.open){const o=r;return o?ba.createPortal(p.createElement(z7,{scope:e.__scopeSelect},p.createElement(ch.Slot,{scope:e.__scopeSelect},p.createElement("div",null,e.children))),o):null}return p.createElement(Ite,W({},e,{ref:t}))}),ro=10,[z7,uh]=Fc(vc),Ite=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:y,hideWhenDetached:b,avoidCollisions:w,...v}=e,h=zs(vc,n),[S,E]=p.useState(null),[k,x]=p.useState(null),C=rt(t,Q=>E(Q)),[_,T]=p.useState(null),[R,L]=p.useState(null),D=j_(n),[H,z]=p.useState(!1),M=p.useRef(!1);p.useEffect(()=>{if(S)return gf(S)},[S]),Jm();const U=p.useCallback(Q=>{const[pe,...he]=D().map(ke=>ke.ref.current),[re]=he.slice(-1),Ee=document.activeElement;for(const ke of Q)if(ke===Ee||(ke==null||ke.scrollIntoView({block:"nearest"}),ke===pe&&k&&(k.scrollTop=0),ke===re&&k&&(k.scrollTop=k.scrollHeight),ke==null||ke.focus(),document.activeElement!==Ee))return},[D,k]),X=p.useCallback(()=>U([_,S]),[U,_,S]);p.useEffect(()=>{H&&X()},[H,X]);const{onOpenChange:j,triggerPointerDownPosRef:O}=h;p.useEffect(()=>{if(S){let Q={x:0,y:0};const pe=re=>{var Ee,ke,We,Ht;Q={x:Math.abs(Math.round(re.pageX)-((Ee=(ke=O.current)===null||ke===void 0?void 0:ke.x)!==null&&Ee!==void 0?Ee:0)),y:Math.abs(Math.round(re.pageY)-((We=(Ht=O.current)===null||Ht===void 0?void 0:Ht.y)!==null&&We!==void 0?We:0))}},he=re=>{Q.x<=10&&Q.y<=10?re.preventDefault():S.contains(re.target)||j(!1),document.removeEventListener("pointermove",pe),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",he,{capture:!0})}}},[S,j,O]),p.useEffect(()=>{const Q=()=>j(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[j]);const[A,V]=V7(Q=>{const pe=D().filter(Ee=>!Ee.disabled),he=pe.find(Ee=>Ee.ref.current===document.activeElement),re=q7(pe,Q,he);re&&setTimeout(()=>re.ref.current.focus())}),P=p.useCallback((Q,pe,he)=>{const re=!M.current&&!he;(h.value!==void 0&&h.value===pe||re)&&(T(Q),re&&(M.current=!0))},[h.value]),N=p.useCallback(()=>S==null?void 0:S.focus(),[S]),K=p.useCallback((Q,pe,he)=>{const re=!M.current&&!he;(h.value!==void 0&&h.value===pe||re)&&L(Q)},[h.value]),ae=r==="popper"?$2:Ote,ne=ae===$2?{side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:y,hideWhenDetached:b,avoidCollisions:w}:{};return p.createElement(z7,{scope:n,content:S,viewport:k,onViewportChange:x,itemRefCallback:P,selectedItem:_,onItemLeave:N,itemTextRefCallback:K,focusSelectedItem:X,selectedItemText:R,position:r,isPositioned:H,searchRef:A},p.createElement(ih,{as:$a,allowPinchZoom:!0},p.createElement(eh,{asChild:!0,trapped:h.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:fe(a,Q=>{var pe;(pe=h.trigger)===null||pe===void 0||pe.focus({preventScroll:!0}),Q.preventDefault()})},p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>h.onOpenChange(!1)},p.createElement(ae,W({role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:Q=>Q.preventDefault()},v,ne,{onPlaced:()=>z(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:fe(v.onKeyDown,Q=>{const pe=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!pe&&Q.key.length===1&&V(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let re=D().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const Ee=Q.target,ke=re.indexOf(Ee);re=re.slice(ke+1)}setTimeout(()=>U(re)),Q.preventDefault()}})}))))))}),Ote=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,o=zs(vc,n),i=uh(vc,n),[s,l]=p.useState(null),[c,u]=p.useState(null),d=rt(t,C=>u(C)),g=j_(n),m=p.useRef(!1),y=p.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:v,focusSelectedItem:h}=i,S=p.useCallback(()=>{if(o.trigger&&o.valueNode&&s&&c&&b&&w&&v){const C=o.trigger.getBoundingClientRect(),_=c.getBoundingClientRect(),T=o.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(o.dir!=="rtl"){const Ee=R.left-_.left,ke=T.left-Ee,We=C.left-ke,Ht=C.width+We,mt=Math.max(Ht,_.width),Hn=window.innerWidth-ro,F=P2(ke,[ro,Hn-mt]);s.style.minWidth=Ht+"px",s.style.left=F+"px"}else{const Ee=_.right-R.right,ke=window.innerWidth-T.right-Ee,We=window.innerWidth-C.right-ke,Ht=C.width+We,mt=Math.max(Ht,_.width),Hn=window.innerWidth-ro,F=P2(ke,[ro,Hn-mt]);s.style.minWidth=Ht+"px",s.style.right=F+"px"}const L=g(),D=window.innerHeight-ro*2,H=b.scrollHeight,z=window.getComputedStyle(c),M=parseInt(z.borderTopWidth,10),U=parseInt(z.paddingTop,10),X=parseInt(z.borderBottomWidth,10),j=parseInt(z.paddingBottom,10),O=M+U+H+j+X,A=Math.min(w.offsetHeight*5,O),V=window.getComputedStyle(b),P=parseInt(V.paddingTop,10),N=parseInt(V.paddingBottom,10),K=C.top+C.height/2-ro,ae=D-K,ne=w.offsetHeight/2,Q=w.offsetTop+ne,pe=M+U+Q,he=O-pe;if(pe<=K){const Ee=w===L[L.length-1].ref.current;s.style.bottom="0px";const ke=c.clientHeight-b.offsetTop-b.offsetHeight,We=Math.max(ae,ne+(Ee?N:0)+ke+X),Ht=pe+We;s.style.height=Ht+"px"}else{const Ee=w===L[0].ref.current;s.style.top="0px";const We=Math.max(K,M+b.offsetTop+(Ee?P:0)+ne)+he;s.style.height=We+"px",b.scrollTop=pe-K+b.offsetTop}s.style.margin=`${ro}px 0`,s.style.minHeight=A+"px",s.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[g,o.trigger,o.valueNode,s,c,b,w,v,o.dir,r]);Zr(()=>S(),[S]);const[E,k]=p.useState();Zr(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const x=p.useCallback(C=>{C&&y.current===!0&&(S(),h==null||h(),y.current=!1)},[S,h]);return p.createElement(Dte,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:x},p.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E}},p.createElement(ze.div,W({},a,{ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}}))))}),$2=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ro,...o}=e,i=z_(n);return p.createElement(pf,W({},i,o,{ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[Dte,Lte]=Fc(vc,{}),F2="SelectViewport",Mte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=uh(F2,n),o=Lte(F2,n),i=rt(t,a.onViewportChange),s=p.useRef(0);return p.createElement(p.Fragment,null,p.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),p.createElement(ch.Slot,{scope:n},p.createElement(ze.div,W({"data-radix-select-viewport":"",role:"presentation"},r,{ref:i,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:fe(r.onScroll,l=>{const c=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:d}=o;if(d!=null&&d.current&&u){const g=Math.abs(s.current-c.scrollTop);if(g>0){const m=window.innerHeight-ro*2,y=parseFloat(u.style.minHeight),b=parseFloat(u.style.height),w=Math.max(y,b);if(w0?S:0,u.style.justifyContent="flex-end")}}}s.current=c.scrollTop})}))))}),Pte="SelectGroup",[STe,$te]=Fc(Pte),Fte="SelectLabel",jte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=$te(Fte,n);return p.createElement(ze.div,W({id:a.id},r,{ref:t}))}),ok="SelectItem",[zte,U7]=Fc(ok),Ute=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...i}=e,s=zs(ok,n),l=uh(ok,n),c=s.value===r,[u,d]=p.useState(o??""),[g,m]=p.useState(!1),y=rt(t,v=>{var h;return(h=l.itemRefCallback)===null||h===void 0?void 0:h.call(l,v,r,a)}),b=bi(),w=()=>{a||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.createElement(zte,{scope:n,value:r,disabled:a,textId:b,isSelected:c,onItemTextChange:p.useCallback(v=>{d(h=>{var S;return h||((S=v==null?void 0:v.textContent)!==null&&S!==void 0?S:"").trim()})},[])},p.createElement(ch.ItemSlot,{scope:n,value:r,disabled:a,textValue:u},p.createElement(ze.div,W({role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1},i,{ref:y,onFocus:fe(i.onFocus,()=>m(!0)),onBlur:fe(i.onBlur,()=>m(!1)),onPointerUp:fe(i.onPointerUp,w),onPointerMove:fe(i.onPointerMove,v=>{if(a){var h;(h=l.onItemLeave)===null||h===void 0||h.call(l)}else v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(i.onPointerLeave,v=>{if(v.currentTarget===document.activeElement){var h;(h=l.onItemLeave)===null||h===void 0||h.call(l)}}),onKeyDown:fe(i.onKeyDown,v=>{var h;((h=l.searchRef)===null||h===void 0?void 0:h.current)!==""&&v.key===" "||(yte.includes(v.key)&&w(),v.key===" "&&v.preventDefault())})}))))}),op="SelectItemText",Bte=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...o}=e,i=zs(op,n),s=uh(op,n),l=U7(op,n),c=Ete(op,n),[u,d]=p.useState(null),g=rt(t,v=>d(v),l.onItemTextChange,v=>{var h;return(h=s.itemTextRefCallback)===null||h===void 0?void 0:h.call(s,v,l.value,l.disabled)}),m=u==null?void 0:u.textContent,y=p.useMemo(()=>p.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},m),[l.disabled,l.value,m]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=c;return Zr(()=>(b(y),()=>w(y)),[b,w,y]),p.createElement(p.Fragment,null,p.createElement(ze.span,W({id:l.textId},o,{ref:g})),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ba.createPortal(o.children,i.valueNode):null)}),Hte="SelectItemIndicator",Vte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return U7(Hte,n).isSelected?p.createElement(ze.span,W({"aria-hidden":!0},r,{ref:t})):null}),qte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.createElement(ze.div,W({"aria-hidden":!0},r,{ref:t}))});function B7(e){return e===""||e===void 0}const H7=p.forwardRef((e,t)=>{const{value:n,...r}=e,a=p.useRef(null),o=rt(t,a),i=F_(n);return p.useEffect(()=>{const s=a.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&u){const d=new Event("change",{bubbles:!0});u.call(s,n),s.dispatchEvent(d)}},[i,n]),p.createElement(Nm,{asChild:!0},p.createElement("select",W({},r,{ref:o,defaultValue:n})))});H7.displayName="BubbleSelect";function V7(e){const t=ur(e),n=p.useRef(""),r=p.useRef(0),a=p.useCallback(i=>{const s=n.current+i;t(s),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(s)},[t]),o=p.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function q7(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Gte(e,Math.max(o,0));a.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function Gte(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Wte=xte,G7=Cte,Kte=Ate,Yte=Tte,Zte=Rte,W7=Nte,Xte=Mte,K7=jte,Y7=Ute,Qte=Bte,Jte=Vte,Z7=qte,So=Wte,wo=Kte,za=p.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(G7,{ref:r,className:ee("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(Yte,{asChild:!0,children:f.jsx(YC,{className:"h-4 w-4 opacity-50"})})]}));za.displayName=G7.displayName;const Ua=p.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>f.jsx(Zte,{children:f.jsx(W7,{ref:a,className:ee("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:f.jsx(Xte,{className:ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));Ua.displayName=W7.displayName;const ene=p.forwardRef(({className:e,...t},n)=>f.jsx(K7,{ref:n,className:ee("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ene.displayName=K7.displayName;const Fn=p.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(Y7,{ref:r,className:ee("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(Jte,{children:f.jsx(Mm,{className:"h-4 w-4"})})}),f.jsx(Qte,{children:t})]}));Fn.displayName=Y7.displayName;const tne=p.forwardRef(({className:e,...t},n)=>f.jsx(Z7,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",e),...t}));tne.displayName=Z7.displayName;function Ts(e){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(e)}function _i(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Un(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Wa(e){Un(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Ts(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function nne(e,t){Un(2,arguments);var n=Wa(e).getTime(),r=_i(t);return new Date(n+r)}var rne={};function dh(){return rne}function ane(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}var X7=6e4,Q7=36e5;function one(e){return Un(1,arguments),e instanceof Date||Ts(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function ine(e){if(Un(1,arguments),!one(e)&&typeof e!="number")return!1;var t=Wa(e);return!isNaN(Number(t))}function sne(e,t){Un(2,arguments);var n=_i(t);return nne(e,-n)}var lne=864e5;function cne(e){Un(1,arguments);var t=Wa(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),a=n-r;return Math.floor(a/lne)+1}function Pg(e){Un(1,arguments);var t=1,n=Wa(e),r=n.getUTCDay(),a=(r=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function une(e){Un(1,arguments);var t=J7(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Pg(n);return r}var dne=6048e5;function fne(e){Un(1,arguments);var t=Wa(e),n=Pg(t).getTime()-une(t).getTime();return Math.round(n/dne)+1}function $g(e,t){var n,r,a,o,i,s,l,c;Un(1,arguments);var u=dh(),d=_i((n=(r=(a=(o=t==null?void 0:t.weekStartsOn)!==null&&o!==void 0?o:t==null||(i=t.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&a!==void 0?a:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var g=Wa(e),m=g.getUTCDay(),y=(m=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(d+1,0,m),y.setUTCHours(0,0,0,0);var b=$g(y,t),w=new Date(0);w.setUTCFullYear(d,0,m),w.setUTCHours(0,0,0,0);var v=$g(w,t);return u.getTime()>=b.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function pne(e,t){var n,r,a,o,i,s,l,c;Un(1,arguments);var u=dh(),d=_i((n=(r=(a=(o=t==null?void 0:t.firstWeekContainsDate)!==null&&o!==void 0?o:t==null||(i=t.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&a!==void 0?a:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),g=e8(e,t),m=new Date(0);m.setUTCFullYear(g,0,d),m.setUTCHours(0,0,0,0);var y=$g(m,t);return y}var gne=6048e5;function mne(e,t){Un(1,arguments);var n=Wa(e),r=$g(n,t).getTime()-pne(n,t).getTime();return Math.round(r/gne)+1}function bt(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length0?r:1-r;return bt(n==="yy"?a%100:a,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):bt(r+1,2)},d:function(t,n){return bt(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return bt(t.getUTCHours()%12||12,n.length)},H:function(t,n){return bt(t.getUTCHours(),n.length)},m:function(t,n){return bt(t.getUTCMinutes(),n.length)},s:function(t,n){return bt(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,a=t.getUTCMilliseconds(),o=Math.floor(a*Math.pow(10,r-3));return bt(o,n.length)}};const Po=hne;var el={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},bne={G:function(t,n,r){var a=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(a,{width:"abbreviated"});case"GGGGG":return r.era(a,{width:"narrow"});case"GGGG":default:return r.era(a,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var a=t.getUTCFullYear(),o=a>0?a:1-a;return r.ordinalNumber(o,{unit:"year"})}return Po.y(t,n)},Y:function(t,n,r,a){var o=e8(t,a),i=o>0?o:1-o;if(n==="YY"){var s=i%100;return bt(s,2)}return n==="Yo"?r.ordinalNumber(i,{unit:"year"}):bt(i,n.length)},R:function(t,n){var r=J7(t);return bt(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return bt(r,n.length)},Q:function(t,n,r){var a=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return bt(a,2);case"Qo":return r.ordinalNumber(a,{unit:"quarter"});case"QQQ":return r.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(a,{width:"wide",context:"formatting"})}},q:function(t,n,r){var a=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return bt(a,2);case"qo":return r.ordinalNumber(a,{unit:"quarter"});case"qqq":return r.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(a,{width:"wide",context:"standalone"})}},M:function(t,n,r){var a=t.getUTCMonth();switch(n){case"M":case"MM":return Po.M(t,n);case"Mo":return r.ordinalNumber(a+1,{unit:"month"});case"MMM":return r.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(a,{width:"wide",context:"formatting"})}},L:function(t,n,r){var a=t.getUTCMonth();switch(n){case"L":return String(a+1);case"LL":return bt(a+1,2);case"Lo":return r.ordinalNumber(a+1,{unit:"month"});case"LLL":return r.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(a,{width:"wide",context:"standalone"})}},w:function(t,n,r,a){var o=mne(t,a);return n==="wo"?r.ordinalNumber(o,{unit:"week"}):bt(o,n.length)},I:function(t,n,r){var a=fne(t);return n==="Io"?r.ordinalNumber(a,{unit:"week"}):bt(a,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):Po.d(t,n)},D:function(t,n,r){var a=cne(t);return n==="Do"?r.ordinalNumber(a,{unit:"dayOfYear"}):bt(a,n.length)},E:function(t,n,r){var a=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(a,{width:"short",context:"formatting"});case"EEEE":default:return r.day(a,{width:"wide",context:"formatting"})}},e:function(t,n,r,a){var o=t.getUTCDay(),i=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(i);case"ee":return bt(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(t,n,r,a){var o=t.getUTCDay(),i=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(i);case"cc":return bt(i,n.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(t,n,r){var a=t.getUTCDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return bt(o,n.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(a,{width:"short",context:"formatting"});case"iiii":default:return r.day(a,{width:"wide",context:"formatting"})}},a:function(t,n,r){var a=t.getUTCHours(),o=a/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,n,r){var a=t.getUTCHours(),o;switch(a===12?o=el.noon:a===0?o=el.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,n,r){var a=t.getUTCHours(),o;switch(a>=17?o=el.evening:a>=12?o=el.afternoon:a>=4?o=el.morning:o=el.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var a=t.getUTCHours()%12;return a===0&&(a=12),r.ordinalNumber(a,{unit:"hour"})}return Po.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):Po.H(t,n)},K:function(t,n,r){var a=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(a,{unit:"hour"}):bt(a,n.length)},k:function(t,n,r){var a=t.getUTCHours();return a===0&&(a=24),n==="ko"?r.ordinalNumber(a,{unit:"hour"}):bt(a,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):Po.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):Po.s(t,n)},S:function(t,n){return Po.S(t,n)},X:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();if(i===0)return"Z";switch(n){case"X":return z2(i);case"XXXX":case"XX":return Ki(i);case"XXXXX":case"XXX":default:return Ki(i,":")}},x:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();switch(n){case"x":return z2(i);case"xxxx":case"xx":return Ki(i);case"xxxxx":case"xxx":default:return Ki(i,":")}},O:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+j2(i,":");case"OOOO":default:return"GMT"+Ki(i,":")}},z:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+j2(i,":");case"zzzz":default:return"GMT"+Ki(i,":")}},t:function(t,n,r,a){var o=a._originalDate||t,i=Math.floor(o.getTime()/1e3);return bt(i,n.length)},T:function(t,n,r,a){var o=a._originalDate||t,i=o.getTime();return bt(i,n.length)}};function j2(e,t){var n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),o=r%60;if(o===0)return n+String(a);var i=t||"";return n+String(a)+i+bt(o,2)}function z2(e,t){if(e%60===0){var n=e>0?"-":"+";return n+bt(Math.abs(e)/60,2)}return Ki(e,t)}function Ki(e,t){var n=t||"",r=e>0?"-":"+",a=Math.abs(e),o=bt(Math.floor(a/60),2),i=bt(a%60,2);return r+o+n+i}const yne=bne;var U2=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},t8=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},vne=function(t,n){var r=t.match(/(P+)(p+)?/)||[],a=r[1],o=r[2];if(!o)return U2(t,n);var i;switch(a){case"P":i=n.dateTime({width:"short"});break;case"PP":i=n.dateTime({width:"medium"});break;case"PPP":i=n.dateTime({width:"long"});break;case"PPPP":default:i=n.dateTime({width:"full"});break}return i.replace("{{date}}",U2(a,n)).replace("{{time}}",t8(o,n))},Sne={p:t8,P:vne};const wne=Sne;var Ene=["D","DD"],xne=["YY","YYYY"];function kne(e){return Ene.indexOf(e)!==-1}function Cne(e){return xne.indexOf(e)!==-1}function B2(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var _ne={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ane=function(t,n,r){var a,o=_ne[t];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+a:a+" ago":a};const Tne=Ane;function Vb(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var Rne={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Nne={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ine={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},One={date:Vb({formats:Rne,defaultWidth:"full"}),time:Vb({formats:Nne,defaultWidth:"full"}),dateTime:Vb({formats:Ine,defaultWidth:"full"})};const Dne=One;var Lne={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Mne=function(t,n,r,a){return Lne[t]};const Pne=Mne;function cu(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",a;if(r==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=n!=null&&n.width?String(n.width):o;a=e.formattingValues[i]||e.formattingValues[o]}else{var s=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[s]}var c=e.argumentCallback?e.argumentCallback(t):t;return a[c]}}var $ne={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Fne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},jne={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},zne={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Une={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bne={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Hne=function(t,n){var r=Number(t),a=r%100;if(a>20||a<10)switch(a%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Vne={ordinalNumber:Hne,era:cu({values:$ne,defaultWidth:"wide"}),quarter:cu({values:Fne,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:cu({values:jne,defaultWidth:"wide"}),day:cu({values:zne,defaultWidth:"wide"}),dayPeriod:cu({values:Une,defaultWidth:"wide",formattingValues:Bne,defaultFormattingWidth:"wide"})};const qne=Vne;function uu(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var i=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?Wne(s,function(d){return d.test(i)}):Gne(s,function(d){return d.test(i)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(i.length);return{value:c,rest:u}}}function Gne(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Wne(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var a=r[0],o=t.match(e.parsePattern);if(!o)return null;var i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;var s=t.slice(a.length);return{value:i,rest:s}}}var Yne=/^(\d+)(th|st|nd|rd)?/i,Zne=/\d+/i,Xne={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Qne={any:[/^b/i,/^(a|c)/i]},Jne={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ere={any:[/1/i,/2/i,/3/i,/4/i]},tre={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},nre={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},rre={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},are={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ore={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ire={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},sre={ordinalNumber:Kne({matchPattern:Yne,parsePattern:Zne,valueCallback:function(t){return parseInt(t,10)}}),era:uu({matchPatterns:Xne,defaultMatchWidth:"wide",parsePatterns:Qne,defaultParseWidth:"any"}),quarter:uu({matchPatterns:Jne,defaultMatchWidth:"wide",parsePatterns:ere,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:uu({matchPatterns:tre,defaultMatchWidth:"wide",parsePatterns:nre,defaultParseWidth:"any"}),day:uu({matchPatterns:rre,defaultMatchWidth:"wide",parsePatterns:are,defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:ore,defaultMatchWidth:"any",parsePatterns:ire,defaultParseWidth:"any"})};const lre=sre;var cre={code:"en-US",formatDistance:Tne,formatLong:Dne,formatRelative:Pne,localize:qne,match:lre,options:{weekStartsOn:0,firstWeekContainsDate:1}};const ure=cre;var dre=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fre=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,pre=/^'([^]*?)'?$/,gre=/''/g,mre=/[a-zA-Z]/;function Us(e,t,n){var r,a,o,i,s,l,c,u,d,g,m,y,b,w,v,h,S,E;Un(2,arguments);var k=String(t),x=dh(),C=(r=(a=n==null?void 0:n.locale)!==null&&a!==void 0?a:x.locale)!==null&&r!==void 0?r:ure,_=_i((o=(i=(s=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&s!==void 0?s:x.firstWeekContainsDate)!==null&&i!==void 0?i:(d=x.locale)===null||d===void 0||(g=d.options)===null||g===void 0?void 0:g.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=_i((m=(y=(b=(w=n==null?void 0:n.weekStartsOn)!==null&&w!==void 0?w:n==null||(v=n.locale)===null||v===void 0||(h=v.options)===null||h===void 0?void 0:h.weekStartsOn)!==null&&b!==void 0?b:x.weekStartsOn)!==null&&y!==void 0?y:(S=x.locale)===null||S===void 0||(E=S.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&m!==void 0?m:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!C.localize)throw new RangeError("locale must contain localize property");if(!C.formatLong)throw new RangeError("locale must contain formatLong property");var R=Wa(e);if(!ine(R))throw new RangeError("Invalid time value");var L=ane(R),D=sne(R,L),H={firstWeekContainsDate:_,weekStartsOn:T,locale:C,_originalDate:R},z=k.match(fre).map(function(M){var U=M[0];if(U==="p"||U==="P"){var X=wne[U];return X(M,C.formatLong)}return M}).join("").match(dre).map(function(M){if(M==="''")return"'";var U=M[0];if(U==="'")return hre(M);var X=yne[U];if(X)return!(n!=null&&n.useAdditionalWeekYearTokens)&&Cne(M)&&B2(M,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&kne(M)&&B2(M,t,String(e)),X(D,M,C.localize,H);if(U.match(mre))throw new RangeError("Format string contains an unescaped latin alphabet character `"+U+"`");return M}).join("");return z}function hre(e){var t=e.match(pre);return t?t[1].replace(gre,"'"):e}function ik(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],ip.timeZoneDelimiter.test(t.date)&&(t.date=e.split(ip.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){var a=ip.timezone.exec(r);a?(t.time=r.replace(a[1],""),t.timezone=a[1]):t.time=r}return t}function Cre(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,o=r[2]?parseInt(r[2]):null;return{year:o===null?a:o*100,restDateString:e.slice((r[1]||r[2]).length)}}function _re(e,t){if(t===null)return new Date(NaN);var n=e.match(wre);if(!n)return new Date(NaN);var r=!!n[4],a=du(n[1]),o=du(n[2])-1,i=du(n[3]),s=du(n[4]),l=du(n[5])-1;if(r)return Dre(t,s,l)?Rre(t,s,l):new Date(NaN);var c=new Date(0);return!Ire(t,o,i)||!Ore(t,a)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(a,i)),c)}function du(e){return e?parseInt(e):1}function Are(e){var t=e.match(Ere);if(!t)return NaN;var n=qb(t[1]),r=qb(t[2]),a=qb(t[3]);return Lre(n,r,a)?n*Q7+r*X7+a*1e3:NaN}function qb(e){return e&&parseFloat(e.replace(",","."))||0}function Tre(e){if(e==="Z")return 0;var t=e.match(xre);if(!t)return 0;var n=t[1]==="+"?-1:1,r=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return Mre(r,a)?n*(r*Q7+a*X7):NaN}function Rre(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var a=r.getUTCDay()||7,o=(t-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+o),r}var Nre=[31,null,31,30,31,30,31,31,30,31,30,31];function r8(e){return e%400===0||e%4===0&&e%100!==0}function Ire(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Nre[t]||(r8(e)?29:28))}function Ore(e,t){return t>=1&&t<=(r8(e)?366:365)}function Dre(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Lre(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Mre(e,t){return t>=0&&t<=59}const Pre=(e,t,n="Never")=>{const r=e.getValue(t);return r?Us(new Date(r),"MMM dd, yyyy"):n},Dn=({isLoading:e,children:t})=>e?f.jsx(Pi,{className:"h-6 w-full"}):t,_n=p.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:ee("flex h-10 w-full rounded-md border border-input bg-background-lighter px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));_n.displayName="Input";const $re=({value:e,onValueChange:t})=>f.jsx("form",{children:f.jsxs("div",{className:"relative",children:[f.jsx(Ms,{className:"pointer-events-none absolute left-[12px] top-3 h-4 w-4 text-muted-foreground"}),f.jsx(_n,{placeholder:"Search",value:e,onChange:n=>t(n.target.value),className:"w-52 pl-8 lg:w-80"})]})}),zi=({isLoading:e,children:t})=>e?f.jsx(Pi,{className:"h-6 w-full"}):t,H2=(e,t)=>{const n=e.getValue(t);return n?Us(new Date(n),"MMM dd, yyyy"):"Never"},Fre=(e,t)=>[{accessorKey:"name",header:"Agent Name",cell:({row:n})=>f.jsx(zi,{isLoading:t,children:n.getValue("name")})},{accessorFn:n=>{var r,a;return((a=(r=n.memory)==null?void 0:r.memory)==null?void 0:a.recall_memory)??0},accessorKey:"messages",header:()=>f.jsx(Yf,{children:f.jsx(xX,{className:"h-5 w-5"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:" text-center tabular-nums",children:n.getValue("messages")??0})})},{accessorFn:n=>{var r,a;return((a=(r=n.memory)==null?void 0:r.memory)==null?void 0:a.archival_memory)??0},accessorKey:"memories",header:()=>f.jsx(Yf,{children:f.jsx(EX,{className:"h-5 w-5"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:"text-center tabular-nums",children:n.getValue("memories")??0})})},{accessorFn:n=>0,accessorKey:"sources",header:()=>f.jsx(Yf,{children:f.jsx(kX,{className:"h-5 w-4"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:"text-center tabular-nums",children:n.getValue("sources")??0})})},{accessorFn:n=>n.tools.length,accessorKey:"tools",header:()=>f.jsx(Yf,{className:"justify-center",children:f.jsx(CX,{className:"h-5 w-5"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:"text-center tabular-nums",children:n.getValue("tools")??0})})},{accessorKey:"last_run",header:"Last Run",cell:({row:n})=>f.jsx(zi,{isLoading:t,children:H2(n,"last_run")})},{accessorKey:"created_at",header:"Lifespan",cell:({row:n})=>f.jsx(zi,{isLoading:t,children:H2(n,"created_at")})},{accessorKey:"chat",header:"",cell:({row:n})=>t?f.jsx(Pi,{className:"h-6 w-6"}):f.jsxs("div",{className:"flex",children:[f.jsx(ue,{onClick:()=>e(n.original),className:"rounded-lg px-3 py-1",variant:"outline",children:"Chat"}),f.jsx(ue,{variant:"ghost",onClick:()=>n.toggleExpanded(),children:n.getIsExpanded()?f.jsx(SX,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(vX,{className:"h-4 w-4 text-muted-foreground"})})]})}],U_=nf(Hm((e,t)=>({currentAgent:null,lastAgentInitMessage:null,actions:{setAgent:n=>e({currentAgent:n}),setLastAgentInitMessage:n=>e(r=>({...r,lastAgentInitMessage:n})),removeAgent:()=>e(n=>({...n,currentAgent:null}))}}),{name:"agent-storage",partialize:({actions:e,...t})=>t})),To=()=>U_(e=>e.currentAgent),jre=()=>U_(e=>e.lastAgentInitMessage),fh=()=>U_(e=>e.actions);function zre({setShowingAgentCreation:e}){return f.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3",children:[f.jsx("h2",{className:"font-semibold",children:"Create your first agent"}),f.jsxs(ue,{size:"sm",onClick:()=>e(!0),children:[f.jsx(ya,{className:"mr-2 h-4 w-4"}),"Create Agent"]})]})}const Ure=e=>{const{agent:t}=e,n=p.useMemo(()=>{var o;return Object.values(((o=t.memory)==null?void 0:o.memory)||{})},[t]),r=p.useMemo(()=>{var o;return((o=n.find(i=>i.label==="persona"))==null?void 0:o.name)??"Not set"},[t]),a=p.useMemo(()=>{var o;return((o=n.find(i=>i.label==="human"))==null?void 0:o.name)??"Not set"},[t]);return f.jsxs("div",{className:"flex flex-col",children:[f.jsxs("div",{className:"flex gap-4 border-b-[1px] py-3",children:[f.jsxs("div",{className:"flex gap-3 text-muted-foreground",children:[f.jsx(yX,{className:"h-4 w-5"}),f.jsx("h6",{children:"Agent Persona"})]}),f.jsx("p",{children:r})]}),f.jsxs("div",{className:"flex gap-4 py-3",children:[f.jsxs("div",{className:"flex gap-3 text-muted-foreground",children:[f.jsx(wX,{className:"h-4 w-5"}),f.jsx("h6",{children:"Human Persona"})]}),f.jsx("p",{children:a})]})]})},Bre=({className:e,setShowingAgentCreation:t})=>{const[n,r]=p.useState(""),{setAgent:a}=fh(),{data:o,isSuccess:i,isError:s,isLoading:l}=Xm(void 0,{retry:!1}),c=p.useMemo(()=>i?o==null?void 0:o.filter(g=>g.name.toLowerCase().includes(n.toLowerCase())):[],[o,i,n]),u=Mi(),d=g=>{a(g),u(`${g.name}/chat`,{relative:"path"})};return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex items-center justify-between bg-background/95 px-4 pb-3 pt-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:f.jsx($re,{value:n,onValueChange:r})}),f.jsx("div",{className:e,children:!l&&c.length===0?f.jsx(zre,{setShowingAgentCreation:t}):f.jsx(cf,{columns:Fre(d,!1),isLoading:l,data:c,error:s?"There was an error loading the agents. Please try again later":void 0,renderPagination:g=>f.jsx(uf,{className:"mt-4",table:g}),expandedRowsContent:g=>f.jsx(Ure,{agent:c[g]})})})]})},a8="Dialog",[o8,i8]=zn(a8),[Hre,va]=o8(a8),Vre=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,s=p.useRef(null),l=p.useRef(null),[c=!1,u]=Fa({prop:r,defaultProp:a,onChange:o});return p.createElement(Hre,{scope:t,triggerRef:s,contentRef:l,contentId:bi(),titleId:bi(),descriptionId:bi(),open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(d=>!d),[u]),modal:i},n)},qre="DialogTrigger",Gre=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(qre,n),o=rt(t,a.triggerRef);return p.createElement(ze.button,W({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":B_(a.open)},r,{ref:o,onClick:fe(e.onClick,a.onOpenToggle)}))}),s8="DialogPortal",[Wre,l8]=o8(s8,{forceMount:void 0}),Kre=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=va(s8,t);return p.createElement(Wre,{scope:t,forceMount:n},p.Children.map(r,i=>p.createElement(pr,{present:n||o.open},p.createElement(Qd,{asChild:!0,container:a},i))))},sk="DialogOverlay",Yre=p.forwardRef((e,t)=>{const n=l8(sk,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=va(sk,e.__scopeDialog);return o.modal?p.createElement(pr,{present:r||o.open},p.createElement(Zre,W({},a,{ref:t}))):null}),Zre=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(sk,n);return p.createElement(ih,{as:$a,allowPinchZoom:!0,shards:[a.contentRef]},p.createElement(ze.div,W({"data-state":B_(a.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Sc="DialogContent",Xre=p.forwardRef((e,t)=>{const n=l8(Sc,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=va(Sc,e.__scopeDialog);return p.createElement(pr,{present:r||o.open},o.modal?p.createElement(Qre,W({},a,{ref:t})):p.createElement(Jre,W({},a,{ref:t})))}),Qre=p.forwardRef((e,t)=>{const n=va(Sc,e.__scopeDialog),r=p.useRef(null),a=rt(t,n.contentRef,r);return p.useEffect(()=>{const o=r.current;if(o)return gf(o)},[]),p.createElement(c8,W({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=n.triggerRef.current)===null||i===void 0||i.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&o.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,o=>o.preventDefault())}))}),Jre=p.forwardRef((e,t)=>{const n=va(Sc,e.__scopeDialog),r=p.useRef(!1),a=p.useRef(!1);return p.createElement(c8,W({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i;if((i=e.onCloseAutoFocus)===null||i===void 0||i.call(e,o),!o.defaultPrevented){var s;r.current||(s=n.triggerRef.current)===null||s===void 0||s.focus(),o.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:o=>{var i,s;(i=e.onInteractOutside)===null||i===void 0||i.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((s=n.triggerRef.current)===null||s===void 0?void 0:s.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}}))}),c8=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,s=va(Sc,n),l=p.useRef(null),c=rt(t,l);return Jm(),p.createElement(p.Fragment,null,p.createElement(eh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o},p.createElement(Ls,W({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":B_(s.open)},i,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),u8="DialogTitle",eae=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(u8,n);return p.createElement(ze.h2,W({id:a.titleId},r,{ref:t}))}),tae="DialogDescription",nae=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(tae,n);return p.createElement(ze.p,W({id:a.descriptionId},r,{ref:t}))}),rae="DialogClose",aae=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(rae,n);return p.createElement(ze.button,W({type:"button"},r,{ref:t,onClick:fe(e.onClick,()=>a.onOpenChange(!1))}))});function B_(e){return e?"open":"closed"}const oae="DialogTitleWarning",[iae,wTe]=RV(oae,{contentName:Sc,titleName:u8,docsSlug:"dialog"}),d8=Vre,sae=Gre,f8=Kre,H_=Yre,V_=Xre,q_=eae,G_=nae,W_=aae,Wt=d8,lae=f8,p8=p.forwardRef(({className:e,...t},n)=>f.jsx(H_,{ref:n,className:ee("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));p8.displayName=H_.displayName;const Bt=p.forwardRef(({className:e,children:t,hasCloseButton:n=!0,...r},a)=>f.jsxs(lae,{children:[f.jsx(p8,{}),f.jsxs(V_,{ref:a,className:ee("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...r,children:[t,n?f.jsxs(W_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(Di,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]}):null]})]}));Bt.displayName=V_.displayName;const Pt=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Pt.displayName="DialogHeader";const g8=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});g8.displayName="DialogFooter";const $t=p.forwardRef(({className:e,...t},n)=>f.jsx(q_,{ref:n,className:ee("text-lg font-semibold leading-none tracking-tight",e),...t}));$t.displayName=q_.displayName;const dn=p.forwardRef(({className:e,...t},n)=>f.jsx(G_,{ref:n,className:ee("text-sm text-muted-foreground",e),...t}));dn.displayName=G_.displayName;const cae=({open:e,onOpenChange:t,closeDialog:n})=>{const r=()=>{t(!1),n()};return f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Cancel Creating Agent"}),f.jsx(dn,{children:"Are you sure you want to cancel creating an Agent? All the information you worked on will be lost."})]}),f.jsxs("div",{className:"flex justify-end gap-4",children:[f.jsx(ue,{variant:"ghost",onClick:()=>t(!1),children:"No"}),f.jsx(ue,{onClick:r,children:"Yes"})]})]})})};var hf=e=>e.type==="checkbox",Rl=e=>e instanceof Date,Yn=e=>e==null;const m8=e=>typeof e=="object";var cn=e=>!Yn(e)&&!Array.isArray(e)&&m8(e)&&!Rl(e),h8=e=>cn(e)&&e.target?hf(e.target)?e.target.checked:e.target.value:e,uae=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,b8=(e,t)=>e.has(uae(t)),dae=e=>{const t=e.constructor&&e.constructor.prototype;return cn(t)&&t.hasOwnProperty("isPrototypeOf")},K_=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ln(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(K_&&(e instanceof Blob||e instanceof FileList))&&(n||cn(e)))if(t=n?[]:{},!n&&!dae(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Ln(e[r]));else return e;return t}var jc=e=>Array.isArray(e)?e.filter(Boolean):[],Ot=e=>e===void 0,ge=(e,t,n)=>{if(!t||!cn(e))return n;const r=jc(t.split(/[,[\].]+?/)).reduce((a,o)=>Yn(a)?a:a[o],e);return Ot(r)||r===e?Ot(e[t])?n:e[t]:r},si=e=>typeof e=="boolean";const Fg={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Hr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ja={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},y8=Ae.createContext(null),Bs=()=>Ae.useContext(y8),fae=e=>{const{children:t,...n}=e;return Ae.createElement(y8.Provider,{value:n},t)};var v8=(e,t,n,r=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Hr.all&&(t._proxyFormState[i]=!r||Hr.all),n&&(n[i]=!0),e[i]}});return a},wr=e=>cn(e)&&!Object.keys(e).length,S8=(e,t,n,r)=>{n(e);const{name:a,...o}=e;return wr(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!r||Hr.all))},kr=e=>Array.isArray(e)?e:[e],w8=(e,t,n)=>!e||!t||e===t||kr(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function ph(e){const t=Ae.useRef(e);t.current=e,Ae.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function pae(e){const t=Bs(),{control:n=t.control,disabled:r,name:a,exact:o}=e||{},[i,s]=Ae.useState(n._formState),l=Ae.useRef(!0),c=Ae.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=Ae.useRef(a);return u.current=a,ph({disabled:r,next:d=>l.current&&w8(u.current,d.name,o)&&S8(d,c.current,n._updateFormState)&&s({...n._formState,...d}),subject:n._subjects.state}),Ae.useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),v8(i,n,c.current,!1)}var Oa=e=>typeof e=="string",E8=(e,t,n,r,a)=>Oa(e)?(r&&t.watch.add(e),ge(n,e,a)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),ge(n,o))):(r&&(t.watchAll=!0),n);function gae(e){const t=Bs(),{control:n=t.control,name:r,defaultValue:a,disabled:o,exact:i}=e||{},s=Ae.useRef(r);s.current=r,ph({disabled:o,subject:n._subjects.values,next:u=>{w8(s.current,u.name,i)&&c(Ln(E8(s.current,n._names,u.values||n._formValues,!1,a)))}});const[l,c]=Ae.useState(n._getWatch(r,a));return Ae.useEffect(()=>n._removeUnmounted()),l}var Y_=e=>/^\w*$/.test(e),x8=e=>jc(e.replace(/["|']|\]/g,"").split(/\.|\[/));function ht(e,t,n){let r=-1;const a=Y_(t)?[t]:x8(t),o=a.length,i=o-1;for(;++r{const u=a._options.shouldUnregister||o,d=(g,m)=>{const y=ge(a._fields,g);y&&(y._f.mount=m)};if(d(n,!0),u){const g=Ln(ge(a._options.defaultValues,n));ht(a._defaultValues,n,g),Ot(ge(a._formValues,n))&&ht(a._formValues,n,g)}return()=>{(i?u&&!a._state.action:u)?a.unregister(n):d(n,!1)}},[n,a,i,o]),Ae.useEffect(()=>{ge(a._fields,n)&&a._updateDisabledField({disabled:r,fields:a._fields,name:n})},[r,n,a]),{field:{name:n,value:s,...si(r)?{disabled:r}:{},onChange:Ae.useCallback(u=>c.current.onChange({target:{value:h8(u),name:n},type:Fg.CHANGE}),[n]),onBlur:Ae.useCallback(()=>c.current.onBlur({target:{value:ge(a._formValues,n),name:n},type:Fg.BLUR}),[n,a]),ref:u=>{const d=ge(a._fields,n);d&&u&&(d._f.ref={focus:()=>u.focus(),select:()=>u.select(),setCustomValidity:g=>u.setCustomValidity(g),reportValidity:()=>u.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ge(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!ge(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ge(l.touchedFields,n)},error:{enumerable:!0,get:()=>ge(l.errors,n)}})}}const hae=e=>e.render(mae(e));var k8=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{};const jg=(e,t,n)=>{for(const r of n||Object.keys(e)){const a=ge(e,r);if(a){const{_f:o,...i}=a;if(o&&t(o.name)){if(o.ref.focus){o.ref.focus();break}else if(o.refs&&o.refs[0].focus){o.refs[0].focus();break}}else cn(i)&&jg(i,t)}}};var $o=()=>{const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},Gb=(e,t,n={})=>n.shouldFocus||Ot(n.shouldFocus)?n.focusName||`${e}.${Ot(n.focusIndex)?t:n.focusIndex}.`:"",lk=e=>({isOnSubmit:!e||e===Hr.onSubmit,isOnBlur:e===Hr.onBlur,isOnChange:e===Hr.onChange,isOnAll:e===Hr.all,isOnTouch:e===Hr.onTouched}),ck=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),C8=(e,t,n)=>{const r=jc(ge(e,n));return ht(r,"root",t[n]),ht(e,n,r),e},Z_=e=>e.type==="file",li=e=>typeof e=="function",zg=e=>{if(!K_)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},qp=e=>Oa(e),X_=e=>e.type==="radio",Ug=e=>e instanceof RegExp;const V2={value:!1,isValid:!1},q2={value:!0,isValid:!0};var _8=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ot(e[0].attributes.value)?Ot(e[0].value)||e[0].value===""?q2:{value:e[0].value,isValid:!0}:q2:V2}return V2};const G2={isValid:!1,value:null};var A8=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,G2):G2;function W2(e,t,n="validate"){if(qp(e)||Array.isArray(e)&&e.every(qp)||si(e)&&!e)return{type:n,message:qp(e)?e:"",ref:t}}var tl=e=>cn(e)&&!Ug(e)?e:{value:e,message:""},uk=async(e,t,n,r,a)=>{const{ref:o,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:g,validate:m,name:y,valueAsNumber:b,mount:w,disabled:v}=e._f,h=ge(t,y);if(!w||v)return{};const S=i?i[0]:o,E=D=>{r&&S.reportValidity&&(S.setCustomValidity(si(D)?"":D||""),S.reportValidity())},k={},x=X_(o),C=hf(o),_=x||C,T=(b||Z_(o))&&Ot(o.value)&&Ot(h)||zg(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,R=k8.bind(null,y,n,k),L=(D,H,z,M=Ja.maxLength,U=Ja.minLength)=>{const X=D?H:z;k[y]={type:D?M:U,message:X,ref:o,...R(D?M:U,X)}};if(a?!Array.isArray(h)||!h.length:s&&(!_&&(T||Yn(h))||si(h)&&!h||C&&!_8(i).isValid||x&&!A8(i).isValid)){const{value:D,message:H}=qp(s)?{value:!!s,message:s}:tl(s);if(D&&(k[y]={type:Ja.required,message:H,ref:S,...R(Ja.required,H)},!n))return E(H),k}if(!T&&(!Yn(u)||!Yn(d))){let D,H;const z=tl(d),M=tl(u);if(!Yn(h)&&!isNaN(h)){const U=o.valueAsNumber||h&&+h;Yn(z.value)||(D=U>z.value),Yn(M.value)||(H=Unew Date(new Date().toDateString()+" "+A),j=o.type=="time",O=o.type=="week";Oa(z.value)&&h&&(D=j?X(h)>X(z.value):O?h>z.value:U>new Date(z.value)),Oa(M.value)&&h&&(H=j?X(h)+D.value,M=!Yn(H.value)&&h.length<+H.value;if((z||M)&&(L(z,D.message,H.message),!n))return E(k[y].message),k}if(g&&!T&&Oa(h)){const{value:D,message:H}=tl(g);if(Ug(D)&&!h.match(D)&&(k[y]={type:Ja.pattern,message:H,ref:o,...R(Ja.pattern,H)},!n))return E(H),k}if(m){if(li(m)){const D=await m(h,t),H=W2(D,S);if(H&&(k[y]={...H,...R(Ja.validate,H.message)},!n))return E(H.message),k}else if(cn(m)){let D={};for(const H in m){if(!wr(D)&&!n)break;const z=W2(await m[H](h,t),S,H);z&&(D={...z,...R(H,z.message)},E(z.message),n&&(k[y]=D))}if(!wr(D)&&(k[y]={ref:S,...D},!n))return k}}return E(!0),k};function Wb(e,t){return[...e,...kr(t)]}var Kb=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Yb(e,t,n){return[...e.slice(0,t),...kr(n),...e.slice(t)]}var Zb=(e,t,n)=>Array.isArray(e)?(Ot(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[];function Xb(e,t){return[...kr(t),...kr(e)]}function bae(e,t){let n=0;const r=[...e];for(const a of t)r.splice(a-n,1),n++;return jc(r).length?r:[]}var Qb=(e,t)=>Ot(t)?[]:bae(e,kr(t).sort((n,r)=>n-r)),Jb=(e,t,n)=>{e[t]=[e[n],e[n]=e[t]][0]};function yae(e,t){const n=t.slice(0,-1).length;let r=0;for(;r(e[t]=n,e);function Sae(e){const t=Bs(),{control:n=t.control,name:r,keyName:a="id",shouldUnregister:o}=e,[i,s]=Ae.useState(n._getFieldArray(r)),l=Ae.useRef(n._getFieldArray(r).map($o)),c=Ae.useRef(i),u=Ae.useRef(r),d=Ae.useRef(!1);u.current=r,c.current=i,n._names.array.add(r),e.rules&&n.register(r,e.rules),ph({next:({values:k,name:x})=>{if(x===u.current||!x){const C=ge(k,u.current);Array.isArray(C)&&(s(C),l.current=C.map($o))}},subject:n._subjects.array});const g=Ae.useCallback(k=>{d.current=!0,n._updateFieldArray(r,k)},[n,r]),m=(k,x)=>{const C=kr(Ln(k)),_=Wb(n._getFieldArray(r),C);n._names.focus=Gb(r,_.length-1,x),l.current=Wb(l.current,C.map($o)),g(_),s(_),n._updateFieldArray(r,_,Wb,{argA:Kb(k)})},y=(k,x)=>{const C=kr(Ln(k)),_=Xb(n._getFieldArray(r),C);n._names.focus=Gb(r,0,x),l.current=Xb(l.current,C.map($o)),g(_),s(_),n._updateFieldArray(r,_,Xb,{argA:Kb(k)})},b=k=>{const x=Qb(n._getFieldArray(r),k);l.current=Qb(l.current,k),g(x),s(x),n._updateFieldArray(r,x,Qb,{argA:k})},w=(k,x,C)=>{const _=kr(Ln(x)),T=Yb(n._getFieldArray(r),k,_);n._names.focus=Gb(r,k,C),l.current=Yb(l.current,k,_.map($o)),g(T),s(T),n._updateFieldArray(r,T,Yb,{argA:k,argB:Kb(x)})},v=(k,x)=>{const C=n._getFieldArray(r);Jb(C,k,x),Jb(l.current,k,x),g(C),s(C),n._updateFieldArray(r,C,Jb,{argA:k,argB:x},!1)},h=(k,x)=>{const C=n._getFieldArray(r);Zb(C,k,x),Zb(l.current,k,x),g(C),s(C),n._updateFieldArray(r,C,Zb,{argA:k,argB:x},!1)},S=(k,x)=>{const C=Ln(x),_=K2(n._getFieldArray(r),k,C);l.current=[..._].map((T,R)=>!T||R===k?$o():l.current[R]),g(_),s([..._]),n._updateFieldArray(r,_,K2,{argA:k,argB:C},!0,!1)},E=k=>{const x=kr(Ln(k));l.current=x.map($o),g([...x]),s([...x]),n._updateFieldArray(r,[...x],C=>C,{},!0,!1)};return Ae.useEffect(()=>{if(n._state.action=!1,ck(r,n._names)&&n._subjects.state.next({...n._formState}),d.current&&(!lk(n._options.mode).isOnSubmit||n._formState.isSubmitted))if(n._options.resolver)n._executeSchema([r]).then(k=>{const x=ge(k.errors,r),C=ge(n._formState.errors,r);(C?!x&&C.type||x&&(C.type!==x.type||C.message!==x.message):x&&x.type)&&(x?ht(n._formState.errors,r,x):pn(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const k=ge(n._fields,r);k&&k._f&&uk(k,n._formValues,n._options.criteriaMode===Hr.all,n._options.shouldUseNativeValidation,!0).then(x=>!wr(x)&&n._subjects.state.next({errors:C8(n._formState.errors,x,r)}))}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&jg(n._fields,k=>!!k&&k.startsWith(n._names.focus||"")),n._names.focus="",n._updateValid(),d.current=!1},[i,r,n]),Ae.useEffect(()=>(!ge(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||o)&&n.unregister(r)}),[r,n,a,o]),{swap:Ae.useCallback(v,[g,r,n]),move:Ae.useCallback(h,[g,r,n]),prepend:Ae.useCallback(y,[g,r,n]),append:Ae.useCallback(m,[g,r,n]),remove:Ae.useCallback(b,[g,r,n]),insert:Ae.useCallback(w,[g,r,n]),update:Ae.useCallback(S,[g,r,n]),replace:Ae.useCallback(E,[g,r,n]),fields:Ae.useMemo(()=>i.map((k,x)=>({...k,[a]:l.current[x]||$o()})),[i,a])}}function ey(){let e=[];return{get observers(){return e},next:a=>{for(const o of e)o.next&&o.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(o=>o!==a)}}),unsubscribe:()=>{e=[]}}}var Bg=e=>Yn(e)||!m8(e);function as(e,t){if(Bg(e)||Bg(t))return e===t;if(Rl(e)&&Rl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const a of n){const o=e[a];if(!r.includes(a))return!1;if(a!=="ref"){const i=t[a];if(Rl(o)&&Rl(i)||cn(o)&&cn(i)||Array.isArray(o)&&Array.isArray(i)?!as(o,i):o!==i)return!1}}return!0}var T8=e=>e.type==="select-multiple",wae=e=>X_(e)||hf(e),ty=e=>zg(e)&&e.isConnected,R8=e=>{for(const t in e)if(li(e[t]))return!0;return!1};function Hg(e,t={}){const n=Array.isArray(e);if(cn(e)||n)for(const r in e)Array.isArray(e[r])||cn(e[r])&&!R8(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Hg(e[r],t[r])):Yn(e[r])||(t[r]=!0);return t}function N8(e,t,n){const r=Array.isArray(e);if(cn(e)||r)for(const a in e)Array.isArray(e[a])||cn(e[a])&&!R8(e[a])?Ot(t)||Bg(n[a])?n[a]=Array.isArray(e[a])?Hg(e[a],[]):{...Hg(e[a])}:N8(e[a],Yn(t)?{}:t[a],n[a]):n[a]=!as(e[a],t[a]);return n}var ny=(e,t)=>N8(e,t,Hg(t)),I8=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ot(e)?e:t?e===""?NaN:e&&+e:n&&Oa(e)?new Date(e):r?r(e):e;function ry(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Z_(t)?t.files:X_(t)?A8(e.refs).value:T8(t)?[...t.selectedOptions].map(({value:n})=>n):hf(t)?_8(e.refs).value:I8(Ot(t.value)?e.ref.value:t.value,e)}var Eae=(e,t,n,r)=>{const a={};for(const o of e){const i=ge(t,o);i&&ht(a,o,i._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},fu=e=>Ot(e)?e:Ug(e)?e.source:cn(e)?Ug(e.value)?e.value.source:e.value:e,xae=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Y2(e,t,n){const r=ge(e,n);if(r||Y_(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),i=ge(t,o),s=ge(e,o);if(i&&!Array.isArray(i)&&n!==o)return{name:n};if(s&&s.type)return{name:o,error:s};a.pop()}return{name:n}}var kae=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,Cae=(e,t)=>!jc(ge(e,t)).length&&pn(e,t);const _ae={mode:Hr.onSubmit,reValidateMode:Hr.onChange,shouldFocusError:!0};function Aae(e={},t){let n={..._ae,...e},r={submitCount:0,isDirty:!1,isLoading:li(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},o=cn(n.defaultValues)||cn(n.values)?Ln(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:Ln(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={values:ey(),array:ey(),state:ey()},m=e.resetOptions&&e.resetOptions.keepDirtyValues,y=lk(n.mode),b=lk(n.reValidateMode),w=n.criteriaMode===Hr.all,v=F=>q=>{clearTimeout(u),u=setTimeout(F,q)},h=async F=>{if(d.isValid||F){const q=n.resolver?wr((await T()).errors):await L(a,!0);q!==r.isValid&&g.state.next({isValid:q})}},S=F=>d.isValidating&&g.state.next({isValidating:F}),E=(F,q=[],Y,ye,de=!0,oe=!0)=>{if(ye&&Y){if(s.action=!0,oe&&Array.isArray(ge(a,F))){const _e=Y(ge(a,F),ye.argA,ye.argB);de&&ht(a,F,_e)}if(oe&&Array.isArray(ge(r.errors,F))){const _e=Y(ge(r.errors,F),ye.argA,ye.argB);de&&ht(r.errors,F,_e),Cae(r.errors,F)}if(d.touchedFields&&oe&&Array.isArray(ge(r.touchedFields,F))){const _e=Y(ge(r.touchedFields,F),ye.argA,ye.argB);de&&ht(r.touchedFields,F,_e)}d.dirtyFields&&(r.dirtyFields=ny(o,i)),g.state.next({name:F,isDirty:H(F,q),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ht(i,F,q)},k=(F,q)=>{ht(r.errors,F,q),g.state.next({errors:r.errors})},x=(F,q,Y,ye)=>{const de=ge(a,F);if(de){const oe=ge(i,F,Ot(Y)?ge(o,F):Y);Ot(oe)||ye&&ye.defaultChecked||q?ht(i,F,q?oe:ry(de._f)):U(F,oe),s.mount&&h()}},C=(F,q,Y,ye,de)=>{let oe=!1,_e=!1;const wt={name:F};if(!Y||ye){d.isDirty&&(_e=r.isDirty,r.isDirty=wt.isDirty=H(),oe=_e!==wt.isDirty);const St=as(ge(o,F),q);_e=ge(r.dirtyFields,F),St?pn(r.dirtyFields,F):ht(r.dirtyFields,F,!0),wt.dirtyFields=r.dirtyFields,oe=oe||d.dirtyFields&&_e!==!St}if(Y){const St=ge(r.touchedFields,F);St||(ht(r.touchedFields,F,Y),wt.touchedFields=r.touchedFields,oe=oe||d.touchedFields&&St!==Y)}return oe&&de&&g.state.next(wt),oe?wt:{}},_=(F,q,Y,ye)=>{const de=ge(r.errors,F),oe=d.isValid&&si(q)&&r.isValid!==q;if(e.delayError&&Y?(c=v(()=>k(F,Y)),c(e.delayError)):(clearTimeout(u),c=null,Y?ht(r.errors,F,Y):pn(r.errors,F)),(Y?!as(de,Y):de)||!wr(ye)||oe){const _e={...ye,...oe&&si(q)?{isValid:q}:{},errors:r.errors,name:F};r={...r,..._e},g.state.next(_e)}S(!1)},T=async F=>n.resolver(i,n.context,Eae(F||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation)),R=async F=>{const{errors:q}=await T(F);if(F)for(const Y of F){const ye=ge(q,Y);ye?ht(r.errors,Y,ye):pn(r.errors,Y)}else r.errors=q;return q},L=async(F,q,Y={valid:!0})=>{for(const ye in F){const de=F[ye];if(de){const{_f:oe,..._e}=de;if(oe){const wt=l.array.has(oe.name),St=await uk(de,i,w,n.shouldUseNativeValidation&&!q,wt);if(St[oe.name]&&(Y.valid=!1,q))break;!q&&(ge(St,oe.name)?wt?C8(r.errors,St,oe.name):ht(r.errors,oe.name,St[oe.name]):pn(r.errors,oe.name))}_e&&await L(_e,q,Y)}}return Y.valid},D=()=>{for(const F of l.unMount){const q=ge(a,F);q&&(q._f.refs?q._f.refs.every(Y=>!ty(Y)):!ty(q._f.ref))&&ne(F)}l.unMount=new Set},H=(F,q)=>(F&&q&&ht(i,F,q),!as(V(),o)),z=(F,q,Y)=>E8(F,l,{...s.mount?i:Ot(q)?o:Oa(F)?{[F]:q}:q},Y,q),M=F=>jc(ge(s.mount?i:o,F,e.shouldUnregister?ge(o,F,[]):[])),U=(F,q,Y={})=>{const ye=ge(a,F);let de=q;if(ye){const oe=ye._f;oe&&(!oe.disabled&&ht(i,F,I8(q,oe)),de=zg(oe.ref)&&Yn(q)?"":q,T8(oe.ref)?[...oe.ref.options].forEach(_e=>_e.selected=de.includes(_e.value)):oe.refs?hf(oe.ref)?oe.refs.length>1?oe.refs.forEach(_e=>(!_e.defaultChecked||!_e.disabled)&&(_e.checked=Array.isArray(de)?!!de.find(wt=>wt===_e.value):de===_e.value)):oe.refs[0]&&(oe.refs[0].checked=!!de):oe.refs.forEach(_e=>_e.checked=_e.value===de):Z_(oe.ref)?oe.ref.value="":(oe.ref.value=de,oe.ref.type||g.values.next({name:F,values:{...i}})))}(Y.shouldDirty||Y.shouldTouch)&&C(F,de,Y.shouldTouch,Y.shouldDirty,!0),Y.shouldValidate&&A(F)},X=(F,q,Y)=>{for(const ye in q){const de=q[ye],oe=`${F}.${ye}`,_e=ge(a,oe);(l.array.has(F)||!Bg(de)||_e&&!_e._f)&&!Rl(de)?X(oe,de,Y):U(oe,de,Y)}},j=(F,q,Y={})=>{const ye=ge(a,F),de=l.array.has(F),oe=Ln(q);ht(i,F,oe),de?(g.array.next({name:F,values:{...i}}),(d.isDirty||d.dirtyFields)&&Y.shouldDirty&&g.state.next({name:F,dirtyFields:ny(o,i),isDirty:H(F,oe)})):ye&&!ye._f&&!Yn(oe)?X(F,oe,Y):U(F,oe,Y),ck(F,l)&&g.state.next({...r}),g.values.next({name:F,values:{...i}}),!s.mount&&t()},O=async F=>{const q=F.target;let Y=q.name,ye=!0;const de=ge(a,Y),oe=()=>q.type?ry(de._f):h8(F);if(de){let _e,wt;const St=oe(),Z=F.type===Fg.BLUR||F.type===Fg.FOCUS_OUT,le=!xae(de._f)&&!n.resolver&&!ge(r.errors,Y)&&!de._f.deps||kae(Z,ge(r.touchedFields,Y),r.isSubmitted,b,y),De=ck(Y,l,Z);ht(i,Y,St),Z?(de._f.onBlur&&de._f.onBlur(F),c&&c(0)):de._f.onChange&&de._f.onChange(F);const He=C(Y,St,Z,!1),ft=!wr(He)||De;if(!Z&&g.values.next({name:Y,type:F.type,values:{...i}}),le)return d.isValid&&h(),ft&&g.state.next({name:Y,...De?{}:He});if(!Z&&De&&g.state.next({...r}),S(!0),n.resolver){const{errors:Tn}=await T([Y]),Ir=Y2(r.errors,a,Y),Sn=Y2(Tn,a,Ir.name||Y);_e=Sn.error,Y=Sn.name,wt=wr(Tn)}else _e=(await uk(de,i,w,n.shouldUseNativeValidation))[Y],ye=Number.isNaN(St)||St===ge(i,Y,St),ye&&(_e?wt=!1:d.isValid&&(wt=await L(a,!0)));ye&&(de._f.deps&&A(de._f.deps),_(Y,wt,_e,He))}},A=async(F,q={})=>{let Y,ye;const de=kr(F);if(S(!0),n.resolver){const oe=await R(Ot(F)?F:de);Y=wr(oe),ye=F?!de.some(_e=>ge(oe,_e)):Y}else F?(ye=(await Promise.all(de.map(async oe=>{const _e=ge(a,oe);return await L(_e&&_e._f?{[oe]:_e}:_e)}))).every(Boolean),!(!ye&&!r.isValid)&&h()):ye=Y=await L(a);return g.state.next({...!Oa(F)||d.isValid&&Y!==r.isValid?{}:{name:F},...n.resolver||!F?{isValid:Y}:{},errors:r.errors,isValidating:!1}),q.shouldFocus&&!ye&&jg(a,oe=>oe&&ge(r.errors,oe),F?de:l.mount),ye},V=F=>{const q={...o,...s.mount?i:{}};return Ot(F)?q:Oa(F)?ge(q,F):F.map(Y=>ge(q,Y))},P=(F,q)=>({invalid:!!ge((q||r).errors,F),isDirty:!!ge((q||r).dirtyFields,F),isTouched:!!ge((q||r).touchedFields,F),error:ge((q||r).errors,F)}),N=F=>{F&&kr(F).forEach(q=>pn(r.errors,q)),g.state.next({errors:F?r.errors:{}})},K=(F,q,Y)=>{const ye=(ge(a,F,{_f:{}})._f||{}).ref;ht(r.errors,F,{...q,ref:ye}),g.state.next({name:F,errors:r.errors,isValid:!1}),Y&&Y.shouldFocus&&ye&&ye.focus&&ye.focus()},ae=(F,q)=>li(F)?g.values.subscribe({next:Y=>F(z(void 0,q),Y)}):z(F,q,!0),ne=(F,q={})=>{for(const Y of F?kr(F):l.mount)l.mount.delete(Y),l.array.delete(Y),q.keepValue||(pn(a,Y),pn(i,Y)),!q.keepError&&pn(r.errors,Y),!q.keepDirty&&pn(r.dirtyFields,Y),!q.keepTouched&&pn(r.touchedFields,Y),!n.shouldUnregister&&!q.keepDefaultValue&&pn(o,Y);g.values.next({values:{...i}}),g.state.next({...r,...q.keepDirty?{isDirty:H()}:{}}),!q.keepIsValid&&h()},Q=({disabled:F,name:q,field:Y,fields:ye})=>{if(si(F)){const de=F?void 0:ge(i,q,ry(Y?Y._f:ge(ye,q)._f));ht(i,q,de),C(q,de,!1,!1,!0)}},pe=(F,q={})=>{let Y=ge(a,F);const ye=si(q.disabled);return ht(a,F,{...Y||{},_f:{...Y&&Y._f?Y._f:{ref:{name:F}},name:F,mount:!0,...q}}),l.mount.add(F),Y?Q({field:Y,disabled:q.disabled,name:F}):x(F,!0,q.value),{...ye?{disabled:q.disabled}:{},...n.progressive?{required:!!q.required,min:fu(q.min),max:fu(q.max),minLength:fu(q.minLength),maxLength:fu(q.maxLength),pattern:fu(q.pattern)}:{},name:F,onChange:O,onBlur:O,ref:de=>{if(de){pe(F,q),Y=ge(a,F);const oe=Ot(de.value)&&de.querySelectorAll&&de.querySelectorAll("input,select,textarea")[0]||de,_e=wae(oe),wt=Y._f.refs||[];if(_e?wt.find(St=>St===oe):oe===Y._f.ref)return;ht(a,F,{_f:{...Y._f,..._e?{refs:[...wt.filter(ty),oe,...Array.isArray(ge(o,F))?[{}]:[]],ref:{type:oe.type,name:F}}:{ref:oe}}}),x(F,!1,void 0,oe)}else Y=ge(a,F,{}),Y._f&&(Y._f.mount=!1),(n.shouldUnregister||q.shouldUnregister)&&!(b8(l.array,F)&&s.action)&&l.unMount.add(F)}}},he=()=>n.shouldFocusError&&jg(a,F=>F&&ge(r.errors,F),l.mount),re=(F,q)=>async Y=>{Y&&(Y.preventDefault&&Y.preventDefault(),Y.persist&&Y.persist());let ye=Ln(i);if(g.state.next({isSubmitting:!0}),n.resolver){const{errors:de,values:oe}=await T();r.errors=de,ye=oe}else await L(a);pn(r.errors,"root"),wr(r.errors)?(g.state.next({errors:{}}),await F(ye,Y)):(q&&await q({...r.errors},Y),he(),setTimeout(he)),g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:wr(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Ee=(F,q={})=>{ge(a,F)&&(Ot(q.defaultValue)?j(F,ge(o,F)):(j(F,q.defaultValue),ht(o,F,q.defaultValue)),q.keepTouched||pn(r.touchedFields,F),q.keepDirty||(pn(r.dirtyFields,F),r.isDirty=q.defaultValue?H(F,ge(o,F)):H()),q.keepError||(pn(r.errors,F),d.isValid&&h()),g.state.next({...r}))},ke=(F,q={})=>{const Y=F?Ln(F):o,ye=Ln(Y),de=F&&!wr(F)?ye:o;if(q.keepDefaultValues||(o=Y),!q.keepValues){if(q.keepDirtyValues||m)for(const oe of l.mount)ge(r.dirtyFields,oe)?ht(de,oe,ge(i,oe)):j(oe,ge(de,oe));else{if(K_&&Ot(F))for(const oe of l.mount){const _e=ge(a,oe);if(_e&&_e._f){const wt=Array.isArray(_e._f.refs)?_e._f.refs[0]:_e._f.ref;if(zg(wt)){const St=wt.closest("form");if(St){St.reset();break}}}}a={}}i=e.shouldUnregister?q.keepDefaultValues?Ln(o):{}:Ln(de),g.array.next({values:{...de}}),g.values.next({values:{...de}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!d.isValid||!!q.keepIsValid,s.watch=!!e.shouldUnregister,g.state.next({submitCount:q.keepSubmitCount?r.submitCount:0,isDirty:q.keepDirty?r.isDirty:!!(q.keepDefaultValues&&!as(F,o)),isSubmitted:q.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q.keepDirtyValues?r.dirtyFields:q.keepDefaultValues&&F?ny(o,F):{},touchedFields:q.keepTouched?r.touchedFields:{},errors:q.keepErrors?r.errors:{},isSubmitSuccessful:q.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},We=(F,q)=>ke(li(F)?F(i):F,q);return{control:{register:pe,unregister:ne,getFieldState:P,handleSubmit:re,setError:K,_executeSchema:T,_getWatch:z,_getDirty:H,_updateValid:h,_removeUnmounted:D,_updateFieldArray:E,_updateDisabledField:Q,_getFieldArray:M,_reset:ke,_resetDefaultValues:()=>li(n.defaultValues)&&n.defaultValues().then(F=>{We(F,n.resetOptions),g.state.next({isLoading:!1})}),_updateFormState:F=>{r={...r,...F}},_subjects:g,_proxyFormState:d,get _fields(){return a},get _formValues(){return i},get _state(){return s},set _state(F){s=F},get _defaultValues(){return o},get _names(){return l},set _names(F){l=F},get _formState(){return r},set _formState(F){r=F},get _options(){return n},set _options(F){n={...n,...F}}},trigger:A,register:pe,handleSubmit:re,watch:ae,setValue:j,getValues:V,reset:We,resetField:Ee,clearErrors:N,unregister:ne,setError:K,setFocus:(F,q={})=>{const Y=ge(a,F),ye=Y&&Y._f;if(ye){const de=ye.refs?ye.refs[0]:ye.ref;de.focus&&(de.focus(),q.shouldSelect&&de.select())}},getFieldState:P}}function bn(e={}){const t=Ae.useRef(),n=Ae.useRef(),[r,a]=Ae.useState({isDirty:!1,isValidating:!1,isLoading:li(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:li(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Aae(e,()=>a(i=>({...i}))),formState:r});const o=t.current.control;return o._options=e,ph({subject:o._subjects.state,next:i=>{S8(i,o._proxyFormState,o._updateFormState,!0)&&a({...o._formState})}}),Ae.useEffect(()=>{e.values&&!as(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values):o._resetDefaultValues()},[e.values,o]),Ae.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=v8(r,o),t.current}var Z2=function(e,t,n){if(e&&"reportValidity"in e){var r=ge(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},O8=function(e,t){var n=function(a){var o=t.fields[a];o&&o.ref&&"reportValidity"in o.ref?Z2(o.ref,a,e):o.refs&&o.refs.forEach(function(i){return Z2(i,a,e)})};for(var r in t.fields)n(r)},Tae=function(e,t){t.shouldUseNativeValidation&&O8(e,t);var n={};for(var r in e){var a=ge(t.fields,r),o=Object.assign(e[r]||{},{ref:a&&a.ref});if(Nae(t.names||Object.keys(e),r)){var i=Object.assign({},Rae(ge(n,r)));ht(i,"root",o),ht(n,r,i)}else ht(n,r,o)}return n},Rae=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Nae=function(e,t){return e.some(function(n){return n.startsWith(t+".")})},Iae=function(e,t){for(var n={};e.length;){var r=e[0],a=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[i]={message:s.message,type:s.code}}else n[i]={message:o,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return e.push(d)})}),t){var l=n[i].types,c=l&&l[r.code];n[i]=k8(i,t,n,a,c?[].concat(c,r.message):r.message)}e.shift()}return n},yn=function(e,t,n){return n===void 0&&(n={}),function(r,a,o){try{return Promise.resolve(function(i,s){try{var l=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(c){return o.shouldUseNativeValidation&&O8({},o),{errors:{},values:n.raw?r:c}})}catch(c){return s(c)}return l&&l.then?l.then(void 0,s):l}(0,function(i){if(function(s){return s.errors!=null}(i))return{values:{},errors:Tae(Iae(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}};function Ul(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Oae(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function D8(...e){return t=>e.forEach(n=>Oae(n,t))}function bf(...e){return p.useCallback(D8(...e),e)}function Dae(e,t=[]){let n=[];function r(o,i){const s=p.createContext(i),l=n.length;n=[...n,i];function c(d){const{scope:g,children:m,...y}=d,b=(g==null?void 0:g[e][l])||s,w=p.useMemo(()=>y,Object.values(y));return p.createElement(b.Provider,{value:w},m)}function u(d,g){const m=(g==null?void 0:g[e][l])||s,y=p.useContext(m);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,u]}const a=()=>{const o=n.map(i=>p.createContext(i));return function(s){const l=(s==null?void 0:s[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return a.scopeName=e,[r,Lae(a,...t)]}function Lae(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...s,...d}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}const dk=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Mae=Wd["useId".toString()]||(()=>{});let Pae=0;function ay(e){const[t,n]=p.useState(Mae());return dk(()=>{e||n(r=>r??String(Pae++))},[e]),e||(t?`radix-${t}`:"")}function Rs(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function $ae({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,a]=Fae({defaultProp:t,onChange:n}),o=e!==void 0,i=o?e:r,s=Rs(n),l=p.useCallback(c=>{if(o){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else a(c)},[o,e,a,s]);return[i,l]}function Fae({defaultProp:e,onChange:t}){const n=p.useState(e),[r]=n,a=p.useRef(r),o=Rs(t);return p.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),n}const Q_=p.forwardRef((e,t)=>{const{children:n,...r}=e,a=p.Children.toArray(n),o=a.find(zae);if(o){const i=o.props.children,s=a.map(l=>l===o?p.Children.count(i)>1?p.Children.only(null):p.isValidElement(i)?i.props.children:null:l);return p.createElement(fk,W({},r,{ref:t}),p.isValidElement(i)?p.cloneElement(i,void 0,s):null)}return p.createElement(fk,W({},r,{ref:t}),n)});Q_.displayName="Slot";const fk=p.forwardRef((e,t)=>{const{children:n,...r}=e;return p.isValidElement(n)?p.cloneElement(n,{...Uae(r,n.props),ref:D8(t,n.ref)}):p.Children.count(n)>1?p.Children.only(null):null});fk.displayName="SlotClone";const jae=({children:e})=>p.createElement(p.Fragment,null,e);function zae(e){return p.isValidElement(e)&&e.type===jae}function Uae(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?n[r]=(...s)=>{o==null||o(...s),a==null||a(...s)}:r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}const Bae=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],gh=Bae.reduce((e,t)=>{const n=p.forwardRef((r,a)=>{const{asChild:o,...i}=r,s=o?Q_:t;return p.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),p.createElement(s,W({},i,{ref:a}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Hae(e,t){e&&ba.flushSync(()=>e.dispatchEvent(t))}function Vae(e){const t=Rs(e);p.useEffect(()=>{const n=r=>{r.key==="Escape"&&t(r)};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t])}const pk="dismissableLayer.update",qae="dismissableLayer.pointerDownOutside",Gae="dismissableLayer.focusOutside";let X2;const Wae=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kae=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:s,...l}=e,c=p.useContext(Wae),[u,d]=p.useState(null),[,g]=p.useState({}),m=bf(t,x=>d(x)),y=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=y.indexOf(b),v=u?y.indexOf(u):-1,h=c.layersWithOutsidePointerEventsDisabled.size>0,S=v>=w,E=Yae(x=>{const C=x.target,_=[...c.branches].some(T=>T.contains(C));!S||_||(a==null||a(x),i==null||i(x),x.defaultPrevented||s==null||s())}),k=Zae(x=>{const C=x.target;[...c.branches].some(T=>T.contains(C))||(o==null||o(x),i==null||i(x),x.defaultPrevented||s==null||s())});return Vae(x=>{v===c.layers.size-1&&(r==null||r(x),!x.defaultPrevented&&s&&(x.preventDefault(),s()))}),p.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(X2=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Q2(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(document.body.style.pointerEvents=X2)}},[u,n,c]),p.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Q2())},[u,c]),p.useEffect(()=>{const x=()=>g({});return document.addEventListener(pk,x),()=>document.removeEventListener(pk,x)},[]),p.createElement(gh.div,W({},l,{ref:m,style:{pointerEvents:h?S?"auto":"none":void 0,...e.style},onFocusCapture:Ul(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Ul(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Ul(e.onPointerDownCapture,E.onPointerDownCapture)}))});function Yae(e){const t=Rs(e),n=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const a=i=>{if(i.target&&!n.current){let c=function(){L8(qae,t,l,{discrete:!0})};var s=c;const l={originalEvent:i};i.pointerType==="touch"?(document.removeEventListener("click",r.current),r.current=c,document.addEventListener("click",r.current,{once:!0})):c()}n.current=!1},o=window.setTimeout(()=>{document.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),document.removeEventListener("pointerdown",a),document.removeEventListener("click",r.current)}},[t]),{onPointerDownCapture:()=>n.current=!0}}function Zae(e){const t=Rs(e),n=p.useRef(!1);return p.useEffect(()=>{const r=a=>{a.target&&!n.current&&L8(Gae,t,{originalEvent:a},{discrete:!1})};return document.addEventListener("focusin",r),()=>document.removeEventListener("focusin",r)},[t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Q2(){const e=new CustomEvent(pk);document.dispatchEvent(e)}function L8(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Hae(a,o):a.dispatchEvent(o)}const oy="focusScope.autoFocusOnMount",iy="focusScope.autoFocusOnUnmount",J2={bubbles:!1,cancelable:!0},Xae=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[s,l]=p.useState(null),c=Rs(a),u=Rs(o),d=p.useRef(null),g=bf(t,b=>l(b)),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let v=function(S){if(m.paused||!s)return;const E=S.target;s.contains(E)?d.current=E:Yi(d.current,{select:!0})},h=function(S){m.paused||!s||s.contains(S.relatedTarget)||Yi(d.current,{select:!0})};var b=v,w=h;return document.addEventListener("focusin",v),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",h)}}},[r,s,m.paused]),p.useEffect(()=>{if(s){tN.add(m);const b=document.activeElement;if(!s.contains(b)){const v=new CustomEvent(oy,J2);s.addEventListener(oy,c),s.dispatchEvent(v),v.defaultPrevented||(Qae(roe(M8(s)),{select:!0}),document.activeElement===b&&Yi(s))}return()=>{s.removeEventListener(oy,c),setTimeout(()=>{const v=new CustomEvent(iy,J2);s.addEventListener(iy,u),s.dispatchEvent(v),v.defaultPrevented||Yi(b??document.body,{select:!0}),s.removeEventListener(iy,u),tN.remove(m)},0)}}},[s,c,u,m]);const y=p.useCallback(b=>{if(!n&&!r||m.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(w&&v){const h=b.currentTarget,[S,E]=Jae(h);S&&E?!b.shiftKey&&v===E?(b.preventDefault(),n&&Yi(S,{select:!0})):b.shiftKey&&v===S&&(b.preventDefault(),n&&Yi(E,{select:!0})):v===h&&b.preventDefault()}},[n,r,m.paused]);return p.createElement(gh.div,W({tabIndex:-1},i,{ref:g,onKeyDown:y}))});function Qae(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Yi(r,{select:t}),document.activeElement!==n)return}function Jae(e){const t=M8(e),n=eN(t,e),r=eN(t.reverse(),e);return[n,r]}function M8(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function eN(e,t){for(const n of e)if(!eoe(n,{upTo:t}))return n}function eoe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function toe(e){return e instanceof HTMLInputElement&&"select"in e}function Yi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&toe(e)&&t&&e.select()}}const tN=noe();function noe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=nN(e,t),e.unshift(t)},remove(t){var n;e=nN(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function nN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function roe(e){return e.filter(t=>t.tagName!=="A")}const aoe=p.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...a}=e;return r?qC.createPortal(p.createElement(gh.div,W({},a,{ref:t})),r):null});function ooe(e,t){return p.useReducer((n,r)=>{const a=t[n][r];return a??n},e)}const mh=e=>{const{present:t,children:n}=e,r=ioe(t),a=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=bf(r.ref,a.ref);return typeof n=="function"||r.isPresent?p.cloneElement(a,{ref:o}):null};mh.displayName="Presence";function ioe(e){const[t,n]=p.useState(),r=p.useRef({}),a=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[s,l]=ooe(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const c=sp(r.current);o.current=s==="mounted"?c:"none"},[s]),dk(()=>{const c=r.current,u=a.current;if(u!==e){const g=o.current,m=sp(c);e?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&g!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),dk(()=>{if(t){const c=d=>{const m=sp(r.current).includes(d.animationName);d.target===t&&m&&ba.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(o.current=sp(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:p.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function sp(e){return(e==null?void 0:e.animationName)||"none"}let sy=0;function soe(){p.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:rN()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:rN()),sy++,()=>{sy===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),sy--}},[])}function rN(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var P8=u7(),ly=function(){},hh=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:ly,onWheelCapture:ly,onTouchMoveCapture:ly}),a=r[0],o=r[1],i=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,g=e.sideCar,m=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,v=w===void 0?"div":w,h=O_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),S=g,E=c7([n,t]),k=Pn(Pn({},h),a);return p.createElement(p.Fragment,null,u&&p.createElement(S,{sideCar:P8,removeScrollBar:c,shards:d,noIsolation:m,inert:y,setCallbacks:o,allowPinchZoom:!!b,lockRef:n}),i?p.cloneElement(p.Children.only(s),Pn(Pn({},k),{ref:E})):p.createElement(v,Pn({},k,{className:l,ref:E}),s))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:Vu,zeroRight:Hu};var gk=!1;if(typeof window<"u")try{var lp=Object.defineProperty({},"passive",{get:function(){return gk=!0,!0}});window.addEventListener("test",lp,lp),window.removeEventListener("test",lp,lp)}catch{gk=!1}var nl=gk?{passive:!1}:!1,loe=function(e){var t=window.getComputedStyle(e);return t.overflowY!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowY==="visible")},coe=function(e){var t=window.getComputedStyle(e);return t.overflowX!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowX==="visible")},aN=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=$8(e,n);if(r){var a=F8(e,n),o=a[1],i=a[2];if(o>i)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},uoe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},doe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},$8=function(e,t){return e==="v"?loe(t):coe(t)},F8=function(e,t){return e==="v"?uoe(t):doe(t)},foe=function(e,t){return e==="h"&&t==="rtl"?-1:1},poe=function(e,t,n,r,a){var o=foe(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,g=0;do{var m=F8(e,s),y=m[0],b=m[1],w=m[2],v=b-w-o*y;(y||v)&&$8(e,s)&&(d+=v,g+=y),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(a&&d===0||!a&&i>d)||!u&&(a&&g===0||!a&&-i>g))&&(c=!0),c},cp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oN=function(e){return[e.deltaX,e.deltaY]},iN=function(e){return e&&"current"in e?e.current:e},goe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},moe=function(e){return` +`)},oee=0,Js=[];function iee(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),a=p.useState(oee++)[0],o=p.useState(function(){return D_()})[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=l7([e.lockRef.current],(e.shards||[]).map(L2),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(b,w){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var v=rp(b),h=n.current,S="deltaX"in b?b.deltaX:h[0]-v[0],E="deltaY"in b?b.deltaY:h[1]-v[1],k,x=b.target,C=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in b&&C==="h"&&x.type==="range")return!1;var _=O2(C,x);if(!_)return!0;if(_?k=C:(k=C==="v"?"h":"v",_=O2(C,x)),!_)return!1;if(!r.current&&"changedTouches"in b&&(S||E)&&(r.current=k),!k)return!0;var T=r.current||k;return nee(T,w,b,T==="h"?S:E,!0)},[]),l=p.useCallback(function(b){var w=b;if(!(!Js.length||Js[Js.length-1]!==o)){var v="deltaY"in w?D2(w):rp(w),h=t.current.filter(function(k){return k.name===w.type&&k.target===w.target&&ree(k.delta,v)})[0];if(h&&h.should){w.cancelable&&w.preventDefault();return}if(!h){var S=(i.current.shards||[]).map(L2).filter(Boolean).filter(function(k){return k.contains(w.target)}),E=S.length>0?s(w,S[0]):!i.current.noIsolation;E&&w.cancelable&&w.preventDefault()}}},[]),c=p.useCallback(function(b,w,v,h){var S={name:b,delta:w,target:v,should:h};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(E){return E!==S})},1)},[]),u=p.useCallback(function(b){n.current=rp(b),r.current=void 0},[]),d=p.useCallback(function(b){c(b.type,D2(b),b.target,s(b,e.lockRef.current))},[]),g=p.useCallback(function(b){c(b.type,rp(b),b.target,s(b,e.lockRef.current))},[]);p.useEffect(function(){return Js.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Qs),document.addEventListener("touchmove",l,Qs),document.addEventListener("touchstart",u,Qs),function(){Js=Js.filter(function(b){return b!==o}),document.removeEventListener("wheel",l,Qs),document.removeEventListener("touchmove",l,Qs),document.removeEventListener("touchstart",u,Qs)}},[]);var m=e.removeScrollBar,y=e.inert;return p.createElement(p.Fragment,null,y?p.createElement(o,{styles:aee(a)}):null,m?p.createElement(g7,{gapMode:"margin"}):null)}const see=f7(p7,iee);var y7=p.forwardRef(function(e,t){return p.createElement(oh,Pn({},e,{ref:t,sideCar:see}))});y7.classNames=oh.classNames;const ih=y7,rk=["Enter"," "],lee=["ArrowDown","PageUp","Home"],v7=["ArrowUp","PageDown","End"],cee=[...lee,...v7],uee={ltr:[...rk,"ArrowRight"],rtl:[...rk,"ArrowLeft"]},dee={ltr:["ArrowLeft"],rtl:["ArrowRight"]},sh="Menu",[wd,fee,pee]=Rm(sh),[Fs,S7]=zn(sh,[pee,qa,ah]),w7=qa(),E7=ah(),[pTe,js]=Fs(sh),[gTe,mf]=Fs(sh),gee=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,a=w7(n);return p.createElement(ff,W({},a,r,{ref:t}))}),x7="MenuPortal",[mee,k7]=Fs(x7,{forceMount:void 0}),hee=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:a}=e,o=js(x7,t);return p.createElement(mee,{scope:t,forceMount:n},p.createElement(pr,{present:n||o.open},p.createElement(Qd,{asChild:!0,container:a},r)))},ga="MenuContent",[bee,L_]=Fs(ga),yee=p.forwardRef((e,t)=>{const n=k7(ga,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=js(ga,e.__scopeMenu),i=mf(ga,e.__scopeMenu);return p.createElement(wd.Provider,{scope:e.__scopeMenu},p.createElement(pr,{present:r||o.open},p.createElement(wd.Slot,{scope:e.__scopeMenu},i.modal?p.createElement(vee,W({},a,{ref:t})):p.createElement(See,W({},a,{ref:t})))))}),vee=p.forwardRef((e,t)=>{const n=js(ga,e.__scopeMenu),r=p.useRef(null),a=rt(t,r);return p.useEffect(()=>{const o=r.current;if(o)return gf(o)},[]),p.createElement(M_,W({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:fe(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)}))}),See=p.forwardRef((e,t)=>{const n=js(ga,e.__scopeMenu);return p.createElement(M_,W({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)}))}),M_=p.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:i,disableOutsidePointerEvents:s,onEntryFocus:l,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:g,onDismiss:m,disableOutsideScroll:y,...b}=e,w=js(ga,n),v=mf(ga,n),h=w7(n),S=E7(n),E=fee(n),[k,x]=p.useState(null),C=p.useRef(null),_=rt(t,C,w.onContentChange),T=p.useRef(0),R=p.useRef(""),L=p.useRef(0),D=p.useRef(null),H=p.useRef("right"),z=p.useRef(0),M=y?ih:p.Fragment,U=y?{as:$a,allowPinchZoom:!0}:void 0,X=O=>{var A,V;const P=R.current+O,N=E().filter(he=>!he.disabled),K=document.activeElement,ae=(A=N.find(he=>he.ref.current===K))===null||A===void 0?void 0:A.textValue,ne=N.map(he=>he.textValue),Q=Pee(ne,P,ae),pe=(V=N.find(he=>he.textValue===Q))===null||V===void 0?void 0:V.ref.current;(function he(re){R.current=re,window.clearTimeout(T.current),re!==""&&(T.current=window.setTimeout(()=>he(""),1e3))})(P),pe&&setTimeout(()=>pe.focus())};p.useEffect(()=>()=>window.clearTimeout(T.current),[]),Jm();const j=p.useCallback(O=>{var A,V;return H.current===((A=D.current)===null||A===void 0?void 0:A.side)&&Fee(O,(V=D.current)===null||V===void 0?void 0:V.area)},[]);return p.createElement(bee,{scope:n,searchRef:R,onItemEnter:p.useCallback(O=>{j(O)&&O.preventDefault()},[j]),onItemLeave:p.useCallback(O=>{var A;j(O)||((A=C.current)===null||A===void 0||A.focus(),x(null))},[j]),onTriggerLeave:p.useCallback(O=>{j(O)&&O.preventDefault()},[j]),pointerGraceTimerRef:L,onPointerGraceIntentChange:p.useCallback(O=>{D.current=O},[])},p.createElement(M,U,p.createElement(eh,{asChild:!0,trapped:a,onMountAutoFocus:fe(o,O=>{var A;O.preventDefault(),(A=C.current)===null||A===void 0||A.focus()}),onUnmountAutoFocus:i},p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:c,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:g,onDismiss:m},p.createElement(o7,W({asChild:!0},S,{dir:v.dir,orientation:"vertical",loop:r,currentTabStopId:k,onCurrentTabStopIdChange:x,onEntryFocus:fe(l,O=>{v.isUsingKeyboardRef.current||O.preventDefault()})}),p.createElement(pf,W({role:"menu","aria-orientation":"vertical","data-state":R7(w.open),"data-radix-menu-content":"",dir:v.dir},h,b,{ref:_,style:{outline:"none",...b.style},onKeyDown:fe(b.onKeyDown,O=>{const V=O.target.closest("[data-radix-menu-content]")===O.currentTarget,P=O.ctrlKey||O.altKey||O.metaKey,N=O.key.length===1;V&&(O.key==="Tab"&&O.preventDefault(),!P&&N&&X(O.key));const K=C.current;if(O.target!==K||!cee.includes(O.key))return;O.preventDefault();const ne=E().filter(Q=>!Q.disabled).map(Q=>Q.ref.current);v7.includes(O.key)&&ne.reverse(),Lee(ne)}),onBlur:fe(e.onBlur,O=>{O.currentTarget.contains(O.target)||(window.clearTimeout(T.current),R.current="")}),onPointerMove:fe(e.onPointerMove,Ed(O=>{const A=O.target,V=z.current!==O.clientX;if(O.currentTarget.contains(A)&&V){const P=O.clientX>z.current?"right":"left";H.current=P,z.current=O.clientX}}))})))))))}),wee=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.createElement(ze.div,W({},r,{ref:t}))}),ak="MenuItem",M2="menu.itemSelect",P_=p.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...a}=e,o=p.useRef(null),i=mf(ak,e.__scopeMenu),s=L_(ak,e.__scopeMenu),l=rt(t,o),c=p.useRef(!1),u=()=>{const d=o.current;if(!n&&d){const g=new CustomEvent(M2,{bubbles:!0,cancelable:!0});d.addEventListener(M2,m=>r==null?void 0:r(m),{once:!0}),WC(d,g),g.defaultPrevented?c.current=!1:i.onClose()}};return p.createElement(C7,W({},a,{ref:l,disabled:n,onClick:fe(e.onClick,u),onPointerDown:d=>{var g;(g=e.onPointerDown)===null||g===void 0||g.call(e,d),c.current=!0},onPointerUp:fe(e.onPointerUp,d=>{var g;c.current||(g=d.currentTarget)===null||g===void 0||g.click()}),onKeyDown:fe(e.onKeyDown,d=>{const g=s.searchRef.current!=="";n||g&&d.key===" "||rk.includes(d.key)&&(d.currentTarget.click(),d.preventDefault())})}))}),C7=p.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...o}=e,i=L_(ak,n),s=E7(n),l=p.useRef(null),c=rt(t,l),[u,d]=p.useState(!1),[g,m]=p.useState("");return p.useEffect(()=>{const y=l.current;if(y){var b;m(((b=y.textContent)!==null&&b!==void 0?b:"").trim())}},[o.children]),p.createElement(wd.ItemSlot,{scope:n,disabled:r,textValue:a??g},p.createElement(i7,W({asChild:!0},s,{focusable:!r}),p.createElement(ze.div,W({role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0},o,{ref:c,onPointerMove:fe(e.onPointerMove,Ed(y=>{r?i.onItemLeave(y):(i.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus())})),onPointerLeave:fe(e.onPointerLeave,Ed(y=>i.onItemLeave(y))),onFocus:fe(e.onFocus,()=>d(!0)),onBlur:fe(e.onBlur,()=>d(!1))}))))}),Eee=p.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...a}=e;return p.createElement(A7,{scope:e.__scopeMenu,checked:n},p.createElement(P_,W({role:"menuitemcheckbox","aria-checked":Mg(n)?"mixed":n},a,{ref:t,"data-state":$_(n),onSelect:fe(a.onSelect,()=>r==null?void 0:r(Mg(n)?!0:!n),{checkForDefaultPrevented:!1})})))}),xee="MenuRadioGroup",[mTe,kee]=Fs(xee,{value:void 0,onValueChange:()=>{}}),Cee="MenuRadioItem",_ee=p.forwardRef((e,t)=>{const{value:n,...r}=e,a=kee(Cee,e.__scopeMenu),o=n===a.value;return p.createElement(A7,{scope:e.__scopeMenu,checked:o},p.createElement(P_,W({role:"menuitemradio","aria-checked":o},r,{ref:t,"data-state":$_(o),onSelect:fe(r.onSelect,()=>{var i;return(i=a.onValueChange)===null||i===void 0?void 0:i.call(a,n)},{checkForDefaultPrevented:!1})})))}),_7="MenuItemIndicator",[A7,Aee]=Fs(_7,{checked:!1}),Tee=p.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...a}=e,o=Aee(_7,n);return p.createElement(pr,{present:r||Mg(o.checked)||o.checked===!0},p.createElement(ze.span,W({},a,{ref:t,"data-state":$_(o.checked)})))}),Ree=p.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.createElement(ze.div,W({role:"separator","aria-orientation":"horizontal"},r,{ref:t}))}),Nee="MenuSub",[hTe,T7]=Fs(Nee),ap="MenuSubTrigger",Iee=p.forwardRef((e,t)=>{const n=js(ap,e.__scopeMenu),r=mf(ap,e.__scopeMenu),a=T7(ap,e.__scopeMenu),o=L_(ap,e.__scopeMenu),i=p.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:l}=o,c={__scopeMenu:e.__scopeMenu},u=p.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return p.useEffect(()=>u,[u]),p.useEffect(()=>{const d=s.current;return()=>{window.clearTimeout(d),l(null)}},[s,l]),p.createElement(gee,W({asChild:!0},c),p.createElement(C7,W({id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":R7(n.open)},e,{ref:GC(t,a.onTriggerChange),onClick:d=>{var g;(g=e.onClick)===null||g===void 0||g.call(e,d),!(e.disabled||d.defaultPrevented)&&(d.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:fe(e.onPointerMove,Ed(d=>{o.onItemEnter(d),!d.defaultPrevented&&!e.disabled&&!n.open&&!i.current&&(o.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:fe(e.onPointerLeave,Ed(d=>{var g;u();const m=(g=n.content)===null||g===void 0?void 0:g.getBoundingClientRect();if(m){var y;const b=(y=n.content)===null||y===void 0?void 0:y.dataset.side,w=b==="right",v=w?-5:5,h=m[w?"left":"right"],S=m[w?"right":"left"];o.onPointerGraceIntentChange({area:[{x:d.clientX+v,y:d.clientY},{x:h,y:m.top},{x:S,y:m.top},{x:S,y:m.bottom},{x:h,y:m.bottom}],side:b}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(d),d.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:fe(e.onKeyDown,d=>{const g=o.searchRef.current!=="";if(!(e.disabled||g&&d.key===" ")&&uee[r.dir].includes(d.key)){var m;n.onOpenChange(!0),(m=n.content)===null||m===void 0||m.focus(),d.preventDefault()}})})))}),Oee="MenuSubContent",Dee=p.forwardRef((e,t)=>{const n=k7(ga,e.__scopeMenu),{forceMount:r=n.forceMount,...a}=e,o=js(ga,e.__scopeMenu),i=mf(ga,e.__scopeMenu),s=T7(Oee,e.__scopeMenu),l=p.useRef(null),c=rt(t,l);return p.createElement(wd.Provider,{scope:e.__scopeMenu},p.createElement(pr,{present:r||o.open},p.createElement(wd.Slot,{scope:e.__scopeMenu},p.createElement(M_,W({id:s.contentId,"aria-labelledby":s.triggerId},a,{ref:c,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var d;i.isUsingKeyboardRef.current&&((d=l.current)===null||d===void 0||d.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:fe(e.onFocusOutside,u=>{u.target!==s.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:fe(e.onEscapeKeyDown,u=>{i.onClose(),u.preventDefault()}),onKeyDown:fe(e.onKeyDown,u=>{const d=u.currentTarget.contains(u.target),g=dee[i.dir].includes(u.key);if(d&&g){var m;o.onOpenChange(!1),(m=s.trigger)===null||m===void 0||m.focus(),u.preventDefault()}})})))))});function R7(e){return e?"open":"closed"}function Mg(e){return e==="indeterminate"}function $_(e){return Mg(e)?"indeterminate":e?"checked":"unchecked"}function Lee(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Mee(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function Pee(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Mee(e,Math.max(o,0));a.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function $ee(e,t){const{x:n,y:r}=e;let a=!1;for(let o=0,i=t.length-1;or!=u>r&&n<(c-s)*(r-l)/(u-l)+s&&(a=!a)}return a}function Fee(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return $ee(n,t)}function Ed(e){return t=>t.pointerType==="mouse"?e(t):void 0}const jee=hee,zee=yee,Uee=wee,Bee=P_,Hee=Eee,Vee=_ee,qee=Tee,Gee=Ree,Wee=Iee,Kee=Dee,N7="DropdownMenu",[Yee,bTe]=zn(N7,[S7]),Ga=S7(),[yTe,Zee]=Yee(N7),Xee=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Ga(t);return p.createElement(jee,W({},r,n))},Qee="DropdownMenuContent",Jee=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Zee(Qee,n),o=Ga(n),i=p.useRef(!1);return p.createElement(zee,W({id:a.contentId,"aria-labelledby":a.triggerId},o,r,{ref:t,onCloseAutoFocus:fe(e.onCloseAutoFocus,s=>{var l;i.current||(l=a.triggerRef.current)===null||l===void 0||l.focus(),i.current=!1,s.preventDefault()}),onInteractOutside:fe(e.onInteractOutside,s=>{const l=s.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,u=l.button===2||c;(!a.modal||u)&&(i.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)"}}))}),ete=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Uee,W({},a,r,{ref:t}))}),tte=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Bee,W({},a,r,{ref:t}))}),nte=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Hee,W({},a,r,{ref:t}))}),rte=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Vee,W({},a,r,{ref:t}))}),ate=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(qee,W({},a,r,{ref:t}))}),ote=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Gee,W({},a,r,{ref:t}))}),ite=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Wee,W({},a,r,{ref:t}))}),ste=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,a=Ga(n);return p.createElement(Kee,W({},a,r,{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)"}}))}),lte=Xee,I7=Jee,O7=ete,D7=tte,L7=nte,M7=rte,P7=ate,$7=ote,F7=ite,j7=ste,cte=p.forwardRef(({className:e,inset:t,children:n,...r},a)=>f.jsxs(F7,{ref:a,className:ee("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,f.jsx(Pm,{className:"ml-auto h-4 w-4"})]}));cte.displayName=F7.displayName;const ute=p.forwardRef(({className:e,...t},n)=>f.jsx(j7,{ref:n,className:ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",e),...t}));ute.displayName=j7.displayName;const dte=p.forwardRef(({className:e,sideOffset:t=4,...n},r)=>f.jsx(lte,{children:f.jsx(I7,{ref:r,sideOffset:t,className:ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md 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",e),...n})}));dte.displayName=I7.displayName;const fte=p.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(D7,{ref:r,className:ee("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...n}));fte.displayName=D7.displayName;const pte=p.forwardRef(({className:e,children:t,checked:n,...r},a)=>f.jsxs(L7,{ref:a,className:ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(P7,{children:f.jsx(Mm,{className:"h-4 w-4"})})}),t]}));pte.displayName=L7.displayName;const gte=p.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(M7,{ref:r,className:ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(P7,{children:f.jsx(QF,{className:"h-2 w-2 fill-current"})})}),t]}));gte.displayName=M7.displayName;const mte=p.forwardRef(({className:e,inset:t,...n},r)=>f.jsx(O7,{ref:r,className:ee("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));mte.displayName=O7.displayName;const hte=p.forwardRef(({className:e,...t},n)=>f.jsx($7,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",e),...t}));hte.displayName=$7.displayName;function P2(e,[t,n]){return Math.min(n,Math.max(t,e))}function F_(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}const bte=[" ","Enter","ArrowUp","ArrowDown"],yte=[" ","Enter"],lh="Select",[ch,j_,vte]=Rm(lh),[Fc,vTe]=zn(lh,[vte,qa]),z_=qa(),[Ste,zs]=Fc(lh),[wte,Ete]=Fc(lh),xte=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:o,value:i,defaultValue:s,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:g,required:m}=e,y=z_(t),[b,w]=p.useState(null),[v,h]=p.useState(null),[S,E]=p.useState(!1),k=x_(c),[x=!1,C]=Fa({prop:r,defaultProp:a,onChange:o}),[_,T]=Fa({prop:i,defaultProp:s,onChange:l}),R=p.useRef(null),L=b?!!b.closest("form"):!0,[D,H]=p.useState(new Set),z=Array.from(D).map(M=>M.props.value).join(";");return p.createElement(rh,y,p.createElement(Ste,{required:m,scope:t,trigger:b,onTriggerChange:w,valueNode:v,onValueNodeChange:h,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:bi(),value:_,onValueChange:T,open:x,onOpenChange:C,dir:k,triggerPointerDownPosRef:R,disabled:g},p.createElement(ch.Provider,{scope:t},p.createElement(wte,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(M=>{H(U=>new Set(U).add(M))},[]),onNativeOptionRemove:p.useCallback(M=>{H(U=>{const X=new Set(U);return X.delete(M),X})},[])},n)),L?p.createElement(H7,{key:z,"aria-hidden":!0,required:m,tabIndex:-1,name:u,autoComplete:d,value:_,onChange:M=>T(M.target.value),disabled:g},_===void 0?p.createElement("option",{value:""}):null,Array.from(D)):null))},kte="SelectTrigger",Cte=p.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,o=z_(n),i=zs(kte,n),s=i.disabled||r,l=rt(t,i.onTriggerChange),c=j_(n),[u,d,g]=V7(y=>{const b=c().filter(h=>!h.disabled),w=b.find(h=>h.value===i.value),v=q7(b,y,w);v!==void 0&&i.onValueChange(v.value)}),m=()=>{s||(i.onOpenChange(!0),g())};return p.createElement(ff,W({asChild:!0},o),p.createElement(ze.button,W({type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":B7(i.value)?"":void 0},a,{ref:l,onClick:fe(a.onClick,y=>{y.currentTarget.focus()}),onPointerDown:fe(a.onPointerDown,y=>{const b=y.target;b.hasPointerCapture(y.pointerId)&&b.releasePointerCapture(y.pointerId),y.button===0&&y.ctrlKey===!1&&(m(),i.triggerPointerDownPosRef.current={x:Math.round(y.pageX),y:Math.round(y.pageY)},y.preventDefault())}),onKeyDown:fe(a.onKeyDown,y=>{const b=u.current!=="";!(y.ctrlKey||y.altKey||y.metaKey)&&y.key.length===1&&d(y.key),!(b&&y.key===" ")&&bte.includes(y.key)&&(m(),y.preventDefault())})})))}),_te="SelectValue",Ate=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:o,placeholder:i="",...s}=e,l=zs(_te,n),{onValueNodeHasChildrenChange:c}=l,u=o!==void 0,d=rt(t,l.onValueNodeChange);return Zr(()=>{c(u)},[c,u]),p.createElement(ze.span,W({},s,{ref:d,style:{pointerEvents:"none"}}),B7(l.value)?p.createElement(p.Fragment,null,i):o)}),Tte=p.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return p.createElement(ze.span,W({"aria-hidden":!0},a,{ref:t}),r||"▼")}),Rte=e=>p.createElement(Qd,W({asChild:!0},e)),vc="SelectContent",Nte=p.forwardRef((e,t)=>{const n=zs(vc,e.__scopeSelect),[r,a]=p.useState();if(Zr(()=>{a(new DocumentFragment)},[]),!n.open){const o=r;return o?ba.createPortal(p.createElement(z7,{scope:e.__scopeSelect},p.createElement(ch.Slot,{scope:e.__scopeSelect},p.createElement("div",null,e.children))),o):null}return p.createElement(Ite,W({},e,{ref:t}))}),ro=10,[z7,uh]=Fc(vc),Ite=p.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:i,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:y,hideWhenDetached:b,avoidCollisions:w,...v}=e,h=zs(vc,n),[S,E]=p.useState(null),[k,x]=p.useState(null),C=rt(t,Q=>E(Q)),[_,T]=p.useState(null),[R,L]=p.useState(null),D=j_(n),[H,z]=p.useState(!1),M=p.useRef(!1);p.useEffect(()=>{if(S)return gf(S)},[S]),Jm();const U=p.useCallback(Q=>{const[pe,...he]=D().map(ke=>ke.ref.current),[re]=he.slice(-1),Ee=document.activeElement;for(const ke of Q)if(ke===Ee||(ke==null||ke.scrollIntoView({block:"nearest"}),ke===pe&&k&&(k.scrollTop=0),ke===re&&k&&(k.scrollTop=k.scrollHeight),ke==null||ke.focus(),document.activeElement!==Ee))return},[D,k]),X=p.useCallback(()=>U([_,S]),[U,_,S]);p.useEffect(()=>{H&&X()},[H,X]);const{onOpenChange:j,triggerPointerDownPosRef:O}=h;p.useEffect(()=>{if(S){let Q={x:0,y:0};const pe=re=>{var Ee,ke,We,Ht;Q={x:Math.abs(Math.round(re.pageX)-((Ee=(ke=O.current)===null||ke===void 0?void 0:ke.x)!==null&&Ee!==void 0?Ee:0)),y:Math.abs(Math.round(re.pageY)-((We=(Ht=O.current)===null||Ht===void 0?void 0:Ht.y)!==null&&We!==void 0?We:0))}},he=re=>{Q.x<=10&&Q.y<=10?re.preventDefault():S.contains(re.target)||j(!1),document.removeEventListener("pointermove",pe),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",pe),document.addEventListener("pointerup",he,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",pe),document.removeEventListener("pointerup",he,{capture:!0})}}},[S,j,O]),p.useEffect(()=>{const Q=()=>j(!1);return window.addEventListener("blur",Q),window.addEventListener("resize",Q),()=>{window.removeEventListener("blur",Q),window.removeEventListener("resize",Q)}},[j]);const[A,V]=V7(Q=>{const pe=D().filter(Ee=>!Ee.disabled),he=pe.find(Ee=>Ee.ref.current===document.activeElement),re=q7(pe,Q,he);re&&setTimeout(()=>re.ref.current.focus())}),P=p.useCallback((Q,pe,he)=>{const re=!M.current&&!he;(h.value!==void 0&&h.value===pe||re)&&(T(Q),re&&(M.current=!0))},[h.value]),N=p.useCallback(()=>S==null?void 0:S.focus(),[S]),K=p.useCallback((Q,pe,he)=>{const re=!M.current&&!he;(h.value!==void 0&&h.value===pe||re)&&L(Q)},[h.value]),ae=r==="popper"?$2:Ote,ne=ae===$2?{side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:g,collisionPadding:m,sticky:y,hideWhenDetached:b,avoidCollisions:w}:{};return p.createElement(z7,{scope:n,content:S,viewport:k,onViewportChange:x,itemRefCallback:P,selectedItem:_,onItemLeave:N,itemTextRefCallback:K,focusSelectedItem:X,selectedItemText:R,position:r,isPositioned:H,searchRef:A},p.createElement(ih,{as:$a,allowPinchZoom:!0},p.createElement(eh,{asChild:!0,trapped:h.open,onMountAutoFocus:Q=>{Q.preventDefault()},onUnmountAutoFocus:fe(a,Q=>{var pe;(pe=h.trigger)===null||pe===void 0||pe.focus({preventScroll:!0}),Q.preventDefault()})},p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:i,onFocusOutside:Q=>Q.preventDefault(),onDismiss:()=>h.onOpenChange(!1)},p.createElement(ae,W({role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:Q=>Q.preventDefault()},v,ne,{onPlaced:()=>z(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:fe(v.onKeyDown,Q=>{const pe=Q.ctrlKey||Q.altKey||Q.metaKey;if(Q.key==="Tab"&&Q.preventDefault(),!pe&&Q.key.length===1&&V(Q.key),["ArrowUp","ArrowDown","Home","End"].includes(Q.key)){let re=D().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(Q.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(Q.key)){const Ee=Q.target,ke=re.indexOf(Ee);re=re.slice(ke+1)}setTimeout(()=>U(re)),Q.preventDefault()}})}))))))}),Ote=p.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,o=zs(vc,n),i=uh(vc,n),[s,l]=p.useState(null),[c,u]=p.useState(null),d=rt(t,C=>u(C)),g=j_(n),m=p.useRef(!1),y=p.useRef(!0),{viewport:b,selectedItem:w,selectedItemText:v,focusSelectedItem:h}=i,S=p.useCallback(()=>{if(o.trigger&&o.valueNode&&s&&c&&b&&w&&v){const C=o.trigger.getBoundingClientRect(),_=c.getBoundingClientRect(),T=o.valueNode.getBoundingClientRect(),R=v.getBoundingClientRect();if(o.dir!=="rtl"){const Ee=R.left-_.left,ke=T.left-Ee,We=C.left-ke,Ht=C.width+We,mt=Math.max(Ht,_.width),Hn=window.innerWidth-ro,F=P2(ke,[ro,Hn-mt]);s.style.minWidth=Ht+"px",s.style.left=F+"px"}else{const Ee=_.right-R.right,ke=window.innerWidth-T.right-Ee,We=window.innerWidth-C.right-ke,Ht=C.width+We,mt=Math.max(Ht,_.width),Hn=window.innerWidth-ro,F=P2(ke,[ro,Hn-mt]);s.style.minWidth=Ht+"px",s.style.right=F+"px"}const L=g(),D=window.innerHeight-ro*2,H=b.scrollHeight,z=window.getComputedStyle(c),M=parseInt(z.borderTopWidth,10),U=parseInt(z.paddingTop,10),X=parseInt(z.borderBottomWidth,10),j=parseInt(z.paddingBottom,10),O=M+U+H+j+X,A=Math.min(w.offsetHeight*5,O),V=window.getComputedStyle(b),P=parseInt(V.paddingTop,10),N=parseInt(V.paddingBottom,10),K=C.top+C.height/2-ro,ae=D-K,ne=w.offsetHeight/2,Q=w.offsetTop+ne,pe=M+U+Q,he=O-pe;if(pe<=K){const Ee=w===L[L.length-1].ref.current;s.style.bottom="0px";const ke=c.clientHeight-b.offsetTop-b.offsetHeight,We=Math.max(ae,ne+(Ee?N:0)+ke+X),Ht=pe+We;s.style.height=Ht+"px"}else{const Ee=w===L[0].ref.current;s.style.top="0px";const We=Math.max(K,M+b.offsetTop+(Ee?P:0)+ne)+he;s.style.height=We+"px",b.scrollTop=pe-K+b.offsetTop}s.style.margin=`${ro}px 0`,s.style.minHeight=A+"px",s.style.maxHeight=D+"px",r==null||r(),requestAnimationFrame(()=>m.current=!0)}},[g,o.trigger,o.valueNode,s,c,b,w,v,o.dir,r]);Zr(()=>S(),[S]);const[E,k]=p.useState();Zr(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const x=p.useCallback(C=>{C&&y.current===!0&&(S(),h==null||h(),y.current=!1)},[S,h]);return p.createElement(Dte,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:m,onScrollButtonChange:x},p.createElement("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E}},p.createElement(ze.div,W({},a,{ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}}))))}),$2=p.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=ro,...o}=e,i=z_(n);return p.createElement(pf,W({},i,o,{ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}}))}),[Dte,Lte]=Fc(vc,{}),F2="SelectViewport",Mte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=uh(F2,n),o=Lte(F2,n),i=rt(t,a.onViewportChange),s=p.useRef(0);return p.createElement(p.Fragment,null,p.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"}}),p.createElement(ch.Slot,{scope:n},p.createElement(ze.div,W({"data-radix-select-viewport":"",role:"presentation"},r,{ref:i,style:{position:"relative",flex:1,overflow:"auto",...r.style},onScroll:fe(r.onScroll,l=>{const c=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:d}=o;if(d!=null&&d.current&&u){const g=Math.abs(s.current-c.scrollTop);if(g>0){const m=window.innerHeight-ro*2,y=parseFloat(u.style.minHeight),b=parseFloat(u.style.height),w=Math.max(y,b);if(w0?S:0,u.style.justifyContent="flex-end")}}}s.current=c.scrollTop})}))))}),Pte="SelectGroup",[STe,$te]=Fc(Pte),Fte="SelectLabel",jte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=$te(Fte,n);return p.createElement(ze.div,W({id:a.id},r,{ref:t}))}),ok="SelectItem",[zte,U7]=Fc(ok),Ute=p.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:o,...i}=e,s=zs(ok,n),l=uh(ok,n),c=s.value===r,[u,d]=p.useState(o??""),[g,m]=p.useState(!1),y=rt(t,v=>{var h;return(h=l.itemRefCallback)===null||h===void 0?void 0:h.call(l,v,r,a)}),b=bi(),w=()=>{a||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.createElement(zte,{scope:n,value:r,disabled:a,textId:b,isSelected:c,onItemTextChange:p.useCallback(v=>{d(h=>{var S;return h||((S=v==null?void 0:v.textContent)!==null&&S!==void 0?S:"").trim()})},[])},p.createElement(ch.ItemSlot,{scope:n,value:r,disabled:a,textValue:u},p.createElement(ze.div,W({role:"option","aria-labelledby":b,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1},i,{ref:y,onFocus:fe(i.onFocus,()=>m(!0)),onBlur:fe(i.onBlur,()=>m(!1)),onPointerUp:fe(i.onPointerUp,w),onPointerMove:fe(i.onPointerMove,v=>{if(a){var h;(h=l.onItemLeave)===null||h===void 0||h.call(l)}else v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:fe(i.onPointerLeave,v=>{if(v.currentTarget===document.activeElement){var h;(h=l.onItemLeave)===null||h===void 0||h.call(l)}}),onKeyDown:fe(i.onKeyDown,v=>{var h;((h=l.searchRef)===null||h===void 0?void 0:h.current)!==""&&v.key===" "||(yte.includes(v.key)&&w(),v.key===" "&&v.preventDefault())})}))))}),op="SelectItemText",Bte=p.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...o}=e,i=zs(op,n),s=uh(op,n),l=U7(op,n),c=Ete(op,n),[u,d]=p.useState(null),g=rt(t,v=>d(v),l.onItemTextChange,v=>{var h;return(h=s.itemTextRefCallback)===null||h===void 0?void 0:h.call(s,v,l.value,l.disabled)}),m=u==null?void 0:u.textContent,y=p.useMemo(()=>p.createElement("option",{key:l.value,value:l.value,disabled:l.disabled},m),[l.disabled,l.value,m]),{onNativeOptionAdd:b,onNativeOptionRemove:w}=c;return Zr(()=>(b(y),()=>w(y)),[b,w,y]),p.createElement(p.Fragment,null,p.createElement(ze.span,W({id:l.textId},o,{ref:g})),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?ba.createPortal(o.children,i.valueNode):null)}),Hte="SelectItemIndicator",Vte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return U7(Hte,n).isSelected?p.createElement(ze.span,W({"aria-hidden":!0},r,{ref:t})):null}),qte=p.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.createElement(ze.div,W({"aria-hidden":!0},r,{ref:t}))});function B7(e){return e===""||e===void 0}const H7=p.forwardRef((e,t)=>{const{value:n,...r}=e,a=p.useRef(null),o=rt(t,a),i=F_(n);return p.useEffect(()=>{const s=a.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&u){const d=new Event("change",{bubbles:!0});u.call(s,n),s.dispatchEvent(d)}},[i,n]),p.createElement(Nm,{asChild:!0},p.createElement("select",W({},r,{ref:o,defaultValue:n})))});H7.displayName="BubbleSelect";function V7(e){const t=ur(e),n=p.useRef(""),r=p.useRef(0),a=p.useCallback(i=>{const s=n.current+i;t(s),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(s)},[t]),o=p.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,o]}function q7(e,t,n){const a=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let i=Gte(e,Math.max(o,0));a.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(a.toLowerCase()));return l!==n?l:void 0}function Gte(e,t){return e.map((n,r)=>e[(t+r)%e.length])}const Wte=xte,G7=Cte,Kte=Ate,Yte=Tte,Zte=Rte,W7=Nte,Xte=Mte,K7=jte,Y7=Ute,Qte=Bte,Jte=Vte,Z7=qte,So=Wte,wo=Kte,za=p.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(G7,{ref:r,className:ee("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:[t,f.jsx(Yte,{asChild:!0,children:f.jsx(YC,{className:"h-4 w-4 opacity-50"})})]}));za.displayName=G7.displayName;const Ua=p.forwardRef(({className:e,children:t,position:n="popper",...r},a)=>f.jsx(Zte,{children:f.jsx(W7,{ref:a,className:ee("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:f.jsx(Xte,{className:ee("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t})})}));Ua.displayName=W7.displayName;const ene=p.forwardRef(({className:e,...t},n)=>f.jsx(K7,{ref:n,className:ee("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ene.displayName=K7.displayName;const Fn=p.forwardRef(({className:e,children:t,...n},r)=>f.jsxs(Y7,{ref:r,className:ee("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[f.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:f.jsx(Jte,{children:f.jsx(Mm,{className:"h-4 w-4"})})}),f.jsx(Qte,{children:t})]}));Fn.displayName=Y7.displayName;const tne=p.forwardRef(({className:e,...t},n)=>f.jsx(Z7,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",e),...t}));tne.displayName=Z7.displayName;function Ts(e){"@babel/helpers - typeof";return Ts=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(e)}function _i(e){if(e===null||e===!0||e===!1)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}function Un(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}function Wa(e){Un(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||Ts(e)==="object"&&t==="[object Date]"?new Date(e.getTime()):typeof e=="number"||t==="[object Number]"?new Date(e):((typeof e=="string"||t==="[object String]")&&typeof console<"u"&&(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments"),console.warn(new Error().stack)),new Date(NaN))}function nne(e,t){Un(2,arguments);var n=Wa(e).getTime(),r=_i(t);return new Date(n+r)}var rne={};function dh(){return rne}function ane(e){var t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),e.getTime()-t.getTime()}var X7=6e4,Q7=36e5;function one(e){return Un(1,arguments),e instanceof Date||Ts(e)==="object"&&Object.prototype.toString.call(e)==="[object Date]"}function ine(e){if(Un(1,arguments),!one(e)&&typeof e!="number")return!1;var t=Wa(e);return!isNaN(Number(t))}function sne(e,t){Un(2,arguments);var n=_i(t);return nne(e,-n)}var lne=864e5;function cne(e){Un(1,arguments);var t=Wa(e),n=t.getTime();t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0);var r=t.getTime(),a=n-r;return Math.floor(a/lne)+1}function Pg(e){Un(1,arguments);var t=1,n=Wa(e),r=n.getUTCDay(),a=(r=a.getTime()?n+1:t.getTime()>=i.getTime()?n:n-1}function une(e){Un(1,arguments);var t=J7(e),n=new Date(0);n.setUTCFullYear(t,0,4),n.setUTCHours(0,0,0,0);var r=Pg(n);return r}var dne=6048e5;function fne(e){Un(1,arguments);var t=Wa(e),n=Pg(t).getTime()-une(t).getTime();return Math.round(n/dne)+1}function $g(e,t){var n,r,a,o,i,s,l,c;Un(1,arguments);var u=dh(),d=_i((n=(r=(a=(o=t==null?void 0:t.weekStartsOn)!==null&&o!==void 0?o:t==null||(i=t.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.weekStartsOn)!==null&&a!==void 0?a:u.weekStartsOn)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.weekStartsOn)!==null&&n!==void 0?n:0);if(!(d>=0&&d<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var g=Wa(e),m=g.getUTCDay(),y=(m=1&&m<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var y=new Date(0);y.setUTCFullYear(d+1,0,m),y.setUTCHours(0,0,0,0);var b=$g(y,t),w=new Date(0);w.setUTCFullYear(d,0,m),w.setUTCHours(0,0,0,0);var v=$g(w,t);return u.getTime()>=b.getTime()?d+1:u.getTime()>=v.getTime()?d:d-1}function pne(e,t){var n,r,a,o,i,s,l,c;Un(1,arguments);var u=dh(),d=_i((n=(r=(a=(o=t==null?void 0:t.firstWeekContainsDate)!==null&&o!==void 0?o:t==null||(i=t.locale)===null||i===void 0||(s=i.options)===null||s===void 0?void 0:s.firstWeekContainsDate)!==null&&a!==void 0?a:u.firstWeekContainsDate)!==null&&r!==void 0?r:(l=u.locale)===null||l===void 0||(c=l.options)===null||c===void 0?void 0:c.firstWeekContainsDate)!==null&&n!==void 0?n:1),g=e8(e,t),m=new Date(0);m.setUTCFullYear(g,0,d),m.setUTCHours(0,0,0,0);var y=$g(m,t);return y}var gne=6048e5;function mne(e,t){Un(1,arguments);var n=Wa(e),r=$g(n,t).getTime()-pne(n,t).getTime();return Math.round(r/gne)+1}function bt(e,t){for(var n=e<0?"-":"",r=Math.abs(e).toString();r.length0?r:1-r;return bt(n==="yy"?a%100:a,n.length)},M:function(t,n){var r=t.getUTCMonth();return n==="M"?String(r+1):bt(r+1,2)},d:function(t,n){return bt(t.getUTCDate(),n.length)},a:function(t,n){var r=t.getUTCHours()/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h:function(t,n){return bt(t.getUTCHours()%12||12,n.length)},H:function(t,n){return bt(t.getUTCHours(),n.length)},m:function(t,n){return bt(t.getUTCMinutes(),n.length)},s:function(t,n){return bt(t.getUTCSeconds(),n.length)},S:function(t,n){var r=n.length,a=t.getUTCMilliseconds(),o=Math.floor(a*Math.pow(10,r-3));return bt(o,n.length)}};const Po=hne;var el={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},bne={G:function(t,n,r){var a=t.getUTCFullYear()>0?1:0;switch(n){case"G":case"GG":case"GGG":return r.era(a,{width:"abbreviated"});case"GGGGG":return r.era(a,{width:"narrow"});case"GGGG":default:return r.era(a,{width:"wide"})}},y:function(t,n,r){if(n==="yo"){var a=t.getUTCFullYear(),o=a>0?a:1-a;return r.ordinalNumber(o,{unit:"year"})}return Po.y(t,n)},Y:function(t,n,r,a){var o=e8(t,a),i=o>0?o:1-o;if(n==="YY"){var s=i%100;return bt(s,2)}return n==="Yo"?r.ordinalNumber(i,{unit:"year"}):bt(i,n.length)},R:function(t,n){var r=J7(t);return bt(r,n.length)},u:function(t,n){var r=t.getUTCFullYear();return bt(r,n.length)},Q:function(t,n,r){var a=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"Q":return String(a);case"QQ":return bt(a,2);case"Qo":return r.ordinalNumber(a,{unit:"quarter"});case"QQQ":return r.quarter(a,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(a,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(a,{width:"wide",context:"formatting"})}},q:function(t,n,r){var a=Math.ceil((t.getUTCMonth()+1)/3);switch(n){case"q":return String(a);case"qq":return bt(a,2);case"qo":return r.ordinalNumber(a,{unit:"quarter"});case"qqq":return r.quarter(a,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(a,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(a,{width:"wide",context:"standalone"})}},M:function(t,n,r){var a=t.getUTCMonth();switch(n){case"M":case"MM":return Po.M(t,n);case"Mo":return r.ordinalNumber(a+1,{unit:"month"});case"MMM":return r.month(a,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(a,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(a,{width:"wide",context:"formatting"})}},L:function(t,n,r){var a=t.getUTCMonth();switch(n){case"L":return String(a+1);case"LL":return bt(a+1,2);case"Lo":return r.ordinalNumber(a+1,{unit:"month"});case"LLL":return r.month(a,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(a,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(a,{width:"wide",context:"standalone"})}},w:function(t,n,r,a){var o=mne(t,a);return n==="wo"?r.ordinalNumber(o,{unit:"week"}):bt(o,n.length)},I:function(t,n,r){var a=fne(t);return n==="Io"?r.ordinalNumber(a,{unit:"week"}):bt(a,n.length)},d:function(t,n,r){return n==="do"?r.ordinalNumber(t.getUTCDate(),{unit:"date"}):Po.d(t,n)},D:function(t,n,r){var a=cne(t);return n==="Do"?r.ordinalNumber(a,{unit:"dayOfYear"}):bt(a,n.length)},E:function(t,n,r){var a=t.getUTCDay();switch(n){case"E":case"EE":case"EEE":return r.day(a,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(a,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(a,{width:"short",context:"formatting"});case"EEEE":default:return r.day(a,{width:"wide",context:"formatting"})}},e:function(t,n,r,a){var o=t.getUTCDay(),i=(o-a.weekStartsOn+8)%7||7;switch(n){case"e":return String(i);case"ee":return bt(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(o,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(o,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(o,{width:"short",context:"formatting"});case"eeee":default:return r.day(o,{width:"wide",context:"formatting"})}},c:function(t,n,r,a){var o=t.getUTCDay(),i=(o-a.weekStartsOn+8)%7||7;switch(n){case"c":return String(i);case"cc":return bt(i,n.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(o,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(o,{width:"narrow",context:"standalone"});case"cccccc":return r.day(o,{width:"short",context:"standalone"});case"cccc":default:return r.day(o,{width:"wide",context:"standalone"})}},i:function(t,n,r){var a=t.getUTCDay(),o=a===0?7:a;switch(n){case"i":return String(o);case"ii":return bt(o,n.length);case"io":return r.ordinalNumber(o,{unit:"day"});case"iii":return r.day(a,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(a,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(a,{width:"short",context:"formatting"});case"iiii":default:return r.day(a,{width:"wide",context:"formatting"})}},a:function(t,n,r){var a=t.getUTCHours(),o=a/12>=1?"pm":"am";switch(n){case"a":case"aa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},b:function(t,n,r){var a=t.getUTCHours(),o;switch(a===12?o=el.noon:a===0?o=el.midnight:o=a/12>=1?"pm":"am",n){case"b":case"bb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},B:function(t,n,r){var a=t.getUTCHours(),o;switch(a>=17?o=el.evening:a>=12?o=el.afternoon:a>=4?o=el.morning:o=el.night,n){case"B":case"BB":case"BBB":return r.dayPeriod(o,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(o,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(o,{width:"wide",context:"formatting"})}},h:function(t,n,r){if(n==="ho"){var a=t.getUTCHours()%12;return a===0&&(a=12),r.ordinalNumber(a,{unit:"hour"})}return Po.h(t,n)},H:function(t,n,r){return n==="Ho"?r.ordinalNumber(t.getUTCHours(),{unit:"hour"}):Po.H(t,n)},K:function(t,n,r){var a=t.getUTCHours()%12;return n==="Ko"?r.ordinalNumber(a,{unit:"hour"}):bt(a,n.length)},k:function(t,n,r){var a=t.getUTCHours();return a===0&&(a=24),n==="ko"?r.ordinalNumber(a,{unit:"hour"}):bt(a,n.length)},m:function(t,n,r){return n==="mo"?r.ordinalNumber(t.getUTCMinutes(),{unit:"minute"}):Po.m(t,n)},s:function(t,n,r){return n==="so"?r.ordinalNumber(t.getUTCSeconds(),{unit:"second"}):Po.s(t,n)},S:function(t,n){return Po.S(t,n)},X:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();if(i===0)return"Z";switch(n){case"X":return z2(i);case"XXXX":case"XX":return Ki(i);case"XXXXX":case"XXX":default:return Ki(i,":")}},x:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();switch(n){case"x":return z2(i);case"xxxx":case"xx":return Ki(i);case"xxxxx":case"xxx":default:return Ki(i,":")}},O:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();switch(n){case"O":case"OO":case"OOO":return"GMT"+j2(i,":");case"OOOO":default:return"GMT"+Ki(i,":")}},z:function(t,n,r,a){var o=a._originalDate||t,i=o.getTimezoneOffset();switch(n){case"z":case"zz":case"zzz":return"GMT"+j2(i,":");case"zzzz":default:return"GMT"+Ki(i,":")}},t:function(t,n,r,a){var o=a._originalDate||t,i=Math.floor(o.getTime()/1e3);return bt(i,n.length)},T:function(t,n,r,a){var o=a._originalDate||t,i=o.getTime();return bt(i,n.length)}};function j2(e,t){var n=e>0?"-":"+",r=Math.abs(e),a=Math.floor(r/60),o=r%60;if(o===0)return n+String(a);var i=t||"";return n+String(a)+i+bt(o,2)}function z2(e,t){if(e%60===0){var n=e>0?"-":"+";return n+bt(Math.abs(e)/60,2)}return Ki(e,t)}function Ki(e,t){var n=t||"",r=e>0?"-":"+",a=Math.abs(e),o=bt(Math.floor(a/60),2),i=bt(a%60,2);return r+o+n+i}const yne=bne;var U2=function(t,n){switch(t){case"P":return n.date({width:"short"});case"PP":return n.date({width:"medium"});case"PPP":return n.date({width:"long"});case"PPPP":default:return n.date({width:"full"})}},t8=function(t,n){switch(t){case"p":return n.time({width:"short"});case"pp":return n.time({width:"medium"});case"ppp":return n.time({width:"long"});case"pppp":default:return n.time({width:"full"})}},vne=function(t,n){var r=t.match(/(P+)(p+)?/)||[],a=r[1],o=r[2];if(!o)return U2(t,n);var i;switch(a){case"P":i=n.dateTime({width:"short"});break;case"PP":i=n.dateTime({width:"medium"});break;case"PPP":i=n.dateTime({width:"long"});break;case"PPPP":default:i=n.dateTime({width:"full"});break}return i.replace("{{date}}",U2(a,n)).replace("{{time}}",t8(o,n))},Sne={p:t8,P:vne};const wne=Sne;var Ene=["D","DD"],xne=["YY","YYYY"];function kne(e){return Ene.indexOf(e)!==-1}function Cne(e){return xne.indexOf(e)!==-1}function B2(e,t,n){if(e==="YYYY")throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="YY")throw new RangeError("Use `yy` instead of `YY` (in `".concat(t,"`) for formatting years to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="D")throw new RangeError("Use `d` instead of `D` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));if(e==="DD")throw new RangeError("Use `dd` instead of `DD` (in `".concat(t,"`) for formatting days of the month to the input `").concat(n,"`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"))}var _ne={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Ane=function(t,n,r){var a,o=_ne[t];return typeof o=="string"?a=o:n===1?a=o.one:a=o.other.replace("{{count}}",n.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+a:a+" ago":a};const Tne=Ane;function Vb(e){return function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var Rne={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Nne={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Ine={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},One={date:Vb({formats:Rne,defaultWidth:"full"}),time:Vb({formats:Nne,defaultWidth:"full"}),dateTime:Vb({formats:Ine,defaultWidth:"full"})};const Dne=One;var Lne={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Mne=function(t,n,r,a){return Lne[t]};const Pne=Mne;function cu(e){return function(t,n){var r=n!=null&&n.context?String(n.context):"standalone",a;if(r==="formatting"&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,i=n!=null&&n.width?String(n.width):o;a=e.formattingValues[i]||e.formattingValues[o]}else{var s=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[s]}var c=e.argumentCallback?e.argumentCallback(t):t;return a[c]}}var $ne={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Fne={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},jne={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},zne={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Une={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Bne={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Hne=function(t,n){var r=Number(t),a=r%100;if(a>20||a<10)switch(a%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Vne={ordinalNumber:Hne,era:cu({values:$ne,defaultWidth:"wide"}),quarter:cu({values:Fne,defaultWidth:"wide",argumentCallback:function(t){return t-1}}),month:cu({values:jne,defaultWidth:"wide"}),day:cu({values:zne,defaultWidth:"wide"}),dayPeriod:cu({values:Une,defaultWidth:"wide",formattingValues:Bne,defaultFormattingWidth:"wide"})};const qne=Vne;function uu(e){return function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;var i=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(s)?Wne(s,function(d){return d.test(i)}):Gne(s,function(d){return d.test(i)}),c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;var u=t.slice(i.length);return{value:c,rest:u}}}function Gne(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function Wne(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=t.match(e.matchPattern);if(!r)return null;var a=r[0],o=t.match(e.parsePattern);if(!o)return null;var i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;var s=t.slice(a.length);return{value:i,rest:s}}}var Yne=/^(\d+)(th|st|nd|rd)?/i,Zne=/\d+/i,Xne={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Qne={any:[/^b/i,/^(a|c)/i]},Jne={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},ere={any:[/1/i,/2/i,/3/i,/4/i]},tre={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},nre={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},rre={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},are={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ore={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ire={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},sre={ordinalNumber:Kne({matchPattern:Yne,parsePattern:Zne,valueCallback:function(t){return parseInt(t,10)}}),era:uu({matchPatterns:Xne,defaultMatchWidth:"wide",parsePatterns:Qne,defaultParseWidth:"any"}),quarter:uu({matchPatterns:Jne,defaultMatchWidth:"wide",parsePatterns:ere,defaultParseWidth:"any",valueCallback:function(t){return t+1}}),month:uu({matchPatterns:tre,defaultMatchWidth:"wide",parsePatterns:nre,defaultParseWidth:"any"}),day:uu({matchPatterns:rre,defaultMatchWidth:"wide",parsePatterns:are,defaultParseWidth:"any"}),dayPeriod:uu({matchPatterns:ore,defaultMatchWidth:"any",parsePatterns:ire,defaultParseWidth:"any"})};const lre=sre;var cre={code:"en-US",formatDistance:Tne,formatLong:Dne,formatRelative:Pne,localize:qne,match:lre,options:{weekStartsOn:0,firstWeekContainsDate:1}};const ure=cre;var dre=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,fre=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,pre=/^'([^]*?)'?$/,gre=/''/g,mre=/[a-zA-Z]/;function Us(e,t,n){var r,a,o,i,s,l,c,u,d,g,m,y,b,w,v,h,S,E;Un(2,arguments);var k=String(t),x=dh(),C=(r=(a=n==null?void 0:n.locale)!==null&&a!==void 0?a:x.locale)!==null&&r!==void 0?r:ure,_=_i((o=(i=(s=(l=n==null?void 0:n.firstWeekContainsDate)!==null&&l!==void 0?l:n==null||(c=n.locale)===null||c===void 0||(u=c.options)===null||u===void 0?void 0:u.firstWeekContainsDate)!==null&&s!==void 0?s:x.firstWeekContainsDate)!==null&&i!==void 0?i:(d=x.locale)===null||d===void 0||(g=d.options)===null||g===void 0?void 0:g.firstWeekContainsDate)!==null&&o!==void 0?o:1);if(!(_>=1&&_<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var T=_i((m=(y=(b=(w=n==null?void 0:n.weekStartsOn)!==null&&w!==void 0?w:n==null||(v=n.locale)===null||v===void 0||(h=v.options)===null||h===void 0?void 0:h.weekStartsOn)!==null&&b!==void 0?b:x.weekStartsOn)!==null&&y!==void 0?y:(S=x.locale)===null||S===void 0||(E=S.options)===null||E===void 0?void 0:E.weekStartsOn)!==null&&m!==void 0?m:0);if(!(T>=0&&T<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");if(!C.localize)throw new RangeError("locale must contain localize property");if(!C.formatLong)throw new RangeError("locale must contain formatLong property");var R=Wa(e);if(!ine(R))throw new RangeError("Invalid time value");var L=ane(R),D=sne(R,L),H={firstWeekContainsDate:_,weekStartsOn:T,locale:C,_originalDate:R},z=k.match(fre).map(function(M){var U=M[0];if(U==="p"||U==="P"){var X=wne[U];return X(M,C.formatLong)}return M}).join("").match(dre).map(function(M){if(M==="''")return"'";var U=M[0];if(U==="'")return hre(M);var X=yne[U];if(X)return!(n!=null&&n.useAdditionalWeekYearTokens)&&Cne(M)&&B2(M,t,String(e)),!(n!=null&&n.useAdditionalDayOfYearTokens)&&kne(M)&&B2(M,t,String(e)),X(D,M,C.localize,H);if(U.match(mre))throw new RangeError("Format string contains an unescaped latin alphabet character `"+U+"`");return M}).join("");return z}function hre(e){var t=e.match(pre);return t?t[1].replace(gre,"'"):e}function ik(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n2)return t;if(/:/.test(n[0])?r=n[0]:(t.date=n[0],r=n[1],ip.timeZoneDelimiter.test(t.date)&&(t.date=e.split(ip.timeZoneDelimiter)[0],r=e.substr(t.date.length,e.length))),r){var a=ip.timezone.exec(r);a?(t.time=r.replace(a[1],""),t.timezone=a[1]):t.time=r}return t}function Cre(e,t){var n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),r=e.match(n);if(!r)return{year:NaN,restDateString:""};var a=r[1]?parseInt(r[1]):null,o=r[2]?parseInt(r[2]):null;return{year:o===null?a:o*100,restDateString:e.slice((r[1]||r[2]).length)}}function _re(e,t){if(t===null)return new Date(NaN);var n=e.match(wre);if(!n)return new Date(NaN);var r=!!n[4],a=du(n[1]),o=du(n[2])-1,i=du(n[3]),s=du(n[4]),l=du(n[5])-1;if(r)return Dre(t,s,l)?Rre(t,s,l):new Date(NaN);var c=new Date(0);return!Ire(t,o,i)||!Ore(t,a)?new Date(NaN):(c.setUTCFullYear(t,o,Math.max(a,i)),c)}function du(e){return e?parseInt(e):1}function Are(e){var t=e.match(Ere);if(!t)return NaN;var n=qb(t[1]),r=qb(t[2]),a=qb(t[3]);return Lre(n,r,a)?n*Q7+r*X7+a*1e3:NaN}function qb(e){return e&&parseFloat(e.replace(",","."))||0}function Tre(e){if(e==="Z")return 0;var t=e.match(xre);if(!t)return 0;var n=t[1]==="+"?-1:1,r=parseInt(t[2]),a=t[3]&&parseInt(t[3])||0;return Mre(r,a)?n*(r*Q7+a*X7):NaN}function Rre(e,t,n){var r=new Date(0);r.setUTCFullYear(e,0,4);var a=r.getUTCDay()||7,o=(t-1)*7+n+1-a;return r.setUTCDate(r.getUTCDate()+o),r}var Nre=[31,null,31,30,31,30,31,31,30,31,30,31];function r8(e){return e%400===0||e%4===0&&e%100!==0}function Ire(e,t,n){return t>=0&&t<=11&&n>=1&&n<=(Nre[t]||(r8(e)?29:28))}function Ore(e,t){return t>=1&&t<=(r8(e)?366:365)}function Dre(e,t,n){return t>=1&&t<=53&&n>=0&&n<=6}function Lre(e,t,n){return e===24?t===0&&n===0:n>=0&&n<60&&t>=0&&t<60&&e>=0&&e<25}function Mre(e,t){return t>=0&&t<=59}const Pre=(e,t,n="Never")=>{const r=e.getValue(t);return r?Us(new Date(r),"MMM dd, yyyy"):n},Dn=({isLoading:e,children:t})=>e?f.jsx(Pi,{className:"h-6 w-full"}):t,_n=p.forwardRef(({className:e,type:t,...n},r)=>f.jsx("input",{type:t,className:ee("flex h-10 w-full rounded-md border border-input bg-background-lighter px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));_n.displayName="Input";const $re=({value:e,onValueChange:t})=>f.jsx("form",{children:f.jsxs("div",{className:"relative",children:[f.jsx(Ms,{className:"pointer-events-none absolute left-[12px] top-3 h-4 w-4 text-muted-foreground"}),f.jsx(_n,{placeholder:"Search",value:e,onChange:n=>t(n.target.value),className:"w-52 pl-8 lg:w-80"})]})}),zi=({isLoading:e,children:t})=>e?f.jsx(Pi,{className:"h-6 w-full"}):t,H2=(e,t)=>{const n=e.getValue(t);return n?Us(new Date(n),"MMM dd, yyyy"):"Never"},Fre=(e,t)=>[{accessorKey:"name",header:"Agent Name",cell:({row:n})=>f.jsx(zi,{isLoading:t,children:n.getValue("name")})},{accessorFn:n=>{var r,a;return((a=(r=n.memory)==null?void 0:r.memory)==null?void 0:a.recall_memory)??0},accessorKey:"messages",header:()=>f.jsx(Yf,{children:f.jsx(xX,{className:"h-5 w-5"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:" text-center tabular-nums",children:n.getValue("messages")??0})})},{accessorFn:n=>{var r,a;return((a=(r=n.memory)==null?void 0:r.memory)==null?void 0:a.archival_memory)??0},accessorKey:"memories",header:()=>f.jsx(Yf,{children:f.jsx(EX,{className:"h-5 w-5"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:"text-center tabular-nums",children:n.getValue("memories")??0})})},{accessorFn:n=>0,accessorKey:"sources",header:()=>f.jsx(Yf,{children:f.jsx(kX,{className:"h-5 w-4"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:"text-center tabular-nums",children:n.getValue("sources")??0})})},{accessorFn:n=>n.tools.length,accessorKey:"tools",header:()=>f.jsx(Yf,{className:"justify-center",children:f.jsx(CX,{className:"h-5 w-5"})}),cell:({row:n})=>f.jsx(zi,{isLoading:t,children:f.jsx("div",{className:"text-center tabular-nums",children:n.getValue("tools")??0})})},{accessorKey:"last_run",header:"Last Run",cell:({row:n})=>f.jsx(zi,{isLoading:t,children:H2(n,"last_run")})},{accessorKey:"created_at",header:"Lifespan",cell:({row:n})=>f.jsx(zi,{isLoading:t,children:H2(n,"created_at")})},{accessorKey:"chat",header:"",cell:({row:n})=>t?f.jsx(Pi,{className:"h-6 w-6"}):f.jsxs("div",{className:"flex",children:[f.jsx(ue,{onClick:()=>e(n.original),className:"rounded-lg px-3 py-1",variant:"outline",children:"Chat"}),f.jsx(ue,{variant:"ghost",onClick:()=>n.toggleExpanded(),children:n.getIsExpanded()?f.jsx(SX,{className:"h-4 w-4 text-muted-foreground"}):f.jsx(vX,{className:"h-4 w-4 text-muted-foreground"})})]})}],U_=nf(Hm((e,t)=>({currentAgent:null,lastAgentInitMessage:null,actions:{setAgent:n=>e({currentAgent:n}),setLastAgentInitMessage:n=>e(r=>({...r,lastAgentInitMessage:n})),removeAgent:()=>e(n=>({...n,currentAgent:null}))}}),{name:"agent-storage",partialize:({actions:e,...t})=>t})),To=()=>U_(e=>e.currentAgent),jre=()=>U_(e=>e.lastAgentInitMessage),fh=()=>U_(e=>e.actions);function zre({setShowingAgentCreation:e}){return f.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3",children:[f.jsx("h2",{className:"font-semibold",children:"Create your first agent"}),f.jsxs(ue,{size:"sm",onClick:()=>e(!0),children:[f.jsx(ya,{className:"mr-2 h-4 w-4"}),"Create Agent"]})]})}const Ure=e=>{const{agent:t}=e,n=p.useMemo(()=>{var o;return Object.values(((o=t.memory)==null?void 0:o.memory)||{})},[t]),r=p.useMemo(()=>{var o;return((o=n.find(i=>i.label==="persona"))==null?void 0:o.name)??"Not set"},[t]),a=p.useMemo(()=>{var o;return((o=n.find(i=>i.label==="human"))==null?void 0:o.name)??"Not set"},[t]);return f.jsxs("div",{className:"flex flex-col",children:[f.jsxs("div",{className:"flex gap-4 border-b-[1px] py-3",children:[f.jsxs("div",{className:"flex gap-3 text-muted-foreground",children:[f.jsx(yX,{className:"h-4 w-5"}),f.jsx("h6",{children:"Agent Persona"})]}),f.jsx("p",{children:r})]}),f.jsxs("div",{className:"flex gap-4 py-3",children:[f.jsxs("div",{className:"flex gap-3 text-muted-foreground",children:[f.jsx(wX,{className:"h-4 w-5"}),f.jsx("h6",{children:"Human Persona"})]}),f.jsx("p",{children:a})]})]})},Bre=({className:e,setShowingAgentCreation:t})=>{const[n,r]=p.useState(""),{setAgent:a}=fh(),{data:o,isSuccess:i,isError:s,isLoading:l}=Xm({userId:void 0},void 0,{retry:!1}),c=p.useMemo(()=>i?o==null?void 0:o.filter(g=>g.name.toLowerCase().includes(n.toLowerCase())):[],[o,i,n]),u=Mi(),d=g=>{a(g),u(`${g.name}/chat`,{relative:"path"})};return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"flex items-center justify-between bg-background/95 px-4 pb-3 pt-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:f.jsx($re,{value:n,onValueChange:r})}),f.jsx("div",{className:e,children:!l&&c.length===0?f.jsx(zre,{setShowingAgentCreation:t}):f.jsx(cf,{columns:Fre(d,!1),isLoading:l,data:c,error:s?"There was an error loading the agents. Please try again later":void 0,renderPagination:g=>f.jsx(uf,{className:"mt-4",table:g}),expandedRowsContent:g=>f.jsx(Ure,{agent:c[g]})})})]})},a8="Dialog",[o8,i8]=zn(a8),[Hre,va]=o8(a8),Vre=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,s=p.useRef(null),l=p.useRef(null),[c=!1,u]=Fa({prop:r,defaultProp:a,onChange:o});return p.createElement(Hre,{scope:t,triggerRef:s,contentRef:l,contentId:bi(),titleId:bi(),descriptionId:bi(),open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(d=>!d),[u]),modal:i},n)},qre="DialogTrigger",Gre=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(qre,n),o=rt(t,a.triggerRef);return p.createElement(ze.button,W({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":B_(a.open)},r,{ref:o,onClick:fe(e.onClick,a.onOpenToggle)}))}),s8="DialogPortal",[Wre,l8]=o8(s8,{forceMount:void 0}),Kre=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=va(s8,t);return p.createElement(Wre,{scope:t,forceMount:n},p.Children.map(r,i=>p.createElement(pr,{present:n||o.open},p.createElement(Qd,{asChild:!0,container:a},i))))},sk="DialogOverlay",Yre=p.forwardRef((e,t)=>{const n=l8(sk,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=va(sk,e.__scopeDialog);return o.modal?p.createElement(pr,{present:r||o.open},p.createElement(Zre,W({},a,{ref:t}))):null}),Zre=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(sk,n);return p.createElement(ih,{as:$a,allowPinchZoom:!0,shards:[a.contentRef]},p.createElement(ze.div,W({"data-state":B_(a.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),Sc="DialogContent",Xre=p.forwardRef((e,t)=>{const n=l8(Sc,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=va(Sc,e.__scopeDialog);return p.createElement(pr,{present:r||o.open},o.modal?p.createElement(Qre,W({},a,{ref:t})):p.createElement(Jre,W({},a,{ref:t})))}),Qre=p.forwardRef((e,t)=>{const n=va(Sc,e.__scopeDialog),r=p.useRef(null),a=rt(t,n.contentRef,r);return p.useEffect(()=>{const o=r.current;if(o)return gf(o)},[]),p.createElement(c8,W({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=n.triggerRef.current)===null||i===void 0||i.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&o.preventDefault()}),onFocusOutside:fe(e.onFocusOutside,o=>o.preventDefault())}))}),Jre=p.forwardRef((e,t)=>{const n=va(Sc,e.__scopeDialog),r=p.useRef(!1),a=p.useRef(!1);return p.createElement(c8,W({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i;if((i=e.onCloseAutoFocus)===null||i===void 0||i.call(e,o),!o.defaultPrevented){var s;r.current||(s=n.triggerRef.current)===null||s===void 0||s.focus(),o.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:o=>{var i,s;(i=e.onInteractOutside)===null||i===void 0||i.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((s=n.triggerRef.current)===null||s===void 0?void 0:s.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}}))}),c8=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,s=va(Sc,n),l=p.useRef(null),c=rt(t,l);return Jm(),p.createElement(p.Fragment,null,p.createElement(eh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o},p.createElement(Ls,W({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":B_(s.open)},i,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)}),u8="DialogTitle",eae=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(u8,n);return p.createElement(ze.h2,W({id:a.titleId},r,{ref:t}))}),tae="DialogDescription",nae=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(tae,n);return p.createElement(ze.p,W({id:a.descriptionId},r,{ref:t}))}),rae="DialogClose",aae=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=va(rae,n);return p.createElement(ze.button,W({type:"button"},r,{ref:t,onClick:fe(e.onClick,()=>a.onOpenChange(!1))}))});function B_(e){return e?"open":"closed"}const oae="DialogTitleWarning",[iae,wTe]=RV(oae,{contentName:Sc,titleName:u8,docsSlug:"dialog"}),d8=Vre,sae=Gre,f8=Kre,H_=Yre,V_=Xre,q_=eae,G_=nae,W_=aae,Wt=d8,lae=f8,p8=p.forwardRef(({className:e,...t},n)=>f.jsx(H_,{ref:n,className:ee("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));p8.displayName=H_.displayName;const Bt=p.forwardRef(({className:e,children:t,hasCloseButton:n=!0,...r},a)=>f.jsxs(lae,{children:[f.jsx(p8,{}),f.jsxs(V_,{ref:a,className:ee("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...r,children:[t,n?f.jsxs(W_,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[f.jsx(Di,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]}):null]})]}));Bt.displayName=V_.displayName;const Pt=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Pt.displayName="DialogHeader";const g8=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});g8.displayName="DialogFooter";const $t=p.forwardRef(({className:e,...t},n)=>f.jsx(q_,{ref:n,className:ee("text-lg font-semibold leading-none tracking-tight",e),...t}));$t.displayName=q_.displayName;const dn=p.forwardRef(({className:e,...t},n)=>f.jsx(G_,{ref:n,className:ee("text-sm text-muted-foreground",e),...t}));dn.displayName=G_.displayName;const cae=({open:e,onOpenChange:t,closeDialog:n})=>{const r=()=>{t(!1),n()};return f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Cancel Creating Agent"}),f.jsx(dn,{children:"Are you sure you want to cancel creating an Agent? All the information you worked on will be lost."})]}),f.jsxs("div",{className:"flex justify-end gap-4",children:[f.jsx(ue,{variant:"ghost",onClick:()=>t(!1),children:"No"}),f.jsx(ue,{onClick:r,children:"Yes"})]})]})})};var hf=e=>e.type==="checkbox",Rl=e=>e instanceof Date,Yn=e=>e==null;const m8=e=>typeof e=="object";var cn=e=>!Yn(e)&&!Array.isArray(e)&&m8(e)&&!Rl(e),h8=e=>cn(e)&&e.target?hf(e.target)?e.target.checked:e.target.value:e,uae=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,b8=(e,t)=>e.has(uae(t)),dae=e=>{const t=e.constructor&&e.constructor.prototype;return cn(t)&&t.hasOwnProperty("isPrototypeOf")},K_=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ln(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(K_&&(e instanceof Blob||e instanceof FileList))&&(n||cn(e)))if(t=n?[]:{},!n&&!dae(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Ln(e[r]));else return e;return t}var jc=e=>Array.isArray(e)?e.filter(Boolean):[],Ot=e=>e===void 0,ge=(e,t,n)=>{if(!t||!cn(e))return n;const r=jc(t.split(/[,[\].]+?/)).reduce((a,o)=>Yn(a)?a:a[o],e);return Ot(r)||r===e?Ot(e[t])?n:e[t]:r},si=e=>typeof e=="boolean";const Fg={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},Hr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Ja={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},y8=Ae.createContext(null),Bs=()=>Ae.useContext(y8),fae=e=>{const{children:t,...n}=e;return Ae.createElement(y8.Provider,{value:n},t)};var v8=(e,t,n,r=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const i=o;return t._proxyFormState[i]!==Hr.all&&(t._proxyFormState[i]=!r||Hr.all),n&&(n[i]=!0),e[i]}});return a},wr=e=>cn(e)&&!Object.keys(e).length,S8=(e,t,n,r)=>{n(e);const{name:a,...o}=e;return wr(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(i=>t[i]===(!r||Hr.all))},kr=e=>Array.isArray(e)?e:[e],w8=(e,t,n)=>!e||!t||e===t||kr(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function ph(e){const t=Ae.useRef(e);t.current=e,Ae.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function pae(e){const t=Bs(),{control:n=t.control,disabled:r,name:a,exact:o}=e||{},[i,s]=Ae.useState(n._formState),l=Ae.useRef(!0),c=Ae.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1}),u=Ae.useRef(a);return u.current=a,ph({disabled:r,next:d=>l.current&&w8(u.current,d.name,o)&&S8(d,c.current,n._updateFormState)&&s({...n._formState,...d}),subject:n._subjects.state}),Ae.useEffect(()=>(l.current=!0,c.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),v8(i,n,c.current,!1)}var Oa=e=>typeof e=="string",E8=(e,t,n,r,a)=>Oa(e)?(r&&t.watch.add(e),ge(n,e,a)):Array.isArray(e)?e.map(o=>(r&&t.watch.add(o),ge(n,o))):(r&&(t.watchAll=!0),n);function gae(e){const t=Bs(),{control:n=t.control,name:r,defaultValue:a,disabled:o,exact:i}=e||{},s=Ae.useRef(r);s.current=r,ph({disabled:o,subject:n._subjects.values,next:u=>{w8(s.current,u.name,i)&&c(Ln(E8(s.current,n._names,u.values||n._formValues,!1,a)))}});const[l,c]=Ae.useState(n._getWatch(r,a));return Ae.useEffect(()=>n._removeUnmounted()),l}var Y_=e=>/^\w*$/.test(e),x8=e=>jc(e.replace(/["|']|\]/g,"").split(/\.|\[/));function ht(e,t,n){let r=-1;const a=Y_(t)?[t]:x8(t),o=a.length,i=o-1;for(;++r{const u=a._options.shouldUnregister||o,d=(g,m)=>{const y=ge(a._fields,g);y&&(y._f.mount=m)};if(d(n,!0),u){const g=Ln(ge(a._options.defaultValues,n));ht(a._defaultValues,n,g),Ot(ge(a._formValues,n))&&ht(a._formValues,n,g)}return()=>{(i?u&&!a._state.action:u)?a.unregister(n):d(n,!1)}},[n,a,i,o]),Ae.useEffect(()=>{ge(a._fields,n)&&a._updateDisabledField({disabled:r,fields:a._fields,name:n})},[r,n,a]),{field:{name:n,value:s,...si(r)?{disabled:r}:{},onChange:Ae.useCallback(u=>c.current.onChange({target:{value:h8(u),name:n},type:Fg.CHANGE}),[n]),onBlur:Ae.useCallback(()=>c.current.onBlur({target:{value:ge(a._formValues,n),name:n},type:Fg.BLUR}),[n,a]),ref:u=>{const d=ge(a._fields,n);d&&u&&(d._f.ref={focus:()=>u.focus(),select:()=>u.select(),setCustomValidity:g=>u.setCustomValidity(g),reportValidity:()=>u.reportValidity()})}},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ge(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!ge(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ge(l.touchedFields,n)},error:{enumerable:!0,get:()=>ge(l.errors,n)}})}}const hae=e=>e.render(mae(e));var k8=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{};const jg=(e,t,n)=>{for(const r of n||Object.keys(e)){const a=ge(e,r);if(a){const{_f:o,...i}=a;if(o&&t(o.name)){if(o.ref.focus){o.ref.focus();break}else if(o.refs&&o.refs[0].focus){o.refs[0].focus();break}}else cn(i)&&jg(i,t)}}};var $o=()=>{const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(Math.random()*16+e)%16|0;return(t=="x"?n:n&3|8).toString(16)})},Gb=(e,t,n={})=>n.shouldFocus||Ot(n.shouldFocus)?n.focusName||`${e}.${Ot(n.focusIndex)?t:n.focusIndex}.`:"",lk=e=>({isOnSubmit:!e||e===Hr.onSubmit,isOnBlur:e===Hr.onBlur,isOnChange:e===Hr.onChange,isOnAll:e===Hr.all,isOnTouch:e===Hr.onTouched}),ck=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length)))),C8=(e,t,n)=>{const r=jc(ge(e,n));return ht(r,"root",t[n]),ht(e,n,r),e},Z_=e=>e.type==="file",li=e=>typeof e=="function",zg=e=>{if(!K_)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},qp=e=>Oa(e),X_=e=>e.type==="radio",Ug=e=>e instanceof RegExp;const V2={value:!1,isValid:!1},q2={value:!0,isValid:!0};var _8=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ot(e[0].attributes.value)?Ot(e[0].value)||e[0].value===""?q2:{value:e[0].value,isValid:!0}:q2:V2}return V2};const G2={isValid:!1,value:null};var A8=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,G2):G2;function W2(e,t,n="validate"){if(qp(e)||Array.isArray(e)&&e.every(qp)||si(e)&&!e)return{type:n,message:qp(e)?e:"",ref:t}}var tl=e=>cn(e)&&!Ug(e)?e:{value:e,message:""},uk=async(e,t,n,r,a)=>{const{ref:o,refs:i,required:s,maxLength:l,minLength:c,min:u,max:d,pattern:g,validate:m,name:y,valueAsNumber:b,mount:w,disabled:v}=e._f,h=ge(t,y);if(!w||v)return{};const S=i?i[0]:o,E=D=>{r&&S.reportValidity&&(S.setCustomValidity(si(D)?"":D||""),S.reportValidity())},k={},x=X_(o),C=hf(o),_=x||C,T=(b||Z_(o))&&Ot(o.value)&&Ot(h)||zg(o)&&o.value===""||h===""||Array.isArray(h)&&!h.length,R=k8.bind(null,y,n,k),L=(D,H,z,M=Ja.maxLength,U=Ja.minLength)=>{const X=D?H:z;k[y]={type:D?M:U,message:X,ref:o,...R(D?M:U,X)}};if(a?!Array.isArray(h)||!h.length:s&&(!_&&(T||Yn(h))||si(h)&&!h||C&&!_8(i).isValid||x&&!A8(i).isValid)){const{value:D,message:H}=qp(s)?{value:!!s,message:s}:tl(s);if(D&&(k[y]={type:Ja.required,message:H,ref:S,...R(Ja.required,H)},!n))return E(H),k}if(!T&&(!Yn(u)||!Yn(d))){let D,H;const z=tl(d),M=tl(u);if(!Yn(h)&&!isNaN(h)){const U=o.valueAsNumber||h&&+h;Yn(z.value)||(D=U>z.value),Yn(M.value)||(H=Unew Date(new Date().toDateString()+" "+A),j=o.type=="time",O=o.type=="week";Oa(z.value)&&h&&(D=j?X(h)>X(z.value):O?h>z.value:U>new Date(z.value)),Oa(M.value)&&h&&(H=j?X(h)+D.value,M=!Yn(H.value)&&h.length<+H.value;if((z||M)&&(L(z,D.message,H.message),!n))return E(k[y].message),k}if(g&&!T&&Oa(h)){const{value:D,message:H}=tl(g);if(Ug(D)&&!h.match(D)&&(k[y]={type:Ja.pattern,message:H,ref:o,...R(Ja.pattern,H)},!n))return E(H),k}if(m){if(li(m)){const D=await m(h,t),H=W2(D,S);if(H&&(k[y]={...H,...R(Ja.validate,H.message)},!n))return E(H.message),k}else if(cn(m)){let D={};for(const H in m){if(!wr(D)&&!n)break;const z=W2(await m[H](h,t),S,H);z&&(D={...z,...R(H,z.message)},E(z.message),n&&(k[y]=D))}if(!wr(D)&&(k[y]={ref:S,...D},!n))return k}}return E(!0),k};function Wb(e,t){return[...e,...kr(t)]}var Kb=e=>Array.isArray(e)?e.map(()=>{}):void 0;function Yb(e,t,n){return[...e.slice(0,t),...kr(n),...e.slice(t)]}var Zb=(e,t,n)=>Array.isArray(e)?(Ot(e[n])&&(e[n]=void 0),e.splice(n,0,e.splice(t,1)[0]),e):[];function Xb(e,t){return[...kr(t),...kr(e)]}function bae(e,t){let n=0;const r=[...e];for(const a of t)r.splice(a-n,1),n++;return jc(r).length?r:[]}var Qb=(e,t)=>Ot(t)?[]:bae(e,kr(t).sort((n,r)=>n-r)),Jb=(e,t,n)=>{e[t]=[e[n],e[n]=e[t]][0]};function yae(e,t){const n=t.slice(0,-1).length;let r=0;for(;r(e[t]=n,e);function Sae(e){const t=Bs(),{control:n=t.control,name:r,keyName:a="id",shouldUnregister:o}=e,[i,s]=Ae.useState(n._getFieldArray(r)),l=Ae.useRef(n._getFieldArray(r).map($o)),c=Ae.useRef(i),u=Ae.useRef(r),d=Ae.useRef(!1);u.current=r,c.current=i,n._names.array.add(r),e.rules&&n.register(r,e.rules),ph({next:({values:k,name:x})=>{if(x===u.current||!x){const C=ge(k,u.current);Array.isArray(C)&&(s(C),l.current=C.map($o))}},subject:n._subjects.array});const g=Ae.useCallback(k=>{d.current=!0,n._updateFieldArray(r,k)},[n,r]),m=(k,x)=>{const C=kr(Ln(k)),_=Wb(n._getFieldArray(r),C);n._names.focus=Gb(r,_.length-1,x),l.current=Wb(l.current,C.map($o)),g(_),s(_),n._updateFieldArray(r,_,Wb,{argA:Kb(k)})},y=(k,x)=>{const C=kr(Ln(k)),_=Xb(n._getFieldArray(r),C);n._names.focus=Gb(r,0,x),l.current=Xb(l.current,C.map($o)),g(_),s(_),n._updateFieldArray(r,_,Xb,{argA:Kb(k)})},b=k=>{const x=Qb(n._getFieldArray(r),k);l.current=Qb(l.current,k),g(x),s(x),n._updateFieldArray(r,x,Qb,{argA:k})},w=(k,x,C)=>{const _=kr(Ln(x)),T=Yb(n._getFieldArray(r),k,_);n._names.focus=Gb(r,k,C),l.current=Yb(l.current,k,_.map($o)),g(T),s(T),n._updateFieldArray(r,T,Yb,{argA:k,argB:Kb(x)})},v=(k,x)=>{const C=n._getFieldArray(r);Jb(C,k,x),Jb(l.current,k,x),g(C),s(C),n._updateFieldArray(r,C,Jb,{argA:k,argB:x},!1)},h=(k,x)=>{const C=n._getFieldArray(r);Zb(C,k,x),Zb(l.current,k,x),g(C),s(C),n._updateFieldArray(r,C,Zb,{argA:k,argB:x},!1)},S=(k,x)=>{const C=Ln(x),_=K2(n._getFieldArray(r),k,C);l.current=[..._].map((T,R)=>!T||R===k?$o():l.current[R]),g(_),s([..._]),n._updateFieldArray(r,_,K2,{argA:k,argB:C},!0,!1)},E=k=>{const x=kr(Ln(k));l.current=x.map($o),g([...x]),s([...x]),n._updateFieldArray(r,[...x],C=>C,{},!0,!1)};return Ae.useEffect(()=>{if(n._state.action=!1,ck(r,n._names)&&n._subjects.state.next({...n._formState}),d.current&&(!lk(n._options.mode).isOnSubmit||n._formState.isSubmitted))if(n._options.resolver)n._executeSchema([r]).then(k=>{const x=ge(k.errors,r),C=ge(n._formState.errors,r);(C?!x&&C.type||x&&(C.type!==x.type||C.message!==x.message):x&&x.type)&&(x?ht(n._formState.errors,r,x):pn(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{const k=ge(n._fields,r);k&&k._f&&uk(k,n._formValues,n._options.criteriaMode===Hr.all,n._options.shouldUseNativeValidation,!0).then(x=>!wr(x)&&n._subjects.state.next({errors:C8(n._formState.errors,x,r)}))}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&jg(n._fields,k=>!!k&&k.startsWith(n._names.focus||"")),n._names.focus="",n._updateValid(),d.current=!1},[i,r,n]),Ae.useEffect(()=>(!ge(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||o)&&n.unregister(r)}),[r,n,a,o]),{swap:Ae.useCallback(v,[g,r,n]),move:Ae.useCallback(h,[g,r,n]),prepend:Ae.useCallback(y,[g,r,n]),append:Ae.useCallback(m,[g,r,n]),remove:Ae.useCallback(b,[g,r,n]),insert:Ae.useCallback(w,[g,r,n]),update:Ae.useCallback(S,[g,r,n]),replace:Ae.useCallback(E,[g,r,n]),fields:Ae.useMemo(()=>i.map((k,x)=>({...k,[a]:l.current[x]||$o()})),[i,a])}}function ey(){let e=[];return{get observers(){return e},next:a=>{for(const o of e)o.next&&o.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(o=>o!==a)}}),unsubscribe:()=>{e=[]}}}var Bg=e=>Yn(e)||!m8(e);function as(e,t){if(Bg(e)||Bg(t))return e===t;if(Rl(e)&&Rl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const a of n){const o=e[a];if(!r.includes(a))return!1;if(a!=="ref"){const i=t[a];if(Rl(o)&&Rl(i)||cn(o)&&cn(i)||Array.isArray(o)&&Array.isArray(i)?!as(o,i):o!==i)return!1}}return!0}var T8=e=>e.type==="select-multiple",wae=e=>X_(e)||hf(e),ty=e=>zg(e)&&e.isConnected,R8=e=>{for(const t in e)if(li(e[t]))return!0;return!1};function Hg(e,t={}){const n=Array.isArray(e);if(cn(e)||n)for(const r in e)Array.isArray(e[r])||cn(e[r])&&!R8(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Hg(e[r],t[r])):Yn(e[r])||(t[r]=!0);return t}function N8(e,t,n){const r=Array.isArray(e);if(cn(e)||r)for(const a in e)Array.isArray(e[a])||cn(e[a])&&!R8(e[a])?Ot(t)||Bg(n[a])?n[a]=Array.isArray(e[a])?Hg(e[a],[]):{...Hg(e[a])}:N8(e[a],Yn(t)?{}:t[a],n[a]):n[a]=!as(e[a],t[a]);return n}var ny=(e,t)=>N8(e,t,Hg(t)),I8=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Ot(e)?e:t?e===""?NaN:e&&+e:n&&Oa(e)?new Date(e):r?r(e):e;function ry(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return Z_(t)?t.files:X_(t)?A8(e.refs).value:T8(t)?[...t.selectedOptions].map(({value:n})=>n):hf(t)?_8(e.refs).value:I8(Ot(t.value)?e.ref.value:t.value,e)}var Eae=(e,t,n,r)=>{const a={};for(const o of e){const i=ge(t,o);i&&ht(a,o,i._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},fu=e=>Ot(e)?e:Ug(e)?e.source:cn(e)?Ug(e.value)?e.value.source:e.value:e,xae=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Y2(e,t,n){const r=ge(e,n);if(r||Y_(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),i=ge(t,o),s=ge(e,o);if(i&&!Array.isArray(i)&&n!==o)return{name:n};if(s&&s.type)return{name:o,error:s};a.pop()}return{name:n}}var kae=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,Cae=(e,t)=>!jc(ge(e,t)).length&&pn(e,t);const _ae={mode:Hr.onSubmit,reValidateMode:Hr.onChange,shouldFocusError:!0};function Aae(e={},t){let n={..._ae,...e},r={submitCount:0,isDirty:!1,isLoading:li(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:{}},a={},o=cn(n.defaultValues)||cn(n.values)?Ln(n.defaultValues||n.values)||{}:{},i=n.shouldUnregister?{}:Ln(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={values:ey(),array:ey(),state:ey()},m=e.resetOptions&&e.resetOptions.keepDirtyValues,y=lk(n.mode),b=lk(n.reValidateMode),w=n.criteriaMode===Hr.all,v=F=>q=>{clearTimeout(u),u=setTimeout(F,q)},h=async F=>{if(d.isValid||F){const q=n.resolver?wr((await T()).errors):await L(a,!0);q!==r.isValid&&g.state.next({isValid:q})}},S=F=>d.isValidating&&g.state.next({isValidating:F}),E=(F,q=[],Y,ye,de=!0,oe=!0)=>{if(ye&&Y){if(s.action=!0,oe&&Array.isArray(ge(a,F))){const _e=Y(ge(a,F),ye.argA,ye.argB);de&&ht(a,F,_e)}if(oe&&Array.isArray(ge(r.errors,F))){const _e=Y(ge(r.errors,F),ye.argA,ye.argB);de&&ht(r.errors,F,_e),Cae(r.errors,F)}if(d.touchedFields&&oe&&Array.isArray(ge(r.touchedFields,F))){const _e=Y(ge(r.touchedFields,F),ye.argA,ye.argB);de&&ht(r.touchedFields,F,_e)}d.dirtyFields&&(r.dirtyFields=ny(o,i)),g.state.next({name:F,isDirty:H(F,q),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ht(i,F,q)},k=(F,q)=>{ht(r.errors,F,q),g.state.next({errors:r.errors})},x=(F,q,Y,ye)=>{const de=ge(a,F);if(de){const oe=ge(i,F,Ot(Y)?ge(o,F):Y);Ot(oe)||ye&&ye.defaultChecked||q?ht(i,F,q?oe:ry(de._f)):U(F,oe),s.mount&&h()}},C=(F,q,Y,ye,de)=>{let oe=!1,_e=!1;const wt={name:F};if(!Y||ye){d.isDirty&&(_e=r.isDirty,r.isDirty=wt.isDirty=H(),oe=_e!==wt.isDirty);const St=as(ge(o,F),q);_e=ge(r.dirtyFields,F),St?pn(r.dirtyFields,F):ht(r.dirtyFields,F,!0),wt.dirtyFields=r.dirtyFields,oe=oe||d.dirtyFields&&_e!==!St}if(Y){const St=ge(r.touchedFields,F);St||(ht(r.touchedFields,F,Y),wt.touchedFields=r.touchedFields,oe=oe||d.touchedFields&&St!==Y)}return oe&&de&&g.state.next(wt),oe?wt:{}},_=(F,q,Y,ye)=>{const de=ge(r.errors,F),oe=d.isValid&&si(q)&&r.isValid!==q;if(e.delayError&&Y?(c=v(()=>k(F,Y)),c(e.delayError)):(clearTimeout(u),c=null,Y?ht(r.errors,F,Y):pn(r.errors,F)),(Y?!as(de,Y):de)||!wr(ye)||oe){const _e={...ye,...oe&&si(q)?{isValid:q}:{},errors:r.errors,name:F};r={...r,..._e},g.state.next(_e)}S(!1)},T=async F=>n.resolver(i,n.context,Eae(F||l.mount,a,n.criteriaMode,n.shouldUseNativeValidation)),R=async F=>{const{errors:q}=await T(F);if(F)for(const Y of F){const ye=ge(q,Y);ye?ht(r.errors,Y,ye):pn(r.errors,Y)}else r.errors=q;return q},L=async(F,q,Y={valid:!0})=>{for(const ye in F){const de=F[ye];if(de){const{_f:oe,..._e}=de;if(oe){const wt=l.array.has(oe.name),St=await uk(de,i,w,n.shouldUseNativeValidation&&!q,wt);if(St[oe.name]&&(Y.valid=!1,q))break;!q&&(ge(St,oe.name)?wt?C8(r.errors,St,oe.name):ht(r.errors,oe.name,St[oe.name]):pn(r.errors,oe.name))}_e&&await L(_e,q,Y)}}return Y.valid},D=()=>{for(const F of l.unMount){const q=ge(a,F);q&&(q._f.refs?q._f.refs.every(Y=>!ty(Y)):!ty(q._f.ref))&&ne(F)}l.unMount=new Set},H=(F,q)=>(F&&q&&ht(i,F,q),!as(V(),o)),z=(F,q,Y)=>E8(F,l,{...s.mount?i:Ot(q)?o:Oa(F)?{[F]:q}:q},Y,q),M=F=>jc(ge(s.mount?i:o,F,e.shouldUnregister?ge(o,F,[]):[])),U=(F,q,Y={})=>{const ye=ge(a,F);let de=q;if(ye){const oe=ye._f;oe&&(!oe.disabled&&ht(i,F,I8(q,oe)),de=zg(oe.ref)&&Yn(q)?"":q,T8(oe.ref)?[...oe.ref.options].forEach(_e=>_e.selected=de.includes(_e.value)):oe.refs?hf(oe.ref)?oe.refs.length>1?oe.refs.forEach(_e=>(!_e.defaultChecked||!_e.disabled)&&(_e.checked=Array.isArray(de)?!!de.find(wt=>wt===_e.value):de===_e.value)):oe.refs[0]&&(oe.refs[0].checked=!!de):oe.refs.forEach(_e=>_e.checked=_e.value===de):Z_(oe.ref)?oe.ref.value="":(oe.ref.value=de,oe.ref.type||g.values.next({name:F,values:{...i}})))}(Y.shouldDirty||Y.shouldTouch)&&C(F,de,Y.shouldTouch,Y.shouldDirty,!0),Y.shouldValidate&&A(F)},X=(F,q,Y)=>{for(const ye in q){const de=q[ye],oe=`${F}.${ye}`,_e=ge(a,oe);(l.array.has(F)||!Bg(de)||_e&&!_e._f)&&!Rl(de)?X(oe,de,Y):U(oe,de,Y)}},j=(F,q,Y={})=>{const ye=ge(a,F),de=l.array.has(F),oe=Ln(q);ht(i,F,oe),de?(g.array.next({name:F,values:{...i}}),(d.isDirty||d.dirtyFields)&&Y.shouldDirty&&g.state.next({name:F,dirtyFields:ny(o,i),isDirty:H(F,oe)})):ye&&!ye._f&&!Yn(oe)?X(F,oe,Y):U(F,oe,Y),ck(F,l)&&g.state.next({...r}),g.values.next({name:F,values:{...i}}),!s.mount&&t()},O=async F=>{const q=F.target;let Y=q.name,ye=!0;const de=ge(a,Y),oe=()=>q.type?ry(de._f):h8(F);if(de){let _e,wt;const St=oe(),Z=F.type===Fg.BLUR||F.type===Fg.FOCUS_OUT,le=!xae(de._f)&&!n.resolver&&!ge(r.errors,Y)&&!de._f.deps||kae(Z,ge(r.touchedFields,Y),r.isSubmitted,b,y),De=ck(Y,l,Z);ht(i,Y,St),Z?(de._f.onBlur&&de._f.onBlur(F),c&&c(0)):de._f.onChange&&de._f.onChange(F);const He=C(Y,St,Z,!1),ft=!wr(He)||De;if(!Z&&g.values.next({name:Y,type:F.type,values:{...i}}),le)return d.isValid&&h(),ft&&g.state.next({name:Y,...De?{}:He});if(!Z&&De&&g.state.next({...r}),S(!0),n.resolver){const{errors:Tn}=await T([Y]),Ir=Y2(r.errors,a,Y),Sn=Y2(Tn,a,Ir.name||Y);_e=Sn.error,Y=Sn.name,wt=wr(Tn)}else _e=(await uk(de,i,w,n.shouldUseNativeValidation))[Y],ye=Number.isNaN(St)||St===ge(i,Y,St),ye&&(_e?wt=!1:d.isValid&&(wt=await L(a,!0)));ye&&(de._f.deps&&A(de._f.deps),_(Y,wt,_e,He))}},A=async(F,q={})=>{let Y,ye;const de=kr(F);if(S(!0),n.resolver){const oe=await R(Ot(F)?F:de);Y=wr(oe),ye=F?!de.some(_e=>ge(oe,_e)):Y}else F?(ye=(await Promise.all(de.map(async oe=>{const _e=ge(a,oe);return await L(_e&&_e._f?{[oe]:_e}:_e)}))).every(Boolean),!(!ye&&!r.isValid)&&h()):ye=Y=await L(a);return g.state.next({...!Oa(F)||d.isValid&&Y!==r.isValid?{}:{name:F},...n.resolver||!F?{isValid:Y}:{},errors:r.errors,isValidating:!1}),q.shouldFocus&&!ye&&jg(a,oe=>oe&&ge(r.errors,oe),F?de:l.mount),ye},V=F=>{const q={...o,...s.mount?i:{}};return Ot(F)?q:Oa(F)?ge(q,F):F.map(Y=>ge(q,Y))},P=(F,q)=>({invalid:!!ge((q||r).errors,F),isDirty:!!ge((q||r).dirtyFields,F),isTouched:!!ge((q||r).touchedFields,F),error:ge((q||r).errors,F)}),N=F=>{F&&kr(F).forEach(q=>pn(r.errors,q)),g.state.next({errors:F?r.errors:{}})},K=(F,q,Y)=>{const ye=(ge(a,F,{_f:{}})._f||{}).ref;ht(r.errors,F,{...q,ref:ye}),g.state.next({name:F,errors:r.errors,isValid:!1}),Y&&Y.shouldFocus&&ye&&ye.focus&&ye.focus()},ae=(F,q)=>li(F)?g.values.subscribe({next:Y=>F(z(void 0,q),Y)}):z(F,q,!0),ne=(F,q={})=>{for(const Y of F?kr(F):l.mount)l.mount.delete(Y),l.array.delete(Y),q.keepValue||(pn(a,Y),pn(i,Y)),!q.keepError&&pn(r.errors,Y),!q.keepDirty&&pn(r.dirtyFields,Y),!q.keepTouched&&pn(r.touchedFields,Y),!n.shouldUnregister&&!q.keepDefaultValue&&pn(o,Y);g.values.next({values:{...i}}),g.state.next({...r,...q.keepDirty?{isDirty:H()}:{}}),!q.keepIsValid&&h()},Q=({disabled:F,name:q,field:Y,fields:ye})=>{if(si(F)){const de=F?void 0:ge(i,q,ry(Y?Y._f:ge(ye,q)._f));ht(i,q,de),C(q,de,!1,!1,!0)}},pe=(F,q={})=>{let Y=ge(a,F);const ye=si(q.disabled);return ht(a,F,{...Y||{},_f:{...Y&&Y._f?Y._f:{ref:{name:F}},name:F,mount:!0,...q}}),l.mount.add(F),Y?Q({field:Y,disabled:q.disabled,name:F}):x(F,!0,q.value),{...ye?{disabled:q.disabled}:{},...n.progressive?{required:!!q.required,min:fu(q.min),max:fu(q.max),minLength:fu(q.minLength),maxLength:fu(q.maxLength),pattern:fu(q.pattern)}:{},name:F,onChange:O,onBlur:O,ref:de=>{if(de){pe(F,q),Y=ge(a,F);const oe=Ot(de.value)&&de.querySelectorAll&&de.querySelectorAll("input,select,textarea")[0]||de,_e=wae(oe),wt=Y._f.refs||[];if(_e?wt.find(St=>St===oe):oe===Y._f.ref)return;ht(a,F,{_f:{...Y._f,..._e?{refs:[...wt.filter(ty),oe,...Array.isArray(ge(o,F))?[{}]:[]],ref:{type:oe.type,name:F}}:{ref:oe}}}),x(F,!1,void 0,oe)}else Y=ge(a,F,{}),Y._f&&(Y._f.mount=!1),(n.shouldUnregister||q.shouldUnregister)&&!(b8(l.array,F)&&s.action)&&l.unMount.add(F)}}},he=()=>n.shouldFocusError&&jg(a,F=>F&&ge(r.errors,F),l.mount),re=(F,q)=>async Y=>{Y&&(Y.preventDefault&&Y.preventDefault(),Y.persist&&Y.persist());let ye=Ln(i);if(g.state.next({isSubmitting:!0}),n.resolver){const{errors:de,values:oe}=await T();r.errors=de,ye=oe}else await L(a);pn(r.errors,"root"),wr(r.errors)?(g.state.next({errors:{}}),await F(ye,Y)):(q&&await q({...r.errors},Y),he(),setTimeout(he)),g.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:wr(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Ee=(F,q={})=>{ge(a,F)&&(Ot(q.defaultValue)?j(F,ge(o,F)):(j(F,q.defaultValue),ht(o,F,q.defaultValue)),q.keepTouched||pn(r.touchedFields,F),q.keepDirty||(pn(r.dirtyFields,F),r.isDirty=q.defaultValue?H(F,ge(o,F)):H()),q.keepError||(pn(r.errors,F),d.isValid&&h()),g.state.next({...r}))},ke=(F,q={})=>{const Y=F?Ln(F):o,ye=Ln(Y),de=F&&!wr(F)?ye:o;if(q.keepDefaultValues||(o=Y),!q.keepValues){if(q.keepDirtyValues||m)for(const oe of l.mount)ge(r.dirtyFields,oe)?ht(de,oe,ge(i,oe)):j(oe,ge(de,oe));else{if(K_&&Ot(F))for(const oe of l.mount){const _e=ge(a,oe);if(_e&&_e._f){const wt=Array.isArray(_e._f.refs)?_e._f.refs[0]:_e._f.ref;if(zg(wt)){const St=wt.closest("form");if(St){St.reset();break}}}}a={}}i=e.shouldUnregister?q.keepDefaultValues?Ln(o):{}:Ln(de),g.array.next({values:{...de}}),g.values.next({values:{...de}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!s.mount&&t(),s.mount=!d.isValid||!!q.keepIsValid,s.watch=!!e.shouldUnregister,g.state.next({submitCount:q.keepSubmitCount?r.submitCount:0,isDirty:q.keepDirty?r.isDirty:!!(q.keepDefaultValues&&!as(F,o)),isSubmitted:q.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:q.keepDirtyValues?r.dirtyFields:q.keepDefaultValues&&F?ny(o,F):{},touchedFields:q.keepTouched?r.touchedFields:{},errors:q.keepErrors?r.errors:{},isSubmitSuccessful:q.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},We=(F,q)=>ke(li(F)?F(i):F,q);return{control:{register:pe,unregister:ne,getFieldState:P,handleSubmit:re,setError:K,_executeSchema:T,_getWatch:z,_getDirty:H,_updateValid:h,_removeUnmounted:D,_updateFieldArray:E,_updateDisabledField:Q,_getFieldArray:M,_reset:ke,_resetDefaultValues:()=>li(n.defaultValues)&&n.defaultValues().then(F=>{We(F,n.resetOptions),g.state.next({isLoading:!1})}),_updateFormState:F=>{r={...r,...F}},_subjects:g,_proxyFormState:d,get _fields(){return a},get _formValues(){return i},get _state(){return s},set _state(F){s=F},get _defaultValues(){return o},get _names(){return l},set _names(F){l=F},get _formState(){return r},set _formState(F){r=F},get _options(){return n},set _options(F){n={...n,...F}}},trigger:A,register:pe,handleSubmit:re,watch:ae,setValue:j,getValues:V,reset:We,resetField:Ee,clearErrors:N,unregister:ne,setError:K,setFocus:(F,q={})=>{const Y=ge(a,F),ye=Y&&Y._f;if(ye){const de=ye.refs?ye.refs[0]:ye.ref;de.focus&&(de.focus(),q.shouldSelect&&de.select())}},getFieldState:P}}function bn(e={}){const t=Ae.useRef(),n=Ae.useRef(),[r,a]=Ae.useState({isDirty:!1,isValidating:!1,isLoading:li(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:{},defaultValues:li(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Aae(e,()=>a(i=>({...i}))),formState:r});const o=t.current.control;return o._options=e,ph({subject:o._subjects.state,next:i=>{S8(i,o._proxyFormState,o._updateFormState,!0)&&a({...o._formState})}}),Ae.useEffect(()=>{e.values&&!as(e.values,n.current)?(o._reset(e.values,o._options.resetOptions),n.current=e.values):o._resetDefaultValues()},[e.values,o]),Ae.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=v8(r,o),t.current}var Z2=function(e,t,n){if(e&&"reportValidity"in e){var r=ge(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},O8=function(e,t){var n=function(a){var o=t.fields[a];o&&o.ref&&"reportValidity"in o.ref?Z2(o.ref,a,e):o.refs&&o.refs.forEach(function(i){return Z2(i,a,e)})};for(var r in t.fields)n(r)},Tae=function(e,t){t.shouldUseNativeValidation&&O8(e,t);var n={};for(var r in e){var a=ge(t.fields,r),o=Object.assign(e[r]||{},{ref:a&&a.ref});if(Nae(t.names||Object.keys(e),r)){var i=Object.assign({},Rae(ge(n,r)));ht(i,"root",o),ht(n,r,i)}else ht(n,r,o)}return n},Rae=function(e){return Array.isArray(e)?e.filter(Boolean):[]},Nae=function(e,t){return e.some(function(n){return n.startsWith(t+".")})},Iae=function(e,t){for(var n={};e.length;){var r=e[0],a=r.code,o=r.message,i=r.path.join(".");if(!n[i])if("unionErrors"in r){var s=r.unionErrors[0].errors[0];n[i]={message:s.message,type:s.code}}else n[i]={message:o,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(d){return e.push(d)})}),t){var l=n[i].types,c=l&&l[r.code];n[i]=k8(i,t,n,a,c?[].concat(c,r.message):r.message)}e.shift()}return n},yn=function(e,t,n){return n===void 0&&(n={}),function(r,a,o){try{return Promise.resolve(function(i,s){try{var l=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(c){return o.shouldUseNativeValidation&&O8({},o),{errors:{},values:n.raw?r:c}})}catch(c){return s(c)}return l&&l.then?l.then(void 0,s):l}(0,function(i){if(function(s){return s.errors!=null}(i))return{values:{},errors:Tae(Iae(i.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw i}))}catch(i){return Promise.reject(i)}}};function Ul(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function Oae(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function D8(...e){return t=>e.forEach(n=>Oae(n,t))}function bf(...e){return p.useCallback(D8(...e),e)}function Dae(e,t=[]){let n=[];function r(o,i){const s=p.createContext(i),l=n.length;n=[...n,i];function c(d){const{scope:g,children:m,...y}=d,b=(g==null?void 0:g[e][l])||s,w=p.useMemo(()=>y,Object.values(y));return p.createElement(b.Provider,{value:w},m)}function u(d,g){const m=(g==null?void 0:g[e][l])||s,y=p.useContext(m);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${d}\` must be used within \`${o}\``)}return c.displayName=o+"Provider",[c,u]}const a=()=>{const o=n.map(i=>p.createContext(i));return function(s){const l=(s==null?void 0:s[e])||o;return p.useMemo(()=>({[`__scope${e}`]:{...s,[e]:l}}),[s,l])}};return a.scopeName=e,[r,Lae(a,...t)]}function Lae(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((s,{useScope:l,scopeName:c})=>{const d=l(o)[`__scope${c}`];return{...s,...d}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}const dk=globalThis!=null&&globalThis.document?p.useLayoutEffect:()=>{},Mae=Wd["useId".toString()]||(()=>{});let Pae=0;function ay(e){const[t,n]=p.useState(Mae());return dk(()=>{e||n(r=>r??String(Pae++))},[e]),e||(t?`radix-${t}`:"")}function Rs(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}function $ae({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,a]=Fae({defaultProp:t,onChange:n}),o=e!==void 0,i=o?e:r,s=Rs(n),l=p.useCallback(c=>{if(o){const d=typeof c=="function"?c(e):c;d!==e&&s(d)}else a(c)},[o,e,a,s]);return[i,l]}function Fae({defaultProp:e,onChange:t}){const n=p.useState(e),[r]=n,a=p.useRef(r),o=Rs(t);return p.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),n}const Q_=p.forwardRef((e,t)=>{const{children:n,...r}=e,a=p.Children.toArray(n),o=a.find(zae);if(o){const i=o.props.children,s=a.map(l=>l===o?p.Children.count(i)>1?p.Children.only(null):p.isValidElement(i)?i.props.children:null:l);return p.createElement(fk,W({},r,{ref:t}),p.isValidElement(i)?p.cloneElement(i,void 0,s):null)}return p.createElement(fk,W({},r,{ref:t}),n)});Q_.displayName="Slot";const fk=p.forwardRef((e,t)=>{const{children:n,...r}=e;return p.isValidElement(n)?p.cloneElement(n,{...Uae(r,n.props),ref:D8(t,n.ref)}):p.Children.count(n)>1?p.Children.only(null):null});fk.displayName="SlotClone";const jae=({children:e})=>p.createElement(p.Fragment,null,e);function zae(e){return p.isValidElement(e)&&e.type===jae}function Uae(e,t){const n={...t};for(const r in t){const a=e[r],o=t[r];/^on[A-Z]/.test(r)?n[r]=(...s)=>{o==null||o(...s),a==null||a(...s)}:r==="style"?n[r]={...a,...o}:r==="className"&&(n[r]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}const Bae=["a","button","div","h2","h3","img","li","nav","ol","p","span","svg","ul"],gh=Bae.reduce((e,t)=>{const n=p.forwardRef((r,a)=>{const{asChild:o,...i}=r,s=o?Q_:t;return p.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),p.createElement(s,W({},i,{ref:a}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Hae(e,t){e&&ba.flushSync(()=>e.dispatchEvent(t))}function Vae(e){const t=Rs(e);p.useEffect(()=>{const n=r=>{r.key==="Escape"&&t(r)};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t])}const pk="dismissableLayer.update",qae="dismissableLayer.pointerDownOutside",Gae="dismissableLayer.focusOutside";let X2;const Wae=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kae=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,onDismiss:s,...l}=e,c=p.useContext(Wae),[u,d]=p.useState(null),[,g]=p.useState({}),m=bf(t,x=>d(x)),y=Array.from(c.layers),[b]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=y.indexOf(b),v=u?y.indexOf(u):-1,h=c.layersWithOutsidePointerEventsDisabled.size>0,S=v>=w,E=Yae(x=>{const C=x.target,_=[...c.branches].some(T=>T.contains(C));!S||_||(a==null||a(x),i==null||i(x),x.defaultPrevented||s==null||s())}),k=Zae(x=>{const C=x.target;[...c.branches].some(T=>T.contains(C))||(o==null||o(x),i==null||i(x),x.defaultPrevented||s==null||s())});return Vae(x=>{v===c.layers.size-1&&(r==null||r(x),!x.defaultPrevented&&s&&(x.preventDefault(),s()))}),p.useEffect(()=>{if(u)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(X2=document.body.style.pointerEvents,document.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(u)),c.layers.add(u),Q2(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(document.body.style.pointerEvents=X2)}},[u,n,c]),p.useEffect(()=>()=>{u&&(c.layers.delete(u),c.layersWithOutsidePointerEventsDisabled.delete(u),Q2())},[u,c]),p.useEffect(()=>{const x=()=>g({});return document.addEventListener(pk,x),()=>document.removeEventListener(pk,x)},[]),p.createElement(gh.div,W({},l,{ref:m,style:{pointerEvents:h?S?"auto":"none":void 0,...e.style},onFocusCapture:Ul(e.onFocusCapture,k.onFocusCapture),onBlurCapture:Ul(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:Ul(e.onPointerDownCapture,E.onPointerDownCapture)}))});function Yae(e){const t=Rs(e),n=p.useRef(!1),r=p.useRef(()=>{});return p.useEffect(()=>{const a=i=>{if(i.target&&!n.current){let c=function(){L8(qae,t,l,{discrete:!0})};var s=c;const l={originalEvent:i};i.pointerType==="touch"?(document.removeEventListener("click",r.current),r.current=c,document.addEventListener("click",r.current,{once:!0})):c()}n.current=!1},o=window.setTimeout(()=>{document.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),document.removeEventListener("pointerdown",a),document.removeEventListener("click",r.current)}},[t]),{onPointerDownCapture:()=>n.current=!0}}function Zae(e){const t=Rs(e),n=p.useRef(!1);return p.useEffect(()=>{const r=a=>{a.target&&!n.current&&L8(Gae,t,{originalEvent:a},{discrete:!1})};return document.addEventListener("focusin",r),()=>document.removeEventListener("focusin",r)},[t]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function Q2(){const e=new CustomEvent(pk);document.dispatchEvent(e)}function L8(e,t,n,{discrete:r}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),r?Hae(a,o):a.dispatchEvent(o)}const oy="focusScope.autoFocusOnMount",iy="focusScope.autoFocusOnUnmount",J2={bubbles:!1,cancelable:!0},Xae=p.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...i}=e,[s,l]=p.useState(null),c=Rs(a),u=Rs(o),d=p.useRef(null),g=bf(t,b=>l(b)),m=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(r){let v=function(S){if(m.paused||!s)return;const E=S.target;s.contains(E)?d.current=E:Yi(d.current,{select:!0})},h=function(S){m.paused||!s||s.contains(S.relatedTarget)||Yi(d.current,{select:!0})};var b=v,w=h;return document.addEventListener("focusin",v),document.addEventListener("focusout",h),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",h)}}},[r,s,m.paused]),p.useEffect(()=>{if(s){tN.add(m);const b=document.activeElement;if(!s.contains(b)){const v=new CustomEvent(oy,J2);s.addEventListener(oy,c),s.dispatchEvent(v),v.defaultPrevented||(Qae(roe(M8(s)),{select:!0}),document.activeElement===b&&Yi(s))}return()=>{s.removeEventListener(oy,c),setTimeout(()=>{const v=new CustomEvent(iy,J2);s.addEventListener(iy,u),s.dispatchEvent(v),v.defaultPrevented||Yi(b??document.body,{select:!0}),s.removeEventListener(iy,u),tN.remove(m)},0)}}},[s,c,u,m]);const y=p.useCallback(b=>{if(!n&&!r||m.paused)return;const w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,v=document.activeElement;if(w&&v){const h=b.currentTarget,[S,E]=Jae(h);S&&E?!b.shiftKey&&v===E?(b.preventDefault(),n&&Yi(S,{select:!0})):b.shiftKey&&v===S&&(b.preventDefault(),n&&Yi(E,{select:!0})):v===h&&b.preventDefault()}},[n,r,m.paused]);return p.createElement(gh.div,W({tabIndex:-1},i,{ref:g,onKeyDown:y}))});function Qae(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Yi(r,{select:t}),document.activeElement!==n)return}function Jae(e){const t=M8(e),n=eN(t,e),r=eN(t.reverse(),e);return[n,r]}function M8(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const a=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||a?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function eN(e,t){for(const n of e)if(!eoe(n,{upTo:t}))return n}function eoe(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function toe(e){return e instanceof HTMLInputElement&&"select"in e}function Yi(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&toe(e)&&t&&e.select()}}const tN=noe();function noe(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=nN(e,t),e.unshift(t)},remove(t){var n;e=nN(e,t),(n=e[0])===null||n===void 0||n.resume()}}}function nN(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function roe(e){return e.filter(t=>t.tagName!=="A")}const aoe=p.forwardRef((e,t)=>{var n;const{container:r=globalThis==null||(n=globalThis.document)===null||n===void 0?void 0:n.body,...a}=e;return r?qC.createPortal(p.createElement(gh.div,W({},a,{ref:t})),r):null});function ooe(e,t){return p.useReducer((n,r)=>{const a=t[n][r];return a??n},e)}const mh=e=>{const{present:t,children:n}=e,r=ioe(t),a=typeof n=="function"?n({present:r.isPresent}):p.Children.only(n),o=bf(r.ref,a.ref);return typeof n=="function"||r.isPresent?p.cloneElement(a,{ref:o}):null};mh.displayName="Presence";function ioe(e){const[t,n]=p.useState(),r=p.useRef({}),a=p.useRef(e),o=p.useRef("none"),i=e?"mounted":"unmounted",[s,l]=ooe(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const c=sp(r.current);o.current=s==="mounted"?c:"none"},[s]),dk(()=>{const c=r.current,u=a.current;if(u!==e){const g=o.current,m=sp(c);e?l("MOUNT"):m==="none"||(c==null?void 0:c.display)==="none"?l("UNMOUNT"):l(u&&g!==m?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,l]),dk(()=>{if(t){const c=d=>{const m=sp(r.current).includes(d.animationName);d.target===t&&m&&ba.flushSync(()=>l("ANIMATION_END"))},u=d=>{d.target===t&&(o.current=sp(r.current))};return t.addEventListener("animationstart",u),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{t.removeEventListener("animationstart",u),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:p.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function sp(e){return(e==null?void 0:e.animationName)||"none"}let sy=0;function soe(){p.useEffect(()=>{var e,t;const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(e=n[0])!==null&&e!==void 0?e:rN()),document.body.insertAdjacentElement("beforeend",(t=n[1])!==null&&t!==void 0?t:rN()),sy++,()=>{sy===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),sy--}},[])}function rN(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.cssText="outline: none; opacity: 0; position: fixed; pointer-events: none",e}var P8=u7(),ly=function(){},hh=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:ly,onWheelCapture:ly,onTouchMoveCapture:ly}),a=r[0],o=r[1],i=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,u=e.enabled,d=e.shards,g=e.sideCar,m=e.noIsolation,y=e.inert,b=e.allowPinchZoom,w=e.as,v=w===void 0?"div":w,h=O_(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as"]),S=g,E=c7([n,t]),k=Pn(Pn({},h),a);return p.createElement(p.Fragment,null,u&&p.createElement(S,{sideCar:P8,removeScrollBar:c,shards:d,noIsolation:m,inert:y,setCallbacks:o,allowPinchZoom:!!b,lockRef:n}),i?p.cloneElement(p.Children.only(s),Pn(Pn({},k),{ref:E})):p.createElement(v,Pn({},k,{className:l,ref:E}),s))});hh.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};hh.classNames={fullWidth:Vu,zeroRight:Hu};var gk=!1;if(typeof window<"u")try{var lp=Object.defineProperty({},"passive",{get:function(){return gk=!0,!0}});window.addEventListener("test",lp,lp),window.removeEventListener("test",lp,lp)}catch{gk=!1}var nl=gk?{passive:!1}:!1,loe=function(e){var t=window.getComputedStyle(e);return t.overflowY!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowY==="visible")},coe=function(e){var t=window.getComputedStyle(e);return t.overflowX!=="hidden"&&!(t.overflowY===t.overflowX&&t.overflowX==="visible")},aN=function(e,t){var n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var r=$8(e,n);if(r){var a=F8(e,n),o=a[1],i=a[2];if(o>i)return!0}n=n.parentNode}while(n&&n!==document.body);return!1},uoe=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},doe=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},$8=function(e,t){return e==="v"?loe(t):coe(t)},F8=function(e,t){return e==="v"?uoe(t):doe(t)},foe=function(e,t){return e==="h"&&t==="rtl"?-1:1},poe=function(e,t,n,r,a){var o=foe(e,window.getComputedStyle(t).direction),i=o*r,s=n.target,l=t.contains(s),c=!1,u=i>0,d=0,g=0;do{var m=F8(e,s),y=m[0],b=m[1],w=m[2],v=b-w-o*y;(y||v)&&$8(e,s)&&(d+=v,g+=y),s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(u&&(a&&d===0||!a&&i>d)||!u&&(a&&g===0||!a&&-i>g))&&(c=!0),c},cp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},oN=function(e){return[e.deltaX,e.deltaY]},iN=function(e){return e&&"current"in e?e.current:e},goe=function(e,t){return e[0]===t[0]&&e[1]===t[1]},moe=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},hoe=0,rl=[];function boe(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),a=p.useState(hoe++)[0],o=p.useState(function(){return D_()})[0],i=p.useRef(e);p.useEffect(function(){i.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var b=l7([e.lockRef.current],(e.shards||[]).map(iN),!0).filter(Boolean);return b.forEach(function(w){return w.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),b.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var s=p.useCallback(function(b,w){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var v=cp(b),h=n.current,S="deltaX"in b?b.deltaX:h[0]-v[0],E="deltaY"in b?b.deltaY:h[1]-v[1],k,x=b.target,C=Math.abs(S)>Math.abs(E)?"h":"v";if("touches"in b&&C==="h"&&x.type==="range")return!1;var _=aN(C,x);if(!_)return!0;if(_?k=C:(k=C==="v"?"h":"v",_=aN(C,x)),!_)return!1;if(!r.current&&"changedTouches"in b&&(S||E)&&(r.current=k),!k)return!0;var T=r.current||k;return poe(T,w,b,T==="h"?S:E,!0)},[]),l=p.useCallback(function(b){var w=b;if(!(!rl.length||rl[rl.length-1]!==o)){var v="deltaY"in w?oN(w):cp(w),h=t.current.filter(function(k){return k.name===w.type&&k.target===w.target&&goe(k.delta,v)})[0];if(h&&h.should){w.preventDefault();return}if(!h){var S=(i.current.shards||[]).map(iN).filter(Boolean).filter(function(k){return k.contains(w.target)}),E=S.length>0?s(w,S[0]):!i.current.noIsolation;E&&w.preventDefault()}}},[]),c=p.useCallback(function(b,w,v,h){var S={name:b,delta:w,target:v,should:h};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(E){return E!==S})},1)},[]),u=p.useCallback(function(b){n.current=cp(b),r.current=void 0},[]),d=p.useCallback(function(b){c(b.type,oN(b),b.target,s(b,e.lockRef.current))},[]),g=p.useCallback(function(b){c(b.type,cp(b),b.target,s(b,e.lockRef.current))},[]);p.useEffect(function(){return rl.push(o),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:g}),document.addEventListener("wheel",l,nl),document.addEventListener("touchmove",l,nl),document.addEventListener("touchstart",u,nl),function(){rl=rl.filter(function(b){return b!==o}),document.removeEventListener("wheel",l,nl),document.removeEventListener("touchmove",l,nl),document.removeEventListener("touchstart",u,nl)}},[]);var m=e.removeScrollBar,y=e.inert;return p.createElement(p.Fragment,null,y?p.createElement(o,{styles:moe(a)}):null,m?p.createElement(g7,{gapMode:"margin"}):null)}const yoe=f7(P8,boe);var j8=p.forwardRef(function(e,t){return p.createElement(hh,Pn({},e,{ref:t,sideCar:yoe}))});j8.classNames=hh.classNames;const voe=j8,z8="Dialog",[U8,ETe]=Dae(z8),[Soe,Hs]=U8(z8),woe=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!0}=e,s=p.useRef(null),l=p.useRef(null),[c=!1,u]=$ae({prop:r,defaultProp:a,onChange:o});return p.createElement(Soe,{scope:t,triggerRef:s,contentRef:l,contentId:ay(),titleId:ay(),descriptionId:ay(),open:c,onOpenChange:u,onOpenToggle:p.useCallback(()=>u(d=>!d),[u]),modal:i},n)},B8="DialogPortal",[Eoe,H8]=U8(B8,{forceMount:void 0}),xoe=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:a}=e,o=Hs(B8,t);return p.createElement(Eoe,{scope:t,forceMount:n},p.Children.map(r,i=>p.createElement(mh,{present:n||o.open},p.createElement(aoe,{asChild:!0,container:a},i))))},mk="DialogOverlay",koe=p.forwardRef((e,t)=>{const n=H8(mk,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=Hs(mk,e.__scopeDialog);return o.modal?p.createElement(mh,{present:r||o.open},p.createElement(Coe,W({},a,{ref:t}))):null}),Coe=p.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,a=Hs(mk,n);return p.createElement(voe,{as:Q_,allowPinchZoom:!0,shards:[a.contentRef]},p.createElement(gh.div,W({"data-state":q8(a.open)},r,{ref:t,style:{pointerEvents:"auto",...r.style}})))}),xd="DialogContent",_oe=p.forwardRef((e,t)=>{const n=H8(xd,e.__scopeDialog),{forceMount:r=n.forceMount,...a}=e,o=Hs(xd,e.__scopeDialog);return p.createElement(mh,{present:r||o.open},o.modal?p.createElement(Aoe,W({},a,{ref:t})):p.createElement(Toe,W({},a,{ref:t})))}),Aoe=p.forwardRef((e,t)=>{const n=Hs(xd,e.__scopeDialog),r=p.useRef(null),a=bf(t,n.contentRef,r);return p.useEffect(()=>{const o=r.current;if(o)return gf(o)},[]),p.createElement(V8,W({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ul(e.onCloseAutoFocus,o=>{var i;o.preventDefault(),(i=n.triggerRef.current)===null||i===void 0||i.focus()}),onPointerDownOutside:Ul(e.onPointerDownOutside,o=>{const i=o.detail.originalEvent,s=i.button===0&&i.ctrlKey===!0;(i.button===2||s)&&o.preventDefault()}),onFocusOutside:Ul(e.onFocusOutside,o=>o.preventDefault())}))}),Toe=p.forwardRef((e,t)=>{const n=Hs(xd,e.__scopeDialog),r=p.useRef(!1);return p.createElement(V8,W({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o;if((o=e.onCloseAutoFocus)===null||o===void 0||o.call(e,a),!a.defaultPrevented){var i;r.current||(i=n.triggerRef.current)===null||i===void 0||i.focus(),a.preventDefault()}r.current=!1},onInteractOutside:a=>{var o,i;(o=e.onInteractOutside)===null||o===void 0||o.call(e,a),a.defaultPrevented||(r.current=!0);const s=a.target;((i=n.triggerRef.current)===null||i===void 0?void 0:i.contains(s))&&a.preventDefault()}}))}),V8=p.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,...i}=e,s=Hs(xd,n),l=p.useRef(null),c=bf(t,l);return soe(),p.createElement(p.Fragment,null,p.createElement(Xae,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o},p.createElement(Kae,W({role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":q8(s.open)},i,{ref:c,onDismiss:()=>s.onOpenChange(!1)}))),!1)});function q8(e){return e?"open":"closed"}const Roe=woe,Noe=xoe,Ioe=koe,Ooe=_oe;var sN=1,Doe=.9,Loe=.3,cy=.1,Moe=0,uy=.999,Poe=.9999,$oe=.99,lN=/[\\\/\-_+.# \t"@\[\(\{&]/,Foe=/[\\\/\-_+.# \t"@\[\(\{&]/g;function hk(e,t,n,r,a,o){if(o===t.length)return a===e.length?sN:$oe;for(var i=r.charAt(o),s=n.indexOf(i,a),l=0,c,u,d;s>=0;)c=hk(e,t,n,r,s+1,o+1),c>l&&(s===a?c*=sN:lN.test(e.charAt(s-1))?(c*=Doe,d=e.slice(a,s-1).match(Foe),d&&a>0&&(c*=Math.pow(uy,d.length))):lN.test(e.slice(a,s-1))?(c*=Moe,a>0&&(c*=Math.pow(uy,s-a))):(c*=Loe,a>0&&(c*=Math.pow(uy,s-a))),e.charAt(s)!==t.charAt(o)&&(c*=Poe)),cc&&(c=u*cy)),c>l&&(l=c),s=n.indexOf(i,s+1);return l}function joe(e,t){return hk(e,t,e.toLowerCase(),t.toLowerCase(),0,0)}var zoe=joe;const Uoe=Ac(zoe);var Boe='[cmdk-list-sizer=""]',pu='[cmdk-group=""]',dy='[cmdk-group-items=""]',Hoe='[cmdk-group-heading=""]',G8='[cmdk-item=""]',cN=`${G8}:not([aria-disabled="true"])`,bk="cmdk-item-select",Vo="data-value",Voe=(e,t)=>Uoe(e,t),W8=p.createContext(void 0),yf=()=>p.useContext(W8),K8=p.createContext(void 0),J_=()=>p.useContext(K8),Y8=p.createContext(void 0),Z8=p.forwardRef((e,t)=>{let n=p.useRef(null),r=ul(()=>({search:"",value:"",filtered:{count:0,items:new Map,groups:new Set}})),a=ul(()=>new Set),o=ul(()=>new Map),i=ul(()=>new Map),s=ul(()=>new Set),l=t9(e),{label:c,children:u,value:d,onValueChange:g,filter:m,shouldFilter:y,...b}=e,w=p.useId(),v=p.useId(),h=p.useId(),S=Qoe();zc(()=>{if(d!==void 0){let O=d.trim().toLowerCase();r.current.value=O,S(6,R),E.emit()}},[d]);let E=p.useMemo(()=>({subscribe:O=>(s.current.add(O),()=>s.current.delete(O)),snapshot:()=>r.current,setState:(O,A,V)=>{var P,N,K;if(!Object.is(r.current[O],A)){if(r.current[O]=A,O==="search")T(),C(),S(1,_);else if(O==="value")if(((P=l.current)==null?void 0:P.value)!==void 0){(K=(N=l.current).onValueChange)==null||K.call(N,A);return}else V||S(5,R);E.emit()}},emit:()=>{s.current.forEach(O=>O())}}),[]),k=p.useMemo(()=>({value:(O,A)=>{A!==i.current.get(O)&&(i.current.set(O,A),r.current.filtered.items.set(O,x(A)),S(2,()=>{C(),E.emit()}))},item:(O,A)=>(a.current.add(O),A&&(o.current.has(A)?o.current.get(A).add(O):o.current.set(A,new Set([O]))),S(3,()=>{T(),C(),r.current.value||_(),E.emit()}),()=>{i.current.delete(O),a.current.delete(O),r.current.filtered.items.delete(O),S(4,()=>{T(),_(),E.emit()})}),group:O=>(o.current.has(O)||o.current.set(O,new Set),()=>{i.current.delete(O),o.current.delete(O)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],listId:w,inputId:h,labelId:v}),[]);function x(O){var A;let V=((A=l.current)==null?void 0:A.filter)??Voe;return O?V(O,r.current.search):0}function C(){if(!n.current||!r.current.search||l.current.shouldFilter===!1)return;let O=r.current.filtered.items,A=[];r.current.filtered.groups.forEach(P=>{let N=o.current.get(P),K=0;N.forEach(ae=>{let ne=O.get(ae);K=Math.max(ne,K)}),A.push([P,K])});let V=n.current.querySelector(Boe);D().sort((P,N)=>{let K=P.getAttribute(Vo),ae=N.getAttribute(Vo);return(O.get(ae)??0)-(O.get(K)??0)}).forEach(P=>{let N=P.closest(dy);N?N.appendChild(P.parentElement===N?P:P.closest(`${dy} > *`)):V.appendChild(P.parentElement===V?P:P.closest(`${dy} > *`))}),A.sort((P,N)=>N[1]-P[1]).forEach(P=>{let N=n.current.querySelector(`${pu}[${Vo}="${P[0]}"]`);N==null||N.parentElement.appendChild(N)})}function _(){let O=D().find(V=>!V.ariaDisabled),A=O==null?void 0:O.getAttribute(Vo);E.setState("value",A||void 0)}function T(){if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=a.current.size;return}r.current.filtered.groups=new Set;let O=0;for(let A of a.current){let V=i.current.get(A),P=x(V);r.current.filtered.items.set(A,P),P>0&&O++}for(let[A,V]of o.current)for(let P of V)if(r.current.filtered.items.get(P)>0){r.current.filtered.groups.add(A);break}r.current.filtered.count=O}function R(){var O,A,V;let P=L();P&&(((O=P.parentElement)==null?void 0:O.firstChild)===P&&((V=(A=P.closest(pu))==null?void 0:A.querySelector(Hoe))==null||V.scrollIntoView({block:"nearest"})),P.scrollIntoView({block:"nearest"}))}function L(){return n.current.querySelector(`${G8}[aria-selected="true"]`)}function D(){return Array.from(n.current.querySelectorAll(cN))}function H(O){let A=D()[O];A&&E.setState("value",A.getAttribute(Vo))}function z(O){var A;let V=L(),P=D(),N=P.findIndex(ae=>ae===V),K=P[N+O];(A=l.current)!=null&&A.loop&&(K=N+O<0?P[P.length-1]:N+O===P.length?P[0]:P[N+O]),K&&E.setState("value",K.getAttribute(Vo))}function M(O){let A=L(),V=A==null?void 0:A.closest(pu),P;for(;V&&!P;)V=O>0?Zoe(V,pu):Xoe(V,pu),P=V==null?void 0:V.querySelector(cN);P?E.setState("value",P.getAttribute(Vo)):z(O)}let U=()=>H(D().length-1),X=O=>{O.preventDefault(),O.metaKey?U():O.altKey?M(1):z(1)},j=O=>{O.preventDefault(),O.metaKey?H(0):O.altKey?M(-1):z(-1)};return p.createElement("div",{ref:vf([n,t]),...b,"cmdk-root":"",onKeyDown:O=>{var A;if((A=b.onKeyDown)==null||A.call(b,O),!O.defaultPrevented)switch(O.key){case"n":case"j":{O.ctrlKey&&X(O);break}case"ArrowDown":{X(O);break}case"p":case"k":{O.ctrlKey&&j(O);break}case"ArrowUp":{j(O);break}case"Home":{O.preventDefault(),H(0);break}case"End":{O.preventDefault(),U();break}case"Enter":{O.preventDefault();let V=L();if(V){let P=new Event(bk);V.dispatchEvent(P)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:k.inputId,id:k.labelId,style:Joe},c),p.createElement(K8.Provider,{value:E},p.createElement(W8.Provider,{value:k},u)))}),X8=p.forwardRef((e,t)=>{let n=p.useId(),r=p.useRef(null),a=p.useContext(Y8),o=yf(),i=t9(e);zc(()=>o.item(n,a),[]);let s=n9(n,r,[e.value,e.children,r]),l=J_(),c=wc(v=>v.value&&v.value===s.current),u=wc(v=>o.filter()===!1?!0:v.search?v.filtered.items.get(n)>0:!0);p.useEffect(()=>{let v=r.current;if(!(!v||e.disabled))return v.addEventListener(bk,d),()=>v.removeEventListener(bk,d)},[u,e.onSelect,e.disabled]);function d(){var v,h;(h=(v=i.current).onSelect)==null||h.call(v,s.current)}function g(){l.setState("value",s.current,!0)}if(!u)return null;let{disabled:m,value:y,onSelect:b,...w}=e;return p.createElement("div",{ref:vf([r,t]),...w,"cmdk-item":"",role:"option","aria-disabled":m||void 0,"aria-selected":c||void 0,"data-selected":c||void 0,onPointerMove:m?void 0:g,onClick:m?void 0:d},e.children)}),Q8=p.forwardRef((e,t)=>{let{heading:n,children:r,...a}=e,o=p.useId(),i=p.useRef(null),s=p.useRef(null),l=p.useId(),c=yf(),u=wc(g=>c.filter()===!1?!0:g.search?g.filtered.groups.has(o):!0);zc(()=>c.group(o),[]),n9(o,i,[e.value,e.heading,s]);let d=p.createElement(Y8.Provider,{value:o},r);return p.createElement("div",{ref:vf([i,t]),...a,"cmdk-group":"",role:"presentation",hidden:u?void 0:!0},n&&p.createElement("div",{ref:s,"cmdk-group-heading":"","aria-hidden":!0,id:l},n),p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?l:void 0},d))}),qoe=p.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,a=p.useRef(null),o=wc(i=>!i.search);return!n&&!o?null:p.createElement("div",{ref:vf([a,t]),...r,"cmdk-separator":"",role:"separator"})}),J8=p.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=J_(),i=wc(l=>l.search),s=yf();return p.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),p.createElement("input",{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":s.listId,"aria-labelledby":s.labelId,id:s.inputId,type:"text",value:a?e.value:i,onChange:l=>{a||o.setState("search",l.target.value),n==null||n(l.target.value)}})}),Goe=p.forwardRef((e,t)=>{let{children:n,...r}=e,a=p.useRef(null),o=p.useRef(null),i=yf();return p.useEffect(()=>{if(o.current&&a.current){let s=o.current,l=a.current,c,u=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let d=s.getBoundingClientRect().height;l.style.setProperty("--cmdk-list-height",d.toFixed(1)+"px")})});return u.observe(s),()=>{cancelAnimationFrame(c),u.unobserve(s)}}},[]),p.createElement("div",{ref:vf([a,t]),...r,"cmdk-list":"",role:"listbox","aria-label":"Suggestions",id:i.listId,"aria-labelledby":i.inputId},p.createElement("div",{ref:o,"cmdk-list-sizer":""},n))}),Woe=p.forwardRef((e,t)=>{let{open:n,onOpenChange:r,container:a,...o}=e;return p.createElement(Roe,{open:n,onOpenChange:r},p.createElement(Noe,{container:a},p.createElement(Ioe,{"cmdk-overlay":""}),p.createElement(Ooe,{"aria-label":e.label,"cmdk-dialog":""},p.createElement(Z8,{ref:t,...o}))))}),e9=p.forwardRef((e,t)=>{let n=p.useRef(!0),r=wc(a=>a.filtered.count===0);return p.useEffect(()=>{n.current=!1},[]),n.current||!r?null:p.createElement("div",{ref:t,...e,"cmdk-empty":"",role:"presentation"})}),Koe=p.forwardRef((e,t)=>{let{progress:n,children:r,...a}=e;return p.createElement("div",{ref:t,...a,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Loading..."},p.createElement("div",{"aria-hidden":!0},r))}),Yoe=Object.assign(Z8,{List:Goe,Item:X8,Input:J8,Group:Q8,Separator:qoe,Dialog:Woe,Empty:e9,Loading:Koe});function Zoe(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Xoe(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function t9(e){let t=p.useRef(e);return zc(()=>{t.current=e}),t}var zc=typeof window>"u"?p.useEffect:p.useLayoutEffect;function ul(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function vf(e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}function wc(e){let t=J_(),n=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,n,n)}function n9(e,t,n){let r=p.useRef(),a=yf();return zc(()=>{var o;let i=(()=>{var s;for(let l of n){if(typeof l=="string")return l.trim().toLowerCase();if(typeof l=="object"&&"current"in l&&l.current)return(s=l.current.textContent)==null?void 0:s.trim().toLowerCase()}})();a.value(e,i),(o=t.current)==null||o.setAttribute(Vo,i),r.current=i}),r}var Qoe=()=>{let[e,t]=p.useState(),n=ul(()=>new Map);return zc(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),t({})}},Joe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const r9="Popover",[a9,xTe]=zn(r9,[qa]),eA=qa(),[eie,Uc]=a9(r9),o9=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:a,onOpenChange:o,modal:i=!1}=e,s=eA(t),l=p.useRef(null),[c,u]=p.useState(!1),[d=!1,g]=Fa({prop:r,defaultProp:a,onChange:o});return p.createElement(rh,s,p.createElement(eie,{scope:t,contentId:bi(),triggerRef:l,open:d,onOpenChange:g,onOpenToggle:p.useCallback(()=>g(m=>!m),[g]),hasCustomAnchor:c,onCustomAnchorAdd:p.useCallback(()=>u(!0),[]),onCustomAnchorRemove:p.useCallback(()=>u(!1),[]),modal:i},n))},tie="PopoverTrigger",i9=p.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,a=Uc(tie,n),o=eA(n),i=rt(t,a.triggerRef),s=p.createElement(ze.button,W({type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":u9(a.open)},r,{ref:i,onClick:fe(e.onClick,a.onOpenToggle)}));return a.hasCustomAnchor?s:p.createElement(ff,W({asChild:!0},o),s)}),s9="PopoverPortal",[nie,rie]=a9(s9,{forceMount:void 0}),aie=e=>{const{__scopePopover:t,forceMount:n,children:r,container:a}=e,o=Uc(s9,t);return p.createElement(nie,{scope:t,forceMount:n},p.createElement(pr,{present:n||o.open},p.createElement(Qd,{asChild:!0,container:a},r)))},kd="PopoverContent",l9=p.forwardRef((e,t)=>{const n=rie(kd,e.__scopePopover),{forceMount:r=n.forceMount,...a}=e,o=Uc(kd,e.__scopePopover);return p.createElement(pr,{present:r||o.open},o.modal?p.createElement(oie,W({},a,{ref:t})):p.createElement(iie,W({},a,{ref:t})))}),oie=p.forwardRef((e,t)=>{const n=Uc(kd,e.__scopePopover),r=p.useRef(null),a=rt(t,r),o=p.useRef(!1);return p.useEffect(()=>{const i=r.current;if(i)return gf(i)},[]),p.createElement(ih,{as:$a,allowPinchZoom:!0},p.createElement(c9,W({},e,{ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:fe(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),o.current||(s=n.triggerRef.current)===null||s===void 0||s.focus()}),onPointerDownOutside:fe(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,c=s.button===2||l;o.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:fe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})))}),iie=p.forwardRef((e,t)=>{const n=Uc(kd,e.__scopePopover),r=p.useRef(!1),a=p.useRef(!1);return p.createElement(c9,W({},e,{ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var i;if((i=e.onCloseAutoFocus)===null||i===void 0||i.call(e,o),!o.defaultPrevented){var s;r.current||(s=n.triggerRef.current)===null||s===void 0||s.focus(),o.preventDefault()}r.current=!1,a.current=!1},onInteractOutside:o=>{var i,s;(i=e.onInteractOutside)===null||i===void 0||i.call(e,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((s=n.triggerRef.current)===null||s===void 0?void 0:s.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}}))}),c9=p.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:i,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,g=Uc(kd,n),m=eA(n);return Jm(),p.createElement(eh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:a,onUnmountAutoFocus:o},p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>g.onOpenChange(!1)},p.createElement(pf,W({"data-state":u9(g.open),role:"dialog",id:g.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)"}}))))});function u9(e){return e?"open":"closed"}const sie=o9,lie=i9,cie=aie,d9=l9,uN=o9,dN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(i9,{asChild:!0,...n,children:f.jsxs(ue,{variant:"outline",role:"combobox",className:ee("w-full justify-between font-normal py-2 px-3 hover:bg-transparent",e),children:[t,f.jsx(YC,{className:"h-4 w-4 opacity-50"})]})})),fN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(l9,{className:ee("PopoverContent z-50 bg-background rounded-md border"),...n,children:t})),pN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(Yoe,{className:ee("w-full",e),...n,children:t})),gN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(J8,{className:ee("w-full pt-2 px-3 bg-background text-foreground border-b py-3 focus-visible:outline-none",e),...n,children:t})),mN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(e9,{className:ee("w-full px-3 text-destructive text-sm",e),...n,children:t})),hN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(Q8,{className:ee("w-full",e),...n,children:t})),bN=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(X8,{className:ee("w-full py-2 px-3 hover:bg-muted",e),...n,children:t})),uie=p.forwardRef((e,t)=>p.createElement(ze.label,W({},e,{ref:t,onMouseDown:n=>{var r;(r=e.onMouseDown)===null||r===void 0||r.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault()}}))),f9=uie,die=Jd("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),os=p.forwardRef(({className:e,...t},n)=>f.jsx(f9,{ref:n,className:ee(die(),e),...t}));os.displayName=f9.displayName;const vn=fae,p9=p.createContext({}),ut=({...e})=>f.jsx(p9.Provider,{value:{name:e.name},children:f.jsx(hae,{...e})}),bh=()=>{const e=p.useContext(p9),t=p.useContext(g9),{getFieldState:n,formState:r}=Bs(),a=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...a}},g9=p.createContext({}),it=p.forwardRef(({className:e,...t},n)=>{const r=p.useId();return f.jsx(g9.Provider,{value:{id:r},children:f.jsx("div",{ref:n,className:ee("space-y-2",e),...t})})});it.displayName="FormItem";const yt=p.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:a}=bh();return f.jsx(os,{ref:n,className:ee(r&&"text-destructive",e),htmlFor:a,...t})});yt.displayName="FormLabel";const pt=p.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:a,formMessageId:o}=bh();return f.jsx($a,{ref:t,id:r,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...e})});pt.displayName="FormControl";const Mt=p.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=bh();return f.jsx("p",{ref:n,id:r,className:ee("text-sm text-muted-foreground",e),...t})});Mt.displayName="FormDescription";const ct=p.forwardRef(({className:e,children:t,...n},r)=>{const{error:a,formMessageId:o}=bh(),i=a?String(a==null?void 0:a.message):t;return i?f.jsx("p",{ref:r,id:o,className:ee("text-sm font-medium text-destructive",e),...n,children:i}):null});ct.displayName="FormMessage";function fie(){const e=p.useRef(null);return{formRef:e,onKeyDown:n=>{var r;n.key==="Enter"&&!n.shiftKey&&!n.nativeEvent.isComposing&&((r=e.current)==null||r.requestSubmit(),n.preventDefault())}}}const Vs=p.forwardRef(({className:e,...t},n)=>f.jsx("textarea",{className:ee("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));Vs.displayName="Textarea";const Ai=({limit:e,charCount:t,...n})=>f.jsxs("div",{className:"relative",children:[f.jsx(Vs,{className:ee("min-h-80",n.className),...n}),f.jsxs("div",{className:"absolute bottom-2 right-2.5 text-xs text-muted-foreground",children:[t??0," / ",e]})]}),pie=(...e)=>ee("scroll-m-20 text-2xl font-semibold tracking-tight",e),gie=(...e)=>ee("rounded bg-muted px-[0.3rem] py-[0.2rem] font-mono text-sm font-semibold",e),Tt=(...e)=>ee("text-sm text-muted-foreground",e);var gt;(function(e){e.assertEqual=a=>a;function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const o={};for(const i of a)o[i]=i;return o},e.getValidEnumValues=a=>{const o=e.objectKeys(a).filter(s=>typeof a[a[s]]!="number"),i={};for(const s of o)i[s]=a[s];return e.objectValues(i)},e.objectValues=a=>e.objectKeys(a).map(function(o){return a[o]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const i in a)Object.prototype.hasOwnProperty.call(a,i)&&o.push(i);return o},e.find=(a,o)=>{for(const i of a)if(o(i))return i},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function r(a,o=" | "){return a.map(i=>typeof i=="string"?`'${i}'`:i).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(gt||(gt={}));var yN;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(yN||(yN={}));const ve=gt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xi=e=>{switch(typeof e){case"undefined":return ve.undefined;case"string":return ve.string;case"number":return isNaN(e)?ve.nan:ve.number;case"boolean":return ve.boolean;case"function":return ve.function;case"bigint":return ve.bigint;case"symbol":return ve.symbol;case"object":return Array.isArray(e)?ve.array:e===null?ve.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?ve.promise:typeof Map<"u"&&e instanceof Map?ve.map:typeof Set<"u"&&e instanceof Set?ve.set:typeof Date<"u"&&e instanceof Date?ve.date:ve.object;default:return ve.unknown}},ce=gt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ma extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},a=o=>{for(const i of o.issues)if(i.code==="invalid_union")i.unionErrors.map(a);else if(i.code==="invalid_return_type")a(i.returnTypeError);else if(i.code==="invalid_arguments")a(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const a of this.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Ma.create=e=>new Ma(e);const Vg=(e,t)=>{let n;switch(e.code){case ce.invalid_type:e.received===ve.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ce.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,gt.jsonStringifyReplacer)}`;break;case ce.unrecognized_keys:n=`Unrecognized key(s) in object: ${gt.joinValues(e.keys,", ")}`;break;case ce.invalid_union:n="Invalid input";break;case ce.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${gt.joinValues(e.options)}`;break;case ce.invalid_enum_value:n=`Invalid enum value. Expected ${gt.joinValues(e.options)}, received '${e.received}'`;break;case ce.invalid_arguments:n="Invalid function arguments";break;case ce.invalid_return_type:n="Invalid function return type";break;case ce.invalid_date:n="Invalid date";break;case ce.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:gt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ce.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ce.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ce.custom:n="Invalid input";break;case ce.invalid_intersection_types:n="Intersection results could not be merged";break;case ce.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ce.not_finite:n="Number must be finite";break;default:n=t.defaultError,gt.assertNever(e)}return{message:n}};let mie=Vg;function yk(){return mie}const vk=e=>{const{data:t,path:n,errorMaps:r,issueData:a}=e,o=[...n,...a.path||[]],i={...a,path:o};let s="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)s=c(i,{data:t,defaultError:s}).message;return{...a,path:o,message:a.message||s}};function we(e,t){const n=vk({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,yk(),Vg].filter(r=>!!r)});e.common.issues.push(n)}class Qn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const a of n){if(a.status==="aborted")return Ge;a.status==="dirty"&&t.dirty(),r.push(a.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const a of n)r.push({key:await a.key,value:await a.value});return Qn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const a of n){const{key:o,value:i}=a;if(o.status==="aborted"||i.status==="aborted")return Ge;o.status==="dirty"&&t.dirty(),i.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof i.value<"u"||a.alwaysSet)&&(r[o.value]=i.value)}return{status:t.value,value:r}}}const Ge=Object.freeze({status:"aborted"}),hie=e=>({status:"dirty",value:e}),dr=e=>({status:"valid",value:e}),vN=e=>e.status==="aborted",SN=e=>e.status==="dirty",qg=e=>e.status==="valid",Sk=e=>typeof Promise<"u"&&e instanceof Promise;var Ie;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Ie||(Ie={}));class Ba{constructor(t,n,r,a){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=a}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const wN=(e,t)=>{if(qg(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Ma(e.common.issues);return this._error=n,this._error}}};function qe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:a}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(i,s)=>i.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:a}}class at{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Xi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Xi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Qn,ctx:{common:t.parent.common,data:t.data,parsedType:Xi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Sk(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const a={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xi(t)},o=this._parseSync({data:t,path:a.path,parent:a});return wN(a,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Xi(t)},a=this._parse({data:t,path:r.path,parent:r}),o=await(Sk(a)?a:Promise.resolve(a));return wN(r,o)}refine(t,n){const r=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{const i=t(a),s=()=>o.addIssue({code:ce.custom,...r(a)});return typeof Promise<"u"&&i instanceof Promise?i.then(l=>l?!0:(s(),!1)):i?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,a)=>t(r)?!0:(a.addIssue(typeof n=="function"?n(r,a):n),!1))}_refinement(t){return new xo({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return yi.create(this,this._def)}nullable(){return Cc.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Pa.create(this,this._def)}promise(){return Ad.create(this,this._def)}or(t){return Kg.create([this,t],this._def)}and(t){return Yg.create(this,t,this._def)}transform(t){return new xo({...qe(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new em({...qe(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new Tie({typeName:Me.ZodBranded,type:this,...qe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new _k({...qe(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return yh.create(this,t)}readonly(){return Tk.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const bie=/^c[^\s-]{8,}$/i,yie=/^[a-z][a-z0-9]*$/,vie=/^[0-9A-HJKMNP-TV-Z]{26}$/,Sie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,wie=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Eie="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let fy;const xie=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,kie=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Cie=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function _ie(e,t){return!!((t==="v4"||!t)&&xie.test(e)||(t==="v6"||!t)&&kie.test(e))}class lo extends at{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==ve.string){const o=this._getOrReturnCtx(t);return we(o,{code:ce.invalid_type,expected:ve.string,received:o.parsedType}),Ge}const r=new Qn;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),we(a,{code:ce.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const i=t.data.length>o.value,s=t.data.lengtht.test(a),{validation:n,code:ce.invalid_string,...Ie.errToObj(r)})}_addCheck(t){return new lo({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Ie.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Ie.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Ie.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Ie.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Ie.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Ie.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Ie.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Ie.errToObj(t)})}datetime(t){var n;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...Ie.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Ie.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Ie.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Ie.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Ie.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Ie.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Ie.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Ie.errToObj(n)})}nonempty(t){return this.min(1,Ie.errToObj(t))}trim(){return new lo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new lo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new lo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new lo({checks:[],typeName:Me.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...qe(e)})};function Aie(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,a=n>r?n:r,o=parseInt(e.toFixed(a).replace(".","")),i=parseInt(t.toFixed(a).replace(".",""));return o%i/Math.pow(10,a)}class Ec extends at{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==ve.number){const o=this._getOrReturnCtx(t);return we(o,{code:ce.invalid_type,expected:ve.number,received:o.parsedType}),Ge}let r;const a=new Qn;for(const o of this._def.checks)o.kind==="int"?gt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),we(r,{code:ce.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),we(r,{code:ce.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Aie(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),we(r,{code:ce.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),we(r,{code:ce.not_finite,message:o.message}),a.dirty()):gt.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ie.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ie.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ie.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ie.toString(n))}setLimit(t,n,r,a){return new Ec({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ie.toString(a)}]})}_addCheck(t){return new Ec({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Ie.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ie.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ie.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Ie.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ie.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ie.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&>.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Ec({checks:[],typeName:Me.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...qe(e)});class xc extends at{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==ve.bigint){const o=this._getOrReturnCtx(t);return we(o,{code:ce.invalid_type,expected:ve.bigint,received:o.parsedType}),Ge}let r;const a=new Qn;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),we(r,{code:ce.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),we(r,{code:ce.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):gt.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Ie.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Ie.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Ie.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Ie.toString(n))}setLimit(t,n,r,a){return new xc({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Ie.toString(a)}]})}_addCheck(t){return new xc({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ie.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ie.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ie.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ie.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Ie.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new xc({checks:[],typeName:Me.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...qe(e)})};class wk extends at{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==ve.boolean){const r=this._getOrReturnCtx(t);return we(r,{code:ce.invalid_type,expected:ve.boolean,received:r.parsedType}),Ge}return dr(t.data)}}wk.create=e=>new wk({typeName:Me.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...qe(e)});class Cd extends at{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==ve.date){const o=this._getOrReturnCtx(t);return we(o,{code:ce.invalid_type,expected:ve.date,received:o.parsedType}),Ge}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return we(o,{code:ce.invalid_date}),Ge}const r=new Qn;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),we(a,{code:ce.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):gt.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Cd({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Ie.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Ie.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Cd({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Me.ZodDate,...qe(e)});class Ek extends at{_parse(t){if(this._getType(t)!==ve.symbol){const r=this._getOrReturnCtx(t);return we(r,{code:ce.invalid_type,expected:ve.symbol,received:r.parsedType}),Ge}return dr(t.data)}}Ek.create=e=>new Ek({typeName:Me.ZodSymbol,...qe(e)});class Gg extends at{_parse(t){if(this._getType(t)!==ve.undefined){const r=this._getOrReturnCtx(t);return we(r,{code:ce.invalid_type,expected:ve.undefined,received:r.parsedType}),Ge}return dr(t.data)}}Gg.create=e=>new Gg({typeName:Me.ZodUndefined,...qe(e)});class Wg extends at{_parse(t){if(this._getType(t)!==ve.null){const r=this._getOrReturnCtx(t);return we(r,{code:ce.invalid_type,expected:ve.null,received:r.parsedType}),Ge}return dr(t.data)}}Wg.create=e=>new Wg({typeName:Me.ZodNull,...qe(e)});class _d extends at{constructor(){super(...arguments),this._any=!0}_parse(t){return dr(t.data)}}_d.create=e=>new _d({typeName:Me.ZodAny,...qe(e)});class Bl extends at{constructor(){super(...arguments),this._unknown=!0}_parse(t){return dr(t.data)}}Bl.create=e=>new Bl({typeName:Me.ZodUnknown,...qe(e)});class Ti extends at{_parse(t){const n=this._getOrReturnCtx(t);return we(n,{code:ce.invalid_type,expected:ve.never,received:n.parsedType}),Ge}}Ti.create=e=>new Ti({typeName:Me.ZodNever,...qe(e)});class xk extends at{_parse(t){if(this._getType(t)!==ve.undefined){const r=this._getOrReturnCtx(t);return we(r,{code:ce.invalid_type,expected:ve.void,received:r.parsedType}),Ge}return dr(t.data)}}xk.create=e=>new xk({typeName:Me.ZodVoid,...qe(e)});class Pa extends at{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),a=this._def;if(n.parsedType!==ve.array)return we(n,{code:ce.invalid_type,expected:ve.array,received:n.parsedType}),Ge;if(a.exactLength!==null){const i=n.data.length>a.exactLength.value,s=n.data.lengtha.maxLength.value&&(we(n,{code:ce.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,s)=>a.type._parseAsync(new Ba(n,i,n.path,s)))).then(i=>Qn.mergeArray(r,i));const o=[...n.data].map((i,s)=>a.type._parseSync(new Ba(n,i,n.path,s)));return Qn.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Pa({...this._def,minLength:{value:t,message:Ie.toString(n)}})}max(t,n){return new Pa({...this._def,maxLength:{value:t,message:Ie.toString(n)}})}length(t,n){return new Pa({...this._def,exactLength:{value:t,message:Ie.toString(n)}})}nonempty(t){return this.min(1,t)}}Pa.create=(e,t)=>new Pa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...qe(t)});function dl(e){if(e instanceof Vt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=yi.create(dl(r))}return new Vt({...e._def,shape:()=>t})}else return e instanceof Pa?new Pa({...e._def,type:dl(e.element)}):e instanceof yi?yi.create(dl(e.unwrap())):e instanceof Cc?Cc.create(dl(e.unwrap())):e instanceof Eo?Eo.create(e.items.map(t=>dl(t))):e}class Vt extends at{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=gt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==ve.object){const c=this._getOrReturnCtx(t);return we(c,{code:ce.invalid_type,expected:ve.object,received:c.parsedType}),Ge}const{status:r,ctx:a}=this._processInputParams(t),{shape:o,keys:i}=this._getCached(),s=[];if(!(this._def.catchall instanceof Ti&&this._def.unknownKeys==="strip"))for(const c in a.data)i.includes(c)||s.push(c);const l=[];for(const c of i){const u=o[c],d=a.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Ba(a,d,a.path,c)),alwaysSet:c in a.data})}if(this._def.catchall instanceof Ti){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of s)l.push({key:{status:"valid",value:u},value:{status:"valid",value:a.data[u]}});else if(c==="strict")s.length>0&&(we(a,{code:ce.unrecognized_keys,keys:s}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of s){const d=a.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Ba(a,d,a.path,u)),alwaysSet:u in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key;c.push({key:d,value:await u.value,alwaysSet:u.alwaysSet})}return c}).then(c=>Qn.mergeObjectSync(r,c)):Qn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return Ie.errToObj,new Vt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var a,o,i,s;const l=(i=(o=(a=this._def).errorMap)===null||o===void 0?void 0:o.call(a,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=Ie.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Vt({...this._def,unknownKeys:"strip"})}passthrough(){return new Vt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Vt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Vt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Me.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Vt({...this._def,catchall:t})}pick(t){const n={};return gt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Vt({...this._def,shape:()=>n})}omit(t){const n={};return gt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Vt({...this._def,shape:()=>n})}deepPartial(){return dl(this)}partial(t){const n={};return gt.objectKeys(this.shape).forEach(r=>{const a=this.shape[r];t&&!t[r]?n[r]=a:n[r]=a.optional()}),new Vt({...this._def,shape:()=>n})}required(t){const n={};return gt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof yi;)o=o._def.innerType;n[r]=o}}),new Vt({...this._def,shape:()=>n})}keyof(){return m9(gt.objectKeys(this.shape))}}Vt.create=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strip",catchall:Ti.create(),typeName:Me.ZodObject,...qe(t)});Vt.strictCreate=(e,t)=>new Vt({shape:()=>e,unknownKeys:"strict",catchall:Ti.create(),typeName:Me.ZodObject,...qe(t)});Vt.lazycreate=(e,t)=>new Vt({shape:e,unknownKeys:"strip",catchall:Ti.create(),typeName:Me.ZodObject,...qe(t)});class Kg extends at{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function a(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const i=o.map(s=>new Ma(s.ctx.common.issues));return we(n,{code:ce.invalid_union,unionErrors:i}),Ge}if(n.common.async)return Promise.all(r.map(async o=>{const i={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}})).then(a);{let o;const i=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=i.map(l=>new Ma(l));return we(n,{code:ce.invalid_union,unionErrors:s}),Ge}}get options(){return this._def.options}}Kg.create=(e,t)=>new Kg({options:e,typeName:Me.ZodUnion,...qe(t)});const Gp=e=>e instanceof Xg?Gp(e.schema):e instanceof xo?Gp(e.innerType()):e instanceof Qg?[e.value]:e instanceof Ns?e.options:e instanceof Jg?Object.keys(e.enum):e instanceof em?Gp(e._def.innerType):e instanceof Gg?[void 0]:e instanceof Wg?[null]:null;class tA extends at{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.object)return we(n,{code:ce.invalid_type,expected:ve.object,received:n.parsedType}),Ge;const r=this.discriminator,a=n.data[r],o=this.optionsMap.get(a);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(we(n,{code:ce.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ge)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const a=new Map;for(const o of n){const i=Gp(o.shape[t]);if(!i)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of i){if(a.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);a.set(s,o)}}return new tA({typeName:Me.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:a,...qe(r)})}}function kk(e,t){const n=Xi(e),r=Xi(t);if(e===t)return{valid:!0,data:e};if(n===ve.object&&r===ve.object){const a=gt.objectKeys(t),o=gt.objectKeys(e).filter(s=>a.indexOf(s)!==-1),i={...e,...t};for(const s of o){const l=kk(e[s],t[s]);if(!l.valid)return{valid:!1};i[s]=l.data}return{valid:!0,data:i}}else if(n===ve.array&&r===ve.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(vN(o)||vN(i))return Ge;const s=kk(o.value,i.value);return s.valid?((SN(o)||SN(i))&&n.dirty(),{status:n.value,value:s.data}):(we(r,{code:ce.invalid_intersection_types}),Ge)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,i])=>a(o,i)):a(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Yg.create=(e,t,n)=>new Yg({left:e,right:t,typeName:Me.ZodIntersection,...qe(n)});class Eo extends at{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.array)return we(r,{code:ce.invalid_type,expected:ve.array,received:r.parsedType}),Ge;if(r.data.lengththis._def.items.length&&(we(r,{code:ce.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((i,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Ba(r,i,r.path,s)):null}).filter(i=>!!i);return r.common.async?Promise.all(o).then(i=>Qn.mergeArray(n,i)):Qn.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new Eo({...this._def,rest:t})}}Eo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Eo({items:e,typeName:Me.ZodTuple,rest:null,...qe(t)})};class Zg extends at{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.object)return we(r,{code:ce.invalid_type,expected:ve.object,received:r.parsedType}),Ge;const a=[],o=this._def.keyType,i=this._def.valueType;for(const s in r.data)a.push({key:o._parse(new Ba(r,s,r.path,s)),value:i._parse(new Ba(r,r.data[s],r.path,s))});return r.common.async?Qn.mergeObjectAsync(n,a):Qn.mergeObjectSync(n,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof at?new Zg({keyType:t,valueType:n,typeName:Me.ZodRecord,...qe(r)}):new Zg({keyType:lo.create(),valueType:t,typeName:Me.ZodRecord,...qe(n)})}}class Ck extends at{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.map)return we(r,{code:ce.invalid_type,expected:ve.map,received:r.parsedType}),Ge;const a=this._def.keyType,o=this._def.valueType,i=[...r.data.entries()].map(([s,l],c)=>({key:a._parse(new Ba(r,s,r.path,[c,"key"])),value:o._parse(new Ba(r,l,r.path,[c,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of i){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Ge;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(c.value,u.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of i){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Ge;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),s.set(c.value,u.value)}return{status:n.value,value:s}}}}Ck.create=(e,t,n)=>new Ck({valueType:t,keyType:e,typeName:Me.ZodMap,...qe(n)});class kc extends at{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==ve.set)return we(r,{code:ce.invalid_type,expected:ve.set,received:r.parsedType}),Ge;const a=this._def;a.minSize!==null&&r.data.sizea.maxSize.value&&(we(r,{code:ce.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function i(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Ge;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const s=[...r.data.values()].map((l,c)=>o._parse(new Ba(r,l,r.path,c)));return r.common.async?Promise.all(s).then(l=>i(l)):i(s)}min(t,n){return new kc({...this._def,minSize:{value:t,message:Ie.toString(n)}})}max(t,n){return new kc({...this._def,maxSize:{value:t,message:Ie.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}kc.create=(e,t)=>new kc({valueType:e,minSize:null,maxSize:null,typeName:Me.ZodSet,...qe(t)});class qu extends at{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.function)return we(n,{code:ce.invalid_type,expected:ve.function,received:n.parsedType}),Ge;function r(s,l){return vk({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,yk(),Vg].filter(c=>!!c),issueData:{code:ce.invalid_arguments,argumentsError:l}})}function a(s,l){return vk({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,yk(),Vg].filter(c=>!!c),issueData:{code:ce.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof Ad){const s=this;return dr(async function(...l){const c=new Ma([]),u=await s._def.args.parseAsync(l,o).catch(m=>{throw c.addIssue(r(l,m)),c}),d=await Reflect.apply(i,this,u);return await s._def.returns._def.type.parseAsync(d,o).catch(m=>{throw c.addIssue(a(d,m)),c})})}else{const s=this;return dr(function(...l){const c=s._def.args.safeParse(l,o);if(!c.success)throw new Ma([r(l,c.error)]);const u=Reflect.apply(i,this,c.data),d=s._def.returns.safeParse(u,o);if(!d.success)throw new Ma([a(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new qu({...this._def,args:Eo.create(t).rest(Bl.create())})}returns(t){return new qu({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new qu({args:t||Eo.create([]).rest(Bl.create()),returns:n||Bl.create(),typeName:Me.ZodFunction,...qe(r)})}}class Xg extends at{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Xg.create=(e,t)=>new Xg({getter:e,typeName:Me.ZodLazy,...qe(t)});class Qg extends at{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return we(n,{received:n.data,code:ce.invalid_literal,expected:this._def.value}),Ge}return{status:"valid",value:t.data}}get value(){return this._def.value}}Qg.create=(e,t)=>new Qg({value:e,typeName:Me.ZodLiteral,...qe(t)});function m9(e,t){return new Ns({values:e,typeName:Me.ZodEnum,...qe(t)})}class Ns extends at{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return we(n,{expected:gt.joinValues(r),received:n.parsedType,code:ce.invalid_type}),Ge}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return we(n,{received:n.data,code:ce.invalid_enum_value,options:r}),Ge}return dr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Ns.create(t)}exclude(t){return Ns.create(this.options.filter(n=>!t.includes(n)))}}Ns.create=m9;class Jg extends at{_parse(t){const n=gt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==ve.string&&r.parsedType!==ve.number){const a=gt.objectValues(n);return we(r,{expected:gt.joinValues(a),received:r.parsedType,code:ce.invalid_type}),Ge}if(n.indexOf(t.data)===-1){const a=gt.objectValues(n);return we(r,{received:r.data,code:ce.invalid_enum_value,options:a}),Ge}return dr(t.data)}get enum(){return this._def.values}}Jg.create=(e,t)=>new Jg({values:e,typeName:Me.ZodNativeEnum,...qe(t)});class Ad extends at{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==ve.promise&&n.common.async===!1)return we(n,{code:ce.invalid_type,expected:ve.promise,received:n.parsedType}),Ge;const r=n.parsedType===ve.promise?n.data:Promise.resolve(n.data);return dr(r.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Ad.create=(e,t)=>new Ad({type:e,typeName:Me.ZodPromise,...qe(t)});class xo extends at{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:i=>{we(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const i=a.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(i).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:i,path:r.path,parent:r})}if(a.type==="refinement"){const i=s=>{const l=a.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ge:(s.status==="dirty"&&n.dirty(),i(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Ge:(s.status==="dirty"&&n.dirty(),i(s.value).then(()=>({status:n.value,value:s.value}))))}if(a.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!qg(i))return i;const s=a.transform(i.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>qg(i)?Promise.resolve(a.transform(i.value,o)).then(s=>({status:n.value,value:s})):i);gt.assertNever(a)}}xo.create=(e,t,n)=>new xo({schema:e,typeName:Me.ZodEffects,effect:t,...qe(n)});xo.createWithPreprocess=(e,t,n)=>new xo({schema:t,effect:{type:"preprocess",transform:e},typeName:Me.ZodEffects,...qe(n)});class yi extends at{_parse(t){return this._getType(t)===ve.undefined?dr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}yi.create=(e,t)=>new yi({innerType:e,typeName:Me.ZodOptional,...qe(t)});class Cc extends at{_parse(t){return this._getType(t)===ve.null?dr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Cc.create=(e,t)=>new Cc({innerType:e,typeName:Me.ZodNullable,...qe(t)});class em extends at{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===ve.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}em.create=(e,t)=>new em({innerType:e,typeName:Me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...qe(t)});class _k extends at{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Sk(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ma(r.common.issues)},input:r.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ma(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}_k.create=(e,t)=>new _k({innerType:e,typeName:Me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...qe(t)});class Ak extends at{_parse(t){if(this._getType(t)!==ve.nan){const r=this._getOrReturnCtx(t);return we(r,{code:ce.invalid_type,expected:ve.nan,received:r.parsedType}),Ge}return{status:"valid",value:t.data}}}Ak.create=e=>new Ak({typeName:Me.ZodNaN,...qe(e)});class Tie extends at{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class yh extends at{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ge:o.status==="dirty"?(n.dirty(),hie(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const a=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Ge:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:r.path,parent:r})}}static create(t,n){return new yh({in:t,out:n,typeName:Me.ZodPipeline})}}class Tk extends at{_parse(t){const n=this._def.innerType._parse(t);return qg(n)&&(n.value=Object.freeze(n.value)),n}}Tk.create=(e,t)=>new Tk({innerType:e,typeName:Me.ZodReadonly,...qe(t)});const Rie=(e,t={},n)=>e?_d.create().superRefine((r,a)=>{var o,i;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(i=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&i!==void 0?i:!0,c=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...c,fatal:l})}}):_d.create();Vt.lazycreate;var Me;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Me||(Me={}));const Ce=lo.create;Ec.create;Ak.create;xc.create;wk.create;Cd.create;Ek.create;Gg.create;Wg.create;const Nie=_d.create;Bl.create;Ti.create;xk.create;const nA=Pa.create,Xe=Vt.create;Vt.strictCreate;Kg.create;tA.create;Yg.create;Eo.create;Zg.create;Ck.create;kc.create;qu.create;Xg.create;Qg.create;Ns.create;Jg.create;Ad.create;xo.create;yi.create;Cc.create;xo.createWithPreprocess;yh.create;function EN({setEditPersona:e,personas:t,descriptionName:n,fieldName:r}){const a=Bs(),o=()=>{e(void 0);const i=t.find(s=>s.name===a.watch(n));i&&a.setValue(r,i.value||"")};return f.jsxs("div",{className:"flex justify-end gap-3",children:[f.jsx(ue,{variant:"ghost",type:"button",onClick:o,children:f.jsx("span",{children:"Cancel"})}),f.jsx(ue,{variant:"outline",onClick:()=>e(void 0),children:f.jsx("span",{children:"Save changes"})})]})}function xN({setEditPersona:e,editPersona:t,personaValue:n}){const r=Bs(),a=Mi();return f.jsxs("div",{className:"mt-2 flex gap-4",children:[r.getValues(n)?f.jsxs(ue,{variant:"ghost",className:"px-0",onClick:()=>e(t),children:[f.jsx(ZC,{className:"mr-1 h-4 w-4"}),f.jsx("span",{children:"Edit Persona"})]}):null,f.jsxs(ue,{variant:"ghost",className:"px-0",onClick:()=>a(t==="human"?"/human-templates?openCreatePersona":"/agent-templates?openCreatePersona"),children:[f.jsx(ya,{className:"h-4 w-4"}),f.jsx("span",{children:"New Template"})]})]})}const Iie=Xe({name:Ce().min(2,{message:"Name must be at least 2 characters."}).max(30,{message:"Name must not be longer than 30 characters."}),model:Ce(),humanName:Ce().max(2e3),agentName:Ce().max(2e3)});function Oie(e,t){let n="Error creating agent";const r=`${n}: Unspecified error.`;try{const a=JSON.parse(e.message);a.detail&&(a.detail=="None"?n=r:n=`${n}: ${a.detail}`)}catch{n=r}t({title:n,duration:5e3})}const Qr="persona",fr="human";function Die({personas:e,humans:t,models:n,tools:r,closeDialog:a,openCancelCreateAgent:o}){const i=Xt(),s=dX(),{toast:l}=An(),c=2e3,u=2e3,d=Iie.extend({humanValue:Ce().max(u).min(2,{message:"Human name must be at least 2 characters."}),agentValue:Ce().max(c).min(2,{message:"Agent name must be at least 2 characters."}),embedding_model:Ce()}),{data:g}=E6(),m=bn({resolver:yn(d),defaultValues:{name:"",model:"",embedding_model:"",humanName:"",agentName:"",humanValue:"",agentValue:""},mode:"onChange"}),y=C=>{const _=n.find(T=>T.model===C.model);_&&g&&s.mutate({requestBody:{name:C.name,embedding_config:g.find(T=>T.embedding_model===C.embedding_model)||void 0,llm_config:_,tools:r.filter(T=>T.tags.includes("base")).map(T=>T.name).filter(T=>!!T),memory:{memory:{[fr]:{name:C.humanName,label:fr,value:C.humanValue},[Qr]:{name:C.agentName,label:Qr,value:C.agentValue}}}}},{onSuccess:()=>{i.invalidateQueries({queryKey:g6()}),a(),l({title:"Agent created successfully!",duration:5e3})},onError:T=>Oie(T,l)})},[b,w]=p.useState(),v=m.getFieldState("humanValue").isDirty,h=m.getFieldState("agentValue").isDirty,[S,E]=p.useState(!1),[k,x]=p.useState(!1);return f.jsx(vn,{...m,children:f.jsxs("form",{onSubmit:m.handleSubmit(y),className:"space-y-8",children:[f.jsxs("div",{className:"space-y-4",children:[f.jsx(ut,{control:m.control,name:"name",render:({field:C})=>f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Agent Name"}),f.jsx(pt,{children:f.jsx(_n,{...C})}),f.jsx(Mt,{className:"text-xs",children:"This is your agents display name. It can be a real name or a pseudonym."}),f.jsx(ct,{})]})}),f.jsx(ut,{control:m.control,name:"model",render:({field:C})=>f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Model"}),f.jsxs(So,{onValueChange:C.onChange,value:C.value,children:[f.jsx(pt,{children:f.jsx(za,{children:f.jsx(wo,{placeholder:"Select a model"})})}),f.jsx(Ua,{children:n.map(_=>f.jsx(Fn,{value:_.model,children:_.model},_.model))})]}),f.jsx(Mt,{className:"text-xs ",children:"Select the model to be used with this agent."}),f.jsx(ct,{})]})}),f.jsx(ut,{control:m.control,name:"embedding_model",render:({field:C})=>f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Embedding Config"}),f.jsxs(So,{onValueChange:C.onChange,value:C.value,children:[f.jsx(pt,{children:f.jsx(za,{children:f.jsx(wo,{placeholder:"Select a model"})})}),f.jsx(Ua,{children:g?g.map(_=>f.jsx(Fn,{value:_.embedding_model,children:_.embedding_model},_.embedding_model)):f.jsx(Fn,{value:"loading",disabled:!0,children:"Loading..."})})]}),f.jsx(ct,{})]})})]}),f.jsxs("div",{className:"space-y-6",children:[f.jsxs("div",{children:[f.jsx("p",{className:"font-semibold ",children:"Core memory"}),f.jsx("p",{className:"text-sm text-muted-foreground",children:"Agent’s core memory about itself (agent persona) and the user (human persona)."})]}),f.jsxs("div",{children:[f.jsx(ut,{control:m.control,name:"agentName",render:({field:C})=>f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Agent Persona"}),f.jsxs(uN,{open:S,onOpenChange:E,children:[f.jsx(dN,{children:f.jsxs("div",{className:"flex gap-2",children:[f.jsx("span",{children:C.value??"Search or select"}),h?f.jsx("div",{className:"text-muted-foreground",children:"(Edited)"}):null]})}),f.jsx(fN,{children:f.jsxs(pN,{children:[f.jsx(gN,{placeholder:"Search persona"}),f.jsx(mN,{children:"No Agent Persona was found."}),f.jsx(hN,{children:e.map(_=>f.jsx(bN,{value:_.name||"",onSelect:T=>{const R=e.find(L=>L.name===T);C.onChange(T),m.setValue("agentValue",(R==null?void 0:R.value)||""),E(!1)},children:_.name},_.name))})]})})]}),f.jsx(ct,{})]})}),b==="agent"?null:f.jsx(xN,{editPersona:"agent",setEditPersona:w,personaValue:"agentName"})]}),b==="agent"?f.jsx(ut,{control:m.control,name:"agentValue",render:({field:C})=>{var _;return f.jsxs(f.Fragment,{children:[f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Persona Description"}),f.jsx(pt,{children:f.jsx(Ai,{placeholder:"Describe your persona here",charCount:(_=C.value)==null?void 0:_.length,limit:c,...C})}),f.jsx(Mt,{children:"You can use no more than 2000 characters."}),f.jsx(ct,{})]}),f.jsx(EN,{fieldName:"agentValue",descriptionName:"agentName",personas:e,setEditPersona:w})]})}}):null,f.jsxs("div",{children:[f.jsx(ut,{control:m.control,name:"humanName",render:({field:C})=>f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Human Persona"}),f.jsxs(uN,{open:k,onOpenChange:x,children:[f.jsx(dN,{children:f.jsxs("div",{className:"flex gap-2",children:[f.jsx("span",{children:C.value??"Search or select"}),v?f.jsx("span",{className:"text-muted-foreground",children:"(Edited)"}):null]})}),f.jsx(fN,{children:f.jsxs(pN,{children:[f.jsx(gN,{placeholder:"Search human"}),f.jsx(mN,{children:"No Human Persona was found."}),f.jsx(hN,{children:t.map(_=>f.jsx(bN,{value:_.name||"",onSelect:T=>{const R=t.find(L=>L.name===T);C.onChange(T),m.setValue("humanValue",(R==null?void 0:R.value)||""),x(!1)},children:_.name},_.name))})]})})]}),f.jsx(ct,{})]})}),b==="human"?null:f.jsx(xN,{editPersona:"human",setEditPersona:w,personaValue:"humanName"})]}),b==="human"?f.jsxs(f.Fragment,{children:[f.jsx(ut,{control:m.control,name:"humanValue",render:({field:C})=>{var _;return f.jsxs(it,{className:"space-y-1",children:[f.jsx(yt,{children:"Persona Description"}),f.jsx(pt,{children:f.jsx(Ai,{placeholder:"Describe your human here",charCount:(_=C.value)==null?void 0:_.length,limit:c,...C})}),f.jsx(Mt,{children:"You can use no more than 2000 characters."}),f.jsx(ct,{})]})}}),f.jsx(EN,{fieldName:"humanValue",descriptionName:"humanName",personas:t,setEditPersona:w})]}):null]}),f.jsxs("div",{className:"flex justify-between",children:[f.jsx(ue,{type:"button",variant:"ghost",onClick:()=>o(),children:"Cancel"}),f.jsxs("div",{className:"flex items-center",children:[s.isPending?f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Creating Agent..."})]}):null,f.jsx(ue,{type:"submit",children:"Create Agent"})]})]})]})})}const Lie=({open:e,onOpenChange:t})=>{const{data:n}=w6(),{data:r}=Rg({label:Qr}),{data:a}=Rg({label:fr}),{data:o}=Zm(),[i,s]=p.useState(!1);return f.jsxs(Wt,{open:e,onOpenChange:t,children:[f.jsxs(Bt,{className:"h-full max-h-[95svh] w-full gap-8 sm:max-w-[800px]",hasCloseButton:!1,children:[f.jsxs("button",{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",onClick:()=>s(!0),children:[f.jsx(Di,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]}),f.jsx(Pt,{children:f.jsx($t,{children:"Create Agent"})}),f.jsx("div",{className:"-mt-8 h-full overflow-y-auto p-1",children:f.jsx(Die,{models:n||[],humans:a??[],personas:r??[],tools:o??[],closeDialog:()=>t(!1),openCancelCreateAgent:()=>s(!0)})})]}),f.jsx(cae,{open:i,onOpenChange:l=>s(l),closeDialog:()=>t(!1)})]})},Mie=()=>{const[e,t]=p.useState(!1);return f.jsxs($s,{className:"flex flex-col",children:[f.jsxs("div",{className:"flex items-center justify-between px-4",children:[f.jsx("h1",{className:"mb-4 flex pt-2 text-2xl font-bold",children:"Agents"}),f.jsx(ue,{icon:f.jsx(ya,{className:"h-4 w-4"}),onClick:()=>t(!0),size:"sm",children:"Create Agent"})]}),f.jsx(Bre,{className:"mx-4 h-full",setShowingAgentCreation:t}),f.jsx(Lie,{open:e,onOpenChange:n=>t(n)})]})},Pie={path:"agents",element:f.jsx(Mie,{})},h9=Jd("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-background-darker hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function b9({className:e,variant:t,...n}){return f.jsx("div",{className:ee(h9({variant:t}),e),...n})}const $ie=(e,t)=>e==="date"?Sre(t):t,y9=nf(Hm(e=>({history:{},actions:{addMessage:(t,n)=>e(r=>({...r,history:{...r.history,[t]:[...r.history[t]??[],n]}})),replaceLastMessage:(t,n)=>e(r=>{const a=[...r.history[t]];return a.length>0&&(a[a.length-1]=n),{...r,history:{...r.history,[t]:a}}}),replaceMessageIds:(t,n,r)=>e(a=>{const o=a.history[t],i=[];for(const s of o)s.id===n&&(console.log("replacing old id",n,r),s.id=r),i.push(s);return{...a,history:{...a.history,[t]:i}}})}}),{name:"message-history-storage",storage:o_(()=>localStorage,{reviver:$ie}),partialize:({actions:e,...t})=>t})),Fie=e=>y9(t=>t.history[e]??[]),jie=()=>y9(e=>e.actions);async function zie(e,t){const n=e.getReader();let r;for(;!(r=await n.read()).done;)t(r.value)}function Uie(e){let t,n,r,a=!1;return function(i){t===void 0?(t=i,n=0,r=-1):t=Hie(t,i);const s=t.length;let l=0;for(;n0){const l=a.decode(i.subarray(0,s)),c=s+(i[s+1]===32?2:1),u=a.decode(i.subarray(c));switch(l){case"data":r.data=r.data?r.data+` @@ -155,7 +155,7 @@ Error generating stack: `+o.message+` `),l(h?{type:"agent_response",message_type:"assistant_message",message:w.startsWith(`{ "message": "`)?w.replace(`{ "message": "`,"").replace('"}',"").replace('",}',"").replace(`" -}`,""):"",date:x.date,id:v}:{type:"agent_response",message_type:"function_call",message:w.replace("}","})"),date:x.date,id:v}))}else"function_return"in x?(h=!1,console.error("replacing ids",v,x.id),c(v,x.id),console.log("a",x),s({type:"agent_response",message_type:"function_return",message:"None",date:x.date,id:x.id}),d(),S()):"internal_error"in x?(console.log("error",x),m()):console.log("not matched",x)},onclose(){console.log("Connection closed by the server"),S(),u()},onerror(E){console.log("There was an error from server",E),S(),m()}}),v},registerOnMessageCallback:n=>e(r=>({...r,onMessageCallback:n})),registerOnLastMessageReplaceCallback:n=>e(r=>({...r,onLastMessageReplaceCallback:n})),registerOnReplaceTemporaryIdsWithReturnedIdsCallback:n=>e(r=>({...r,onReplaceTemporaryIdsWithReturnedIdsCallback:n})),abortStream:()=>{var n;(n=t().abortController)==null||n.abort(),e({...e,abortController:null,readyState:0})}}}))),AN=()=>Xie(e=>e.actions),Qie="The user is back! Let's pick up the conversation! Reflect on the previous conversation and use your function calling to send them a friendly message.",Sf=nf(Hm((e,t)=>({showingMessageReceipts:!1,showingInternalMonologue:!0,shouldSendAutoMessage:!1,autoMessage:Qie,showingFunctions:!0,actions:{setShouldSendAutoMessage:n=>e({...t(),shouldSendAutoMessage:n}),setAutoMessage:n=>e({...t(),autoMessage:n}),setShowingInternalMonologue:n=>e({...t(),showingInternalMonologue:n}),setShowingFunctions:n=>e({...t(),showingFunctions:n}),setShowingMessageReceipts:n=>e({...t(),showingMessageReceipts:n})}}),{name:"chat-storage",partialize:({actions:e,...t})=>t})),Jie=()=>Sf(e=>e.showingMessageReceipts),w9=()=>Sf(e=>e.showingInternalMonologue),E9=()=>Sf(e=>e.showingFunctions),x9=()=>Sf(e=>({shouldSendAutoMessage:e.shouldSendAutoMessage,autoMessage:e.autoMessage})),ese=()=>Sf(e=>e.actions),tse=sie,nse=lie,k9=p.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>f.jsx(cie,{children:f.jsx(d9,{ref:a,align:t,sideOffset:n,className:ee("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...r})}));k9.displayName=d9.displayName;const C9="Switch",[rse,kTe]=zn(C9),[ase,ose]=rse(C9),ise=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:i,disabled:s,value:l="on",onCheckedChange:c,...u}=e,[d,g]=p.useState(null),m=rt(t,h=>g(h)),y=p.useRef(!1),b=d?!!d.closest("form"):!0,[w=!1,v]=Fa({prop:a,defaultProp:o,onChange:c});return p.createElement(ase,{scope:n,checked:w,disabled:s},p.createElement(ze.button,W({type:"button",role:"switch","aria-checked":w,"aria-required":i,"data-state":_9(w),"data-disabled":s?"":void 0,disabled:s,value:l},u,{ref:m,onClick:fe(e.onClick,h=>{v(S=>!S),b&&(y.current=h.isPropagationStopped(),y.current||h.stopPropagation())})})),b&&p.createElement(cse,{control:d,bubbles:!y.current,name:r,value:l,checked:w,required:i,disabled:s,style:{transform:"translateX(-100%)"}}))}),sse="SwitchThumb",lse=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=ose(sse,n);return p.createElement(ze.span,W({"data-state":_9(a.checked),"data-disabled":a.disabled?"":void 0},r,{ref:t}))}),cse=e=>{const{control:t,checked:n,bubbles:r=!0,...a}=e,o=p.useRef(null),i=F_(n),s=N_(t);return p.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const g=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(g)}},[i,n,r]),p.createElement("input",W({type:"checkbox","aria-hidden":!0,defaultChecked:n},a,{tabIndex:-1,ref:o,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function _9(e){return e?"checked":"unchecked"}const A9=ise,use=lse,Wp=p.forwardRef(({className:e,...t},n)=>f.jsx(A9,{className:ee("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:f.jsx(use,{className:ee("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Wp.displayName=A9.displayName;const dse=()=>{const{autoMessage:e,shouldSendAutoMessage:t}=x9(),[n,r]=p.useState(e),[a,o]=p.useState("idle"),i=w9(),s=E9(),{setShowingInternalMonologue:l,setShowingFunctions:c,setAutoMessage:u,setShouldSendAutoMessage:d}=ese(),g=()=>{o("updating"),setTimeout(()=>{u(n),o("success"),setTimeout(()=>o("idle"),600)},600)};return f.jsxs(tse,{children:[f.jsx(nse,{asChild:!0,children:f.jsx(ue,{size:"iconXs",className:"absolute right-3 top-2 z-10",variant:"outline",children:f.jsx(jq,{className:"size-4"})})}),f.jsxs(k9,{align:"end",className:"w-80 space-y-4 rounded-md border bg-background p-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(os,{htmlFor:"internal-monologue",children:"Show Internal Monologue"}),f.jsx(Wp,{checked:i,onCheckedChange:m=>l(m),id:"internal-monologue"})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(os,{htmlFor:"showing-functions",children:"Show Functions"}),f.jsx(Wp,{checked:s,onCheckedChange:m=>c(m),id:"showing-functions"})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(os,{htmlFor:"should-send-auto-message",children:"Send Auto Message"}),f.jsx(Wp,{checked:t,onCheckedChange:m=>d(m),id:"should-send-auto-message"})]}),f.jsxs("div",{className:"flex flex-col space-y-2",children:[f.jsx(os,{htmlFor:"auto-message",children:"Auto Message"}),f.jsx(Vs,{id:"auto-message",className:"min-h-[10rem] resize-none",value:n,onChange:m=>r(m.target.value)}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(ue,{disabled:a==="updating",onClick:g,className:"w-fit",variant:"outline",size:"xs",children:"Update Message"}),a!=="updating"?null:f.jsx("div",{className:Tt("ml-4 flex items-center animate-in slide-in-from-bottom-2"),children:f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "})}),a!=="success"?null:f.jsx("div",{className:Tt("ml-4 flex items-center text-emerald-600 animate-in slide-in-from-bottom-2"),children:f.jsx(Lm,{className:"mr-2 h-4 w-4 "})})]})]})]})]})},vh=({children:e,className:t})=>f.jsx("h4",{className:ee("text-sm font-medium uppercase text-foreground",t),children:e}),Sh=({children:e,className:t,button:n,onClickInfo:r})=>f.jsxs(vh,{className:ee("flex h-8 items-center justify-between",t),children:[f.jsxs("span",{className:"inline-flex items-center tabular-nums",children:[f.jsx("span",{children:e}),f.jsx(Iq,{className:"ml-1.5 size-3.5 text-muted-foreground",onClick:r})]}),n]}),rA=({onClick:e})=>f.jsx(ue,{onClick:e,size:"iconXs",variant:"outline",children:f.jsx(ya,{className:"size-4 text-foreground"})}),T9=({className:e,children:t,onClick:n})=>f.jsxs("div",{className:ee("flex items-center justify-between rounded-md border border-dashed p-2 text-sm font-normal text-muted-foreground",e),children:[f.jsx("span",{children:t}),f.jsx(ue,{onClick:n,size:"iconXs",variant:"outline",children:f.jsx(ya,{className:"size-4 text-foreground"})})]}),fse=Xe({message:Ce().min(1,"Message cannot be empty...")}),pse=e=>{const n=bn({resolver:yn(fse),defaultValues:{message:""}});function r(a){e.onCreateArchivalMemory(a.message)}return f.jsx(vn,{...n,children:f.jsxs("form",{onSubmit:n.handleSubmit(r),className:"mt-4",children:[f.jsx(ut,{control:n.control,name:"message",render:({field:a})=>{var o;return f.jsxs(it,{className:"-mt-2 w-full",children:[f.jsx(yt,{className:"sr-only",children:"Memory to store"}),f.jsx(pt,{className:"w-full",children:f.jsx(Ai,{className:"min-h-40",placeholder:"What you want the agent to know about you",charCount:(o=a.value)==null?void 0:o.length,limit:2e3,...a})}),f.jsx(ct,{})]})}}),f.jsxs("div",{className:"flex items-center justify-between pt-8",children:[f.jsx(ue,{type:"button",onClick:e.onCancel,variant:"ghost",children:"Cancel"}),f.jsxs("div",{className:"flex gap-3",children:[e.isPending&&f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Saving memory..."})]}),f.jsx(ue,{disabled:e.isPending,type:"submit",children:"Save Memory"})]})]})]})})},gse=({agentId:e,open:t,onOpenChange:n})=>{const r=Xt(),a=fX(),o=i=>{a.mutate({agentId:e||"",requestBody:{text:i}},{onSuccess:()=>{n(!1),r.invalidateQueries({queryKey:h6({agentId:e||""})})}})};return f.jsx(Wt,{open:t,onOpenChange:n,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Add Memory"}),f.jsx(dn,{children:"Add a memory. Archival memory serves as an infinite, structured storage space for reflections, insights, and other data not fitting into core memory."})]}),f.jsx(pse,{isPending:a.isPending,onCreateArchivalMemory:o,onCancel:()=>n(!1)})]})})},mse=({memoryId:e,agentId:t,open:n,onOpenChange:r})=>{const a=Xt(),o=hX(),i=()=>o.mutate({agentId:t||"",memoryId:e},{onSuccess:()=>{a.invalidateQueries({queryKey:sf({agentId:t||""})}),r(!1)}});return f.jsx(Wt,{open:n,onOpenChange:r,children:f.jsxs(Bt,{className:"w-full sm:max-w-[350px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Delete Memory"}),f.jsx(dn,{className:"!my-4",children:"Are you sure you want to delete this memory?"})]}),f.jsxs(g8,{children:[f.jsx(ue,{size:"sm",type:"button",onClick:()=>r(!1),variant:"ghost",children:"Cancel"}),f.jsx(ue,{size:"sm",disabled:o.isPending,onClick:i,children:"Delete"})]})]})})},R9=({className:e,archivalMemory:t,agentId:n,isViewMemoryDialog:r})=>{const[a,o]=p.useState(!1),[i,s]=p.useState(!0),[l,c]=p.useState(!1),u=p.useRef(null),d=p.useRef(null);return p.useLayoutEffect(()=>{(()=>{if(u.current&&d.current){const m=u.current.scrollWidth>d.current.clientWidth;c(m)}})()},[t.text]),f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:ee("relative w-full rounded-md border p-4 pr-10",e),children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"Jun 18 2024"}),f.jsx("div",{className:ee("break-words text-sm",i&&"truncate"),ref:d,children:f.jsx("p",{ref:u,className:ee(i?"w-min":"w-full",!r&&"inline"),children:t.text})})]}),f.jsx(ue,{className:"absolute right-2 top-2.5 text-muted-foreground",onClick:()=>o(!0),variant:"ghost",size:"iconXs",children:f.jsx(Di,{className:"size-4"})}),r&&l?f.jsx(ue,{className:"mt-2 h-7 w-fit p-0 font-semibold",variant:"link",onClick:()=>s(!i),children:i?f.jsxs(f.Fragment,{children:["more",f.jsx(YC,{className:"ml-2 h-4 w-4"})]}):f.jsxs(f.Fragment,{children:["less",f.jsx(Eq,{className:"ml-2 h-4 w-4"})]})}):null]}),f.jsx(mse,{memoryId:t.id||"",agentId:n,open:a,onOpenChange:o})]})},hse=({setCurrentPage:e,className:t,currentPage:n,totalPages:r})=>f.jsx("div",{className:ee("flex items-center justify-end space-x-2",t),children:f.jsxs("div",{className:"space-x-2",children:[f.jsx(ue,{variant:"outline",size:"sm",onClick:()=>e(a=>Math.max(a-1,1)),disabled:n===1,children:"Previous"}),f.jsx(ue,{variant:"outline",size:"sm",onClick:()=>e(a=>Math.min(a+1,r)),disabled:n===r,children:"Next"})]})}),aA=({items:e,searchTerm:t,setSearchTerm:n,setShowSearchInput:r,showSearchInput:a,onOpenAddDialog:o,buttonText:i,isViewArchivalMemoryDialog:s,setShowFilterButton:l,showFilterButton:c})=>{const u=()=>{r(!a),l&&l(!1)},d=()=>{l&&l(!c),r(!1)};return f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex h-8 w-full items-center justify-between",children:[f.jsxs("p",{className:"text-xs",children:[e?e==null?void 0:e.length:null," items"]}),f.jsxs("div",{className:"flex h-full gap-2",children:[f.jsxs("div",{className:"relative flex h-full items-center justify-end border-r-2",children:[a?f.jsx(_n,{placeholder:"Search",value:t,onChange:g=>n(g.target.value),className:"mr-2 h-8 w-32 pl-9 md:w-52"}):null,f.jsx("button",{className:ee("mr-2",a&&"absolute left-3 top-2"),onClick:()=>u(),children:f.jsx(Ms,{className:ee("h-4 w-4")})})]}),s?f.jsxs("div",{className:"flex h-full items-center justify-end gap-2 border-r-2",children:[c?f.jsx(ue,{className:"px-2 py-0",size:"sm",children:f.jsx("span",{className:"p-0 text-xs",children:"Oldest to newest"})}):null,f.jsx("button",{className:ee("mr-2 h-full p-0.5",c&&"bg-muted"),onClick:()=>d(),children:f.jsx(vq,{className:"h-4 w-4"})})]}):null]})]}),f.jsxs(ue,{variant:"ghost",onClick:()=>o(!0),children:[i,f.jsx(ya,{className:"ml-1 h-4 w-4"})]})]})},bse=({agentId:e,open:t,onOpenChange:n,onOpenAddMemory:r})=>{V4();const o=S6({agentId:e||""}).data??[],[i,s]=p.useState(!1),[l,c]=p.useState(!1),[u,d]=p.useState(""),g=(o??[]).filter(S=>S.text.toLowerCase().includes(u.toLowerCase())),[m,y]=p.useState(1),b=10,w=m*b,v=w-b,h=g.slice(v,w);return f.jsx(Wt,{open:t,onOpenChange:n,children:f.jsxs(Bt,{className:"flex max-h-[95svh] flex-col overflow-auto sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Archival Memory"}),f.jsx(dn,{children:"Archival memory serves as an infinite, structured storage space for reflections, insights, and other data not fitting into core memory."}),f.jsx(aA,{items:o,searchTerm:u,setSearchTerm:d,setShowSearchInput:s,showSearchInput:i,onOpenAddDialog:r,buttonText:"Add Memory",isViewArchivalMemoryDialog:!0,setShowFilterButton:c,showFilterButton:l})]}),f.jsx("div",{className:"flex w-full flex-col",children:h.map(S=>f.jsx(R9,{agentId:e,archivalMemory:S,className:"mb-2",isViewMemoryDialog:!0},S.id))}),f.jsx(hse,{currentPage:m,setCurrentPage:y,totalPages:Math.ceil(g.length/b)})]})})},yse=({agentId:e})=>{const t=S6({agentId:e??""},void 0,{enabled:!!e}),n=t.data??[],[r,a]=p.useState(!1),[o,i]=p.useState(!1),s=()=>a(!0);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"py-4",children:[f.jsxs(Sh,{button:n.length===0?null:f.jsx(rA,{onClick:()=>i(!0)}),children:["Archival Memory (",n.length,")"]}),t.isFetching?f.jsx(Pi,{className:"h-[70px]"}):null,t.isError?f.jsx("div",{className:"h-[70px] border border-destructive",children:"Something went wrong..."}):null,t.isSuccess?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-2",children:[...n].slice(0,3).map(l=>f.jsx(R9,{className:"mb-2",archivalMemory:l,agentId:e},l.id))}),n.length<1?null:f.jsxs(ue,{onClick:s,className:"mt-2 h-7 w-fit p-2 font-semibold",variant:"link",children:["See all ",f.jsx(Pm,{className:"ml-2 h-4 w-4"})]}),n.length>0?null:f.jsx(T9,{onClick:()=>i(!0),children:"Nothing here yet. Add memory"})]}):null]}),f.jsx(bse,{agentId:e,open:r,onOpenChange:a,onOpenAddMemory:l=>i(l)}),f.jsx(gse,{agentId:e,open:o,onOpenChange:i})]})},vse=(e,t)=>e.length>t?e.substring(0,t)+"...":e;function Sse(e,t){let n="Error adding data source...";const r=`${n}: Unspecified error.`;try{const a=JSON.parse(e.message);a.detail&&(a.detail=="None"?n=r:n=`${n}: ${a.detail}`)}catch{n=r}t({title:n,duration:5e3})}const N9=({source:e,handleRemoveDataSource:t})=>f.jsxs("div",{className:"relative rounded-md border p-4",children:[f.jsxs("p",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"font-medium",children:e.name}),f.jsx("span",{className:"mt-0.5 text-xs text-muted-foreground",children:Us(new Date(e.created_at||""),"MMM dd yyyy")})]}),f.jsx("p",{className:Tt(),children:(e==null?void 0:e.description)??"None"}),f.jsxs("button",{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",onClick:()=>t(e.id||""),children:[f.jsx(Di,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]},e.id),wse=Xe({sourceIds:nA(Ce())}),Ese=({closeDialog:e})=>{const t=To(),n=Xt(),{data:r,isLoading:a}=h_(),{data:o}=v6({agentId:(t==null?void 0:t.id)||""}),i=x6(),[s,l]=p.useState(!1),{toast:c}=An(),u=r??[],d=bn({resolver:yn(wse),mode:"onSubmit",defaultValues:{sourceIds:[]}}),g=async v=>{if(!(t!=null&&t.id))return;l(!0);const h=[];for(const S of v.sourceIds)try{const E=await i.mutateAsync({agentId:t.id,sourceId:S},{onSuccess:()=>{n.invalidateQueries({queryKey:m6({agentId:t.id||""})}),c({title:"Data source added successfully!",duration:5e3})}});h.push(E)}catch(E){Sse(E,c)}h.length>0&&c({title:"Data source added successfully!",duration:5e3}),l(!1),e()},m=d.watch("sourceIds"),y=p.useMemo(()=>{if(!u)return[];const v=new Set(m),h=new Set((o||[]).map(S=>S.id));return u.filter(S=>!v.has(S.id||"")&&!h.has(S.id))},[r,u,m]),b=v=>{m.some(h=>h===v)||d.setValue("sourceIds",[...m,v])},w=v=>{d.setValue("sourceIds",m.filter(h=>h!==v))};return f.jsx(vn,{...d,children:f.jsxs("form",{onSubmit:d.handleSubmit(g,v=>console.log(v)),className:"space-y-8",children:[f.jsx(ut,{control:d.control,name:"sourceIds",render:()=>f.jsxs(it,{children:[f.jsxs(So,{disabled:a,value:"",onValueChange:v=>b(v),children:[f.jsx(pt,{children:f.jsx(za,{children:f.jsx(wo,{placeholder:a?"Loading data sources...":"Search or select data source"})})}),f.jsx(Ua,{className:"max-h-[200px] overflow-y-auto",children:(y==null?void 0:y.length)===0?f.jsx(Fn,{value:"no-sources",disabled:!0,children:"No additional data sources available"}):y.map(v=>f.jsx(Fn,{value:v.id||"",children:v.name},v.id))})]}),f.jsx(ct,{})]})}),f.jsx("div",{className:"space-y-2",children:d.watch("sourceIds")?u.filter(v=>d.getValues("sourceIds").some(h=>h===v.id)).map(v=>f.jsx(N9,{handleRemoveDataSource:w,source:v},v.id)):null}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(ue,{variant:"ghost",type:"button",onClick:()=>e(),children:"Cancel"}),f.jsxs("div",{className:"flex gap-3",children:[s&&f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Attaching to agent..."})]}),f.jsx(ue,{type:"submit",children:"Add Source"})]})]})]})})},xse=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Add Data Source"}),f.jsx(dn,{children:"By adding a data source, you will make it available to the Agent to use for information."})]}),f.jsx(Ese,{closeDialog:()=>t(!1)})]})}),kse=({onDetach:e,onOpenAddSourceChange:t})=>{const n=[],[r,a]=p.useState(!1),[o,i]=p.useState(""),s=(n??[]).filter(l=>l.name.toLowerCase().includes(o.toLowerCase()));return f.jsxs(f.Fragment,{children:[f.jsx(aA,{items:n,searchTerm:o,setSearchTerm:i,setShowSearchInput:a,showSearchInput:r,onOpenAddDialog:t,buttonText:"Add Source"}),f.jsx("div",{className:"space-y-2",children:n?s.map(l=>f.jsx(N9,{handleRemoveDataSource:e,source:l},l.id)):null})]})},Cse=({open:e,onOpenChange:t,onDetach:n,onOpenAddSourceChange:r})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Data Sources"}),f.jsx(dn,{children:"Data sources make it available to the Agent to use for information outside of the immediate context window."})]}),f.jsx(kse,{onDetach:n,onOpenAddSourceChange:r})]})}),_se=()=>{const[e,t]=p.useState(!1),[n,r]=p.useState(!1),a=To(),{data:o}=v6({agentId:(a==null?void 0:a.id)||""}),i=p.useMemo(()=>o??[],[o]),s=k6(),{toast:l}=An(),c=u=>{!u||!a||s.mutate({agentId:a.id||"",sourceId:u},{onSuccess:()=>{l({title:"Agent detached successfully!",duration:3e3})},onError:d=>l({title:"Failed to detach agent!",duration:3e3})})};return f.jsxs("div",{className:"py-4",children:[f.jsxs(Sh,{button:i.length===0?null:f.jsx(rA,{onClick:()=>t(!0)}),onClickInfo:()=>r(!0),children:["Data Sources (",i.length,")"]}),f.jsx("ul",{className:"mt-2 space-y-2",children:i.map(u=>f.jsxs("li",{className:"rounded-md border p-4",children:[f.jsx("div",{className:"relative flex justify-between",children:f.jsxs("p",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-medium",children:u.name}),f.jsx("span",{className:"text-xs",children:Us(new Date(u.created_at||""),"MMM dd yyyy")})]})}),f.jsx("p",{className:Tt(),children:vse((u==null?void 0:u.description)??"None",42)})]},u.id))}),i.length>0?null:f.jsx(T9,{onClick:()=>t(!0),children:"Nothing here yet. Add source"}),f.jsx(xse,{open:e,onOpenChange:u=>t(u)}),f.jsx(Cse,{open:n,onOpenChange:u=>r(u),onDetach:c,onOpenAddSourceChange:u=>t(u)})]})},Ase="AlertDialog",[Tse,CTe]=zn(Ase,[i8]),Ro=i8(),Rse=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ro(t);return p.createElement(d8,W({},r,n,{modal:!0}))},Nse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(sae,W({},a,r,{ref:t}))}),Ise=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ro(t);return p.createElement(f8,W({},r,n))},Ose=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(H_,W({},a,r,{ref:t}))}),I9="AlertDialogContent",[Dse,Lse]=Tse(I9),Mse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=Ro(n),i=p.useRef(null),s=rt(t,i),l=p.useRef(null);return p.createElement(iae,{contentName:I9,titleName:Pse,docsSlug:"alert-dialog"},p.createElement(Dse,{scope:n,cancelRef:l},p.createElement(V_,W({role:"alertdialog"},o,a,{ref:s,onOpenAutoFocus:fe(a.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=l.current)===null||u===void 0||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault()}),p.createElement(Tm,null,r),!1)))}),Pse="AlertDialogTitle",$se=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(q_,W({},a,r,{ref:t}))}),Fse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(G_,W({},a,r,{ref:t}))}),jse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(W_,W({},a,r,{ref:t}))}),zse="AlertDialogCancel",Use=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=Lse(zse,n),o=Ro(n),i=rt(t,a);return p.createElement(W_,W({},o,r,{ref:i}))}),Bse=Rse,Hse=Nse,Vse=Ise,O9=Ose,D9=Mse,L9=jse,M9=Use,P9=$se,$9=Fse,qse=Bse,Gse=Hse,Wse=Vse,F9=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(O9,{className:ee("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...n,ref:r}));F9.displayName=O9.displayName;const j9=p.forwardRef(({className:e,...t},n)=>f.jsxs(Wse,{children:[f.jsx(F9,{}),f.jsx(D9,{ref:n,className:ee("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...t})]}));j9.displayName=D9.displayName;const z9=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col space-y-2 text-center sm:text-left",e),...t});z9.displayName="AlertDialogHeader";const U9=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});U9.displayName="AlertDialogFooter";const B9=p.forwardRef(({className:e,...t},n)=>f.jsx(P9,{ref:n,className:ee("text-lg font-semibold",e),...t}));B9.displayName=P9.displayName;const H9=p.forwardRef(({className:e,...t},n)=>f.jsx($9,{ref:n,className:ee("text-sm text-muted-foreground",e),...t}));H9.displayName=$9.displayName;const V9=p.forwardRef(({className:e,variant:t,...n},r)=>f.jsx(L9,{ref:r,className:ee(bc({variant:t}),e),...n}));V9.displayName=L9.displayName;const q9=p.forwardRef(({className:e,...t},n)=>f.jsx(M9,{ref:n,className:ee(bc({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));q9.displayName=M9.displayName;const Kse=()=>{const e=To(),{mutate:t,isPending:n}=mX(),{toast:r}=An(),a=Mi(),o=p.useCallback(()=>{e&&t({agentId:e.id||""},{onSuccess:()=>{r({title:"Agent deleted successfully",duration:500}),a("/agents")},onError:()=>{r({title:"There was an error deleting the agent, please try again",duration:5e3})}})},[e==null?void 0:e.id,a,t]);return f.jsxs(qse,{children:[f.jsx(Gse,{asChild:!0,children:f.jsx(ue,{variant:"destructive",children:"Delete Agent"})}),f.jsxs(j9,{children:[f.jsxs(z9,{children:[f.jsx(B9,{children:"Delete Agent"}),f.jsx(H9,{children:"When you delete an agent, all the information and interaction will be lost. Are you sure you want to delete the agent"})]}),f.jsxs(U9,{children:[f.jsx(q9,{children:"Cancel"}),f.jsx(V9,{onClick:o,variant:"destructive",children:f.jsxs(f.Fragment,{children:[n&&f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),"Delete Agent"]})})]})]})]})},Yse=()=>f.jsxs("div",{className:"flex flex-col gap-2 pb-10 pt-4",children:[f.jsx(vh,{children:"Delete Agent"}),f.jsx("p",{className:" text-sm text-muted-foreground",children:"When you delete an agent, all the information and interaction will be lost."}),f.jsx(Kse,{})]}),Zse={configItem:e=>["config",e]},Xse=e=>{const t=AZ();return Jr({queryKey:Zse.configItem(e),enabled:!!e,queryFn:async()=>t.get("/config").then(n=>n.data)})},G9=({icon:e,name:t,isEditing:n,onEditPersonaClicked:r})=>f.jsxs("div",{className:"flex items-center justify-between py-4",children:[f.jsxs("div",{className:"flex items-center font-medium",children:[e,f.jsx("span",{children:t})]}),n?null:f.jsxs(ue,{onClick:r,variant:"ghost",size:"xs",children:["Edit Persona ",f.jsx(ZC,{className:"ml-2 size-4"})]})]}),W9=({renderContent:e,state:t,onClose:n})=>{const r=p.useRef("closed"),a=t==="edit"||t==="closed"&&r.current==="edit";return p.useEffect(()=>{r.current=t},[t]),f.jsx(Wt,{open:t==="view"||t==="edit",onOpenChange:o=>{o||n()},children:f.jsx(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:e(a)})})},K9=({status:e,limit:t,defaultContent:n,onCancelClicked:r,onSaveClicked:a})=>{const[o,i]=p.useState(n);return f.jsxs(f.Fragment,{children:[f.jsxs(os,{children:["Persona Description",f.jsx(Ai,{charCount:(o==null?void 0:o.length)??0,limit:t,onChange:s=>i(s.target.value),className:"min-h-[60vh] whitespace-pre-line font-normal",defaultValue:o})]}),f.jsxs("div",{className:"flex items-center justify-between pt-8",children:[f.jsx(ue,{onClick:()=>r(),variant:"ghost",children:"Cancel"}),f.jsxs("div",{className:"flex items-center",children:[e!=="pending"?null:f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Updating persona..."})]}),e!=="success"?null:f.jsxs("div",{className:Tt("mr-4 flex items-center text-emerald-600 animate-in slide-in-from-bottom-2"),children:[f.jsx(Lm,{className:"mr-2 h-4 w-4 "}),f.jsx("span",{children:"Persona updated!"})]}),f.jsx(ue,{onClick:()=>a(o),children:"Save"})]})]})]})},Qse=({name:e,state:t,onClose:n,onSaveEditPersonaClicked:r,onEditPersonaClicked:a,onCancelEditPersonaClicked:o,status:i,content:s})=>{Xse(V4());const l=2e3;return f.jsx(W9,{name:e,state:t,onClose:n,renderContent:c=>f.jsxs(f.Fragment,{children:[f.jsxs(Pt,{children:[f.jsx($t,{children:c?"Edit Agent Persona":"Agent Persona"}),f.jsx(dn,{children:c?"You can edit your personas memory. This won’t affect the persona original template. Any changes will be saved as new core memories.":"This information stores details about the agent's persona, guiding its behaviour and responses to maintain consistency and personality in interactions."})]}),f.jsxs("div",{className:c?"":"mb-8",children:[f.jsx(G9,{name:e,icon:f.jsx(Dm,{className:"mr-2 size-6"}),isEditing:c,onEditPersonaClicked:a}),c?null:f.jsx("p",{className:"whitespace-pre-line",children:s}),c?f.jsx(K9,{status:i,defaultContent:s,limit:l,onCancelClicked:o,onSaveClicked:r}):null]})]})})},Jse=({name:e,state:t,onClose:n,content:r,onCancelEditPersonaClicked:a,onEditPersonaClicked:o,onSaveEditPersonaClicked:i,status:s})=>f.jsx(W9,{name:e,state:t,onClose:n,renderContent:l=>f.jsxs(f.Fragment,{children:[f.jsxs(Pt,{children:[f.jsx($t,{children:l?"Edit Human Persona":"Human Persona"}),f.jsx(dn,{children:l?"You can edit your personas memory. This won’t affect the persona original template. Any changes will be saved as new core memories":"Stores key details about the person the agent is conversing with, enabling personalised and friend-like conversations"})]}),f.jsxs("div",{className:l?"":"mb-8",children:[f.jsx(G9,{name:e,icon:f.jsx(XC,{className:"mr-2 size-6"}),isEditing:l,onEditPersonaClicked:o}),l?null:f.jsx("p",{className:"whitespace-pre-line",children:r}),l?f.jsx(K9,{status:s,defaultContent:r,limit:2e3,onCancelClicked:a,onSaveClicked:i}):null]})]})}),TN=({className:e,title:t,name:n,content:r,onEditClick:a,onMoreClick:o,icon:i})=>f.jsxs("div",{className:ee("rounded-md border p-3",e),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center font-semibold",children:[i,f.jsx("span",{children:t})]}),f.jsx(ue,{onClick:a,size:"iconXs",variant:"ghost",children:f.jsx(ZC,{className:"h-4 w-4 text-muted-foreground"})})]}),f.jsxs("div",{className:"flex flex-col gap-2 pl-7",children:[f.jsx("p",{className:"mt-2 text-xs text-muted-foreground/60",children:n}),f.jsxs("p",{className:"relative h-[78px] overflow-hidden text-ellipsis text-sm text-muted-foreground",children:[r,f.jsx("span",{className:"absolute bottom-0 right-0 h-5 w-10 bg-gradient-to-r from-transparent to-background to-55%"})]}),f.jsxs(ue,{onClick:o,className:"-ml-2 h-7 w-fit p-2 font-semibold",variant:"link",children:["more ",f.jsx(Pm,{className:"ml-2 h-4 w-4"})]})]})]}),ele=({agentId:e})=>{const t=y_(),{data:n,refetch:r,isRefetching:a}=b_({agentId:e||""}),{mutate:o}=Qm(),i=Xt(),s=p.useMemo(()=>{var y,b;return(b=(y=n==null?void 0:n.memory)==null?void 0:y.memory)==null?void 0:b[fr]},[n]),l=p.useMemo(()=>{var y,b;return(b=(y=n==null?void 0:n.memory)==null?void 0:y.memory)==null?void 0:b[Qr]},[n]),[c,u]=p.useState("closed"),[d,g]=p.useState("closed"),m=y=>b=>{var w,v,h;!l||!e||(o({agentId:e,requestBody:{id:e,memory:{...n==null?void 0:n.memory,memory:{...(w=n==null?void 0:n.memory)==null?void 0:w.memory,[y]:{...(h=(v=n==null?void 0:n.memory)==null?void 0:v.memory)==null?void 0:h[y],value:b}}}}}),t.mutate({blockId:l.id||"",requestBody:{id:l.id||"",value:b}},{onSuccess:()=>{i.invalidateQueries({queryKey:sf({agentId:e})})}}))};return f.jsxs("div",{className:"pb-6 pt-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(Sh,{children:"Core Memory"}),f.jsx(ue,{onClick:y=>{y.stopPropagation(),r()},disabled:a,variant:"outline",className:"z-10 h-7 w-7 p-0",children:f.jsx(Mq,{className:"size-5 "+(a?"animate-spin":"")})})]}),!l||!s?f.jsx("p",{className:"flex items-center justify-center p-20",children:"Loading memory..."}):f.jsxs(f.Fragment,{children:[f.jsx(TN,{className:"mt-2",title:"Agent Persona",name:l.name||"",content:l.value,onMoreClick:()=>u("view"),onEditClick:()=>u("edit"),icon:f.jsx(Dm,{className:"mr-2 h-5 w-5"})}),f.jsx(TN,{className:"my-4",title:"Human Persona",name:s.name||"",content:s.value,onMoreClick:()=>g("view"),onEditClick:()=>g("edit"),icon:f.jsx(XC,{className:"mr-2 h-5 w-5"})}),f.jsx(Qse,{status:t.status,content:l.value||"",name:l.name||"",onClose:()=>u("closed"),state:c,onEditPersonaClicked:()=>u("edit"),onCancelEditPersonaClicked:()=>u("closed"),onSaveEditPersonaClicked:m(Qr)}),f.jsx(Jse,{status:t.status,content:s.value||"",name:s.name||"",onClose:()=>g("closed"),state:d,onEditPersonaClicked:()=>g("edit"),onCancelEditPersonaClicked:()=>g("closed"),onSaveEditPersonaClicked:m(fr)})]})]})},tle=(e,t)=>{var a,o;const n=(a=e.tags)==null?void 0:a.includes("memgpt-base"),r=(o=t.tags)==null?void 0:o.includes("memgpt-base");return n&&r?e.name.localeCompare(t.name):n?-1:1},to="-ml-1 mr-2 size-5",nle={archival_memory_insert:f.jsx(yq,{className:to}),archival_memory_search:f.jsx(Dq,{className:to}),conversation_search:f.jsx(Ms,{className:to}),conversation_search_date:f.jsx(Sq,{className:to}),core_memory_append:f.jsx(ya,{className:to}),core_memory_replace:f.jsx(Pq,{className:to}),pause_heartbeats:f.jsx(Rq,{className:to}),send_message:f.jsx(Fq,{className:to})},oA=({tool:e,showDescription:t,isAddModal:n,onClick:r})=>{var o,i;const a=n??!e.tags.some(s=>s==="memgpt-base");return f.jsxs("div",{className:"rounded-md border px-4 py-2",children:[f.jsxs("div",{className:"flex items-end justify-between",children:[f.jsxs("span",{className:"inline-flex items-center text-sm font-semibold",children:[nle[e.name]??f.jsx(Nq,{className:to})," ",e.name.replace(/_/g," ").replace(/\w\S*/g,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())]}),a?f.jsx(ue,{variant:"ghost",size:"iconXs",type:"button",onClick:r,children:f.jsx(Di,{className:"size-4"})}):f.jsx("div",{className:"h-7"})]}),f.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[f.jsx("span",{className:"ml-6 text-xs text-muted-foreground",children:e.name}),f.jsx(b9,{variant:"secondary",className:"text-muted-foreground",children:(o=e.tags[0])==null?void 0:o.replace("memgpt-","")})]}),t?f.jsx("div",{className:"mt-2",children:f.jsx("p",{className:"text-sm text-muted-foreground",children:JSON.stringify((i=e==null?void 0:e.json_schema)==null?void 0:i.description)||""})}):null]})},rle=()=>{const e=To();return b_({agentId:(e==null?void 0:e.id)||""},void 0,{initialData:e,enabled:!!e})},ale=Xe({toolIds:nA(Ce())}),ole=({closeDialog:e})=>{const{data:t}=rle(),{data:n,isLoading:r}=Zm(),{mutate:a,isPending:o}=Qm(),i=p.useMemo(()=>new Set(t==null?void 0:t.tools),[t]),s=p.useMemo(()=>(n||[]).filter(w=>!i.has(w.name)),[n]),l=To(),c=(l==null?void 0:l.tools)??[],u=bn({resolver:yn(ale),mode:"onSubmit",defaultValues:{toolIds:[]}}),d=async w=>{w.toolIds.length&&l!=null&&l.id&&a({agentId:l.id,requestBody:{id:l.id,tools:w.toolIds}},{onSuccess:()=>{e()}})},g=s.filter(w=>!c.some(v=>v===w.id)),m=u.watch("toolIds"),y=w=>{m.some(v=>v===w)||u.setValue("toolIds",[...m,w])},b=w=>{u.setValue("toolIds",m.filter(v=>v!==w))};return f.jsx(vn,{...u,children:f.jsxs("form",{onSubmit:u.handleSubmit(d,w=>console.log(w)),className:"space-y-8",children:[f.jsx(ut,{control:u.control,name:"toolIds",render:({field:w})=>f.jsxs(it,{children:[f.jsxs(So,{disabled:r,onValueChange:v=>y(v),children:[f.jsx(pt,{children:f.jsx(za,{children:f.jsx(wo,{placeholder:r?"Loading tools...":"Search or select tools"})})}),f.jsx(Ua,{className:"max-h-[200px] overflow-y-auto",children:(g??[]).map(v=>f.jsx(Fn,{value:v.name,children:v.name},v.id))})]}),f.jsx(ct,{})]})}),f.jsx("div",{className:"space-y-2",children:u.watch("toolIds")?s.filter(w=>u.getValues("toolIds").some(v=>v===w.id)).map(w=>f.jsx(oA,{tool:w,showDescription:!0,isAddModal:!0,onClick:()=>b(w.id||"")},w.id)):null}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(ue,{variant:"ghost",type:"button",onClick:()=>e(),children:"Cancel"}),f.jsxs("div",{className:"flex gap-3",children:[o&&f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Adding tool to agent..."})]}),f.jsx(ue,{type:"submit",children:"Add Tool"})]})]})]})})},ile=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsx(Pt,{children:f.jsx($t,{children:"Add Tool"})}),f.jsx(ole,{closeDialog:()=>t(!1)})]})}),sle=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full max-w-80 overflow-auto",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Remove Tool"}),f.jsx(dn,{children:"Are you sure you want to remove this Tool? This is a base Agent tool, removing it might result in problems in hove the Agent functions."})]}),f.jsxs("div",{className:"flex justify-end gap-4",children:[f.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),f.jsx(ue,{children:"Remove"})]})]})}),lle=({open:e,onOpenChange:t,onOpenAddToolsChange:n,tools:r,onOpenConfirmationModal:a})=>{const[o,i]=p.useState(!1),[s,l]=p.useState(""),c=(r??[]).filter(u=>{var d;return(d=u.name)==null?void 0:d.toLowerCase().includes(s.toLowerCase())});return f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full overflow-auto sm:max-w-[800px]",children:[f.jsx(Pt,{children:f.jsx($t,{children:"Tools"})}),f.jsx(aA,{items:r,searchTerm:s,setSearchTerm:l,setShowSearchInput:i,showSearchInput:o,onOpenAddDialog:n,buttonText:"Add Tool"}),c==null?void 0:c.map(u=>f.jsx(oA,{tool:u,showDescription:!0,onClick:()=>a(!0)},u.id))]})})},cle=({tools:e})=>{const[t,n]=p.useState(!1),[r,a]=p.useState(!1),[o,i]=p.useState(!1),{data:s}=Zm(),l=p.useMemo(()=>(s==null?void 0:s.filter(u=>e.find(d=>d===u.name)))||[],[s,e]),c=(s||[]).length>l.length;return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"py-4",children:[f.jsxs(Sh,{button:c?f.jsx(rA,{onClick:()=>n(!0)}):null,children:["Tools (",e.length,")"]}),f.jsx("div",{className:"mt-2 space-y-2",children:l.sort(tle).slice(0,3).map(u=>f.jsx(oA,{tool:u,onClick:()=>i(!0)},u.id))}),e.length<3?null:f.jsxs(ue,{onClick:()=>a(!0),className:"mt-2 h-7 w-fit p-2 font-semibold",variant:"link",children:["See all ",f.jsx(Pm,{className:"ml-2 h-4 w-4"})]})]}),f.jsx(lle,{onOpenChange:u=>a(u),open:r,onOpenAddToolsChange:u=>n(u),tools:l,onOpenConfirmationModal:u=>i(!0)}),f.jsx(ile,{onOpenChange:n,open:t}),f.jsx(sle,{onOpenChange:i,open:o})]})};function ule(e){const{agent:t}=e,[n,r]=p.useState(!1),{data:a}=w6(),{mutate:o}=Qm(),i=Xt(),s=p.useCallback(l=>{if(!t.id)return;const c=a==null?void 0:a.find(u=>u.model===l);c&&o({agentId:t.id,requestBody:{llm_config:c,id:t.id}},{onSuccess:()=>{i.setQueriesData({queryKey:sf({agentId:t.id||""})},u=>{if(u)return{...u,llm_config:c}})}})},[t.id,o,i]);return f.jsx("div",{className:"pb-6 pt-4",children:f.jsxs("div",{className:"h-[35px] flex flex-col justify-between",children:[f.jsx(vh,{children:"Model"}),n?f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(So,{value:t.llm_config.model,onValueChange:s,children:[f.jsx(za,{children:f.jsx(wo,{placeholder:"Select a model"})}),f.jsx(Ua,{children:a?a.map(l=>f.jsx(Fn,{value:l.model,children:l.model},l.model)):f.jsx(Fn,{value:"loading",disabled:!0,children:"Loading..."})})]}),f.jsxs("button",{onClick:()=>r(!1),className:"h-7 w-7 p-0",children:[f.jsx(Di,{})," ",f.jsx("div",{className:"sr-only",children:"Close"})," "]})]}):f.jsxs("div",{onClick:()=>r(!0),className:"flex cursor-pointer items-center gap-2 text-sm",children:[t.llm_config.model," ",f.jsx(JF,{className:"w-4"}),f.jsx("div",{className:"sr-only",children:"Edit"})]})]})})}function dle(e){const{agent:t}=e,{data:n}=E6(),[r,a]=p.useState(!1),{mutate:o}=Qm(),i=Xt(),s=p.useCallback(l=>{if(!n||!t.id)return;const c=n.find(u=>u.embedding_model===l);c&&o({agentId:t.id,requestBody:{embedding_config:c,id:t.id}},{onSuccess:()=>{i.setQueriesData({queryKey:sf({agentId:t.id||""})},u=>{if(u)return{...u,embedding_config:c}})}})},[t.id,n,o,i]);return f.jsx("div",{className:"pb-6 pt-4",children:f.jsxs("div",{className:"h-[35px] flex w-full flex-col items-start justify-start",children:[f.jsx(vh,{children:"Embedding Model"}),r?f.jsxs("div",{className:"flex w-full items-center gap-2",children:[f.jsxs(So,{value:t.embedding_config.embedding_model,onValueChange:s,children:[f.jsx(za,{className:"w-full",children:f.jsx(wo,{placeholder:"Select an embedding model"})}),f.jsx(Ua,{children:n?n.map(l=>f.jsx(Fn,{value:l.embedding_model,children:l.embedding_model},l.embedding_model)):f.jsx(Fn,{value:"loading",disabled:!0,children:"Loading..."})})]}),f.jsxs("button",{onClick:()=>a(!1),className:"h-7 w-7 p-0",children:[f.jsx(Di,{})," ",f.jsx("div",{className:"sr-only",children:"Close"})," "]})]}):f.jsxs("div",{onClick:()=>a(!0),className:"flex cursor-pointer items-center gap-2 text-sm",children:[t.embedding_config.embedding_model," ",f.jsx(JF,{className:"w-4"}),f.jsx("div",{className:"sr-only",children:"Edit"})]})]})})}const fle=({currentAgentId:e})=>{const t=To(),{data:n}=b_({agentId:(t==null?void 0:t.id)||""},void 0,{initialData:t,enabled:!!t});return f.jsxs("div",{className:"w-96 flex-none overflow-auto px-4",children:[n&&f.jsx(ule,{agent:n}),n&&f.jsx(dle,{agent:n}),f.jsx(ele,{agentId:e}),f.jsx(yse,{agentId:e}),f.jsx(_se,{}),f.jsx(cle,{tools:(n==null?void 0:n.tools)??[]}),f.jsx(Yse,{})]})},RN={user:6,"internal-monologue":5,assistant:4,"function-call":3,"message-receipt":2,error:1,login:0},ple=(e,t)=>e.sort((n,r)=>{const a=n.date.toISOString().localeCompare(r.date.toISOString());return a!==0?a:RN[r.type]-RN[n.type]}).filter(n=>!!n.message),gle=()=>{const e=p.useRef(null),t=p.useRef(null),n=p.useRef(null),[r,a]=p.useState(!0),[o,i]=p.useState(!1),s=p.useCallback(()=>{e.current&&e.current.scrollIntoView({block:"end",behavior:"smooth"})},[]);return p.useEffect(()=>{e.current&&r&&!o&&e.current.scrollIntoView({block:"end"})},[r,o]),p.useEffect(()=>{const{current:l}=t;if(l){const c=u=>{const d=u.target,g=25,m=d.scrollTop+d.clientHeight>=d.scrollHeight-g;a(m)};return l.addEventListener("scroll",c,{passive:!0}),()=>{l.removeEventListener("scroll",c)}}},[]),p.useEffect(()=>{if(n.current){const l=new IntersectionObserver(c=>{c.forEach(u=>{u.isIntersecting?i(!0):i(!1)})},{rootMargin:"0px 0px 100px 0px"});return l.observe(n.current),()=>{l.disconnect()}}}),{messagesRef:e,scrollRef:t,visibilityRef:n,scrollToBottom:s,isAtBottom:r,isVisible:o}},mle=({children:e})=>f.jsx("div",{className:"relative flex-1 overflow-y-auto",children:e}),hle=({name:e,date:t})=>e?f.jsxs("p",{className:"flex items-center",children:[f.jsx("span",{className:"mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground",children:f.jsx(Dm,{className:"h-4 w-4"})}),f.jsx("span",{className:"text-sm font-semibold text-foreground",children:e}),f.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:t?Us(t,"MMM d yy, h:mm a"):""})]}):null;function ble(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const wh=function(e){if(e==null)return wle;if(typeof e=="function")return Eh(e);if(typeof e=="object")return Array.isArray(e)?yle(e):vle(e);if(typeof e=="string")return Sle(e);throw new Error("Expected function, string, or object as test")};function yle(e){const t=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let m=Y9,y,b,w;if((!t||o(l,c,u[u.length-1]||void 0))&&(m=Cle(n(l,u)),m[0]===Nk))return m;if("children"in l&&l.children){const v=l;if(v.children&&m[0]!==kle)for(b=(r?v.children.length:-1)+i,w=u.concat(v);b>-1&&b0?{type:"text",value:x}:void 0),x===!1?g.lastIndex=E+1:(y!==E&&h.push({type:"text",value:c.value.slice(y,E)}),Array.isArray(x)?h.push(...x):x&&h.push(x),y=E+S[0].length,v=!0),!g.global)break;S=g.exec(c.value)}return v?(y-1&&e.test(String.fromCharCode(n))}}const gy="phrasing",my=["autolink","link","image","label"];function Mle(){return{transforms:[Ble],enter:{literalAutolink:$le,literalAutolinkEmail:hy,literalAutolinkHttp:hy,literalAutolinkWww:hy},exit:{literalAutolink:Ule,literalAutolinkEmail:zle,literalAutolinkHttp:Fle,literalAutolinkWww:jle}}}function Ple(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gy,notInConstruct:my},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gy,notInConstruct:my},{character:":",before:"[ps]",after:"\\/",inConstruct:gy,notInConstruct:my}]}}function $le(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function hy(e){this.config.enter.autolinkProtocol.call(this,e)}function Fle(e){this.config.exit.autolinkProtocol.call(this,e)}function jle(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function zle(e){this.config.exit.autolinkEmail.call(this,e)}function Ule(e){this.exit(e)}function Ble(e){X9(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Hle],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,Vle]],{ignore:["link","linkReference"]})}function Hle(e,t,n,r,a){let o="";if(!Q9(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!qle(n)))return!1;const i=Gle(n+r);if(!i[0])return!1;const s={type:"link",title:null,url:o+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[s,{type:"text",value:i[1]}]:s}function Vle(e,t,n,r){return!Q9(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function qle(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Gle(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=NN(e,"(");let o=NN(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Q9(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Is(n)||xh(n))&&(!t||n!==47)}function ma(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}J9.peek=rce;function Wle(){return{enter:{gfmFootnoteDefinition:Yle,gfmFootnoteDefinitionLabelString:Zle,gfmFootnoteCall:Jle,gfmFootnoteCallString:ece},exit:{gfmFootnoteDefinition:Qle,gfmFootnoteDefinitionLabelString:Xle,gfmFootnoteCall:nce,gfmFootnoteCallString:tce}}}function Kle(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:ace,footnoteReference:J9}}}function Yle(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Zle(){this.buffer()}function Xle(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=ma(this.sliceSerialize(e)).toLowerCase()}function Qle(e){this.exit(e)}function Jle(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ece(){this.buffer()}function tce(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=ma(this.sliceSerialize(e)).toLowerCase()}function nce(e){this.exit(e)}function J9(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const i=n.enter("footnoteReference"),s=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{...a.current(),before:o,after:"]"})),s(),i(),o+=a.move("]"),o}function rce(){return"["}function ace(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const i=n.enter("footnoteDefinition"),s=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{...a.current(),before:o,after:"]"})),s(),o+=a.move("]:"+(e.children&&e.children.length>0?" ":"")),a.shift(4),o+=a.move(n.indentLines(n.containerFlow(e,a.current()),oce)),i(),o}function oce(e,t,n){return t===0?e:(n?"":" ")+e}const ice=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ej.peek=dce;function sce(){return{canContainEols:["delete"],enter:{strikethrough:cce},exit:{strikethrough:uce}}}function lce(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ice}],handlers:{delete:ej}}}function cce(e){this.enter({type:"delete",children:[]},e)}function uce(e){this.exit(e)}function ej(e,t,n,r){const a=n.createTracker(r),o=n.enter("strikethrough");let i=a.move("~~");return i+=n.containerPhrasing(e,{...a.current(),before:i,after:"~"}),i+=a.move("~~"),o(),i}function dce(){return"~"}function fce(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||gce,a=[],o=[],i=[],s=[];let l=0,c=-1;for(;++cl&&(l=e[c].length);++ws[w])&&(s[w]=h)}y.push(v)}o[c]=y,i[c]=b}let u=-1;if(typeof n=="object"&&"length"in n)for(;++us[u]&&(s[u]=v),g[u]=v),d[u]=h}o.splice(1,0,d),i.splice(1,0,g),c=-1;const m=[];for(;++ce(r=>({...r,onMessageCallback:n})),registerOnLastMessageReplaceCallback:n=>e(r=>({...r,onLastMessageReplaceCallback:n})),registerOnReplaceTemporaryIdsWithReturnedIdsCallback:n=>e(r=>({...r,onReplaceTemporaryIdsWithReturnedIdsCallback:n})),abortStream:()=>{var n;(n=t().abortController)==null||n.abort(),e({...e,abortController:null,readyState:0})}}}))),AN=()=>Xie(e=>e.actions),Qie="The user is back! Let's pick up the conversation! Reflect on the previous conversation and use your function calling to send them a friendly message.",Sf=nf(Hm((e,t)=>({showingMessageReceipts:!1,showingInternalMonologue:!0,shouldSendAutoMessage:!1,autoMessage:Qie,showingFunctions:!0,actions:{setShouldSendAutoMessage:n=>e({...t(),shouldSendAutoMessage:n}),setAutoMessage:n=>e({...t(),autoMessage:n}),setShowingInternalMonologue:n=>e({...t(),showingInternalMonologue:n}),setShowingFunctions:n=>e({...t(),showingFunctions:n}),setShowingMessageReceipts:n=>e({...t(),showingMessageReceipts:n})}}),{name:"chat-storage",partialize:({actions:e,...t})=>t})),Jie=()=>Sf(e=>e.showingMessageReceipts),w9=()=>Sf(e=>e.showingInternalMonologue),E9=()=>Sf(e=>e.showingFunctions),x9=()=>Sf(e=>({shouldSendAutoMessage:e.shouldSendAutoMessage,autoMessage:e.autoMessage})),ese=()=>Sf(e=>e.actions),tse=sie,nse=lie,k9=p.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>f.jsx(cie,{children:f.jsx(d9,{ref:a,align:t,sideOffset:n,className:ee("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...r})}));k9.displayName=d9.displayName;const C9="Switch",[rse,kTe]=zn(C9),[ase,ose]=rse(C9),ise=p.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:a,defaultChecked:o,required:i,disabled:s,value:l="on",onCheckedChange:c,...u}=e,[d,g]=p.useState(null),m=rt(t,h=>g(h)),y=p.useRef(!1),b=d?!!d.closest("form"):!0,[w=!1,v]=Fa({prop:a,defaultProp:o,onChange:c});return p.createElement(ase,{scope:n,checked:w,disabled:s},p.createElement(ze.button,W({type:"button",role:"switch","aria-checked":w,"aria-required":i,"data-state":_9(w),"data-disabled":s?"":void 0,disabled:s,value:l},u,{ref:m,onClick:fe(e.onClick,h=>{v(S=>!S),b&&(y.current=h.isPropagationStopped(),y.current||h.stopPropagation())})})),b&&p.createElement(cse,{control:d,bubbles:!y.current,name:r,value:l,checked:w,required:i,disabled:s,style:{transform:"translateX(-100%)"}}))}),sse="SwitchThumb",lse=p.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,a=ose(sse,n);return p.createElement(ze.span,W({"data-state":_9(a.checked),"data-disabled":a.disabled?"":void 0},r,{ref:t}))}),cse=e=>{const{control:t,checked:n,bubbles:r=!0,...a}=e,o=p.useRef(null),i=F_(n),s=N_(t);return p.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const g=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(g)}},[i,n,r]),p.createElement("input",W({type:"checkbox","aria-hidden":!0,defaultChecked:n},a,{tabIndex:-1,ref:o,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function _9(e){return e?"checked":"unchecked"}const A9=ise,use=lse,Wp=p.forwardRef(({className:e,...t},n)=>f.jsx(A9,{className:ee("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:f.jsx(use,{className:ee("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Wp.displayName=A9.displayName;const dse=()=>{const{autoMessage:e,shouldSendAutoMessage:t}=x9(),[n,r]=p.useState(e),[a,o]=p.useState("idle"),i=w9(),s=E9(),{setShowingInternalMonologue:l,setShowingFunctions:c,setAutoMessage:u,setShouldSendAutoMessage:d}=ese(),g=()=>{o("updating"),setTimeout(()=>{u(n),o("success"),setTimeout(()=>o("idle"),600)},600)};return f.jsxs(tse,{children:[f.jsx(nse,{asChild:!0,children:f.jsx(ue,{size:"iconXs",className:"absolute right-3 top-2 z-10",variant:"outline",children:f.jsx(jq,{className:"size-4"})})}),f.jsxs(k9,{align:"end",className:"w-80 space-y-4 rounded-md border bg-background p-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(os,{htmlFor:"internal-monologue",children:"Show Internal Monologue"}),f.jsx(Wp,{checked:i,onCheckedChange:m=>l(m),id:"internal-monologue"})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(os,{htmlFor:"showing-functions",children:"Show Functions"}),f.jsx(Wp,{checked:s,onCheckedChange:m=>c(m),id:"showing-functions"})]}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(os,{htmlFor:"should-send-auto-message",children:"Send Auto Message"}),f.jsx(Wp,{checked:t,onCheckedChange:m=>d(m),id:"should-send-auto-message"})]}),f.jsxs("div",{className:"flex flex-col space-y-2",children:[f.jsx(os,{htmlFor:"auto-message",children:"Auto Message"}),f.jsx(Vs,{id:"auto-message",className:"min-h-[10rem] resize-none",value:n,onChange:m=>r(m.target.value)}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(ue,{disabled:a==="updating",onClick:g,className:"w-fit",variant:"outline",size:"xs",children:"Update Message"}),a!=="updating"?null:f.jsx("div",{className:Tt("ml-4 flex items-center animate-in slide-in-from-bottom-2"),children:f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "})}),a!=="success"?null:f.jsx("div",{className:Tt("ml-4 flex items-center text-emerald-600 animate-in slide-in-from-bottom-2"),children:f.jsx(Lm,{className:"mr-2 h-4 w-4 "})})]})]})]})]})},vh=({children:e,className:t})=>f.jsx("h4",{className:ee("text-sm font-medium uppercase text-foreground",t),children:e}),Sh=({children:e,className:t,button:n,onClickInfo:r})=>f.jsxs(vh,{className:ee("flex h-8 items-center justify-between",t),children:[f.jsxs("span",{className:"inline-flex items-center tabular-nums",children:[f.jsx("span",{children:e}),f.jsx(Iq,{className:"ml-1.5 size-3.5 text-muted-foreground",onClick:r})]}),n]}),rA=({onClick:e})=>f.jsx(ue,{onClick:e,size:"iconXs",variant:"outline",children:f.jsx(ya,{className:"size-4 text-foreground"})}),T9=({className:e,children:t,onClick:n})=>f.jsxs("div",{className:ee("flex items-center justify-between rounded-md border border-dashed p-2 text-sm font-normal text-muted-foreground",e),children:[f.jsx("span",{children:t}),f.jsx(ue,{onClick:n,size:"iconXs",variant:"outline",children:f.jsx(ya,{className:"size-4 text-foreground"})})]}),fse=Xe({message:Ce().min(1,"Message cannot be empty...")}),pse=e=>{const n=bn({resolver:yn(fse),defaultValues:{message:""}});function r(a){e.onCreateArchivalMemory(a.message)}return f.jsx(vn,{...n,children:f.jsxs("form",{onSubmit:n.handleSubmit(r),className:"mt-4",children:[f.jsx(ut,{control:n.control,name:"message",render:({field:a})=>{var o;return f.jsxs(it,{className:"-mt-2 w-full",children:[f.jsx(yt,{className:"sr-only",children:"Memory to store"}),f.jsx(pt,{className:"w-full",children:f.jsx(Ai,{className:"min-h-40",placeholder:"What you want the agent to know about you",charCount:(o=a.value)==null?void 0:o.length,limit:2e3,...a})}),f.jsx(ct,{})]})}}),f.jsxs("div",{className:"flex items-center justify-between pt-8",children:[f.jsx(ue,{type:"button",onClick:e.onCancel,variant:"ghost",children:"Cancel"}),f.jsxs("div",{className:"flex gap-3",children:[e.isPending&&f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Saving memory..."})]}),f.jsx(ue,{disabled:e.isPending,type:"submit",children:"Save Memory"})]})]})]})})},gse=({agentId:e,open:t,onOpenChange:n})=>{const r=Xt(),a=fX(),o=i=>{a.mutate({agentId:e||"",requestBody:{text:i}},{onSuccess:()=>{n(!1),r.invalidateQueries({queryKey:h6({agentId:e||""})})}})};return f.jsx(Wt,{open:t,onOpenChange:n,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Add Memory"}),f.jsx(dn,{children:"Add a memory. Archival memory serves as an infinite, structured storage space for reflections, insights, and other data not fitting into core memory."})]}),f.jsx(pse,{isPending:a.isPending,onCreateArchivalMemory:o,onCancel:()=>n(!1)})]})})},mse=({memoryId:e,agentId:t,open:n,onOpenChange:r})=>{const a=Xt(),o=hX(),i=()=>o.mutate({agentId:t||"",memoryId:e},{onSuccess:()=>{a.invalidateQueries({queryKey:sf({agentId:t||""})}),r(!1)}});return f.jsx(Wt,{open:n,onOpenChange:r,children:f.jsxs(Bt,{className:"w-full sm:max-w-[350px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Delete Memory"}),f.jsx(dn,{className:"!my-4",children:"Are you sure you want to delete this memory?"})]}),f.jsxs(g8,{children:[f.jsx(ue,{size:"sm",type:"button",onClick:()=>r(!1),variant:"ghost",children:"Cancel"}),f.jsx(ue,{size:"sm",disabled:o.isPending,onClick:i,children:"Delete"})]})]})})},R9=({className:e,archivalMemory:t,agentId:n,isViewMemoryDialog:r})=>{const[a,o]=p.useState(!1),[i,s]=p.useState(!0),[l,c]=p.useState(!1),u=p.useRef(null),d=p.useRef(null);return p.useLayoutEffect(()=>{(()=>{if(u.current&&d.current){const m=u.current.scrollWidth>d.current.clientWidth;c(m)}})()},[t.text]),f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:ee("relative w-full rounded-md border p-4 pr-10",e),children:[f.jsxs("div",{className:"flex-1",children:[f.jsx("div",{className:"mb-1 text-xs text-muted-foreground",children:"Jun 18 2024"}),f.jsx("div",{className:ee("break-words text-sm",i&&"truncate"),ref:d,children:f.jsx("p",{ref:u,className:ee(i?"w-min":"w-full",!r&&"inline"),children:t.text})})]}),f.jsx(ue,{className:"absolute right-2 top-2.5 text-muted-foreground",onClick:()=>o(!0),variant:"ghost",size:"iconXs",children:f.jsx(Di,{className:"size-4"})}),r&&l?f.jsx(ue,{className:"mt-2 h-7 w-fit p-0 font-semibold",variant:"link",onClick:()=>s(!i),children:i?f.jsxs(f.Fragment,{children:["more",f.jsx(YC,{className:"ml-2 h-4 w-4"})]}):f.jsxs(f.Fragment,{children:["less",f.jsx(Eq,{className:"ml-2 h-4 w-4"})]})}):null]}),f.jsx(mse,{memoryId:t.id||"",agentId:n,open:a,onOpenChange:o})]})},hse=({setCurrentPage:e,className:t,currentPage:n,totalPages:r})=>f.jsx("div",{className:ee("flex items-center justify-end space-x-2",t),children:f.jsxs("div",{className:"space-x-2",children:[f.jsx(ue,{variant:"outline",size:"sm",onClick:()=>e(a=>Math.max(a-1,1)),disabled:n===1,children:"Previous"}),f.jsx(ue,{variant:"outline",size:"sm",onClick:()=>e(a=>Math.min(a+1,r)),disabled:n===r,children:"Next"})]})}),aA=({items:e,searchTerm:t,setSearchTerm:n,setShowSearchInput:r,showSearchInput:a,onOpenAddDialog:o,buttonText:i,isViewArchivalMemoryDialog:s,setShowFilterButton:l,showFilterButton:c})=>{const u=()=>{r(!a),l&&l(!1)},d=()=>{l&&l(!c),r(!1)};return f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex h-8 w-full items-center justify-between",children:[f.jsxs("p",{className:"text-xs",children:[e?e==null?void 0:e.length:null," items"]}),f.jsxs("div",{className:"flex h-full gap-2",children:[f.jsxs("div",{className:"relative flex h-full items-center justify-end border-r-2",children:[a?f.jsx(_n,{placeholder:"Search",value:t,onChange:g=>n(g.target.value),className:"mr-2 h-8 w-32 pl-9 md:w-52"}):null,f.jsx("button",{className:ee("mr-2",a&&"absolute left-3 top-2"),onClick:()=>u(),children:f.jsx(Ms,{className:ee("h-4 w-4")})})]}),s?f.jsxs("div",{className:"flex h-full items-center justify-end gap-2 border-r-2",children:[c?f.jsx(ue,{className:"px-2 py-0",size:"sm",children:f.jsx("span",{className:"p-0 text-xs",children:"Oldest to newest"})}):null,f.jsx("button",{className:ee("mr-2 h-full p-0.5",c&&"bg-muted"),onClick:()=>d(),children:f.jsx(vq,{className:"h-4 w-4"})})]}):null]})]}),f.jsxs(ue,{variant:"ghost",onClick:()=>o(!0),children:[i,f.jsx(ya,{className:"ml-1 h-4 w-4"})]})]})},bse=({agentId:e,open:t,onOpenChange:n,onOpenAddMemory:r})=>{V4();const o=S6({agentId:e||""}).data??[],[i,s]=p.useState(!1),[l,c]=p.useState(!1),[u,d]=p.useState(""),g=(o??[]).filter(S=>S.text.toLowerCase().includes(u.toLowerCase())),[m,y]=p.useState(1),b=10,w=m*b,v=w-b,h=g.slice(v,w);return f.jsx(Wt,{open:t,onOpenChange:n,children:f.jsxs(Bt,{className:"flex max-h-[95svh] flex-col overflow-auto sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Archival Memory"}),f.jsx(dn,{children:"Archival memory serves as an infinite, structured storage space for reflections, insights, and other data not fitting into core memory."}),f.jsx(aA,{items:o,searchTerm:u,setSearchTerm:d,setShowSearchInput:s,showSearchInput:i,onOpenAddDialog:r,buttonText:"Add Memory",isViewArchivalMemoryDialog:!0,setShowFilterButton:c,showFilterButton:l})]}),f.jsx("div",{className:"flex w-full flex-col",children:h.map(S=>f.jsx(R9,{agentId:e,archivalMemory:S,className:"mb-2",isViewMemoryDialog:!0},S.id))}),f.jsx(hse,{currentPage:m,setCurrentPage:y,totalPages:Math.ceil(g.length/b)})]})})},yse=({agentId:e})=>{const t=S6({agentId:e??""},void 0,{enabled:!!e}),n=t.data??[],[r,a]=p.useState(!1),[o,i]=p.useState(!1),s=()=>a(!0);return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"py-4",children:[f.jsxs(Sh,{button:n.length===0?null:f.jsx(rA,{onClick:()=>i(!0)}),children:["Archival Memory (",n.length,")"]}),t.isFetching?f.jsx(Pi,{className:"h-[70px]"}):null,t.isError?f.jsx("div",{className:"h-[70px] border border-destructive",children:"Something went wrong..."}):null,t.isSuccess?f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"mt-2",children:[...n].slice(0,3).map(l=>f.jsx(R9,{className:"mb-2",archivalMemory:l,agentId:e},l.id))}),n.length<1?null:f.jsxs(ue,{onClick:s,className:"mt-2 h-7 w-fit p-2 font-semibold",variant:"link",children:["See all ",f.jsx(Pm,{className:"ml-2 h-4 w-4"})]}),n.length>0?null:f.jsx(T9,{onClick:()=>i(!0),children:"Nothing here yet. Add memory"})]}):null]}),f.jsx(bse,{agentId:e,open:r,onOpenChange:a,onOpenAddMemory:l=>i(l)}),f.jsx(gse,{agentId:e,open:o,onOpenChange:i})]})},vse=(e,t)=>e.length>t?e.substring(0,t)+"...":e;function Sse(e,t){let n="Error adding data source...";const r=`${n}: Unspecified error.`;try{const a=JSON.parse(e.message);a.detail&&(a.detail=="None"?n=r:n=`${n}: ${a.detail}`)}catch{n=r}t({title:n,duration:5e3})}const N9=({source:e,handleRemoveDataSource:t})=>f.jsxs("div",{className:"relative rounded-md border p-4",children:[f.jsxs("p",{className:"flex items-center gap-1",children:[f.jsx("span",{className:"font-medium",children:e.name}),f.jsx("span",{className:"mt-0.5 text-xs text-muted-foreground",children:Us(new Date(e.created_at||""),"MMM dd yyyy")})]}),f.jsx("p",{className:Tt(),children:(e==null?void 0:e.description)??"None"}),f.jsxs("button",{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",onClick:()=>t(e.id||""),children:[f.jsx(Di,{className:"h-4 w-4"}),f.jsx("span",{className:"sr-only",children:"Close"})]})]},e.id),wse=Xe({sourceIds:nA(Ce())}),Ese=({closeDialog:e})=>{const t=To(),n=Xt(),{data:r,isLoading:a}=h_(),{data:o}=v6({agentId:(t==null?void 0:t.id)||""}),i=x6(),[s,l]=p.useState(!1),{toast:c}=An(),u=r??[],d=bn({resolver:yn(wse),mode:"onSubmit",defaultValues:{sourceIds:[]}}),g=async v=>{if(!(t!=null&&t.id))return;l(!0);const h=[];for(const S of v.sourceIds)try{const E=await i.mutateAsync({agentId:t.id,sourceId:S},{onSuccess:()=>{n.invalidateQueries({queryKey:m6({agentId:t.id||""})}),c({title:"Data source added successfully!",duration:5e3})}});h.push(E)}catch(E){Sse(E,c)}h.length>0&&c({title:"Data source added successfully!",duration:5e3}),l(!1),e()},m=d.watch("sourceIds"),y=p.useMemo(()=>{if(!u)return[];const v=new Set(m),h=new Set((o||[]).map(S=>S.id));return u.filter(S=>!v.has(S.id||"")&&!h.has(S.id))},[r,u,m]),b=v=>{m.some(h=>h===v)||d.setValue("sourceIds",[...m,v])},w=v=>{d.setValue("sourceIds",m.filter(h=>h!==v))};return f.jsx(vn,{...d,children:f.jsxs("form",{onSubmit:d.handleSubmit(g,v=>console.log(v)),className:"space-y-8",children:[f.jsx(ut,{control:d.control,name:"sourceIds",render:()=>f.jsxs(it,{children:[f.jsxs(So,{disabled:a,value:"",onValueChange:v=>b(v),children:[f.jsx(pt,{children:f.jsx(za,{children:f.jsx(wo,{placeholder:a?"Loading data sources...":"Search or select data source"})})}),f.jsx(Ua,{className:"max-h-[200px] overflow-y-auto",children:(y==null?void 0:y.length)===0?f.jsx(Fn,{value:"no-sources",disabled:!0,children:"No additional data sources available"}):y.map(v=>f.jsx(Fn,{value:v.id||"",children:v.name},v.id))})]}),f.jsx(ct,{})]})}),f.jsx("div",{className:"space-y-2",children:d.watch("sourceIds")?u.filter(v=>d.getValues("sourceIds").some(h=>h===v.id)).map(v=>f.jsx(N9,{handleRemoveDataSource:w,source:v},v.id)):null}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(ue,{variant:"ghost",type:"button",onClick:()=>e(),children:"Cancel"}),f.jsxs("div",{className:"flex gap-3",children:[s&&f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Attaching to agent..."})]}),f.jsx(ue,{type:"submit",children:"Add Source"})]})]})]})})},xse=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Add Data Source"}),f.jsx(dn,{children:"By adding a data source, you will make it available to the Agent to use for information."})]}),f.jsx(Ese,{closeDialog:()=>t(!1)})]})}),kse=({onDetach:e,onOpenAddSourceChange:t})=>{const n=[],[r,a]=p.useState(!1),[o,i]=p.useState(""),s=(n??[]).filter(l=>l.name.toLowerCase().includes(o.toLowerCase()));return f.jsxs(f.Fragment,{children:[f.jsx(aA,{items:n,searchTerm:o,setSearchTerm:i,setShowSearchInput:a,showSearchInput:r,onOpenAddDialog:t,buttonText:"Add Source"}),f.jsx("div",{className:"space-y-2",children:n?s.map(l=>f.jsx(N9,{handleRemoveDataSource:e,source:l},l.id)):null})]})},Cse=({open:e,onOpenChange:t,onDetach:n,onOpenAddSourceChange:r})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Data Sources"}),f.jsx(dn,{children:"Data sources make it available to the Agent to use for information outside of the immediate context window."})]}),f.jsx(kse,{onDetach:n,onOpenAddSourceChange:r})]})}),_se=()=>{const[e,t]=p.useState(!1),[n,r]=p.useState(!1),a=To(),{data:o}=v6({agentId:(a==null?void 0:a.id)||""}),i=p.useMemo(()=>o??[],[o]),s=k6(),{toast:l}=An(),c=u=>{!u||!a||s.mutate({agentId:a.id||"",sourceId:u},{onSuccess:()=>{l({title:"Agent detached successfully!",duration:3e3})},onError:d=>l({title:"Failed to detach agent!",duration:3e3})})};return f.jsxs("div",{className:"py-4",children:[f.jsxs(Sh,{button:i.length===0?null:f.jsx(rA,{onClick:()=>t(!0)}),onClickInfo:()=>r(!0),children:["Data Sources (",i.length,")"]}),f.jsx("ul",{className:"mt-2 space-y-2",children:i.map(u=>f.jsxs("li",{className:"rounded-md border p-4",children:[f.jsx("div",{className:"relative flex justify-between",children:f.jsxs("p",{className:"flex items-center gap-2",children:[f.jsx("span",{className:"font-medium",children:u.name}),f.jsx("span",{className:"text-xs",children:Us(new Date(u.created_at||""),"MMM dd yyyy")})]})}),f.jsx("p",{className:Tt(),children:vse((u==null?void 0:u.description)??"None",42)})]},u.id))}),i.length>0?null:f.jsx(T9,{onClick:()=>t(!0),children:"Nothing here yet. Add source"}),f.jsx(xse,{open:e,onOpenChange:u=>t(u)}),f.jsx(Cse,{open:n,onOpenChange:u=>r(u),onDetach:c,onOpenAddSourceChange:u=>t(u)})]})},Ase="AlertDialog",[Tse,CTe]=zn(Ase,[i8]),Ro=i8(),Rse=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ro(t);return p.createElement(d8,W({},r,n,{modal:!0}))},Nse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(sae,W({},a,r,{ref:t}))}),Ise=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ro(t);return p.createElement(f8,W({},r,n))},Ose=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(H_,W({},a,r,{ref:t}))}),I9="AlertDialogContent",[Dse,Lse]=Tse(I9),Mse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=Ro(n),i=p.useRef(null),s=rt(t,i),l=p.useRef(null);return p.createElement(iae,{contentName:I9,titleName:Pse,docsSlug:"alert-dialog"},p.createElement(Dse,{scope:n,cancelRef:l},p.createElement(V_,W({role:"alertdialog"},o,a,{ref:s,onOpenAutoFocus:fe(a.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=l.current)===null||u===void 0||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault()}),p.createElement(Tm,null,r),!1)))}),Pse="AlertDialogTitle",$se=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(q_,W({},a,r,{ref:t}))}),Fse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(G_,W({},a,r,{ref:t}))}),jse=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,a=Ro(n);return p.createElement(W_,W({},a,r,{ref:t}))}),zse="AlertDialogCancel",Use=p.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=Lse(zse,n),o=Ro(n),i=rt(t,a);return p.createElement(W_,W({},o,r,{ref:i}))}),Bse=Rse,Hse=Nse,Vse=Ise,O9=Ose,D9=Mse,L9=jse,M9=Use,P9=$se,$9=Fse,qse=Bse,Gse=Hse,Wse=Vse,F9=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(O9,{className:ee("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...n,ref:r}));F9.displayName=O9.displayName;const j9=p.forwardRef(({className:e,...t},n)=>f.jsxs(Wse,{children:[f.jsx(F9,{}),f.jsx(D9,{ref:n,className:ee("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full",e),...t})]}));j9.displayName=D9.displayName;const z9=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col space-y-2 text-center sm:text-left",e),...t});z9.displayName="AlertDialogHeader";const U9=({className:e,...t})=>f.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});U9.displayName="AlertDialogFooter";const B9=p.forwardRef(({className:e,...t},n)=>f.jsx(P9,{ref:n,className:ee("text-lg font-semibold",e),...t}));B9.displayName=P9.displayName;const H9=p.forwardRef(({className:e,...t},n)=>f.jsx($9,{ref:n,className:ee("text-sm text-muted-foreground",e),...t}));H9.displayName=$9.displayName;const V9=p.forwardRef(({className:e,variant:t,...n},r)=>f.jsx(L9,{ref:r,className:ee(bc({variant:t}),e),...n}));V9.displayName=L9.displayName;const q9=p.forwardRef(({className:e,...t},n)=>f.jsx(M9,{ref:n,className:ee(bc({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));q9.displayName=M9.displayName;const Kse=()=>{const e=To(),{mutate:t,isPending:n}=mX(),{toast:r}=An(),a=Mi(),o=p.useCallback(()=>{e&&t({agentId:e.id||""},{onSuccess:()=>{r({title:"Agent deleted successfully",duration:500}),a("/agents")},onError:()=>{r({title:"There was an error deleting the agent, please try again",duration:5e3})}})},[e==null?void 0:e.id,a,t]);return f.jsxs(qse,{children:[f.jsx(Gse,{asChild:!0,children:f.jsx(ue,{variant:"destructive",children:"Delete Agent"})}),f.jsxs(j9,{children:[f.jsxs(z9,{children:[f.jsx(B9,{children:"Delete Agent"}),f.jsx(H9,{children:"When you delete an agent, all the information and interaction will be lost. Are you sure you want to delete the agent"})]}),f.jsxs(U9,{children:[f.jsx(q9,{children:"Cancel"}),f.jsx(V9,{onClick:o,variant:"destructive",children:f.jsxs(f.Fragment,{children:[n&&f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),"Delete Agent"]})})]})]})]})},Yse=()=>f.jsxs("div",{className:"flex flex-col gap-2 pb-10 pt-4",children:[f.jsx(vh,{children:"Delete Agent"}),f.jsx("p",{className:" text-sm text-muted-foreground",children:"When you delete an agent, all the information and interaction will be lost."}),f.jsx(Kse,{})]}),Zse={configItem:e=>["config",e]},Xse=e=>{const t=AZ();return Jr({queryKey:Zse.configItem(e),enabled:!!e,queryFn:async()=>t.get("/config").then(n=>n.data)})},G9=({icon:e,name:t,isEditing:n,onEditPersonaClicked:r})=>f.jsxs("div",{className:"flex items-center justify-between py-4",children:[f.jsxs("div",{className:"flex items-center font-medium",children:[e,f.jsx("span",{children:t})]}),n?null:f.jsxs(ue,{onClick:r,variant:"ghost",size:"xs",children:["Edit Persona ",f.jsx(ZC,{className:"ml-2 size-4"})]})]}),W9=({renderContent:e,state:t,onClose:n})=>{const r=p.useRef("closed"),a=t==="edit"||t==="closed"&&r.current==="edit";return p.useEffect(()=>{r.current=t},[t]),f.jsx(Wt,{open:t==="view"||t==="edit",onOpenChange:o=>{o||n()},children:f.jsx(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:e(a)})})},K9=({status:e,limit:t,defaultContent:n,onCancelClicked:r,onSaveClicked:a})=>{const[o,i]=p.useState(n);return f.jsxs(f.Fragment,{children:[f.jsxs(os,{children:["Persona Description",f.jsx(Ai,{charCount:(o==null?void 0:o.length)??0,limit:t,onChange:s=>i(s.target.value),className:"min-h-[60vh] whitespace-pre-line font-normal",defaultValue:o})]}),f.jsxs("div",{className:"flex items-center justify-between pt-8",children:[f.jsx(ue,{onClick:()=>r(),variant:"ghost",children:"Cancel"}),f.jsxs("div",{className:"flex items-center",children:[e!=="pending"?null:f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Updating persona..."})]}),e!=="success"?null:f.jsxs("div",{className:Tt("mr-4 flex items-center text-emerald-600 animate-in slide-in-from-bottom-2"),children:[f.jsx(Lm,{className:"mr-2 h-4 w-4 "}),f.jsx("span",{children:"Persona updated!"})]}),f.jsx(ue,{onClick:()=>a(o),children:"Save"})]})]})]})},Qse=({name:e,state:t,onClose:n,onSaveEditPersonaClicked:r,onEditPersonaClicked:a,onCancelEditPersonaClicked:o,status:i,content:s})=>{Xse(V4());const l=2e3;return f.jsx(W9,{name:e,state:t,onClose:n,renderContent:c=>f.jsxs(f.Fragment,{children:[f.jsxs(Pt,{children:[f.jsx($t,{children:c?"Edit Agent Persona":"Agent Persona"}),f.jsx(dn,{children:c?"You can edit your personas memory. This won’t affect the persona original template. Any changes will be saved as new core memories.":"This information stores details about the agent's persona, guiding its behaviour and responses to maintain consistency and personality in interactions."})]}),f.jsxs("div",{className:c?"":"mb-8",children:[f.jsx(G9,{name:e,icon:f.jsx(Dm,{className:"mr-2 size-6"}),isEditing:c,onEditPersonaClicked:a}),c?null:f.jsx("p",{className:"whitespace-pre-line",children:s}),c?f.jsx(K9,{status:i,defaultContent:s,limit:l,onCancelClicked:o,onSaveClicked:r}):null]})]})})},Jse=({name:e,state:t,onClose:n,content:r,onCancelEditPersonaClicked:a,onEditPersonaClicked:o,onSaveEditPersonaClicked:i,status:s})=>f.jsx(W9,{name:e,state:t,onClose:n,renderContent:l=>f.jsxs(f.Fragment,{children:[f.jsxs(Pt,{children:[f.jsx($t,{children:l?"Edit Human Persona":"Human Persona"}),f.jsx(dn,{children:l?"You can edit your personas memory. This won’t affect the persona original template. Any changes will be saved as new core memories":"Stores key details about the person the agent is conversing with, enabling personalised and friend-like conversations"})]}),f.jsxs("div",{className:l?"":"mb-8",children:[f.jsx(G9,{name:e,icon:f.jsx(XC,{className:"mr-2 size-6"}),isEditing:l,onEditPersonaClicked:o}),l?null:f.jsx("p",{className:"whitespace-pre-line",children:r}),l?f.jsx(K9,{status:s,defaultContent:r,limit:2e3,onCancelClicked:a,onSaveClicked:i}):null]})]})}),TN=({className:e,title:t,name:n,content:r,onEditClick:a,onMoreClick:o,icon:i})=>f.jsxs("div",{className:ee("rounded-md border p-3",e),children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsxs("div",{className:"flex items-center font-semibold",children:[i,f.jsx("span",{children:t})]}),f.jsx(ue,{onClick:a,size:"iconXs",variant:"ghost",children:f.jsx(ZC,{className:"h-4 w-4 text-muted-foreground"})})]}),f.jsxs("div",{className:"flex flex-col gap-2 pl-7",children:[f.jsx("p",{className:"mt-2 text-xs text-muted-foreground/60",children:n}),f.jsxs("p",{className:"relative h-[78px] overflow-hidden text-ellipsis text-sm text-muted-foreground",children:[r,f.jsx("span",{className:"absolute bottom-0 right-0 h-5 w-10 bg-gradient-to-r from-transparent to-background to-55%"})]}),f.jsxs(ue,{onClick:o,className:"-ml-2 h-7 w-fit p-2 font-semibold",variant:"link",children:["more ",f.jsx(Pm,{className:"ml-2 h-4 w-4"})]})]})]}),ele=({agentId:e})=>{const t=y_(),{data:n,refetch:r,isRefetching:a}=b_({agentId:e||""}),{mutate:o}=Qm(),i=Xt(),s=p.useMemo(()=>{var y,b;return(b=(y=n==null?void 0:n.memory)==null?void 0:y.memory)==null?void 0:b[fr]},[n]),l=p.useMemo(()=>{var y,b;return(b=(y=n==null?void 0:n.memory)==null?void 0:y.memory)==null?void 0:b[Qr]},[n]),[c,u]=p.useState("closed"),[d,g]=p.useState("closed"),m=y=>b=>{var w,v,h;!l||!e||o({agentId:e,requestBody:{id:e,memory:{...n==null?void 0:n.memory,memory:{...(w=n==null?void 0:n.memory)==null?void 0:w.memory,[y]:{...(h=(v=n==null?void 0:n.memory)==null?void 0:v.memory)==null?void 0:h[y],value:b}}}}},{onSuccess:()=>{i.invalidateQueries({queryKey:sf({agentId:e})})}})};return f.jsxs("div",{className:"pb-6 pt-4",children:[f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(Sh,{children:"Core Memory"}),f.jsx(ue,{onClick:y=>{y.stopPropagation(),r()},disabled:a,variant:"outline",className:"z-10 h-7 w-7 p-0",children:f.jsx(Mq,{className:"size-5 "+(a?"animate-spin":"")})})]}),!l||!s?f.jsx("p",{className:"flex items-center justify-center p-20",children:"Loading memory..."}):f.jsxs(f.Fragment,{children:[f.jsx(TN,{className:"mt-2",title:"Agent Persona",name:l.name||"",content:l.value,onMoreClick:()=>u("view"),onEditClick:()=>u("edit"),icon:f.jsx(Dm,{className:"mr-2 h-5 w-5"})}),f.jsx(TN,{className:"my-4",title:"Human Persona",name:s.name||"",content:s.value,onMoreClick:()=>g("view"),onEditClick:()=>g("edit"),icon:f.jsx(XC,{className:"mr-2 h-5 w-5"})}),f.jsx(Qse,{status:t.status,content:l.value||"",name:l.name||"",onClose:()=>u("closed"),state:c,onEditPersonaClicked:()=>u("edit"),onCancelEditPersonaClicked:()=>u("closed"),onSaveEditPersonaClicked:m(Qr)}),f.jsx(Jse,{status:t.status,content:s.value||"",name:s.name||"",onClose:()=>g("closed"),state:d,onEditPersonaClicked:()=>g("edit"),onCancelEditPersonaClicked:()=>g("closed"),onSaveEditPersonaClicked:m(fr)})]})]})},tle=(e,t)=>{var a,o;const n=(a=e.tags)==null?void 0:a.includes("memgpt-base"),r=(o=t.tags)==null?void 0:o.includes("memgpt-base");return n&&r?e.name.localeCompare(t.name):n?-1:1},to="-ml-1 mr-2 size-5",nle={archival_memory_insert:f.jsx(yq,{className:to}),archival_memory_search:f.jsx(Dq,{className:to}),conversation_search:f.jsx(Ms,{className:to}),conversation_search_date:f.jsx(Sq,{className:to}),core_memory_append:f.jsx(ya,{className:to}),core_memory_replace:f.jsx(Pq,{className:to}),pause_heartbeats:f.jsx(Rq,{className:to}),send_message:f.jsx(Fq,{className:to})},oA=({tool:e,showDescription:t,isAddModal:n,onClick:r})=>{var o,i;const a=n??!e.tags.some(s=>s==="memgpt-base");return f.jsxs("div",{className:"rounded-md border px-4 py-2",children:[f.jsxs("div",{className:"flex items-end justify-between",children:[f.jsxs("span",{className:"inline-flex items-center text-sm font-semibold",children:[nle[e.name]??f.jsx(Nq,{className:to})," ",e.name.replace(/_/g," ").replace(/\w\S*/g,s=>s.charAt(0).toUpperCase()+s.substring(1).toLowerCase())]}),a?f.jsx(ue,{variant:"ghost",size:"iconXs",type:"button",onClick:r,children:f.jsx(Di,{className:"size-4"})}):f.jsx("div",{className:"h-7"})]}),f.jsxs("div",{className:"mt-1 flex items-center justify-between",children:[f.jsx("span",{className:"ml-6 text-xs text-muted-foreground",children:e.name}),f.jsx(b9,{variant:"secondary",className:"text-muted-foreground",children:(o=e.tags[0])==null?void 0:o.replace("memgpt-","")})]}),t?f.jsx("div",{className:"mt-2",children:f.jsx("p",{className:"text-sm text-muted-foreground",children:JSON.stringify((i=e==null?void 0:e.json_schema)==null?void 0:i.description)||""})}):null]})},rle=()=>{const e=To();return b_({agentId:(e==null?void 0:e.id)||""},void 0,{initialData:e,enabled:!!e})},ale=Xe({toolIds:nA(Ce())}),ole=({closeDialog:e})=>{const{data:t}=rle(),{data:n,isLoading:r}=Zm(),{mutate:a,isPending:o}=Qm(),i=p.useMemo(()=>new Set(t==null?void 0:t.tools),[t]),s=p.useMemo(()=>(n||[]).filter(w=>!i.has(w.name)),[n]),l=To(),c=(l==null?void 0:l.tools)??[],u=bn({resolver:yn(ale),mode:"onSubmit",defaultValues:{toolIds:[]}}),d=async w=>{w.toolIds.length&&l!=null&&l.id&&a({agentId:l.id,requestBody:{id:l.id,tools:w.toolIds}},{onSuccess:()=>{e()}})},g=s.filter(w=>!c.some(v=>v===w.id)),m=u.watch("toolIds"),y=w=>{m.some(v=>v===w)||u.setValue("toolIds",[...m,w])},b=w=>{u.setValue("toolIds",m.filter(v=>v!==w))};return f.jsx(vn,{...u,children:f.jsxs("form",{onSubmit:u.handleSubmit(d,w=>console.log(w)),className:"space-y-8",children:[f.jsx(ut,{control:u.control,name:"toolIds",render:({field:w})=>f.jsxs(it,{children:[f.jsxs(So,{disabled:r,onValueChange:v=>y(v),children:[f.jsx(pt,{children:f.jsx(za,{children:f.jsx(wo,{placeholder:r?"Loading tools...":"Search or select tools"})})}),f.jsx(Ua,{className:"max-h-[200px] overflow-y-auto",children:(g??[]).map(v=>f.jsx(Fn,{value:v.name,children:v.name},v.id))})]}),f.jsx(ct,{})]})}),f.jsx("div",{className:"space-y-2",children:u.watch("toolIds")?s.filter(w=>u.getValues("toolIds").some(v=>v===w.id)).map(w=>f.jsx(oA,{tool:w,showDescription:!0,isAddModal:!0,onClick:()=>b(w.id||"")},w.id)):null}),f.jsxs("div",{className:"flex items-center justify-between",children:[f.jsx(ue,{variant:"ghost",type:"button",onClick:()=>e(),children:"Cancel"}),f.jsxs("div",{className:"flex gap-3",children:[o&&f.jsxs("div",{className:Tt("mr-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Adding tool to agent..."})]}),f.jsx(ue,{type:"submit",children:"Add Tool"})]})]})]})})},ile=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsx(Pt,{children:f.jsx($t,{children:"Add Tool"})}),f.jsx(ole,{closeDialog:()=>t(!1)})]})}),sle=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full max-w-80 overflow-auto",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Remove Tool"}),f.jsx(dn,{children:"Are you sure you want to remove this Tool? This is a base Agent tool, removing it might result in problems in hove the Agent functions."})]}),f.jsxs("div",{className:"flex justify-end gap-4",children:[f.jsx(ue,{type:"button",variant:"ghost",onClick:()=>t(!1),children:"Cancel"}),f.jsx(ue,{children:"Remove"})]})]})}),lle=({open:e,onOpenChange:t,onOpenAddToolsChange:n,tools:r,onOpenConfirmationModal:a})=>{const[o,i]=p.useState(!1),[s,l]=p.useState(""),c=(r??[]).filter(u=>{var d;return(d=u.name)==null?void 0:d.toLowerCase().includes(s.toLowerCase())});return f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full overflow-auto sm:max-w-[800px]",children:[f.jsx(Pt,{children:f.jsx($t,{children:"Tools"})}),f.jsx(aA,{items:r,searchTerm:s,setSearchTerm:l,setShowSearchInput:i,showSearchInput:o,onOpenAddDialog:n,buttonText:"Add Tool"}),c==null?void 0:c.map(u=>f.jsx(oA,{tool:u,showDescription:!0,onClick:()=>a(!0)},u.id))]})})},cle=({tools:e})=>{const[t,n]=p.useState(!1),[r,a]=p.useState(!1),[o,i]=p.useState(!1),{data:s}=Zm(),l=p.useMemo(()=>(s==null?void 0:s.filter(u=>e.find(d=>d===u.name)))||[],[s,e]),c=(s||[]).length>l.length;return f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"py-4",children:[f.jsxs(Sh,{button:c?f.jsx(rA,{onClick:()=>n(!0)}):null,children:["Tools (",e.length,")"]}),f.jsx("div",{className:"mt-2 space-y-2",children:l.sort(tle).slice(0,3).map(u=>f.jsx(oA,{tool:u,onClick:()=>i(!0)},u.id))}),e.length<3?null:f.jsxs(ue,{onClick:()=>a(!0),className:"mt-2 h-7 w-fit p-2 font-semibold",variant:"link",children:["See all ",f.jsx(Pm,{className:"ml-2 h-4 w-4"})]})]}),f.jsx(lle,{onOpenChange:u=>a(u),open:r,onOpenAddToolsChange:u=>n(u),tools:l,onOpenConfirmationModal:u=>i(!0)}),f.jsx(ile,{onOpenChange:n,open:t}),f.jsx(sle,{onOpenChange:i,open:o})]})};function ule(e){const{agent:t}=e,[n,r]=p.useState(!1),{data:a}=w6(),{mutate:o}=Qm(),i=Xt(),s=p.useCallback(l=>{if(!t.id)return;const c=a==null?void 0:a.find(u=>u.model===l);c&&o({agentId:t.id,requestBody:{llm_config:c,id:t.id}},{onSuccess:()=>{i.setQueriesData({queryKey:sf({agentId:t.id||""})},u=>{if(u)return{...u,llm_config:c}})}})},[t.id,o,i]);return f.jsx("div",{className:"pb-6 pt-4",children:f.jsxs("div",{className:"h-[35px] flex flex-col justify-between",children:[f.jsx(vh,{children:"Model"}),n?f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsxs(So,{value:t.llm_config.model,onValueChange:s,children:[f.jsx(za,{children:f.jsx(wo,{placeholder:"Select a model"})}),f.jsx(Ua,{children:a?a.map(l=>f.jsx(Fn,{value:l.model,children:l.model},l.model)):f.jsx(Fn,{value:"loading",disabled:!0,children:"Loading..."})})]}),f.jsxs("button",{onClick:()=>r(!1),className:"h-7 w-7 p-0",children:[f.jsx(Di,{})," ",f.jsx("div",{className:"sr-only",children:"Close"})," "]})]}):f.jsxs("div",{onClick:()=>r(!0),className:"flex cursor-pointer items-center gap-2 text-sm",children:[t.llm_config.model," ",f.jsx(JF,{className:"w-4"}),f.jsx("div",{className:"sr-only",children:"Edit"})]})]})})}function dle(e){const{agent:t}=e,{data:n}=E6(),[r,a]=p.useState(!1),{mutate:o}=Qm(),i=Xt(),s=p.useCallback(l=>{if(!n||!t.id)return;const c=n.find(u=>u.embedding_model===l);c&&o({agentId:t.id,requestBody:{embedding_config:c,id:t.id}},{onSuccess:()=>{i.setQueriesData({queryKey:sf({agentId:t.id||""})},u=>{if(u)return{...u,embedding_config:c}})}})},[t.id,n,o,i]);return f.jsx("div",{className:"pb-6 pt-4",children:f.jsxs("div",{className:"h-[35px] flex w-full flex-col items-start justify-start",children:[f.jsx(vh,{children:"Embedding Model"}),r?f.jsxs("div",{className:"flex w-full items-center gap-2",children:[f.jsxs(So,{value:t.embedding_config.embedding_model,onValueChange:s,children:[f.jsx(za,{className:"w-full",children:f.jsx(wo,{placeholder:"Select an embedding model"})}),f.jsx(Ua,{children:n?n.map(l=>f.jsx(Fn,{value:l.embedding_model,children:l.embedding_model},l.embedding_model)):f.jsx(Fn,{value:"loading",disabled:!0,children:"Loading..."})})]}),f.jsxs("button",{onClick:()=>a(!1),className:"h-7 w-7 p-0",children:[f.jsx(Di,{})," ",f.jsx("div",{className:"sr-only",children:"Close"})," "]})]}):f.jsxs("div",{onClick:()=>a(!0),className:"flex cursor-pointer items-center gap-2 text-sm",children:[t.embedding_config.embedding_model," ",f.jsx(JF,{className:"w-4"}),f.jsx("div",{className:"sr-only",children:"Edit"})]})]})})}const fle=({currentAgentId:e})=>{const t=To(),{data:n}=b_({agentId:(t==null?void 0:t.id)||""},void 0,{initialData:t,enabled:!!t});return f.jsxs("div",{className:"w-96 flex-none overflow-auto px-4",children:[n&&f.jsx(ule,{agent:n}),n&&f.jsx(dle,{agent:n}),f.jsx(ele,{agentId:e}),f.jsx(yse,{agentId:e}),f.jsx(_se,{}),f.jsx(cle,{tools:(n==null?void 0:n.tools)??[]}),f.jsx(Yse,{})]})},RN={user:6,"internal-monologue":5,assistant:4,"function-call":3,"message-receipt":2,error:1,login:0},ple=(e,t)=>e.sort((n,r)=>{const a=n.date.toISOString().localeCompare(r.date.toISOString());return a!==0?a:RN[r.type]-RN[n.type]}).filter(n=>!!n.message),gle=()=>{const e=p.useRef(null),t=p.useRef(null),n=p.useRef(null),[r,a]=p.useState(!0),[o,i]=p.useState(!1),s=p.useCallback(()=>{e.current&&e.current.scrollIntoView({block:"end",behavior:"smooth"})},[]);return p.useEffect(()=>{e.current&&r&&!o&&e.current.scrollIntoView({block:"end"})},[r,o]),p.useEffect(()=>{const{current:l}=t;if(l){const c=u=>{const d=u.target,g=25,m=d.scrollTop+d.clientHeight>=d.scrollHeight-g;a(m)};return l.addEventListener("scroll",c,{passive:!0}),()=>{l.removeEventListener("scroll",c)}}},[]),p.useEffect(()=>{if(n.current){const l=new IntersectionObserver(c=>{c.forEach(u=>{u.isIntersecting?i(!0):i(!1)})},{rootMargin:"0px 0px 100px 0px"});return l.observe(n.current),()=>{l.disconnect()}}}),{messagesRef:e,scrollRef:t,visibilityRef:n,scrollToBottom:s,isAtBottom:r,isVisible:o}},mle=({children:e})=>f.jsx("div",{className:"relative flex-1 overflow-y-auto",children:e}),hle=({name:e,date:t})=>e?f.jsxs("p",{className:"flex items-center",children:[f.jsx("span",{className:"mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground",children:f.jsx(Dm,{className:"h-4 w-4"})}),f.jsx("span",{className:"text-sm font-semibold text-foreground",children:e}),f.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:t?Us(t,"MMM d yy, h:mm a"):""})]}):null;function ble(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const wh=function(e){if(e==null)return wle;if(typeof e=="function")return Eh(e);if(typeof e=="object")return Array.isArray(e)?yle(e):vle(e);if(typeof e=="string")return Sle(e);throw new Error("Expected function, string, or object as test")};function yle(e){const t=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let m=Y9,y,b,w;if((!t||o(l,c,u[u.length-1]||void 0))&&(m=Cle(n(l,u)),m[0]===Nk))return m;if("children"in l&&l.children){const v=l;if(v.children&&m[0]!==kle)for(b=(r?v.children.length:-1)+i,w=u.concat(v);b>-1&&b0?{type:"text",value:x}:void 0),x===!1?g.lastIndex=E+1:(y!==E&&h.push({type:"text",value:c.value.slice(y,E)}),Array.isArray(x)?h.push(...x):x&&h.push(x),y=E+S[0].length,v=!0),!g.global)break;S=g.exec(c.value)}return v?(y-1&&e.test(String.fromCharCode(n))}}const gy="phrasing",my=["autolink","link","image","label"];function Mle(){return{transforms:[Ble],enter:{literalAutolink:$le,literalAutolinkEmail:hy,literalAutolinkHttp:hy,literalAutolinkWww:hy},exit:{literalAutolink:Ule,literalAutolinkEmail:zle,literalAutolinkHttp:Fle,literalAutolinkWww:jle}}}function Ple(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:gy,notInConstruct:my},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:gy,notInConstruct:my},{character:":",before:"[ps]",after:"\\/",inConstruct:gy,notInConstruct:my}]}}function $le(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function hy(e){this.config.enter.autolinkProtocol.call(this,e)}function Fle(e){this.config.exit.autolinkProtocol.call(this,e)}function jle(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function zle(e){this.config.exit.autolinkEmail.call(this,e)}function Ule(e){this.exit(e)}function Ble(e){X9(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,Hle],[/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g,Vle]],{ignore:["link","linkReference"]})}function Hle(e,t,n,r,a){let o="";if(!Q9(a)||(/^w/i.test(t)&&(n=t+n,t="",o="http://"),!qle(n)))return!1;const i=Gle(n+r);if(!i[0])return!1;const s={type:"link",title:null,url:o+t+i[0],children:[{type:"text",value:t+i[0]}]};return i[1]?[s,{type:"text",value:i[1]}]:s}function Vle(e,t,n,r){return!Q9(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function qle(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function Gle(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const a=NN(e,"(");let o=NN(e,")");for(;r!==-1&&a>o;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),o++;return[e,n]}function Q9(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Is(n)||xh(n))&&(!t||n!==47)}function ma(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}J9.peek=rce;function Wle(){return{enter:{gfmFootnoteDefinition:Yle,gfmFootnoteDefinitionLabelString:Zle,gfmFootnoteCall:Jle,gfmFootnoteCallString:ece},exit:{gfmFootnoteDefinition:Qle,gfmFootnoteDefinitionLabelString:Xle,gfmFootnoteCall:nce,gfmFootnoteCallString:tce}}}function Kle(){return{unsafe:[{character:"[",inConstruct:["phrasing","label","reference"]}],handlers:{footnoteDefinition:ace,footnoteReference:J9}}}function Yle(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Zle(){this.buffer()}function Xle(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=ma(this.sliceSerialize(e)).toLowerCase()}function Qle(e){this.exit(e)}function Jle(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function ece(){this.buffer()}function tce(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.label=t,n.identifier=ma(this.sliceSerialize(e)).toLowerCase()}function nce(e){this.exit(e)}function J9(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const i=n.enter("footnoteReference"),s=n.enter("reference");return o+=a.move(n.safe(n.associationId(e),{...a.current(),before:o,after:"]"})),s(),i(),o+=a.move("]"),o}function rce(){return"["}function ace(e,t,n,r){const a=n.createTracker(r);let o=a.move("[^");const i=n.enter("footnoteDefinition"),s=n.enter("label");return o+=a.move(n.safe(n.associationId(e),{...a.current(),before:o,after:"]"})),s(),o+=a.move("]:"+(e.children&&e.children.length>0?" ":"")),a.shift(4),o+=a.move(n.indentLines(n.containerFlow(e,a.current()),oce)),i(),o}function oce(e,t,n){return t===0?e:(n?"":" ")+e}const ice=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];ej.peek=dce;function sce(){return{canContainEols:["delete"],enter:{strikethrough:cce},exit:{strikethrough:uce}}}function lce(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:ice}],handlers:{delete:ej}}}function cce(e){this.enter({type:"delete",children:[]},e)}function uce(e){this.exit(e)}function ej(e,t,n,r){const a=n.createTracker(r),o=n.enter("strikethrough");let i=a.move("~~");return i+=n.containerPhrasing(e,{...a.current(),before:i,after:"~"}),i+=a.move("~~"),o(),i}function dce(){return"~"}function fce(e,t={}){const n=(t.align||[]).concat(),r=t.stringLength||gce,a=[],o=[],i=[],s=[];let l=0,c=-1;for(;++cl&&(l=e[c].length);++ws[w])&&(s[w]=h)}y.push(v)}o[c]=y,i[c]=b}let u=-1;if(typeof n=="object"&&"length"in n)for(;++us[u]&&(s[u]=v),g[u]=v),d[u]=h}o.splice(1,0,d),i.splice(1,0,g),c=-1;const m=[];for(;++c "),o.shift(2);const i=n.indentLines(n.containerFlow(e,o.current()),hce);return a(),i}function hce(e,t,n){return">"+(n?"":" ")+e}function bce(e,t){return ON(e,t.inConstruct,!0)&&!ON(e,t.notInConstruct,!1)}function ON(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ri&&(i=o):o=1,a=r+t.length,r=n.indexOf(t,a);return i}function yce(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function vce(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function Sce(e,t,n,r){const a=vce(n),o=e.value||"",i=a==="`"?"GraveAccent":"Tilde";if(yce(e,n)){const d=n.enter("codeIndented"),g=n.indentLines(o,wce);return d(),g}const s=n.createTracker(r),l=a.repeat(Math.max(tj(o,a)+1,3)),c=n.enter("codeFenced");let u=s.move(l);if(e.lang){const d=n.enter(`codeFencedLang${i}`);u+=s.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...s.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${i}`);u+=s.move(" "),u+=s.move(n.safe(e.meta,{before:u,after:` @@ -209,7 +209,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho - less than the value passed to \`max\` (or ${Oh} if no \`max\` prop is set) - \`null\` if the progress is indeterminate. -Defaulting to \`null\`.`}const aU=tU,uCe=iCe,oU=p.forwardRef(({className:e,value:t,indeterminate:n=!1,...r},a)=>f.jsx(aU,{ref:a,className:ee("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:f.jsx(uCe,{className:ee("h-full w-full flex-1 bg-primary transition-all",n&&"animate-progress origin-left"),style:{transform:`translateX(-${100-(t||0)}%)`}})}));oU.displayName=aU.displayName;function dCe({job:e}){var n;const t=p.useMemo(()=>{var a;const r=(a=e==null?void 0:e.metadata_)==null?void 0:a.filename;return typeof r=="string"?r:"Unknown"},[(n=e==null?void 0:e.metadata_)==null?void 0:n.filename]);return f.jsx("div",{className:"border rounded-sm p-3 gap-3 flex flex-col",children:f.jsxs("div",{className:"text-sm whitespace-nowrap gap-4 text-muted-foreground items-center flex flex-row justify-between",children:[f.jsxs("div",{children:["Uploading ",t]}),f.jsx(oU,{className:"h-2",indeterminate:!0}),f.jsx("div",{children:"Indeterminate time to upload"})]})})}function fCe(){const{data:e}=lX(void 0,{refetchInterval:2e3}),t=p.useMemo(()=>e||[],[e]);return f.jsx("div",{className:"mx-4 my-4 rounded flex flex-col gap-2",children:f.jsx("div",{className:"flex flex-col gap-3",children:t.map(n=>f.jsx(dCe,{job:n},n.id))})})}const pCe=()=>{const[e,t]=p.useState(!1),[n,r]=p.useState(!1),[a,o]=p.useState(),[i,s]=p.useState(!1),[l,c]=p.useState(),[u,d]=p.useState(!1),[g,m]=p.useState(),[y,b]=p.useState(!1),[w,v]=p.useState(),[h,S]=p.useState(""),[E]=Ih(h,300),k=R=>{c(R),s(!0)},x=R=>{o(R),r(!0)},C=R=>{s(R),R||setTimeout(()=>c(void 0),300)},_=R=>{v(R),d(!0)},T=(R,L)=>{m({source:R,agent:L}),b(!0)};return f.jsxs($s,{children:[f.jsxs("div",{className:"flex items-center justify-between bg-background/95 px-4 pb-3 pt-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[f.jsx(Vke,{value:h,onValueChange:S}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsxs(ue,{onClick:()=>s(!0),size:"sm",children:[f.jsx(e4,{className:"mr-2 h-4 w-4"}),"Upload Data"]}),f.jsxs(ue,{onClick:()=>t(!0),size:"sm",children:[f.jsx(ya,{className:"mr-2 h-4 w-4"}),"Create Data Source"]})]})]}),f.jsx(fCe,{}),f.jsx(Gke,{onSourceUpload:k,onSourceEdit:x,onAttachAgent:_,onDetachAgent:T,className:"mx-4",nameFilter:E}),f.jsx(Hke,{open:e,onOpenChange:t}),f.jsx(Zke,{source:a,open:n,onOpenChange:r}),f.jsx(tCe,{source:l,open:i,onOpenChange:C}),f.jsx(jke,{source:w,open:u,onOpenChange:d}),f.jsx(Wke,{source:g==null?void 0:g.source,agent:g==null?void 0:g.agent,open:y,onOpenChange:b})]})},gCe={path:"data-sources",element:f.jsx(pCe,{})},mCe=Xe({name:Ce().min(1,{message:"Name must be at least 1 character."}).max(30,{message:"Name must not be longer than 30 characters."}),text:Ce().max(2e3).min(0)}),hCe={name:"",text:""};function bCe({closeDialog:e}){const t=_6(),{toast:n}=An(),r=mCe.extend({text:Ce().max(2e3).min(0)}),a=Xt(),o=bn({resolver:yn(r),defaultValues:hCe,mode:"onChange"}),i=s=>{t.mutate({requestBody:{label:Qr,name:s.name,value:s.text}},{onSuccess:()=>{a.invalidateQueries({queryKey:lf({label:Qr})}),e(),n({title:"Persona created successfully!",duration:5e3})},onError:l=>{n({title:"Error creating persona",duration:5e3})}})};return f.jsx(vn,{...o,children:f.jsxs("form",{onSubmit:o.handleSubmit(i,s=>console.log(s)),className:"space-y-8",children:[f.jsx(ut,{control:o.control,name:"name",render:({field:s})=>f.jsxs(it,{children:[f.jsx(yt,{children:"Name"}),f.jsx(pt,{children:f.jsx(_n,{...s})}),f.jsx(Mt,{children:"This is your personas display name. It can be a real name or a pseudonym."}),f.jsx(ct,{})]})}),f.jsx(ut,{control:o.control,name:"text",render:({field:s})=>{var l;return f.jsxs(it,{children:[f.jsx(pt,{children:f.jsx(Ai,{placeholder:"Describe your persona here",charCount:(l=s.value)==null?void 0:l.length,limit:2e3,...s})}),f.jsxs(Mt,{children:["You can use no more than ",2e3," characters."]}),f.jsx(ct,{})]})}}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(ue,{type:"submit",children:"Create Persona"}),t.isPending&&f.jsxs("div",{className:Tt("ml-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Creating Persona..."})]})]})]})})}const yCe=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Create Persona"}),f.jsx(dn,{children:"Add a new persona here. Click create when you're done."})]}),f.jsx(bCe,{closeDialog:()=>t(!1)})]})}),vCe=Xe({text:Ce().max(2e3).min(0)});function SCe({persona:e,closeDialog:t}){const n=y_(),r=Xt(),{toast:a}=An(),o=vCe.extend({text:Ce().max(2e3).min(0)}),i={text:e.value||""},s=bn({resolver:yn(o),defaultValues:i,mode:"onChange"}),l=c=>{n.mutate({blockId:e.id||"",requestBody:{id:e.id||"",value:c.text||""}},{onSuccess:()=>{r.invalidateQueries({queryKey:lf({label:Qr})}),t(),a({title:"Persona updated successfully!",duration:5e3})},onError:u=>{a({title:"Error updating persona",duration:5e3})}})};return f.jsx(vn,{...s,children:f.jsxs("form",{onSubmit:s.handleSubmit(l,c=>console.log(c)),className:"space-y-8",children:[f.jsx(ut,{control:s.control,name:"text",render:({field:c})=>{var u;return f.jsxs(it,{children:[f.jsx(pt,{children:f.jsx(Ai,{placeholder:"Describe your persona here",charCount:(u=c.value)==null?void 0:u.length,limit:2e3,...c})}),f.jsxs(Mt,{children:["You can use no more than ",2e3," characters."]}),f.jsx(ct,{})]})}}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(ue,{type:"submit",children:"Update Persona"}),n.isPending&&f.jsxs("div",{className:Tt("ml-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Updating Persona..."})]})]})]})})}const wCe=({persona:e,open:t,onOpenChange:n})=>f.jsx(Wt,{open:t,onOpenChange:n,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsxs($t,{children:["Edit ",(e==null?void 0:e.name)??"Persona"]}),f.jsx(dn,{children:"Edit existing agent template here. Click create when you're done."})]}),e?f.jsx(SCe,{persona:e,closeDialog:()=>n(!1)}):f.jsx("p",{children:"No Persona...."})]})}),ECe=({value:e,onValueChange:t})=>f.jsx("form",{children:f.jsxs("div",{className:"relative",children:[f.jsx(Ms,{className:"pointer-events-none absolute left-[12px] top-3 h-4 w-4 text-muted-foreground"}),f.jsx(_n,{placeholder:"Search persona",value:e,onChange:n=>t(n.target.value),className:"w-52 pl-8 lg:w-80"})]})});let kx;const iU="HoverCard",[sU,ATe]=zn(iU,[qa]),KA=qa(),[xCe,YA]=sU(iU),kCe=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:a,onOpenChange:o,openDelay:i=700,closeDelay:s=300}=e,l=KA(t),c=p.useRef(0),u=p.useRef(0),d=p.useRef(!1),g=p.useRef(!1),[m=!1,y]=Fa({prop:r,defaultProp:a,onChange:o}),b=p.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>y(!0),i)},[i,y]),w=p.useCallback(()=>{clearTimeout(c.current),!d.current&&!g.current&&(u.current=window.setTimeout(()=>y(!1),s))},[s,y]),v=p.useCallback(()=>y(!1),[y]);return p.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),p.createElement(xCe,{scope:t,open:m,onOpenChange:y,onOpen:b,onClose:w,onDismiss:v,hasSelectionRef:d,isPointerDownOnContentRef:g},p.createElement(rh,l,n))},CCe="HoverCardTrigger",_Ce=p.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,a=YA(CCe,n),o=KA(n);return p.createElement(ff,W({asChild:!0},o),p.createElement(ze.a,W({"data-state":a.open?"open":"closed"},r,{ref:t,onPointerEnter:fe(e.onPointerEnter,lm(a.onOpen)),onPointerLeave:fe(e.onPointerLeave,lm(a.onClose)),onFocus:fe(e.onFocus,a.onOpen),onBlur:fe(e.onBlur,a.onClose),onTouchStart:fe(e.onTouchStart,i=>i.preventDefault())})))}),ACe="HoverCardPortal",[TTe,TCe]=sU(ACe,{forceMount:void 0}),Vk="HoverCardContent",RCe=p.forwardRef((e,t)=>{const n=TCe(Vk,e.__scopeHoverCard),{forceMount:r=n.forceMount,...a}=e,o=YA(Vk,e.__scopeHoverCard);return p.createElement(pr,{present:r||o.open},p.createElement(NCe,W({"data-state":o.open?"open":"closed"},a,{onPointerEnter:fe(e.onPointerEnter,lm(o.onOpen)),onPointerLeave:fe(e.onPointerLeave,lm(o.onClose)),ref:t})))}),NCe=p.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,...s}=e,l=YA(Vk,n),c=KA(n),u=p.useRef(null),d=rt(t,u),[g,m]=p.useState(!1);return p.useEffect(()=>{if(g){const y=document.body;return kx=y.style.userSelect||y.style.webkitUserSelect,y.style.userSelect="none",y.style.webkitUserSelect="none",()=>{y.style.userSelect=kx,y.style.webkitUserSelect=kx}}},[g]),p.useEffect(()=>{if(u.current){const y=()=>{m(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())===null||b===void 0?void 0:b.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",y),()=>{document.removeEventListener("pointerup",y),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),p.useEffect(()=>{u.current&&ICe(u.current).forEach(b=>b.setAttribute("tabindex","-1"))}),p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:fe(o,y=>{y.preventDefault()}),onDismiss:l.onDismiss},p.createElement(pf,W({},c,s,{onPointerDown:fe(s.onPointerDown,y=>{y.currentTarget.contains(y.target)&&m(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...s.style,userSelect:g?"text":void 0,WebkitUserSelect:g?"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 lm(e){return t=>t.pointerType==="touch"?void 0:e()}function ICe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}const OCe=kCe,DCe=_Ce,lU=RCe,LCe=OCe,MCe=DCe,cU=p.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>f.jsx(lU,{ref:a,align:t,sideOffset:n,className:ee("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...r}));cU.displayName=lU.displayName;const ZA=({text:e})=>f.jsxs(LCe,{children:[f.jsx(MCe,{asChild:!0,children:f.jsx(ue,{size:"sm",variant:"ghost",className:"-mx-4 w-96 text-left font-normal",children:f.jsx("span",{className:"h-6 w-full truncate text-left",children:f.jsx("span",{className:"whitespace-pre",children:e})})})}),f.jsx(cU,{className:"w-[300px] p-4 sm:w-[500px]",children:f.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:f.jsx("p",{className:"whitespace-pre-wrap",children:e})})})]}),PCe=(e,t)=>[{accessorKey:"edit",header:"",size:20,cell:({row:n})=>t?f.jsx(Pi,{className:"h-6 w-6"}):f.jsx(ue,{onClick:()=>e(n.original),className:"!h-6 !w-6 !p-1",variant:"ghost",children:f.jsx($m,{className:"h-3.5 w-3.5"})})},{accessorKey:"name",header:"Name",cell:({row:n})=>f.jsx(Dn,{isLoading:t,children:n.getValue("name")})},{accessorKey:"value",header:"Value",cell:({row:n})=>f.jsx(Dn,{isLoading:t,children:f.jsx(ZA,{text:n.getValue("value")})})}],$Ce=({onPersonaEdit:e,nameFilter:t,className:n})=>{const{data:r,isLoading:a,isError:o}=Rg({label:Qr}),i=p.useMemo(()=>(r??[]).filter(s=>{var l;return(l=s.name)==null?void 0:l.includes(t)}),[r,t]);return f.jsx("div",{className:n,children:f.jsx(cf,{columns:PCe(e,a),isLoading:a,error:o?"Error loading agent templates":void 0,data:i,renderPagination:s=>f.jsx(uf,{className:"mt-4",table:s})})})},FCe=()=>{const[e,t]=p.useState(""),[n]=Ih(e,300),r=Li(),[a,o]=p.useState(r.search.includes("openCreatePersona")??!1),[i,s]=p.useState(null),[l,c]=p.useState(!1),u=d=>{s(d),c(!0)};return f.jsxs($s,{children:[f.jsxs("div",{className:"flex items-center justify-between bg-background/95 px-4 pb-3 pt-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[f.jsx(ECe,{value:e,onValueChange:t}),f.jsxs(ue,{onClick:()=>o(!0),size:"sm",children:[f.jsx(ya,{className:"mr-2 h-4 w-4"}),"Create Persona"]})]}),f.jsx($Ce,{onPersonaEdit:u,nameFilter:n,className:"mx-4"}),f.jsx(yCe,{open:a,onOpenChange:d=>o(d)}),f.jsx(wCe,{persona:i,open:l,onOpenChange:d=>c(d)})]})},jCe={path:"agent-templates",element:f.jsx(FCe,{})},uU="Radio",[zCe,dU]=zn(uU),[UCe,BCe]=zCe(uU),HCe=p.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:a=!1,required:o,disabled:i,value:s="on",onCheck:l,...c}=e,[u,d]=p.useState(null),g=rt(t,b=>d(b)),m=p.useRef(!1),y=u?!!u.closest("form"):!0;return p.createElement(UCe,{scope:n,checked:a,disabled:i},p.createElement(ze.button,W({type:"button",role:"radio","aria-checked":a,"data-state":fU(a),"data-disabled":i?"":void 0,disabled:i,value:s},c,{ref:g,onClick:fe(e.onClick,b=>{a||l==null||l(),y&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})})),y&&p.createElement(GCe,{control:u,bubbles:!m.current,name:r,value:s,checked:a,required:o,disabled:i,style:{transform:"translateX(-100%)"}}))}),VCe="RadioIndicator",qCe=p.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...a}=e,o=BCe(VCe,n);return p.createElement(pr,{present:r||o.checked},p.createElement(ze.span,W({"data-state":fU(o.checked),"data-disabled":o.disabled?"":void 0},a,{ref:t})))}),GCe=e=>{const{control:t,checked:n,bubbles:r=!0,...a}=e,o=p.useRef(null),i=F_(n),s=N_(t);return p.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const g=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(g)}},[i,n,r]),p.createElement("input",W({type:"radio","aria-hidden":!0,defaultChecked:n},a,{tabIndex:-1,ref:o,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function fU(e){return e?"checked":"unchecked"}const WCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pU="RadioGroup",[KCe,RTe]=zn(pU,[ah,dU]),gU=ah(),mU=dU(),[YCe,ZCe]=KCe(pU),XCe=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:a,value:o,required:i=!1,disabled:s=!1,orientation:l,dir:c,loop:u=!0,onValueChange:d,...g}=e,m=gU(n),y=x_(c),[b,w]=Fa({prop:o,defaultProp:a,onChange:d});return p.createElement(YCe,{scope:n,name:r,required:i,disabled:s,value:b,onValueChange:w},p.createElement(o7,W({asChild:!0},m,{orientation:l,dir:y,loop:u}),p.createElement(ze.div,W({role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":s?"":void 0,dir:y},g,{ref:t}))))}),QCe="RadioGroupItem",JCe=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...a}=e,o=ZCe(QCe,n),i=o.disabled||r,s=gU(n),l=mU(n),c=p.useRef(null),u=rt(t,c),d=o.value===a.value,g=p.useRef(!1);return p.useEffect(()=>{const m=b=>{WCe.includes(b.key)&&(g.current=!0)},y=()=>g.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",y)}},[]),p.createElement(i7,W({asChild:!0},s,{focusable:!i,active:d}),p.createElement(HCe,W({disabled:i,required:o.required,checked:d},l,a,{name:o.name,ref:u,onCheck:()=>o.onValueChange(a.value),onKeyDown:fe(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:fe(a.onFocus,()=>{var m;g.current&&((m=c.current)===null||m===void 0||m.click())})})))}),e_e=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,a=mU(n);return p.createElement(qCe,W({},a,r,{ref:t}))}),hU=XCe,bU=JCe,t_e=e_e,yU=p.forwardRef(({className:e,...t},n)=>f.jsx(hU,{className:ee("grid gap-2",e),...t,ref:n}));yU.displayName=hU.displayName;const vU=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(bU,{ref:r,className:ee("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:f.jsx(t_e,{className:"flex items-center justify-center",children:f.jsx(QF,{className:"h-2.5 w-2.5 fill-current text-current"})})}));vU.displayName=bU.displayName;const qk="horizontal",n_e=["horizontal","vertical"],SU=p.forwardRef((e,t)=>{const{decorative:n,orientation:r=qk,...a}=e,o=wU(r)?r:qk,s=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return p.createElement(ze.div,W({"data-orientation":o},s,a,{ref:t}))});SU.propTypes={orientation(e,t,n){const r=e[t],a=String(r);return r&&!wU(r)?new Error(r_e(a,n)):null}};function r_e(e,t){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${t}\`, expected one of: +Defaulting to \`null\`.`}const aU=tU,uCe=iCe,oU=p.forwardRef(({className:e,value:t,indeterminate:n=!1,...r},a)=>f.jsx(aU,{ref:a,className:ee("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:f.jsx(uCe,{className:ee("h-full w-full flex-1 bg-primary transition-all",n&&"animate-progress origin-left"),style:{transform:`translateX(-${100-(t||0)}%)`}})}));oU.displayName=aU.displayName;function dCe({job:e}){var n;const t=p.useMemo(()=>{var a;const r=(a=e==null?void 0:e.metadata_)==null?void 0:a.filename;return typeof r=="string"?r:"Unknown"},[(n=e==null?void 0:e.metadata_)==null?void 0:n.filename]);return f.jsx("div",{className:"border rounded-sm p-3 gap-3 flex flex-col",children:f.jsxs("div",{className:"text-sm whitespace-nowrap gap-4 text-muted-foreground items-center flex flex-row justify-between",children:[f.jsxs("div",{children:["Uploading ",t]}),f.jsx(oU,{className:"h-2",indeterminate:!0}),f.jsx("div",{children:"Indeterminate time to upload"})]})})}function fCe(){const{data:e}=lX({userId:""},void 0,{refetchInterval:2e3}),t=p.useMemo(()=>e||[],[e]);return f.jsx("div",{className:"mx-4 my-4 rounded flex flex-col gap-2",children:f.jsx("div",{className:"flex flex-col gap-3",children:t.map(n=>f.jsx(dCe,{job:n},n.id))})})}const pCe=()=>{const[e,t]=p.useState(!1),[n,r]=p.useState(!1),[a,o]=p.useState(),[i,s]=p.useState(!1),[l,c]=p.useState(),[u,d]=p.useState(!1),[g,m]=p.useState(),[y,b]=p.useState(!1),[w,v]=p.useState(),[h,S]=p.useState(""),[E]=Ih(h,300),k=R=>{c(R),s(!0)},x=R=>{o(R),r(!0)},C=R=>{s(R),R||setTimeout(()=>c(void 0),300)},_=R=>{v(R),d(!0)},T=(R,L)=>{m({source:R,agent:L}),b(!0)};return f.jsxs($s,{children:[f.jsxs("div",{className:"flex items-center justify-between bg-background/95 px-4 pb-3 pt-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[f.jsx(Vke,{value:h,onValueChange:S}),f.jsxs("div",{className:"flex items-center space-x-2",children:[f.jsxs(ue,{onClick:()=>s(!0),size:"sm",children:[f.jsx(e4,{className:"mr-2 h-4 w-4"}),"Upload Data"]}),f.jsxs(ue,{onClick:()=>t(!0),size:"sm",children:[f.jsx(ya,{className:"mr-2 h-4 w-4"}),"Create Data Source"]})]})]}),f.jsx(fCe,{}),f.jsx(Gke,{onSourceUpload:k,onSourceEdit:x,onAttachAgent:_,onDetachAgent:T,className:"mx-4",nameFilter:E}),f.jsx(Hke,{open:e,onOpenChange:t}),f.jsx(Zke,{source:a,open:n,onOpenChange:r}),f.jsx(tCe,{source:l,open:i,onOpenChange:C}),f.jsx(jke,{source:w,open:u,onOpenChange:d}),f.jsx(Wke,{source:g==null?void 0:g.source,agent:g==null?void 0:g.agent,open:y,onOpenChange:b})]})},gCe={path:"data-sources",element:f.jsx(pCe,{})},mCe=Xe({name:Ce().min(1,{message:"Name must be at least 1 character."}).max(30,{message:"Name must not be longer than 30 characters."}),text:Ce().max(2e3).min(0)}),hCe={name:"",text:""};function bCe({closeDialog:e}){const t=_6(),{toast:n}=An(),r=mCe.extend({text:Ce().max(2e3).min(0)}),a=Xt(),o=bn({resolver:yn(r),defaultValues:hCe,mode:"onChange"}),i=s=>{t.mutate({requestBody:{label:Qr,name:s.name,value:s.text}},{onSuccess:()=>{a.invalidateQueries({queryKey:lf({label:Qr})}),e(),n({title:"Persona created successfully!",duration:5e3})},onError:l=>{n({title:"Error creating persona",duration:5e3})}})};return f.jsx(vn,{...o,children:f.jsxs("form",{onSubmit:o.handleSubmit(i,s=>console.log(s)),className:"space-y-8",children:[f.jsx(ut,{control:o.control,name:"name",render:({field:s})=>f.jsxs(it,{children:[f.jsx(yt,{children:"Name"}),f.jsx(pt,{children:f.jsx(_n,{...s})}),f.jsx(Mt,{children:"This is your personas display name. It can be a real name or a pseudonym."}),f.jsx(ct,{})]})}),f.jsx(ut,{control:o.control,name:"text",render:({field:s})=>{var l;return f.jsxs(it,{children:[f.jsx(pt,{children:f.jsx(Ai,{placeholder:"Describe your persona here",charCount:(l=s.value)==null?void 0:l.length,limit:2e3,...s})}),f.jsxs(Mt,{children:["You can use no more than ",2e3," characters."]}),f.jsx(ct,{})]})}}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(ue,{type:"submit",children:"Create Persona"}),t.isPending&&f.jsxs("div",{className:Tt("ml-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Creating Persona..."})]})]})]})})}const yCe=({open:e,onOpenChange:t})=>f.jsx(Wt,{open:e,onOpenChange:t,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsx($t,{children:"Create Persona"}),f.jsx(dn,{children:"Add a new persona here. Click create when you're done."})]}),f.jsx(bCe,{closeDialog:()=>t(!1)})]})}),vCe=Xe({text:Ce().max(2e3).min(0)});function SCe({persona:e,closeDialog:t}){const n=y_(),r=Xt(),{toast:a}=An(),o=vCe.extend({text:Ce().max(2e3).min(0)}),i={text:e.value||""},s=bn({resolver:yn(o),defaultValues:i,mode:"onChange"}),l=c=>{n.mutate({blockId:e.id||"",requestBody:{id:e.id||"",value:c.text||""}},{onSuccess:()=>{r.invalidateQueries({queryKey:lf({label:Qr})}),t(),a({title:"Persona updated successfully!",duration:5e3})},onError:u=>{a({title:"Error updating persona",duration:5e3})}})};return f.jsx(vn,{...s,children:f.jsxs("form",{onSubmit:s.handleSubmit(l,c=>console.log(c)),className:"space-y-8",children:[f.jsx(ut,{control:s.control,name:"text",render:({field:c})=>{var u;return f.jsxs(it,{children:[f.jsx(pt,{children:f.jsx(Ai,{placeholder:"Describe your persona here",charCount:(u=c.value)==null?void 0:u.length,limit:2e3,...c})}),f.jsxs(Mt,{children:["You can use no more than ",2e3," characters."]}),f.jsx(ct,{})]})}}),f.jsxs("div",{className:"flex items-center",children:[f.jsx(ue,{type:"submit",children:"Update Persona"}),n.isPending&&f.jsxs("div",{className:Tt("ml-4 flex items-center animate-in slide-in-from-bottom-2"),children:[f.jsx(un,{className:"mr-2 h-4 w-4 animate-spin "}),f.jsx("span",{children:"Updating Persona..."})]})]})]})})}const wCe=({persona:e,open:t,onOpenChange:n})=>f.jsx(Wt,{open:t,onOpenChange:n,children:f.jsxs(Bt,{className:"max-h-[95svh] w-full sm:max-w-[800px]",children:[f.jsxs(Pt,{children:[f.jsxs($t,{children:["Edit ",(e==null?void 0:e.name)??"Persona"]}),f.jsx(dn,{children:"Edit existing agent template here. Click create when you're done."})]}),e?f.jsx(SCe,{persona:e,closeDialog:()=>n(!1)}):f.jsx("p",{children:"No Persona...."})]})}),ECe=({value:e,onValueChange:t})=>f.jsx("form",{children:f.jsxs("div",{className:"relative",children:[f.jsx(Ms,{className:"pointer-events-none absolute left-[12px] top-3 h-4 w-4 text-muted-foreground"}),f.jsx(_n,{placeholder:"Search persona",value:e,onChange:n=>t(n.target.value),className:"w-52 pl-8 lg:w-80"})]})});let kx;const iU="HoverCard",[sU,ATe]=zn(iU,[qa]),KA=qa(),[xCe,YA]=sU(iU),kCe=e=>{const{__scopeHoverCard:t,children:n,open:r,defaultOpen:a,onOpenChange:o,openDelay:i=700,closeDelay:s=300}=e,l=KA(t),c=p.useRef(0),u=p.useRef(0),d=p.useRef(!1),g=p.useRef(!1),[m=!1,y]=Fa({prop:r,defaultProp:a,onChange:o}),b=p.useCallback(()=>{clearTimeout(u.current),c.current=window.setTimeout(()=>y(!0),i)},[i,y]),w=p.useCallback(()=>{clearTimeout(c.current),!d.current&&!g.current&&(u.current=window.setTimeout(()=>y(!1),s))},[s,y]),v=p.useCallback(()=>y(!1),[y]);return p.useEffect(()=>()=>{clearTimeout(c.current),clearTimeout(u.current)},[]),p.createElement(xCe,{scope:t,open:m,onOpenChange:y,onOpen:b,onClose:w,onDismiss:v,hasSelectionRef:d,isPointerDownOnContentRef:g},p.createElement(rh,l,n))},CCe="HoverCardTrigger",_Ce=p.forwardRef((e,t)=>{const{__scopeHoverCard:n,...r}=e,a=YA(CCe,n),o=KA(n);return p.createElement(ff,W({asChild:!0},o),p.createElement(ze.a,W({"data-state":a.open?"open":"closed"},r,{ref:t,onPointerEnter:fe(e.onPointerEnter,lm(a.onOpen)),onPointerLeave:fe(e.onPointerLeave,lm(a.onClose)),onFocus:fe(e.onFocus,a.onOpen),onBlur:fe(e.onBlur,a.onClose),onTouchStart:fe(e.onTouchStart,i=>i.preventDefault())})))}),ACe="HoverCardPortal",[TTe,TCe]=sU(ACe,{forceMount:void 0}),Vk="HoverCardContent",RCe=p.forwardRef((e,t)=>{const n=TCe(Vk,e.__scopeHoverCard),{forceMount:r=n.forceMount,...a}=e,o=YA(Vk,e.__scopeHoverCard);return p.createElement(pr,{present:r||o.open},p.createElement(NCe,W({"data-state":o.open?"open":"closed"},a,{onPointerEnter:fe(e.onPointerEnter,lm(o.onOpen)),onPointerLeave:fe(e.onPointerLeave,lm(o.onClose)),ref:t})))}),NCe=p.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:i,...s}=e,l=YA(Vk,n),c=KA(n),u=p.useRef(null),d=rt(t,u),[g,m]=p.useState(!1);return p.useEffect(()=>{if(g){const y=document.body;return kx=y.style.userSelect||y.style.webkitUserSelect,y.style.userSelect="none",y.style.webkitUserSelect="none",()=>{y.style.userSelect=kx,y.style.webkitUserSelect=kx}}},[g]),p.useEffect(()=>{if(u.current){const y=()=>{m(!1),l.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var b;((b=document.getSelection())===null||b===void 0?void 0:b.toString())!==""&&(l.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",y),()=>{document.removeEventListener("pointerup",y),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!1}}},[l.isPointerDownOnContentRef,l.hasSelectionRef]),p.useEffect(()=>{u.current&&ICe(u.current).forEach(b=>b.setAttribute("tabindex","-1"))}),p.createElement(Ls,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:i,onEscapeKeyDown:r,onPointerDownOutside:a,onFocusOutside:fe(o,y=>{y.preventDefault()}),onDismiss:l.onDismiss},p.createElement(pf,W({},c,s,{onPointerDown:fe(s.onPointerDown,y=>{y.currentTarget.contains(y.target)&&m(!0),l.hasSelectionRef.current=!1,l.isPointerDownOnContentRef.current=!0}),ref:d,style:{...s.style,userSelect:g?"text":void 0,WebkitUserSelect:g?"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 lm(e){return t=>t.pointerType==="touch"?void 0:e()}function ICe(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}const OCe=kCe,DCe=_Ce,lU=RCe,LCe=OCe,MCe=DCe,cU=p.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},a)=>f.jsx(lU,{ref:a,align:t,sideOffset:n,className:ee("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...r}));cU.displayName=lU.displayName;const ZA=({text:e})=>f.jsxs(LCe,{children:[f.jsx(MCe,{asChild:!0,children:f.jsx(ue,{size:"sm",variant:"ghost",className:"-mx-4 w-96 text-left font-normal",children:f.jsx("span",{className:"h-6 w-full truncate text-left",children:f.jsx("span",{className:"whitespace-pre",children:e})})})}),f.jsx(cU,{className:"w-[300px] p-4 sm:w-[500px]",children:f.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:f.jsx("p",{className:"whitespace-pre-wrap",children:e})})})]}),PCe=(e,t)=>[{accessorKey:"edit",header:"",size:20,cell:({row:n})=>t?f.jsx(Pi,{className:"h-6 w-6"}):f.jsx(ue,{onClick:()=>e(n.original),className:"!h-6 !w-6 !p-1",variant:"ghost",children:f.jsx($m,{className:"h-3.5 w-3.5"})})},{accessorKey:"name",header:"Name",cell:({row:n})=>f.jsx(Dn,{isLoading:t,children:n.getValue("name")})},{accessorKey:"value",header:"Value",cell:({row:n})=>f.jsx(Dn,{isLoading:t,children:f.jsx(ZA,{text:n.getValue("value")})})}],$Ce=({onPersonaEdit:e,nameFilter:t,className:n})=>{const{data:r,isLoading:a,isError:o}=Rg({label:Qr}),i=p.useMemo(()=>(r??[]).filter(s=>{var l;return(l=s.name)==null?void 0:l.includes(t)}),[r,t]);return f.jsx("div",{className:n,children:f.jsx(cf,{columns:PCe(e,a),isLoading:a,error:o?"Error loading agent templates":void 0,data:i,renderPagination:s=>f.jsx(uf,{className:"mt-4",table:s})})})},FCe=()=>{const[e,t]=p.useState(""),[n]=Ih(e,300),r=Li(),[a,o]=p.useState(r.search.includes("openCreatePersona")??!1),[i,s]=p.useState(null),[l,c]=p.useState(!1),u=d=>{s(d),c(!0)};return f.jsxs($s,{children:[f.jsxs("div",{className:"flex items-center justify-between bg-background/95 px-4 pb-3 pt-2.5 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[f.jsx(ECe,{value:e,onValueChange:t}),f.jsxs(ue,{onClick:()=>o(!0),size:"sm",children:[f.jsx(ya,{className:"mr-2 h-4 w-4"}),"Create Persona"]})]}),f.jsx($Ce,{onPersonaEdit:u,nameFilter:n,className:"mx-4"}),f.jsx(yCe,{open:a,onOpenChange:d=>o(d)}),f.jsx(wCe,{persona:i,open:l,onOpenChange:d=>c(d)})]})},jCe={path:"agent-templates",element:f.jsx(FCe,{})},uU="Radio",[zCe,dU]=zn(uU),[UCe,BCe]=zCe(uU),HCe=p.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:a=!1,required:o,disabled:i,value:s="on",onCheck:l,...c}=e,[u,d]=p.useState(null),g=rt(t,b=>d(b)),m=p.useRef(!1),y=u?!!u.closest("form"):!0;return p.createElement(UCe,{scope:n,checked:a,disabled:i},p.createElement(ze.button,W({type:"button",role:"radio","aria-checked":a,"data-state":fU(a),"data-disabled":i?"":void 0,disabled:i,value:s},c,{ref:g,onClick:fe(e.onClick,b=>{a||l==null||l(),y&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})})),y&&p.createElement(GCe,{control:u,bubbles:!m.current,name:r,value:s,checked:a,required:o,disabled:i,style:{transform:"translateX(-100%)"}}))}),VCe="RadioIndicator",qCe=p.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...a}=e,o=BCe(VCe,n);return p.createElement(pr,{present:r||o.checked},p.createElement(ze.span,W({"data-state":fU(o.checked),"data-disabled":o.disabled?"":void 0},a,{ref:t})))}),GCe=e=>{const{control:t,checked:n,bubbles:r=!0,...a}=e,o=p.useRef(null),i=F_(n),s=N_(t);return p.useEffect(()=>{const l=o.current,c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"checked").set;if(i!==n&&d){const g=new Event("click",{bubbles:r});d.call(l,n),l.dispatchEvent(g)}},[i,n,r]),p.createElement("input",W({type:"radio","aria-hidden":!0,defaultChecked:n},a,{tabIndex:-1,ref:o,style:{...e.style,...s,position:"absolute",pointerEvents:"none",opacity:0,margin:0}}))};function fU(e){return e?"checked":"unchecked"}const WCe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],pU="RadioGroup",[KCe,RTe]=zn(pU,[ah,dU]),gU=ah(),mU=dU(),[YCe,ZCe]=KCe(pU),XCe=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:a,value:o,required:i=!1,disabled:s=!1,orientation:l,dir:c,loop:u=!0,onValueChange:d,...g}=e,m=gU(n),y=x_(c),[b,w]=Fa({prop:o,defaultProp:a,onChange:d});return p.createElement(YCe,{scope:n,name:r,required:i,disabled:s,value:b,onValueChange:w},p.createElement(o7,W({asChild:!0},m,{orientation:l,dir:y,loop:u}),p.createElement(ze.div,W({role:"radiogroup","aria-required":i,"aria-orientation":l,"data-disabled":s?"":void 0,dir:y},g,{ref:t}))))}),QCe="RadioGroupItem",JCe=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...a}=e,o=ZCe(QCe,n),i=o.disabled||r,s=gU(n),l=mU(n),c=p.useRef(null),u=rt(t,c),d=o.value===a.value,g=p.useRef(!1);return p.useEffect(()=>{const m=b=>{WCe.includes(b.key)&&(g.current=!0)},y=()=>g.current=!1;return document.addEventListener("keydown",m),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",m),document.removeEventListener("keyup",y)}},[]),p.createElement(i7,W({asChild:!0},s,{focusable:!i,active:d}),p.createElement(HCe,W({disabled:i,required:o.required,checked:d},l,a,{name:o.name,ref:u,onCheck:()=>o.onValueChange(a.value),onKeyDown:fe(m=>{m.key==="Enter"&&m.preventDefault()}),onFocus:fe(a.onFocus,()=>{var m;g.current&&((m=c.current)===null||m===void 0||m.click())})})))}),e_e=p.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,a=mU(n);return p.createElement(qCe,W({},a,r,{ref:t}))}),hU=XCe,bU=JCe,t_e=e_e,yU=p.forwardRef(({className:e,...t},n)=>f.jsx(hU,{className:ee("grid gap-2",e),...t,ref:n}));yU.displayName=hU.displayName;const vU=p.forwardRef(({className:e,children:t,...n},r)=>f.jsx(bU,{ref:r,className:ee("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...n,children:f.jsx(t_e,{className:"flex items-center justify-center",children:f.jsx(QF,{className:"h-2.5 w-2.5 fill-current text-current"})})}));vU.displayName=bU.displayName;const qk="horizontal",n_e=["horizontal","vertical"],SU=p.forwardRef((e,t)=>{const{decorative:n,orientation:r=qk,...a}=e,o=wU(r)?r:qk,s=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return p.createElement(ze.div,W({"data-orientation":o},s,a,{ref:t}))});SU.propTypes={orientation(e,t,n){const r=e[t],a=String(r);return r&&!wU(r)?new Error(r_e(a,n)):null}};function r_e(e,t){return`Invalid prop \`orientation\` of value \`${e}\` supplied to \`${t}\`, expected one of: - horizontal - vertical diff --git a/letta/server/static_files/favicon.ico b/letta/server/static_files/static-files/favicon.ico similarity index 100% rename from letta/server/static_files/favicon.ico rename to letta/server/static_files/static-files/favicon.ico diff --git a/letta/server/static_files/index.html b/letta/server/static_files/static-files/index.html similarity index 94% rename from letta/server/static_files/index.html rename to letta/server/static_files/static-files/index.html index ca84b5a1ee..9c5a643ae3 100644 --- a/letta/server/static_files/index.html +++ b/letta/server/static_files/static-files/index.html @@ -29,7 +29,7 @@ } } - + diff --git a/letta/server/static_files/memgpt_logo_transparent.png b/letta/server/static_files/static-files/memgpt_logo_transparent.png similarity index 100% rename from letta/server/static_files/memgpt_logo_transparent.png rename to letta/server/static_files/static-files/memgpt_logo_transparent.png From 1788202d458a8bf85c347de973648ea17a33b7de Mon Sep 17 00:00:00 2001 From: Shubham Naik Date: Mon, 14 Oct 2024 10:57:51 -0700 Subject: [PATCH 2/2] chore: next --- .../{static-files => }/assets/index-3ab03d5b.css | 0 .../{static-files => }/assets/index-dc228d4a.js | 0 .../static_files/{static-files => }/favicon.ico | Bin .../static_files/{static-files => }/index.html | 0 .../{static-files => }/memgpt_logo_transparent.png | Bin 5 files changed, 0 insertions(+), 0 deletions(-) rename letta/server/static_files/{static-files => }/assets/index-3ab03d5b.css (100%) rename letta/server/static_files/{static-files => }/assets/index-dc228d4a.js (100%) rename letta/server/static_files/{static-files => }/favicon.ico (100%) rename letta/server/static_files/{static-files => }/index.html (100%) rename letta/server/static_files/{static-files => }/memgpt_logo_transparent.png (100%) diff --git a/letta/server/static_files/static-files/assets/index-3ab03d5b.css b/letta/server/static_files/assets/index-3ab03d5b.css similarity index 100% rename from letta/server/static_files/static-files/assets/index-3ab03d5b.css rename to letta/server/static_files/assets/index-3ab03d5b.css diff --git a/letta/server/static_files/static-files/assets/index-dc228d4a.js b/letta/server/static_files/assets/index-dc228d4a.js similarity index 100% rename from letta/server/static_files/static-files/assets/index-dc228d4a.js rename to letta/server/static_files/assets/index-dc228d4a.js diff --git a/letta/server/static_files/static-files/favicon.ico b/letta/server/static_files/favicon.ico similarity index 100% rename from letta/server/static_files/static-files/favicon.ico rename to letta/server/static_files/favicon.ico diff --git a/letta/server/static_files/static-files/index.html b/letta/server/static_files/index.html similarity index 100% rename from letta/server/static_files/static-files/index.html rename to letta/server/static_files/index.html diff --git a/letta/server/static_files/static-files/memgpt_logo_transparent.png b/letta/server/static_files/memgpt_logo_transparent.png similarity index 100% rename from letta/server/static_files/static-files/memgpt_logo_transparent.png rename to letta/server/static_files/memgpt_logo_transparent.png