PageSourceSearch

https://pleasantoncateringcompany.com/assets/ChatPanel-DvXC4VsA.js

js pleasantoncateringcompany.com collected 2026-09-29 11:07:00 UTC 366,970 bytes, 51 lines download raw bytes

1var ca=e=>{throw TypeError(e)};var la=(e,t,n)=>t.has(e)||ca("Cannot "+n);var se=(e,t,n)=>(la(e,t,"read from private field"),n?n.call(e):t.get(e)),Oo=(e,t,n)=>t.has(e)?ca("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Vn=(e,t,n,r)=>(la(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{D as oi,cu as lm,r as l,j as w,ba as Q,bq as Le,b9 as lt,aq as um,aO as si,aj as jc,X as ii,u as dm,aG as Lc,cv as fm,a as pm,b8 as ua,f as To}from"./index-B5Aoxc7f.js";import{u as mm}from"./use-mobile-6NNt0-df.js";import{B as zc,c as An,a as Fc}from"./input-CaPPmnTN.js";import{A as hm}from"./arrow-down-CqfsauXI.js";import{f as vm,g as gm,h as ym,i as bm,j as Zc,R as Uc}from"./dialog-CzbOn1_E.js";import{S as wm}from"./search-C4_LEUwQ.js";import{C as xm}from"./chevron-up-9NLVA2yF.js";import{L as Sm}from"./loader-circle-BavV0jUT.js";import{T as Em}from"./trash-2-HCSm3v03.js";const _m=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Cm=oi("circle",_m);const Pm=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],Im=oi("corner-down-left",Pm);const Rm=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Om=oi("square",Rm);var Bc="vercel.ai.error",Tm=Symbol.for(Bc),da,fa,bt=class Wc extends(fa=Error,da=Tm,fa){constructor({name:t,message:n,cause:r}){super(n),this[da]=!0,this.name=t,this.cause=r}static isInstance(t){return Wc.hasMarker(t,Bc)}static hasMarker(t,n){const r=Symbol.for(n);return t!=null&&typeof t=="object"&&r in t&&typeof t[r]=="boolean"&&t[r]===!0}};function Vc(e){return e==null?"unknown error":typeof e=="string"?e:e instanceof Error?e.toString():JSON.stringify(e)}var Hc="AI_InvalidArgumentError",Gc=`vercel.ai.error.${Hc}`,Am=Symbol.for(Gc),pa,ma,$m=class extends(ma=bt,pa=Am,ma){constructor({message:e,cause:t,argument:n}){super({name:Hc,message:e,cause:t}),this[pa]=!0,this.argument=n}static isInstance(e){return bt.hasMarker(e,Gc)}},Kc="AI_JSONParseError",qc=`vercel.ai.error.${Kc}`,Nm=Symbol.for(qc),ha,va,ga=class extends(va=bt,ha=Nm,va){constructor({text:e,cause:t}){super({name:Kc,message:`JSON parsing failed: Text: ${e}.
2Error message: ${Vc(t)}`,cause:t}),this[ha]=!0,this.text=e}static isInstance(e){return bt.hasMarker(e,qc)}},Jc="AI_TypeValidationError",Yc=`vercel.ai.error.${Jc}`,Dm=Symbol.for(Yc),ya,ba,$n=class ts extends(ba=bt,ya=Dm,ba){constructor({value:t,cause:n,context:r}){let o="Type validation failed";if(r?.field&&(o+=` for ${r.field}`),r?.entityName||r?.entityId){o+=" (";const s=[];r.entityName&&s.push(r.entityName),r.entityId&&s.push(`id: "${r.entityId}"`),o+=s.join(", "),o+=")"}super({name:Jc,message:`${o}: Value: ${JSON.stringify(t)}.
3Error message: ${Vc(n)}`,cause:n}),this[ya]=!0,this.value=t,this.context=r}static isInstance(t){return bt.hasMarker(t,Yc)}static wrap({value:t,cause:n,context:r}){var o,s,i;return ts.isInstance(n)&&n.value===t&&((o=n.context)==null?void 0:o.field)===r?.field&&((s=n.context)==null?void 0:s.entityName)===r?.entityName&&((i=n.context)==null?void 0:i.entityId)===r?.entityId?n:new ts({value:t,cause:n,context:r})}};function $(e,t,n){function r(a,d){var u;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(u=a._zod).traits??(u.traits=new Set),a._zod.traits.add(e),t(a,d);for(const f in i.prototype)f in a||Object.defineProperty(a,f,{value:i.prototype[f].bind(a)});a._zod.constr=i,a._zod.def=d}const o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var d;const u=n?.Parent?new s:this;r(u,a),(d=u._zod).deferred??(d.deferred=[]);for(const f of u._zod.deferred)f();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}class nr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const Xc={};function zt(e){return Xc}function Qc(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function Mm(e,t){return typeof t=="bigint"?t.toString():t}function ai(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ci(e){return e==null}function li(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function km(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,o=n>r?n:r,s=Number.parseInt(e.toFixed(o).replace(".","")),i=Number.parseInt(t.toFixed(o).replace(".",""));return s%i/10**o}function ce(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function Jr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Hn(e){return JSON.stringify(e)}const el=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Ur(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const jm=ai(()=>
vendor: 12,873 bytes, line 3
3{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Br(e){if(Ur(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Ur(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const Lm=new Set(["string","number","symbol"]);function lr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function an(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function K(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function zm(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const Fm={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Zm(e,t){const n={},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&(n[o]=r.shape[o])}return an(e,{...e._zod.def,shape:n,checks:[]})}function Um(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const o in t){if(!(o in r.shape))throw new Error(`Unrecognized key: "${o}"`);t[o]&&delete n[o]}return an(e,{...e._zod.def,shape:n,checks:[]})}function Bm(e,t){if(!Br(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return Jr(this,"shape",r),r},checks:[]};return an(e,n)}function Wm(e,t){return an(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return Jr(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function Vm(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)o[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return an(t,{...t._zod.def,shape:o,checks:[]})}function Hm(e,t,n){const r=t._zod.def.shape,o={...r};if(n)for(const s in n){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(o[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)o[s]=new e({type:"nonoptional",innerType:r[s]});return an(t,{...t._zod.def,shape:o,checks:[]})}function er(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Jt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Er(e){return typeof e=="string"?e:e?.message}function Ft(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const o=Er(e.inst?._zod.def?.error?.(e))??Er(t?.error?.(e))??Er(n.customError?.(e))??Er(n.localeError?.(e))??"Invalid input";r.message=o}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function ui(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function rr(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const tl=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,Mm,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},nl=$("$ZodError",tl),rl=$("$ZodError",tl,{Parent:Error});function Gm(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Km(e,t){const n=t||function(s){return s.message},r={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>o({issues:a}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)r._errors.push(n(i));else{let a=r,d=0;for(;d<i.path.length;){const u=i.path[d];d===i.path.length-1?(a[u]=a[u]||{_errors:[]},a[u]._errors.push(n(i))):a[u]=a[u]||{_errors:[]},a=a[u],d++}}};return o(e),r}const qm=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new nr;if(i.issues.length){const a=new(o?.Err??e)(i.issues.map(d=>Ft(d,s,zt())));throw el(a,o?.callee),a}return i.value},Jm=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new(o?.Err??e)(i.issues.map(d=>Ft(d,s,zt())));throw el(a,o?.callee),a}return i.value},ol=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new nr;return s.issues.length?{success:!1,error:new(e??nl)(s.issues.map(i=>Ft(i,o,zt())))}:{success:!0,data:s.value}},Ym=ol(rl),sl=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ft(i,o,zt())))}:{success:!0,data:s.value}},Xm=sl(rl),Qm=/^[cC][^\s-]{8,}$/,eh=/^[0-9a-z]+$/,th=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,nh=/^[0-9a-vA-V]{20}$/,rh=/^[A-Za-z0-9]{27}$/,oh=/^[a-zA-Z0-9_-]{21}$/,sh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ih=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,wa=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,ah=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,ch="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lh(){return new RegExp(ch,"u")}const uh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,dh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,fh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ph=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,mh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,il=/^[A-Za-z0-9_-]*$/,hh=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,vh=/^\+(?:[0-9]){6,14}[0-9]$/,al="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",gh=new RegExp(`^${al}$`);function cl(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function yh(e){return new RegExp(`^${cl(e)}$`)}function bh(e){const t=cl({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${al}T(?:${r})$`)}const wh=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},xh=/^\d+$/,Sh=/^-?\d+(?:\.\d+)?/i,Eh=/true|false/i,_h=/null/i,Ch=/^[^A-Z]*$/,Ph=/^[^a-z]*$/,Ze=$("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ll={number:"number",bigint:"bigint",object:"date"},ul=$("$ZodCheckLessThan",(e,t)=>{Ze.init(e,t);const n=ll[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),dl=$("$ZodCheckGreaterThan",(e,t)=>{Ze.init(e,t);const n=ll[typeof t.value];e._zod.onattach.push(r=>{const o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ih=$("$ZodCheckMultipleOf",(e,t)=>{Ze.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):km(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Rh=$("$ZodCheckNumberFormat",(e,t)=>{Ze.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Fm[t.format];e._zod.onattach.push(i=>{const a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=xh)}),e._zod.check=i=>{const a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inst:e})}}),Oh=$("$ZodCheckMaxLength",(e,t)=>{var n;Ze.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ci(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const i=ui(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Th=$("$ZodCheckMinLength",(e,t)=>{var n;Ze.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ci(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const i=ui(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Ah=$("$ZodCheckLengthEquals",(e,t)=>{var n;Ze.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!ci(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,s=o.length;if(s===t.length)return;const i=ui(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),Yr=$("$ZodCheckStringFormat",(e,t)=>{var n,r;Ze.init(e,t),e._zod.onattach.push(o=>{const s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),$h=$("$ZodCheckRegex",(e,t)=>{Yr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Nh=$("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Ch),Yr.init(e,t)}),Dh=$("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Ph),Yr.init(e,t)}),Mh=$("$ZodCheckIncludes",(e,t)=>{Ze.init(e,t);const n=lr(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input
vendor: 5,623 bytes, lines 3-5
3:o.value,inst:e,continue:!t.abort})}}),kh=$("$ZodCheckStartsWith",(e,t)=>{Ze.init(e,t);const n=new RegExp(`^${lr(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),jh=$("$ZodCheckEndsWith",(e,t)=>{Ze.init(e,t);const n=new RegExp(`.*${lr(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),Lh=$("$ZodCheckOverwrite",(e,t)=>{Ze.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class zh{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
4`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>`  ${s}`)];return new t(...n,o.join(`
5`))}}const Fh={major:4,minor:0,patch:0},me=$("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Fh;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const o of r)for(const s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(s,i,a)=>{let d=er(s),u;for(const f of i){if(f._zod.def.when){if(!f._zod.def.when(s))continue}else if(d)continue;const c=s.issues.length,m=f._zod.check(s);if(m instanceof Promise&&a?.async===!1)throw new nr;if(u||m instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await m,s.issues.length!==c&&(d||(d=er(s,c)))});else{if(s.issues.length===c)continue;d||(d=er(s,c))}}return u?u.then(()=>s):s};e._zod.run=(s,i)=>{const a=e._zod.parse(s,i);if(a instanceof Promise){if(i.async===!1)throw new nr;return a.then(d=>o(d,r,i))}return o(a,r,i)}}e["~standard"]={validate:o=>{try{const s=Ym(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Xm(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}}),di=$("$ZodString",(e,t)=>{me.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??wh(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),ve=$("$ZodStringFormat",(e,t)=>{Yr.init(e,t),di.init(e,t)}),Zh=$("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ih),ve.init(e,t)}),Uh=$("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=wa(r))}else t.pattern??(t.pattern=wa());ve.init(e,t)}),Bh=$("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=ah),ve.init(e,t)}),Wh=$("$ZodURL",(e,t)=>{ve.init(e,t),e._zod.check=n=>{try{const r=n.value,o=new URL(r),s=o.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:hh.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&s.endsWith("/")?n.value=s.slice(0,-1):n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Vh=$("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=lh()),ve.init(e,t)}),Hh=$("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=oh),ve.init(e,t)}),Gh=$("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Qm),ve.init(e,t)}),Kh=$("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=eh),ve.init(e,t)}),qh=$("$ZodULID",(e,t)=>{t.pattern??(t.pattern=th),ve.init(e,t)}),Jh=$("$ZodXID",(e,t)=>{t.pattern??(t.pattern=nh),ve.init(e,t)}),Yh=$("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=rh),ve.init(e,t)}),Xh=$("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=bh(t)),ve.init(e,t)}),Qh=$("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=gh),ve.init(e,t)}),ev=$("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=yh(t)),ve.init(e,t)}),tv=$("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=sh),ve.init(e,t)}),nv=$("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=uh),ve.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),rv=$("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=dh),ve.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),ov=$("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=fh),ve.init(e,t)}),sv=$("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ph),ve.init(e,t),e._zod.check=n=>{const[r,o]=n.value.split("/");try{if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function fl(e){if(e==="")return!0;
vendor: 6,541 bytes, lines 5-28
5if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const iv=$("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=mh),ve.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{fl(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function av(e){if(!il.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return fl(n)}const cv=$("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=il),ve.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{av(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),lv=$("$ZodE164",(e,t)=>{t.pattern??(t.pattern=vh),ve.init(e,t)});function uv(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const dv=$("$ZodJWT",(e,t)=>{ve.init(e,t),e._zod.check=n=>{uv(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),pl=$("$ZodNumber",(e,t)=>{me.init(e,t),e._zod.pattern=e._zod.bag.pattern??Sh,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),fv=$("$ZodNumber",(e,t)=>{Rh.init(e,t),pl.init(e,t)}),pv=$("$ZodBoolean",(e,t)=>{me.init(e,t),e._zod.pattern=Eh,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),mv=$("$ZodNull",(e,t)=>{me.init(e,t),e._zod.pattern=_h,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{const o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}}),hv=$("$ZodUnknown",(e,t)=>{me.init(e,t),e._zod.parse=n=>n}),vv=$("$ZodNever",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function xa(e,t,n){e.issues.length&&t.issues.push(...Jt(n,e.issues)),t.value[n]=e.value}const gv=$("$ZodArray",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],d=t.element._zod.run({value:a,issues:[]},r);d instanceof Promise?s.push(d.then(u=>xa(u,n,i))):xa(d,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function _r(e,t,n){e.issues.length&&t.issues.push(...Jt(n,e.issues)),t.value[n]=e.value}function Sa(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...Jt(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const yv=$("$ZodObject",(e,t)=>{me.init(e,t);const n=ai(()=>{const c=Object.keys(t.shape);for(const h of c)if(!(t.shape[h]instanceof me))throw new Error(`Invalid element at key "${h}": expected a Zod schema`);const m=zm(t.shape);return{shape:t.shape,keys:c,keySet:new Set(c),numKeys:c.length,optionalKeys:new Set(m)}});ce(e._zod,"propValues",()=>{const c=t.shape,m={};for(const h in c){const p=c[h]._zod;if(p.values){m[h]??(m[h]=new Set);for(const g of p.values)m[h].add(g)}}return m});const r=c=>{const m=new zh(["shape","payload","ctx"]),h=n.value,p=x=>{const b=Hn(x);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};m.write("const input = payload.value;");const g=Object.create(null);let v=0;for(const x of h.keys)g[x]=`key_${v++}`;m.write("const newResult = {}");for(const x of h.keys)if(h.optionalKeys.has(x)){const b=g[x];m.write(`const ${b} = ${p(x)};`);const E=Hn(x);m.write(`
6        if (${b}.issues.length) {
7          if (input[${E}] === undefined) {
8            if (${E} in input) {
9              newResult[${E}] = undefined;
10            }
11          } else {
12            payload.issues = payload.issues.concat(
13              ${b}.issues.map((iss) => ({
14                ...iss,
15                path: iss.path ? [${E}, ...iss.path] : [${E}],
16              }))
17            );
18          }
19        } else if (${b}.value === undefined) {
20          if (${E} in input) newResult[${E}] = undefined;
21        } else {
22          newResult[${E}] = ${b}.value;
23        }
24        `)}else{const b=g[x];m.write(`const ${b} = ${p(x)};`),m.write(`
25          if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
26            ...iss,
27            path: iss.path ? [${Hn(x)}, ...iss.path] : [${Hn(x)}]
28          })));`),m.write(`newResult[${Hn(x)}] = ${b}.value`)}m.write("payload.value = newResult;"),m.write("return payload;");const S=m.compile();return(x,b)=>S(c,x,b)};let o;const s=Ur,i=!Xc.jitless,d=i&&jm.value,u=t.catchall;let f;e._zod.parse=(c,m)=>{f??(f=n.value);const h=c.value;if(!s(h))return c.issues.push({expected:"object",code:"invalid_type",input:h,inst:e}),c;const p=[];if(i&&d&&m?.async===!1&&m.jitless!==!0)o||(o=r(t.shape)),c=o(c,m);else{c.value={};const b=f.shape;for(const E of f.keys){const _=b[E],y=_._zod.run({value:h[E],issues:[]},m),P=_._zod.optin==="optional"&&_._zod.optout==="optional";y instanceof Promise?p.push(y.then(T=>P?Sa(T,c,E,h):_r(T,c,E))):P?Sa(y,c,E,h):_r(y,c,E)}}if(!u)return p.length?Promise.all(p).then(()=>c):c;const g=[],v=f.keySet,S=u._zod,x=S.def.type;for(const b of Object.keys(h)){if(v.has(b))continue;if(x==="never"){g.push(b);continue}const E=S.run({value:h[b],issues:[]},m);E instanceof Promise?p.push(E.then(_=>_r(_,c,b))):_r(E,c,b)}return g.length&&c.issues.push({code:"unrecognized_keys",keys:g,input:h,inst:e}),p.length?Promise.all(p).then(()=>c):c}});function Ea(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>Ft(s,r,zt())))}),t}const ml=$("$ZodUnion",(e,t)=>{me.init(e,t),ce(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),ce(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),ce(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),ce(e._zod,"pattern",()=>{if(t.options.every(n=>
28n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>li(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Ea(i,n,e,r)):Ea(s,n,e,r)}}),bv=$("$ZodDiscriminatedUnion",(e,t)=>{ml.init(e,t);const n=e._zod.parse;ce(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,d]of Object.entries(i)){o[a]||(o[a]=new Set);for(const u of d)o[a].add(u)}}return o});const r=ai(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const d of a){if(s.has(d))throw new Error(`Duplicate discriminator value "${String(d)}"`);s.set(d,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!Ur(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),wv=$("$ZodIntersection",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([d,u])=>_a(n,d,u)):_a(n,s,i)}});function ns(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Br(e)&&Br(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=ns(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=ns(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _a(e,t,n){if(t.issues.length&&e.issues.push(...t.issues),n.issues.length&&e.issues.push(...n.issues),er(e))return e;const r=ns(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const xv=$("$ZodRecord",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Br(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const d of i)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){const u=t.valueType._zod.run({value:o[d],issues:[]},r);u instanceof Promise?s.push(u.then(f=>{f.issues.length&&n.issues.push(...Jt(d,f.issues)),n.value[d]=f.value})):(u.issues.length&&n.issues.push(...Jt(d,u.issues)),n.value[d]=u.value)}let a;for(const d in o)i.has(d)||(a=a??[],a.push(d));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(u=>Ft(u,r,zt())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}const d=t.valueType._zod.run({value:o[i],issues:[]},r);d instanceof Promise?s.push(d.then(u=>{u.issues.length&&n.issues.push(...Jt(i,u.issues)),n.value[a.value]=u.value})):(d.issues.length&&n.issues.push(...Jt(i,d.issues)),n.value[a.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Sv=$("$ZodEnum",(e,t)=>{me.init(e,t);const n=Qc(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>Lm.has(typeof r)).map(r=>typeof r=="string"?lr(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Ev=$("$ZodLiteral",(e,t)=>{me.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?lr(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),_v=$("$ZodTransform",(e,t)=>{me.init(e,t),e._zod.parse=(n,r)=>
vendor: 8,561 bytes, line 28
28{const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n));if(o instanceof Promise)throw new nr;return n.value=o,n}}),Cv=$("$ZodOptional",(e,t)=>{me.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ce(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${li(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),Pv=$("$ZodNullable",(e,t)=>{me.init(e,t),ce(e._zod,"optin",()=>t.innerType._zod.optin),ce(e._zod,"optout",()=>t.innerType._zod.optout),ce(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${li(n.source)}|null)$`):void 0}),ce(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Iv=$("$ZodDefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Ca(s,t)):Ca(o,t)}});function Ca(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Rv=$("$ZodPrefault",(e,t)=>{me.init(e,t),e._zod.optin="optional",ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Ov=$("$ZodNonOptional",(e,t)=>{me.init(e,t),ce(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Pa(s,e)):Pa(o,e)}});function Pa(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Tv=$("$ZodCatch",(e,t)=>{me.init(e,t),e._zod.optin="optional",ce(e._zod,"optout",()=>t.innerType._zod.optout),ce(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Ft(i,r,zt()))},input:n.value}),n.issues=[]),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Ft(s,r,zt()))},input:n.value}),n.issues=[]),n)}}),Av=$("$ZodPipe",(e,t)=>{me.init(e,t),ce(e._zod,"values",()=>t.in._zod.values),ce(e._zod,"optin",()=>t.in._zod.optin),ce(e._zod,"optout",()=>t.out._zod.optout),e._zod.parse=(n,r)=>{const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Ia(s,t,r)):Ia(o,t,r)}});function Ia(e,t,n){return er(e)?e:t.out._zod.run({value:e.value,issues:e.issues},n)}const $v=$("$ZodReadonly",(e,t)=>{me.init(e,t),ce(e._zod,"propValues",()=>t.innerType._zod.propValues),ce(e._zod,"values",()=>t.innerType._zod.values),ce(e._zod,"optin",()=>t.innerType._zod.optin),ce(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Ra):Ra(o)}});function Ra(e){return e.value=Object.freeze(e.value),e}const Nv=$("$ZodLazy",(e,t)=>{me.init(e,t),ce(e._zod,"innerType",()=>t.getter()),ce(e._zod,"pattern",()=>e._zod.innerType._zod.pattern),ce(e._zod,"propValues",()=>e._zod.innerType._zod.propValues),ce(e._zod,"optin",()=>e._zod.innerType._zod.optin),ce(e._zod,"optout",()=>e._zod.innerType._zod.optout),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Dv=$("$ZodCustom",(e,t)=>{Ze.init(e,t),me.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Oa(s,n,r,e));Oa(o,n,r,e)}});function Oa(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(rr(o))}}class hl{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}}function Mv(){return new hl}const Jn=Mv();function kv(e,t){return new e({type:"string",...K(t)})}function jv(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...K(t)})}function Ta(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...K(t)})}function Lv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...K(t)})}function zv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...K(t)})}function Fv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...K(t)})}function Zv(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...K(t)})}function Uv(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...K(t)})}function Bv(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...K(t)})}function Wv(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...K(t)})}function Vv(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...K(t)})}function Hv(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...K(t)})}function Gv(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...K(t)})}function Kv(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...K(t)})}function qv(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...K(t)})}function Jv(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...K(t)})}function Yv(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...K(t)})}function Xv(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...K(t)})}function Qv(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...K(t)})}function eg(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...K(t)})}function tg(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...K(t)})}function ng(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...K(t)})}function rg(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...K(t)})}function og(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...K(t)})}function sg(e,t){return new e({type:"string",format:"date",check:"string_format",...K(t)})}function ig(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...K(t)})}function ag(e,t){return new e({type:"string",format:"duration",check:"string_format",...K(t)})}function cg(e,t){return new e({type:"number",checks:[],...K(t)})}function lg(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...K(t)})}function ug(e,t){return new e({type:"boolean",...K(t)})}function dg(e,t){return new e({type:"null",...K(t)})}function fg(e){return new e({type:"unknown"})}function pg(e,t){return new e({type:"never",...K(t)})}function Aa(e,t){return new ul({check:"less_than",...K(t),value:e,inclusive:!1})}function Ao(e,t){return new ul({check:"less_than",...K(t),value:e,inclusive:!0})}function $a(e,t){return new dl({check:"greater_than",...K(t),value:e,inclusive:!1})}function $o(e,t){return new dl({check:"greater_than",...K(t),value:e,inclusive:!0})}function Na(e,t){return new Ih({check:"multiple_of",...K(t),value:e})}function vl(e,t){return new Oh({check:"max_length",...K(t),maximum:e})}function Wr(e,t){return new Th({check:"min_length",...K(t),minimum:e})}function gl(e,t){return new Ah({check:"length_equals",...K(t),length:e})}function mg(e,t){return new $h({check:"string_format",format:"regex",...K(t),pattern:e})}function hg(e){return new Nh({check:"string_format",format:"lowercase",...K(e)})}
28function vg(e){return new Dh({check:"string_format",format:"uppercase",...K(e)})}function gg(e,t){return new Mh({check:"string_format",format:"includes",...K(t),includes:e})}function yg(e,t){return new kh({check:"string_format",format:"starts_with",...K(t),prefix:e})}function bg(e,t){return new jh({check:"string_format",format:"ends_with",...K(t),suffix:e})}function ur(e){return new Lh({check:"overwrite",tx:e})}function wg(e){return ur(t=>t.normalize(e))}function xg(){return ur(e=>e.trim())}function Sg(){return ur(e=>e.toLowerCase())}function Eg(){return ur(e=>e.toUpperCase())}function _g(e,t,n){return new e({type:"array",element:t,...K(n)})}function Cg(e,t,n){const r=K(n);return r.abort??(r.abort=!0),new e({type:"custom",check:"custom",fn:t,...r})}function Pg(e,t,n){return new e({type:"custom",check:"custom",fn:t,...K(n)})}class Da{constructor(t){this.counter=0,this.metadataRegistry=t?.metadata??Jn,this.target=t?.target??"draft-2020-12",this.unrepresentable=t?.unrepresentable??"throw",this.override=t?.override??(()=>{}),this.io=t?.io??"output",this.seen=new Map}process(t,n={path:[],schemaPath:[]}){var r;const o=t._zod.def,s={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i=this.seen.get(t);if(i)return i.count++,n.schemaPath.includes(t)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};this.seen.set(t,a);const d=t._zod.toJSONSchema?.();if(d)a.schema=d;else{const c={...n,schemaPath:[...n.schemaPath,t],path:n.path},m=t._zod.parent;if(m)a.ref=m,this.process(m,c),this.seen.get(m).isParent=!0;else{const h=a.schema;switch(o.type){case"string":{const p=h;p.type="string";const{minimum:g,maximum:v,format:S,patterns:x,contentEncoding:b}=t._zod.bag;if(typeof g=="number"&&(p.minLength=g),typeof v=="number"&&(p.maxLength=v),S&&(p.format=s[S]??S,p.format===""&&delete p.format),b&&(p.contentEncoding=b),x&&x.size>0){const E=[...x];E.length===1?p.pattern=E[0].source:E.length>1&&(a.schema.allOf=[...E.map(_=>({...this.target==="draft-7"?{type:"string"}:{},pattern:_.source}))])}break}case"number":{const p=h,{minimum:g,maximum:v,format:S,multipleOf:x,exclusiveMaximum:b,exclusiveMinimum:E}=t._zod.bag;typeof S=="string"&&S.includes("int")?p.type="integer":p.type="number",typeof E=="number"&&(p.exclusiveMinimum=E),typeof g=="number"&&(p.minimum=g,typeof E=="number"&&(E>=g?delete p.minimum:delete p.exclusiveMinimum)),typeof b=="number"&&(p.exclusiveMaximum=b),typeof v=="number"&&(p.maximum=v,typeof b=="number"&&(b<=v?delete p.maximum:delete p.exclusiveMaximum)),typeof x=="number"&&(p.multipleOf=x);break}case"boolean":{const p=h;p.type="boolean";break}case"bigint":{if(this.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema");break}case"symbol":{if(this.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema");break}case"null":{h.type="null";break}case"any":break;case"unknown":break;case"undefined":{if(this.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema");break}case"void":{if(this.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema");break}case"never":{h.not={};break}case"date":{if(this.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema");break}case"array":{const p=h,{minimum:g,maximum:v}=t._zod.bag;typeof g=="number"&&(p.minItems=g),typeof v=="number"&&(p.maxItems=v),p.type="array",p.items=this.process(o.element,{...c,path:[...c.path,"items"]});break}case"object":{const p=h;p.type="object",p.properties={};const g=o.shape;for(const x in g)p.properties[x]=this.process(g[x],{...c,path:[...c.path,"properties",x]});const v=new Set(Object.keys(g)),S=new Set([...v].filter(x=>{const b=o.shape[x]._zod;return this.io==="input"?b.optin===void 0:b.optout===void 0}));S.size>
280&&(p.required=Array.from(S)),o.catchall?._zod.def.type==="never"?p.additionalProperties=!1:o.catchall?o.catchall&&(p.additionalProperties=this.process(o.catchall,{...c,path:[...c.path,"additionalProperties"]})):this.io==="output"&&(p.additionalProperties=!1);break}case"union":{const p=h;p.anyOf=o.options.map((g,v)=>this.process(g,{...c,path:[...c.path,"anyOf",v]}));break}case"intersection":{const p=h,g=this.process(o.left,{...c,path:[...c.path,"allOf",0]}),v=this.process(o.right,{...c,path:[...c.path,"allOf",1]}),S=b=>"allOf"in b&&Object.keys(b).length===1,x=[...S(g)?g.allOf:[g],...S(v)?v.allOf:[v]];p.allOf=x;break}case"tuple":{const p=h;p.type="array";const g=o.items.map((x,b)=>this.process(x,{...c,path:[...c.path,"prefixItems",b]}));if(this.target==="draft-2020-12"?p.prefixItems=g:p.items=g,o.rest){const x=this.process(o.rest,{...c,path:[...c.path,"items"]});this.target==="draft-2020-12"?p.items=x:p.additionalItems=x}o.rest&&(p.items=this.process(o.rest,{...c,path:[...c.path,"items"]}));const{minimum:v,maximum:S}=t._zod.bag;typeof v=="number"&&(p.minItems=v),typeof S=="number"&&(p.maxItems=S);break}case"record":{const p=h;p.type="object",p.propertyNames=this.process(o.keyType,{...c,path:[...c.path,"propertyNames"]}),p.additionalProperties=this.process(o.valueType,{...c,path:[...c.path,"additionalProperties"]});break}case"map":{if(this.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema");break}case"set":{if(this.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema");break}case"enum":{const p=h,g=Qc(o.entries);g.every(v=>typeof v=="number")&&(p.type="number"),g.every(v=>typeof v=="string")&&(p.type="string"),p.enum=g;break}case"literal":{const p=h,g=[];for(const v of o.values)if(v===void 0){if(this.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof v=="bigint"){if(this.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");g.push(Number(v))}else g.push(v);if(g.length!==0)if(g.length===1){const v=g[0];p.type=v===null?"null":typeof v,p.const=v}else g.every(v=>typeof v=="number")&&(p.type="number"),g.every(v=>typeof v=="string")&&(p.type="string"),g.every(v=>typeof v=="boolean")&&(p.type="string"),g.every(v=>v===null)&&(p.type="null"),p.enum=g;break}case"file":{const p=h,g={type:"string",format:"binary",contentEncoding:"binary"},{minimum:v,maximum:S,mime:x}=t._zod.bag;v!==void 0&&(g.minLength=v),S!==void 0&&(g.maxLength=S),x?x.length===1?(g.contentMediaType=x[0],Object.assign(p,g)):p.anyOf=x.map(b=>({...g,contentMediaType:b})):Object.assign(p,g);break}case"transform":{if(this.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema");break}case"nullable":{const p=this.process(o.innerType,c);h.anyOf=[p,{type:"null"}];break}case"nonoptional":{this.process(o.innerType,c),a.ref=o.innerType;break}case"success":{const p=h;p.type="boolean";break}case"default":{this.process(o.innerType,c),a.ref=o.innerType,h.default=JSON.parse(JSON.stringify(o.defaultValue));break}case"prefault":{this.process(o.innerType,c),a.ref=o.innerType,this.io==="input"&&(h._prefault=JSON.parse(JSON.stringify(o.defaultValue)));break}case"catch":{this.process(o.innerType,c),a.ref=o.innerType;let p;try{p=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}h.default=p;break}case"nan":{if(this.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema");break}case"template_literal":{const p=h,g=t._zod.pattern;if(!g)throw new Error("Pattern not found in template literal");p.type="string",p.pattern=g.source;break}case"pipe":{const p=this.io==="input"?o.in._zod.def.type==="transform"?o.out:o.in:o.out;this.process(p,c),a.ref=p;break}case"readonly":{this.process(o.innerType,c),a.ref=o.innerType,h.readOnly=!0;break}case"promise":{this.process(o.innerType,c),a.ref=o.innerType;break}case"optional":{this.process(o.innerType,c),a.ref=o.innerType;break}case"lazy":{const p=t._zod.innerType;this.process(p,c),a.ref=p;break}
28case"custom":{if(this.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema");break}}}}const u=this.metadataRegistry.get(t);return u&&Object.assign(a.schema,u),this.io==="input"&&Se(t)&&(delete a.schema.examples,delete a.schema.default),this.io==="input"&&a.schema._prefault&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,this.seen.get(t).schema}emit(t,n){const r={cycles:n?.cycles??"ref",reused:n?.reused??"inline",external:n?.external??void 0},o=this.seen.get(t);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=f=>{const c=this.target==="draft-2020-12"?"$defs":"definitions";if(r.external){const g=r.external.registry.get(f[0])?.id,v=r.external.uri??(x=>x);if(g)return{ref:v(g)};const S=f[1].defId??f[1].schema.id??`schema${this.counter++}`;return f[1].defId=S,{defId:S,ref:`${v("__shared")}#/${c}/${S}`}}if(f[1]===o)return{ref:"#"};const h=`#/${c}/`,p=f[1].schema.id??`__schema${this.counter++}`;return{defId:p,ref:h+p}},i=f=>{if(f[1].schema.$ref)return;const c=f[1],{ref:m,defId:h}=s(f);c.def={...c.schema},h&&(c.defId=h);const p=c.schema;for(const g in p)delete p[g];p.$ref=m};if(r.cycles==="throw")for(const f of this.seen.entries()){const c=f[1];if(c.cycle)throw new Error(`Cycle detected: #/${c.cycle?.join("/")}/<root>
29
30Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of this.seen.entries()){const c=f[1];if(t===f[0]){i(f);continue}if(r.external){const h=r.external.registry.get(f[0])?.id;if(t!==f[0]&&h){i(f);continue}}if(this.metadataRegistry.get(f[0])?.id){i(f);continue}if(c.cycle){i(f);continue}if(c.count>1&&r.reused==="ref"){i(f);continue}}const a=(f,c)=>{const m=this.seen.get(f),h=m.def??m.schema,p={...h};if(m.ref===null)return;const g=m.ref;if(m.ref=null,g){a(g,c);const v=this.seen.get(g).schema;v.$ref&&c.target==="draft-7"?(h.allOf=h.allOf??[],h.allOf.push(v)):(Object.assign(h,v),Object.assign(h,p))}m.isParent||this.override({zodSchema:f,jsonSchema:h,path:m.path??[]})};for(const f of[...this.seen.entries()].reverse())a(f[0],{target:this.target});const d={};if(this.target==="draft-2020-12"?d.$schema="https://json-schema.org/draft/2020-12/schema":this.target==="draft-7"?d.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),r.external?.uri){const f=r.external.registry.get(t)?.id;if(!f)throw new Error("Schema is missing an `id` property");d.$id=r.external.uri(f)}Object.assign(d,o.def);const u=r.external?.defs??{};for(const f of this.seen.entries()){const c=f[1];c.def&&c.defId&&(u[c.defId]=c.def)}r.external||Object.keys(u).length>0&&(this.target==="draft-2020-12"?d.$defs=u:d.definitions=u);try{return JSON.parse(JSON.stringify(d))}catch{throw new Error("Error converting schema to JSON.")}}}function Ig(e,t){if(e instanceof hl){const r=new Da(t),o={};
30for(const a of e._idmap.entries()){const[d,u]=a;r.process(u)}const s={},i={registry:e,uri:t?.uri,defs:o};for(const a of e._idmap.entries()){const[d,u]=a;s[d]=r.emit(u,{...t,external:i})}if(Object.keys(o).length>0){const a=r.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[a]:o}}return{schemas:s}}const n=new Da(t);return n.process(e),n.emit(e,t)}function Se(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;switch(o.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":return!1;case"array":return Se(o.element,n);case"object":{for(const s in o.shape)if(Se(o.shape[s],n))return!0;return!1}case"union":{for(const s of o.options)if(Se(s,n))return!0;return!1}case"intersection":return Se(o.left,n)||Se(o.right,n);case"tuple":{for(const s of o.items)if(Se(s,n))return!0;return!!(o.rest&&Se(o.rest,n))}case"record":return Se(o.
30keyType,n)||Se(o.valueType,n);case"map":return Se(o.keyType,n)||Se(o.valueType,n);case"set":return Se(o.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":return Se(o.innerType,n);case"lazy":return Se(o.getter(),n);case"default":return Se(o.innerType,n);case"prefault":return Se(o.innerType,n);case"custom":return!1;case"transform":return!0;case"pipe":return Se(o.in,n)||Se(o.out,n);case"success":return!1;case"catch":return!1}throw new Error(`Unknown schema type: ${o.type}`)}const Rg=$("ZodISODateTime",(e,t)=>{Xh.init(e,t),ye.init(e,t)});function Og(e){return og(Rg,e)}const Tg=$("ZodISODate",(e,t)=>{Qh.init(e,t),ye.init(e,t)});function Ag(e){return sg(Tg,e)}const $g=$("ZodISOTime",(e,t)=>{ev.init(e,t),ye.init(e,t)});function Ng(e){return ig($g,e)}const Dg=$("ZodISODuration",(e,t)=>{tv.init(e,t),ye.init(e,t)});function Mg(e){return ag(Dg,e)}const kg=(e,t)=>{nl.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Km(e,n)},flatten:{value:n=>Gm(e,n)},addIssue:{value:n=>e.issues.push(n)},addIssues:{value:n=>e.issues.push(...n)},isEmpty:{get(){return e.issues.length===0}}})},Xr=$("ZodError",kg,{Parent:Error}),jg=qm(Xr),Lg=Jm(Xr),zg=ol(Xr),yl=sl(Xr),ge=$("ZodType",(e,t)=>(me.init(e,t),e.def=t,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>an(e,n,r),e.brand=()=>e,e.register=((n,r)=>(n.add(e,r),e)),e.parse=(n,r)=>jg(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>zg(e,n,r),e.parseAsync=async(n,r)=>Lg(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>yl(e,n,r),e.spa=e.safeParseAsync,e.refine=(n,r)=>e.check(Dy(n,r)),e.superRefine=n=>e.check(My(n)),e.overwrite=n=>e.check(ur(n)),e.optional=()=>ja(e),e.nullable=()=>La(e),e.nullish=()=>ja(La(e)),e.nonoptional=n=>Cy(e,n),e.array=()=>jn(e),e.or=n=>Ne([e,n]),e.and=n=>hy(e,n),e.transform=n=>za(e,by(n)),e.default=n=>Sy(e,n),e.prefault=n=>_y(e,n),e.catch=n=>Iy(e,n),e.pipe=n=>za(e,n),e.readonly=()=>Ty(e),e.describe=n=>{const r=e.clone();return Jn.add(r,{description:n}),r},Object.defineProperty(e,"description",{get(){return Jn.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return Jn.get(e);const r=e.clone();return Jn.add(r,n[0]),r},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),bl=$("_ZodString",(e,t)=>{di.init(e,t),ge.init(e,t);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...r)=>e.check(mg(...r)),e.includes=(...r)=>e.check(gg(...r)),e.startsWith=(...r)=>e.check(yg(...r)),e.endsWith=(...r)=>e.check(bg(...r)),e.min=(...r)=>e.check(Wr(...r)),e.max=(...r)=>e.check(vl(...r)),e.length=(...r)=>e.check(gl(...r)),e.nonempty=(...r)=>e.check(Wr(1,...r)),e.lowercase=r=>e.check(hg(r)),e.uppercase=r=>e.check(vg(r)),e.trim=()=>e.check(xg()),e.normalize=(...r)=>e.check(wg(...r)),e.toLowerCase=()=>e.check(Sg()),e.toUpperCase=()=>e.check(Eg())}),Fg=$("ZodString",(e,t)=>{di.init(e,t),bl.init(e,t),e.email=n=>e.check(jv(Zg,n)),e.url=n=>e.check(Uv(Ug,n)),e.jwt=n=>e.check(rg(ry,n)),e.emoji=n=>e.check(Bv(Bg,n)),e.guid=n=>e.check(Ta(Ma,n)),e.uuid=n=>e.check(Lv(Cr,n)),e.uuidv4=n=>e.check(zv(Cr,n)),e.uuidv6=n=>e.check(Fv(Cr,n)),e.uuidv7=n=>e.check(Zv(Cr,n)),e.nanoid=n=>e.check(Wv(Wg,n)),e.guid=n=>e.check(Ta(Ma,n)),e.cuid=n=>e.check(Vv(Vg,n)),e.cuid2=n=>e.check(Hv(Hg,n)),e.ulid=n=>e.check(Gv(Gg,n)),e.base64=n=>e.check(eg(ey,n)),e.base64url=n=>
vendor: 5,152 bytes, line 30
30e.check(tg(ty,n)),e.xid=n=>e.check(Kv(Kg,n)),e.ksuid=n=>e.check(qv(qg,n)),e.ipv4=n=>e.check(Jv(Jg,n)),e.ipv6=n=>e.check(Yv(Yg,n)),e.cidrv4=n=>e.check(Xv(Xg,n)),e.cidrv6=n=>e.check(Qv(Qg,n)),e.e164=n=>e.check(ng(ny,n)),e.datetime=n=>e.check(Og(n)),e.date=n=>e.check(Ag(n)),e.time=n=>e.check(Ng(n)),e.duration=n=>e.check(Mg(n))});function M(e){return kv(Fg,e)}const ye=$("ZodStringFormat",(e,t)=>{ve.init(e,t),bl.init(e,t)}),Zg=$("ZodEmail",(e,t)=>{Bh.init(e,t),ye.init(e,t)}),Ma=$("ZodGUID",(e,t)=>{Zh.init(e,t),ye.init(e,t)}),Cr=$("ZodUUID",(e,t)=>{Uh.init(e,t),ye.init(e,t)}),Ug=$("ZodURL",(e,t)=>{Wh.init(e,t),ye.init(e,t)}),Bg=$("ZodEmoji",(e,t)=>{Vh.init(e,t),ye.init(e,t)}),Wg=$("ZodNanoID",(e,t)=>{Hh.init(e,t),ye.init(e,t)}),Vg=$("ZodCUID",(e,t)=>{Gh.init(e,t),ye.init(e,t)}),Hg=$("ZodCUID2",(e,t)=>{Kh.init(e,t),ye.init(e,t)}),Gg=$("ZodULID",(e,t)=>{qh.init(e,t),ye.init(e,t)}),Kg=$("ZodXID",(e,t)=>{Jh.init(e,t),ye.init(e,t)}),qg=$("ZodKSUID",(e,t)=>{Yh.init(e,t),ye.init(e,t)}),Jg=$("ZodIPv4",(e,t)=>{nv.init(e,t),ye.init(e,t)}),Yg=$("ZodIPv6",(e,t)=>{rv.init(e,t),ye.init(e,t)}),Xg=$("ZodCIDRv4",(e,t)=>{ov.init(e,t),ye.init(e,t)}),Qg=$("ZodCIDRv6",(e,t)=>{sv.init(e,t),ye.init(e,t)}),ey=$("ZodBase64",(e,t)=>{iv.init(e,t),ye.init(e,t)}),ty=$("ZodBase64URL",(e,t)=>{cv.init(e,t),ye.init(e,t)}),ny=$("ZodE164",(e,t)=>{lv.init(e,t),ye.init(e,t)}),ry=$("ZodJWT",(e,t)=>{dv.init(e,t),ye.init(e,t)}),wl=$("ZodNumber",(e,t)=>{pl.init(e,t),ge.init(e,t),e.gt=(r,o)=>e.check($a(r,o)),e.gte=(r,o)=>e.check($o(r,o)),e.min=(r,o)=>e.check($o(r,o)),e.lt=(r,o)=>e.check(Aa(r,o)),e.lte=(r,o)=>e.check(Ao(r,o)),e.max=(r,o)=>e.check(Ao(r,o)),e.int=r=>e.check(ka(r)),e.safe=r=>e.check(ka(r)),e.positive=r=>e.check($a(0,r)),e.nonnegative=r=>e.check($o(0,r)),e.negative=r=>e.check(Aa(0,r)),e.nonpositive=r=>e.check(Ao(0,r)),e.multipleOf=(r,o)=>e.check(Na(r,o)),e.step=(r,o)=>e.check(Na(r,o)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function oy(e){return cg(wl,e)}const sy=$("ZodNumberFormat",(e,t)=>{fv.init(e,t),wl.init(e,t)});function ka(e){return lg(sy,e)}const iy=$("ZodBoolean",(e,t)=>{pv.init(e,t),ge.init(e,t)});function _e(e){return ug(iy,e)}const ay=$("ZodNull",(e,t)=>{mv.init(e,t),ge.init(e,t)});function cy(e){return dg(ay,e)}const ly=$("ZodUnknown",(e,t)=>{hv.init(e,t),ge.init(e,t)});function rt(){return fg(ly)}const uy=$("ZodNever",(e,t)=>{vv.init(e,t),ge.init(e,t)});function dy(e){return pg(uy,e)}const fy=$("ZodArray",(e,t)=>{gv.init(e,t),ge.init(e,t),e.element=t.element,e.min=(n,r)=>e.check(Wr(n,r)),e.nonempty=n=>e.check(Wr(1,n)),e.max=(n,r)=>e.check(vl(n,r)),e.length=(n,r)=>e.check(gl(n,r)),e.unwrap=()=>e.element});function jn(e,t){return _g(fy,e,t)}const xl=$("ZodObject",(e,t)=>{yv.init(e,t),ge.init(e,t),ce(e,"shape",()=>t.shape),e.keyof=()=>El(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:rt()}),e.loose=()=>e.clone({...e._zod.def,catchall:rt()}),e.strict=()=>e.clone({...e._zod.def,catchall:dy()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>Bm(e,n),e.merge=n=>Wm(e,n),e.pick=n=>Zm(e,n),e.omit=n=>Um(e,n),e.partial=(...n)=>Vm(_l,e,n[0]),e.required=(...n)=>Hm(Cl,e,n[0])});function te(e,t){const n={type:"object",get shape(){return Jr(this,"shape",{...e}),this.shape},...K(t)};return new xl(n)}function ue(e,t){return new xl({type:"object",get shape(){return Jr(this,"shape",{...e}),this.shape},catchall:rt(),...K(t)})}const Sl=$("ZodUnion",(e,t)=>{ml.init(e,t),ge.init(e,t),e.options=t.options});function Ne(e,t){return new Sl({type:"union",options:e,...K(t)})}const py=$("ZodDiscriminatedUnion",(e,t)=>{Sl.init(e,t),bv.init(e,t)});function fi(e,t,n){return new py({type:"union",options:t,discriminator:e,...K(n)})}const my=$("ZodIntersection",(e,t)=>{wv.init(e,t),ge.init(e,t)});function hy(e,t){return new my({type:"intersection",left:e,right:t})}const vy=$("ZodRecord",(e,t)=>{xv.init(e,t),ge.init(e,t),e.keyType=t.keyType,e.valueType=t.valueType});function ot(e,t,n){return new vy({type:"record",keyType:e,valueType:t,...K(n)})}const rs=$("ZodEnum",(e,t)=>{Sv.init(e,t),ge.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new rs({...t,checks:[],...K(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new rs({...t,checks:[],...K(o),entries:s})}});function El(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new rs({type:"enum",entries:n,...K(t)})}const gy=$("ZodLiteral",(e,t)=>{Ev.init(e,t),ge.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if
30(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new gy({type:"literal",values:Array.isArray(e)?e:[e],...K(t)})}const yy=$("ZodTransform",(e,t)=>{_v.init(e,t),ge.init(e,t),e._zod.parse=(n,r)=>{n.addIssue=s=>{if(typeof s=="string")n.issues.push(rr(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),i.continue??(i.continue=!0),n.issues.push(rr(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n)):(n.value=o,n)}});function by(e){return new yy({type:"transform",transform:e})}const _l=$("ZodOptional",(e,t)=>{Cv.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function ja(e){return new _l({type:"optional",innerType:e})}const wy=$("ZodNullable",(e,t)=>{Pv.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function La(e){return new wy({type:"nullable",innerType:e})}const xy=$("ZodDefault",(e,t)=>{Iv.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Sy(e,t){return new xy({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Ey=$("ZodPrefault",(e,t)=>{Rv.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function _y(e,t){return new Ey({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():t}})}const Cl=$("ZodNonOptional",(e,t)=>{Ov.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.innerType});function Cy(e,t){return new Cl({type:"nonoptional",innerType:e,...K(t)})}const Py=$("ZodCatch",(e,t)=>{Tv.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Iy(e,t){return new Py({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const Ry=$("ZodPipe",(e,t)=>{Av.init(e,t),ge.init(e,t),e.in=t.in,e.out=t.out});function za(e,t){return new Ry({type:"pipe",in:e,out:t})}const Oy=$("ZodReadonly",(e,t)=>{$v.init(e,t),ge.init(e,t)});function Ty(e){return new Oy({type:"readonly",innerType:e})}const Ay=$("ZodLazy",(e,t)=>{Nv.init(e,t),ge.init(e,t),e.unwrap=()=>e._zod.def.getter()});function $y(e){return new Ay({type:"lazy",getter:e})}const pi=$("ZodCustom",(e,t)=>{Dv.init(e,t),ge.init(e,t)});function Ny(e){const t=new Ze({check:"custom"});return t._zod.check=e,t}function Pl(e,t){return Cg(pi,e??(()=>!0),t)}function Dy(e,t={}){return Pg(pi,e,t)}function My(e){const t=Ny(n=>(n.addIssue=r=>{if(typeof r=="string")n.issues.push(rr(r,n.value,t._zod.def));else{const o=r;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=t),o.continue??(o.continue=!t._zod.def.abort),n.issues.push(rr(o))}},e(n.value,n)));return t}function Xt(e,t={error:`Input not instance of ${e.name}`}){const n=new pi({type:"custom",check:"custom",fn:r=>r instanceof e,abort:!0,...K(t)});return n._zod.bag.Class=e,n}var X;(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"})(X||(X={}));class No extends Error{constructor(t,n){super(t),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}const Fa=10,ky=13,Ht=32;function Do(e){}function jy(e){if(typeof e=="function")throw new TypeError("`config` must be an object, got a function instead. Did 
vendor: 34,346 bytes, lines 30-43
30you mean `createParser({onEvent: fn})`?");const{onEvent:t=Do,onError:n=Do,onRetry:r=Do,onComment:o,maxBufferSize:s}=e,i=[];let a=0,d=!0,u,f="",c=0,m,h=!1;function p(_){if(h)throw new Error("Cannot feed parser: it was terminated after exceeding the configured max buffer size. Call `reset()` to resume parsing.");if(d&&(d=!1,_.charCodeAt(0)===239&&_.charCodeAt(1)===187&&_.charCodeAt(2)===191&&(_=_.slice(3))),i.length===0){const T=v(_);T!==""&&(i.push(T),a=T.length),g();return}if(_.indexOf(`
31`)===-1&&_.indexOf("\r")===-1){i.push(_),a+=_.length,g();return}i.push(_);const y=i.join("");i.length=0,a=0;const P=v(y);P!==""&&(i.push(P),a=P.length),g()}function g(){s!==void 0&&(a+f.length<=s||(h=!0,i.length=0,a=0,u=void 0,f="",c=0,m=void 0,n(new No(`Buffered data exceeded max buffer size of ${s} characters`,{type:"max-buffer-size-exceeded"}))))}function v(_){let y=0;if(_.indexOf("\r")===-1){let P=_.indexOf(`
32`,y);for(;P!==-1;){if(y===P){c>0&&t({id:u,event:m,data:f}),u=void 0,f="",c=0,m=void 0,y=P+1,P=_.indexOf(`
33`,y);continue}const T=_.charCodeAt(y);if(Za(_,y,T)){const R=_.charCodeAt(y+5)===Ht?y+6:y+5,N=_.slice(R,P);if(c===0&&_.charCodeAt(P+1)===Fa){t({id:u,event:m,data:N}),u=void 0,f="",m=void 0,y=P+2,P=_.indexOf(`
34`,y);continue}f=c===0?N:`${f}
35${N}`,c++}else Ua(_,y,T)?m=_.slice(_.charCodeAt(y+6)===Ht?y+7:y+6,P)||void 0:S(_,y,P);y=P+1,P=_.indexOf(`
36`,y)}return _.slice(y)}for(;y<_.length;){const P=_.indexOf("\r",y),T=_.indexOf(`
37`,y);let R=-1;if(P!==-1&&T!==-1?R=P<T?P:T:P!==-1?P===_.length-1?R=-1:R=P:T!==-1&&(R=T),R===-1)break;S(_,y,R),y=R+1,_.charCodeAt(y-1)===ky&&_.charCodeAt(y)===Fa&&y++}return _.slice(y)}function S(_,y,P){if(y===P){b();return}const T=_.charCodeAt(y);if(Za(_,y,T)){const A=_.charCodeAt(y+5)===Ht?y+6:y+5,U=_.slice(A,P);f=c===0?U:`${f}
38${U}`,c++;return}if(Ua(_,y,T)){m=_.slice(_.charCodeAt(y+6)===Ht?y+7:y+6,P)||void 0;return}if(T===105&&_.charCodeAt(y+1)===100&&_.charCodeAt(y+2)===58){const A=_.slice(_.charCodeAt(y+3)===Ht?y+4:y+3,P);u=A.includes("\0")?void 0:A;return}if(T===58){if(o){const A=_.slice(y,P);o(A.slice(_.charCodeAt(y+1)===Ht?2:1))}return}const R=_.slice(y,P),N=R.indexOf(":");if(N===-1){x(R,"",R);return}const D=R.slice(0,N),C=R.charCodeAt(N+1)===Ht?2:1,O=R.slice(N+C);x(D,O,R)}function x(_,y,P){switch(_){case"event":m=y||void 0;break;case"data":f=c===0?y:`${f}
39${y}`,c++;break;case"id":u=y.includes("\0")?void 0:y;break;case"retry":/^\d+$/.test(y)?r(parseInt(y,10)):n(new No(`Invalid \`retry\` value: "${y}"`,{type:"invalid-retry",value:y,line:P}));break;default:n(new No(`Unknown field "${_.length>20?`${_.slice(0,20)}…`:_}"`,{type:"unknown-field",field:_,value:y,line:P}));break}}function b(){c>0&&t({id:u,event:m,data:f}),u=void 0,f="",c=0,m=void 0}function E(_={}){if(_.consume&&i.length>0){const y=i.join("");S(y,0,y.length)}d=!0,u=void 0,f="",c=0,m=void 0,i.length=0,a=0,h=!1}return{feed:p,reset:E}}function Za(e,t,n){return n===100&&e.charCodeAt(t+1)===97&&e.charCodeAt(t+2)===116&&e.charCodeAt(t+3)===97&&e.charCodeAt(t+4)===58}function Ua(e,t,n){return n===101&&e.charCodeAt(t+1)===118&&e.charCodeAt(t+2)===101&&e.charCodeAt(t+3)===110&&e.charCodeAt(t+4)===116&&e.charCodeAt(t+5)===58}class Ly extends TransformStream{constructor({onError:t,onRetry:n,onComment:r,maxBufferSize:o}={}){let s;super({start(i){s=jy({onEvent:a=>{i.enqueue(a)},onError(a){typeof t=="function"&&t(a),(t==="terminate"||a.type==="max-buffer-size-exceeded")&&i.error(a)},onRetry:n,onComment:r,maxBufferSize:o})},transform(i){s.feed(i)}})}}new TextDecoder;var zy=globalThis.fetch;Fy(zy);function Fy(e){const t=Function.prototype.toString.call(e);return t.includes("internal/deps/undici")||t.includes("lazy loading of undici")}var Qe=({prefix:e,size:t=16,alphabet:n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:r="-"}={})=>{const o=()=>{const s=n.length,i=new Array(t);for(let a=0;a<t;a++)i[a]=n[Math.random()*s|0];return i.join("")};if(e==null)return o;if(n.includes(r))throw new $m({argument:"separator",message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${o()}`},Zy=Qe();function mn(e){if(e==null)return{};const t={};if(e instanceof Headers)e.forEach((n,r)=>{t[r.toLowerCase()]=n});else{Array.isArray(e)||(e=Object.entries(e));for(const[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}function Uy(e){var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null?n:!1}var By=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Wy=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function Ba(e){const t=JSON.parse(e);return t===null||typeof t!="object"||By.test(e)===!1&&Wy.test(e)===!1?t:Vy(t)}function Vy(e){let t=[e];for(;t.length;){const n=t;t=[];for(const r of n){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&r.constructor!==null&&typeof r.constructor=="object"&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const o in r){const s=r[o];s&&typeof s=="object"&&t.push(s)}}}return e}function Hy(e){const{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Ba(e)}try{return Ba(e)}finally{Error.stackTraceLimit=t}}function mi(e){if(e.type==="object"||Array.isArray(e.type)&&e.type.includes("object")){e.additionalProperties=!1;const{properties:n}=e;if(n!=null)for(const r of Object.keys(n))n[r]=Gt(n[r])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(Gt):Gt(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(Gt)),e.allOf!=null&&(e.allOf=e.allOf.map(Gt)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(Gt));const{definitions:t}=e;if(t!=null)for(const n of Object.keys(t))t[n]=Gt(t[n]);return e}function Gt(e){return typeof e=="boolean"?e:mi(e)}var Gy=Symbol("Let zodToJsonSchema decide on which parser to use"),Wa={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"},Ky=e=>typeof e=="string"?{...Wa,name:e}:{...Wa,...e};function Ge(){return{}}function qy(e,t){var n,r,o;const s={type:"array"};return(n=e.type)!=null&&n._def&&((o=(r=e.type)==null?void 0:r._def)==null?void 0:o.typeName)!==X.ZodAny&&(s.items=le(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}function Jy(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function Yy(){return{type:"boolean"}}function Il(e,t){return le(e.type._def,t)}var Xy=(e,t)=>le(e.innerType._def,t);function Rl(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(o=>Rl(e,t,o))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return Qy(e)}}var Qy=e=>{const t={type:"integer",format:"unix-time"};for(const n of e.checks)switch(n.kind){case"min":t.minimum=n.value;break;case"max":t.maximum=n.value;break}return t};function eb(e,t){return{...le(e.innerType._def,t),default:e.defaultValue()}}function tb(e,t){return t.effectStrategy==="input"?le(e.schema._def,t):Ge()}function nb(e){return{type:"string",enum:Array.from(e.values)}}var rb=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function ob(e,t){const n=[le(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),le(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(o=>!!o),r=[];return n.forEach(o=>{if(rb(o))r.push(...o.allOf);else{let s=o;if("additionalProperties"in o&&o.additionalProperties===!1){const{additionalProperties:i,...a}=o;s=a}r.push(s)}}),r.length?{allOf:r}:void 0}function sb(e){const t=typeof e.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(e.value)?"array":"object"}:{type:t==="bigint"?"integer":t,const:e.value}}var Mo=void 0,et={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Mo===void 0&&(Mo=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Mo),uuid:/^[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}$/,ipv4:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([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})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function Ol(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value;break;case"max":n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"email":switch(t.emailStrategy){case"format:email":tt(n,"email",r.message,t);break;case"format:idn-email":tt(n,"idn-email",r.message,t);break;case"pattern:zod":Me(n,et.email,r.message,t);break}break;case"url":tt(n,"uri",r.message,t);break;case"uuid":tt(n,"uuid",r.message,t);break;case"regex":Me(n,r.regex,r.message,t);break;case"cuid":Me(n,et.cuid,r.message,t);break;case"cuid2":Me(n,et.cuid2,r.message,t);break;case"startsWith":Me(n,RegExp(`^${ko(r.value,t)}`),r.message,t);break;case"endsWith":Me(n,RegExp(`${ko(r.value,t)}$`),r.message,t);break;case"datetime":tt(n,"date-time",r.message,t);break;case"date":tt(n,"date",r.message,t);break;case"time":tt(n,"time",r.message,t);break;case"duration":tt(n,"duration",r.message,t);break;case"length":n.minLength=typeof n.minLength=="number"?Math.max(n.minLength,r.value):r.value,n.maxLength=typeof n.maxLength=="number"?Math.min(n.maxLength,r.value):r.value;break;case"includes":{Me(n,RegExp(ko(r.value,t)),r.message,t);break}case"ip":{r.version!=="v6"&&tt(n,"ipv4",r.message,t),r.version!=="v4"&&tt(n,"ipv6",r.message,t);break}case"base64url":Me(n,et.base64url,r.message,t);break;case"jwt":Me(n,et.jwt,r.message,t);break;case"cidr":{r.version!=="v6"&&Me(n,et.ipv4Cidr,r.message,t),r.version!=="v4"&&Me(n,et.ipv6Cidr,r.message,t);break}case"emoji":Me(n,et.emoji(),r.message,t);break;case"ulid":{Me(n,et.ulid,r.message,t);break}case"base64":{switch(t.base64Strategy){case"format:binary":{tt(n,"binary",r.message,t);break}case"contentEncoding:base64":{n.contentEncoding="base64";break}case"pattern:zod":{Me(n,et.base64,r.message,t);break}}break}case"nanoid":Me(n,et.nanoid,r.message,t)}return n}function ko(e,t){return t.patternStrategy==="escape"?ab(e):e}var ib=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function ab(e){let t="";for(let n=0;n<e.length;n++)ib.has(e[n])||(t+="\\"),t+=e[n];return t}function tt(e,t,n,r){var o;e.format||(o=e.anyOf)!=null&&o.some(s=>s.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):e.format=t}function Me(e,t,n,r){var o;e.pattern||(o=e.allOf)!=null&&o.some(s=>s.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Va(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Va(t,r)}function Va(e,t){var n;if(!t.applyRegexFlags||!e.flags)return e.source;const r={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},o=r.i?e.source.toLowerCase():e.source;let s="",i=!1,a=!1,d=!1;for(let u=0;u<o.length;u++){if(i){s+=o[u],i=!1;continue}if(r.i){if(a){if(o[u].match(/[a-z]/)){d?(s+=o[u],s+=`${o[u-2]}-${o[u]}`.toUpperCase(),d=!1):o[u+1]==="-"&&((n=o[u+2])!=null&&n.match(/[a-z]/))?(s+=o[u],d=!0):s+=`${o[u]}${o[u].toUpperCase()}`;continue}}else if(o[u].match(/[a-z]/)){s+=`[${o[u]}${o[u].toUpperCase()}]`;continue}}if(r.m){if(o[u]==="^"){s+=`(^|(?<=[\r
40]))`;continue}else if(o[u]==="$"){s+=`($|(?=[\r
41]))`;continue}}if(r.s&&o[u]==="."){s+=a?`${o[u]}\r
42`:`[${o[u]}\r
43]`;continue}s+=o[u],o[u]==="\\"?i=!0:a&&o[u]==="]"?a=!1:!a&&o[u]==="["&&(a=!0)}try{new RegExp(s)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return s}function Tl(e,t){var n,r,o,s,i,a;const d={type:"object",additionalProperties:(n=le(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===X.ZodString&&((o=e.keyType._def.checks)!=null&&o.length)){const{type:u,...f}=Ol(e.keyType._def,t);return{...d,propertyNames:f}}else{if(((s=e.keyType)==null?void 0:s._def.typeName)===X.ZodEnum)return{...d,propertyNames:{enum:e.keyType._def.values}};if(((i=e.keyType)==null?void 0:i._def.typeName)===X.ZodBranded&&e.keyType._def.type._def.typeName===X.ZodString&&((a=e.keyType._def.type._def.checks)!=null&&a.length)){const{type:u,...f}=Il(e.keyType._def,t);return{...d,propertyNames:f}}}return d}function cb(e,t){if(t.mapStrategy==="record")return Tl(e,t);const n=le(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Ge(),r=le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Ge();return{type:"array",maxItems:125,items:{type:"array",items:[n,r],minItems:2,maxItems:2}}}function lb(e){const t=e.values,r=Object.keys(e.values).filter(s=>typeof t[t[s]]!="number").map(s=>t[s]),o=Array.from(new Set(r.map(s=>typeof s)));return{type:o.length===1?o[0]==="string"?"string":"number":["string","number"],enum:r}}function ub(){return{not:Ge()}}function db(){return{type:"null"}}var os={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function fb(e,t){const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(r=>r._def.typeName in os&&(!r._def.checks||!r._def.checks.length))){const r=n.reduce((o,s)=>{const i=os[s._def.typeName];return i&&!o.includes(i)?[...o,i]:o},[]);return{type:r.length>1?r:r[0]}}else if(n.every(r=>r._def.typeName==="ZodLiteral"&&!r.description)){const r=n.reduce((o,s)=>{const i=typeof s._def.value;switch(i){case"string":case"number":case"boolean":return[...o,i];case"bigint":return[...o,"integer"];case"object":if(s._def.value===null)return[...o,"null"];default:return o}},[]);if(r.length===n.length){const o=r.filter((s,i,a)=>a.indexOf(s)===i);return{type:o.length>1?o:o[0],enum:n.reduce((s,i)=>s.includes(i._def.value)?s:[...s,i._def.value],[])}}}else if(n.every(r=>r._def.typeName==="ZodEnum"))return{type:"string",enum:n.reduce((r,o)=>[...r,...o._def.values.filter(s=>!r.includes(s))],[])};return pb(e,t)}var pb=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((r,o)=>le(r._def,{...t,currentPath:[...t.currentPath,"anyOf",`${o}`]})).filter(r=>!!r&&(!t.strictUnions||typeof r=="object"&&Object.keys(r).length>0));return n.length?{anyOf:n}:void 0};function mb(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[os[e.innerType._def.typeName],"null"]};const n=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}function hb(e){const t={type:"number"};if(!e.checks)return t;for(const n of e.checks)switch(n.kind){case"int":t.type="integer";break;case"min":n.inclusive?t.minimum=n.value:t.exclusiveMinimum=n.value;break;case"max":n.inclusive?t.maximum=n.value:t.exclusiveMaximum=n.value;break;case"multipleOf":t.multipleOf=n.value;break}return t}function vb(e,t){const n={type:"object",properties:{}},r=[],o=e.shape();for(const i in o){let a=o[i];if(a===void 0||a._def===void 0)continue;const d=yb(a),u=le(a._def,{...t,currentPath:[...t.currentPath,"properties",i],propertyPath:[...t.currentPath,"properties",i]});u!==void 0&&(n.properties[i]=u,d||r.push(i))}r.length&&(n.required=r);const s=gb(e,t);return s!==void 0&&(n.additionalProperties=s),n}function gb(e,t){if(e.catchall._def.typeName!=="ZodNever")return le(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return t.removeAdditionalStrategy==="strict"?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}function yb(e){try{return e.isOptional()}catch{return!0}}var bb=(e,t)=>{var n;if(t.currentPath.toString()===((n=t.propertyPath)==null?void 0:n.toString()))return le(e.innerType._def,t);const r=le(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return r?{anyOf:[{not:Ge()},r]}:Ge()},wb=(e,t)=>{if(t.pipeStrategy==="input")return le(e.in._def,t);if(t.pipeStrategy==="output")return le(e.out._def,t);const n=le(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),r=le(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]});return{allOf:[n,r].filter(o=>o!==void 0)}};function xb(e,t){return le(e.type._def,t)}function Sb(e,t){const r={type:"array",uniqueItems:!0,items:le(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}function Eb(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((n,r)=>le(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[]),additionalItems:le(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((n,r)=>le(n._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((n,r)=>r===void 0?n:[...n,r],[])}}function _b(){return{not:Ge()}}function Cb(){return Ge()}var Pb=(e,t)=>le(e.innerType._def,t),Ib=(e,t,n)=>{switch(t){case X.ZodString:return Ol(e,n);case X.ZodNumber:return hb(e);case X.ZodObject:return vb(e,n);case X.ZodBigInt:return Jy(e);case X.ZodBoolean:return Yy();case X.ZodDate:return Rl(e,n);case X.ZodUndefined:return _b();case X.ZodNull:return db();case X.ZodArray:return qy(e,n);case X.ZodUnion:case X.ZodDiscriminatedUnion:return fb(e,n);case X.ZodIntersection:return ob(e,n);case X.ZodTuple:return Eb(e,n);case X.ZodRecord:return Tl(e,n);case X.ZodLiteral:return sb(e);case X.ZodEnum:return nb(e);case X.ZodNativeEnum:return lb(e);case X.ZodNullable:return mb(e,n);case X.ZodOptional:return bb(e,n);case X.ZodMap:return cb(e,n);case X.ZodSet:return Sb(e,n);case X.ZodLazy:return()=>e.getter()._def;case X.ZodPromise:return xb(e,n);case X.ZodNaN:case X.ZodNever:return ub();case X.ZodEffects:return tb(e,n);case X.ZodAny:return Ge();case X.ZodUnknown:return Cb();case X.ZodDefault:return eb(e,n);case X.ZodBranded:return Il(e,n);case X.ZodReadonly:return Pb(e,n);case X.ZodCatch:return Xy(e,n);case X.ZodPipeline:return wb(e,n);case X.ZodFunction:case X.ZodVoid:case X.ZodSymbol:return;default:return(r=>{})()}},Rb=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function le(e,t,n=!1){var r;const o=t.seen.get(e);if(t.override){const d=(r=t.override)==null?void 0:r.call(t,e,t,o,n);if(d!==Gy)return d}if(o&&!n){const d=Ob(o,t);if(d!==void 0)return d}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const i=Ib(e,e.typeName,t),a=typeof i=="function"?le(i(),t):i;if(a&&Tb(e,t,a),t.postProcess){const d=t.postProcess(a,e,t);return s.jsonSchema=a,d}return s.jsonSchema=a,a}var Ob=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Rb(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((n,r)=>t.currentPath[r]===n)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Ge()):t.$refStrategy==="seen"?Ge():void 0}},Tb=(e,t,n)=>(e.description&&(n.description=e.description),n),Ab=e=>{const t=Ky(e),n=t.name!==void 0?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([r,o])=>[o._def,{def:o._def,path:[...t.basePath,t.definitionPath,r],jsonSchema:void 0}]))}},$b=(e,t)=>{var n;const r=Ab(t);let o=typeof t=="object"&&t.definitions?Object.entries(t.definitions).reduce((u,[f,c])=>{var m;return{...u,[f]:(m=le(c._def,{...r,currentPath:[...r.basePath,r.definitionPath,f]},!0))!=null?m:Ge()}},{}):void 0;const s=typeof t=="string"?t:t?.nameStrategy==="title"?void 0:t?.name,i=(n=le(e._def,s===void 0?r:{...r,currentPath:[...r.basePath,r.definitionPath,s]},!1))!=null?n:Ge(),a=typeof t=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;a!==void 0&&(i.title=a);const d=s===void 0?o?{...i,[r.definitionPath]:o}:i:{$ref:[...r.$refStrategy==="relative"?[]:r.basePath,r.definitionPath,s].join("/"),[r.definitionPath]:{...o,[s]:i}};return d.$schema="http://json-schema.org/draft-07/schema#",d},ss=Symbol.for("vercel.ai.schema");function Nb(e){let t;return()=>(t==null&&(t=e()),t)}function Qr(e,{validate:t}={}){return{[ss]:!0,_type:void 0,get jsonSchema(){return typeof e=="function"&&(e=e()),e},validate:t}}function Db(e){return typeof e=="object"&&e!==null&&ss in e&&e[ss]===!0&&"jsonSchema"in e&&"validate"in e}function hi(e){return e==null?Qr({type:"object",properties:{},additionalProperties:!1}):Db(e)?e:"~standard"in e?e["~standard"].vendor==="zod"?Al(e):Mb(e):e()}function Mb(e){return Qr(()=>{if(!kb(e))throw new Error(`Standard schema vendor '${e["~standard"].vendor}' does not support JSON Schema conversion.`);return mi(e["~standard"].jsonSchema.input({target:"draft-07"}))},{validate:async t=>{const n=await e["~standard"].validate(t);return"value"in n?{success:!0,value:n.value}:{success:!1,error:new $n({value:t,cause:n.issues})}}})}function kb(e){return e["~standard"].jsonSchema!=null}function jb(e,t){var n;const r=(n=void 0)!=null?n:!1;return Qr(()=>$b(e,{$refStrategy:r?"root":"none"}),{validate:async o=>{const s=await e.safeParseAsync(o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function Lb(e,t){var n;const r=(n=void 0)!=null?n:!1;return Qr(()=>mi(Ig(e,{target:"draft-7",io:"input",reused:r?"ref":"inline"})),{validate:async o=>{const s=await yl(e,o);return s.success?{success:!0,value:s.data}:{success:!1,error:s.error}}})}function zb(e){return"_zod"in e}function Al(e,t){return zb(e)?Lb(e):jb(e)}async function Ha({value:e,schema:t,context:n}){const r=await or({value:e,schema:t,context:n});if(!r.success)throw $n.wrap({value:e,cause:r.error,context:n});return r.value}async function or({value:e,schema:t,context:n}){const r=hi(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};const o=await r.validate(e);return o.success?{success:!0,value:o.value,rawValue:e}:{success:!1,error:$n.wrap({value:e,cause:o.error,context:n}),rawValue:e}}catch(o){return{success:!1,error:$n.wrap({value:e,cause:o,context:n}),rawValue:e}}}async function Qt({text:e,schema:t}){try{const n=Hy(e);return t==null?{success:!0,value:n,rawValue:n}:await or({value:n,schema:t})}catch(n){return{success:!1,error:ga.isInstance(n)?n:new ga({text:e,cause:n}),rawValue:void 0}}}function Fb({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ly).pipeThrough(new TransformStream({async transform({data:n},r){n!=="[DONE]"&&r.enqueue(await Qt({text:n,schema:t}))}}))}async function Dt(e){return typeof e=="function"&&(e=e()),Promise.resolve(e)}new TextDecoder;var Zb=Object.defineProperty,Ub=(e,t)=>{for(var n in t)Zb(e,n,{get:t[n],enumerable:!0})},$l="AI_NoObjectGeneratedError",Nl=`vercel.ai.error.${$l}`,Bb=Symbol.for(Nl),Dl,Mt=class extends bt{constructor({message:e="No object generated.",cause:t,text:n,response:r,usage:o,finishReason:s}){super({name:$l,message:e,cause:t}),this[Dl]=!0,this.text=n,this.response=r,this.usage=o,this.finishReason=s}static isInstance(e){return bt.hasMarker(e,Nl)}};Dl=Bb;var Ml="AI_UIMessageStreamError",kl=`vercel.ai.error.${Ml}`,Wb=Symbol.for(kl),jl,Kt=class extends bt{constructor({chunkType:e,chunkId:t,message:n}){super({name:Ml,message:n}),this[jl]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return bt.hasMarker(e,kl)}};jl=Wb;function Ll(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;const n={...e};for(const r in t)if(!(r==="__proto__"||r==="constructor"||r==="prototype")&&Object.prototype.hasOwnProperty.call(t,r)){const o=t[r];if(o===void 0)continue;const s=r in e?e[r]:void 0,i=o!==null&&typeof o=="object"&&!Array.isArray(o)&&!(o instanceof Date)&&!(o instanceof RegExp),a=s!=null&&typeof s=="object"&&!Array.isArray(s)&&!(s instanceof Date)&&!(s instanceof RegExp);i&&a?n[r]=Ll(s,o):n[r]=o}return n}var en=$y(()=>Ne([cy(),M(),oy(),_e(),ot(M(),en.optional()),jn(en)])),Y=ot(M(),ot(M(),en.optional())),dr=Ne([M(),Xt(Uint8Array),Xt(ArrayBuffer),Pl(Uy,{message:"Must be a Buffer"})]),vi=ot(M(),M()),zl=te({type:W("text"),text:M(),providerOptions:Y.optional()}),Vb=te({type:W("image"),image:Ne([dr,Xt(URL),vi]),mediaType:M().optional(),providerOptions:Y.optional()}),Fl=fi("type",[te({type:W("data"),data:dr}),te({type:W("url"),url:Xt(URL)}),te({type:W("reference"),reference:vi}),te({type:W("text"),text:M()})]),Hb=fi("type",[te({type:W("data"),data:dr}),te({type:W("url"),url:Xt(URL)})]),Zl=te({type:W("file"),data:Ne([Fl,dr,Xt(URL),vi]),filename:M().optional(),mediaType:M(),providerOptions:Y.optional()}),Gb=te({type:W("reasoning"),text:M(),providerOptions:Y.optional()}),Kb=te({type:W("custom"),kind:M().transform(e=>e),providerOptions:Y.optional()}),qb=te({type:W("reasoning-file"),data:Ne([Hb,dr,Xt(URL)]),mediaType:M(),providerOptions:Y.optional()}),Jb=te({type:W("tool-call"),toolCallId:M(),toolName:M(),input:rt(),providerOptions:Y.optional(),providerExecuted:_e().optional()}),Yb=fi("type",[te({type:W("text"),value:M(),providerOptions:Y.optional()}),te({type:W("json"),value:en,providerOptions:Y.optional()}),te({type:W("execution-denied"),reason:M().optional(),providerOptions:Y.optional()}),te({type:W("error-text"),value:M(),providerOptions:Y.optional()}),te({type:W("error-json"),value:en,providerOptions:Y.optional()}),te({type:W("content"),value:jn(Ne([te({type:W("text"),text:M(),providerOptions:Y.optional()}),te({type:W("file"),data:Fl,mediaType:M(),filename:M().optional(),providerOptions:Y.optional()}),te({type:W("file-data"),data:M(),mediaType:M(),filename:M().optional(),providerOptions:Y.optional()}),te({type:W("file-url"),url:M(),mediaType:M().optional(),providerOptions:Y.optional()}),te({type:W("file-id"),fileId:Ne([M(),ot(M(),M())]),providerOptions:Y.optional()}),te({type:W("file-reference"),providerReference:ot(M(),M()),providerOptions:Y.optional()}),te({type:W("image-data"),data:M(),mediaType:M(),providerOptions:Y.optional()}),te({type:W("image-url"),url:M(),providerOptions:Y.optional()}),te({type:W("image-file-id"),fileId:Ne([M(),ot(M(),M())]),providerOptions:Y.optional()}),te({type:W("image-file-reference"),providerReference:ot(M(),M()),providerOptions:Y.optional()}),te({type:W("custom"),providerOptions:Y.optional()})]))})]),Ul=te({type:W("tool-result"),toolCallId:M(),toolName:M(),output:Yb,providerOptions:Y.optional()}),Xb=te({type:W("tool-approval-request"),approvalId:M(),toolCallId:M()}),Qb=te({type:W("tool-approval-response"),approvalId:M(),approved:_e(),reason:M().optional()}),ew=te({role:W("system"),content:M(),providerOptions:Y.optional()}),tw=te({role:W("user"),content:Ne([M(),jn(Ne([zl,Vb,Zl]))]),providerOptions:Y.optional()}),nw=te({role:W("assistant"),content:Ne([M(),jn(Ne([zl,Kb,Zl,Gb,qb,Jb,Ul,Xb]))]),providerOptions:Y.optional()}),rw=te({role:W("tool"),content:jn(Ne([Ul,Qb])),providerOptions:Y.optional()});Ne([ew,tw,nw,rw]);var ow={};Ub(ow,{array:()=>cw,choice:()=>lw,json:()=>uw,object:()=>aw,text:()=>iw});function sw(e){const t=["ROOT"];let n=-1,r=null,o=0;function s(f){return f>="0"&&f<="9"||f>="A"&&f<="F"||f>="a"&&f<="f"}function i(f,c,m){switch(f){case'"':{n=c,t.pop(),t.push(m),t.push("INSIDE_STRING");break}case"f":case"t":case"n":{n=c,r=c,t.pop(),t.push(m),t.push("INSIDE_LITERAL");break}case"-":{t.pop(),t.push(m),t.push("INSIDE_NUMBER");break}case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=c,t.pop(),t.push(m),t.push("INSIDE_NUMBER");break}case"{":{n=c,t.pop(),t.push(m),t.push("INSIDE_OBJECT_START");break}case"[":{n=c,t.pop(),t.push(m),t.push("INSIDE_ARRAY_START");break}}}function a(f,c){switch(f){case",":{t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break}case"}":{n=c,t.pop();break}}}function d(f,c){switch(f){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=c,t.pop();break}}}for(let f=0;f<e.length;f++){const c=e[f];switch(t[t.length-1]){case"ROOT":i(c,f,"FINISH");break;case"INSIDE_OBJECT_START":{switch(c){case'"':{t.pop(),t.push("INSIDE_OBJECT_KEY");break}case"}":{n=f,t.pop();break}}break}case"INSIDE_OBJECT_AFTER_COMMA":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break}case"INSIDE_OBJECT_KEY":{c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break}case"INSIDE_OBJECT_AFTER_KEY":{c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break}case"INSIDE_OBJECT_BEFORE_VALUE":{i(c,f,"INSIDE_OBJECT_AFTER_VALUE");break}case"INSIDE_OBJECT_AFTER_VALUE":{a(c,f);break}case"INSIDE_STRING":{switch(c){case'"':{t.pop(),n=f;break}case"\\":{t.push("INSIDE_STRING_ESCAPE");break}default:n=f}break}case"INSIDE_ARRAY_START":{c==="]"?(n=f,t.pop()):(n=f,i(c,f,"INSIDE_ARRAY_AFTER_VALUE"));break}case"INSIDE_ARRAY_AFTER_VALUE":{switch(c){case",":{t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break}case"]":{n=f,t.pop();break}default:{n=f;break}}break}case"INSIDE_ARRAY_AFTER_COMMA":{i(c,f,"INSIDE_ARRAY_AFTER_VALUE");break}case"INSIDE_STRING_ESCAPE":{t.pop(),c==="u"?(o=0,t.push("INSIDE_STRING_UNICODE_ESCAPE")):n=f;break}case"INSIDE_STRING_UNICODE_ESCAPE":{s(c)&&(o++,o===4&&(t.pop(),n=f));break}case"INSIDE_NUMBER":{switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":{n=f;break}case"e":case"E":case"-":case".":break;case",":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&d(c,f),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,f);break}case"}":{t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,f);break}case"]":{t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&d(c,f);break}default:{t.pop();break}}break}case"INSIDE_LITERAL":{const h=e.substring(r,f+1);!"false".startsWith(h)&&!"true".startsWith(h)&&!"null".startsWith(h)?(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(c,f):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&d(c,f)):n=f;break}}}let u=e.slice(0,n+1);for(let f=t.length-1;f>=0;f--)switch(t[f]){case"INSIDE_STRING":{u+='"';break}case"INSIDE_OBJECT_KEY":case"INSIDE_OBJECT_AFTER_KEY":case"INSIDE_OBJECT_AFTER_COMMA":case"INSIDE_OBJECT_START":case"INSIDE_OBJECT_BEFORE_VALUE":case"INSIDE_OBJECT_AFTER_VALUE":{u+="}";break}case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":{u+="]";break}case"INSIDE_LITERAL":{const m=e.substring(r,e.length);"true".startsWith(m)?u+="true".slice(m.length):"false".startsWith(m)?u+="false".slice(m.length):"null".startsWith(m)&&(u+="null".slice(m.length))}}return u}async function fr(e){if(e===void 0)return{value:void 0,state:"undefined-input"};let t=await Qt({text:e});return t.success?{value:t.value,state:"successful-parse"}:(t=await Qt({text:sw(e)}),t.success?{value:t.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"})}var iw=()=>({name:"text",responseFormat:Promise.resolve({type:"text"}),async parseCompleteOutput({text:e}){return e},async parsePartialOutput({text:e}){return{partial:e}},createElementStreamTransform(){}}),aw=({schema:e,name:t,description:n})=>{const r=hi(e);return{name:"object",responseFormat:Dt(r.jsonSchema).then(o=>({type:"json",schema:o,...t!=null&&{name:t},...n!=null&&{description:n}})),async parseCompleteOutput({text:o},s){const i=await Qt({text:o});if(!i.success)throw new Mt({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=await or({value:i.value,schema:r});if(!a.success)throw new Mt({message:"No object generated: response did not match sc
43hema.",cause:a.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});return a.value},async parsePartialOutput({text:o}){const s=await fr(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return{partial:s.value}}},createElementStreamTransform(){}}},cw=({element:e,name:t,description:n})=>{const r=hi(e);return{name:"array",responseFormat:Dt(r.jsonSchema).then(o=>{const{$schema:s,...i}=o;return{type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{elements:{type:"array",items:i}},required:["elements"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}}),async parseCompleteOutput({text:o},s){const i=await Qt({text:o});if(!i.success)throw new Mt({message:"No object generated: could not parse the response.",cause:i.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const a=i.value;if(a==null||typeof a!="object"||!("elements"in a)||!Array.isArray(a.elements))throw new Mt({message:"No object generated: response did not match schema.",cause:new $n({value:a,cause:"response must be an object with an elements array"}),text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});const d=[];for(const u of a.elements){const f=await or({value:u,schema:r});if(!f.success)throw new Mt({message:"No object generated: response did not match schema.",cause:f.error,text:o,response:s.response,usage:s.usage,finishReason:s.finishReason});d.push(f.value)}return d},async parsePartialOutput({text:o}){const s=await fr(o);switch(s.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const i=s.value;if(i==null||typeof i!="object"||!("elements"in i)||!Array.isArray(i.elements))return;const a=s.state==="repaired-parse"&&i.elements.length>0?i.elements.slice(0,-1):i.elements,d=[];for(const u of a){const f=await or({value:u,schema:r});f.success&&d.push(f.value)}return{partial:d}}}},createElementStreamTransform(){let o=0;return new TransformStream({transform({partialOutput:s},i){if(s!=null)for(;o<s.length;o++)i.enqueue(s[o])}})}}},lw=({options:e,name:t,description:n})=>({name:"choice",responseFormat:Promise.resolve({type:"json",schema:{$schema:"http://json-schema.org/draft-07/schema#",type:"object",properties:{result:{type:"string",enum:e}},required:["result"],additionalProperties:!1},...t!=null&&{name:t},...n!=null&&{description:n}}),async parseCompleteOutput({text:r},o){const s=await Qt({text:r});if(!s.success)throw new Mt({message:"No object generated: could not parse the response.",cause:s.error,text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});const i=s.value;if(i==null||typeof i!="object"||!("result"in i)||typeof i.result!="string"||!e.includes(i.result))throw new Mt({message:"No object generated: response did not match schema.",cause:new $n({value:i,cause:"response must be an object that contains a choice value."}),text:r,response:o.response,usage:o.usage,finishReason:o.finishReason});return i.result},async parsePartialOutput({text:r}){const o=await fr(r);switch(o.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":{const s=o.value;if(s==null||typeof s!="object"||!("result"in s)||typeof s.result!="string")return;const i=e.filter(a=>a.startsWith(s.result));return o.state==="successful-parse"?i.includes(s.result)?{partial:s.result}:void 0:i.length===1?{partial:i[0]}:void 0}}},createElementStreamTransform(){}}),uw=({name:e,description:t}={})=>({name:"json",responseFormat:Promise.resolve({type:"json",...e!=null&&{name:e},...t!=null&&{description:t}}),async parseCompleteOutput({text:n},r){const o=await Qt({text:n});if(!o.success)throw new Mt({message:"No object generated: could not parse the response.",cause:o.error,text:n,response:r.response,usage:r.usage,finishReason:r.finishReason});return o.value},async parsePartialOutput({text:n}){const r=await fr(n);switch(r.state){case"failed-parse":case"undefined-input":return;case"repaired-parse":case"successful-parse":return r.value===void 0?void 0:{partial:r.value}}},createElementStreamTransform(){}});new TextEncoder;new TextEncoder;Qe({prefix:"aitxt",size:24});Qe({prefix:"call",size:24});(class extends TransformStream{constructor(){super({transform(e,t){t.enqueue(`data: ${JSON.stringify(e)}
44
45`)},flush(e){e.enqueue(`data: [DONE]
46
47`)}})}});var Gn=ot(M(),en.optional()),dw=Nb(()=>Al(Ne([ue({type:W("text-start"),id:M(),providerMetadata:Y.optional()}),ue({type:W("text-delta"),id:M(),delta:M(),providerMetadata:Y.optional()}),ue({type:W("text-end"),id:M(),providerMetadata:Y.optional()}),ue({type:W("error"),errorText:M()}),ue({type:W("tool-input-start"),toolCallId:M(),toolName:M(),providerExecuted:_e().optional(),providerMetadata:Y.optional(),toolMetadata:Gn.optional(),dynamic:_e().optional(),title:M().optional()}),ue({type:W("tool-input-delta"),toolCallId:M(),inputTextDelta:M()}),ue({type:W("tool-input-available"),toolCallId:M(),toolName:M(),input:rt(),providerExecuted:_e().optional(),providerMetadata:Y.optional(),toolMetadata:Gn.optional(),dynamic:_e().optional(),title:M().optional()}),ue({type:W("tool-input-error"),toolCallId:M(),toolName:M(),input:rt(),providerExecuted:_e().optional(),providerMetadata:Y.optional(),toolMetadata:Gn.optional(),dynamic:_e().optional(),errorText:M(),title:M().optional()}),ue({type:W("tool-approval-request"),approvalId:M(),toolCallId:M(),isAutomatic:_e().optional(),signature:M().optional()}),ue({type:W("tool-approval-response"),approvalId:M(),approved:_e(),reason:M().optional(),providerExecuted:_e().optional(),providerMetadata:Y.optional()}),ue({type:W("tool-output-available"),toolCallId:M(),output:rt(),providerExecuted:_e().optional(),providerMetadata:Y.optional(),toolMetadata:Gn.optional(),dynamic:_e().optional(),preliminary:_e().optional()}),ue({type:W("tool-output-error"),toolCallId:M(),errorText:M(),providerExecuted:_e().optional(),providerMetadata:Y.optional(),toolMetadata:Gn.optional(),dynamic:_e().optional()}),ue({type:W("tool-output-denied"),toolCallId:M()}),ue({type:W("reasoning-start"),id:M(),providerMetadata:Y.optional()}),ue({type:W("reasoning-delta"),id:M(),delta:M(),providerMetadata:Y.optional()}),ue({type:W("reasoning-end"),id:M(),providerMetadata:Y.optional()}),ue({type:W("custom"),kind:M().transform(e=>e),providerMetadata:Y.optional()}),ue({type:W("source-url"),sourceId:M(),url:M(),title:M().optional(),providerMetadata:Y.optional()}),ue({type:W("source-document"),sourceId:M(),mediaType:M(),title:M(),filename:M().optional(),providerMetadata:Y.optional()}),ue({type:W("file"),url:M(),mediaType:M(),providerMetadata:Y.optional()}),ue({type:W("reasoning-file"),url:M(),mediaType:M(),providerMetadata:Y.optional()}),ue({type:Pl(e=>typeof e=="string"&&e.startsWith("data-"),{message:'Type must start with "data-"'}),id:M().optional(),data:rt(),transient:_e().optional()}),ue({type:W("start-step")}),ue({type:W("finish-step")}),ue({type:W("start"),messageId:M().optional(),messageMetadata:rt().optional()}),ue({type:W("finish"),finishReason:El(["stop","length","content-filter","tool-calls","error","other"]).optional(),messageMetadata:rt().optional()}),ue({type:W("abort"),reason:M().optional()}),ue({type:W("message-metadata"),messageMetadata:rt()})])));function fw(e){return e.type.startsWith("data-")}function tr(){return Object.create(null)}function is(e){return e.type.startsWith("tool-")}function pw(e){return e.type==="dynamic-tool"}function Cn(e){return is(e)||pw(e)}function Ga(e){return e.type.split("-").slice(1).join("-")}function mw({lastMessage:e,messageId:t}){return{message:e?.role==="assistant"?e:{id:t,metadata:void 0,role:"assistant",parts:[]},activeTextParts:tr(),activeReasoningParts:tr(),partialToolCalls:tr()}}function hw({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:o,onToolCall:s,onData:i}){return e.pipeThrough(new TransformStream({async transform(a,d){await r(async({state:u,write:f})=>{var c,m,h,p;function g(){const y=u.message.parts;let P=y.length-1;for(;P>=0&&y[P].type!=="step-start";)P--;return y.slice(P+1)}function v(){return g().filter(Cn)}function S(y){let T=v().find(R=>R.toolCallId===y);if(T==null){const R=u.message.parts;for(let N=R.length-1;N>=0;N--){const D=R[N];if(Cn(D)&&D.toolCallId===y){T=D;break}}}if(T==null)throw new Kt({chunkType:"tool-invocation",chunkId:y,message:`No tool invocation found for tool call ID "${y}".`});return T}function x(y){const T=u.message.parts.filter(Cn).find(R=>{var N;return((N=R.approval)==null?void 0:N.id)===y});if(T==null)throw new Kt({chunkType:"tool-approval-response",chunkId:y,message:`No tool invocation found for approval ID "${y}".`});return T}function b(y,P){var T;const R=P??g().find(C=>is(C)&&C.toolCallId===y.toolCallId),N=y,D=R;if(R!=null){R.state=y.state,D.input=N.input,D.output=N.output,D.errorText=N.errorText,D.rawInput=N.rawInput,D.preliminary=N.preliminary,y.title!==void 0&&(D.title=y.title),y.toolMetadata!==void 0&&(D.toolMetadata=y.toolMetadata),D.providerExecuted=(T=N.providerExecuted)!=null?T:R.providerExecuted;const C=N.providerMetadata;if(C!=null)if(y.state==="output-available"||y.state==="output-error"){const O=R;O.resultProviderMetadata=C}else R.callProviderMetadata=C}else u.message.parts.push({type:`tool-${y.toolName}`,toolCallId:y.toolCallId,state:y.state,title:y.title,...y.toolMetadata!==void 0?{toolMetadata:y.toolMetadata}:{},input:N.input,output:N.output,rawInput:N.rawInput,errorText:N.errorText,providerExecuted:N.providerExecuted,preliminary:N.preliminary,...N.providerMetadata!=null&&(y.state==="output-available"||y.state==="output-error")?{resultProviderMetadata:N.providerMetadata}:{}
47,...N.providerMetadata!=null&&!(y.state==="output-available"||y.state==="output-error")?{callProviderMetadata:N.providerMetadata}:{}})}function E(y,P){var T,R;const N=P??g().find(O=>O.type==="dynamic-tool"&&O.toolCallId===y.toolCallId),D=y,C=N;if(N!=null){N.state=y.state,C.toolName=y.toolName,C.input=D.input,C.output=D.output,C.errorText=D.errorText,C.rawInput=(T=D.rawInput)!=null?T:C.rawInput,C.preliminary=D.preliminary,y.title!==void 0&&(C.title=y.title),y.toolMetadata!==void 0&&(C.toolMetadata=y.toolMetadata),C.providerExecuted=(R=D.providerExecuted)!=null?R:N.providerExecuted;const O=D.providerMetadata;if(O!=null)if(y.state==="output-available"||y.state==="output-error"){const A=N;A.resultProviderMetadata=O}else N.callProviderMetadata=O}else u.message.parts.push({type:"dynamic-tool",toolName:y.toolName,toolCallId:y.toolCallId,state:y.state,input:D.input,output:D.output,errorText:D.errorText,preliminary:D.preliminary,providerExecuted:D.providerExecuted,title:y.title,...y.toolMetadata!==void 0?{toolMetadata:y.toolMetadata}:{},...D.providerMetadata!=null&&(y.state==="output-available"||y.state==="output-error")?{resultProviderMetadata:D.providerMetadata}:{},...D.providerMetadata!=null&&!(y.state==="output-available"||y.state==="output-error")?{c
vendor: 29,190 bytes, line 47
47allProviderMetadata:D.providerMetadata}:{}})}async function _(y){if(y!=null){const P=u.message.metadata!=null?Ll(u.message.metadata,y):y;t!=null&&await Ha({value:P,schema:t,context:{field:"message.metadata",entityId:u.message.id}}),u.message.metadata=P}}switch(a.type){case"text-start":{const y={type:"text",text:"",providerMetadata:a.providerMetadata,state:"streaming"};u.activeTextParts[a.id]=y,u.message.parts.push(y),f();break}case"text-delta":{const y=u.activeTextParts[a.id];if(y==null)throw new Kt({chunkType:"text-delta",chunkId:a.id,message:`Received text-delta for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});y.text+=a.delta,y.providerMetadata=(c=a.providerMetadata)!=null?c:y.providerMetadata,f();break}case"text-end":{const y=u.activeTextParts[a.id];if(y==null)throw new Kt({chunkType:"text-end",chunkId:a.id,message:`Received text-end for missing text part with ID "${a.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});y.state="done",y.providerMetadata=(m=a.providerMetadata)!=null?m:y.providerMetadata,delete u.activeTextParts[a.id],f();break}case"custom":{const y={type:"custom",kind:a.kind,providerMetadata:a.providerMetadata};u.message.parts.push(y),f();break}case"reasoning-start":{const y={type:"reasoning",text:"",providerMetadata:a.providerMetadata,state:"streaming"};u.activeReasoningParts[a.id]=y,u.message.parts.push(y),f();break}case"reasoning-delta":{const y=u.activeReasoningParts[a.id];if(y==null)throw new Kt({chunkType:"reasoning-delta",chunkId:a.id,message:`Received reasoning-delta for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});y.text+=a.delta,y.providerMetadata=(h=a.providerMetadata)!=null?h:y.providerMetadata,f();break}case"reasoning-end":{const y=u.activeReasoningParts[a.id];if(y==null)throw new Kt({chunkType:"reasoning-end",chunkId:a.id,message:`Received reasoning-end for missing reasoning part with ID "${a.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});y.providerMetadata=(p=a.providerMetadata)!=null?p:y.providerMetadata,y.state="done",delete u.activeReasoningParts[a.id],f();break}case"file":case"reasoning-file":{u.message.parts.push({type:a.type,mediaType:a.mediaType,url:a.url,...a.providerMetadata!=null?{providerMetadata:a.providerMetadata}:{}}),f();break}case"source-url":{u.message.parts.push({type:"source-url",sourceId:a.sourceId,url:a.url,title:a.title,providerMetadata:a.providerMetadata}),f();break}case"source-document":{u.message.parts.push({type:"source-document",sourceId:a.sourceId,mediaType:a.mediaType,title:a.title,filename:a.filename,providerMetadata:a.providerMetadata}),f();break}case"tool-input-start":{const y=g().filter(is);u.partialToolCalls[a.toolCallId]={text:"",toolName:a.toolName,index:y.length,dynamic:a.dynamic,title:a.title,toolMetadata:a.toolMetadata},a.dynamic?E({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,toolMetadata:a.toolMetadata,providerMetadata:a.providerMetadata}):b({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-streaming",input:void 0,providerExecuted:a.providerExecuted,title:a.title,toolMetadata:a.toolMetadata,providerMetadata:a.providerMetadata}),f();break}case"tool-input-delta":{const y=u.partialToolCalls[a.toolCallId];if(y==null)throw new Kt({chunkType:"tool-input-delta",chunkId:a.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${a.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});y.text+=a.inputTextDelta;const{value:P}=await fr(y.text);y.dynamic?E({toolCallId:a.toolCallId,toolName:y.toolName,state:"input-streaming",input:P,title:y.title,toolMetadata:y.toolMetadata}):b({toolCallId:a.toolCallId,toolName:y.toolName,state:"input-streaming",input:P,title:y.title,toolMetadata:y.toolMetadata}),f();break}case"tool-input-available":{a.dynamic?E({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title,toolMetadata:a.toolMetadata}):b({toolCallId:a.toolCallId,toolName:a.toolName,state:"input-available",input:a.input,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:a.title,toolMetadata:a.toolMetadata}),f(),s&&!a.providerExecuted&&await s({toolCall:a});break}case"tool-input-error":{const y=g().filter(Cn).find(T=>T.toolCallId===a.toolCallId);(y!=null?y.type==="dynamic-tool":!!a.dynamic)?E({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,toolMetadata:a.toolMetadata}):b({toolCallId:a.toolCallId,toolName:a.toolName,state:"output-error",input:void 0,rawInput:a.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,toolMetadata:a.toolMetadata}),f();break}case"tool-approval-request":{const y=S(a.toolCallId);y.state="approval-requested",y.approval={id:a.approvalId,...a.isAutomatic===!0?{isAutomatic:!0}:{},...a.signature!=null?{signature:a.signature}:{}},f();break}case"tool-approval-response":{const y=x(a.approvalId),P=y.approval==null?{id:a.approvalId}:y.approval;y.state="approval-responded",y.approval={id:a.approvalId,approved:a.approved,...a.reason!=null?{reason:a.reason}:{},...P.isAutomatic===!0?{isAutomatic:!0}:{},...P.signature!=null?{signature:P.signature}:{}},a.providerExecuted!=null&&(y.providerExecuted=a.providerExecuted),a.providerMetadata!=null&&(y.callProviderMetadata=a.providerMetadata),f();break}case"tool-output-denied":{const y=S(a.toolCallId);y.state="output-denied",f();break}case"tool-output-available":{const y=S(a.toolCallId);y.type==="dynamic-tool"?E({toolCallId:a.toolCallId,toolName:y.toolName,state:"output-available",input:y.input,output:a.output,preliminary:a.preliminary,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:y.title,toolMetadata:y.toolMetadata},y):b({toolCallId:a.toolCallId,toolName:Ga(y),state:"output-available",input:y.input,output:a.output,providerExecuted:a.providerExecuted,preliminary:a.preliminary,providerMetadata:a.providerMetadata,title:y.title,toolMetadata:y.toolMetadata},y),f();break}case"tool-output-error":{const y=S(a.toolCallId);y.type==="dynamic-tool"?E({toolCallId:a.toolCallId,toolName:y.toolName,state:"output-error",input:y.input,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:y.title,toolMetadata:y.toolMetadata},y):b({toolCallId:a.toolCallId,toolName:Ga(y),state:"output-error",input:y.input,rawInput:y.rawInput,errorText:a.errorText,providerExecuted:a.providerExecuted,providerMetadata:a.providerMetadata,title:y.title,toolMetadata:y.toolMetadata},y),f();break}case"start-step":{u.message.parts.push({type:"step-start"});break}case"finish-step":{u.activeTextParts=tr(),u.activeReasoningParts=tr();break}case"start":{a.messageId!=null&&(u.message.id=a.messageId),await _(a.messageMetadata),(a.messageId!=null||a.messageMetadata!=null)&&f();break}case"finish":{a.finishReason!=null&&(u.finishReason=a.finishReason),await _(a.messageMetadata),a.messageMetadata!=null&&f();break}case"message-metadata":{await _(a.messageMetadata),a.messageMetadata!=null&&f();break}case"error":{o?.(new Error(a.errorText));break}default:if(fw(a)){if(n?.[a.type]!=null){const T=u.message.parts.findIndex(N=>"id"in N&&"data"in N&&N.id===a.id&&N.type===a.type),R=T>=0?T:u.message.parts.length;await Ha({value:a.data,schema:n[a.type],context:{field:`message.parts[${R}].data`,entityName:a.type,entityId:a.id}})}const y=a;if(y.transient){i?.(y);break}const P=y.id!=null?u.message.parts.find(T=>y.type===T.type&&y.id===T.id):void 0;P!=null?P.data=y.data:u.message.parts.push(y),i?.(y),f()}}d.enqueue(a)})}}))}async function vw({stream:e,onError:t}){const n=e.getReader();try{for(;;){const{done:r}=await n.read();if(r)break}}catch(r){t?.(r)}finally{n.releaseLock()}}Qe({prefix:"aitxt",size:24});Qe({prefix:"call",size:24});Qe({prefix:"aitxt",size:24});Qe({prefix:"call",size:24});ot(M(),en.optional());ot(M(),M());Qe({prefix:"call",size:24});Qe({prefix:"call",size:24});Qe({prefix:"aiobj",size:24});var gw=class{constructor(){this.queue=[],this.isProcessing=!1}async processQueue(){if(!this.isProcessing){for(this.isProcessing=!0;this.queue.length>0;)await this.queue[0](),this.queue.shift();this.isProcessing=!1}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(r){n(r)}}),this.processQueue()})}};Qe({prefix:"aiobj",size:24});Qe({prefix:"call",size:24});async function yw(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new Error("FileList is not supported in the current environment");return Promise.all(Array.from(e).map(async t=>{const{name:n,type:r}=t,o=await new Promise((s,i)=>{const a=new FileReader;a.onload=d=>{var u;s((u=d.target)==null?void 0:u.result)},a.onerror=d=>i(d),a.readAsDataURL(t)});return{type:"file",mediaType:r,filename:n,url:o}}))}var bw=class{constructor({api:e="/api/chat",credentials:t,headers:n,body:r,fetch:o,prepareSendMessagesRequest:s,prepareReconnectToStreamRequest:i}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=o,this.prepareSendMessagesRequest=s,this.prepareReconnectToStreamRequest=i}async sendMessages({abortSignal:e,...t}){var n,r,o,s,i;const a=await Dt(this.body),d=await Dt(this.headers),u=await Dt(this.credentials),f={...mn(d),...mn(t.headers)},c=await((n=this.prepareSendMessagesRequest)==null?void 0:n.call(this,{api:this.api,id:t.chatId,messages:t.messages,body:{...a,...t.body},headers:f,credentials:u,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId})),m=(r=c?.api)!=null?r:this.api,h=c?.headers!==void 0?mn(c.headers):f,p=c?.body!==void 0?c.body:{...a,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId},g=(o=c?.credentials)!=null?o:u,S=await((s=this.fetch)!=null?s:globalThis.fetch)(m,{method:"POST",headers:{"Content-Type":"application/json",...h},body:JSON.stringify(p),credentials:g,signal:e});if(!S.ok)throw new Error((i=await S.text())!=null?i:"Failed to fetch the chat response.");if(!S.body)throw new Error("The response body is empty.");return this.processResponseStream(S.body)}async reconnectToStream(e){var t,n,r,o,s;const i=await Dt(this.body),a=await Dt(this.headers),d=await Dt(this.credentials),u={...mn(a),...mn(e.headers)},f=await((t=this.prepareReconnectToStreamRequest)==null?void 0:t.call(this,{api:this.api,id:e.chatId,body:{...i,...e.body},headers:u,credentials:d,requestMetadata:e.metadata})),c=(n=f?.api)!=null?n:`${this.api}/${e.chatId}/stream`,m=f?.headers!==void 0?mn(f.headers):u,h=(r=f?.credentials)!=null?r:d,g=await((o=this.fetch)!=null?o:globalThis.fetch)(c,{method:"GET",headers:m,credentials:h});if(g.status===204)return null;if(!g.ok)throw new Error((s=await g.text())!=null?s:"Failed to fetch the chat response.");if(!g.body)throw new Error("The response body is empty.");return this.processResponseStream(g.body)}},gi=class extends bw{constructor(e={}){super(e)}processResponseStream(e){return Fb({stream:e,schema:dw}).pipeThrough(new TransformStream({async transform(t,n){if(!t.success)throw t.error;n.enqueue(t.value)}}))}},ww=class{constructor({generateId:e=Zy,id:t=e(),transport:n=new gi,messageMetadataSchema:r,dataPartSchemas:o,state:s,onError:i,onToolCall:a,onFinish:d,onData:u,sendAutomaticallyWhen:f}){this.activeResponse=void 0,this.jobExecutor=new gw,this.sendMessage=async(c,m)=>{var h,p,g,v;if(c==null){await this.makeRequest({trigger:"submit-message",messageId:(h=this.lastMessage)==null?void 0:h.id,...m});return}let S;if("text"in c||"files"in c?S={parts:[...Array.isArray(c.files)?c.files:await yw(c.files),..."text"in c&&c.text!=null?[{type:"text",text:c.text}]:[]]}:S=c,c.messageId!=null){const x=this.state.messages.findIndex(b=>b.id===c.messageId);if(x===-1)throw new Error(`message with id ${c.messageId} not found`);if(this.state.messages[x].role!=="user")throw new Error(`message with id ${c.messageId} is not a user message`);this.state.messages=this.state.messages.slice(0,x+1),this.state.replaceMessage(x,{...S,id:c.messageId,role:(p=S.role)!=null?p:"user",metadata:c.metadata})}else this.state.pushMessage({...S,id:(g=S.id)!=null?g:this.generateId(),role:(v=S.role)!=null?v:"user",metadata:c.metadata});await this.makeRequest({trigger:"submit-message",messageId:c.messageId,...m})},this.regenerate=async({messageId:c,...m}={})=>{const h=c==null?this.state.messages.length-1:this.state.messages.findIndex(p=>p.id===c);if(h===-1)throw new Error(`message ${c} not found`);this.state.messages=this.state.messages.slice(0,this.messages[h].role==="assistant"?h:h+1),await this.makeRequest({trigger:"regenerate-message",messageId:c,...m})},this.resumeStream=async(c={})=>{await this.makeRequest({trigger:"resume-stream",...c})},this.clearError=()=>{this.status==="error"&&(this.state.error=void 0,this.setStatus({status:"ready"}))},this.addToolApprovalResponse=async({id:c,approved:m,reason:h,options:p})=>this.jobExecutor.run(async()=>{const g=this.state.messages,v=g[g.length-1],S=x=>Cn(x)&&x.state==="approval-requested"&&x.approval.id===c?{...x,state:"approval-responded",approval:{...x.approval,id:c,approved:m,reason:h}}:x;this.state.replaceMessage(g.length-1,{...v,parts:v.parts.map(S)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(S)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(x=>{var b;x&&this.makeRequest({trigger:"submit-message",messageId:(b=this.lastMessage)==null?void 0:b.id,...p})})}),this.addToolOutput=async({state:c="output-available",toolCallId:m,output:h,errorText:p,options:g})=>this.jobExecutor.run(async()=>{const v=this.state.messages,S=v[v.length-1],x=b=>Cn(b)&&b.toolCallId===m?{...b,state:c,output:h,errorText:p}:b;this.state.replaceMessage(v.length-1,{...S,parts:S.parts.map(x)}),this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(x)),this.status!=="streaming"&&this.status!=="submitted"&&this.sendAutomaticallyWhen&&this.shouldSendAutomatically().then(b=>{var E;b&&this.makeRequest({trigger:"submit-message",messageId:(E=this.lastMessage)==null?void 0:E.id,...g})})}),this.addToolResult=this.addToolOutput,this.stop=async()=>{var c;this.status!=="streaming"&&this.status!=="submitted"||(c=this.activeResponse)!=null&&c.abortController&&this.activeResponse.abortController.abort()},this.id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=o,this.state=s,this.onError=i,this.onToolCall=a,this.onFinish=d,this.onData=u,this.sendAutomaticallyWhen=f}get status(){return this.state.status}setStatus({status:e,error:t}){this.status!==e&&(this.state.status=e,this.state.error=t)}get error(){return this.state.error}get messages(){return this.state.messages}get lastMessage(){return this.state.messages[this.state.messages.length-1]}set messages(e){this.state.messages=e}async shouldSendAutomatically(){if(!this.sendAutomaticallyWhen)return!1;const e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e=="object"&&"then"in e?await e:e}async makeRequest({trigger:e,metadata:t,headers:n,body:r,messageId:o}){var s,i;let a;if(e==="resume-stream")try{const h=await this.transport.reconnectToStream({chatId:this.id,metadata:t,headers:n,body:r});if(h==null)return;a=h}catch(h){this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h});return}this.setStatus({status:"submitted",error:void 0});const d=this.lastMessage;let u=!1,f=!1,c=!1,m;try{const h={state:mw({lastMessage:this.state.snapshot(d),messageId:this.generateId()}),abortController:new AbortController};m=h,h.abortController.signal.addEventListener("abort",()=>{u=!0}),this.activeResponse=h;let p;e==="resume-stream"?p=a:p=await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:h.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:o});const g=v=>this.jobExecutor.run(()=>v({state:h.state,write:()=>{var S;this.setStatus({status:"streaming"}),h.state.message.id===((S=this.lastMessage)==null?void 0:S.id)?this.state.replaceMessage(this.state.messages.length-1,h.state.message):this.state.pushMessage(h.state.message)}}));await vw({stream:hw({stream:p,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:g,onError:v=>{throw v}}),onError:v=>{throw v}}),this.setStatus({status:"ready"})}catch(h){if(u||h.name==="AbortError")return u=!0,this.setStatus({status:"ready"}),null;c=!0,h instanceof TypeError&&(h.message.toLowerCase().includes("fetch")||h.message.toLowerCase().includes("network"))&&(f=!0),this.onError&&h instanceof Error&&this.onError(h),this.setStatus({status:"error",error:h})}finally{try{m&&((s=this.onFinish)==null||s.call(this,{message:m.state.message,messages:this.state.messages,isAbort:u,isDisconnect:f,isError:c,finishReason:m.state.finishReason}))}catch(h){console.error(h)}this.activeResponse===m&&(this.activeResponse=void 0)}!c&&await this.shouldSendAutomatically()&&await this.makeRequest({trigger:"submit-message",messageId:(i=this.lastMessage)==null?void 0:i.id,metadata:t,headers:n,body:r})}},jo,Ka;function xw(){if(Ka)return jo;Ka=1;function e(t,n){if(typeof t!="function")throw new TypeError(`Expected the first argument to be a \`function\`, got \`${typeof t}\`.`);let r,o=0;return function(...i){clearTimeout(r);const a=Date.now(),d=a-o,u=n-d;u<=0?(o=a,t.apply(this,i)):r=setTimeout(()=>{o=Date.now(),t.apply(this,i)},u)}}return jo=e,jo}var Sw=xw();const Ew=lm(Sw);var Bl=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},he=(e,t,n)=>(Bl(e,t,"read from private field"),n?n.call(e):t.get(e)),vt=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Nt=(e,t,n,r)=>(Bl(e,t,"write to private field"),t.set(e,n),n);function _w(e,t){return t!=null?Ew(e,t):e}var Ke,kr,jr,Yn,Xn,Qn,gn,as,cs,Cw=class{constructor(e=[]){vt(this,Ke,void 0),vt(this,kr,"ready"),vt(this,jr,void 0),vt(this,Yn,new Set),vt(this,Xn,new Set),vt(this,Qn,new Set),this.pushMessage=t=>{Nt(this,Ke,he(this,Ke).concat(t)),he(this,gn).call(this)},this.popMessage=()=>{Nt(this,Ke,he(this,Ke).slice(0,-1)),he(this,gn).call(this)},this.replaceMessage=(t,n)=>{Nt(this,Ke,[...he(this,Ke).slice(0,t),this.snapshot(n),...he(this,Ke).slice(t+1)]),he(this,gn).call(this)},this.snapshot=t=>structuredClone(t),this["~registerMessagesCallback"]=(t,n)=>{const r=n?_w(t,n):t;return he(this,Yn).add(r),()=>{he(this,Yn).delete(r)}},this["~registerStatusCallback"]=t=>(he(this,Xn).add(t),()=>{he(this,Xn).delete(t)}),this["~registerErrorCallback"]=t=>(he(this,Qn).add(t),()=>{he(this,Qn).delete(t)}),vt(this,gn,()=>{he(this,Yn).forEach(t=>t())}),vt(this,as,()=>{he(this,Xn).forEach(t=>t())}),vt(this,cs,()=>{he(this,Qn).forEach(t=>t())}),Nt(this,Ke,e)}get status(){return he(this,kr)}set status(e){Nt(this,kr,e),he(this,as).call(this)}get error(){return he(this,jr)}set error(e){Nt(this,jr,e),he(this,cs).call(this)}get messages(){return he(this,Ke)}set messages(e){Nt(this,Ke,[...e]),he(this,gn).call(this)}};Ke=new WeakMap;kr=new WeakMap;jr=new WeakMap;Yn=new WeakMap;Xn=new WeakMap;Qn=new WeakMap;gn=new WeakMap;as=new WeakMap;cs=new WeakMap;var yn,qa=class extends ww{constructor({messages:e,...t}){const n=new Cw(e);super({...t,state:n}),vt(this,yn,void 0),this["~registerMessagesCallback"]=(r,o)=>he(this,yn)["~registerMessagesCallback"](r,o),this["~registerStatusCallback"]=r=>he(this,yn)["~registerStatusCallback"](r),this["~registerErrorCallback"]=r=>he(this,yn)["~registerErrorCallback"](r),Nt(this,yn,n)}};yn=new WeakMap;function Pw({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){const o=e??t,s=l.useRef({});"chat"in r||(s.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen,transport:r.transport});let i;const a=()=>{var v;return(v=s.current.transport)!=null?v:i??(i=new gi)},d={...r,transport:{sendMessages:v=>a().sendMessages(v),reconnectToStream:v=>a().reconnectToStream(v)},onToolCall:v=>{var S,x;return(x=(S=s.current).onToolCall)==null?void 0:x.call(S,v)},onData:v=>{var S,x;return(x=(S=s.current).onData)==null?void 0:x.call(S,v)},onFinish:v=>{var S,x;return(x=(S=s.current).onFinish)==null?void 0:x.call(S,v)},onError:v=>{var S,x;return(x=(S=s.current).onError)==null?void 0:x.call(S,v)},sendAutomaticallyWhen:v=>{var S,x,b;return(b=(x=(S=s.current).sendAutomaticallyWhen)==null?void 0:x.call(S,v))!=null?b:!1}},u=l.useRef("chat"in r?r.chat:new qa(d));("chat"in r&&r.chat!==u.current||"id"in r&&r.id!=null&&u.current.id!==r.id)&&(u.current="chat"in r?r.chat:new qa(d));const c=l.useCallback(v=>u.current["~registerMessagesCallback"](v,o),[o,u.current.id]),m=l.useSyncExternalStore(c,()=>u.current.messages,()=>u.current.messages),h=l.useSyncExternalStore(u.current["~registerStatusCallback"],()=>u.current.status,()=>u.current.status),p=l.useSyncExternalStore(u.current["~registerErrorCallback"],()=>u.current.error,()=>u.current.error),g=l.useCallback(v=>{typeof v=="function"&&(v=v(u.current.messages)),u.current.messages=v},[u]);return l.useEffect(()=>{n&&u.current.resumeStream()},[n,u]),{id:u.current.id,messages:m,setMessages:g,sendMessage:u.current.sendMessage,regenerate:u.current.regenerate,clearError:u.current.clearError,stop:u.current.stop,error:p,resumeStream:u.current.resumeStream,status:h,addToolResult:u.current.addToolOutput,addToolOutput:u.current.addToolOutput,addToolApprovalResponse:u.current.addToolApprovalResponse}}const Iw={damping:.7,stiffness:.05,mass:1.25},Rw=70,Ow=1e3/60,Tw=350;let eo=!1;globalThis.document?.addEventListener("mousedown",()=>{eo=!0});globalThis.document?.addEventListener("mouseup",()=>{eo=!1});globalThis.document?.addEventListener("click",()=>{eo=!1});const Aw=(e={})=>{const[t,n]=l.useState(!1),[r,o]=l.useState(e.initial!==!1),[s,i]=l.useState(!1),a=l.useRef(null);a.current=e;const d=l.useCallback(()=>{if(!eo)return!1;const x=window.getSelection();if(!x||!x.rangeCount)return!1;const b=x.getRangeAt(0);return b.commonAncestorContainer.contains(v.current)||v.current?.contains(b.commonAncestorContainer)},[]),u=l.useCallback(x=>{c.isAtBottom=x,o(x)},[]),f=l.useCallback(x=>{c.escapedFromLock=x,n(x)},[]),c=l.useMemo(()=>{let x;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return v.current?.scrollTop??0},set scrollTop(b){if(v.current){const{scrollBehavior:E}=getComputedStyle(v.current);E!=="auto"&&(v.current.style.scrollBehavior="auto"),v.current.scrollTop=b,c.ignoreScrollToTop=v.current.scrollTop,E!=="auto"&&(v.current.style.scrollBehavior=E)}},get targetScrollTop(){return!v.current||!S.current?0:v.current.scrollHeight-1-v.current.clientHeight},get calculatedTargetScrollTop(){if(!v.current||!S.current)return 0;const{targetScrollTop:b}=this;if(!e.targetScrollTop)return b;if(x?.targetScrollTop===b)return x.calculatedScrollTop;const E=Math.max(Math.min(e.targetScrollTop(b,{scrollElement:v.current,contentElement:S.current}),b),0);return x={targetScrollTop:b,calculatedScrollTop:E},requestAnimationFrame(()=>{x=void 0}),E},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=Rw}}},[]),m=l.useCallback((x={})=>{typeof x=="string"&&(x={animation:x}),x.preserveScrollPosition||u(!0);const b=Date.now()+(Number(x.wait)||0),E=zo(a.current,x.animation),{ignoreEscapes:_=!1}=x;let y,P=c.calculatedTargetScrollTop;x.duration instanceof Promise?x.duration.finally(()=>{y=Date.now()}):y=b+(x.duration??0);const T=async()=>{const R=new Promise(requestAnimationFrame).then(()=>{if(!c.isAtBottom)return c.animation=void 0,!1;const{scrollTop:N}=c,D=performance.now(),C=(D-(c.lastTick??D))/Ow;if(c.animation||(c.animation={behavior:E,promise:R,ignoreEscapes:_}),c.animation.behavior===E&&(c.lastTick=D),d()||b>Date.now())return T();if(N<Math.min(P,c.calculatedTargetScrollTop)){if(c.animation?.behavior===E){if(E==="instant")return c.scrollTop=c.calculatedTargetScrollTop,T();c.velocity=(E.damping*c.velocity+E.stiffness*c.scrollDifference)/E.mass,c.accumulated+=c.velocity*C,c.scrollTop+=c.accumulated,c.scrollTop!==N&&(c.accumulated=0)}return T()}return y>Date.now()?(P=c.calculatedTargetScrollTop,T()):(c.animation=void 0,c.scrollTop<c.calculatedTargetScrollTop?m({animation:zo(a.current,a.current.resize),ignoreEscapes:_,duration:Math.max(0,y-Date.now())||void 0}):c.isAtBottom)});return R.then(N=>(requestAnimationFrame(()=>{c.animation||(c.lastTick=void 0,c.velocity=0)}),N))};return x.wait!==!0&&(c.animation=void 0),c.animation?.behavior===E?c.animation.promise:T()},[u,d,c]),h=l.useCallback(()=>{f(!0),u(!1)},[f,u]),p=l.useCallback(({target:x})=>{if(x!==v.current)return;const{scrollTop:b,ignoreScrollToTop:E}=c;let{lastScrollTop:_=b}=c;c.lastScrollTop=b,c.ignoreScrollToTop=void 0,E&&E>b&&(_=E),i(c.isNearBottom),setTimeout(()=>{if(c.resizeDifference||b===E)return;if(d()){f(!0),u(!1);return}const y=b>_,P=b<_;if(c.animation?.ignoreEscapes){c.scrollTop=_;return}P&&(f(!0),u(!1)),y&&f(!1),!c.escapedFromLock&&c.isNearBottom&&u(!0)},1)},[f,u,d,c]),g=l.useCallback(({target:x,deltaY:b})=>{let E=x;for(;!["scroll","auto"].includes(getComputedStyle(E).overflow);){if(!E.parentElement)return;E=E.parentElement}E===v.current&&b<0&&v.current.scrollHeight>v.current.clientHeight&&!c.animation?.ignoreEscapes&&(f(!0),u(!1))},[f,u,c]),v=Ja(x=>{v.current?.removeEventListener("scroll",p),v.current?.removeEventListener("wheel",g),x?.addEventListener("scroll",p,{passive:!0}),x?.addEventListener("wheel",g,{passive:!0})},[]),S=Ja(x=>{if(c.resizeObserver?.disconnect(),c.resizeObserver=void 0,!x)return;let b;c.resizeObserver=new ResizeObserver(([E])=>{const{height:_}=E.contentRect,y=_-(b??_);if(c.resizeDifference=y,c.scrollTop>c.targetScrollTop&&(c.scrollTop=c.targetScrollTop),i(c.isNearBottom),y>=0){const P=zo(a.current,b?a.current.resize:a.current.initial);m({animation:P,wait:!0,preserveScrollPosition:!0,duration:P==="instant"?void 0:Tw})}else c.isNearBottom&&(f(!1),u(!0));b=_,requestAnimationFrame(()=>{setTimeout(()=>{c.resizeDifference===y&&(c.resizeDifference=0)},1)})}),c.resizeObserver?.observe(x)},[]);return{contentRef:S,scrollRef:v,scrollToBottom:m,stopScroll:h,isAtBottom:r||s,isNearBottom:s,escapedFromLock:t,state:c}};function Ja(e,t){const n=l.useCallback(r=>(n.current=r,e(r)),t);return n}const Lo=new Map;function zo(...e){const t={...Iw};let n=!1;for(const o of e){if(o==="instant"){n=!0;continue}typeof o=="object"&&(n=!1,t.damping=o.damping??t.damping,t.stiffness=o.stiffness??t.stiffness,t.mass=o.mass??t.mass)}const r=JSON.stringify(t);return Lo.has(r)||Lo.set(r,Object.freeze(t)),n?"instant":Lo.get(r)}const Wl=l.createContext(null),$w=typeof window<"u"?l.useLayoutEffect:l.useEffect;function Vr({instance:e,children:t,resize:n,initial:r,mass:o,damping:s,stiffness:i,targetScrollTop:a,contextRef:d,...u}){const f=l.useRef(null),c=l.useCallback((_,y)=>(E?.targetScrollTop??a)?.(_,y)??_,[a]),m=Aw({mass:o,damping:s,stiffness:i,resize:n,initial:r,targetScrollTop:c}),{scrollRef:h,contentRef:p,scrollToBottom:g,stopScroll:v,isAtBottom:S,escapedFromLock:x,state:b}=e??m,E=l.useMemo(()=>({scrollToBottom:g,stopScroll:v,scrollRef:h,isAtBottom:S,escapedFromLock:x,contentRef:p,state:b,get targetScrollTop(){return f.current},set targetScrollTop(_){f.current=_}}),[g,S,p,h,v,x,b]);return l.useImperativeHandle(d,()=>E,[E]),$w(()=>{h.current&&getComputedStyle(h.current).overflow==="visible"&&(h.current.style.overflow="auto")},[]),l.createElement(Wl.Provider,{value:E},l.createElement("div",{...u},typeof t=="function"?t(E):t))}(function(e){function t({children:n,scrollClassName:r,...o}){const s=Vl();return l.createElement("div",{ref:s.scrollRef,style:{height:"100%",width:"100%",scrollbarGutter:"stable both-edges"},className:r},l.createElement("div",{...o,ref:s.contentRef},typeof n=="function"?n(s):n))}e.Content=t})(Vr||(Vr={}));function Vl(){const e=l.useContext(Wl);if(!e)throw new Error("use-stick-to-bottom component context must be used within a StickToBottom component");return e}const Nw=({className:e,...t})=>w.jsx(Vr,{className:Q("relative flex-1 overflow-y-hidden",e),initial:"smooth",resize:"smooth",role:"log",...t}),Dw=({className:e,...t})=>w.jsx(Vr.Content,{className:Q("flex flex-col gap-8 p-4",e),...t}),Mw=({className:e,...t})=>{const{isAtBottom:n,scrollToBottom:r}=Vl(),o=l.useCallback(()=>{r()},[r]);return!n&&w.jsx(zc,{className:Q("absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",e),onClick:o,size:"icon",type:"button",variant:"outline",...t,children:w.jsx(hm,{className:"size-4"})})};var kw=Object.defineProperty,yi=(e,t)=>kw(e,"name",{value:t,configurable:!0});function ls(e,t){if(typeof e=="function")return e(t);
47e!=null&&(e.current=t)}yi(ls,"setRef");function Hl(...e){return t=>{let n=!1;const r=e.map(o=>{const s=ls(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():ls(e[o],null)}}}}yi(Hl,"composeRefs");function Gl(...e){return l.useCallback(Hl(...e),e)}yi(Gl,"useComposedRefs");var jw=Object.defineProperty,ut=(e,t)=>jw(e,"name",{value:t,configurable:!0});function Kl(e){const t=l.forwardRef((n,r)=>{let{children:o,...s}=n,i=null,a=!1;const d=[];us(o)&&typeof Pr=="function"&&(o=Pr(o._payload)),l.Children.forEach(o,m=>{if(Xl(m)){a=!0;const h=m;let p="child"in h.props?h.props.child:h.props.children;us(p)&&typeof Pr=="function"&&(p=Pr(p._payload)),i=zw(h,p),d.push(i?.props?.children)}else d.push(m)}),i?i=l.cloneElement(i,void 0,d):!a&&l.Children.count(o)===1&&l.isValidElement(o)&&(i=o);const u=i?Yl(i):void 0,f=Gl(r,u);if(!i){if(o||o===0)throw new Error(a?Uw(e):Zw(e));return o}const c=Jl(s,i.props??{});return i.type!==l.Fragment&&(c.ref=r?f:u),l.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}ut(Kl,"createSlot");var ql=Symbol.for("radix.slottable");function Lw(e){const t=ut(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=ql,t}ut(Lw,"createSlottable");var zw=ut((e,t)=>{if("child"in e.props){const n=e.props.child;return l.isValidElement(n)?l.cloneElement(n,void 0,e.props.children(n.props.children)):null}return l.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Jl(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}ut(Jl,"mergeProps");function Yl(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ut(Yl,"getElementRef");function Xl(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ql}ut(Xl,"isSlottable");var Fw=Symbol.for("react.lazy");function us(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Fw&&"_payload"in e&&Ql(e._payload)}ut(us,"isLazyComponent");function Ql(e){return typeof e=="object"&&e!==null&&"then"in e}ut(Ql,"isPromiseLike");var Zw=ut(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Uw=ut(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Pr=Le[" use ".trim().toString()],Bw=Object.defineProperty,Ww=(e,t)=>Bw(e,"name",{value:t,configurable:!0}),Vw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Hw=Vw.reduce((e,t)=>{const n=Kl(`Primitive.${t}`),r=l.forwardRef((o,s)=>{const{asChild:i,...a}=o,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Gw(e,t){e&&lt.flushSync(()=>e.dispatchEvent(t))}Ww(Gw,"dispatchDiscreteCustomEvent");var Kw=Object.defineProperty,eu=(e,t)=>Kw(e,"name",{value:t,configurable:!0}),Ya="horizontal",qw=["horizontal","vertical"],Jw=l.forwardRef(eu(function(t,n){const{decorative:r,orientation:o=Ya,...s}=t,i=tu(o)?o:Ya,d=r?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return w.jsx(Hw.div,{"data-orientation":i,...d,...s,ref:n})},"Separator"));function tu(e){return qw.includes(e)}eu(tu,"isValidOrientation");var nu=Jw;const Yw=l.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>w.jsx(nu,{ref:o,decorative:n,orientation:t,className:Q("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));Yw.displayName=nu.displayName;var Xw=Object.defineProperty,Ln=(e,t)=>Xw(e,"name",{value:t,configurable:!0}),ru=!!(typeof window<"u"&&window.document&&window.document.createElement);function Lr(e,t,{checkForDefaultPrevented:n=!0}={}
47){return Ln(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}Ln(Lr,"composeEventHandlers");function Qw(e){if(!ru)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Ln(Qw,"getOwnerWindow");function ds(e){if(!ru)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Ln(ds,"getOwnerDocument");function ou(e,t=!1){const{activeElement:n}=ds(e);if(!n?.nodeName)return null;if(su(n)&&n.contentDocument)return ou(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=ds(n).getElementById(r);if(o)return o}}return n}Ln(ou,"getActiveElement");function su(e){return e.tagName==="IFRAME"}Ln(su,"isFrame");var ex=Object.defineProperty,bi=(e,t)=>ex(e,"name",{value:t,configurable:!0});function fs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}bi(fs,"setRef");function iu(...e){return t=>{let n=!1;const r=e.map(o=>{const s=fs(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():fs(e[o],null)}}}}bi(iu,"composeRefs");function pr(...e){return l.useCallback(iu(...e),e)}bi(pr,"useComposedRefs");var tx=Object.defineProperty,qe=(e,t)=>tx(e,"name",{value:t,configurable:!0});function nx(e,t){const n=l.createContext(t);n.displayName=e+"Context";const r=qe(s=>{const{children:i,...a}=s,d=l.useMemo(()=>a,Object.values(a));return w.jsx(n.Provider,{value:d,children:i})},"Provider");r.displayName=e+"Provider";function o(s,i={}){const{optional:a=!1}=i,d=l.useContext(n);if(d)return d;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return qe(o,"useContext"),[r,o]}qe(nx,"createContext");function wi(e,t=[]){let n=[];function r(s,i){const a=l.createContext(i);a.displayName=s+"Context";const d=n.length;n=[...n,i];const u=qe(c=>{const{scope:m,children:h,...p}=c,g=m?.[e]?.[d]||a,v=l.useMemo(()=>p,Object.values(p));return w.jsx(g.Provider,{value:v,children:h})},"Provider");u.displayName=s+"Provider";function f(c,m,h={}){const{optional:p=!1}=h,g=m?.[e]?.[d]||a,v=l.useContext(g);if(v)return v;if(i!==void 0)return i;if(!p)throw new Error(`\`${c}\` must be used within \`${s}\``)}return qe(f,"useContext"),[u,f]}qe(r,"createContext");const o=qe(()=>{const s=n.map(i=>l.createContext(i));return qe(function(a){const d=a?.[e]||s;return l.useMemo(()=>({[`__scope${e}`]:{...a,[e]:d}}),[a,d])},"useScope")},"createScope");return o.scopeName=e,[r,au(o,...t)]}qe(wi,"createContextScope");function au(...e){const t=e[0];if(e.length===1)return t;const n=qe(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return qe(function(s){const i=r.reduce((a,{useScope:d,scopeName:u})=>{const c=d(s)[`__scope${u}`];return{...a,...c}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}qe(au,"composeContextScopes");var rx=Object.defineProperty,dt=(e,t)=>rx(e,"name",{value:t,configurable:!0});function cu(e){const t=l.forwardRef((n,r)=>{let{children:o,...s}=n,i=null,a=!1;const d=[];ps(o)&&typeof Ir=="function"&&(o=Ir(o._payload)),l.Children.forEach(o,m=>{if(pu(m)){a=!0;const h=m;let p="child"in h.props?h.props.child:h.props.children;ps(p)&&typeof Ir=="function"&&(p=Ir(p._payload)),i=ox(h,p),d.push(i?.props?.children)}else d.push(m)}),i?i=l.cloneElement(i,void 0,d):!a&&l.Children.count(o)===1&&l.isValidElement(o)&&(i=o);const u=i?fu(i):void 0,f=pr(r,u);if(!i){if(o||o===0)throw new Error(a?ax(e):ix(e));return o}const c=du(s,i.props??{});return i.type!==l.Fragment&&(c.ref=r?f:u),l.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}dt(cu,"createSlot");var lu=Symbol.for("radix.slottable");function uu(e){const t=dt(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=lu,t}dt(uu,"createSlottable");var ox=dt((e,t)=>{if("child"in e.props){const n=e.props.child;return l.isValidElement(n)?l.cloneElement(n,void 0,e.props.children(n.props.children)):null}return l.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function du(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}
47:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}dt(du,"mergeProps");function fu(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}dt(fu,"getElementRef");function pu(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lu}dt(pu,"isSlottable");var sx=Symbol.for("react.lazy");function ps(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===sx&&"_payload"in e&&mu(e._payload)}dt(ps,"isLazyComponent");function mu(e){return typeof e=="object"&&e!==null&&"then"in e}dt(mu,"isPromiseLike");var ix=dt(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),ax=dt(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ir=Le[" use ".trim().toString()],cx=Object.defineProperty,lx=(e,t)=>cx(e,"name",{value:t,configurable:!0}),ux=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],to=ux.reduce((e,t)=>{const n=cu(`Primitive.${t}`),r=l.forwardRef((o,s)=>{const{asChild:i,...a}=o,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function hu(e,t){e&&lt.flushSync(()=>e.dispatchEvent(t))}lx(hu,"dispatchDiscreteCustomEvent");var dx=Object.defineProperty,fx=(e,t)=>dx(e,"name",{value:t,configurable:!0});function mr(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>((...n)=>t.current?.(...n)),[])}fx(mr,"useCallbackRef");var px=Object.defineProperty,Ce=(e,t)=>px(e,"name",{value:t,configurable:!0}),ms="dismissableLayer.update",mx="dismissableLayer.pointerDownOutside",hx="dismissableLayer.focusOutside",Xa,vu=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),vx=l.forwardRef(Ce(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:d,onDismiss:u,...f}=t,c=l.useContext(vu),[m,h]=l.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=l.useState({}),v=pr(n,h),S=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=x?S.indexOf(x):-1,E=m?S.indexOf(m):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,y=E>=b,P=l.useRef(!1),T=gu(C=>{i?.(C),d?.(C),C.defaultPrevented||u?.()},{ownerDocument:p,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:c.dismissableSurfaces,shouldHandlePointerDownOutside:l.useCallback(C=>{if(!(C instanceof Node))return!1;const O=[...c.branches].some(A=>A.contains(C));return y&&!O},[c.branches,y])}),R=yu(C=>{if(o&&P.current)return;const O=C.target;[...c.branches].some(U=>U.contains(O))||(a?.(C),d?.(C),C.defaultPrevented||u?.())},p),N=m?E===S.length-1:!1,D=mr(C=>{C.key==="Escape"&&(s?.(C),!C.defaultPrevented&&u&&(C.preventDefault(),u()))});return l.useEffect(()=>{if(N)return p.addEventListener("keydown",D,{capture:!0}),()=>p.removeEventListener("keydown",D,{capture:!0})},[p,N,D]),l.useEffect(()=>{if(m)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Xa=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(m)),c.layers.add(m),hs(),()=>{r&&(c.layersWithOutsidePointerEventsDisabled.delete(m),c.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Xa))}},[m,p,r,c]),l.useEffect(()=>()=>{m&&(c.layers.delete(m),c.layersWithOutsidePointerEventsDisabled.delete(m),hs())},[m,c]),l.useEffect(()=>{const C=Ce(()=>g({}),"handleUpdate");return document.addEventListener(ms,C),()=>document.removeEventListener(ms,C)},[]),w.jsx(to.div,{...f,ref:v,style:{pointerEvents:_?y?"auto":"none":void 0,...t.style},onFocusCapture:Lr(t.onFocusCapture,R.onFocusCapture),onBlurCapture:Lr(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:Lr(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function gx(){const e=l.useContext(vu),[t,n]=l.useState(null);return l.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Ce(gx,"useDismissableLayerSurface");var yx=Ce(()=>!0,"IS_TRUE");function gu(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=yx}=t,a=mr(e),d=l.useRef(!1),u=l.useRef(!1),f=l.useRef(new Map),c=l.useRef(()=>{});return l.useEffect(()=>{function m(){u.current=!1,o.current=!1,f.current.clear()}Ce(m,"resetOutsideInteraction");function h(){return Array.from(f.current.values()).some(Boolean)}Ce(h,"isOutsideInteractionIntercepted");function p(b){if(!u.current)return;const E=b.target;E instanceof Node&&[...s].some(y=>y.contains(E))||f.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{u.current&&c.current()},0)}Ce(p,"handleInteractionCapture");function g(b){u.current&&f.current.set(b.type,!1)}Ce(g,"handleInteractionBubble");const v=Ce(b=>
47{if(b.target&&!d.current){let E=function(){n.removeEventListener("click",c.current);const y=h();m(),y||xi(mx,a,_,{discrete:!0})};if(Ce(E,"handleAndDispatchPointerDownOutsideEvent"),!i(b.target)){n.removeEventListener("click",c.current),m(),d.current=!1;return}const _={originalEvent:b};u.current=!0,o.current=r&&b.button===0,f.current.clear(),!r||b.button!==0?E():(n.removeEventListener("click",c.current),c.current=E,n.addEventListener("click",c.current,{once:!0}))}else n.removeEventListener("click",c.current),m();d.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of S)n.addEventListener(b,p,!0),n.addEventListener(b,g);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",c.current);for(const b of S)n.removeEventListener(b,p,!0),n.removeEventListener(b,g)}},[n,a,r,o,s,i]),{onPointerDownCapture:Ce(()=>d.current=!0,"onPointerDownCapture")}}Ce(gu,"usePointerDownOutside");function yu(e,t=globalThis?.document){const n=mr(e),r=l.useRef(!1);return l.useEffect(()=>{const o=Ce(s=>{s.target&&!r.current&&xi(hx,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:Ce(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Ce(()=>r.current=!1,"onBlurCapture")}}Ce(yu,"useFocusOutside");function hs(){const e=new CustomEvent(ms);document.dispatchEvent(e)}Ce(hs,"dispatchUpdate");function xi(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?hu(o,s):o.dispatchEvent(s)}Ce(xi,"handleAndDispatchCustomEvent");var kt=globalThis?.document?l.useLayoutEffect:()=>{};const bx=["top","right","bottom","left"],Zt=Math.min,Ve=Math.max,Hr=Math.round,Rr=Math.floor,yt=e=>({x:e,y:e}),wx={left:"right",right:"left",bottom:"top",top:"bottom"};function vs(e,t,n){return Ve(e,Zt(t,n))}function Pt(e,t){return typeof e=="function"?e(t):e}function It(e){return e.split("-")[0]}function zn(e){return e.split("-")[1]}function Si(e){return e==="x"?"y":"x"}function Ei(e){return e==="y"?"height":"width"}function gt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _i(e){return Si(gt(e))}function xx(e,t,n){n===void 0&&(n=!1);const r=zn(e),o=_i(e),s=Ei(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=Gr(i)),[i,Gr(i)]}function Sx(e){const t=Gr(e);return[gs(e),t,gs(t)]}function gs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Qa=["left","right"],ec=["right","left"],Ex=["top","bottom"],_x=["bottom","top"];function Cx(e,t,n){switch(e){case"top":case"bottom":return n?t?ec:Qa:t?Qa:ec;case"left":case"right":return t?Ex:_x;default:return[]}}function Px(e,t,n,r){const o=zn(e);let s=Cx(It(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(gs)))),s}function Gr(e){const t=It(e);return wx[t]+e.slice(t.length)}function Ix(e){return{top:0,right:0,bottom:0,left:0,...e}}function bu(e){return typeof e!="number"?Ix(e):{top:e,right:e,bottom:e,left:e}}function Kr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function tc(e,t,n){let{reference:r,floating:o}=e;const s=gt(t),i=_i(t),a=Ei(i),d=It(t),u=s==="y",f=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let h;switch(d){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:c};break;case"left":h={x:r.x-o.width,y:c};break;default:h={x:r.x,y:r.y}}switch(zn(t)){case"start":h[i]-=m*(n&&u?-1:1);break;case"end":h[i]+=m*(n&&u?-1:1);break}return h}async function Rx(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:f="viewport",elementContext:c="floating",altBoundary:m=!1,padding:h=0}=Pt(t,e),p=bu(h),v=a[m?c==="floating"?"reference":"floating":c],S=Kr(await s.getClippingRect
vendor: 4,808 bytes, line 47
47({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:f,strategy:d})),x=c==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},_=Kr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:b,strategy:d}):x);return{top:(S.top-_.top+p.top)/E.y,bottom:(_.bottom-S.bottom+p.bottom)/E.y,left:(S.left-_.left+p.left)/E.x,right:(_.right-S.right+p.right)/E.x}}const Ox=50,Tx=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=i.detectOverflow?i:{...i,detectOverflow:Rx},d=await(i.isRTL==null?void 0:i.isRTL(t));let u=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:c}=tc(u,r,d),m=r,h=0;const p={};for(let g=0;g<s.length;g++){const v=s[g];if(!v)continue;const{name:S,fn:x}=v,{x:b,y:E,data:_,reset:y}=await x({x:f,y:c,initialPlacement:r,placement:m,strategy:o,middlewareData:p,rects:u,platform:a,elements:{reference:e,floating:t}});f=b??f,c=E??c,p[S]={...p[S],..._},y&&h<Ox&&(h++,typeof y=="object"&&(y.placement&&(m=y.placement),y.rects&&(u=y.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):y.rects),{x:f,y:c}=tc(u,m,d)),g=-1)}return{x:f,y:c,placement:m,strategy:o,middlewareData:p}},Ax=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:d}=t,{element:u,padding:f=0}=Pt(e,t)||{};if(u==null)return{};const c=bu(f),m={x:n,y:r},h=_i(o),p=Ei(h),g=await i.getDimensions(u),v=h==="y",S=v?"top":"left",x=v?"bottom":"right",b=v?"clientHeight":"clientWidth",E=s.reference[p]+s.reference[h]-m[h]-s.floating[p],_=m[h]-s.reference[h],y=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let P=y?y[b]:0;(!P||!await(i.isElement==null?void 0:i.isElement(y)))&&(P=a.floating[b]||s.floating[p]);const T=E/2-_/2,R=P/2-g[p]/2-1,N=Zt(c[S],R),D=Zt(c[x],R),C=N,O=P-g[p]-D,A=P/2-g[p]/2+T,U=vs(C,A,O),B=!d.arrow&&zn(o)!=null&&A!==U&&s.reference[p]/2-(A<C?N:D)-g[p]/2<0,Z=B?A<C?A-C:A-O:0;return{[h]:m[h]+Z,data:{[h]:U,centerOffset:A-U-Z,...B&&{alignmentOffset:Z}},reset:B}}}),$x=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:d,elements:u}=t,{mainAxis:f=!0,crossAxis:c=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=Pt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const S=It(o),x=gt(a),b=It(a)===a,E=await(d.isRTL==null?void 0:d.isRTL(u.floating)),_=m||(b||!g?[Gr(a)]:Sx(a)),y=p!=="none";!m&&y&&_.push(...Px(a,g,p,E));const P=[a,..._],T=await d.detectOverflow(t,v),R=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&R.push(T[S]),c){const A=xx(o,i,E);R.push(T[A[0]],T[A[1]])}if(N=[...N,{placement:o,overflows:R}],!R.every(A=>A<=0)){var D,C;const A=(((D=s.flip)==null?void 0:D.index)||0)+1,U=P[A];if(U&&(!(c==="alignment"?x!==gt(U):!1)||N.every(V=>gt(V.placement)===x?V.overflows[0]>0:!0)))return{data:{index:A,overflows:N},reset:{placement:U}};let B=(C=N.filter(Z=>Z.overflows[0]<=0).sort((Z,V)=>Z.overflows[1]-V.overflows[1])[0])==null?void 0:C.placement;if(!B)switch(h){case"bestFit":{var O;const Z=(O=N.filter(V=>{if(y){const H=gt(V.placement);return H===x||H==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(H=>H>0).reduce((H,F)=>H+F,0)]).sort((V,H)=>V[1]-H[1])[0])==null?void 0:O[0];Z&&(B=Z);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function nc(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rc(e){return bx.some(t=>e[t]>=0)}const Nx=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Pt(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=nc(i,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:rc(a)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),a=nc(i,n.floating);return{data:{escapedOffsets:a,escaped:rc(a)}}}default:return{}}}}},wu=new Set(["left","top"]);async function Dx(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=It(n),a=zn(n),d=gt(n)==="y",u=wu.has(i)?-1:1,f=s&&d?-1:1,c=Pt(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:p}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}
47:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),d?{x:h*f,y:m*u}:{x:m*u,y:h*f}}const Mx=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,d=await Dx(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+d.x,y:s+d.y,data:{...d,placement:i}}}}},kx=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:a=!1,limiter:d={fn:S=>{let{x,y:b}=S;return{x,y:b}}},...u}=Pt(e,t),f={x:n,y:r},c=await s.detectOverflow(t,u),m=gt(It(o)),h=Si(m);let p=f[h],g=f[m];if(i){const S=h==="y"?"top":"left",x=h==="y"?"bottom":"right",b=p+c[S],E=p-c[x];p=vs(b,p,E)}if(a){const S=m==="y"?"top":"left",x=m==="y"?"bottom":"right",b=g+c[S],E=g-c[x];g=vs(b,g,E)}const v=d.fn({...t,[h]:p,[m]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[m]:a}}}}}},jx=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:d=!0,crossAxis:u=!0}=Pt(e,t),f={x:n,y:r},c=gt(o),m=Si(c);let h=f[m],p=f[c];const g=Pt(a,t),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(d){const b=m==="y"?"height":"width",E=s.reference[m]-s.floating[b]+v.mainAxis,_=s.reference[m]+s.reference[b]-v.mainAxis;h<E?h=E:h>_&&(h=_)}if(u){var S,x;const b=m==="y"?"width":"height",E=wu.has(It(o)),_=s.reference[c]-s.floating[b]+(E&&((S=i.offset)==null?void 0:S[c])||0)+(E?0:v.crossAxis),y=s.reference[c]+s.reference[b]+(E?0:((x=i.offset)==null?void 0:x[c])||0)-(E?v.crossAxis:0);p<_?p=_:p>y&&(p=y)}return{[m]:h,[c]:p}}}},Lx=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:d=()=>{},...u}=Pt(e,t),f=await i.detectOverflow(t,u),c=It(o),m=zn(o),h=gt(o)==="y",{width:p,height:g}=s.floating;let v,S;c==="top"||c==="bottom"?(v=c,S=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(S=c,v=m==="end"?"top":"bottom");const x=g-f.top-f.bottom,b=p-f.left-f.right,E=Zt(g-f[v],x),_=Zt(p-f[S],b),y=!t.middlewareData.shift;let P=E,T=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=b),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=x),y&&!m){const N=Ve(f.left,0),D=Ve(f.right,0),C=Ve(f.top,0),O=Ve(f.bottom,0);h?T=p-2*(N!==0||D!==0?N+D:Ve(f.left,f.right)):P=g-2*(C!==0||O!==0?C+O:Ve(f.top,f.bottom))}await d({...t,availableWidth:T,availableHeight:P});const R=await i.getDimensions(a.floating);return p!==R.width||g!==R.height?{reset:{rects:!0}}:{}}}};function no(){return typeof window<"u"}function Fn(e){return xu(e)?(e.nodeName||"").toLowerCase():"#document"}function He(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xt(e){var t;return(t=(xu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xu(e){return no()?e instanceof Node||e instanceof He(e).Node:!1}function at(e){return no()?e instanceof Element||e instanceof He(e).Element:!1}function $t(e){return no()?e instanceof HTMLElement||e instanceof He(e).HTMLElement:!1}function oc(e){return!no()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof He(e).ShadowRoot}function hr(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ct(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function zx(e){return/^(table|td|th)$/.test(Fn(e))}function ro(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Fx=/transform|translate|scale|rotate|perspective|filter/,Zx=/paint|layout|strict|content/,qt=e=>!!e&&e!=="none";let Fo;function Ci(e){const t=at(e)?ct(e):e;return qt(t.transform)||qt(t.translate)||qt(t.scale)||qt(t.rotate)||qt(t.perspective)||!Pi()&&(qt(t.backdropFilter)||qt(t.filter))||Fx.test(t.willChange||"")||Zx.test(t.contain||"")}function Ux(e){let t=Ut(e);for(;$t(t)&&!Nn(t);){if(Ci(t))return t;if(ro(t))return null;t=Ut(t)}return null}function Pi(){return Fo==null&&(Fo=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Fo}function Nn(e){return/^(html|body|#document)$/.test(Fn(e))}function ct(e){return He(e).getComputedStyle(e)}function oo(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ut(e){if(Fn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||oc(e)&&e.host||xt(e);return oc(t)?t.host:t}function Su(e){const t=Ut(e);return Nn(t)?e.ownerDocument?e.ownerDocument.body:e.body:$t(t)&&hr(t)?t:Su(t)}function sr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Su(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=He(o);if(s){const a=ys(i);
vendor: 4,304 bytes, line 47
47return t.concat(i,i.visualViewport||[],hr(o)?o:[],a&&n?sr(a):[])}else return t.concat(o,sr(o,[],n))}function ys(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Eu(e){const t=ct(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=$t(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Hr(n)!==s||Hr(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Ii(e){return at(e)?e:e.contextElement}function Pn(e){const t=Ii(e);if(!$t(t))return yt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Eu(t);let i=(s?Hr(n.width):n.width)/r,a=(s?Hr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Bx=yt(0);function _u(e){const t=He(e);return!Pi()||!t.visualViewport?Bx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Wx(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==He(e)?!1:t}function tn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Ii(e);let i=yt(1);t&&(r?at(r)&&(i=Pn(r)):i=Pn(e));const a=Wx(s,n,r)?_u(s):yt(0);let d=(o.left+a.x)/i.x,u=(o.top+a.y)/i.y,f=o.width/i.x,c=o.height/i.y;if(s){const m=He(s),h=r&&at(r)?He(r):r;let p=m,g=ys(p);for(;g&&r&&h!==p;){const v=Pn(g),S=g.getBoundingClientRect(),x=ct(g),b=S.left+(g.clientLeft+parseFloat(x.paddingLeft))*v.x,E=S.top+(g.clientTop+parseFloat(x.paddingTop))*v.y;d*=v.x,u*=v.y,f*=v.x,c*=v.y,d+=b,u+=E,p=He(g),g=ys(p)}}return Kr({width:f,height:c,x:d,y:u})}function so(e,t){const n=oo(e).scrollLeft;return t?t.left+n:tn(xt(e)).left+n}function Cu(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-so(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Vx(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=xt(r),a=t?ro(t.floating):!1;if(r===i||a&&s)return n;let d={scrollLeft:0,scrollTop:0},u=yt(1);const f=yt(0),c=$t(r);if((c||!c&&!s)&&((Fn(r)!=="body"||hr(i))&&(d=oo(r)),c)){const h=tn(r);u=Pn(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const m=i&&!c&&!s?Cu(i,d):yt(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-d.scrollLeft*u.x+f.x+m.x,y:n.y*u.y-d.scrollTop*u.y+f.y+m.y}}function Hx(e){return Array.from(e.getClientRects())}function Gx(e){const t=xt(e),n=oo(e),r=e.ownerDocument.body,o=Ve(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+so(e);const a=-n.scrollTop;return ct(r).direction==="rtl"&&(i+=Ve(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}const sc=25;function Kx(e,t){const n=He(e),r=xt(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,d=0;if(o){s=o.width,i=o.height;const f=Pi();(!f||f&&t==="fixed")&&(a=o.offsetLeft,d=o.offsetTop)}const u=so(r);if(u<=0){const f=r.ownerDocument,c=f.body,m=getComputedStyle(c),h=f.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(r.clientWidth-c.clientWidth-h);p<=sc&&(s-=p)}else u<=sc&&(s+=u);return{width:s,height:i,x:a,y:d}}function qx(e,t){const n=tn(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=$t(e)?Pn(e):yt(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,d=o*s.x,u=r*s.y;return{width:i,height:a,x:d,y:u}}function ic(e,t,n){let r;if(t==="viewport")r=Kx(e,n);else if(t==="document")r=Gx(xt(e));else if(at(t))r=qx(t,n);else{const o=_u(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Kr(r)}function Pu(e,t){const n=Ut(e);return n===t||!at(n)||Nn(n)?!1:ct(n).position==="fixed"||Pu(n,t)}function Jx(e,t){const n=t.get(e);if(n)return n;let r=sr(e,[],!1).filter(a=>at(a)&&Fn(a)!=="body"),o=null;const s=ct(e).position==="fixed";let i=s?Ut(e):e;for(;at(i)&&!Nn(i);){const a=ct(i),d=Ci(i);!d&&a.position==="fixed"&&(o=null),(s?!d&&!o:!d&&a.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||hr(i)&&!d&&Pu(e,i))?r=r.filter(f=>f!==i):o=a,i=Ut(i)}return t.set(e,r),r}function Yx(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?ro(t)?[]:Jx(t,this._c):[].concat(n),r],a=ic(t,i[0],o);let d=a.top,u=a.right,f=a.bottom,c=a.left;for(let m=1;m<i.length;m++){const h=ic(t,i[m],o);d=Ve(h.top,d),u=Zt(h.right,u),f=Zt(h.bottom,f),c=Ve(h.left,c)}return{width:u-c,height:f-d,x:c,y:d}}function Xx(e){const{width:t,height:n}=Eu(e);return{width:t,height:n}}
vendor: 4,579 bytes, line 47
47function Qx(e,t,n){const r=$t(t),o=xt(t),s=n==="fixed",i=tn(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const d=yt(0);function u(){d.x=so(o)}if(r||!r&&!s)if((Fn(t)!=="body"||hr(o))&&(a=oo(t)),r){const h=tn(t,!0,s,t);d.x=h.x+t.clientLeft,d.y=h.y+t.clientTop}else o&&u();s&&!r&&o&&u();const f=o&&!r&&!s?Cu(o,a):yt(0),c=i.left+a.scrollLeft-d.x-f.x,m=i.top+a.scrollTop-d.y-f.y;return{x:c,y:m,width:i.width,height:i.height}}function Zo(e){return ct(e).position==="static"}function ac(e,t){if(!$t(e)||ct(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return xt(e)===n&&(n=n.ownerDocument.body),n}function Iu(e,t){const n=He(e);if(ro(e))return n;if(!$t(e)){let o=Ut(e);for(;o&&!Nn(o);){if(at(o)&&!Zo(o))return o;o=Ut(o)}return n}let r=ac(e,t);for(;r&&zx(r)&&Zo(r);)r=ac(r,t);return r&&Nn(r)&&Zo(r)&&!Ci(r)?n:r||Ux(e)||n}const eS=async function(e){const t=this.getOffsetParent||Iu,n=this.getDimensions,r=await n(e.floating);return{reference:Qx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tS(e){return ct(e).direction==="rtl"}const nS={convertOffsetParentRelativeRectToViewportRelativeRect:Vx,getDocumentElement:xt,getClippingRect:Yx,getOffsetParent:Iu,getElementRects:eS,getClientRects:Hx,getDimensions:Xx,getScale:Pn,isElement:at,isRTL:tS};function Ru(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rS(e,t){let n=null,r;const o=xt(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,d){a===void 0&&(a=!1),d===void 0&&(d=1),s();const u=e.getBoundingClientRect(),{left:f,top:c,width:m,height:h}=u;if(a||t(),!m||!h)return;const p=Rr(c),g=Rr(o.clientWidth-(f+m)),v=Rr(o.clientHeight-(c+h)),S=Rr(f),b={rootMargin:-p+"px "+-g+"px "+-v+"px "+-S+"px",threshold:Ve(0,Zt(1,d))||1};let E=!0;function _(y){const P=y[0].intersectionRatio;if(P!==d){if(!E)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}P===1&&!Ru(u,e.getBoundingClientRect())&&i(),E=!1}try{n=new IntersectionObserver(_,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,b)}n.observe(e)}return i(!0),s}function io(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,u=Ii(e),f=o||s?[...u?sr(u):[],...t?sr(t):[]]:[];f.forEach(S=>{o&&S.addEventListener("scroll",n,{passive:!0}),s&&S.addEventListener("resize",n)});const c=u&&a?rS(u,n):null;let m=-1,h=null;i&&(h=new ResizeObserver(S=>{let[x]=S;x&&x.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!d&&h.observe(u),t&&h.observe(t));let p,g=d?tn(e):null;d&&v();function v(){const S=tn(e);g&&!Ru(g,S)&&n(),g=S,p=requestAnimationFrame(v)}return n(),()=>{var S;f.forEach(x=>{o&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),c?.(),(S=h)==null||S.disconnect(),h=null,d&&cancelAnimationFrame(p)}}const oS=Mx,sS=kx,iS=$x,aS=Lx,cS=Nx,cc=Ax,lS=jx,uS=(e,t,n)=>{const r=new Map,o={platform:nS,...n},s={...o.platform,_c:r};return Tx(e,t,{...o,platform:s})};var dS=typeof document<"u",fS=function(){},zr=dS?l.useLayoutEffect:fS;function qr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!qr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ou(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lc(e,t){const n=Ou(e);return Math.round(t*n)/n}function Uo(e){const t=l.useRef(e);return zr(()=>{t.current=e}),t}function ao(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:d,open:u}=e,[f,c]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=l.useState(r);qr(m,r)||h(r);const[p,g]=l.useState(null),[v,S]=l.useState(null),x=l.useCallback(V=>{V!==y.current&&(y.current=V,g(V))},[]),b=l.useCallback(V=>{V!==P.current&&(P.current=V,S(V))},[]),E=s||p,_=i||v,y=l.useRef(null),P=l.useRef(null),T=l.useRef(f),R=d!=null,N=Uo(d),D=Uo(o),C=Uo(u),O=l.useCallback(()=>
47{if(!y.current||!P.current)return;const V={placement:t,strategy:n,middleware:m};D.current&&(V.platform=D.current),uS(y.current,P.current,V).then(H=>{const F={...H,isPositioned:C.current!==!1};A.current&&!qr(T.current,F)&&(T.current=F,lt.flushSync(()=>{c(F)}))})},[m,t,n,D,C]);zr(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,c(V=>({...V,isPositioned:!1})))},[u]);const A=l.useRef(!1);zr(()=>(A.current=!0,()=>{A.current=!1}),[]),zr(()=>{if(E&&(y.current=E),_&&(P.current=_),E&&_){if(N.current)return N.current(E,_,O);O()}},[E,_,O,N,R]);const U=l.useMemo(()=>({reference:y,floating:P,setReference:x,setFloating:b}),[x,b]),B=l.useMemo(()=>({reference:E,floating:_}),[E,_]),Z=l.useMemo(()=>{const V={position:n,left:0,top:0};if(!B.floating)return V;const H=lc(B.floating,f.x),F=lc(B.floating,f.y);return a?{...V,transform:"translate("+H+"px, "+F+"px)",...Ou(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:F}},[n,a,B.floating,f.x,f.y]);return l.useMemo(()=>({...f,update:O,refs:U,elements:B,floatingStyles:Z}),[f,O,U,B,Z])}const pS=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?cc({element:r.current,padding:o}).fn(n):{}:r?cc({element:r,padding:o}).fn(n):{}}}},co=(e,t)=>{const n=oS(e);return{name:n.name,fn:n.fn,options:[e,t]}},lo=(e,t)=>{const n=sS(e);return{name:n.name,fn:n.fn,options:[e,t]}},uo=(e,t)=>({fn:lS(e).fn,options:[e,t]}),fo=(e,t)=>{const n=iS(e);return{name:n.name,fn:n.fn,options:[e,t]}},po=(e,t)=>{const n=aS(e);return{name:n.name,fn:n.fn,options:[e,t]}},mo=(e,t)=>{const n=cS(e);return{name:n.name,fn:n.fn,options:[e,t]}},ho=(e,t)=>{const n=pS(e);return{name:n.name,fn:n.fn,options:[e,t]}};var mS=Object.defineProperty,hS=(e,t)=>mS(e,"name",{value:t,configurable:!0});function Tu(e){const[t,n]=l.useState(void 0);return kt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const d=s.borderBoxSize,u=Array.isArray(d)?d[0]:d;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}hS(Tu,"useSize");var vS=Object.defineProperty,In=(e,t)=>vS(e,"name",{value:t,configurable:!0}),Au="Popper",[$u,Nu]=wi(Au),[hR,gS]=$u(Au),Du="PopperContent",[yS,vR]=$u(Du),bS=l.forwardRef(In(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=t,S=gS(Du,r),[x,b]=l.useState(null),E=pr(n,b),[_,y]=l.useState(null),P=Tu(_),T=P?.width??0,R=P?.height??0,N=o+(i!=="center"?"-"+i:""),D=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},C=Array.isArray(f)?f:[f],O=C.length>0,A={padding:D,boundary:C.filter(Mu),altBoundary:O},{refs:U,floatingStyles:B,placement:Z,isPositioned:V,middlewareData:H}=ao({strategy:"fixed",placement:N,whileElementsMounted:In((...G)=>io(...G,{animationFrame:p==="always"}),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[co({mainAxis:s+R,alignmentAxis:a}),u&&lo({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?uo():void 0,...A}),u&&fo({...A}),po({...A,apply:In(({elements:G,rects:ee,availableWidth:ne,availableHeight:ae})=>{const{width:pe,height:De}=ee.reference,fe=G.floating.style;fe.setProperty("--radix-popper-available-width",`${ne}px`),fe.setProperty("--radix-popper-available-height",`${ae}px`),fe.setProperty("--radix-popper-anchor-width",`${pe}px`),fe.setProperty("--radix-popper-anchor-height",`${De}px`)},"apply")}),_&&ho({element:_,padding:d}),wS({arrowWidth:T,arrowHeight:R}),h&&mo({strategy:"referenceHidden",...A,boundary:O?A.boundary:void 0})]}),F=S.setPlacementState;kt(()=>(F(Z),()=>{F(void 0)}),[Z,F]);const[ie,I]=Ri(Z),k=mr(g);kt(()=>{V&&k?.()},[V,k]);const z=H.arrow?.x,j=H.arrow?.y,q=H.arrow?.centerOffset!==0,[J,L]=l.useState();return kt(()=>{x&&L(window.getComputedStyle(x).zIndex)},[x]),w.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:V?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(yS,{scope:r,placedSide:ie,placedAlign:I,onArrowChange:y,arrowX:z,arrowY:j,shouldHideArrow:q,children:w.jsx(to.div,{"data-side":ie,"data-align":I,...v,ref:E,style:{...v.style,animation:V?v.style?.animation:"none"}})})})},"PopperContent"));function Mu(e){return e!==null}In(Mu,"isNotNull");var wS=In(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=Ri(n),c={start:"0%",center:"50%",end:"100%"}[f],m=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+d/2;let p="",g="";return u==="bottom"?(p=i?c:`${m}px`,g=`${-d}px`):u==="top"?(p=i?c:`${m}px`,g=`${r.floating.height+d}px`):u==="right"?(p=`${-d}px`,g=i?c:`${h}px`):u==="left"&&(p=`${r.floating.width+d}px`,g=i?c:`${h}px`),{data:{x:p,y:g}}}}),"transformOrigin");function Ri(e){const[t,n="center"]=e.split("-");return[t,n]}In(Ri,"getSideAndAlignFromPlacement");var xS=bS,SS=Object.defineProperty,ES=(e,t)=>SS(e,"name",{value:t,configurable:!0}),_S=l.forwardRef(ES(function(t,n){const{container:r,...o}=t,[s,i]=l.useState(!1);kt(()=>i(!0),[]);const a=r||s&&globalThis?.document?.body;return a?lt.createPortal(w.jsx(to.div,{...o,ref:n}),a):null},"Portal")),CS=Object.defineProperty,Rt=(e,t)=>
47CS(e,"name",{value:t,configurable:!0});function ku(e,t){return l.useReducer((n,r)=>t[n][r]??n,e)}Rt(ku,"useStateMachine");var ju=Rt(e=>{const{present:t,children:n}=e,r=Lu(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=zu(r.ref,Fu(o));return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null},"Presence");function Lu(e){const[t,n]=l.useState(),r=l.useRef(null),o=l.useRef(e),s=l.useRef("none"),i=l.useRef(void 0),a=e?"mounted":"unmounted",[d,u]=ku(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{d==="mounted"?(s.current=i.current??bn(r.current),i.current=void 0):s.current="none"},[d]),kt(()=>{const f=r.current,c=o.current;if(c!==e){const h=s.current,p=bn(f);e?(i.current=p,u("MOUNT")):p==="none"||f?.display==="none"?u("UNMOUNT"):u(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),kt(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,m=Rt(p=>{const v=bn(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(u("ANIMATION_END"),!o.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),h=Rt(p=>{p.target===t&&(s.current=bn(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:l.useCallback(f=>{if(f){const c=getComputedStyle(f);r.current=c,i.current=bn(c)}else r.current=null;n(f)},[])}}Rt(Lu,"usePresence");function bs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Rt(bs,"setRef");function zu(...e){const t=l.useRef(e);return t.current=e,l.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(i=>{const a=bs(i,n);return!o&&typeof a=="function"&&(o=!0),a});if(o)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():bs(r[i],null)}}},[])}Rt(zu,"useStableComposedRefs");function bn(e){return e?.animationName||"none"}Rt(bn,"getAnimationName");function Fu(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Rt(Fu,"getElementRef");var PS=Object.defineProperty,IS=(e,t)=>PS(e,"name",{value:t,configurable:!0}),RS=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),OS=l.forwardRef(IS(function(t,n){return w.jsx(to.span,{...t,ref:n,style:{...RS,...t.style}})},"VisuallyHidden")),TS=OS,AS=Object.defineProperty,Fe=(e,t)=>AS(e,"name",{value:t,configurable:!0}),[Oi,gR]=wi("Tooltip",[Nu]),$S=Nu(),NS="TooltipProvider",uc="tooltip.open",[yR,DS]=Oi(NS),MS="Tooltip",[bR,vo]=Oi(MS),Zu="TooltipPortal",[kS,jS]=Oi(Zu,{forceMount:void 0}),LS=Fe(e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=vo(Zu,t);return w.jsx(kS,{scope:t,forceMount:n,children:w.jsx(ju,{present:n||s.open,children:w.jsx(_S,{asChild:!0,container:o,children:r})})})},"TooltipPortal"),ir="TooltipContent",zS=l.forwardRef(Fe(function(t,n){const r=jS(ir,t.__scopeTooltip),{forceMount:o=r.forceMount,side:s="top",...i}=t,a=vo(ir,t.__scopeTooltip);return w.jsx(ju,{present:o||a.open,children:a.disableHoverableContent?w.jsx(Uu,{side:s,...i,ref:n}):w.jsx(FS,{side:s,...i,ref:n})})},"TooltipContent")),FS=l.forwardRef(Fe(function(t,n){const r=vo(ir,t.__scopeTooltip),o=DS(ir,t.__scopeTooltip),s=l.useRef(null),i=pr(n,s),[a,d]=l.useState(null),{trigger:u,onClose:f}=r,c=s.current,{onPointerInTransitChange:m}=o,h=l.useCallback(()=>{d(null),m(!1)},[m]),p=l.useCallback((g,v)=>{const S=g.currentTarget,x={x:g.clientX,y:g.clientY},b=Bu(x,S.getBoundingClientRect()),E=Wu(x,b),_=Vu(v.getBoundingClientRect()),y=Gu([...E,..._]);d(y),m(!0)},[m]);return l.useEffect(()=>()=>h(),[h]),l.useEffect(()=>{if(u&&c){const g=Fe(S=>p(S,c),"handleTriggerLeave"),v=Fe(S=>p(S,u),"handleContentLeave");return u.addEventListener("pointerleave",g),c.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",g),c.removeEventListener("pointerleave",v)}}},[u,c,p,h]),l.useEffect(()=>{if(a){const g=Fe(v=>{const S=v.target,x={x:v.clientX,y:v.clientY},b=u?.contains(S)||c?.contains(S),E=!Hu(x,a);b?h():E&&(h(),f())},"handleTrackPointerGrace");return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[u,c,a,f,h]),w.jsx(Uu,{...t,ref:i})},"TooltipContentHoverable")),ZS=uu("TooltipContent"),Uu=l.forwardRef(Fe(function(t,n){const{__scopeTooltip:r,children:o,"aria-label":s,id:i,onEscapeKeyDown:a,onPointerDownOutside:d,...u}=t,f=vo(ir,r),c=$S(r),{onClose:m}=f;l.useEffect(()=>(document.addEventListener(uc,m),()=>document.removeEventListener(uc,m)),[m]),l.useEffect(()=>{if(f.trigger){const p=Fe(g=>{g.target instanceof Node&&g.target.contains(f.trigger)&&m()},"handleScroll");return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[f.trigger,m]);const{setContentId:h}=f;return kt(()=>(h(i),()=>{h(void 0)}),[i,h]),w.jsx(vx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:d,onFocusOutside:p=>p.preventDefault(),onDismiss:m,children:w.jsxs(xS,{"data-state":f.stateAttribute,role:s?void 0:"tooltip",id:s?void 0:f.contentId,...c,...u,ref:n,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[w.jsx(ZS,{children:o}),s?w.jsx(TS,{id:f.contentId,role:"tooltip",children:s}):null]})})},"TooltipContentImpl"));function Bu(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Fe(Bu,"getExitSideFromRect");function Wu(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}Fe(Wu,"getPaddedExitPoints");function Vu(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}Fe(Vu,"getPointsFromRect");function Hu(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],d=t[i],u=a.x,f=a.y,c=d.x,m=d.y;f>r!=m>r&&n<(c-u)*(r-f)/(m-f)+u&&(o=!o)}return o}Fe(Hu,"isPointInPolygon");function Gu(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),Ku(t)}Fe(Gu,"getHull");function Ku(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}Fe(Ku,"getHullPresorted");var US=LS,qu=zS;const BS=l.forwardRef(({className:e,sideOffset:t=4,...n},r)=>
47w.jsx(US,{children:w.jsx(qu,{ref:r,sideOffset:t,className:Q("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...n})}));BS.displayName=qu.displayName;const WS=({className:e,from:t,...n})=>w.jsx("div",{className:Q("group flex w-full max-w-[95%] flex-col gap-2",t==="user"?"is-user ml-auto justify-end":"is-assistant",e),...n}),VS=({children:e,className:t,...n})=>w.jsx("div",{className:Q("is-user:dark flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm","group-[.is-user]:ml-auto group-[.is-user]:rounded-lg group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-foreground","group-[.is-assistant]:text-foreground",t),...n,children:e});l.createContext(null);const Ju=l.memo(({className:e,children:t,isAnimating:n,...r})=>w.jsx("div",{className:Q("size-full whitespace-pre-wrap text-sm leading-relaxed [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",e),...r,children:t}),(e,t)=>e.children===t.children&&t.isAnimating===e.isAnimating);Ju.displayName="MessageResponse";var dc=1,HS=.9,GS=.8,KS=.17,Bo=.1,Wo=.999,qS=.9999,JS=.99,YS=/[\\\/_+.#"@\[\(\{&]/,XS=/[\\\/_+.#"@\[\(\{&]/g,QS=/[\s-]/,Yu=/[\s-]/g;function ws(e,t,n,r,o,s,i){if(s===t.length)return o===e.length?dc:JS;var a=`${o},${s}`;if(i[a]!==void 0)return i[a];for(var d=r.charAt(s),u=n.indexOf(d,o),f=0,c,m,h,p;u>=0;)c=ws(e,t,n,r,u+1,s+1,i),c>f&&(u===o?c*=dc:YS.test(e.charAt(u-1))?(c*=GS,h=e.slice(o,u-1).match(XS),h&&o>0&&(c*=Math.pow(Wo,h.length))):QS.test(e.charAt(u-1))?(c*=HS,p=e.slice(o,u-1).match(Yu),p&&o>0&&(c*=Math.pow(Wo,p.length))):(c*=KS,o>0&&(c*=Math.pow(Wo,u-o))),e.charAt(u)!==t.charAt(s)&&(c*=qS)),(c<Bo&&n.charAt(u-1)===r.charAt(s+1)||r.charAt(s+1)===r.charAt(s)&&n.charAt(u-1)!==r.charAt(s))&&(m=ws(e,t,n,r,u+1,s+2,i),m*Bo>c&&(c=m*Bo)),c>f&&(f=c),u=n.indexOf(d,u+1);return i[a]=f,f}function fc(e){return e.toLowerCase().replace(Yu," ")}function eE(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ws(e,t,fc(e),fc(t),0,0,{})}function tE(e){const t=nE(e),n=l.forwardRef((r,o)=>{const{children:s,...i}=r,a=l.Children.toArray(s),d=a.find(oE);if(d){const u=d.props.children,f=a.map(c=>c===d?l.Children.count(u)>1?l.Children.only(null):l.isValidElement(u)?u.props.children:null:c);return w.jsx(t,{...i,ref:o,children:l.isValidElement(u)?l.cloneElement(u,void 0,f):null})}return w.jsx(t,{...i,ref:o,children:s})});return n.displayName=`${e}.Slot`,n}function nE(e){const t=l.forwardRef((n,r)=>{const{children:o,...s}=n;if(l.isValidElement(o)){const i=iE(o),a=sE(s,o.props);return o.type!==l.Fragment&&(a.ref=r?An(r,i):i),l.cloneElement(o,a)}return l.Children.count(o)>1?l.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var rE=Symbol("radix.slottable");function oE(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===rE}function sE(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function iE(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var aE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vt=aE.reduce((e,t)=>{const n=tE(`Primitive.${t}`),r=l.forwardRef((o,s)=>{const{asChild:i,...a}=o,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),cE=globalThis?.document?l.useLayoutEffect:()=>{},lE=Le[" useId ".trim().toString()]||(()=>{}),uE=0;function Rn(e){const[t,n]=l.useState(lE());return cE(()=>{n(r=>r??String(uE++))},[e]),t?`radix-${t}`:""}var Kn='[cmdk-group=""]',Vo='[cmdk-group-items=""]',dE='[cmdk-group-heading=""]',Xu='[cmdk-item=""]',pc=`${Xu}:not([aria-disabled="true"])`,xs="cmdk-item-select",wn="data-value",fE=(e,t,n)=>eE(e,t,n),Qu=l.createContext(void 0),vr=()=>l.useContext(Qu),ed=l.createContext(void 0),Ti=()=>l.useContext(ed),td=l.createContext(void 0),nd=l.forwardRef((e,t)=>
vendor: 9,934 bytes, line 47
47{let n=xn(()=>{var I,k;return{search:"",value:(k=(I=e.value)!=null?I:e.defaultValue)!=null?k:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=xn(()=>new Set),o=xn(()=>new Map),s=xn(()=>new Map),i=xn(()=>new Set),a=rd(e),{label:d,children:u,value:f,onValueChange:c,filter:m,shouldFilter:h,loop:p,disablePointerSelection:g=!1,vimBindings:v=!0,...S}=e,x=Rn(),b=Rn(),E=Rn(),_=l.useRef(null),y=EE();nn(()=>{if(f!==void 0){let I=f.trim();n.current.value=I,P.emit()}},[f]),nn(()=>{y(6,O)},[]);let P=l.useMemo(()=>({subscribe:I=>(i.current.add(I),()=>i.current.delete(I)),snapshot:()=>n.current,setState:(I,k,z)=>{var j,q,J,L;if(!Object.is(n.current[I],k)){if(n.current[I]=k,I==="search")C(),N(),y(1,D);else if(I==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let G=document.getElementById(E);G?G.focus():(j=document.getElementById(x))==null||j.focus()}if(y(7,()=>{var G;n.current.selectedItemId=(G=A())==null?void 0:G.id,P.emit()}),z||y(5,O),((q=a.current)==null?void 0:q.value)!==void 0){let G=k??"";(L=(J=a.current).onValueChange)==null||L.call(J,G);return}}P.emit()}},emit:()=>{i.current.forEach(I=>I())}}),[]),T=l.useMemo(()=>({value:(I,k,z)=>{var j;k!==((j=s.current.get(I))==null?void 0:j.value)&&(s.current.set(I,{value:k,keywords:z}),n.current.filtered.items.set(I,R(k,z)),y(2,()=>{N(),P.emit()}))},item:(I,k)=>(r.current.add(I),k&&(o.current.has(k)?o.current.get(k).add(I):o.current.set(k,new Set([I]))),y(3,()=>{C(),N(),n.current.value||D(),P.emit()}),()=>{s.current.delete(I),r.current.delete(I),n.current.filtered.items.delete(I);let z=A();y(4,()=>{C(),z?.getAttribute("id")===I&&D(),P.emit()})}),group:I=>(o.current.has(I)||o.current.set(I,new Set),()=>{s.current.delete(I),o.current.delete(I)}),filter:()=>a.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>a.current.disablePointerSelection,listId:x,inputId:E,labelId:b,listInnerRef:_}),[]);function R(I,k){var z,j;let q=(j=(z=a.current)==null?void 0:z.filter)!=null?j:fE;return I?q(I,n.current.search,k):0}function N(){if(!n.current.search||a.current.shouldFilter===!1)return;let I=n.current.filtered.items,k=[];n.current.filtered.groups.forEach(j=>{let q=o.current.get(j),J=0;q.forEach(L=>{let G=I.get(L);J=Math.max(G,J)}),k.push([j,J])});let z=_.current;U().sort((j,q)=>{var J,L;let G=j.getAttribute("id"),ee=q.getAttribute("id");return((J=I.get(ee))!=null?J:0)-((L=I.get(G))!=null?L:0)}).forEach(j=>{let q=j.closest(Vo);q?q.appendChild(j.parentElement===q?j:j.closest(`${Vo} > *`)):z.appendChild(j.parentElement===z?j:j.closest(`${Vo} > *`))}),k.sort((j,q)=>q[1]-j[1]).forEach(j=>{var q;let J=(q=_.current)==null?void 0:q.querySelector(`${Kn}[${wn}="${encodeURIComponent(j[0])}"]`);J?.parentElement.appendChild(J)})}function D(){let I=U().find(z=>z.getAttribute("aria-disabled")!=="true"),k=I?.getAttribute(wn);P.setState("value",k||void 0)}function C(){var I,k,z,j;if(!n.current.search||a.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let q=0;for(let J of r.current){let L=(k=(I=s.current.get(J))==null?void 0:I.value)!=null?k:"",G=(j=(z=s.current.get(J))==null?void 0:z.keywords)!=null?j:[],ee=R(L,G);n.current.filtered.items.set(J,ee),ee>0&&q++}for(let[J,L]of o.current)for(let G of L)if(n.current.filtered.items.get(G)>0){n.current.filtered.groups.add(J);break}n.current.filtered.count=q}function O(){var I,k,z;let j=A();j&&(((I=j.parentElement)==null?void 0:I.firstChild)===j&&((z=(k=j.closest(Kn))==null?void 0:k.querySelector(dE))==null||z.scrollIntoView({block:"nearest"})),j.scrollIntoView({block:"nearest"}))}function A(){var I;return(I=_.current)==null?void 0:I.querySelector(`${Xu}[aria-selected="true"]`)}function U(){var I;return Array.from(((I=_.current)==null?void 0:I.querySelectorAll(pc))||[])}function B(I){let k=U()[I];k&&P.setState("value",k.getAttribute(wn))}function Z(I){var k;let z=A(),j=U(),q=j.findIndex(L=>L===z),J=j[q+I];(k=a.current)!=null&&k.loop&&(J=q+I<0?j[j.length-1]:q+I===j.length?j[0]:j[q+I]),J&&P.setState("value",J.getAttribute(wn))}function V(I){let k=A(),z=k?.closest(Kn),j;for(;z&&!j;)z=I>0?xE(z,Kn):SE(z,Kn),j=z?.querySelector(pc);j?P.setState("value",j.getAttribute(wn)):Z(I)}let H=()=>B(U().length-1),F=I=>{I.preventDefault(),I.metaKey?H():I.altKey?V(1):Z(1)},ie=I=>{I.preventDefault(),I.metaKey?B(0):I.altKey?V(-1):Z(-1)};return l.createElement(Vt.div,{ref:t,tabIndex:-1,...S,"cmdk-root":"",onKeyDown:I=>{var k;(k=S.onKeyDown)==null||k.call(S,I);let z=I.nativeEvent.isComposing||I.keyCode===229;if(!(I.defaultPrevented||z))switch(I.key){case"n":case"j":{v&&I.ctrlKey&&F(I);break}case"ArrowDown":{F(I);break}case"p":case"k":{v&&I.ctrlKey&&ie(I);break}case"ArrowUp":{ie(I);break}case"Home":{I.preventDefault(),B(0);break}case"End":{I.preventDefault(),H();break}case"Enter":{I.preventDefault();let j=A();if(j){let q=new Event(xs);j.dispatchEvent(q)}}}}},l.createElement("label",{"cmdk-label":"",htmlFor:T.inputId,id:T.labelId,style:CE},d),go(e,I=>l.createElement(ed.Provider,{value:P},l.createElement(Qu.Provider,{value:T},I))))}),pE=l.forwardRef((e,t)=>{var n,r;let o=Rn(),s=l.useRef(null),i=l.useContext(td),a=vr(),d=rd(e),u=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:i?.forceMount;nn(()=>{if(!u)return a.item(o,i?.id)},[u]);let f=od(o,s,[e.value,e.children,s],e.keywords),c=Ti(),m=Bt(y=>y.value&&y.value===f.current),h=Bt(y=>u||a.filter()===!1?!0:y.search?y.filtered.items.get(o)>0:!0);l.useEffect(()=>{let y=s.current;if(!(!y||e.disabled))return y.addEventListener(xs,p),()=>y.removeEventListener(xs,p)},[h,e.onSelect,e.disabled]);function p(){var y,P;g(),(P=(y=d.current).onSelect)==null||P.call(y,f.current)}function g(){c.setState("value",f.current,!0)}if(!h)return null;let{disabled:v,value:S,onSelect:x,forceMount:b,keywords:E,..._}=e;return l.createElement(Vt.div,{ref:An(s,t),..._,id:o,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!m,"data-disabled":!!v,"data-selected":!!m,onPointerMove:v||a.getDisablePointerSelection()?void 0:g,onClick:v?void 0:p},e.children)}),mE=l.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:o,...s}=e,i=Rn(),a=l.useRef(null),d=l.useRef(null),u=Rn(),f=vr(),c=Bt(h=>o||f.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);nn(()=>f.group(i),[]),od(i,a,[e.value,e.heading,d]);let m=l.useMemo(()=>({id:i,forceMount:o}),[o]);return l.createElement(Vt.div,{ref:An(a,t),...s,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},n&&l.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:u},n),go(e,h=>l.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?u:void 0},l.createElement(td.Provider,{value:m},h))))}),hE=l.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,o=l.useRef(null),s=Bt(i=>!i.search);return!n&&!s?null:l.createElement(Vt.div,{ref:An(o,t),...r,"cmdk-separator":"",role:"separator"})}),vE=l.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,o=e.value!=null,s=Ti(),i=Bt(u=>u.search),a=Bt(u=>u.selectedItemId),d=vr();return l.useEffect(()=>{e.value!=null&&s.setState("search",e.value)},[e.value]),l.createElement(Vt.input,{ref:t,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":a,id:d.inputId,type:"text",value:o?e.value:i,onChange:u=>{o||s.setState("search",u.target.value),n?.(u.target.value)}})}),gE=l.forwardRef((e,t)=>{let{children:n,label:r="Suggestions",...o}=e,s=l.useRef(null),i=l.useRef(null),a=Bt(u=>u.selectedItemId),d=vr();return l.useEffect(()=>{if(i.current&&s.current){let u=i.current,f=s.current,c,m=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=u.offsetHeight;f.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return m.observe(u),()=>{cancelAnimationFrame(c),m.unobserve(u)}}},[]),l.createElement(Vt.div,{ref:An(s,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":a,"aria-label":r,id:d.listId},go(e,u=>l.createElement("div",{ref:An(i,d.listInnerRef),"cmdk-list-sizer":""},u)))}),yE=l.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:o,contentClassName:s,container:i,...a}=e;return l.createElement(vm,{open:n,onOpenChange:r},l.createElement(gm,{container:i},l.createElement(ym,{"cmdk-overlay":"",className:o}),l.createElement(bm,{"aria-label":e.label,"cmdk-dialog":"",className:s},l.createElement(nd,{ref:t,...a}))))}),bE=l.forwardRef((e,t)=>Bt(n=>n.filtered.count===0)?l.createElement(Vt.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wE=l.forwardRef((e,t)=>{let{progress:n,children:r,label:o="Loading...",...s}=e;return l.createElement(Vt.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},go(e,i=>l.createElement("div",{"aria-hidden":!0},i)))}),Ue=Object.assign(nd,{List:gE,Item:pE,Input:vE,Group:mE,Separator:hE,Dialog:yE,Empty:bE,Loading:wE});function xE(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function SE(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function rd(e){let t=l.useRef(e);return nn(()=>{t.current=e}),t}var nn=typeof window>"u"?l.useEffect:l.useLayoutEffect;function xn(e){let t=l.useRef();return t.current===void 0&&(t.current=e()),t}function Bt(e){let t=Ti(),n=()=>e(t.snapshot());return l.useSyncExternalStore(t.subscribe,n,n)}function od(e,t,n,r=[]){let o=l.useRef(),s=vr();return nn(()=>{var i;let a=(()=>{var u;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(u=f.current.textContent)==null?void 0:u.trim():o.current}})(),d=r.map(u=>u.trim());s.value(e,a,d),(i=t.current)==null||i.setAttribute(wn,a),o.current=a}),o}var EE=()=>{let[e,t]=l.useState(),n=xn(()=>new Map);return nn(()=>{n.current.forEach(r=>
47r()),n.current=new Map},[e]),(r,o)=>{n.current.set(r,o),t({})}};function _E(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function go({asChild:e,children:t},n){return e&&l.isValidElement(t)?l.cloneElement(_E(t),{ref:t.ref},n(t.props.children)):n(t)}var CE={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const PE=l.forwardRef(({className:e,...t},n)=>w.jsx(Ue,{ref:n,className:Q("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));PE.displayName=Ue.displayName;const IE=l.forwardRef(({className:e,...t},n)=>w.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[w.jsx(wm,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),w.jsx(Ue.Input,{ref:n,className:Q("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));IE.displayName=Ue.Input.displayName;const RE=l.forwardRef(({className:e,...t},n)=>w.jsx(Ue.List,{ref:n,className:Q("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));RE.displayName=Ue.List.displayName;const OE=l.forwardRef((e,t)=>w.jsx(Ue.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));OE.displayName=Ue.Empty.displayName;const TE=l.forwardRef(({className:e,...t},n)=>w.jsx(Ue.Group,{ref:n,className:Q("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",e),...t}));TE.displayName=Ue.Group.displayName;const AE=l.forwardRef(({className:e,...t},n)=>w.jsx(Ue.Separator,{ref:n,className:Q("-mx-1 h-px bg-border",e),...t}));AE.displayName=Ue.Separator.displayName;const $E=l.forwardRef(({className:e,...t},n)=>w.jsx(Ue.Item,{ref:n,className:Q("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...t}));$E.displayName=Ue.Item.displayName;var NE=Object.defineProperty,Zn=(e,t)=>NE(e,"name",{value:t,configurable:!0}),sd=!!(typeof window<"u"&&window.document&&window.document.createElement);function re(e,t,{checkForDefaultPrevented:n=!0}={}){return Zn(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}Zn(re,"composeEventHandlers");function DE(e){if(!sd)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Zn(DE,"getOwnerWindow");function Ss(e){if(!sd)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Zn(Ss,"getOwnerDocument");function id(e,t=!1){const{activeElement:n}=Ss(e);if(!n?.nodeName)return null;if(ad(n)&&n.contentDocument)return id(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=Ss(n).getElementById(r);if(o)return o}}return n}Zn(id,"getActiveElement");function ad(e){return e.tagName==="IFRAME"}Zn(ad,"isFrame");var ME=Object.defineProperty,Ai=(e,t)=>ME(e,"name",{value:t,configurable:!0});function Es(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Ai(Es,"setRef");function cd(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Es(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Es(e[o],null)}}}}Ai(cd,"composeRefs");function Ae(...e){return l.useCallback(cd(...e),e)}Ai(Ae,"useComposedRefs");var kE=Object.defineProperty,Je=(e,t)=>
47kE(e,"name",{value:t,configurable:!0});function jE(e,t){const n=l.createContext(t);n.displayName=e+"Context";const r=Je(s=>{const{children:i,...a}=s,d=l.useMemo(()=>a,Object.values(a));return w.jsx(n.Provider,{value:d,children:i})},"Provider");r.displayName=e+"Provider";function o(s,i={}){const{optional:a=!1}=i,d=l.useContext(n);if(d)return d;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Je(o,"useContext"),[r,o]}Je(jE,"createContext");function cn(e,t=[]){let n=[];function r(s,i){const a=l.createContext(i);a.displayName=s+"Context";const d=n.length;n=[...n,i];const u=Je(c=>{const{scope:m,children:h,...p}=c,g=m?.[e]?.[d]||a,v=l.useMemo(()=>p,Object.values(p));return w.jsx(g.Provider,{value:v,children:h})},"Provider");u.displayName=s+"Provider";function f(c,m,h={}){const{optional:p=!1}=h,g=m?.[e]?.[d]||a,v=l.useContext(g);if(v)return v;if(i!==void 0)return i;if(!p)throw new Error(`\`${c}\` must be used within \`${s}\``)}return Je(f,"useContext"),[u,f]}Je(r,"createContext");const o=Je(()=>{const s=n.map(i=>l.createContext(i));return Je(function(a){const d=a?.[e]||s;return l.useMemo(()=>({[`__scope${e}`]:{...a,[e]:d}}),[a,d])},"useScope")},"createScope");return o.scopeName=e,[r,ld(o,...t)]}Je(cn,"createContextScope");function ld(...e){const t=e[0];if(e.length===1)return t;const n=Je(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return Je(function(s){const i=r.reduce((a,{useScope:d,scopeName:u})=>{const c=d(s)[`__scope${u}`];return{...a,...c}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Je(ld,"composeContextScopes");var st=globalThis?.document?l.useLayoutEffect:()=>{},LE=Object.defineProperty,zE=(e,t)=>LE(e,"name",{value:t,configurable:!0}),mc=Le[" useEffectEvent ".trim().toString()],hc=Le[" useInsertionEffect ".trim().toString()];function ud(e){if(typeof mc=="function")return mc(e);const t=l.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof hc=="function"?hc(()=>{t.current=e}):st(()=>{t.current=e}),l.useMemo(()=>((...n)=>t.current?.(...n)),[])}zE(ud,"useEffectEvent");var FE=Object.defineProperty,gr=(e,t)=>FE(e,"name",{value:t,configurable:!0}),ZE=Le[" useInsertionEffect ".trim().toString()]||st;function dd({prop:e,defaultProp:t,onChange:n=gr(()=>{},"onChange"),caller:r}){const[o,s,i]=fd({defaultProp:t,onChange:n}),a=e!==void 0,d=a?e:o,u=l.useCallback(f=>{if(a){const c=pd(f)?f(e):f;c!==e&&i.current?.(c)}else s(f)},[a,e,s,i]);return[d,u]}gr(dd,"useControllableState");function fd({defaultProp:e,onChange:t}){const[n,r]=l.useState(e),o=l.useRef(n),s=l.useRef(t);return ZE(()=>{s.current=t},[t]),l.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}gr(fd,"useUncontrolledState");function pd(e){return typeof e=="function"}gr(pd,"isFunction");var vc=Symbol("RADIX:SYNC_STATE");function UE(e,t,n,r){const{prop:o,defaultProp:s,onChange:i,caller:a}=t,d=o!==void 0,u=ud(i),f=[{...n,state:s}];r&&f.push(r);const[c,m]=l.useReducer((v,S)=>{if(S.type===vc)return{...v,state:S.state};const x=e(v,S);return d&&!Object.is(x.state,v.state)&&u(x.state),x},...f),h=c.state,p=l.useRef(h);l.useEffect(()=>{p.current!==h&&(p.current=h,d||u(h))},[h,p,d]);const g=l.useMemo(()=>o!==void 0?{...c,state:o}:c,[c,o]);return l.useEffect(()=>{d&&!Object.is(o,c.state)&&m({type:vc,state:o})},[o,c.state,d]),[g,m]}gr(UE,"useControllableStateReducer");var BE=Object.defineProperty,ft=(e,t)=>BE(e,"name",{value:t,configurable:!0});function rn(e){const t=l.forwardRef((n,r)=>{let{children:o,...s}=n,i=null,a=!1;const d=[];_s(o)&&typeof Or=="function"&&(o=Or(o._payload)),l.Children.forEach(o,m=>{if(gd(m)){a=!0;const h=m;let p="child"in h.props?h.props.child:h.props.children;_s(p)&&typeof Or=="function"&&(p=Or(p._payload)),i=VE(h,p),d.push(i?.props?.children)}else d.push(m)}),i?i=l.cloneElement(i,void 0,d):!a&&l.Children.count(o)===1&&l.isValidElement(o)&&(i=o);const u=i?vd(i):void 0,f=Ae(r,u);if(!i){if(o||o===0)throw new Error(a?KE(e):GE(e));return o}const c=hd(s,i.props??{});return i.type!==l.Fragment&&(c.ref=r?f:u),l.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}ft(rn,"createSlot");var md=Symbol.for("radix.slottable");function WE(e){const t=ft(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=md,t}ft(WE,"createSlottable");var VE=ft((e,t)=>
47{if("child"in e.props){const n=e.props.child;return l.isValidElement(n)?l.cloneElement(n,void 0,e.props.children(n.props.children)):null}return l.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function hd(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}ft(hd,"mergeProps");function vd(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ft(vd,"getElementRef");function gd(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===md}ft(gd,"isSlottable");var HE=Symbol.for("react.lazy");function _s(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===HE&&"_payload"in e&&yd(e._payload)}ft(_s,"isLazyComponent");function yd(e){return typeof e=="object"&&e!==null&&"then"in e}ft(yd,"isPromiseLike");var GE=ft(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),KE=ft(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Or=Le[" use ".trim().toString()],qE=Object.defineProperty,JE=(e,t)=>qE(e,"name",{value:t,configurable:!0}),YE=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],pt=YE.reduce((e,t)=>{const n=rn(`Primitive.${t}`),r=l.forwardRef((o,s)=>{const{asChild:i,...a}=o,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function $i(e,t){e&&lt.flushSync(()=>e.dispatchEvent(t))}JE($i,"dispatchDiscreteCustomEvent");var XE=Object.defineProperty,Oe=(e,t)=>XE(e,"name",{value:t,configurable:!0});function Ni(e){const t=e+"CollectionProvider",[n,r]=cn(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=Oe(g=>{const{scope:v,children:S}=g,x=l.useRef(null),b=l.useRef(new Map).current;return w.jsx(o,{scope:v,itemMap:b,collectionRef:x,children:S})},"CollectionProvider");i.displayName=t;const a=e+"CollectionSlot",d=rn(a),u=l.forwardRef((g,v)=>{const{scope:S,children:x}=g,b=s(a,S),E=Ae(v,b.collectionRef);return w.jsx(d,{ref:E,children:x})});u.displayName=a;const f=e+"CollectionItemSlot",c="data-radix-collection-item",m=rn(f),h=l.forwardRef((g,v)=>{const{scope:S,children:x,...b}=g,E=l.useRef(null),_=Ae(v,E),y=s(f,S);return l.useEffect(()=>(y.itemMap.set(E,{ref:E,...b}),()=>{y.itemMap.delete(E)})),w.jsx(m,{[c]:"",ref:_,children:x})});h.displayName=f;function p(g){const v=s(e+"CollectionConsumer",g);return l.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${c}]`));return Array.from(v.itemMap.values()).sort((y,P)=>b.indexOf(y.ref.current)-b.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return Oe(p,"useCollection"),[{Provider:i,Slot:u,ItemSlot:h},p,r]}Oe(Ni,"createCollection");var gc=new WeakMap,we,Be,Ho=(Be=class extends Map{constructor(n){super(n);Oo(this,we);Vn(this,we,[...super.keys()]),gc.set(this,!0)}set(n,r){return gc.get(this)&&(this.has(n)?se(this,we)[se(this,we).indexOf(n)]=n:se(this,we).push(n)),super.set(n,r),this}insert(n,r,o){const s=this.has(r),i=se(this,we).length,a=Di(n);let d=a>=0?a:i+a;const u=d<0||d>=i?-1:d;if(u===this.size||s&&u===this.size-1||u===-1)return this.set(r,o),this;const f=this.size+(s?0:1);a<0&&d++;const c=[...se(this,we)];let m,h=!1;for(let p=d;p<f;p++)if(d===p){let g=c[p];c[p]===r&&(g=c[p+1]),s&&this.delete(r),m=this.get(g),this.set(r,o)}else{!h&&c[p-1]===r&&(h=!0);const g=c[h?p:p-1],v=m;m=this.get(g),this.delete(g),this.set(g,v)}return this}with(n,r,o){const s=new Be(this);return s.insert(n,r,o),s}before(n){const r=se(this,we).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const s=se(this,we).indexOf(n);return s===-1?this:this.insert(s,r,o)}after(n){let r=se(this,we).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const s=se(this,we).indexOf(n);return s===-1?this:this.insert(s+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Vn(this,we,[]),super.clear()}delete(n){const r=super.delete(n);return r&&se(this,we).splice(se(this,we).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Fr(se(this,we),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Fr(se(this,we),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return se(this,we).indexOf(n)}keyAt(n){return Fr(se(this,we),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return s;o++}}findIndex(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return o;o++}return-1}filter(n,r){const o=[];let s=0;for(const i of this)Reflect.apply(n,r,[i,s,this])&&o.push(i),s++;return new Be(o)}map(n,r){const o=[];let s=0;for(const i of this)o.push([i[0],Reflect.apply(n,r,[i,s,this])]),s++;return new Be(o)}reduce(...n){const[r,o]=n;let s=0,i=o??this.at(0);for(const a of this)s===0&&n.length===1?i=a:i=Reflect.apply(r,this,[i,a,s,this]),s++;return i}reduceRight(...n){const[r,o]=n;let s=o??this.at(-1);for(let i=this.size-1;i>=0;i--){const a=this.at(i);i===this.size-1&&n.length===1?s=a:s=Reflect.apply(r,this,[s,a,i,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new Be(r)}toReversed(){const n=new Be;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new Be(r)}slice(n,r){const o=new Be;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let i=n;i<=s;i++){const a=this.keyAt(i),d=this.get(a);o.set(a,d)}return o}every(n,r){let o=0;for(const s of this){if(!Reflect.apply(n,r,[s,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return!0;o++}return!1}},we=new WeakMap,Oe(Be,"OrderedDict"),Be);function Fr(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=bd(e,t);return n===-1?void 0:e[n]}Oe(Fr,"at");function bd(e,t){const n=e.length,r=Di(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}Oe(bd,"toSafeIndex");function Di(e){return e!==e||e===0?0:Math.trunc(e)}Oe(Di,"toSafeInteger");function QE(e){const t=e+"CollectionProvider",[n,r]=cn(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Ho,setItemMap:Oe(()=>{},"setItemMap")}),i=Oe(({state:b,...E})=>b?w.jsx(d,{...E,state:b}):w.jsx(a,{...E}),"CollectionProvider");i.displayName=t;const a=Oe(b=>{const E=v();return w.jsx(d,{...b,state:E})},"CollectionInit");a.displayName=t+"Init";const d=Oe(b=>{const{scope:E,children:_,state:y}=b,P=l.useRef(null),[T,R]=l.useState(null),N=Ae(P,R),[D,C]=y;return l.useEffect(()=>{if(!T)return;const O=Sd(()=>{});return O.observe(T,{childList:!0,subtree:!0}),()=>{O.disconnect()}},[T]),w.jsx(o,{scope:E,itemMap:D,setItemMap:C,collectionRef:N,collectionRefObject:P,collectionElement:T,children:_})},"CollectionProviderImpl");d.displayName=t+"Impl";const u=e+"CollectionSlot",f=rn(u),c=l.forwardRef((b,E)=>{const{scope:_,children:y}=b,P=s(u,_),T=Ae(E,P.collectionRef);return w.jsx(f,{ref:T,children:y})});c.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=rn(m),g=l.forwardRef((b,E)=>{const{scope:_,children:y,...P}=b,T=l.useRef(null),[R,N]=l.useState(null),D=Ae(E,T,N),C=s(m,_),{setItemMap:O}=C,A=l.useRef(P);wd(A.current,P)||(A.current=P);const U=A.current;return l.useEffect(()=>{const B=U;return O(Z=>R?Z.has(R)?Z.set(R,{...B,element:R}).toSorted(Cs):(Z.set(R,{...B,element:R}
47),Z.toSorted(Cs)):Z),()=>{O(Z=>!R||!Z.has(R)?Z:(Z.delete(R),new Ho(Z)))}},[R,U,O]),w.jsx(p,{[h]:"",ref:D,children:y})});g.displayName=m;function v(){return l.useState(new Ho)}Oe(v,"useInitCollection");function S(b){const{itemMap:E}=s(e+"CollectionConsumer",b);return E}return Oe(S,"useCollection"),[{Provider:i,Slot:c,ItemSlot:g},{createCollectionScope:r,useCollection:S,useInitCollection:v}]}Oe(QE,"createCollection");function wd(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}Oe(wd,"shallowEqual");function xd(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Oe(xd,"isElementPreceding");function Cs(e,t){return!e[1].element||!t[1].element?0:xd(e[1].element,t[1].element)?-1:1}Oe(Cs,"sortByDocumentPosition");function Sd(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Oe(Sd,"getChildListObserver");var e_=Object.defineProperty,t_=(e,t)=>e_(e,"name",{value:t,configurable:!0}),n_=l.createContext(void 0);function Ed(e){const t=l.useContext(n_);return e||t||"ltr"}t_(Ed,"useDirection");var r_=Object.defineProperty,o_=(e,t)=>r_(e,"name",{value:t,configurable:!0});function Wt(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>((...n)=>t.current?.(...n)),[])}o_(Wt,"useCallbackRef");var s_=Object.defineProperty,Pe=(e,t)=>s_(e,"name",{value:t,configurable:!0}),Ps="dismissableLayer.update",i_="dismissableLayer.pointerDownOutside",a_="dismissableLayer.focusOutside",yc,_d=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),c_=l.forwardRef(Pe(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:d,onDismiss:u,...f}=t,c=l.useContext(_d),[m,h]=l.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=l.useState({}),v=Ae(n,h),S=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=x?S.indexOf(x):-1,E=m?S.indexOf(m):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,y=E>=b,P=l.useRef(!1),T=Cd(C=>{i?.(C),d?.(C),C.defaultPrevented||u?.()},{ownerDocument:p,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:c.dismissableSurfaces,shouldHandlePointerDownOutside:l.useCallback(C=>{if(!(C instanceof Node))return!1;const O=[...c.branches].some(A=>A.contains(C));return y&&!O},[c.branches,y])}),R=Pd(C=>{if(o&&P.current)return;const O=C.target;[...c.branches].some(U=>U.contains(O))||(a?.(C),d?.(C),C.defaultPrevented||u?.())},p),N=m?E===S.length-1:!1,D=Wt(C=>{C.key==="Escape"&&(s?.(C),!C.defaultPrevented&&u&&(C.preventDefault(),u()))});return l.useEffect(()=>{if(N)return p.addEventListener("keydown",D,{capture:!0}),()=>p.removeEventListener("keydown",D,{capture:!0})},[p,N,D]),l.useEffect(()=>{if(m)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(yc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(m)),c.layers.add(m),Is(),()=>{r&&(c.layersWithOutsidePointerEventsDisabled.delete(m),c.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=yc))}},[m,p,r,c]),l.useEffect(()=>()=>{m&&(c.layers.delete(m),c.layersWithOutsidePointerEventsDisabled.delete(m),Is())},[m,c]),l.useEffect(()=>{const C=Pe(()=>g({}),"handleUpdate");return document.addEventListener(Ps,C),()=>document.removeEventListener(Ps,C)},[]),w.jsx(pt.div,{...f,ref:v,style:{pointerEvents:_?y?"auto":"none":void 0,...t.style},onFocusCapture:re(t.onFocusCapture,R.onFocusCapture),onBlurCapture:re(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:re(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function l_(){const e=l.useContext(_d),[t,n]=l.useState(null);return l.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Pe(l_,"useDismissableLayerSurface");var u_=Pe(()=>!0,"IS_TRUE");function Cd(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=u_}=t,a=Wt(e),d=l.useRef(!1),u=l.useRef(!1),f=l.useRef(new Map),c=l.useRef(()=>{});return l.useEffect(()=>{function m(){u.current=!1,o.current=!1,f.current.clear()}Pe(m,"resetOutsideInteraction");function h(){return Array.from(f.current.values()).some(Boolean)}Pe(h,"isOutsideInteractionIntercepted");function p(b){if(!u.current)return;const E=b.target;E instanceof Node&&[...s].some(y=>y.contains(E))||f.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{u.current&&c.current()},0)}Pe(p,"handleInteractionCapture");function g(b){u.current&&f.current.set(b.type,!1)}Pe(g,"handleInteractionBubble");const v=Pe(b=>{if(b.target&&!d.current){let E=function(){n.removeEventListener("click",c.current);const y=h();m(),y||Mi(i_,a,_,{discrete:!0})};if(Pe(E,"handleAndDispatchPointerDownOutsideEvent"),!i(b.target)){n.removeEventListener("click",c.current),m(),d.current=!1;return}const _={originalEvent:b};u.current=!0,o.current=r&&b.button===0,f.current.clear(),!r||b.button!==0?E():(n.removeEventListener("click",c.current),c.current=E,n.addEventListener("click",c.current,{once:!0}))}else n.removeEventListener("click",c.current),m();d.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of S)n.addEventListener(b,p,!0),n.addEventListener(b,g);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",c.current);for(const b of S)n.removeEventListener(b,p,!0),n.removeEventListener(b,g)}},[n,a,r,o,s,i]),{onPointerDownCapture:Pe(()=>d.current=!0,"onPointerDownCapture")}}Pe(Cd,"usePointerDownOutside");function Pd(e,t=globalThis?.document){const n=Wt(e),r=l.useRef(!1);return l.useEffect(()=>{const o=Pe(s=>{s.target&&!r.current&&Mi(a_,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:Pe(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Pe(()=>r.current=!1,"onBlurCapture")}}Pe(Pd,"useFocusOutside");function Is(){const e=new CustomEvent(Ps);document.dispatchEvent(e)}Pe(Is,"dispatchUpdate");function Mi(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?$i(o,s):o.dispatchEvent(s)}Pe(Mi,"handleAndDispatchCustomEvent");var d_=Object.defineProperty,ki=(e,t)=>d_(e,"name",{value:t,configurable:!0}),Tr=0,hn=null;function f_(e){return ji(),e.children}ki(f_,"FocusGuards");function ji(){l.useEffect(()=>{hn||(hn={start:Rs(),end:Rs()});const{start:e,end:t}=hn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Tr++,()=>
47{Tr===1&&(hn?.start.remove(),hn?.end.remove(),hn=null),Tr=Math.max(0,Tr-1)}},[])}ki(ji,"useFocusGuards");function Rs(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}ki(Rs,"createFocusGuard");var p_=Object.defineProperty,ke=(e,t)=>p_(e,"name",{value:t,configurable:!0}),Go="focusScope.autoFocusOnMount",Ko="focusScope.autoFocusOnUnmount",bc={bubbles:!1,cancelable:!0},m_=l.forwardRef(ke(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...a}=t,[d,u]=l.useState(null),f=Wt(s),c=Wt(i),m=l.useRef(null),h=Ae(n,u),p=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(o){let v=function(E){if(p.paused||!d)return;const _=E.target;d.contains(_)?m.current=_:_t(m.current,{select:!0})},S=function(E){if(p.paused||!d)return;const _=E.relatedTarget;_!==null&&(d.contains(_)||_t(m.current,{select:!0}))},x=function(E){if(document.activeElement===document.body)for(const y of E)y.removedNodes.length>0&&_t(d)};ke(v,"handleFocusIn"),ke(S,"handleFocusOut"),ke(x,"handleMutations"),document.addEventListener("focusin",v),document.addEventListener("focusout",S);const b=new MutationObserver(x);return d&&b.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),b.disconnect()}}},[o,d,p.paused]),l.useEffect(()=>{if(d){wc.add(p);const v=document.activeElement;if(!d.contains(v)){const x=new CustomEvent(Go,bc);d.addEventListener(Go,f),d.dispatchEvent(x),x.defaultPrevented||(Id($d(Li(d)),{select:!0}),document.activeElement===v&&_t(d))}return()=>{d.removeEventListener(Go,f),setTimeout(()=>{const x=new CustomEvent(Ko,bc);
47d.addEventListener(Ko,c),d.dispatchEvent(x),x.defaultPrevented||_t(v??document.body,{select:!0}),d.removeEventListener(Ko,c),wc.remove(p)},0)}}},[d,f,c,p]);const g=l.useCallback(v=>{if(!r&&!o||p.paused)return;const S=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(S&&x){const b=v.currentTarget,[E,_]=Rd(b);E&&_?!v.shiftKey&&x===_?(v.preventDefault(),r&&_t(E,{select:!0})):v.shiftKey&&x===E&&(v.preventDefault(),r&&_t(_,{select:!0})):x===b&&v.preventDefault()}},[r,o,p.paused]);return w.jsx(pt.div,{tabIndex:-1,...a,ref:h,onKeyDown:g})},"FocusScope"));function Id(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(_t(r,{select:t}),document.activeElement!==n)return}ke(Id,"focusFirst");function Rd(e){const t=Li(e),n=Os(t,e),r=Os(t.reverse(),e);return[n,r]}ke(Rd,"getTabbableEdges");function Li(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:ke(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}ke(Li,"getTabbableCandidates");function Os(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Od(r,{upTo:t})))return r}ke(Os,"findVisible");function Od(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}ke(Od,"isHidden");function Td(e){return e instanceof HTMLInputElement&&"select"in e}ke(Td,"isSelectableInput");function _t(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Td(e)&&t&&e.select()}}ke(_t,"focus");var wc=Ad();function Ad(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Ts(e,t),e.unshift(t)},remove(t){e=Ts(e,t),e[0]?.resume()}}}ke(Ad,"createFocusScopesStack");function Ts(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}ke(Ts,"arrayRemove");function $d(e){return e.filter(t=>t.tagName!=="A")}ke($d,"removeLinks");var h_=Object.defineProperty,v_=(e,t)=>h_(e,"name",{value:t,configurable:!0}),g_=Le[" useId ".trim().toString()]||(()=>{}),y_=0;function Nd(e){const[t,n]=l.useState(g_());return st(()=>{e||n(r=>r??String(y_++))},[e]),e||(t?`radix-${t}`:"")}v_(Nd,"useId");var b_=Object.defineProperty,w_=(e,t)=>b_(e,"name",{value:t,configurable:!0});function Dd(e){const[t,n]=l.useState(void 0);return st(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const d=s.borderBoxSize,u=Array.isArray(d)?d[0]:d;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}w_(Dd,"useSize");var x_=Object.defineProperty,Yt=(e,t)=>x_(e,"name",{value:t,configurable:!0}),Md="Popper",[kd,jd]=cn(Md),[wR,Ld]=kd(Md),S_="PopperAnchor",E_=l.forwardRef(Yt(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,i=Ld(S_,r),a=l.useRef(null),d=i.onAnchorChange,u=l.useCallback(g=>{a.current=g,g&&d(g)},[d]),f=Ae(n,u),c=l.useRef(null);l.useEffect(()=>{if(!o)return;const g=c.current;c.current=o.current,g!==c.current&&d(c.current)});const m=i.placementState&&yo(i.placementState),h=m?.[0],p=m?.[1];return o?null:w.jsx(pt.div,{"data-radix-popper-side":h,"data-radix-popper-align":p,...s,ref:f})},"PopperAnchor")),zd="PopperContent",[__,xR]=kd(zd),C_=l.forwardRef(Yt(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=t,S=Ld(zd,r),[x,b]=l.useState(null),E=Ae(n,b),[_,y]=l.useState(null),P=Dd(_),T=P?.width??0,R=P?.height??0,N=o+(i!=="center"?"-"+i:""),D=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},C=Array.isArray(f)?f:[f],O=C.length>0,A={padding:D,boundary:C.filter(Fd),altBoundary:O},{refs:U,floatingStyles:B,placement:Z,isPositioned:V,middlewareData:H}=ao({strategy:"fixed",placement:N,whileElementsMounted:Yt((...G)=>io(...G,{animationFrame:p==="always"}
47),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[co({mainAxis:s+R,alignmentAxis:a}),u&&lo({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?uo():void 0,...A}),u&&fo({...A}),po({...A,apply:Yt(({elements:G,rects:ee,availableWidth:ne,availableHeight:ae})=>{const{width:pe,height:De}=ee.reference,fe=G.floating.style;fe.setProperty("--radix-popper-available-width",`${ne}px`),fe.setProperty("--radix-popper-available-height",`${ae}px`),fe.setProperty("--radix-popper-anchor-width",`${pe}px`),fe.setProperty("--radix-popper-anchor-height",`${De}px`)},"apply")}),_&&ho({element:_,padding:d}),P_({arrowWidth:T,arrowHeight:R}),h&&mo({strategy:"referenceHidden",...A,boundary:O?A.boundary:void 0})]}),F=S.setPlacementState;st(()=>(F(Z),()=>{F(void 0)}),[Z,F]);const[ie,I]=yo(Z),k=Wt(g);st(()=>{V&&k?.()},[V,k]);const z=H.arrow?.x,j=H.arrow?.y,q=H.arrow?.centerOffset!==0,[J,L]=l.useState();return st(()=>{x&&L(window.getComputedStyle(x).zIndex)},[x]),w.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:V?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(__,{scope:r,placedSide:ie,placedAlign:I,onArrowChange:y,arrowX:z,arrowY:j,shouldHideArrow:q,children:w.jsx(pt.div,{"data-side":ie,"data-align":I,...v,ref:E,style:{...v.style,animation:V?v.style?.animation:"none"}})})})},"PopperContent"));function Fd(e){return e!==null}Yt(Fd,"isNotNull");var P_=Yt(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=yo(n),c={start:"0%",center:"50%",end:"100%"}[f],m=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+d/2;let p="",g="";return u==="bottom"?(p=i?c:`${m}px`,g=`${-d}px`):u==="top"?(p=i?c:`${m}px`,g=`${r.floating.height+d}px`):u==="right"?(p=`${-d}px`,g=i?c:`${h}px`):u==="left"&&(p=`${r.floating.width+d}px`,g=i?c:`${h}px`),{data:{x:p,y:g}}}}),"transformOrigin");function yo(e){const[t,n="center"]=e.split("-");return[t,n]}Yt(yo,"getSideAndAlignFromPlacement");var I_=E_,R_=C_,O_=Object.defineProperty,T_=(e,t)=>O_(e,"name",{value:t,configurable:!0}),A_=l.forwardRef(T_(function(t,n){const{container:r,...o}=t,[s,i]=l.useState(!1);st(()=>i(!0),[]);const a=r||s&&globalThis?.document?.body;return a?lt.createPortal(w.jsx(pt.div,{...o,ref:n}),a):null},"Portal")),$_=Object.defineProperty,Ot=(e,t)=>$_(e,"name",{value:t,configurable:!0});function Zd(e,t){return l.useReducer((n,r)=>t[n][r]??n,e)}Ot(Zd,"useStateMachine");var bo=Ot(e=>{const{present:t,children:n}=e,r=Ud(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=Bd(r.ref,Wd(o));return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null},"Presence");function Ud(e){const[t,n]=l.useState(),r=l.useRef(null),o=l.useRef(e),s=l.useRef("none"),i=l.useRef(void 0),a=e?"mounted":"unmounted",[d,u]=Zd(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{d==="mounted"?(s.current=i.current??Sn(r.current),i.current=void 0):s.current="none"},[d]),st(()=>{const f=r.current,c=o.current;if(c!==e){const h=s.current,p=Sn(f);e?(i.current=p,u("MOUNT")):p==="none"||f?.display==="none"?u("UNMOUNT"):u(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),st(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,m=Ot(p=>{const v=Sn(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(u("ANIMATION_END"),!o.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),h=Ot(p=>{p.target===t&&(s.current=Sn(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:l.useCallback(f=>{if(f){const c=getComputedStyle(f);r.current=c,i.current=Sn(c)}else r.current=null;n(f)},[])}}Ot(Ud,"usePresence");function As(e,t){if(typeof e=="function")return e(t);
47e!=null&&(e.current=t)}Ot(As,"setRef");function Bd(...e){const t=l.useRef(e);return t.current=e,l.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(i=>{const a=As(i,n);return!o&&typeof a=="function"&&(o=!0),a});if(o)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():As(r[i],null)}}},[])}Ot(Bd,"useStableComposedRefs");function Sn(e){return e?.animationName||"none"}Ot(Sn,"getAnimationName");function Wd(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Ot(Wd,"getElementRef");var N_=Object.defineProperty,zi=(e,t)=>N_(e,"name",{value:t,configurable:!0}),qo=!1;function Vd(){const[e,t]=l.useState(qo);return l.useEffect(()=>{qo||(qo=!0,t(!0))},[]),e}zi(Vd,"useIsHydrated");var Hd=Le[" useSyncExternalStore ".trim().toString()];function Gd(){return()=>{}}zi(Gd,"subscribe");function Kd(){return Hd(Gd,()=>!0,()=>!1)}zi(Kd,"useIsHydratedModern");var D_=typeof Hd=="function"?Kd:Vd,M_=Object.defineProperty,ln=(e,t)=>M_(e,"name",{value:t,configurable:!0}),Jo="rovingFocusGroup.onEntryFocus",k_={bubbles:!1,cancelable:!0},wo="RovingFocusGroup",[$s,qd,j_]=Ni(wo),[L_,Jd]=cn(wo,[j_]),[z_,F_]=L_(wo),Z_=l.forwardRef(ln(function(t,n){return w.jsx($s.Provider,{scope:t.__scopeRovingFocusGroup,children:w.jsx($s.Slot,{scope:t.__scopeRovingFocusGroup,children:w.jsx(U_,{...t,ref:n})})})},"RovingFocusGroup")),U_=l.forwardRef(ln(function(t,n){const{__scopeRovingFocusGroup:r,orientation:o,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:u,onEntryFocus:f,preventScrollOnEntryFocus:c=!1,...m}=t,h=l.useRef(null),p=Ae(n,h),g=Ed(i),[v,S]=dd({prop:a,defaultProp:d??null,onChange:u,caller:wo}),[x,b]=l.useState(!1),E=Wt(f),_=qd(r),y=l.useRef(!1),[P,T]=l.useState(0);return l.useEffect(()=>{const R=h.current;if(R)return R.addEventListener(Jo,E),()=>R.removeEventListener(Jo,E)},[E]),w.jsx(z_,{scope:r,orientation:o,dir:g,loop:s,currentTabStopId:v,onItemFocus:l.useCallback(R=>S(R),[S]),onItemShiftTab:l.useCallback(()=>b(!0),[]),onFocusableItemAdd:l.useCallback(()=>T(R=>R+1),[]),onFocusableItemRemove:l.useCallback(()=>T(R=>R-1),[]),children:w.jsx(pt.div,{tabIndex:x||P===0?-1:0,"data-orientation":o,...m,ref:p,style:{outline:"none",...t.style},onMouseDown:re(t.onMouseDown,()=>{y.current=!0}),onFocus:re(t.onFocus,R=>{const N=!y.current;if(R.target===R.currentTarget&&N&&!x){const D=new CustomEvent(Jo,k_);if(R.currentTarget.dispatchEvent(D),!D.defaultPrevented){const C=_().filter(Z=>Z.focusable),O=C.find(Z=>Z.active),A=C.find(Z=>Z.id===v),B=[O,A,...C].filter(Boolean).map(Z=>Z.ref.current);Fi(B,c)}}y.current=!1}),onBlur:re(t.onBlur,()=>b(!1))})})},"RovingFocusGroupImpl")),B_="RovingFocusGroupItem",W_=l.forwardRef(ln(function(t,n){const{__scopeRovingFocusGroup:r,focusable:o=!0,active:s=!1,tabStopId:i,children:a,...d}=t,u=Nd(),f=i||u,c=F_(B_,r),m=c.currentTabStopId===f,h=qd(r),{onFocusableItemAdd:p,onFocusableItemRemove:g,currentTabStopId:v}=c,S=D_();return st(()=>{if(!(!S||!o))return p(),()=>g()},[S,o,p,g]),l.useEffect(()=>{if(!(S||!o))return p(),()=>g()},[S,o,p,g]),w.jsx($s.ItemSlot,{scope:r,id:f,focusable:o,active:s,children:w.jsx(pt.span,{tabIndex:m?0:-1,"data-orientation":c.orientation,...d,ref:n,onMouseDown:re(t.onMouseDown,x=>{o?c.onItemFocus(f):x.preventDefault()}),onFocus:re(t.onFocus,()=>c.onItemFocus(f)),onKeyDown:re(t.onKeyDown,x=>{if(x.key==="Tab"&&x.shiftKey){c.onItemShiftTab();return}if(x.target!==x.currentTarget)return;const b=Xd(x,c.orientation,c.dir);if(b!==void 0){if(x.metaKey||x.ctrlKey||x.altKey||x.shiftKey)return;x.preventDefault();let _=h().filter(y=>y.focusable).map(y=>y.ref.current);if(b==="last")_.reverse();else if(b==="prev"||b==="next"){b==="prev"&&_.reverse();const y=_.indexOf(x.currentTarget);_=c.loop?Qd(_,y+1):_.slice(y+1)}setTimeout(()=>Fi(_))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:v!=null}):a})})},"RovingFocusGroupItem")),V_={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yd(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}ln(Yd,"getDirectionAwareKey");function Xd(e,t,n){const r=Yd(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return V_[r]}ln(Xd,"getFocusIntent");function Fi(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}
47ln(Fi,"focusFirst");function Qd(e,t){return e.map((n,r)=>e[(t+r)%e.length])}ln(Qd,"wrapArray");var H_=Z_,G_=W_,K_=Object.defineProperty,de=(e,t)=>K_(e,"name",{value:t,configurable:!0}),Ns=["Enter"," "],q_=["ArrowDown","PageUp","Home"],ef=["ArrowUp","PageDown","End"],J_=[...q_,...ef],Y_={ltr:[...Ns,"ArrowRight"],rtl:[...Ns,"ArrowLeft"]},X_={ltr:["ArrowLeft"],rtl:["ArrowRight"]},xo="Menu",[ar,Q_,eC]=Ni(xo),[un,tf]=cn(xo,[eC,jd,Jd]),nf=jd(),rf=Jd(),[SR,dn]=un(xo),[ER,yr]=un(xo),tC=l.forwardRef(de(function(t,n){const{__scopeMenu:r,...o}=t,s=nf(r);return w.jsx(I_,{...s,...o,ref:n})},"MenuAnchor")),of="MenuPortal",[nC,sf]=un(of,{forceMount:void 0}),rC=de(e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,s=dn(of,t);return w.jsx(nC,{scope:t,forceMount:n,children:w.jsx(bo,{present:n||s.open,children:w.jsx(A_,{asChild:!0,container:o,children:r})})})},"MenuPortal"),it="MenuContent",[oC,Zi]=un(it),sC=l.forwardRef(de(function(t,n){const r=sf(it,t.__scopeMenu),{forceMount:o=r.forceMount,...s}=t,i=dn(it,t.__scopeMenu),a=yr(it,t.__scopeMenu);return w.jsx(ar.Provider,{scope:t.__scopeMenu,children:w.jsx(bo,{present:o||i.open,children:w.jsx(ar.Slot,{scope:t.__scopeMenu,children:a.modal?w.jsx(iC,{...s,ref:n}):w.jsx(aC,{...s,ref:n})})})})},"MenuContent")),iC=l.forwardRef(de(function(t,n){const r=dn(it,t.__scopeMenu),o=l.useRef(null),s=Ae(n,o);return l.useEffect(()=>{const i=o.current;if(i)return Zc(i)},[]),w.jsx(Ui,{...t,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:re(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),aC=l.forwardRef(de(function(t,n){const r=dn(it,t.__scopeMenu);return w.jsx(Ui,{...t,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),cC=rn("MenuContent.ScrollLock"),Ui=l.forwardRef(de(function(t,n){const{__scopeMenu:r,loop:o=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:d,onEntryFocus:u,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:m,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...v}=t,S=dn(it,r),x=yr(it,r),b=nf(r),E=rf(r),_=Q_(r),[y,P]=l.useState(null),T=l.useRef(null),R=Ae(n,T,S.onContentChange),N=l.useRef(0),D=l.useRef(""),C=l.useRef(0),O=l.useRef(null),A=l.useRef("right"),U=l.useRef(0),B=g?Uc:l.Fragment,Z=g?{as:cC,allowPinchZoom:!0}:void 0,V=de(F=>{const ie=D.current+F,I=_().filter(L=>!L.disabled),k=document.activeElement,z=I.find(L=>L.ref.current===k)?.textValue,j=I.map(L=>L.textValue),q=pf(j,ie,z),J=I.find(L=>L.textValue===q)?.ref.current;de((function L(G){D.current=G,window.clearTimeout(N.current),G!==""&&(N.current=window.setTimeout(()=>L(""),1e3))}),"updateSearch")(ie),J&&setTimeout(()=>J.focus())},"handleTypeaheadSearch");l.useEffect(()=>()=>window.clearTimeout(N.current),[]),ji();const H=l.useCallback(F=>A.current===O.current?.side&&hf(F,O.current?.area),[]);return w.jsx(oC,{scope:r,searchRef:D,onItemEnter:l.useCallback(F=>{H(F)&&F.preventDefault()},[H]),onItemLeave:l.useCallback(F=>{H(F)||(T.current?.focus(),P(null))},[H]),onTriggerLeave:l.useCallback(F=>{H(F)&&F.preventDefault()},[H]),pointerGraceTimerRef:C,onPointerGraceIntentChange:l.useCallback(F=>{O.current=F},[]),children:w.jsx(B,{...Z,children:w.jsx(m_,{asChild:!0,trapped:s,onMountAutoFocus:re(i,F=>{F.preventDefault(),T.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:w.jsx(c_,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:f,onPointerDownOutside:c,onFocusOutside:m,onInteractOutside:h,onDismiss:p,children:w.jsx(H_,{asChild:!0,...E,dir:x.dir,orientation:"vertical",loop:o,currentTabStopId:y,onCurrentTabStopIdChange:P,onEntryFocus:re(u,F=>{x.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:w.jsx(R_,{role:"menu","aria-orientation":"vertical","data-state":Wi(S.open),"data-radix-menu-content":"",dir:x.dir,...b,...v,ref:R,style:{outline:"none",...v.style},onKeyDown:re(v.onKeyDown,F=>{const I=F.target.closest("[data-radix-menu-content]")===F.currentTarget,k=F.ctrlKey||F.altKey||F.metaKey,z=F.key.length===1;
47I&&(F.key==="Tab"&&F.preventDefault(),!k&&z&&V(F.key));const j=T.current;if(F.target!==j||!J_.includes(F.key))return;F.preventDefault();const J=_().filter(L=>!L.disabled).map(L=>L.ref.current);ef.includes(F.key)&&J.reverse(),df(J)}),onBlur:re(t.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(N.current),D.current="")}),onPointerMove:re(t.onPointerMove,Dn(F=>{const ie=F.target,I=U.current!==F.clientX;if(F.currentTarget.contains(ie)&&I){const k=F.clientX>U.current?"right":"left";A.current=k,U.current=F.clientX}}))})})})})})})},"MenuContentImpl")),lC=l.forwardRef(de(function(t,n){const{__scopeMenu:r,...o}=t;return w.jsx(pt.div,{...o,ref:n})},"MenuLabel")),Ds="MenuItem",xc="menu.itemSelect",Bi=l.forwardRef(de(function(t,n){const{disabled:r=!1,onSelect:o,...s}=t,i=l.useRef(null),a=yr(Ds,t.__scopeMenu),d=Zi(Ds,t.__scopeMenu),u=Ae(n,i),f=l.useRef(!1),c=de(()=>{const m=i.current;if(!r&&m){const h=new CustomEvent(xc,{bubbles:!0,cancelable:!0});m.addEventListener(xc,p=>o?.(p),{once:!0}),$i(m,h),h.defaultPrevented?f.current=!1:a.onClose()}},"handleSelect");return w.jsx(af,{...s,ref:u,disabled:r,onClick:re(t.onClick,c),onPointerDown:m=>{t.onPointerDown?.(m),f.current=!0},onPointerUp:re(t.onPointerUp,m=>{f.current||m.currentTarget?.click()}),onKeyDown:re(t.onKeyDown,m=>{r||m.target!==m.currentTarget||d.searchRef.current!==""&&m.key===" "||Ns.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})},"MenuItem")),af=l.forwardRef(de(function(t,n){const{__scopeMenu:r,disabled:o=!1,textValue:s,...i}=t,a=Zi(Ds,r),d=rf(r),u=l.useRef(null),f=Ae(n,u),[c,m]=l.useState(!1),[h,p]=l.useState("");return l.useEffect(()=>{const g=u.current;g&&p((g.textContent??"").trim())},[i.children]),w.jsx(ar.ItemSlot,{scope:r,disabled:o,textValue:s??h,children:w.jsx(G_,{asChild:!0,...d,focusable:!o,children:w.jsx(pt.div,{role:"menuitem","data-highlighted":c?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...i,ref:f,onPointerMove:re(t.onPointerMove,Dn(g=>{o?a.onItemLeave(g):(a.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(t.onPointerLeave,Dn(g=>a.onItemLeave(g))),onFocus:re(t.onFocus,()=>m(!0)),onBlur:re(t.onBlur,()=>m(!1))})})})},"MenuItemImpl")),uC=l.forwardRef(de(function(t,n){const{checked:r=!1,onCheckedChange:o,...s}=t;return w.jsx(lf,{scope:t.__scopeMenu,checked:r,children:w.jsx(Bi,{role:"menuitemcheckbox","aria-checked":cr(r)?"mixed":r,...s,ref:n,"data-state":So(r),onSelect:re(s.onSelect,()=>o?.(cr(r)?!0:!r),{checkForDefaultPrevented:!1})})})},"MenuCheckboxItem")),dC="MenuRadioGroup",[_R,fC]=un(dC,{value:void 0,onValueChange:de(()=>{},"onValueChange")}),pC="MenuRadioItem",mC=l.forwardRef(de(function(t,n){const{value:r,...o}=t,s=fC(pC,t.__scopeMenu),i=r===s.value;return w.jsx(lf,{scope:t.__scopeMenu,checked:i,children:w.jsx(Bi,{role:"menuitemradio","aria-checked":i,...o,ref:n,"data-state":So(i),onSelect:re(o.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})},"MenuRadioItem")),cf="MenuItemIndicator",[lf,hC]=un(cf,{checked:!1}),vC=l.forwardRef(de(function(t,n){const{__scopeMenu:r,forceMount:o,...s}=t,i=hC(cf,r);return w.jsx(bo,{present:o||cr(i.checked)||i.checked===!0,children:w.jsx(pt.span,{...s,ref:n,"data-state":So(i.checked)})})},"MenuItemIndicator")),gC=l.forwardRef(de(function(t,n){const{__scopeMenu:r,...o}=t;return w.jsx(pt.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})},"MenuSeparator")),yC="MenuSub",[CR,uf]=un(yC),Ar="MenuSubTrigger",bC=l.forwardRef(de(function(t,n){const r=dn(Ar,t.__scopeMenu),o=yr(Ar,t.__scopeMenu),s=uf(Ar,t.__scopeMenu),i=Zi(Ar,t.__scopeMenu),a=l.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:u}=i,f={__scopeMenu:t.__scopeMenu},c=l.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);l.useEffect(()=>c,[c]),l.useEffect(()=>{const h=d.current;return()=>{window.clearTimeout(h),u(null)}},[d,u]);const m=Ae(n,s.onTriggerChange);return w.jsx(tC,{asChild:!0,...f,children:w.jsx(af,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?s.contentId:void 0,"data-state":Wi(r.open),...t,ref:m,onClick:h=>{t.onClick?.(h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focu
47s(),r.open||r.onOpenChange(!0))},onPointerMove:re(t.onPointerMove,Dn(h=>{i.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!r.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),c()},100))})),onPointerLeave:re(t.onPointerLeave,Dn(h=>{c();const p=r.content?.getBoundingClientRect();if(p){const g=r.content?.dataset.side,v=g==="right",S=v?-5:5,x=p[v?"left":"right"],b=p[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+S,y:h.clientY},{x,y:p.top},{x:b,y:p.top},{x:b,y:p.bottom},{x,y:p.bottom}],side:g}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:re(t.onKeyDown,h=>{t.disabled||h.target!==h.currentTarget||i.searchRef.current!==""&&h.key===" "||Y_[o.dir].includes(h.key)&&(r.onOpenChange(!0),r.content?.focus(),h.preventDefault())})})})},"MenuSubTrigger")),wC="MenuSubContent",xC=l.forwardRef(de(function(t,n){const r=sf(it,t.__scopeMenu),{forceMount:o=r.forceMount,align:s="start",...i}=t,a=dn(it,t.__scopeMenu),d=yr(it,t.__scopeMenu),u=uf(wC,t.__scopeMenu),f=l.useRef(null),c=Ae(n,f);return w.jsx(ar.Provider,{scope:t.__scopeMenu,children:w.jsx(bo,{present:o||a.open,children:w.jsx(ar.Slot,{scope:t.__scopeMenu,children:w.jsx(Ui,{id:u.contentId,"aria-labelledby":u.triggerId,...i,ref:c,align:s,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:m=>{d.isUsingKeyboardRef.current&&f.current?.focus(),m.preventDefault()},onCloseAutoFocus:m=>m.preventDefault(),onFocusOutside:re(t.onFocusOutside,m=>{m.target!==u.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:re(t.onEscapeKeyDown,m=>{d.onClose(),m.preventDefault()}),onKeyDown:re(t.onKeyDown,m=>{const h=m.currentTarget.contains(m.target),p=X_[d.dir].includes(m.key);h&&p&&(a.onOpenChange(!1),u.trigger?.focus(),m.preventDefault())})})})})})},"MenuSubContent"));function Wi(e){return e?"open":"closed"}de(Wi,"getOpenState");function cr(e){return e==="indeterminate"}de(cr,"isIndeterminate");function So(e){return cr(e)?"indeterminate":e?"checked":"unchecked"}de(So,"getCheckedState");function df(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}de(df,"focusFirst");function ff(e,t){return e.map((n,r)=>e[(t+r)%e.length])}de(ff,"wrapArray");function pf(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=ff(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const d=i.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}de(pf,"getNextMatch");function mf(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s],d=t[i],u=a.x,f=a.y,c=d.x,m=d.y;f>r!=m>r&&n<(c-u)*(r-f)/(m-f)+u&&(o=!o)}return o}de(mf,"isPointInPolygon");function hf(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return mf(n,t)}de(hf,"isPointerInGraceArea");function Dn(e){return t=>t.pointerType==="mouse"?e(t):void 0}de(Dn,"whenMouse");var SC=rC,EC=sC,_C=lC,CC=Bi,PC=uC,IC=mC,RC=vC,OC=gC,TC=bC,AC=xC,$C=Object.defineProperty,St=(e,t)=>$C(e,"name",{value:t,configurable:!0}),vf="DropdownMenu",[NC,PR]=cn(vf,[tf]),Et=tf(),[IR,DC]=NC(vf),MC=St(e=>{const{__scopeDropdownMenu:t,...n}=e,r=Et(t);return w.jsx(SC,{...r,...n})},"DropdownMenuPortal"),kC="DropdownMenuContent",jC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=DC(kC,r),i=Et(r),a=l.useRef(!1);return w.jsx(EC,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...o,ref:n,onCloseAutoFocus:re(t.onCloseAutoFocus,d=>{a.current||s.triggerRef.current?.focus(),a.current=!1,d.preventDefault()}),onInteractOutside:re(t.onInteractOutside,d=>{const u=d.detail.originalEvent,f=u.button===0&&u.ctrlKey===!0,c=u.button===2||f;(!s.modal||c)&&(a.current=!0)}),style:{...t.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)"}})},"DropdownMenuContent")),LC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(_C,{...s,...o,ref:n})},"DropdownMenuLabel")),zC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(CC,{...s,...o,ref:n})},"DropdownMenuItem")),FC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(PC,{...s,...o,ref:n})},"DropdownMenuCheckboxItem")),ZC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(IC,{...s,...o,ref:n})},"DropdownMenuRadioItem")),UC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(RC,{...s,...o,ref:n})},"DropdownMenuItemIndicator")),BC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(OC,{...s,...o,ref:n})},"DropdownMenuSeparator")),WC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(TC,{...s,...o,ref:n})},"DropdownMenuSubTrigger")),VC=l.forwardRef(St(function(t,n){const{__scopeDropdownMenu:r,...o}=t,s=Et(r);return w.jsx(AC,{...s,...o,ref:n,style:{...t.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)"}})},"DropdownMenuSubContent")),HC=MC,gf=jC,yf=LC,bf=zC,wf=FC,xf=ZC,Sf=UC,Ef=BC,_f=WC,Cf=VC;const GC=l.forwardRef(({className:e,inset:t,children:n,...r},o)=>w.jsxs(_f,{ref:o,className:Q("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t&&"pl-8",e),...r,children:[n,w.jsx(um,{className:"ml-auto"})]}));GC.displayName=_f.displayName;const KC=l.forwardRef(({className:e,...t},n)=>w.jsx(Cf,{ref:n,className:Q("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]:sli
47de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin]",e),...t}));KC.displayName=Cf.displayName;const qC=l.forwardRef(({className:e,sideOffset:t=4,...n},r)=>w.jsx(HC,{children:w.jsx(gf,{ref:r,sideOffset:t,className:Q("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-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 origin-[--radix-dropdown-menu-content-transform-origin]",e),...n})}));qC.displayName=gf.displayName;const JC=l.forwardRef(({className:e,inset:t,...n},r)=>w.jsx(bf,{ref:r,className:Q("relative flex cursor-default select-none items-center gap-2 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 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));JC.displayName=bf.displayName;const YC=l.forwardRef(({className:e,children:t,checked:n,...r},o)=>w.jsxs(wf,{ref:o,className:Q("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:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(Sf,{children:w.jsx(si,{className:"h-4 w-4"})})}),t]}));YC.displayName=wf.displayName;const XC=l.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(xf,{ref:r,className:Q("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:[w.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(Sf,{children:w.jsx(Cm,{className:"h-2 w-2 fill-current"})})}),t]}));XC.displayName=xf.displayName;const QC=l.forwardRef(({className:e,inset:t,...n},r)=>w.jsx(yf,{ref:r,className:Q("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));QC.displayName=yf.displayName;const e0=l.forwardRef(({className:e,...t},n)=>w.jsx(Ef,{ref:n,className:Q("-mx-1 my-1 h-px bg-muted",e),...t}));e0.displayName=Ef.displayName;var t0=Object.defineProperty,Un=(e,t)=>t0(e,"name",{value:t,configurable:!0}),Pf=!!(typeof window<"u"&&window.document&&window.document.createElement);function jt(e,t,{checkForDefaultPrevented:n=!0}={}){return Un(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}Un(jt,"composeEventHandlers");function n0(e){if(!Pf)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Un(n0,"getOwnerWindow");function Ms(e){if(!Pf)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Un(Ms,"getOwnerDocument");function If(e,t=!1){const{activeElement:n}=Ms(e);if(!n?.nodeName)return null;if(Rf(n)&&n.contentDocument)return If(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=Ms(n).getElementById(r);if(o)return o}}return n}Un(If,"getActiveElement");function Rf(e){return e.tagName==="IFRAME"}Un(Rf,"isFrame");var r0=Object.defineProperty,Ye=(e,t)=>r0(e,"name",{value:t,configurable:!0});function o0(e,t){const n=l.createContext(t);n.displayName=e+"Context";const r=Ye(s=>{const{children:i,...a}=s,d=l.useMemo(()=>a,Object.values(a));return w.jsx(n.Provider,{value:d,children:i})},"Provider");r.displayName=e+"Provider";function o(s,i={}){const{optional:a=!1}=i,d=l.useContext(n);if(d)return d;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Ye(o,"useContext"),[r,o]}Ye(o0,"createContext");function Vi(e,t=[]){let n=[];function r(s,i){const a=l.createContext(i);a.displayName=s+"Context";const d=n.length;n=[...n,i];const u=Ye(c=>{const{scope:m,children:h,...p}=c,g=m?.[e]?.[d]||a,v=l.useMemo(()=>p,Object.values(p));return w.jsx(g.Provider,{value:v,children:h})},"Provider");u.displayName=s+"Provider";function f(c,m,h={}){const{optional:p=!1}=h,g=m?.[e]?.[d]||a,v=l.useContext(g);if(v)return v;if(i!==void 0)return i;if(!p)throw new Error(`\`${c}\` must be used within \`${s}\``)}return Ye(f,"useContext"),[u,f]}Ye(r,"createContext");const o=Ye(()=>{const s=n.map(i=>l.createContext(i));return Ye(function(a){const d=a?.[e]||s;return l.useMemo(()=>({[`__scope${e}`]:{...a,[e]:d}}),[a,d])},"useScope")},"createScope");return o.scopeName=e,[r,Of(o,...t)]}Ye(Vi,"createContextScope");function Of(...e){const t=e[0];if(e.length===1)return t;const n=Ye(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return Ye(function(s){const i=r.reduce((a,{useScope:d,scopeName:u})=>{const c=d(s)[`__scope${u}`];return{...a,...c}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Ye(Of,"composeContextScopes");var On=globalThis?.document?l.useLayoutEffect:()=>{},s0=Object.defineProperty,Hi=(e,t)=>s0(e,"name",{value:t,configurable:!0});function ks(e,t){if(typeof e=="function")return e(t);
47e!=null&&(e.current=t)}Hi(ks,"setRef");function Tf(...e){return t=>{let n=!1;const r=e.map(o=>{const s=ks(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():ks(e[o],null)}}}}Hi(Tf,"composeRefs");function br(...e){return l.useCallback(Tf(...e),e)}Hi(br,"useComposedRefs");var i0=Object.defineProperty,mt=(e,t)=>i0(e,"name",{value:t,configurable:!0});function Af(e){const t=l.forwardRef((n,r)=>{let{children:o,...s}=n,i=null,a=!1;const d=[];js(o)&&typeof $r=="function"&&(o=$r(o._payload)),l.Children.forEach(o,m=>{if(Mf(m)){a=!0;const h=m;let p="child"in h.props?h.props.child:h.props.children;js(p)&&typeof $r=="function"&&(p=$r(p._payload)),i=c0(h,p),d.push(i?.props?.children)}else d.push(m)}),i?i=l.cloneElement(i,void 0,d):!a&&l.Children.count(o)===1&&l.isValidElement(o)&&(i=o);const u=i?Df(i):void 0,f=br(r,u);if(!i){if(o||o===0)throw new Error(a?d0(e):u0(e));return o}const c=Nf(s,i.props??{});return i.type!==l.Fragment&&(c.ref=r?f:u),l.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}mt(Af,"createSlot");var $f=Symbol.for("radix.slottable");function a0(e){const t=mt(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=$f,t}mt(a0,"createSlottable");var c0=mt((e,t)=>{if("child"in e.props){const n=e.props.child;return l.isValidElement(n)?l.cloneElement(n,void 0,e.props.children(n.props.children)):null}return l.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function Nf(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}mt(Nf,"mergeProps");function Df(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}mt(Df,"getElementRef");function Mf(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$f}mt(Mf,"isSlottable");var l0=Symbol.for("react.lazy");function js(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===l0&&"_payload"in e&&kf(e._payload)}mt(js,"isLazyComponent");function kf(e){return typeof e=="object"&&e!==null&&"then"in e}mt(kf,"isPromiseLike");var u0=mt(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),d0=mt(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),$r=Le[" use ".trim().toString()],f0=Object.defineProperty,p0=(e,t)=>f0(e,"name",{value:t,configurable:!0}),m0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],jf=m0.reduce((e,t)=>{const n=Af(`Primitive.${t}`),r=l.forwardRef((o,s)=>{const{asChild:i,...a}=o,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lf(e,t){e&&lt.flushSync(()=>e.dispatchEvent(t))}p0(Lf,"dispatchDiscreteCustomEvent");var h0=Object.defineProperty,v0=(e,t)=>h0(e,"name",{value:t,configurable:!0});function wr(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>((...n)=>t.current?.(...n)),[])}v0(wr,"useCallbackRef");var g0=Object.defineProperty,y0=(e,t)=>g0(e,"name",{value:t,configurable:!0});function zf(e){const[t,n]=l.useState(void 0);return On(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const d=s.borderBoxSize,u=Array.isArray(d)?d[0]:d;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}y0(zf,"useSize");var b0=Object.defineProperty,Tn=(e,t)=>b0(e,"name",{value:t,configurable:!0}),Ff="Popper",[Zf,Uf]=Vi(Ff),[RR,w0]=Zf(Ff),Bf="PopperContent",[x0,OR]=Zf(Bf),S0=l.forwardRef(Tn(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=t,S=w0(Bf,r),[x,b]=l.useState(null),E=br(n,b),[_,y]=l.useState(null),P=zf(_),T=P?.width??0,R=P?.height??0,N=o+(i!=="center"?"-"+i:""),D=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},C=Array.isArray(f)?f:[f],O=C.length>0,A={padding:D,boundary:C.filter(Wf),altBoundary:O},{refs:U,floatingStyles:B,placement:Z,isPositioned:V,middlewareData:H}=ao({strategy:"fixed",placement:N,whileElementsMounted:Tn((...G)=>io(...G,{animationFrame:p==="always"}
47),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[co({mainAxis:s+R,alignmentAxis:a}),u&&lo({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?uo():void 0,...A}),u&&fo({...A}),po({...A,apply:Tn(({elements:G,rects:ee,availableWidth:ne,availableHeight:ae})=>{const{width:pe,height:De}=ee.reference,fe=G.floating.style;fe.setProperty("--radix-popper-available-width",`${ne}px`),fe.setProperty("--radix-popper-available-height",`${ae}px`),fe.setProperty("--radix-popper-anchor-width",`${pe}px`),fe.setProperty("--radix-popper-anchor-height",`${De}px`)},"apply")}),_&&ho({element:_,padding:d}),E0({arrowWidth:T,arrowHeight:R}),h&&mo({strategy:"referenceHidden",...A,boundary:O?A.boundary:void 0})]}),F=S.setPlacementState;On(()=>(F(Z),()=>{F(void 0)}),[Z,F]);const[ie,I]=Gi(Z),k=wr(g);On(()=>{V&&k?.()},[V,k]);const z=H.arrow?.x,j=H.arrow?.y,q=H.arrow?.centerOffset!==0,[J,L]=l.useState();return On(()=>{x&&L(window.getComputedStyle(x).zIndex)},[x]),w.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:V?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(x0,{scope:r,placedSide:ie,placedAlign:I,onArrowChange:y,arrowX:z,arrowY:j,shouldHideArrow:q,children:w.jsx(jf.div,{"data-side":ie,"data-align":I,...v,ref:E,style:{...v.style,animation:V?v.style?.animation:"none"}})})})},"PopperContent"));function Wf(e){return e!==null}Tn(Wf,"isNotNull");var E0=Tn(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=Gi(n),c={start:"0%",center:"50%",end:"100%"}[f],m=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+d/2;let p="",g="";return u==="bottom"?(p=i?c:`${m}px`,g=`${-d}px`):u==="top"?(p=i?c:`${m}px`,g=`${r.floating.height+d}px`):u==="right"?(p=`${-d}px`,g=i?c:`${h}px`):u==="left"&&(p=`${r.floating.width+d}px`,g=i?c:`${h}px`),{data:{x:p,y:g}}}}),"transformOrigin");function Gi(e){const[t,n="center"]=e.split("-");return[t,n]}Tn(Gi,"getSideAndAlignFromPlacement");var _0=S0,C0=Object.defineProperty,Tt=(e,t)=>C0(e,"name",{value:t,configurable:!0});function Vf(e,t){return l.useReducer((n,r)=>t[n][r]??n,e)}Tt(Vf,"useStateMachine");var P0=Tt(e=>{const{present:t,children:n}=e,r=Hf(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=Gf(r.ref,Kf(o));return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null},"Presence");function Hf(e){const[t,n]=l.useState(),r=l.useRef(null),o=l.useRef(e),s=l.useRef("none"),i=l.useRef(void 0),a=e?"mounted":"unmounted",[d,u]=Vf(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{d==="mounted"?(s.current=i.current??En(r.current),i.current=void 0):s.current="none"},[d]),On(()=>{const f=r.current,c=o.current;if(c!==e){const h=s.current,p=En(f);e?(i.current=p,u("MOUNT")):p==="none"||f?.display==="none"?u("UNMOUNT"):u(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),On(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,m=Tt(p=>{const v=En(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(u("ANIMATION_END"),!o.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),h=Tt(p=>{p.target===t&&(s.current=En(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:l.useCallback(f=>{if(f){const c=getComputedStyle(f);r.current=c,i.current=En(c)}else r.current=null;n(f)},[])}}Tt(Hf,"usePresence");function Ls(e,t){if(typeof e=="function")return e(t);
47e!=null&&(e.current=t)}Tt(Ls,"setRef");function Gf(...e){const t=l.useRef(e);return t.current=e,l.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(i=>{const a=Ls(i,n);return!o&&typeof a=="function"&&(o=!0),a});if(o)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():Ls(r[i],null)}}},[])}Tt(Gf,"useStableComposedRefs");function En(e){return e?.animationName||"none"}Tt(En,"getAnimationName");function Kf(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}Tt(Kf,"getElementRef");var I0=Object.defineProperty,Ie=(e,t)=>I0(e,"name",{value:t,configurable:!0}),zs="dismissableLayer.update",R0="dismissableLayer.pointerDownOutside",O0="dismissableLayer.focusOutside",Sc,qf=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),T0=l.forwardRef(Ie(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:d,onDismiss:u,...f}=t,c=l.useContext(qf),[m,h]=l.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=l.useState({}),v=br(n,h),S=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=x?S.indexOf(x):-1,E=m?S.indexOf(m):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,y=E>=b,P=l.useRef(!1),T=Jf(C=>{i?.(C),d?.(C),C.defaultPrevented||u?.()},{ownerDocument:p,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:c.dismissableSurfaces,shouldHandlePointerDownOutside:l.useCallback(C=>{if(!(C instanceof Node))return!1;const O=[...c.branches].some(A=>A.contains(C));return y&&!O},[c.branches,y])}),R=Yf(C=>{if(o&&P.current)return;const O=C.target;[...c.branches].some(U=>U.contains(O))||(a?.(C),d?.(C),C.defaultPrevented||u?.())},p),N=m?E===S.length-1:!1,D=wr(C=>{C.key==="Escape"&&(s?.(C),!C.defaultPrevented&&u&&(C.preventDefault(),u()))});return l.useEffect(()=>{if(N)return p.addEventListener("keydown",D,{capture:!0}),()=>p.removeEventListener("keydown",D,{capture:!0})},[p,N,D]),l.useEffect(()=>{if(m)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Sc=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(m)),c.layers.add(m),Fs(),()=>{r&&(c.layersWithOutsidePointerEventsDisabled.delete(m),c.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=Sc))}},[m,p,r,c]),l.useEffect(()=>()=>{m&&(c.layers.delete(m),c.layersWithOutsidePointerEventsDisabled.delete(m),Fs())},[m,c]),l.useEffect(()=>{const C=Ie(()=>g({}),"handleUpdate");return document.addEventListener(zs,C),()=>document.removeEventListener(zs,C)},[]),w.jsx(jf.div,{...f,ref:v,style:{pointerEvents:_?y?"auto":"none":void 0,...t.style},onFocusCapture:jt(t.onFocusCapture,R.onFocusCapture),onBlurCapture:jt(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:jt(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function A0(){const e=l.useContext(qf),[t,n]=l.useState(null);return l.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Ie(A0,"useDismissableLayerSurface");var $0=Ie(()=>!0,"IS_TRUE");function Jf(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=$0}=t,a=wr(e),d=l.useRef(!1),u=l.useRef(!1),f=l.useRef(new Map),c=l.useRef(()=>{});return l.useEffect(()=>{function m(){u.current=!1,o.current=!1,f.current.clear()}Ie(m,"resetOutsideInteraction");function h(){return Array.from(f.current.values()).some(Boolean)}Ie(h,"isOutsideInteractionIntercepted");function p(b){if(!u.current)return;const E=b.target;E instanceof Node&&[...s].some(y=>y.contains(E))||f.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{u.current&&c.current()},0)}Ie(p,"handleInteractionCapture");function g(b){u.current&&f.current.set(b.type,!1)}Ie(g,"handleInteractionBubble");const v=Ie(b=>{if(b.target&&!d.current){let E=function(){n.removeEventListener("click",c.current);const y=h();m(),y||Ki(R0,a,_,{discrete:!0})};if(Ie(E,"handleAndDispatchPointerDownOutsideEvent"),!i(b.target)){n.removeEventListener("click",c.current),m(),d.current=!1;return}const _={originalEvent:b};u.current=!0,o.current=r&&b.button===0,f.current.clear(),!r||b.button!==0?E():(n.removeEventListener("click",c.current),c.current=E,n.addEventListener("click",c.current,{once:!0}))}else n.removeEventListener("click",c.current),m();d.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of S)n.addEventListener(b,p,!0),n.addEventListener(b,g);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",c.current);for(const b of S)n.removeEventListener(b,p,!0),n.removeEventListener(b,g)}},[n,a,r,o,s,i]),{onPointerDownCapture:Ie(()=>d.current=!0,"onPointerDownCapture")}}Ie(Jf,"usePointerDownOutside");
47function Yf(e,t=globalThis?.document){const n=wr(e),r=l.useRef(!1);return l.useEffect(()=>{const o=Ie(s=>{s.target&&!r.current&&Ki(O0,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:Ie(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Ie(()=>r.current=!1,"onBlurCapture")}}Ie(Yf,"useFocusOutside");function Fs(){const e=new CustomEvent(zs);document.dispatchEvent(e)}Ie(Fs,"dispatchUpdate");function Ki(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Lf(o,s):o.dispatchEvent(s)}Ie(Ki,"handleAndDispatchCustomEvent");var N0=Object.defineProperty,Mn=(e,t)=>N0(e,"name",{value:t,configurable:!0}),Yo,Xf="HoverCard",[Qf,TR]=Vi(Xf,[Uf]),D0=Uf(),[AR,ep]=Qf(Xf),M0="HoverCardPortal",[$R,k0]=Qf(M0,{forceMount:void 0}),Zs="HoverCardContent",j0=l.forwardRef(Mn(function(t,n){const r=k0(Zs,t.__scopeHoverCard),{forceMount:o=r.forceMount,...s}=t,i=ep(Zs,t.__scopeHoverCard);return w.jsx(P0,{present:o||i.open,children:w.jsx(L0,{"data-state":i.open?"open":"closed",...s,onPointerEnter:jt(t.onPointerEnter,Us(i.onOpen)),onPointerLeave:jt(t.onPointerLeave,Us(i.onClose)),ref:n})})},"HoverCardContent")),L0=l.forwardRef(Mn(function(t,n){const{__scopeHoverCard:r,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:a,...d}=t,u=ep(Zs,r),f=D0(r),c=l.useRef(null),m=br(n,c),[h,p]=l.useState(!1);return l.useEffect(()=>{if(h){const g=document.body;return Yo=g.style.userSelect||g.style.webkitUserSelect,g.style.userSelect="none",g.style.webkitUserSelect="none",()=>{g.style.userSelect=Yo,g.style.webkitUserSelect=Yo}}},[h]),l.useEffect(()=>{if(c.current){const g=Mn(()=>{p(!1),u.isPointerDownOnContentRef.current=!1,setTimeout(()=>{document.getSelection()?.toString()!==""&&(u.hasSelectionRef.current=!0)})},"handlePointerUp");return document.addEventListener("pointerup",g),()=>{document.removeEventListener("pointerup",g),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!1}}},[u.isPointerDownOnContentRef,u.hasSelectionRef]),l.useEffect(()=>{c.current&&tp(c.current).forEach(v=>v.setAttribute("tabindex","-1"))}),w.jsx(T0,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:a,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:jt(i,g=>{g.preventDefault()}),onDismiss:u.onDismiss,children:w.jsx(_0,{...f,...d,onPointerDown:jt(d.onPointerDown,g=>{g.currentTarget.contains(g.target)&&p(!0),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!0}),ref:m,style:{...d.style,userSelect:h?"text":void 0,WebkitUserSelect:h?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})},"HoverCardContentImpl"));function Us(e){return t=>t.pointerType==="touch"?void 0:e()}Mn(Us,"excludeTouch");function tp(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Mn(r=>r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP,"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}Mn(tp,"getTabbableNodes");var np=j0;const z0=l.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>w.jsx(np,{ref:o,align:t,sideOffset:n,className:Q("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 origin-[--radix-hover-card-content-transform-origin]",e),...r}));z0.displayName=np.displayName;const rp=l.forwardRef(({className:e,...t},n)=>
47w.jsx("textarea",{className:Q("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:n,...t}));rp.displayName="Textarea";function F0({className:e,...t}){return w.jsx("div",{"data-slot":"input-group",role:"group",className:Q("group/input-group border-input dark:bg-input/30 shadow-xs relative flex w-full items-center rounded-md border outline-none transition-[color,box-shadow]","h-9 has-[>textarea]:h-auto","has-[>[data-align=inline-start]]:[&>input]:pl-2","has-[>[data-align=inline-end]]:[&>input]:pr-2","has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3","has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3","has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1","has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",e),...t})}const Z0=Fc("text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",{variants:{align:{"inline-start":"order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]","inline-end":"order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]","block-start":"[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5","block-end":"[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5"}},defaultVariants:{align:"inline-start"}});function U0({className:e,align:t="inline-start",...n}){return w.jsx("div",{role:"group","data-slot":"input-group-addon","data-align":t,className:Q(Z0({align:t}),e),onClick:r=>{r.target.closest("button")||r.currentTarget.parentElement?.querySelector("input")?.focus()},...n})}const B0=Fc("flex items-center gap-2 text-sm shadow-none",{variants:{size:{xs:"h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-2 has-[>svg]:px-2 [&>svg:not([class*='size-'])]:size-3.5",sm:"h-8 gap-1.5 rounded-md px-2.5 has-[>svg]:px-2.5","icon-xs":"size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0","icon-sm":"size-8 p-0 has-[>svg]:p-0"}},defaultVariants:{size:"xs"}});function W0({className:e,type:t="button",variant:n="ghost",size:r="xs",...o}){return w.jsx(zc,{type:t,"data-size":r,variant:n,className:Q(B0({size:r}),e),...o})}function V0({className:e,...t}){return w.jsx(rp,{"data-slot":"input-group-control",className:Q("flex-1 resize-none rounded-none border-0 bg-transparent py-3 shadow-none focus-visible:ring-0 dark:bg-transparent",e),...t})}var H0=Object.defineProperty,G0=(e,t)=>H0(e,"name",{value:t,configurable:!0});function Bs(e,[t,n]){return Math.min(n,Math.max(t,e))}G0(Bs,"clamp");var K0=Object.defineProperty,Bn=(e,t)=>K0(e,"name",{value:t,configurable:!0}),op=!!(typeof window<"u"&&window.document&&window.document.createElement);function be(e,t,{checkForDefaultPrevented:n=!0}={}){return Bn(function(o){if(e?.(o),n===!1||!o||!o.defaultPrevented)return t?.(o)},"handleEvent")}Bn(be,"composeEventHandlers");function q0(e){if(!op)throw new Error("Cannot access window outside of the DOM");return e?.ownerDocument?.defaultView??window}Bn(q0,"getOwnerWindow");function Ws(e){if(!op)throw new Error("Cannot access document outside of the DOM");return e?.ownerDocument??document}Bn(Ws,"getOwnerDocument");function sp(e,t=!1){const{activeElement:n}=Ws(e);if(!n?.nodeName)return null;if(ip(n)&&n.contentDocument)return sp(n.contentDocument.body,t);if(t){const r=n.getAttribute("aria-activedescendant");if(r){const o=Ws(n).getElementById(r);if(o)return o}}return n}Bn(sp,"getActiveElement");function ip(e){return e.tagName==="IFRAME"}Bn(ip,"isFrame");var J0=Object.defineProperty,Xe=(e,t)=>J0(e,"name",{value:t,configurable:!0});function Y0(e,t){const n=l.createContext(t);n.displayName=e+"Context";const r=Xe(s=>{const{children:i,...a}=s,d=l.useMemo(()=>a,Object.values(a));return w.jsx(n.Provider,{value:d,children:i})},"Provider");
47r.displayName=e+"Provider";function o(s,i={}){const{optional:a=!1}=i,d=l.useContext(n);if(d)return d;if(t!==void 0)return t;if(!a)throw new Error(`\`${s}\` must be used within \`${e}\``)}return Xe(o,"useContext"),[r,o]}Xe(Y0,"createContext");function xr(e,t=[]){let n=[];function r(s,i){const a=l.createContext(i);a.displayName=s+"Context";const d=n.length;n=[...n,i];const u=Xe(c=>{const{scope:m,children:h,...p}=c,g=m?.[e]?.[d]||a,v=l.useMemo(()=>p,Object.values(p));return w.jsx(g.Provider,{value:v,children:h})},"Provider");u.displayName=s+"Provider";function f(c,m,h={}){const{optional:p=!1}=h,g=m?.[e]?.[d]||a,v=l.useContext(g);if(v)return v;if(i!==void 0)return i;if(!p)throw new Error(`\`${c}\` must be used within \`${s}\``)}return Xe(f,"useContext"),[u,f]}Xe(r,"createContext");const o=Xe(()=>{const s=n.map(i=>l.createContext(i));return Xe(function(a){const d=a?.[e]||s;return l.useMemo(()=>({[`__scope${e}`]:{...a,[e]:d}}),[a,d])},"useScope")},"createScope");return o.scopeName=e,[r,ap(o,...t)]}Xe(xr,"createContextScope");function ap(...e){const t=e[0];if(e.length===1)return t;const n=Xe(()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return Xe(function(s){const i=r.reduce((a,{useScope:d,scopeName:u})=>{const c=d(s)[`__scope${u}`];return{...a,...c}},{});return l.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])},"useComposedScopes")},"createScope");return n.scopeName=t.scopeName,n}Xe(ap,"composeContextScopes");var X0=Object.defineProperty,qi=(e,t)=>X0(e,"name",{value:t,configurable:!0});function Vs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}qi(Vs,"setRef");function cp(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Vs(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Vs(e[o],null)}}}}qi(cp,"composeRefs");function Ee(...e){return l.useCallback(cp(...e),e)}qi(Ee,"useComposedRefs");var Q0=Object.defineProperty,ht=(e,t)=>Q0(e,"name",{value:t,configurable:!0});function on(e){const t=l.forwardRef((n,r)=>{let{children:o,...s}=n,i=null,a=!1;const d=[];Hs(o)&&typeof Nr=="function"&&(o=Nr(o._payload)),l.Children.forEach(o,m=>{if(fp(m)){a=!0;const h=m;let p="child"in h.props?h.props.child:h.props.children;Hs(p)&&typeof Nr=="function"&&(p=Nr(p._payload)),i=tP(h,p),d.push(i?.props?.children)}else d.push(m)}),i?i=l.cloneElement(i,void 0,d):!a&&l.Children.count(o)===1&&l.isValidElement(o)&&(i=o);const u=i?dp(i):void 0,f=Ee(r,u);if(!i){if(o||o===0)throw new Error(a?oP(e):rP(e));return o}const c=up(s,i.props??{});return i.type!==l.Fragment&&(c.ref=r?f:u),l.cloneElement(i,c)});return t.displayName=`${e}.Slot`,t}ht(on,"createSlot");var lp=Symbol.for("radix.slottable");function eP(e){const t=ht(n=>"child"in n?n.children(n.child):n.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=lp,t}ht(eP,"createSlottable");var tP=ht((e,t)=>{if("child"in e.props){const n=e.props.child;return l.isValidElement(n)?l.cloneElement(n,void 0,e.props.children(n.props.children)):null}return l.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function up(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{const d=s(...a);return o(...a),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}ht(up,"mergeProps");function dp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}ht(dp,"getElementRef");function fp(e){return l.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===lp}ht(fp,"isSlottable");var nP=Symbol.for("react.lazy");function Hs(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===nP&&"_payload"in e&&pp(e._payload)}ht(Hs,"isLazyComponent");function pp(e){return typeof e=="object"&&e!==null&&"then"in e}ht(pp,"isPromiseLike");var rP=ht(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),oP=ht(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Nr=Le[" use ".trim().toString()],sP=Object.defineProperty,Te=(e,t)=>
47sP(e,"name",{value:t,configurable:!0});function mp(e){const t=e+"CollectionProvider",[n,r]=xr(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=Te(g=>{const{scope:v,children:S}=g,x=l.useRef(null),b=l.useRef(new Map).current;return w.jsx(o,{scope:v,itemMap:b,collectionRef:x,children:S})},"CollectionProvider");i.displayName=t;const a=e+"CollectionSlot",d=on(a),u=l.forwardRef((g,v)=>{const{scope:S,children:x}=g,b=s(a,S),E=Ee(v,b.collectionRef);return w.jsx(d,{ref:E,children:x})});u.displayName=a;const f=e+"CollectionItemSlot",c="data-radix-collection-item",m=on(f),h=l.forwardRef((g,v)=>{const{scope:S,children:x,...b}=g,E=l.useRef(null),_=Ee(v,E),y=s(f,S);return l.useEffect(()=>(y.itemMap.set(E,{ref:E,...b}),()=>{y.itemMap.delete(E)})),w.jsx(m,{[c]:"",ref:_,children:x})});h.displayName=f;function p(g){const v=s(e+"CollectionConsumer",g);return l.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${c}]`));return Array.from(v.itemMap.values()).sort((y,P)=>b.indexOf(y.ref.current)-b.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return Te(p,"useCollection"),[{Provider:i,Slot:u,ItemSlot:h},p,r]}Te(mp,"createCollection");var Ec=new WeakMap,xe,We,Xo=(We=class extends Map{constructor(n){super(n);Oo(this,xe);Vn(this,xe,[...super.keys()]),Ec.set(this,!0)}set(n,r){return Ec.get(this)&&(this.has(n)?se(this,xe)[se(this,xe).indexOf(n)]=n:se(this,xe).push(n)),super.set(n,r),this}insert(n,r,o){const s=this.has(r),i=se(this,xe).length,a=Ji(n);let d=a>=0?a:i+a;const u=d<0||d>=i?-1:d;if(u===this.size||s&&u===this.size-1||u===-1)return this.set(r,o),this;const f=this.size+(s?0:1);a<0&&d++;const c=[...se(this,xe)];let m,h=!1;for(let p=d;p<f;p++)if(d===p){let g=c[p];c[p]===r&&(g=c[p+1]),s&&this.delete(r),m=this.get(g),this.set(r,o)}else{!h&&c[p-1]===r&&(h=!0);const g=c[h?p:p-1],v=m;m=this.get(g),this.delete(g),this.set(g,v)}return this}with(n,r,o){const s=new We(this);return s.insert(n,r,o),s}before(n){const r=se(this,xe).indexOf(n)-1;if(!(r<0))return this.entryAt(r)}setBefore(n,r,o){const s=se(this,xe).indexOf(n);return s===-1?this:this.insert(s,r,o)}after(n){let r=se(this,xe).indexOf(n);if(r=r===-1||r===this.size-1?-1:r+1,r!==-1)return this.entryAt(r)}setAfter(n,r,o){const s=se(this,xe).indexOf(n);return s===-1?this:this.insert(s+1,r,o)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Vn(this,xe,[]),super.clear()}delete(n){const r=super.delete(n);return r&&se(this,xe).splice(se(this,xe).indexOf(n),1),r}deleteAt(n){const r=this.keyAt(n);return r!==void 0?this.delete(r):!1}at(n){const r=Zr(se(this,xe),n);if(r!==void 0)return this.get(r)}entryAt(n){const r=Zr(se(this,xe),n);if(r!==void 0)return[r,this.get(r)]}indexOf(n){return se(this,xe).indexOf(n)}keyAt(n){return Zr(se(this,xe),n)}from(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.at(s)}keyFrom(n,r){const o=this.indexOf(n);if(o===-1)return;let s=o+r;return s<0&&(s=0),s>=this.size&&(s=this.size-1),this.keyAt(s)}find(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return s;o++}}findIndex(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return o;o++}return-1}filter(n,r){const o=[];let s=0;for(const i of this)Reflect.apply(n,r,[i,s,this])&&o.push(i),s++;return new We(o)}map(n,r){const o=[];let s=0;for(const i of this)o.push([i[0],Reflect.apply(n,r,[i,s,this])]),s++;return new We(o)}reduce(...n){const[r,o]=n;let s=0,i=o??this.at(0);for(const a of this)s===0&&n.length===1?i=a:i=Reflect.apply(r,this,[i,a,s,this]),s++;return i}reduceRight(...n){const[r,o]=n;let s=o??this.at(-1);for(let i=this.size-1;i>=0;i--){const a=this.at(i);i===this.size-1&&n.length===1?s=a:s=Reflect.apply(r,this,[s,a,i,this])}return s}toSorted(n){const r=[...this.entries()].sort(n);return new We(r)}toReversed(){const n=new We;for(let r=this.size-1;r>=0;r--){const o=this.keyAt(r),s=this.get(o);n.set(o,s)}return n}toSpliced(...n){const r=[...this.entries()];return r.splice(...n),new We(r)}slice(n,r){const o=new We;let s=this.size-1;if(n===void 0)return o;n<0&&(n=n+this.size),r!==void 0&&r>0&&(s=r-1);for(let i=n;i<=s;i++){const a=this.keyAt(i),d=this.get(a);o.set(a,d)}return o}every(n,r){let o=0;for(const s of this){if(!Reflect.apply(n,r,[s,o,this]))return!1;o++}return!0}some(n,r){let o=0;for(const s of this){if(Reflect.apply(n,r,[s,o,this]))return!0;o++}return!1}},xe=new WeakMap,Te(We,"OrderedDict"),We);function Zr(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const n=hp(e,t);return n===-1?void 0:e[n]}Te(Zr,"at");function hp(e,t){const n=e.length,r=Ji(t),o=r>=0?r:n+r;return o<0||o>=n?-1:o}Te(hp,"toSafeIndex");function Ji(e){return e!==e||e===0?0:Math.trunc(e)}Te(Ji,"toSafeInteger");function iP(e){const t=e+"CollectionProvider",[n,r]=xr(t),[o,s]=n(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Xo,setItemMap:Te(()=>{},"setItemMap")}
47),i=Te(({state:b,...E})=>b?w.jsx(d,{...E,state:b}):w.jsx(a,{...E}),"CollectionProvider");i.displayName=t;const a=Te(b=>{const E=v();return w.jsx(d,{...b,state:E})},"CollectionInit");a.displayName=t+"Init";const d=Te(b=>{const{scope:E,children:_,state:y}=b,P=l.useRef(null),[T,R]=l.useState(null),N=Ee(P,R),[D,C]=y;return l.useEffect(()=>{if(!T)return;const O=yp(()=>{});return O.observe(T,{childList:!0,subtree:!0}),()=>{O.disconnect()}},[T]),w.jsx(o,{scope:E,itemMap:D,setItemMap:C,collectionRef:N,collectionRefObject:P,collectionElement:T,children:_})},"CollectionProviderImpl");d.displayName=t+"Impl";const u=e+"CollectionSlot",f=on(u),c=l.forwardRef((b,E)=>{const{scope:_,children:y}=b,P=s(u,_),T=Ee(E,P.collectionRef);return w.jsx(f,{ref:T,children:y})});c.displayName=u;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=on(m),g=l.forwardRef((b,E)=>{const{scope:_,children:y,...P}=b,T=l.useRef(null),[R,N]=l.useState(null),D=Ee(E,T,N),C=s(m,_),{setItemMap:O}=C,A=l.useRef(P);vp(A.current,P)||(A.current=P);const U=A.current;return l.useEffect(()=>{const B=U;return O(Z=>R?Z.has(R)?Z.set(R,{...B,element:R}).toSorted(Gs):(Z.set(R,{...B,element:R}),Z.toSorted(Gs)):Z),()=>{O(Z=>!R||!Z.has(R)?Z:(Z.delete(R),new Xo(Z)))}},[R,U,O]),w.jsx(p,{[h]:"",ref:D,children:y})});g.displayName=m;function v(){return l.useState(new Xo)}Te(v,"useInitCollection");function S(b){const{itemMap:E}=s(e+"CollectionConsumer",b);return E}return Te(S,"useCollection"),[{Provider:i,Slot:c,ItemSlot:g},{createCollectionScope:r,useCollection:S,useInitCollection:v}]}Te(iP,"createCollection");function vp(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||e[o]!==t[o])return!1;return!0}Te(vp,"shallowEqual");function gp(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}Te(gp,"isElementPreceding");function Gs(e,t){return!e[1].element||!t[1].element?0:gp(e[1].element,t[1].element)?-1:1}Te(Gs,"sortByDocumentPosition");function yp(e){return new MutationObserver(n=>{for(const r of n)if(r.type==="childList"){e();return}})}Te(yp,"getChildListObserver");var aP=Object.defineProperty,cP=(e,t)=>aP(e,"name",{value:t,configurable:!0}),lP=l.createContext(void 0);function bp(e){const t=l.useContext(lP);return e||t||"ltr"}cP(bp,"useDirection");var uP=Object.defineProperty,dP=(e,t)=>uP(e,"name",{value:t,configurable:!0}),fP=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ze=fP.reduce((e,t)=>{const n=on(`Primitive.${t}`),r=l.forwardRef((o,s)=>{const{asChild:i,...a}=o,d=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),w.jsx(d,{...a,ref:s})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function wp(e,t){e&&lt.flushSync(()=>e.dispatchEvent(t))}dP(wp,"dispatchDiscreteCustomEvent");var pP=Object.defineProperty,mP=(e,t)=>pP(e,"name",{value:t,configurable:!0});function wt(e){const t=l.useRef(e);return l.useEffect(()=>{t.current=e}),l.useMemo(()=>((...n)=>t.current?.(...n)),[])}mP(wt,"useCallbackRef");var hP=Object.defineProperty,Re=(e,t)=>hP(e,"name",{value:t,configurable:!0}),Ks="dismissableLayer.update",vP="dismissableLayer.pointerDownOutside",gP="dismissableLayer.focusOutside",_c,xp=l.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),yP=l.forwardRef(Re(function(t,n){const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:d,onDismiss:u,...f}=t,c=l.useContext(xp),[m,h]=l.useState(null),p=m?.ownerDocument??globalThis?.document,[,g]=l.useState({}),v=Ee(n,h),S=Array.from(c.layers),[x]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),b=x?S.indexOf(x):-1,E=m?S.indexOf(m):-1,_=c.layersWithOutsidePointerEventsDisabled.size>0,y=E>=b,P=l.useRef(!1),T=Sp(C=>{i?.(C),d?.(C),C.defaultPrevented||u?.()},{ownerDocument:p,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:P,dismissableSurfaces:c.dismissableSurfaces,shouldHandlePointerDownOutside:l.useCallback(C=>{if(!(C instanceof Node))return!1;const O=[...c.branches].some(A=>A.contains(C));return y&&!O},[c.branches,y])}),R=Ep(C=>{if(o&&P.current)return;const O=C.target;[...c.branches].some(U=>U.contains(O))||(a?.(C),d?.(C),C.defaultPrevented||u?.())},p),N=m?E===S.length-1:!1,D=wt(C=>{C.key==="Escape"&&(s?.(C),!C.defaultPrevented&&u&&(C.preventDefault(),u()))});return l.useEffect(()=>{if(N)return p.addEventListener("keydown",D,{capture:!0}),()=>p.removeEventListener("keydown",D,{capture:!0})},[p,N,D]),l.useEffect(()=>{if(m)return r&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(_c=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(m)),c.layers.add(m),qs(),()=>{r&&(c.layersWithOutsidePointerEventsDisabled.delete(m),c.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=_c))}},[m,p,r,c]),l.useEffect(()=>()=>{m&&(c.layers.delete(m),c.layersWithOutsidePointerEventsDisabled.delete(m),qs())},[m,c]),l.useEffect(()=>{const C=Re(()=>g({}),"handleUpdate");
47return document.addEventListener(Ks,C),()=>document.removeEventListener(Ks,C)},[]),w.jsx(ze.div,{...f,ref:v,style:{pointerEvents:_?y?"auto":"none":void 0,...t.style},onFocusCapture:be(t.onFocusCapture,R.onFocusCapture),onBlurCapture:be(t.onBlurCapture,R.onBlurCapture),onPointerDownCapture:be(t.onPointerDownCapture,T.onPointerDownCapture)})},"DismissableLayer"));function bP(){const e=l.useContext(xp),[t,n]=l.useState(null);return l.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}Re(bP,"useDismissableLayerSurface");var wP=Re(()=>!0,"IS_TRUE");function Sp(e,t){const{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:s,shouldHandlePointerDownOutside:i=wP}=t,a=wt(e),d=l.useRef(!1),u=l.useRef(!1),f=l.useRef(new Map),c=l.useRef(()=>{});return l.useEffect(()=>{function m(){u.current=!1,o.current=!1,f.current.clear()}Re(m,"resetOutsideInteraction");function h(){return Array.from(f.current.values()).some(Boolean)}Re(h,"isOutsideInteractionIntercepted");function p(b){if(!u.current)return;const E=b.target;E instanceof Node&&[...s].some(y=>y.contains(E))||f.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{u.current&&c.current()},0)}Re(p,"handleInteractionCapture");function g(b){u.current&&f.current.set(b.type,!1)}Re(g,"handleInteractionBubble");const v=Re(b=>{if(b.target&&!d.current){let E=function(){n.removeEventListener("click",c.current);const y=h();m(),y||Yi(vP,a,_,{discrete:!0})};if(Re(E,"handleAndDispatchPointerDownOutsideEvent"),!i(b.target)){n.removeEventListener("click",c.current),m(),d.current=!1;return}const _={originalEvent:b};u.current=!0,o.current=r&&b.button===0,f.current.clear(),!r||b.button!==0?E():(n.removeEventListener("click",c.current),c.current=E,n.addEventListener("click",c.current,{once:!0}))}else n.removeEventListener("click",c.current),m();d.current=!1},"handlePointerDown"),S=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const b of S)n.addEventListener(b,p,!0),n.addEventListener(b,g);const x=window.setTimeout(()=>{n.addEventListener("pointerdown",v)},0);return()=>{window.clearTimeout(x),n.removeEventListener("pointerdown",v),n.removeEventListener("click",c.current);for(const b of S)n.removeEventListener(b,p,!0),n.removeEventListener(b,g)}},[n,a,r,o,s,i]),{onPointerDownCapture:Re(()=>d.current=!0,"onPointerDownCapture")}}Re(Sp,"usePointerDownOutside");function Ep(e,t=globalThis?.document){const n=wt(e),r=l.useRef(!1);return l.useEffect(()=>{const o=Re(s=>{s.target&&!r.current&&Yi(gP,n,{originalEvent:s},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:Re(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Re(()=>r.current=!1,"onBlurCapture")}}Re(Ep,"useFocusOutside");function qs(){const e=new CustomEvent(Ks);document.dispatchEvent(e)}Re(qs,"dispatchUpdate");function Yi(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?wp(o,s):o.dispatchEvent(s)}Re(Yi,"handleAndDispatchCustomEvent");var xP=Object.defineProperty,Xi=(e,t)=>xP(e,"name",{value:t,configurable:!0}),Dr=0,vn=null;function SP(e){return Qi(),e.children}Xi(SP,"FocusGuards");function Qi(){l.useEffect(()=>{vn||(vn={start:Js(),end:Js()});const{start:e,end:t}=vn;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Dr++,()=>{Dr===1&&(vn?.start.remove(),vn?.end.remove(),vn=null),Dr=Math.max(0,Dr-1)}},[])}Xi(Qi,"useFocusGuards");function Js(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}Xi(Js,"createFocusGuard");var EP=Object.defineProperty,je=(e,t)=>EP(e,"name",{value:t,configurable:!0}),Qo="focusScope.autoFocusOnMount",es="focusScope.autoFocusOnUnmount",Cc={bubbles:!1,cancelable:!0},_P=l.forwardRef(je(function(t,n){const{loop:r=!1,trapped:o=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...a}=t,[d,u]=l.useState(null),f=wt(s),c=wt(i),m=l.useRef(null),h=Ee(n,u),p=l.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;l.useEffect(()=>{if(o){let v=function(E){if(p.paused||!d)return;const _=E.target;d.contains(_)?m.current=_:Ct(m.current,{select:!0})},S=function(E){if(p.paused||!d)return;const _=E.relatedTarget;_!==null&&(d.contains(_)||Ct(m.current,{select:!0}))},x=function(E){if(document.activeElement===document.body)for(const y of E)y.removedNodes.length>0&&Ct(d)};je(v,"handleFocusIn"),je(S,"handleFocusOut"),je(x,"handleMutations"),document.addEventListener("focusin",v),document.addEventListener("focusout",S);const b=new MutationObserver(x);return d&&b.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",S),b.disconnect()}}},[o,d,p.paused]),l.useEffect(()=>{if(d){Pc.add(p);const v=document.activeElement;if(!d.contains(v)){const x=new CustomEvent(Qo,Cc);d.addEventListener(Qo,f),d.dispatchEvent(x),x.defaultPrevented||(_p(Op(ea(d)),{select:!0}
47),document.activeElement===v&&Ct(d))}return()=>{d.removeEventListener(Qo,f),setTimeout(()=>{const x=new CustomEvent(es,Cc);d.addEventListener(es,c),d.dispatchEvent(x),x.defaultPrevented||Ct(v??document.body,{select:!0}),d.removeEventListener(es,c),Pc.remove(p)},0)}}},[d,f,c,p]);const g=l.useCallback(v=>{if(!r&&!o||p.paused)return;const S=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,x=document.activeElement;if(S&&x){const b=v.currentTarget,[E,_]=Cp(b);E&&_?!v.shiftKey&&x===_?(v.preventDefault(),r&&Ct(E,{select:!0})):v.shiftKey&&x===E&&(v.preventDefault(),r&&Ct(_,{select:!0})):x===b&&v.preventDefault()}},[r,o,p.paused]);return w.jsx(ze.div,{tabIndex:-1,...a,ref:h,onKeyDown:g})},"FocusScope"));function _p(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ct(r,{select:t}),document.activeElement!==n)return}je(_p,"focusFirst");function Cp(e){const t=ea(e),n=Ys(t,e),r=Ys(t.reverse(),e);return[n,r]}je(Cp,"getTabbableEdges");function ea(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:je(r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)t.push(n.currentNode);return t}je(ea,"getTabbableCandidates");function Ys(e,t){const n=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Pp(r,{upTo:t})))return r}je(Ys,"findVisible");function Pp(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}je(Pp,"isHidden");function Ip(e){return e instanceof HTMLInputElement&&"select"in e}je(Ip,"isSelectableInput");function Ct(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ip(e)&&t&&e.select()}}je(Ct,"focus");var Pc=Rp();function Rp(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=Xs(e,t),e.unshift(t)},remove(t){e=Xs(e,t),e[0]?.resume()}}}je(Rp,"createFocusScopesStack");function Xs(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}je(Xs,"arrayRemove");function Op(e){return e.filter(t=>t.tagName!=="A")}je(Op,"removeLinks");var $e=globalThis?.document?l.useLayoutEffect:()=>{},CP=Object.defineProperty,PP=(e,t)=>CP(e,"name",{value:t,configurable:!0}),IP=Le[" useId ".trim().toString()]||(()=>{}),RP=0;function ta(e){const[t,n]=l.useState(IP());return $e(()=>{e||n(r=>r??String(RP++))},[e]),e||(t?`radix-${t}`:"")}PP(ta,"useId");var OP=Object.defineProperty,TP=(e,t)=>OP(e,"name",{value:t,configurable:!0});function Tp(e){const[t,n]=l.useState(void 0);return $e(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const d=s.borderBoxSize,u=Array.isArray(d)?d[0]:d;i=u.inlineSize,a=u.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}TP(Tp,"useSize");var AP=Object.defineProperty,Lt=(e,t)=>AP(e,"name",{value:t,configurable:!0}),Ap="Popper",[$p,Np]=xr(Ap),[$P,Dp]=$p(Ap),NP=Lt(e=>{const{__scopePopper:t,children:n}=e,[r,o]=l.useState(null),[s,i]=l.useState(void 0);return w.jsx($P,{scope:t,anchor:r,onAnchorChange:o,placementState:s,setPlacementState:i,children:n})},"Popper"),DP="PopperAnchor",MP=l.forwardRef(Lt(function(t,n){const{__scopePopper:r,virtualRef:o,...s}=t,i=Dp(DP,r),a=l.useRef(null),d=i.onAnchorChange,u=l.useCallback(g=>{a.current=g,g&&d(g)},[d]),f=Ee(n,u),c=l.useRef(null);l.useEffect(()=>{if(!o)return;const g=c.current;c.current=o.current,g!==c.current&&d(c.current)});const m=i.placementState&&Eo(i.placementState),h=m?.[0],p=m?.[1];return o?null:w.jsx(ze.div,{"data-radix-popper-side":h,"data-radix-popper-align":p,...s,ref:f})},"PopperAnchor")),Mp="PopperContent",[kP,NR]=$p(Mp),jP=l.forwardRef(Lt(function(t,n){const{__scopePopper:r,side:o="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,arrowPadding:d=0,avoidCollisions:u=!0,collisionBoundary:f=[],collisionPadding:c=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...v}=t,S=Dp(Mp,r),[x,b]=l.useState(null),E=Ee(n,b),[_,y]=l.useState(null),P=Tp(_),T=P?.width??0,R=P?.height??0,N=o+(i!=="center"?"-"+i:""),D=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},C=Array.isArray(f)?f:[f],O=C.length>0,A={padding:D,boundary:C.filter(kp),altBoundary:O},{refs:U,floatingStyles:B,placement:Z,isPositioned:V,middlewareData:H}=ao({strategy:"fixed",placement:N,whileElementsMounted:Lt((...G)=>io(...G,{animationFrame:p==="always"}
47),"whileElementsMounted"),elements:{reference:S.anchor},middleware:[co({mainAxis:s+R,alignmentAxis:a}),u&&lo({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?uo():void 0,...A}),u&&fo({...A}),po({...A,apply:Lt(({elements:G,rects:ee,availableWidth:ne,availableHeight:ae})=>{const{width:pe,height:De}=ee.reference,fe=G.floating.style;fe.setProperty("--radix-popper-available-width",`${ne}px`),fe.setProperty("--radix-popper-available-height",`${ae}px`),fe.setProperty("--radix-popper-anchor-width",`${pe}px`),fe.setProperty("--radix-popper-anchor-height",`${De}px`)},"apply")}),_&&ho({element:_,padding:d}),LP({arrowWidth:T,arrowHeight:R}),h&&mo({strategy:"referenceHidden",...A,boundary:O?A.boundary:void 0})]}),F=S.setPlacementState;$e(()=>(F(Z),()=>{F(void 0)}),[Z,F]);const[ie,I]=Eo(Z),k=wt(g);$e(()=>{V&&k?.()},[V,k]);const z=H.arrow?.x,j=H.arrow?.y,q=H.arrow?.centerOffset!==0,[J,L]=l.useState();return $e(()=>{x&&L(window.getComputedStyle(x).zIndex)},[x]),w.jsx("div",{ref:U.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:V?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[H.transformOrigin?.x,H.transformOrigin?.y].join(" "),...H.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:w.jsx(kP,{scope:r,placedSide:ie,placedAlign:I,onArrowChange:y,arrowX:z,arrowY:j,shouldHideArrow:q,children:w.jsx(ze.div,{"data-side":ie,"data-align":I,...v,ref:E,style:{...v.style,animation:V?v.style?.animation:"none"}})})})},"PopperContent"));function kp(e){return e!==null}Lt(kp,"isNotNull");var LP=Lt(e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:o}=t,i=o.arrow?.centerOffset!==0,a=i?0:e.arrowWidth,d=i?0:e.arrowHeight,[u,f]=Eo(n),c={start:"0%",center:"50%",end:"100%"}[f],m=(o.arrow?.x??0)+a/2,h=(o.arrow?.y??0)+d/2;let p="",g="";return u==="bottom"?(p=i?c:`${m}px`,g=`${-d}px`):u==="top"?(p=i?c:`${m}px`,g=`${r.floating.height+d}px`):u==="right"?(p=`${-d}px`,g=i?c:`${h}px`):u==="left"&&(p=`${r.floating.width+d}px`,g=i?c:`${h}px`),{data:{x:p,y:g}}}}),"transformOrigin");function Eo(e){const[t,n="center"]=e.split("-");return[t,n]}Lt(Eo,"getSideAndAlignFromPlacement");var zP=NP,FP=MP,ZP=jP,UP=Object.defineProperty,BP=(e,t)=>UP(e,"name",{value:t,configurable:!0}),WP=l.forwardRef(BP(function(t,n){const{container:r,...o}=t,[s,i]=l.useState(!1);$e(()=>i(!0),[]);const a=r||s&&globalThis?.document?.body;return a?lt.createPortal(w.jsx(ze.div,{...o,ref:n}),a):null},"Portal")),VP=Object.defineProperty,At=(e,t)=>VP(e,"name",{value:t,configurable:!0});function jp(e,t){return l.useReducer((n,r)=>t[n][r]??n,e)}At(jp,"useStateMachine");var HP=At(e=>{const{present:t,children:n}=e,r=Lp(t),o=typeof n=="function"?n({present:r.isPresent}):l.Children.only(n),s=zp(r.ref,Fp(o));return typeof n=="function"||r.isPresent?l.cloneElement(o,{ref:s}):null},"Presence");function Lp(e){const[t,n]=l.useState(),r=l.useRef(null),o=l.useRef(e),s=l.useRef("none"),i=l.useRef(void 0),a=e?"mounted":"unmounted",[d,u]=jp(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return l.useEffect(()=>{d==="mounted"?(s.current=i.current??_n(r.current),i.current=void 0):s.current="none"},[d]),$e(()=>{const f=r.current,c=o.current;if(c!==e){const h=s.current,p=_n(f);e?(i.current=p,u("MOUNT")):p==="none"||f?.display==="none"?u("UNMOUNT"):u(c&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),$e(()=>{if(t){let f;const c=t.ownerDocument.defaultView??window,m=At(p=>{const v=_n(r.current).includes(CSS.escape(p.animationName));if(p.target===t&&v&&(u("ANIMATION_END"),!o.current)){const S=t.style.animationFillMode;t.style.animationFillMode="forwards",f=c.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=S)})}},"handleAnimationEnd"),h=At(p=>{p.target===t&&(s.current=_n(r.current))},"handleAnimationStart");return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{c.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(d),ref:l.useCallback(f=>{if(f){const c=getComputedStyle(f);r.current=c,i.current=_n(c)}else r.current=null;n(f)},[])}}At(Lp,"usePresence");function Qs(e,t){if(typeof e=="function")return e(t);
47e!=null&&(e.current=t)}At(Qs,"setRef");function zp(...e){const t=l.useRef(e);return t.current=e,l.useCallback(n=>{const r=t.current;let o=!1;const s=r.map(i=>{const a=Qs(i,n);return!o&&typeof a=="function"&&(o=!0),a});if(o)return()=>{for(let i=0;i<s.length;i++){const a=s[i];typeof a=="function"?a():Qs(r[i],null)}}},[])}At(zp,"useStableComposedRefs");function _n(e){return e?.animationName||"none"}At(_n,"getAnimationName");function Fp(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}At(Fp,"getElementRef");var GP=Object.defineProperty,KP=(e,t)=>GP(e,"name",{value:t,configurable:!0}),Ic=Le[" useEffectEvent ".trim().toString()],Rc=Le[" useInsertionEffect ".trim().toString()];function Zp(e){if(typeof Ic=="function")return Ic(e);const t=l.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Rc=="function"?Rc(()=>{t.current=e}):$e(()=>{t.current=e}),l.useMemo(()=>((...n)=>t.current?.(...n)),[])}KP(Zp,"useEffectEvent");var qP=Object.defineProperty,Sr=(e,t)=>qP(e,"name",{value:t,configurable:!0}),JP=Le[" useInsertionEffect ".trim().toString()]||$e;function ei({prop:e,defaultProp:t,onChange:n=Sr(()=>{},"onChange"),caller:r}){const[o,s,i]=Up({defaultProp:t,onChange:n}),a=e!==void 0,d=a?e:o,u=l.useCallback(f=>{if(a){const c=Bp(f)?f(e):f;c!==e&&i.current?.(c)}else s(f)},[a,e,s,i]);return[d,u]}Sr(ei,"useControllableState");function Up({defaultProp:e,onChange:t}){const[n,r]=l.useState(e),o=l.useRef(n),s=l.useRef(t);return JP(()=>{s.current=t},[t]),l.useEffect(()=>{o.current!==n&&(s.current?.(n),o.current=n)},[n,o]),[n,r,s]}Sr(Up,"useUncontrolledState");function Bp(e){return typeof e=="function"}Sr(Bp,"isFunction");var Oc=Symbol("RADIX:SYNC_STATE");function YP(e,t,n,r){const{prop:o,defaultProp:s,onChange:i,caller:a}=t,d=o!==void 0,u=Zp(i),f=[{...n,state:s}];r&&f.push(r);const[c,m]=l.useReducer((v,S)=>{if(S.type===Oc)return{...v,state:S.state};const x=e(v,S);return d&&!Object.is(x.state,v.state)&&u(x.state),x},...f),h=c.state,p=l.useRef(h);l.useEffect(()=>{p.current!==h&&(p.current=h,d||u(h))},[h,p,d]);const g=l.useMemo(()=>o!==void 0?{...c,state:o}:c,[c,o]);return l.useEffect(()=>{d&&!Object.is(o,c.state)&&m({type:Oc,state:o})},[o,c.state,d]),[g,m]}Sr(YP,"useControllableStateReducer");var XP=Object.defineProperty,oe=(e,t)=>XP(e,"name",{value:t,configurable:!0}),QP=[" ","Enter","ArrowUp","ArrowDown"],eI=[" ","Enter"],kn="Select",[_o,Co,tI]=mp(kn),[fn,DR]=xr(kn,[tI,Np]),na=Np(),[nI,Wn]=fn(kn),[rI,oI]=fn(kn);function sI(e){const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:d,dir:u,name:f,autoComplete:c,disabled:m,required:h,form:p,internal_do_not_use_render:g}=e,v=na(t),[S,x]=l.useState(null),[b,E]=l.useState(null),[_,y]=l.useState(!1),P=bp(u),[T,R]=ei({prop:r,defaultProp:o??!1,onChange:s,caller:kn}),[N,D]=ei({prop:i,defaultProp:a,onChange:d,caller:kn}),C=l.useRef(null),O=l.useRef(N);l.useEffect(()=>{const I=p?S?.ownerDocument.getElementById(p):S?.form;if(I instanceof HTMLFormElement){const k=oe(()=>D(O.current),"reset");return I.addEventListener("reset",k),()=>I.removeEventListener("reset",k)}},[p,S,D]);const A=S?!!p||!!S.closest("form"):!0,[U,B]=l.useState(new Set),Z=ta(),V=Array.from(U).map(I=>I.props.value).join(";"),H=l.useCallback(I=>{B(k=>new Set(k).add(I))},[]),F=l.useCallback(I=>{B(k=>{const z=new Set(k);return z.delete(I),z})},[]),ie={required:h,trigger:S,onTriggerChange:x,valueNode:b,onValueNodeChange:E,valueNodeHasChildren:_,onValueNodeHasChildrenChange:y,contentId:Z,value:N,onValueChange:D,open:T,onOpenChange:R,dir:P,triggerPointerDownPosRef:C,disabled:m,name:f,autoComplete:c,form:p,nativeOptions:U,nativeSelectKey:V,isFormControl:A};return w.jsx(zP,{...v,children:w.jsx(nI,{scope:t,...ie,children:w.jsx(_o.Provider,{scope:t,children:w.jsx(rI,{scope:t,onNativeOptionAdd:H,onNativeOptionRemove:F,children:em(g)?g(ie):n})})})})}oe(sI,"SelectProvider");var iI="SelectTrigger",Wp=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,disabled:o=!1,...s}=t,i=na(r),a=Wn(iI,r),d=a.disabled||o,u=Ee(n,a.onTriggerChange),f=Co(r),c=l.useRef("touch"),[m,h,p]=sa(v=>{const S=f().filter(E=>!E.disabled),x=S.find(E=>E.value===a.value),b=ia(S,v,x);b!==void 0&&a.onValueChange(b.value)}),g=oe(v=>{d||(a.onOpenChange(!0),p()),v&&(a.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})},"handleOpen");return w.jsx(FP,{asChild:!0,...i,children:w.jsx(ze.button,{type:"button",role:"combobox","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":oa(a.value)?"":void 0,...s,ref:u,onClick:be(s.onClick,v=>
47{v.currentTarget.focus(),c.current!=="mouse"&&g(v)}),onPointerDown:be(s.onPointerDown,v=>{c.current=v.pointerType;const S=v.target;S.hasPointerCapture(v.pointerId)&&S.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(g(v),v.preventDefault())}),onKeyDown:be(s.onKeyDown,v=>{const S=m.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&h(v.key),!(S&&v.key===" ")&&QP.includes(v.key)&&(g(),v.preventDefault())})})})},"SelectTrigger")),aI=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,children:o,...s}=t;return w.jsx(ze.span,{"aria-hidden":!0,...s,ref:n,children:o||"▼"})},"SelectIcon")),cI="SelectPortal",[lI,uI]=fn(cI,{forceMount:void 0}),dI=oe(e=>{const{__scopeSelect:t,forceMount:n,...r}=e;return w.jsx(lI,{scope:e.__scopeSelect,forceMount:n,children:w.jsx(WP,{asChild:!0,...r})})},"SelectPortal"),sn="SelectContent",Vp=l.forwardRef(oe(function(t,n){const r=uI(sn,t.__scopeSelect),{forceMount:o=r.forceMount,...s}=t,i=Wn(sn,t.__scopeSelect),[a,d]=l.useState();return $e(()=>{d(new DocumentFragment)},[]),w.jsx(HP,{present:o||i.open,children:({present:u})=>u?w.jsx(mI,{...s,ref:n}):w.jsx(fI,{...s,fragment:a})})},"SelectContent")),fI=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,children:o,fragment:s}=t;return s?lt.createPortal(w.jsx(Hp,{scope:r,children:w.jsx(_o.Slot,{scope:r,children:w.jsx("div",{ref:n,children:o})})}),s):null},"SelectContentFragment")),nt=10,[Hp,pn]=fn(sn),pI=on("SelectContent.RemoveScroll"),mI=l.forwardRef(oe(function(t,n){const{__scopeSelect:r}=t,{position:o="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:a,side:d,sideOffset:u,align:f,alignOffset:c,arrowPadding:m,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:v,avoidCollisions:S,...x}=t,b=Wn(sn,r),[E,_]=l.useState(null),[y,P]=l.useState(null),T=Ee(n,_),[R,N]=l.useState(null),[D,C]=l.useState(null),O=Co(r),[A,U]=l.useState(!1),B=l.useRef(!1);l.useEffect(()=>{if(E)return Zc(E)},[E]),Qi();const Z=l.useCallback(L=>{const[G,...ee]=O().map(pe=>pe.ref.current),[ne]=ee.slice(-1),ae=document.activeElement;for(const pe of L)if(pe===ae||(pe?.scrollIntoView({block:"nearest"}),pe===G&&y&&(y.scrollTop=0),pe===ne&&y&&(y.scrollTop=y.scrollHeight),pe?.focus(),document.activeElement!==ae))return},[O,y]),V=l.useCallback(()=>Z([R,E]),[Z,R,E]);l.useEffect(()=>{A&&V()},[A,V]);const{onOpenChange:H,triggerPointerDownPosRef:F}=b;l.useEffect(()=>{if(E){let L={x:0,y:0};const G=oe(ne=>{L={x:Math.abs(Math.round(ne.pageX)-(F.current?.x??0)),y:Math.abs(Math.round(ne.pageY)-(F.current?.y??0))}},"handlePointerMove"),ee=oe(ne=>{L.x<=10&&L.y<=10?ne.preventDefault():ne.composedPath().includes(E)||H(!1),document.removeEventListener("pointermove",G),F.current=null},"handlePointerUp");return F.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",ee,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",ee,{capture:!0})}}},[E,H,F]),l.useEffect(()=>{const L=oe(()=>H(!1),"close");return window.addEventListener("blur",L),window.addEventListener("resize",L),()=>{window.removeEventListener("blur",L),window.removeEventListener("resize",L)}},[H]);const[ie,I]=sa(L=>{const G=O().filter(ae=>!ae.disabled),ee=G.find(ae=>ae.ref.current===document.activeElement),ne=ia(G,L,ee);ne&&setTimeout(()=>ne.ref.current?.focus())}),k=l.useCallback((L,G,ee)=>{const ne=!B.current&&!ee;(b.value!==void 0&&b.value===G||ne)&&(N(L),ne&&(B.current=!0))},[b.value]),z=l.useCallback(()=>E?.focus(),[E]),j=l.useCallback((L,G,ee)=>{const ne=!B.current&&!ee;(b.value!==void 0&&b.value===G||ne)&&C(L)},[b.value]),q=o==="popper"?Tc:hI,J=q===Tc?{side:d,sideOffset:u,align:f,alignOffset:c,arrowPadding:m,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:v,avoidCollisions:S}:{};return w.jsx(Hp,{scope:r,content:E,viewport:y,onViewportChange:P,itemRefCallback:k,selectedItem:R,onItemLeave:z,itemTextRefCallback:j,focusSelectedItem:V,selectedItemText:D,position:o,isPositioned:A,searchRef:ie,children:w.jsx(Uc,{as:pI,allowPinchZoom:!0,children:w.jsx(_P,{asChild:!0,trapped:b.o
vendor: 6,410 bytes, line 47
47pen,onMountAutoFocus:L=>{L.preventDefault()},onUnmountAutoFocus:be(s,L=>{b.trigger?.focus({preventScroll:!0}),L.preventDefault()}),children:w.jsx(yP,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:L=>L.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:w.jsx(q,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:L=>L.preventDefault(),...x,...J,onPlaced:()=>U(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:be(x.onKeyDown,L=>{const G=L.ctrlKey||L.altKey||L.metaKey;if(L.key==="Tab"&&L.preventDefault(),!G&&L.key.length===1&&I(L.key),["ArrowUp","ArrowDown","Home","End"].includes(L.key)){let ne=O().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);if(["ArrowUp","End"].includes(L.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(L.key)){const ae=L.target,pe=ne.indexOf(ae);ne=ne.slice(pe+1)}setTimeout(()=>Z(ne)),L.preventDefault()}})})})})})})},"SelectContentImpl")),hI=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,onPlaced:o,...s}=t,i=Wn(sn,r),a=pn(sn,r),[d,u]=l.useState(null),[f,c]=l.useState(null),m=Ee(n,c),h=Co(r),p=l.useRef(!1),g=l.useRef(!0),{viewport:v,selectedItem:S,selectedItemText:x,focusSelectedItem:b}=a,E=l.useCallback(()=>{if(i.trigger&&i.valueNode&&d&&f&&v&&S&&x){const T=i.trigger.getBoundingClientRect(),R=f.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),D=x.getBoundingClientRect();if(i.dir!=="rtl"){const ae=D.left-R.left,pe=N.left-ae,De=T.left-pe,fe=T.width+De,Po=Math.max(fe,R.width),Io=window.innerWidth-nt,Ro=Bs(pe,[nt,Math.max(nt,Io-Po)]);d.style.minWidth=fe+"px",d.style.left=Ro+"px"}else{const ae=R.right-D.right,pe=window.innerWidth-N.right-ae,De=window.innerWidth-T.right-pe,fe=T.width+De,Po=Math.max(fe,R.width),Io=window.innerWidth-nt,Ro=Bs(pe,[nt,Math.max(nt,Io-Po)]);d.style.minWidth=fe+"px",d.style.right=Ro+"px"}const C=h(),O=window.innerHeight-nt*2,A=v.scrollHeight,U=window.getComputedStyle(f),B=parseInt(U.borderTopWidth,10),Z=parseInt(U.paddingTop,10),V=parseInt(U.borderBottomWidth,10),H=parseInt(U.paddingBottom,10),F=B+Z+A+H+V,ie=Math.min(S.offsetHeight*5,F),I=window.getComputedStyle(v),k=parseInt(I.paddingTop,10),z=parseInt(I.paddingBottom,10),j=T.top+T.height/2-nt,q=O-j,J=S.offsetHeight/2,L=S.offsetTop+J,G=B+Z+L,ee=F-G;if(G<=j){const ae=C.length>0&&S===C[C.length-1].ref.current;d.style.bottom="0px";const pe=f.clientHeight-v.offsetTop-v.offsetHeight,De=Math.max(q,J+(ae?z:0)+pe+V),fe=G+De;d.style.height=fe+"px"}else{const ae=C.length>0&&S===C[0].ref.current;d.style.top="0px";const De=Math.max(j,B+v.offsetTop+(ae?k:0)+J)+ee;d.style.height=De+"px",v.scrollTop=G-j+v.offsetTop}d.style.margin=`${nt}px 0`,d.style.minHeight=ie+"px",d.style.maxHeight=O+"px",o?.(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,d,f,v,S,x,i.dir,o]);$e(()=>E(),[E]);const[_,y]=l.useState();$e(()=>{f&&y(window.getComputedStyle(f).zIndex)},[f]);const P=l.useCallback(T=>{T&&g.current===!0&&(E(),b?.(),g.current=!1)},[E,b]);return w.jsx(vI,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:p,onScrollButtonChange:P,children:w.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:_},children:w.jsx(ze.div,{...s,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})},"SelectItemAlignedPosition")),Tc=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,align:o="start",collisionPadding:s=nt,...i}=t,a=na(r);return w.jsx(ZP,{...a,...i,ref:n,align:o,collisionPadding:s,style:{boxSizing:"border-box",...i.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)"}})},"SelectPopperPosition")),[vI,ra]=fn(sn,{}),Ac="SelectViewport",gI=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,nonce:o,...s}=t,i=pn(Ac,r),a=ra(Ac,r),d=Ee(n,i.onViewportChange),u=l.useRef(0);return w.jsxs(w.Fragment,{children:[w.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),w.jsx(_o.Slot,{scope:r,children:w.jsx(ze.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:be(s.onScroll,f=>{const c=f.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:h}=a;if(h?.current&&m){const p=Math.abs(u.current-c.scrollTop);if(p>0){const g=window.innerHeight-nt*2,v=parseFloat(m.style.minHeight),S=parseFloat(m.style.height),x=Math.max(v,S);if(x<g){const b=x+p,E=Math.min(g,b),_=b-E;m.style.height=E+"px",m.style.bottom==="0px"&&(c.scrollTop=_>0?_:0,m.style.justifyContent="flex-end")}}}u.current=c.scrollTop})})})]})},"SelectViewport")),yI="SelectGroup",[MR,bI]=fn(yI),wI="SelectLabel",Gp=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,...o}=t,s=bI(wI,r);return w.jsx(ze.div,{id:s.id,...o,ref:n})},"SelectLabel")),ti="SelectItem",[xI,Kp]=fn(ti),qp=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,value:o,disabled:s=!1,textValue:i,...a}=t,d=Wn(ti,r),u=pn(ti,r),f=d.value===o,[c,m]=l.useState(i??""),[h,p]=l.useState(!1),g=wt(E=>u.itemRefCallback?.(E,o,s)),v=Ee(n,g),S=ta(),x=l.useRef("touch"),b=oe(()=>{s||(d.onValueChange(o),d.onOpenChange(!1))},"handleSelect");return w.jsx(xI,{scope:r,value:o,disabled:s,textId:S,isSelected:f,onItemTextChange:l.useCallback(E=>{m(_=>_||(E?.textContent??"").trim())},[]),children:w.jsx(_o.ItemSlot,{scope:r,value:o,disabled:s,textValue:c,children:w.jsx(ze.div,{role:"option","aria-labelledby":S,"data-highlighted":h?"":void 0,"aria-selected":f&&h,"data-state":f?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:v,onFocus:be(a.onFocus,()=>p(!0)),onBlur:be(a.onBlur,()=>p(!1)),onClick:be(a.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:be(a.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:be(a.onPointerDown,E=>{x.current=E.pointerType}),onPointerMove:be(a.onPointerMove,E=>{x.current=E.pointerType,s?u.onItemLeave?.():x.current==="mouse"&&E.currentTarget.focu
47s({preventScroll:!0})}),onPointerLeave:be(a.onPointerLeave,E=>{E.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:be(a.onKeyDown,E=>{s||E.target!==E.currentTarget||u.searchRef?.current!==""&&E.key===" "||(eI.includes(E.key)&&b(),E.key===" "&&E.preventDefault())})})})})},"SelectItem")),Mr="SelectItemText",SI=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,className:o,style:s,...i}=t,a=Wn(Mr,r),d=pn(Mr,r),u=Kp(Mr,r),f=oI(Mr,r),[c,m]=l.useState(null),h=wt(b=>d.itemTextRefCallback?.(b,u.value,u.disabled)),p=Ee(n,m,u.onItemTextChange,h),g=c?.textContent,v=l.useMemo(()=>w.jsx("option",{value:u.value,disabled:u.disabled,children:g},u.value),[u.disabled,u.value,g]),{onNativeOptionAdd:S,onNativeOptionRemove:x}=f;return $e(()=>(S(v),()=>x(v)),[S,x,v]),w.jsxs(w.Fragment,{children:[w.jsx(ze.span,{id:u.textId,...i,ref:p}),u.isSelected&&a.valueNode&&!a.valueNodeHasChildren&&!oa(a.value)?lt.createPortal(i.children,a.valueNode):null]})},"SelectItemText")),EI="SelectItemIndicator",_I=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,...o}=t;return Kp(EI,r).isSelected?w.jsx(ze.span,{"aria-hidden":!0,...o,ref:n}):null},"SelectItemIndicator")),$c="SelectScrollUpButton",Jp=l.forwardRef(oe(function(t,n){const r=pn($c,t.__scopeSelect),o=ra($c,t.__scopeSelect),[s,i]=l.useState(!1),a=Ee(n,o.onScrollButtonChange);return $e(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=u.scrollTop>0;i(f)};oe(d,"handleScroll");const u=r.viewport;return d(),u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?w.jsx(Xp,{...t,ref:a,onAutoScroll:()=>{const{viewport:d,selectedItem:u}=r;d&&u&&(d.scrollTop=d.scrollTop-u.offsetHeight)}}):null},"SelectScrollUpButton")),Nc="SelectScrollDownButton",Yp=l.forwardRef(oe(function(t,n){const r=pn(Nc,t.__scopeSelect),o=ra(Nc,t.__scopeSelect),[s,i]=l.useState(!1),a=Ee(n,o.onScrollButtonChange);return $e(()=>{if(r.viewport&&r.isPositioned){let d=function(){const f=u.scrollHeight-u.clientHeight,c=Math.ceil(u.scrollTop)<f;i(c)};oe(d,"handleScroll");const u=r.viewport;return d(),u.addEventListener("scroll",d),()=>u.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),s?w.jsx(Xp,{...t,ref:a,onAutoScroll:()=>{const{viewport:d,selectedItem:u}=r;d&&u&&(d.scrollTop=d.scrollTop+u.offsetHeight)}}):null},"SelectScrollDownButton")),Xp=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,onAutoScroll:o,...s}=t,i=pn("SelectScrollButton",r),a=l.useRef(null),d=Co(r),u=l.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return l.useEffect(()=>()=>u(),[u]),$e(()=>{d().find(c=>c.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),w.jsx(ze.div,{"aria-hidden":!0,...s,ref:n,style:{flexShrink:0,...s.style},onPointerDown:be(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(o,50))}),onPointerMove:be(s.onPointerMove,()=>{i.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(o,50))}),onPointerLeave:be(s.onPointerLeave,()=>{u()})})},"SelectScrollButtonImpl")),Qp=l.forwardRef(oe(function(t,n){const{__scopeSelect:r,...o}=t;return w.jsx(ze.div,{"aria-hidden":!0,...o,ref:n})},"SelectSeparator"));function em(e){return typeof e=="function"}oe(em,"isFunction");function oa(e){return e===""||e===void 0}oe(oa,"shouldShowPlaceholder");function sa(e){const t=wt(e),n=l.useRef(""),r=l.useRef(0),o=l.useCallback(i=>{const a=n.current+i;t(a),oe((function d(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>d(""),1e3))}),"updateSearch")(a)},[t]),s=l.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return l.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}oe(sa,"useTypeaheadSearch");function ia(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=tm(e,Math.max(s,0));o.length===1&&(i=i.filter(u=>u!==n));const d=i.find(u=>u.textValue.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}oe(ia,"findNextItem");function tm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}oe(tm,"wrapArray");const CI=l.forwardRef(({className:e,children:t,size:n,...r},o)=>w.jsxs(Wp,{ref:o,className:Q("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,w.jsx(aI,{asChild:!0,children:w.jsx(jc,{className:"h-4 w-4 opacity-50"})})]}));CI.displayName=Wp.displayName;const nm=l.forwardRef(({className:e,...t},n)=>w.jsx(Jp,{ref:n,className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(xm,{className:"h-4 w-4"})}));nm.displayName=Jp.displayName;const rm=l.forwardRef(({className:e,...t},n)=>w.jsx(Yp,{ref:n,className:Q("flex cursor-default items-center justify-center py-1",e),...t,children:w.jsx(jc,{className:"h-4 w-4"})}));rm.displayName=Yp.displayName;const PI=l.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>w.jsx(dI,{children:w.jsxs(Vp,{ref:o,className:Q("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-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]:sli
47de-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",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:[w.jsx(nm,{}),w.jsx(gI,{className:Q("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),w.jsx(rm,{})]})}));PI.displayName=Vp.displayName;const II=l.forwardRef(({className:e,...t},n)=>w.jsx(Gp,{ref:n,className:Q("px-2 py-1.5 text-sm font-semibold",e),...t}));II.displayName=Gp.displayName;const RI=l.forwardRef(({className:e,children:t,...n},r)=>w.jsxs(qp,{ref:r,className:Q("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[w.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:w.jsx(_I,{children:w.jsx(si,{className:"h-4 w-4"})})}),w.jsx(SI,{children:t})]}));RI.displayName=qp.displayName;const OI=l.forwardRef(({className:e,...t},n)=>w.jsx(Qp,{ref:n,className:Q("-mx-1 my-1 h-px bg-muted",e),...t}));OI.displayName=Qp.displayName;function TI({className:e,...t}){return w.jsx(Sm,{role:"status","aria-label":"Loading",className:Q("size-4 animate-spin",e),...t})}let AI="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Dc=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=AI[n[e]&63];return t};const $I=async e=>{try{const n=await(await fetch(e)).blob();return new Promise(r=>{const o=new FileReader;o.onloadend=()=>r(o.result),o.onerror=()=>r(null),o.readAsDataURL(n)})}catch{return null}},NI=l.createContext(null),DI=l.createContext(null),om=()=>l.useContext(NI),MI=()=>l.useContext(DI),sm=l.createContext(null),kI=()=>{const e=MI(),n=l.useContext(sm)??e;if(!n)throw new Error("usePromptInputAttachments must be used within a PromptInput or PromptInputProvider");return n},jI=l.createContext(null),LI=({className:e,accept:t,multiple:n,globalDrop:r,syncHiddenInput:o,maxFiles:s,maxFileSize:i,onError:a,onSubmit:d,children:u,...f})=>{const c=om(),m=!!c,h=l.useRef(null),p=l.useRef(null),[g,v]=l.useState([]),S=m?c.attachments.files:g,[x,b]=l.useState([]),E=l.useRef(S);l.useEffect(()=>{E.current=S},[S]);const _=l.useCallback(()=>{h.current?.click()},[]),y=l.useCallback(I=>!t||t.trim()===""?!0:t.split(",").map(z=>z.trim()).filter(Boolean).some(z=>{if(z.endsWith("/*")){const j=z.slice(0,-1);return I.type.startsWith(j)}return I.type===z}),[t]),P=l.useCallback(I=>{const k=[...I],z=k.filter(J=>y(J));if(k.length&&z.length===0){a?.({code:"accept",message:"No files match the accepted types."});return}const j=J=>i?J.size<=i:!0,q=z.filter(j);if(z.length>0&&q.length===0){a?.({code:"max_file_size",message:"All files exceed the maximum size."});return}v(J=>{const L=typeof s=="number"?Math.max(0,s-J.length):void 0,G=typeof L=="number"?q.slice(0,L):q;typeof L=="number"&&q.length>L&&a?.({code:"max_files",message:"Too many files. Some were not added."});const ee=[];for(const ne of G)ee.push({filename:ne.name,id:Dc(),mediaType:ne.type,type:"file",url:URL.createObjectURL(ne)});return[...J,...ee]})},[y,s,i,a]),T=l.useCallback(I=>v(k=>{const z=k.find(j=>j.id===I);return z?.url&&URL.revokeObjectURL(z.url),k.filter(j=>j.id!==I)}),[]),R=l.useCallback(I=>{const k=[...I],z=k.filter(ee=>y(ee));if(k.length&&z.length===0){a?.({code:"accept",message:"No files match the accepted types."});return}const j=ee=>i?ee.size<=i:!0,q=z.filter(j);if(z.length>0&&q.length===0){a?.({code:"max_file_size",message:"All files exceed the maximum size."});return}const J=S.length,L=typeof s=="number"?Math.max(0,s-J):void 0,G=typeof L=="number"?q.slice(0,L):q;typeof L=="number"&&q.length>L&&a?.({code:"max_files",message:"Too many files. Some were not added."}),G.length>0&&c?.attachments.add(G)},[y,i,s,a,S.length,c]),N=l.useCallback(()=>m?c?.attachments.clear():v(I=>{for(const k of I)k.url&&URL.revokeObjectURL(k.url);return[]}),[m,c]),D=l.useCallback(()=>b([]),[]),C=m?R:P,O=m?c.attachments.remove:T,A=m?c.attachments.openFileDialog:_,U=l.useCallback(()=>{N(),D()},[N,D]);l.useEffect(()=>{m&&c.__registerFileInput(h,()=>h.current?.click())},[m,c]),l.useEffect(()=>{o&&h.current&&S.length===0&&(h.current.value="")},[S,o]),l.useEffect(()=>{const I=p.current;if(!I||r)return;const k=j=>{j.dataTransfer?.types?.includes("Files")&&j.preventDefault()},z=j=>{j.dataTransfer?.types?.includes("Files")&&j.preventDefault(),j.dataTransfer?.files&&j.dataTransfer.files.length>0&&C(j.dataTransfer.files)};return I.addEventListener("dragover",k),I.addEventListener("drop",z),()=>{I.removeEventListener("dragover",k),I.removeEventListener("drop",z)}},[C,r]),l.useEffect(()=>{if(!r)return;const I=z=>{z.dataTransfer?.types?.includes("Files")&&z.preventDefault()},k=z=>{z.dataTransfer?.types?.includes("Files")&&z.preventDefault(),z.dataTransfer?.files&&z.dataTransfer.files.length>0&&C(z.dataTransfer.files)};return document.addEventListener("dragover",I),document.addEventListener("drop",k),()=>{document.removeEventListener("dragover",I),document.removeEventListener("drop",k)}},[C,r]),l.useEffect(()=>()=>{if(!m)for(const I of E.current)I.url&&URL.revokeObjectURL(I.url)},[m]);const B=l.useCallback(I=>{I.currentTarget.files&&C(I.currentTarget.files),I.currentTarget.value=""},[C]),Z=l.useMemo(()=>({add:C,clear:N,fileInputRef:h,files:S.map(I=>({...I,id:I.id})),openFileDialog:A,remove:O}),[S,C,O,N,A]),V=l.useMemo(()=>({add:I=>{const k=Array.isArray(I)?I:[I];b(z=>[...z,...k.map(j=>({...j,id:Dc()}))])},clear:D,remove:I=>{b(k=>k.filter(z=>z.id!==I))},sources:x}),[x,D]),H=l.useCallback(async I=>{I.preventDefault();const k=I.currentTarget,z=m?c.textInput.value:new FormData(k).get("message")||"";m||k.reset();try{const j=await Promise.all(S.map(async({id:J,...L})=>{if(L.url?.startsWith("blob:")){const G=await $I(L.url);return{...L,url:G??L.url}}return L})),q=d({files:j,text:z},I);if(q instanceof Promise)try{await q,U(),m&&c.textInput.clear()}catch{}else U(),m&&c.textInput.clear()}catch{}},[m,c,S,d,U]),F=w.jsxs(w.Fragment,{children:[w.jsx("input",{accept:t,"aria-label":"Upload files",className:"hidden",multiple:n,onChange:B,ref:h,title:"Upload files",type:"file"}),w.jsx("form",{className:Q("w-full",e),onSubmit:H,ref:p,...f,children:w.jsx(F0,{className:"overflow-hidden",children:u})})]}),ie=w.jsx(jI.Provider,{value:V,children:F});return w.jsx(sm.Provider,{value:Z,children:ie})},zI=({onChange:e,onKeyDown:t,className:n,placeholder:r="What would you like to know?",...o})=>{const s=om(),i=kI(),[a,d]=l.useState(!1),u=l.useCallback(p=>{if(t?.(p),!p.defaultPrevented){if(p.key==="Enter"){if(a||p.nativeEvent.isComposing||p.shiftKey)return;p.preventDefault();const{form:g}=p.currentTarget;if(g?.querySelector('button[type="submit"]')?.disabled)return;g?.requestSubmit()}if(p.key==="Backspace"&&p.currentTarget.value===""&&i.files.length>0){p.preventDefault();const g=i.files.at(-1);g&&i.remove(g.id)}}},[t,a,i]),f=l.useCallback(p=>{const g=p.clipboardData?.items;if(!g)return;const v=[];for(const S of g)if(S.kind==="file"){const x=S.getAsFile();x&&v.push(x)}v.length>0&&(p.preventDefault(),i.add(v))},[i]),c=l.useCallback(()=>d(!1),[]),m=l.useCallback(()=>d(!0),[]),h=s?{onChange:p=>{s.textInput.setInput(p.currentTarget.value),e?.(p)},value:s.textInput.value}:{onChange:e};return w.jsx(V0,{className:Q("field-sizing-content max-h-48 min-h-16",n),name:"message",onCompositionEnd:c,onCompositionStart:m,onKeyDown:u,onPaste:f,placeholder:r,...o,...h})},FI=({className:e,...t})=>
47w.jsx(U0,{align:"block-end",className:Q("justify-between gap-1",e),...t}),ZI=({className:e,variant:t="default",size:n="icon-sm",status:r,onStop:o,onClick:s,children:i,...a})=>{const d=r==="submitted"||r==="streaming";let u=w.jsx(Im,{className:"size-4"});r==="submitted"?u=w.jsx(TI,{}):r==="streaming"?u=w.jsx(Om,{className:"size-4"}):r==="error"&&(u=w.jsx(ii,{className:"size-4"}));const f=l.useCallback(c=>{if(d&&o){c.preventDefault(),o();return}s?.(c)},[d,o,s]);return w.jsx(W0,{"aria-label":d?"Stop":"Submit",className:Q(e),onClick:f,size:n,type:d&&o?"button":"submit",variant:t,...a,children:i??u})};function UI(){return w.jsxs("div",{className:"mt-1 inline-flex items-center gap-1",role:"status","aria-label":"Assistant is typing",children:[w.jsx("span",{className:"sr-only",children:"Assistant is typing…"}),w.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-foreground/30 animate-bounce [animation-delay:-0.3s]"}),w.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-foreground/30 animate-bounce [animation-delay:-0.15s]"}),w.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-foreground
47/30 animate-bounce"})]})}function im(e){if(!e)return e;const t=o=>/"cart_card"|"lineTotal"|"estimatedPortions"|("subtotal"[\s\S]*"items"|"items"[\s\S]*"subtotal")/.test(o);let n=e;return n=n.replace(/```[a-zA-Z]*\n?([\s\S]*?)```/g,(o,s)=>t(s)?"":o),n=(o=>{let s="",i=0;for(;i<o.length;){const a=o[i];if(a==="{"){let d=0,u=i,f=!1,c=!1;for(;u<o.length;u++){const m=o[u];if(f)c?c=!1:m==="\\"?c=!0:m==='"'&&(f=!1);else if(m==='"')f=!0;else if(m==="{")d++;else if(m==="}"&&(d--,d===0)){u++;break}}if(d===0){const m=o.slice(i,u);if(t(m)){i=u;continue}}}s+=a,i++}return s})(n),n=n.replace(/\{\{?\s*(?:propose_)?cart(?:_card)?\s*\}?\}/gi,""),n=n.replace(/\[\s*(?:propose_)?cart(?:_card)?\s*\]/gi,""),n=n.replace(/^\s*\*\*\s*Proposed Cart\s*\*\*\s*:?\s*$\n?/gim,""),n=n.replace(/!\[[^\]]*\]\([^)]*\)/g,""),n=n.replace(/\[([^\]]*)\]\(\s*https?:\/\/[^)\s]+\.(?:png|jpe?g|webp|gif|avif|svg)[^)]*\)/gi,"$1"),n=n.replace(/https?:\/\/\S+\.(?:png|jpe?g|webp|gif|avif|svg)(?:\?\S*)?/gi,""),n.replace(/\n{3,}/g,`
48
49`).trim()}const ni="tracy-chat-messages-v6",ri="tracy-chat-conversation-id-v6",aa="tracy-chat-started-at-v6",qn="tracy-chat-input-draft-v1",am="tracy-chat-abandoned-sent-",BI=1200*1e3,WI=["tracy-chat-messages-v1","tracy-chat-conversation-id-v1","tracy-chat-started-at-v1","tracy-chat-messages-v2","tracy-chat-conversation-id-v2","tracy-chat-started-at-v2","tracy-chat-messages-v3","tracy-chat-conversation-id-v3","tracy-chat-started-at-v3","tracy-chat-messages-v4","tracy-chat-conversation-id-v4","tracy-chat-started-at-v4","tracy-chat-messages-v5","tracy-chat-conversation-id-v5","tracy-chat-started-at-v5"];if(typeof window<"u")try{WI.forEach(e=>window.localStorage.removeItem(e))}catch{}const VI=["Get a Quote","Ask About Menus","Compare Drop-Off vs Full-Service","Find My Order","Dietary / Allergy Help"],HI="Hi! I'm the Catering Concierge. I can help with menus, packages, pricing, dietary questions, and starting a catering quote.";function GI(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(ni);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function KI(){if(typeof window>"u")return"";try{let e=window.localStorage.getItem(ri);return e||(e=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`conv-${Date.now()}-${Math.random().toString(36).slice(2)}`,window.localStorage.setItem(ri,e),window.localStorage.setItem(aa,new Date().toISOString())),e}catch{return`conv-${Date.now()}`}}function cm(e){return(e.parts??[]).map(t=>t.type==="text"?t.text:"").join("").trim()}function qI(e){return(e.parts??[]).some(t=>t?.type==="text"?im(t.text||"").length>0:t?.type==="tool-show_photos"?t.state==="output-available"&&Array.isArray(t.output?.photos)&&t.output.photos.length>0:t?.type==="tool-propose_cart"?t.state==="output-available"&&t.output&&Array.isArray(t.output.matched):!1)}function JI(e){const t=e.map(cm).join(`
50`),n=t.match(/[\w.+-]+@[\w-]+\.[\w.-]+/)?.[0]||"",r=t.match(/(?:\+?1[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}/)?.[0]||"";return{name:"",email:n,phone:r}}function Mc(e,t){const n=typeof window<"u"&&window.localStorage.getItem(aa)||new Date().toISOString(),r=e.filter(o=>o.role==="user"||o.role==="assistant").map(o=>({role:o.role,content:cm(o),ts:o.createdAt||new Date().toISOString()})).filter(o=>o.content.length>0);return{conversation_id:t,visitor:JI(e),page:typeof window<"u"?window.location.pathname:"",started_at:n,ended_at:new Date().toISOString(),transcript:r}}async function YI(e){try{await fetch("/api/public/chatbot/log",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),keepalive:!0})}catch{}}function XI(e){let t=null,n=!1;for(const r of e)for(const o of r.parts)if(!(!o||typeof o!="object")){if(o.type==="tool-save_draft_quote"&&o.state==="output-available"){const s=o.output?.draft;s&&typeof s=="object"&&(t=s)}o.type==="tool-submit_quote_request"&&o.state==="output-available"&&o.output?.submitted===!0&&(n=!0)}return{latestDraft:t,submittedConfirmed:n}}function QI(e){if(typeof window>"u")return;const t=c=>typeof c=="string"&&c.trim()?c.trim():void 0,n={},r=t(e.clientName),o=t(e.email),s=t(e.phone),i=t(e.guestCount),a=t(e.eventDate),d=t(e.eventType),u=t(e.aiSummary);r&&(n.name=r),o&&(n.email=o),s&&(n.phone=s),i&&(n.guests=i),a&&(n.date=a),d&&(n.event_type=d),u&&(n.notes=u);const f=window;f.dataLayer=f.dataLayer||[],f.dataLayer.push({event:"chatbot_lead",lead_source:"catering_concierge",user_data:n,click_ids:fm()})}function eR(e){if(typeof window>"u")return!1;try{return window.localStorage.getItem(am+e)==="1"}catch{return!1}}function tR(e){if(!(typeof window>"u"))try{window.localStorage.setItem(am+e,"1")}
50catch{}}function kc(e,t,n,r){if(eR(e))return;const o={conversationId:e,reason:t,page:typeof window<"u"?window.location.pathname:"",draft:n,adClickIds:Lc()},s=JSON.stringify(o),i="/api/public/chatbot/submit-abandoned";try{if(r&&typeof navigator<"u"&&navigator.sendBeacon){const a=new Blob([s],{type:"application/json"});navigator.sendBeacon(i,a)}else fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:s,keepalive:!0});tR(e)}catch{}}function kR({onClose:e}){const t=mm(),{tenant:n}=dm(),[r]=l.useState(()=>GI()),[o,s]=l.useState(()=>{if(typeof window>"u")return"";try{return window.localStorage.getItem(qn)??""}catch{return""}}),i=l.useRef(null),[a]=l.useState(()=>KI()),[d,u]=l.useState(null),[f,c]=l.useState(null),m=l.useMemo(()=>new gi({api:"/api/public/chat",headers:()=>{const C=n?.domain_name?.trim(),O=n?.city_name?.trim(),A={};return C&&(A["x-tenant-host"]=C),O&&(A["x-tenant-city"]=O),A},body:()=>({adClickIds:Lc()})}),[n?.domain_name,n?.city_name]),{messages:h,sendMessage:p,status:g,error:v,setMessages:S,stop:x}=Pw({id:"tracy-catering-chat",messages:r,transport:m,onError:C=>{console.error("chat stream error",C),c("The assistant connection dropped before a response came through. Please try again — or call us for the quickest help at")},onFinish:({message:C,isError:O,isDisconnect:A,isAbort:U,finishReason:B})=>{O||A||U||!qI(C)?(console.error("chat stream finished without renderable output",{isError:O,isDisconnect:A,isAbort:U,finishReason:B,parts:C.parts}),c("The assistant returned an empty response. Please try again — or call us for the quickest help at")):c(null)}}),b=l.useRef(h);l.useEffect(()=>{b.current=h},[h]);const E=l.useRef(null);l.useEffect(()=>{if(!v)return;const C=b.current,O=C[C.length-1];if(!O||O.role!=="user")return;const A=(O.parts??[]).map(Z=>Z?.type==="text"?Z.text:"").join(" ").trim();if(!A)return;const U=`${O.id}:${A}`;if(E.current===U)return;E.current=U;const B=setTimeout(()=>{try{S(C.slice(0,-1)),p({text:A})}catch{}},400);return()=>clearTimeout(B)},[v,p,S]);const _=l.useRef({latestDraft:null,submittedConfirmed:!1});l.useEffect(()=>{_.current=XI(h)},[h]);const y=l.useRef(new Set);l.useEffect(()=>{for(const C of h)for(const O of C.parts){if(!O||typeof O!="object"||O.type!=="tool-submit_quote_request"||O.state!=="output-available"||O.output?.submitted!==!0)continue;const A=O.toolCallId??`${C.id}:submit`;y.current.has(A)||(y.current.add(A),QI(O.input&&typeof O.input=="object"?O.input:{}))}},[h]),l.useEffect(()=>{if(typeof window>"u")return;let C=null;const O=()=>{C&&clearTimeout(C),C=setTimeout(()=>{const{latestDraft:U,submittedConfirmed:B}=_.current;!U||B||kc(a,"idle",U,!1)},BI)},A=["mousemove","keydown","touchstart","scroll","visibilitychange"];return A.forEach(U=>window.addEventListener(U,O,{passive:!0})),O(),()=>{C&&clearTimeout(C),A.forEach(U=>window.removeEventListener(U,O))}},[a]),l.useEffect(()=>{if(typeof window>"u")return;const C=()=>{const{latestDraft:O,submittedConfirmed:A}=_.current;!O||A||kc(a,"unload",O,!0)};return window.addEventListener("pagehide",C),()=>window.removeEventListener("pagehide",C)},[a]),l.useEffect(()=>{let C=!1;return fetch("/api/public/chatbot/runtime-config").then(O=>O.json()).then(O=>{C||u(O)}).catch(()=>{}),()=>{C=!0}},[]),l.useEffect(()=>{g==="ready"&&(h.length<2||YI(Mc(h,a)))},[g,h,a]),l.useEffect(()=>()=>{const C=b.current;if(!(C.length<2))try{const O=JSON.stringify(Mc(C,a));if(typeof navigator<"u"&&navigator.sendBeacon){const A=new Blob([O],{type:"application/json"});navigator.sendBeacon("/api/public/chatbot/log",A)}else fetch("/api/public/chatbot/log",{method:"POST",headers:{"Content-Type":"application/json"},body:O,keepalive:!0})}catch{}},[a]),l.useEffect(()=>{if(!(typeof window>"u"))try{window.localStorage.setItem(ni,JSON.stringify(h))}catch{}},[h]),l.useEffect(()=>{if(!(typeof window>"u"))try{o?window.localStorage.setItem(qn,o):window.localStorage.removeItem(qn)}catch{}},[o]),l.useEffect(()=>{i.current?.focus()},[g]);const P=l.useCallback((C,O)=>{O.preventDefault?.();const A=o.trim();if(!(!A||g==="streaming"||g==="submitted")){c(null),s("");try{window.localStorage.removeItem(qn)}catch{}p({text:A})}},[o,p,g]),T=l.useCallback(C=>{g==="streaming"||g==="submitted"||(c(null),p({text:C}))},[p,g]),R=l.useCallback(()=>{S([]),c(null);try{window.localStorage.removeItem(ni),window.localStorage.removeItem(ri),window.localStorage.removeItem(aa),window.localStorage.removeItem(qn)}catch{}},[S]);if(d&&d.enabled===!1)return w.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 p-6 text-center",children:[w.jsx("div",{className:"text-sm font-semibold",children:"Catering Concierge"}),w.jsxs("div",{className:"text-sm text-muted-foreground",children:["Our concierge is temporarily unavailable. For the quickest help, please call"," ",w.jsx("a",{className:"underline font-medium",href:"tel:8777894377",children:"877-789-4377"}),"."]})]});const N=h.length===0,D=g==="submitted"||g==="streaming";return w.jsxs("div",{className:"flex h-full flex-col bg-card",children:[w.jsxs("div",{className:"flex items-center justify-between border-b border-border bg-primary text-primary-foreground px-4 py-3",children:[w.jsxs("div",{children:[w.jsx("div",{className:"text-sm font-semibold tracking-wide",children:"Catering Concierge"}),w.jsx("div",{className:"text-xs opacity-80",children:"Menus, packages, pricing, and order help"})]}),w.jsxs("div",{className:"flex items-center gap-1",children:[h.length>0&&w.jsx("button",{type:"button",onClick:R,"aria-label":"Clear conversation",className:"rounded-md p-1.5 text-primary-foreground
50/80 hover:bg-white/10 hover:text-primary-foreground",children:w.jsx(Em,{className:"h-4 w-4"})}),e&&w.jsx("button",{type:"button",onClick:e,"aria-label":"Close chat",className:"rounded-md p-1.5 text-primary-foreground/80 hover:bg-white/10 hover:text-primary-foreground",children:w.jsx(ii,{className:"h-4 w-4"})})]})]}),w.jsxs(Nw,{className:"flex-1",children:[w.jsxs(Dw,{children:[N?w.jsxs("div",{className:"flex flex-col gap-4 pt-6",children:[w.jsx("div",{className:"text-sm text-foreground/80 leading-relaxed",children:HI}),w.jsx("div",{className:"flex flex-col gap-2",children:VI.map(C=>w.jsx("button",{type:"button",onClick:()=>T(C),className:"rounded-lg border border-border bg-card px-3 py-2 text-left text-sm hover:border-primary/40 hover:bg-secondary transition-colors",children:C},C))})]}):h.map(C=>w.jsx(nR,{message:C},C.id)),D&&w.jsx(UI,{}),(v||f)&&w.jsxs("div",{className:"mt-2 rounded-md border border-destructive/40 bg-destructive/10 p-3 text-xs text-destructive",children:[f||"Connection lost. Please try again in a moment — for the quickest help, please call us at"," ",w.jsx("a",{className:"underline font-medium",href:"tel:8777894377",children:"877-789-4377"}),"."]})]}),w.jsx(Mw,{})]}),w.jsx("div",{className:"border-t border-border p-3",children:w.jsxs(LI,{onSubmit:P,children:[w.jsx(zI,{ref:i,value:o,onChange:C=>s(C.target.value),onKeyDown:C=>{if(C.key==="Enter"&&!C.shiftKey&&!C.nativeEvent.isComposing&&t){C.preventDefault();const O=C.currentTarget,A=O.selectionStart??O.value.length,U=O.selectionEnd??O.value.length,B=O.value.slice(0,A)+`
51`+O.value.slice(U);s(B),requestAnimationFrame(()=>{O.selectionStart=O.selectionEnd=A+1})}},placeholder:"Type your question…",className:"text-base"}),w.jsx(FI,{className:"justify-end",children:w.jsx(ZI,{status:g,disabled:!o.trim()&&!D,onStop:x})})]})})]})}function nR({message:e}){const t=e.role==="user";return w.jsx(WS,{from:e.role,children:w.jsx(VS,{className:t?"bg-primary text-primary-foreground":"bg-transparent p-0 text-foreground",children:(()=>{const n=e.parts.some(r=>r.type==="tool-propose_cart"&&r.state==="output-available");return e.parts.map((r,o)=>{if(r.type==="text"){if(t)return w.jsx("span",{className:"whitespace-pre-wrap",children:r.text},o);const s=im(r.text);return s?w.jsx(Ju,{children:s},o):r.text&&r.text.trim()&&!n?w.jsx("span",{className:"text-muted-foreground italic",children:"Building your cart…"},o):null}if(r.type==="tool-show_photos"){const s=r.state,i=r.output;return s!=="output-available"||!i?.photos?.length?null:w.jsx(oR,{photos:i.photos},o)}if(r.type==="tool-propose_cart"){const s=r.state,i=r.output;return s!=="output-available"||!i?null:w.jsx(rR,{data:i},o)}return null})})()})})}function rR({data:e}){const t=pm(),[n,r]=l.useState(!1),[o,s]=l.useState(e.matched),i=o.reduce((u,f)=>u+f.lineTotal,0),a=u=>{s(f=>f.filter((c,m)=>m!==u))},d=()=>{if(n||o.length===0)return;const u=To.getState().add;To.getState().lines.length;for(const f of o){const c={itemId:f.itemId,size:f.size,quantity:f.quantity,name:f.name,price:f.unitPrice,unitLabel:f.unitLabel??(f.size==="unit"?"ea":"tray"),isTaxable:f.isTaxable??void 0,description:f.description??void 0,image:f.imageUrl??void 0};u(c)}To.getState().lines.length,r(!0),setTimeout(()=>{t({to:"/cart"})},350)};return!o.length&&!e.unmatched.length?null:w.jsxs("div",{className:"mt-2 rounded-xl border border-border bg-card p-3 shadow-sm",children:[w.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs font-semibold uppercase tracking-wide text-foreground/70",children:[w.jsx(ua,{className:"h-3.5 w-3.5"}),"Proposed cart",o.some(u=>u.isEstimated)&&w.jsx("span",{className:"ml-1 rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-700 dark:text-amber-300 normal-case tracking-normal",children:"Estimated"})]}),e.estimatedNote&&w.jsx("div",{className:"mb-2 rounded-md bg-amber-500/10 px-2 py-1.5 text-[11px] text-amber-800 dark:text-amber-200",children:e.estimatedNote}),o.length>0&&w.jsx("ul",{className:"divide-y divide-border/60",children:o.map((u,f)=>w.jsxs("li",{className:"flex items-center gap-2 py-2",children:[u.imageUrl?w.jsx("img",{src:u.imageUrl,alt:u.name,className:"h-10 w-10 flex-shrink-0 rounded-md object-cover",loading:"lazy"}):w.jsx("div",{className:"h-10 w-10 flex-shrink-0 rounded-md bg-muted"}),w.jsxs("div",{className:"min-w-0 flex-1",children:[w.jsx("div",{className:"truncate text-sm font-medium",children:u.name}),w.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[u.quantity," × ",u.size==="unit"?u.unitLabel||"ea":u.size," · $",u.unitPrice.toFixed(2),u.isEstimated&&w.jsx("span",{className:"ml-1 text-amber-600 dar
51k:text-amber-400",children:"· est."})]})]}),w.jsxs("div",{className:"text-sm font-semibold tabular-nums",children:["$",u.lineTotal.toFixed(2)]}),!n&&w.jsx("button",{type:"button",onClick:()=>a(f),"aria-label":`Remove ${u.name}`,className:"ml-1 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",children:w.jsx(ii,{className:"h-3.5 w-3.5"})})]},`${u.itemId}-${u.size}-${f}`))}),e.unmatched.length>0&&w.jsxs("div",{className:"mt-2 rounded-md bg-muted/60 p-2 text-[11px] text-muted-foreground",children:["Couldn't find:"," ",e.unmatched.map((u,f)=>w.jsxs("span",{children:[f>0?", ":"",w.jsx("span",{className:"font-medium",children:u.requested})]},f)),". Ask me to try a different name."]}),e.completenessPrompts&&e.completenessPrompts.length>0&&w.jsx("div",{className:"mt-2 space-y-1",children:e.completenessPrompts.map((u,f)=>w.jsx("div",{className:"rounded-md bg-primary/5 px-2 py-1.5 text-[11px] text-foreground/80",children:u},f))}),o.length>0&&w.jsxs("div",{className:"mt-3 flex items-center justify-between gap-4 border-t border-border pt-2",children:[w.jsxs("div",{className:"min-w-0 flex-1 text-xs text-muted-foreground",children:["Subtotal ",w.jsxs("span",{className:"font-semibold text-foreground tabular-nums",children:["$",i.toFixed(2)]}),w.jsx("span",{className:"ml-1",children:"(before delivery & tax)"})]}),w.jsx("button",{type:"button",onClick:d,disabled:n,className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-60",children:n?w.jsxs(w.Fragment,{children:[w.jsx(si,{className:"h-3.5 w-3.5"})," Added — opening cart…"]}):w.jsxs(w.Fragment,{children:[w.jsx(ua,{className:"h-3.5 w-3.5"})," Add all to cart"]})})]})]})}function oR({photos:e}){return w.jsx("div",{className:"mt-2 grid grid-cols-3 gap-2",children:e.map((t,n)=>w.jsxs("a",{href:t.imageUrl,target:"_blank",rel:"noopener noreferrer",className:"group flex flex-col overflow-hidden rounded-lg border border-border bg-card hover:border-primary/40 transition-colors",title:t.name,children:[w.jsx("div",{className:"aspect-square w-full overflow-hidden bg-muted",children:w.jsx("img",{src:t.imageUrl,alt:t.name,loading:"lazy",className:"h-full w-full object-cover transition-transform group-hover:scale-105"})}),w.jsx("div",{className:"px-1.5 py-1 text-[10px] leading-tight text-foreground/80 line-clamp-2",children:t.name})]},`${t.imageUrl}-${n}`))})}export{kR as ChatPanel,kR as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.