@deepagents/devtool 7.1.4 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,7 +12,7 @@ ${a}`,l++}else Lu(e,n,i)?u=e.slice(e.charCodeAt(n+6)===Nu?n+7:n+6,r)||void 0:p(e
|
|
|
12
12
|
${i}`,l++;return}if(Lu(e,t,r)){u=e.slice(e.charCodeAt(t+6)===Nu?t+7:t+6,n)||void 0;return}if(r===105&&e.charCodeAt(t+1)===100&&e.charCodeAt(t+2)===58){let r=e.slice(e.charCodeAt(t+3)===Nu?t+4:t+3,n);s=r.includes(`\0`)?void 0:r;return}if(r===58){if(i){let r=e.slice(t,n);i(r.slice(e.charCodeAt(t+1)===Nu?2:1))}return}let a=e.slice(t,n),o=a.indexOf(`:`);if(o===-1){m(a,``,a);return}let d=a.slice(0,o),f=a.charCodeAt(o+1)===Nu?2:1;m(d,a.slice(o+f),a)}function m(e,t,i){switch(e){case`event`:u=t||void 0;break;case`data`:c=l===0?t:`${c}
|
|
13
13
|
${t}`,l++;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new Au(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new Au(`Unknown field "${e.length>20?`${e.slice(0,20)}\u2026`:e}"`,{type:`unknown-field`,field:e,value:t,line:i}));break}}function h(){l>0&&t({id:s,event:u,data:c}),s=void 0,c=``,l=0,u=void 0}function g(e={}){if(e.consume&&a.length>0){let e=a.join(``);p(e,0,e.length)}o=!0,s=void 0,c=``,l=0,u=void 0,a.length=0}return{feed:d,reset:g}}function Iu(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 Lu(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}var Ru=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Fu({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};new TextDecoder;var{btoa:zu,atob:Bu}=globalThis;function Vu(e){if(e==null)return{};let t={};if(e instanceof Headers)e.forEach((e,n)=>{t[n.toLowerCase()]=e});else{Array.isArray(e)||(e=Object.entries(e));for(let[n,r]of e)r!=null&&(t[n.toLowerCase()]=r)}return t}var Hu=`vercel.ai.error.${`AI_DownloadError`}`;function Uu(e){let t=e.split(`.`);return t.length===4&&t.every(e=>{let t=Number(e);return Number.isInteger(t)&&t>=0&&t<=255&&String(t)===e})}function Wu(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error(`Capture current module path`);Error.captureStackTrace(e,Wu);let[t]=e.stack,n=t?.getFileName();if(n==null)throw Error(`Unable to determine the current module path`);return n}finally{Error.prepareStackTrace=e}}var Gu=({prefix:e,size:t=16,alphabet:n=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz`,separator:r=`-`}={})=>{let i=()=>{let e=n.length,r=Array(t);for(let i=0;i<t;i++)r[i]=n[Math.random()*e|0];return r.join(``)};if(e==null)return i;if(n.includes(r))throw new _u({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},Ku=Gu();function qu(e){return globalThis.Buffer?.isBuffer(e)??!1}var Ju=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,Yu=/"(?: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 Xu(e){let t=JSON.parse(e);return typeof t!=`object`||!t||Ju.test(e)===!1&&Yu.test(e)===!1?t:Zu(t)}function Zu(e){let t=[e];for(;t.length;){let e=t;t=[];for(let n of e){if(Object.prototype.hasOwnProperty.call(n,`__proto__`)||Object.prototype.hasOwnProperty.call(n,`constructor`)&&n.constructor!==null&&typeof n.constructor==`object`&&Object.prototype.hasOwnProperty.call(n.constructor,`prototype`))throw SyntaxError(`Object contains forbidden prototype property`);for(let e in n){let r=n[e];r&&typeof r==`object`&&t.push(r)}}}return e}function Qu(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return Xu(e)}try{return Xu(e)}finally{Error.stackTraceLimit=t}}function $u(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){let{additionalProperties:t}=e;e.additionalProperties=t!=null&&typeof t!=`boolean`&&ed(t);let{properties:n}=e;if(n!=null)for(let e of Object.keys(n))n[e]=ed(n[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(ed):ed(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(ed)),e.allOf!=null&&(e.allOf=e.allOf.map(ed)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(ed));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=ed(t[e]);return e}function ed(e){return typeof e==`boolean`?e:$u(e)}var td=Symbol(`Let zodToJsonSchema decide on which parser to use`),nd={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`},rd=e=>typeof e==`string`?{...nd,name:e}:{...nd,...e};function id(){return{}}function ad(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=Xd(e.type._def,{...t,currentPath:[...t.currentPath,`items`]})),e.minLength&&(n.minItems=e.minLength.value),e.maxLength&&(n.maxItems=e.maxLength.value),e.exactLength&&(n.minItems=e.exactLength.value,n.maxItems=e.exactLength.value),n}function od(e){let t={type:`integer`,format:`int64`};if(!e.checks)return t;for(let 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}return t}function sd(){return{type:`boolean`}}function cd(e,t){return Xd(e.type._def,t)}var ld=(e,t)=>Xd(e.innerType._def,t);function ud(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>ud(e,t,n))};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 dd(e)}}var dd=e=>{let t={type:`integer`,format:`unix-time`};for(let n of e.checks)switch(n.kind){case`min`:t.minimum=n.value;break;case`max`:t.maximum=n.value}return t};function fd(e,t){return{...Xd(e.innerType._def,t),default:e.defaultValue()}}function pd(e,t){return t.effectStrategy===`input`?Xd(e.schema._def,t):id()}function md(e){return{type:`string`,enum:Array.from(e.values)}}var hd=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function gd(e,t){let n=[Xd(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),Xd(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(hd(e))r.push(...e.allOf);else{let t=e;if(`additionalProperties`in e&&e.additionalProperties===!1){let{additionalProperties:n,...r}=e;t=r}r.push(t)}}),r.length?{allOf:r}:void 0}function _d(e){let 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 vd=void 0,yd={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:()=>(vd===void 0&&(vd=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),vd),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 bd(e,t){let n={type:`string`};if(e.checks)for(let 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`:wd(n,`email`,r.message,t);break;case`format:idn-email`:wd(n,`idn-email`,r.message,t);break;case`pattern:zod`:Td(n,yd.email,r.message,t)}break;case`url`:wd(n,`uri`,r.message,t);break;case`uuid`:wd(n,`uuid`,r.message,t);break;case`regex`:Td(n,r.regex,r.message,t);break;case`cuid`:Td(n,yd.cuid,r.message,t);break;case`cuid2`:Td(n,yd.cuid2,r.message,t);break;case`startsWith`:Td(n,RegExp(`^${xd(r.value,t)}`),r.message,t);break;case`endsWith`:Td(n,RegExp(`${xd(r.value,t)}$`),r.message,t);break;case`datetime`:wd(n,`date-time`,r.message,t);break;case`date`:wd(n,`date`,r.message,t);break;case`time`:wd(n,`time`,r.message,t);break;case`duration`:wd(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`:Td(n,RegExp(xd(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&wd(n,`ipv4`,r.message,t),r.version!==`v4`&&wd(n,`ipv6`,r.message,t);break;case`base64url`:Td(n,yd.base64url,r.message,t);break;case`jwt`:Td(n,yd.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&Td(n,yd.ipv4Cidr,r.message,t),r.version!==`v4`&&Td(n,yd.ipv6Cidr,r.message,t);break;case`emoji`:Td(n,yd.emoji(),r.message,t);break;case`ulid`:Td(n,yd.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:wd(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:Td(n,yd.base64,r.message,t)}break;case`nanoid`:Td(n,yd.nanoid,r.message,t)}return n}function xd(e,t){return t.patternStrategy===`escape`?Cd(e):e}var Sd=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function Cd(e){let t=``;for(let n=0;n<e.length;n++)Sd.has(e[n])||(t+=`\\`),t+=e[n];return t}function wd(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(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 Td(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||=[],e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:Ed(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Ed(t,r)}function Ed(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;let n={i:e.flags.includes(`i`),m:e.flags.includes(`m`),s:e.flags.includes(`s`)},r=n.i?e.source.toLowerCase():e.source,i=``,a=!1,o=!1,s=!1;for(let e=0;e<r.length;e++){if(a){i+=r[e],a=!1;continue}if(n.i){if(o){if(r[e].match(/[a-z]/)){s?(i+=r[e],i+=`${r[e-2]}-${r[e]}`.toUpperCase(),s=!1):r[e+1]===`-`&&r[e+2]?.match(/[a-z]/)?(i+=r[e],s=!0):i+=`${r[e]}${r[e].toUpperCase()}`;continue}}else if(r[e].match(/[a-z]/)){i+=`[${r[e]}${r[e].toUpperCase()}]`;continue}}if(n.m){if(r[e]===`^`){i+=`(^|(?<=[\r
|
|
14
14
|
]))`;continue}else if(r[e]===`$`){i+=`($|(?=[\r
|
|
15
|
-
]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}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 i}function Dd(e,t){let n={type:`object`,additionalProperties:Xd(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===`ZodString`&&e.keyType._def.checks?.length){let{type:r,...i}=bd(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===`ZodEnum`)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===`ZodBranded`&&e.keyType._def.type._def.typeName===`ZodString`&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=cd(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Od(e,t){return t.mapStrategy===`record`?Dd(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[Xd(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||id(),Xd(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||id()],minItems:2,maxItems:2}}}function kd(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function Ad(){return{not:id()}}function jd(){return{type:`null`}}var Md={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function Nd(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in Md&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=Md[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Pd(e,t)}var Pd=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Xd(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function Fd(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Md[e.innerType._def.typeName],`null`]};let n=Xd(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Id(e){let t={type:`number`};if(!e.checks)return t;for(let 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}return t}function Ld(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=zd(a),s=Xd(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=Rd(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Rd(e,t){if(e.catchall._def.typeName!==`ZodNever`)return Xd(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 zd(e){try{return e.isOptional()}catch{return!0}}var Bd=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Xd(e.innerType._def,t);let n=Xd(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:id()},n]}:id()},Vd=(e,t)=>{if(t.pipeStrategy===`input`)return Xd(e.in._def,t);if(t.pipeStrategy===`output`)return Xd(e.out._def,t);let n=Xd(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,Xd(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Hd(e,t){return Xd(e.type._def,t)}function Ud(e,t){let n={type:`array`,uniqueItems:!0,items:Xd(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Wd(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>Xd(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:Xd(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Xd(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Gd(){return{not:id()}}function Kd(){return id()}var qd=(e,t)=>Xd(e.innerType._def,t),Jd=(e,t,n)=>{switch(t){case`ZodString`:return bd(e,n);case`ZodNumber`:return Id(e);case`ZodObject`:return Ld(e,n);case`ZodBigInt`:return od(e);case`ZodBoolean`:return sd();case`ZodDate`:return ud(e,n);case`ZodUndefined`:return Gd();case`ZodNull`:return jd();case`ZodArray`:return ad(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return Nd(e,n);case`ZodIntersection`:return gd(e,n);case`ZodTuple`:return Wd(e,n);case`ZodRecord`:return Dd(e,n);case`ZodLiteral`:return _d(e);case`ZodEnum`:return md(e);case`ZodNativeEnum`:return kd(e);case`ZodNullable`:return Fd(e,n);case`ZodOptional`:return Bd(e,n);case`ZodMap`:return Od(e,n);case`ZodSet`:return Ud(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return Hd(e,n);case`ZodNaN`:case`ZodNever`:return Ad();case`ZodEffects`:return pd(e,n);case`ZodAny`:return id();case`ZodUnknown`:return Kd();case`ZodDefault`:return fd(e,n);case`ZodBranded`:return cd(e,n);case`ZodReadonly`:return qd(e,n);case`ZodCatch`:return ld(e,n);case`ZodPipeline`:return Vd(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},Yd=(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 Xd(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==td)return i}if(r&&!n){let e=Zd(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=Jd(e,e.typeName,t),o=typeof a==`function`?Xd(a(),t):a;if(o&&Qd(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var Zd=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:Yd(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),id()):t.$refStrategy===`seen`?id():void 0}},Qd=(e,t,n)=>(e.description&&(n.description=e.description),n),$d=e=>{let t=rd(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},ef=(e,t)=>{let n=$d(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:Xd(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??id()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=Xd(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??id(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},tf=Symbol.for(`vercel.ai.schema`);function nf(e){let t;return()=>(t??=e(),t)}function rf(e,{validate:t}={}){return{[tf]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function af(e){return typeof e==`object`&&!!e&&tf in e&&e[tf]===!0&&`jsonSchema`in e&&`validate`in e}function of(e){return e==null?rf({type:`object`,properties:{},additionalProperties:!1}):af(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?ff(e):sf(e):e()}function sf(e){return rf(()=>{if(!cf(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return $u(e[`~standard`].jsonSchema.input({target:`draft-07`}))},{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new Tu({value:t,cause:n.issues})}}})}function cf(e){return e[`~standard`].jsonSchema!=null}function lf(e,t){let n=t?.useReferences??!1;return rf(()=>ef(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function uf(e,t){let n=t?.useReferences??!1;return rf(()=>$u(Le(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await u(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function df(e){return`_zod`in e}function ff(e,t){return df(e)?uf(e,t):lf(e,t)}async function pf({value:e,schema:t,context:n}){let r=await mf({value:e,schema:t,context:n});if(!r.success)throw Tu.wrap({value:e,cause:r.error,context:n});return r.value}async function mf({value:e,schema:t,context:n}){let r=of(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:Tu.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:Tu.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function hf({text:e,schema:t}){try{let n=Qu(e);return t==null?{success:!0,value:n,rawValue:n}:await mf({value:n,schema:t})}catch(t){return{success:!1,error:xu.isInstance(t)?t:new xu({text:e,cause:t}),rawValue:void 0}}}function gf({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ru).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await hf({text:e,schema:t}))}}))}async function _f(e){return typeof e==`function`&&(e=e()),e}new TextDecoder;var vf=`AI_InvalidArgumentError`,yf=`vercel.ai.error.${vf}`,bf=Symbol.for(yf),xf=class extends iu{constructor({parameter:e,value:t,message:n}){super({name:vf,message:`Invalid argument for parameter ${e}: ${n}`}),this[bf]=!0,this.parameter=e,this.value=t}static isInstance(e){return iu.hasMarker(e,yf)}},Sf=`AI_UIMessageStreamError`,Cf=`vercel.ai.error.${Sf}`,wf=Symbol.for(Cf),Tf=class extends iu{constructor({chunkType:e,chunkId:t,message:n}){super({name:Sf,message:n}),this[wf]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return iu.hasMarker(e,Cf)}},Ef=new Map([[`generateObject`,`AISDK_DEP_GENERATE_OBJECT`],[`streamObject`,`AISDK_DEP_STREAM_OBJECT`],[`experimental_generateSpeech`,`AISDK_DEP_EXPERIMENTAL_GENERATE_SPEECH`],[`experimental_transcribe`,`AISDK_DEP_EXPERIMENTAL_TRANSCRIBE`],[`"image" content part`,`AISDK_DEP_IMAGE_CONTENT_PART`],[`"tool-result" content of type "file-data"`,`AISDK_DEP_TOOL_RESULT_FILE_DATA`],[`"tool-result" content of type "file-url"`,`AISDK_DEP_TOOL_RESULT_FILE_URL`],[`"tool-result" content of type "file-id"`,`AISDK_DEP_TOOL_RESULT_FILE_ID`],[`"tool-result" content of type "file-reference"`,`AISDK_DEP_TOOL_RESULT_FILE_REFERENCE`],[`"tool-result" content of type "image-data"`,`AISDK_DEP_TOOL_RESULT_IMAGE_DATA`],[`"tool-result" content of type "image-url"`,`AISDK_DEP_TOOL_RESULT_IMAGE_URL`],[`"tool-result" content of type "image-file-id"`,`AISDK_DEP_TOOL_RESULT_IMAGE_FILE_ID`],[`"tool-result" content of type "image-file-reference"`,`AISDK_DEP_TOOL_RESULT_IMAGE_FILE_REFERENCE`],[`rawInput in output-error UI message parts`,`AISDK_DEP_UI_MESSAGE_RAW_INPUT`]]);function Df(e){return e.replace(/[^a-zA-Z0-9]/g,e=>`_${e.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`)}`)}function Of({setting:e,provider:t}){return t==null?Ef.get(e)??`AISDK_DEP_SETTING_${Df(e)}`:`AISDK_DEP_PROVIDER_${Df(t)}__${Df(e)}`}function kf({warning:e,provider:t,model:n}){let r=`AI SDK Warning${t!=null&&n!=null?` (${t} / ${n})`:``}:`;switch(e.type){case`unsupported`:{let t=`${r} The feature "${e.feature}" is not supported.`;return e.details&&(t+=` ${e.details}`),t}case`compatibility`:{let t=`${r} The feature "${e.feature}" is used in a compatibility mode.`;return e.details&&(t+=` ${e.details}`),t}case`deprecated`:return`${r} Deprecated: "${e.setting}". ${e.message}`;case`other`:return`${r} ${e.message}`;default:return`${r} ${JSON.stringify(e,null,2)}`}}var Af=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,jf=!1,Mf=new Set;function Nf({message:e,type:t,code:n}){typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(e,n==null?{type:t}:{type:t,code:n}):console.warn(n==null?e:`[${n}] ${e}`)}var Pf=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}jf||(jf=!0,Nf({message:Af,type:`Warning`}));for(let t of e.warnings){let n=t.type===`deprecated`?Of({setting:t.setting,provider:e.provider}):void 0;if(n!=null){if(Mf.has(n))continue;Mf.add(n)}Nf({message:kf({warning:t,provider:e.provider,model:e.model}),type:t.type===`deprecated`?`DeprecationWarning`:`Warning`,code:n})}}};function Ff(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(!(r===`__proto__`||r===`constructor`||r===`prototype`)&&Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=Ff(a,i):n[r]=i}return n}var B={array:S,boolean:E,custom:j,discriminatedUnion:me,enum:ie,instanceof:oe,lazy:h,literal:ye,looseObject:T,never:ve,null:le,number:xe,object:w,record:ct,string:P,union:Ce,unknown:Ee},If=B.lazy(()=>B.union([B.null(),B.string(),B.number(),B.boolean(),B.record(B.string(),If.optional()),B.array(If)])),V=B.record(B.string(),B.record(B.string(),If.optional())),Lf=B.union([B.string(),B.instanceof(Uint8Array),B.instanceof(ArrayBuffer),B.custom(qu,{message:`Must be a Buffer`})]),Rf=B.record(B.string(),B.string()),zf=B.object({type:B.literal(`text`),text:B.string(),providerOptions:V.optional()}),Bf=B.object({type:B.literal(`image`),image:B.union([Lf,B.instanceof(URL),Rf]),mediaType:B.string().optional(),providerOptions:V.optional()}),Vf=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:Lf}),B.object({type:B.literal(`url`),url:B.instanceof(URL)}),B.object({type:B.literal(`reference`),reference:Rf}),B.object({type:B.literal(`text`),text:B.string()})]),Hf=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:Lf}),B.object({type:B.literal(`url`),url:B.instanceof(URL)})]),Uf=B.object({type:B.literal(`file`),data:B.union([Vf,Lf,B.instanceof(URL),Rf]),filename:B.string().optional(),mediaType:B.string(),providerOptions:V.optional()}),Wf=B.object({type:B.literal(`reasoning`),text:B.string(),providerOptions:V.optional()}),Gf=B.object({type:B.literal(`custom`),kind:B.string().transform(e=>e),providerOptions:V.optional()}),Kf=B.object({type:B.literal(`reasoning-file`),data:B.union([Hf,Lf,B.instanceof(URL)]),mediaType:B.string(),providerOptions:V.optional()}),qf=B.object({type:B.literal(`tool-call`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerOptions:V.optional(),providerExecuted:B.boolean().optional()}),Jf=B.discriminatedUnion(`type`,[B.object({type:B.literal(`text`),value:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`json`),value:If,providerOptions:V.optional()}),B.object({type:B.literal(`execution-denied`),reason:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`error-text`),value:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`error-json`),value:If,providerOptions:V.optional()}),B.object({type:B.literal(`content`),value:B.array(B.union([B.object({type:B.literal(`text`),text:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`file`),data:Vf,mediaType:B.string(),filename:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`file-data`),data:B.string(),mediaType:B.string(),filename:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`file-url`),url:B.string(),mediaType:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`file-id`),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:V.optional()}),B.object({type:B.literal(`file-reference`),providerReference:B.record(B.string(),B.string()),providerOptions:V.optional()}),B.object({type:B.literal(`image-data`),data:B.string(),mediaType:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`image-url`),url:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`image-file-id`),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:V.optional()}),B.object({type:B.literal(`image-file-reference`),providerReference:B.record(B.string(),B.string()),providerOptions:V.optional()}),B.object({type:B.literal(`custom`),providerOptions:V.optional()})]))})]),Yf=B.object({type:B.literal(`tool-result`),toolCallId:B.string(),toolName:B.string(),output:Jf,providerOptions:V.optional()}),Xf=B.object({type:B.literal(`tool-approval-request`),approvalId:B.string(),toolCallId:B.string(),reason:B.string().optional(),isAutomatic:B.boolean().optional(),signature:B.string().optional(),inputSchemaInput:B.unknown().optional()}),Zf=B.object({type:B.literal(`tool-approval-response`),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional()}),Qf=B.object({role:B.literal(`system`),content:B.string(),providerOptions:V.optional()}),$f=B.object({role:B.literal(`user`),content:B.union([B.string(),B.array(B.union([zf,Bf,Uf]))]),providerOptions:V.optional()}),ep=B.object({role:B.literal(`assistant`),content:B.union([B.string(),B.array(B.union([zf,Gf,Uf,Wf,Kf,qf,Yf,Xf]))]),providerOptions:V.optional()}),tp=B.object({role:B.literal(`tool`),content:B.array(B.union([Yf,Zf])),providerOptions:V.optional()});B.union([Qf,$f,ep,tp]);function np(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function rp(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),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=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`)}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop()}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop()}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop()}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`)}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`)}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`)}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`)}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop()}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;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`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function ip(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await hf({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await hf({text:rp(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function ap(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ap(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!ap(e[i],t[i]))return!1;return!0}new TextEncoder,new TextEncoder,Gu({prefix:`aitxt`,size:24}),Gu({prefix:`call`,size:24}),TransformStream;var op=B.object({source:B.discriminatedUnion(`sourceType`,[B.object({type:B.literal(`source`),sourceType:B.literal(`url`),id:B.string(),url:B.string(),title:B.string().optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`source`),sourceType:B.literal(`document`),id:B.string(),mediaType:B.string(),title:B.string(),filename:B.string().optional(),providerMetadata:V.optional()})]),startIndex:B.number().int().nonnegative().optional(),endIndex:B.number().int().nonnegative().optional(),citedText:B.string().optional()}),sp=B.record(B.string(),If.optional()),cp=nf(()=>ff(B.union([B.looseObject({type:B.literal(`text-start`),id:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`text-delta`),id:B.string(),delta:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`text-end`),id:B.string(),citations:B.array(op).optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`error`),errorText:B.string()}),B.looseObject({type:B.literal(`tool-input-start`),toolCallId:B.string(),toolName:B.string(),inputEncoding:B.enum([`json`,`text`]).optional(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),title:B.string().optional()}),B.looseObject({type:B.literal(`tool-input-delta`),toolCallId:B.string(),inputTextDelta:B.string()}),B.looseObject({type:B.literal(`tool-input-available`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),title:B.string().optional()}),B.looseObject({type:B.literal(`tool-input-error`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),errorText:B.string(),title:B.string().optional()}),B.looseObject({type:B.literal(`tool-approval-request`),approvalId:B.string(),toolCallId:B.string(),approvalDescriptor:B.unknown().optional(),inputSchemaInput:B.unknown().optional(),reason:B.string().optional(),isAutomatic:B.boolean().optional(),signature:B.string().optional()}),B.looseObject({type:B.literal(`tool-approval-response`),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`tool-output-available`),toolCallId:B.string(),output:B.unknown(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),preliminary:B.boolean().optional()}),B.looseObject({type:B.literal(`tool-output-error`),toolCallId:B.string(),errorText:B.string(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional()}),B.looseObject({type:B.literal(`tool-output-denied`),toolCallId:B.string()}),B.looseObject({type:B.literal(`reasoning-start`),id:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`reasoning-delta`),id:B.string(),delta:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`reasoning-end`),id:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`custom`),kind:B.string().transform(e=>e),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`source-url`),sourceId:B.string(),url:B.string(),title:B.string().optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`source-document`),sourceId:B.string(),mediaType:B.string(),title:B.string(),filename:B.string().optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`file`),url:B.string(),mediaType:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`reasoning-file`),url:B.string(),mediaType:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.custom(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:B.string().optional(),data:B.unknown(),transient:B.boolean().optional()}),B.looseObject({type:B.literal(`start-step`)}),B.looseObject({type:B.literal(`finish-step`)}),B.looseObject({type:B.literal(`reset-step`)}),B.looseObject({type:B.literal(`start`),messageId:B.string().optional(),messageMetadata:B.unknown().optional()}),B.looseObject({type:B.literal(`finish`),finishReason:B.enum([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`other`]).optional(),messageMetadata:B.unknown().optional()}),B.looseObject({type:B.literal(`abort`),reason:B.string().optional()}),B.looseObject({type:B.literal(`message-metadata`),messageMetadata:B.unknown()})])));function lp(e){return e.type.startsWith(`data-`)}function up(){return Object.create(null)}function dp(e){return e.type===`text`}function fp(e){return e.type===`reasoning`}function pp(e){return e.type.startsWith(`tool-`)}function mp(e){return e.type===`dynamic-tool`}function hp(e){return pp(e)||mp(e)}function gp(e){return e.type.split(`-`).slice(1).join(`-`)}function _p(e){return mp(e)?e.toolName:gp(e)}function vp({lastMessage:e,messageId:t}){let n=e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},r=up(),i=n.parts.findLastIndex(e=>e.type===`step-start`),a=0;for(let e of n.parts.slice(i+1)){if(!hp(e))continue;let t=a;pp(e)&&a++,e.state===`input-streaming`&&(r[e.toolCallId]={text:e.rawInput??``,inputEncoding:e.inputEncoding,index:t,toolName:e.type===`dynamic-tool`?e.toolName:gp(e),dynamic:e.type===`dynamic-tool`,title:e.title,toolMetadata:e.toolMetadata})}return{message:n,activeTextParts:up(),activeReasoningParts:up(),partialToolCalls:r}}function yp({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o,resetStateOnMessageIdChange:s=!1,resetStateOnFirstMessageStart:c=!1}){let l=!0;return e.pipeThrough(new TransformStream({async transform(e,u){await r(async({state:r,write:d})=>{function f(){let e=r.message.parts,t=e.length-1;for(;t>=0&&e[t].type!==`step-start`;)t--;return e.slice(t+1)}function p(){return f().filter(hp)}function m(e){let t=p().find(t=>t.toolCallId===e);if(t==null){let n=r.message.parts;for(let r=n.length-1;r>=0;r--){let i=n[r];if(hp(i)&&i.toolCallId===e){t=i;break}}}if(t==null)throw new Tf({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function h(e){let t=r.message.parts.filter(hp).find(t=>t.approval?.id===e);if(t==null)throw new Tf({chunkType:`tool-approval-response`,chunkId:e,message:`No tool invocation found for approval ID "${e}".`});return t}function g(e,t){let n=t??f().find(t=>pp(t)&&t.toolCallId===e.toolCallId),i=e,a=n;if(n!=null){n.state=e.state,a.type=`tool-${e.toolName}`,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,i.inputEncoding==null?delete a.inputEncoding:a.inputEncoding=i.inputEncoding,a.preliminary=i.preliminary,e.title!==void 0&&(a.title=e.title),e.toolMetadata!==void 0&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=i.providerExecuted??n.providerExecuted;let t=i.providerMetadata;if(t!=null)if(e.state===`output-available`||e.state===`output-error`){let e=n;e.resultProviderMetadata=t}else n.callProviderMetadata=t}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...e.toolMetadata===void 0?{}:{toolMetadata:e.toolMetadata},input:i.input,...i.inputEncoding==null?{}:{inputEncoding:i.inputEncoding},output:i.output,rawInput:i.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,preliminary:i.preliminary,...i.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:i.providerMetadata}:{},...i.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:i.providerMetadata}:{}})}function _(e,t){let n=t??f().find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),i=e,a=n;if(n!=null){n.state=e.state,a.toolName=e.toolName,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,i.inputEncoding==null?delete a.inputEncoding:a.inputEncoding=i.inputEncoding,a.preliminary=i.preliminary,e.title!==void 0&&(a.title=e.title),e.toolMetadata!==void 0&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=i.providerExecuted??n.providerExecuted;let t=i.providerMetadata;if(t!=null)if(e.state===`output-available`||e.state===`output-error`){let e=n;e.resultProviderMetadata=t}else n.callProviderMetadata=t}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:i.input,...i.inputEncoding==null?{}:{inputEncoding:i.inputEncoding},output:i.output,errorText:i.errorText,preliminary:i.preliminary,providerExecuted:i.providerExecuted,title:e.title,...e.toolMetadata===void 0?{}:{toolMetadata:e.toolMetadata},...i.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:i.providerMetadata}:{},...i.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:i.providerMetadata}:{}})}async function v(e){if(e!=null){let n=r.message.metadata==null?e:Ff(r.message.metadata,e);t!=null&&await pf({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),d();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new Tf({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,d();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new Tf({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,e.citations!=null&&(t.citations=e.citations),t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],d();break}case`custom`:{let t={type:`custom`,kind:e.kind,providerMetadata:e.providerMetadata};r.message.parts.push(t),d();break}case`reasoning-start`:{let t={type:`reasoning`,id:e.id,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),d();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new Tf({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,d();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new Tf({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],d();break}case`file`:case`reasoning-file`:r.message.parts.push({type:e.type,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),d();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),d();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),d();break;case`tool-input-start`:{let t=f().filter(pp);r.partialToolCalls[e.toolCallId]={text:``,inputEncoding:e.inputEncoding,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),d();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new Tf({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let n=t.inputEncoding===`text`?t.text:(await ip(t.text)).value;t.dynamic?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}):g({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}),d();break}case`tool-input-available`:e.dynamic?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),d(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=f().filter(hp).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),d();break}case`tool-approval-request`:{let t=m(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId,...e.approvalDescriptor==null?{}:{descriptor:e.approvalDescriptor},...Object.prototype.hasOwnProperty.call(e,`inputSchemaInput`)?{inputSchemaInput:e.inputSchemaInput}:{},...e.reason==null?{}:{requestReason:e.reason},...e.isAutomatic===!0?{isAutomatic:!0}:{},...e.signature==null?{}:{signature:e.signature}},d();break}case`tool-approval-response`:{let t=h(e.approvalId),n=t.approval==null?{id:e.approvalId}:t.approval;t.state=`approval-responded`,t.approval={...n,id:e.approvalId,approved:e.approved,...e.reason==null?{}:{reason:e.reason}},e.providerExecuted!=null&&(t.providerExecuted=e.providerExecuted),e.providerMetadata!=null&&(t.callProviderMetadata=e.providerMetadata),d();break}case`tool-output-denied`:{let t=m(e.toolCallId);t.state=`output-denied`,d();break}case`tool-output-available`:{let t=m(e.toolCallId);t.type===`dynamic-tool`?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):g({toolCallId:e.toolCallId,toolName:gp(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),d();break}case`tool-output-error`:{let t=m(e.toolCallId);t.type===`dynamic-tool`?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):g({toolCallId:e.toolCallId,toolName:gp(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),d();break}case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:break;case`reset-step`:{let e=f();r.activeTextParts=up(),r.activeReasoningParts=up(),r.partialToolCalls=up(),e.length>0&&(r.message.parts.splice(r.message.parts.length-e.length,e.length),d());break}case`start`:{let t=c&&l||s&&e.messageId!=null&&e.messageId!==r.message.id;l=!1,t&&Object.assign(r,vp({lastMessage:void 0,messageId:e.messageId??r.message.id}),{finishReason:void 0}),e.messageId!=null&&(r.message.id=e.messageId),await v(e.messageMetadata),(t||e.messageId!=null||e.messageMetadata!=null)&&d({updateStatus:!1});break}case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await v(e.messageMetadata),e.messageMetadata!=null&&d();break;case`message-metadata`:await v(e.messageMetadata),e.messageMetadata!=null&&d();break;case`error`:i?.(Error(e.errorText));break;default:if(lp(e)){if(n?.[e.type]!=null){let t=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:r.message.parts.length;await pf({value:e.data,schema:n[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),d()}}u.enqueue(e)})}}))}async function bp({stream:e,onError:t,abortSignal:n}){let r=e.getReader(),i=()=>{r.cancel().catch(()=>{})};n?.aborted?i():n?.addEventListener(`abort`,i,{once:!0});try{for(;;){let{done:e}=await r.read();if(e)break}}catch(e){t?.(e)}finally{n?.removeEventListener(`abort`,i),r.releaseLock()}}function xp(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}Gu({prefix:`aitxt`,size:24}),Gu({prefix:`call`,size:24}),Gu({prefix:`aitxt`,size:24}),Gu({prefix:`call`,size:24});function Sp(e){return e.dynamic=!1,e}var Cp={type:`deprecated`,setting:`rawInput in output-error UI message parts`,message:`Use the "input" field instead. The "rawInput" field will be removed in the next major version.`};function wp(e){e.some(e=>e.parts.some(e=>typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&(e.type===`dynamic-tool`||e.type.startsWith(`tool-`))&&`state`in e&&e.state===`output-error`&&Object.prototype.hasOwnProperty.call(e,`rawInput`)&&`rawInput`in e&&e.rawInput!==void 0))&&Pf({warnings:[Cp]})}var Tp=B.record(B.string(),If.optional()),Ep=B.record(B.string(),B.string());function Dp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===0}function Op(e){let{type:t,...n}=e;return Sp({...n,type:`dynamic-tool`,toolName:t.slice(5)})}function kp(e){return e.approval!=null&&Object.prototype.hasOwnProperty.call(e.approval,`inputSchemaInput`)?{value:e.approval.inputSchemaInput}:void 0}var Ap=nf(()=>{let e=B.object({id:B.string(),approved:B.never().optional(),descriptor:B.unknown().optional(),requestReason:B.string().optional(),reason:B.never().optional(),isAutomatic:B.boolean().optional(),signature:B.string().optional(),inputSchemaInput:B.unknown().optional()}),t=e.extend({approved:B.boolean(),reason:B.string().optional()}),n=t.extend({approved:B.literal(!0)}),r=t.extend({approved:B.literal(!1)});return ff(B.array(B.object({id:B.string(),role:B.enum([`system`,`user`,`assistant`]),metadata:B.unknown().optional(),parts:B.array(B.union([B.object({type:B.literal(`text`),text:B.string(),citations:B.array(op).optional(),state:B.enum([`streaming`,`done`]).optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`reasoning`),id:B.string().optional(),text:B.string(),state:B.enum([`streaming`,`done`]).optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`custom`),kind:B.string(),providerMetadata:V.optional()}),B.object({type:B.literal(`source-url`),sourceId:B.string(),url:B.string(),title:B.string().optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`source-document`),sourceId:B.string(),mediaType:B.string(),title:B.string(),filename:B.string().optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`file`),mediaType:B.string(),filename:B.string().optional(),url:B.string(),providerReference:Ep.optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`reasoning-file`),mediaType:B.string(),url:B.string(),providerMetadata:V.optional()}),B.object({type:B.literal(`step-start`)}),B.object({type:B.string().startsWith(`data-`),id:B.string().optional(),data:B.unknown()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-streaming`),input:B.unknown().optional(),rawInput:B.string().optional(),inputEncoding:B.enum([`json`,`text`]).optional(),providerExecuted:B.boolean().optional(),callProviderMetadata:V.optional(),output:B.never().optional(),errorText:B.never().optional(),approval:B.never().optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-available`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:B.never().optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-requested`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:e}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-responded`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:t}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-available`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.unknown(),errorText:B.never().optional(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),preliminary:B.boolean().optional(),approval:n.optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-error`),input:B.unknown().optional(),rawInput:B.unknown().optional(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.string(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),approval:n.optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-denied`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:r}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-streaming`),providerExecuted:B.boolean().optional(),callProviderMetadata:V.optional(),input:B.unknown().optional(),rawInput:B.string().optional(),inputEncoding:B.enum([`json`,`text`]).optional(),output:B.never().optional(),errorText:B.never().optional(),approval:B.never().optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-available`),providerExecuted:B.boolean().optional(),input:B.unknown(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:B.never().optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-requested`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:e}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-responded`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:t}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-available`),providerExecuted:B.boolean().optional(),input:B.unknown(),output:B.unknown(),errorText:B.never().optional(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),preliminary:B.boolean().optional(),approval:n.optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-error`),providerExecuted:B.boolean().optional(),input:B.unknown().optional(),rawInput:B.unknown().optional(),output:B.never().optional(),errorText:B.string(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),approval:n.optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-denied`),providerExecuted:B.boolean().optional(),input:B.unknown(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:r})]))}).superRefine((e,t)=>{e.role!==`assistant`&&e.parts.length===0&&t.addIssue({origin:`array`,code:`too_small`,minimum:1,inclusive:!0,input:e.parts,path:[`parts`],message:`Message must contain at least one part`})})).nonempty(`Messages array must not be empty`))});async function jp({messages:e,metadataSchema:t,dataSchemas:n,tools:r,experimental_refineToolInput:i},{convertMissingTerminalToolsToDynamic:a}){try{if(e==null)return{success:!1,error:new xf({parameter:`messages`,value:e,message:`messages parameter must be provided`})};let o=await pf({value:e,schema:Ap});if(wp(o),t)for(let[e,n]of o.entries())n.metadata=await pf({value:n.metadata,schema:t,context:{field:`messages[${e}].metadata`,entityId:n.id}});let s=r!=null||a;if(n||s)for(let[e,t]of o.entries())for(let[o,c]of t.parts.entries()){if(n&&c.type.startsWith(`data-`)){let t=c,r=t.type.slice(5),i=n[r];if(!i)return{success:!1,error:new Tu({value:t.data,cause:`No data schema found for data part ${r}`,context:{field:`messages[${e}].parts[${o}].data`,entityName:r,entityId:t.id}})};t.data=await pf({value:t.data,schema:i,context:{field:`messages[${e}].parts[${o}].data`,entityName:r,entityId:t.id}})}if(s&&c.type.startsWith(`tool-`)){let n=c,s=n.type.slice(5),l=r==null?void 0:np(r,s),u=n.state===`output-available`||n.state===`output-error`||n.state===`output-denied`;if(!l&&u){(r!=null||a)&&(t.parts[o]=Op(n));continue}if(!l)return{success:!1,error:new Tu({value:n.input,cause:`No tool schema found for tool part ${s}`,context:{field:`messages[${e}].parts[${o}].input`,entityName:s,entityId:n.toolCallId}})};let d={field:`messages[${e}].parts[${o}].input`,entityName:s,entityId:n.toolCallId},f=kp(n),p=f==null?n.input:f.value,m=!1;if(n.state!==`input-streaming`&&(n.state!==`output-error`||f!=null||n.input!==void 0)){let e=await mf({value:p,schema:l.inputSchema,context:d}),t;if(!e.success)t=e.error;else if(f!=null)try{let r=np(i,s);ap(r==null?e.value:await r(e.value),n.input)||(t=new Tu({value:n.input,cause:`Tool input does not match the output reconstructed from inputSchemaInput.`,context:d}))}catch(e){t=new Tu({value:p,cause:e,context:d})}if(t!=null)if(n.state===`output-error`||n.state===`output-available`&&Dp(n.input))m=!0;else throw t}n.state===`output-available`&&l.outputSchema&&await pf({value:n.output,schema:l.outputSchema,context:{field:`messages[${e}].parts[${o}].output`,entityName:s,entityId:n.toolCallId}}),m&&(t.parts[o]=Op(n))}}return{success:!0,data:o}}catch(e){return{success:!1,error:e}}}async function Mp(e){return jp(e,{convertMissingTerminalToolsToDynamic:!1})}async function Np(e){let t=await Mp(e);if(!t.success)throw t.error;return t.data}Gu({prefix:`call`,size:24}),Gu({prefix:`call`,size:24}),new TextEncoder,Gu({prefix:`call`,size:24}),Gu({prefix:`aiobj`,size:24});var{atob:Pp}=globalThis,Fp=class{constructor(){this.queue=[],this.isProcessing=!1,this.idleWaiters=[]}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;this.queue.length>0;)await this.queue[0](),this.queue.shift()}finally{this.isProcessing=!1;for(let e of this.idleWaiters.splice(0))e()}}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}async waitForIdle(){!this.isProcessing&&this.queue.length===0||await new Promise(e=>{this.idleWaiters.push(e)})}};Gu({prefix:`aiobj`,size:24}),Gu({prefix:`call`,size:24}),B.object({token:B.string().refine(e=>e.trim().length>0),url:B.string().refine(e=>{try{let t=new URL(e);return(t.protocol===`ws:`||t.protocol===`wss:`)&&t.hostname!==``}catch{return!1}}),expiresAt:B.number().positive().max(2**53-1).optional(),tools:B.array(B.object({type:B.literal(`function`),name:B.string().min(1),description:B.string().optional(),parameters:B.record(B.string(),B.unknown())})).optional()}),Gu({prefix:`call`,size:24}),Gu({prefix:`call`,size:24}),Gu({prefix:`call`,size:24});async function Ip({response:e,url:t,fallbackMessage:n}){let r=await e.text();return new cu({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function Lp(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new ku({functionality:`FileList`,message:`FileList is not supported in the current environment`});return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}function Rp(e,t){let n=e.search(/[?#]/),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n);return`${r.endsWith(`/`)&&t.startsWith(`/`)?r.slice(0,-1):r}${t}${i}`}var zp=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await _f(this.body),r=await _f(this.headers),i=await _f(this.credentials),a={...Vu(r),...Vu(t.headers)},o=await this.prepareSendMessagesRequest?.({api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:Vu(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"content-type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw await Ip({response:d,url:s,fallbackMessage:`Failed to fetch the chat response.`});if(!d.body)throw new fu({message:`The response body is empty.`});return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await _f(this.body),n=await _f(this.headers),r=await _f(this.credentials),i={...Vu(n),...Vu(e.headers)},a=await this.prepareReconnectToStreamRequest?.({api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api;if(o==null){if(e.chatId===`.`||e.chatId===`..`)throw new xf({parameter:`chatId`,value:e.chatId,message:`Chat IDs must not be "." or ".." when using the default reconnect URL.`});o=Rp(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}let s=a?.headers===void 0?i:Vu(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c,signal:e.abortSignal});if(l.status===204)return null;if(!l.ok)throw await Ip({response:l,url:o,fallbackMessage:`Failed to fetch the chat response.`});if(!l.body)throw new fu({message:`The response body is empty.`});return this.processResponseStream(l.body)}},Bp=class extends zp{constructor({resumeStreamIsReplay:e=!0,...t}={}){super(t),this.resumeStreamIsReplay=e}processResponseStream(e){return gf({stream:e,schema:cp}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Vp=class{get id(){return this._id??=this.generateId()}constructor({generateId:e=Ku,id:t,transport:n=new Bp,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.pendingMessagePreparations=new Set,this.activeResponse=void 0,this.activeResumeRequest=void 0,this.resumableStreamState=void 0,this.jobExecutor=new Fp,this.activeStopCount=0,this.stopGeneration=0,this.sendMessage=async(e,t)=>{if(e==null){let e=this.pendingApprovalMessageId;if(e==null){e=this.lastMessage?.id;for(let t=this.state.messages.length-1;t>=0;t--){let n=this.state.messages[t];if(n.role===`assistant`&&n.parts.some(e=>hp(e)&&e.state===`approval-responded`)){e=n.id;break}}}let n=e!=null&&e===this.pendingApprovalMessageId?this.state.messages.findIndex(t=>t.id===e):-1;await this.makeRequestForToolApproval({messageId:e,messageIndex:n,...t});return}let n;if(`text`in e||`files`in e){let t=new AbortController;this.pendingMessagePreparations.add(t);let r;try{r=Array.isArray(e.files)?e.files:await Lp(e.files)}finally{this.pendingMessagePreparations.delete(t)}if(t.signal.aborted)return;n={parts:[...r,...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}}else n=e;if(e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw new xf({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} not found`});if(this.state.messages[t].role!==`user`)throw new xf({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} is not a user message`});this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{id:e.messageId,...n,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw new xf({parameter:`messageId`,value:e,message:`message ${e} not found`});this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this[`~resumeStreamIfDisconnected`]=async({shouldResume:e=()=>!0}={})=>{let t=this.activeResponse;this.resumableStreamState==null&&t!=null&&(await t.completionPromise,this.resumableStreamState!==t.state)||this.resumableStreamState!=null&&e()&&await this.resumeStream()},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=r=>hp(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{...r.approval,id:e,approved:t,reason:n}}:r,o=i.findIndex(t=>t.parts.some(t=>hp(t)&&t.state===`approval-requested`&&t.approval.id===e));if(o!==-1){let e=i[o];this.state.replaceMessage(o,{...e,parts:e.parts.map(a)}),this.pendingApprovalMessageId=e.id}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(a)),o!==-1&&this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen){let e=await this.shouldSendAutomatically();e&&this.runAutomaticRequest(()=>{let e=o===-1?this.lastMessage?.id:i[o].id;return this.makeRequestForToolApproval({messageId:e,messageIndex:o,...r})},e)}}),this.addToolOutput=async({state:e,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=i=>{if(!hp(i)||i.toolCallId!==t)return i;let{approval:a,...o}=i,s=a?.approved===!0?{approval:{...a,approved:a.approved}}:{};return e===`output-error`?{...o,...s,state:e,input:i.input,output:void 0,errorText:r}:{...o,...s,state:`output-available`,input:i.input,output:n,errorText:void 0}},s=a.findIndex(e=>e.parts.some(e=>hp(e)&&e.toolCallId===t));if(s!==-1){let e=a[s];this.state.replaceMessage(s,{...e,parts:e.parts.map(o)})}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),s!==-1&&this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen){let e=await this.shouldSendAutomatically();e&&this.runAutomaticRequest(()=>this.makeRequest({trigger:`submit-message`,messageId:a[s].id,...i}),e)}}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.activeStopCount++,this.stopGeneration++;try{let e=this.activeResumeRequest,t=this.activeResponse;for(let e of this.pendingMessagePreparations)e.abort();e?.abortController.abort(),t?.abortController.abort(),await Promise.all([e?.completionPromise,t?.completionPromise]),await this.jobExecutor.waitForIdle()}finally{this.activeStopCount--}},this.dispose=async()=>{await this.stop(),this.transport.close?.()},this._id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){if(this.status===e){this.error!==t&&(this.state.error=t);return}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;let e=this.sendAutomaticallyWhen({messages:this.state.messages});return e&&typeof e==`object`&&`then`in e?await e:e}async runAutomaticRequest(e,t){let n=this.stopGeneration,r=this.activeStopCount>0;(t??await this.shouldSendAutomatically())&&(r||n!==this.stopGeneration||this.activeStopCount>0||await e())}async makeRequestForToolApproval({messageId:e,messageIndex:t,...n}){let r=e!=null&&e===this.pendingApprovalMessageId;r&&(this.pendingApprovalMessageId=void 0),await this.makeRequest({trigger:`submit-message`,messageId:e,...n}),r&&this.status===`error`&&this.pendingApprovalMessageId==null&&(this.pendingApprovalMessageId=this.state.messages[t]?.id??e)}async makeRequest(e){let t=xp();try{await this.makeRequestImpl({...e,completionPromise:t.promise})}finally{t.resolve()}}async makeRequestImpl({trigger:e,metadata:t,headers:n,body:r,messageId:i,completionPromise:a}){e!==`resume-stream`&&(this.resumableStreamState=void 0);let o=new AbortController,s=e===`resume-stream`?{abortController:o,completionPromise:a}:void 0;s&&(this.activeResumeRequest?.abortController.abort(),this.activeResumeRequest=s);let c=()=>s==null||this.activeResumeRequest===s,l=()=>{this.activeResumeRequest===s&&(this.activeResumeRequest=void 0)},u;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,abortSignal:o.signal,metadata:t,headers:n,body:r});if(o.signal.aborted||!c()){await e?.cancel().catch(()=>{}),c()&&(this.setStatus({status:`ready`}),this.resumableStreamState=void 0),l();return}if(e==null){this.setStatus({status:`ready`}),this.resumableStreamState=void 0,l();return}u=e}catch(e){if(o.signal.aborted||e.name===`AbortError`){c()&&(this.setStatus({status:`ready`}),this.resumableStreamState=void 0),l();return}if(!c())return;this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e}),l();return}this.setStatus({status:`submitted`,error:void 0});let d=this.lastMessage,f=e===`submit-message`&&i!=null?this.state.messages.findIndex(e=>e.id===i):this.state.messages.length-1,p=f===-1?d:this.state.messages[f],m=p?.id,h=e===`resume-stream`&&p?.role===`assistant`&&p.parts.some(e=>hp(e)&&(e.state===`input-streaming`||e.state===`input-available`&&e.providerExecuted||e.state===`approval-responded`))?this.state.snapshot(p):void 0,g=f!==-1&&f<this.state.messages.length-1&&p?.role===`assistant`,_=!1,v=!1,y=!1,b;try{let s={state:e===`resume-stream`&&this.resumableStreamState!=null?this.resumableStreamState:vp({lastMessage:e===`resume-stream`?h:e===`regenerate-message`?void 0:this.state.snapshot(p),messageId:this.generateId()}),abortController:o,completionPromise:a};b=s,s.abortController.signal.addEventListener(`abort`,()=>{_=!0}),this.activeResponse=s;let l;if(l=e===`resume-stream`?u:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:s.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await bp({stream:yp({stream:l,resetStateOnMessageIdChange:e===`resume-stream`,resetStateOnFirstMessageStart:e===`resume-stream`&&this.transport.resumeStreamIsReplay,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>s.abortController.signal.aborted?Promise.resolve():e({state:s.state,write:({updateStatus:e=!0}={})=>{if(s.abortController.signal.aborted)return;e&&this.setStatus({status:`streaming`});let t=this.state.messages.findLastIndex(e=>e.id===s.state.message.id);if(t!==-1)this.state.replaceMessage(t,s.state.message);else if(g){let e=this.state.messages.findLastIndex(e=>e.id===m);e===-1?this.state.pushMessage(s.state.message):this.state.replaceMessage(e,s.state.message)}else this.state.pushMessage(s.state.message)}})),onError:e=>{throw e}}),abortSignal:s.abortController.signal,onError:e=>{throw e}}),_)return c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===s.state&&(this.resumableStreamState=void 0)),null;c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===s.state&&(this.resumableStreamState=void 0))}catch(e){if(_||e.name===`AbortError`)return _=!0,c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0)),null;if(!c())return null;if(y=!0,e instanceof TypeError){let t=e.message.toLowerCase();v=t.includes(`fetch`)||t.includes(`network`)||t===`load failed`}v?this.resumableStreamState=b?.state:this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{b&&this.onFinish?.({message:b.state.message,messages:this.state.messages,isAbort:_,isDisconnect:v,isError:y,finishReason:b.state.finishReason})}finally{this.activeResponse===b&&(this.activeResponse=void 0),l()}}!_&&!y&&await this.runAutomaticRequest(()=>this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r}))}};function Hp({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1).filter(hp);return r.filter(e=>e.state===`approval-responded`).length>0&&r.every(e=>e.state===`output-available`&&e.preliminary!==!0||e.state===`output-error`||e.state===`output-denied`||e.state===`approval-responded`)}function Up({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1),i=r.filter(hp).filter(e=>!e.providerExecuted),a=r.reduce((e,t,n)=>hp(t)&&!t.providerExecuted?n:e,-1);return i.length>0&&!r.slice(a+1).some(e=>e.type===`text`&&e.state!==`done`)&&i.every(e=>e.state===`output-available`&&e.preliminary!==!0||e.state===`output-error`)}var Wp=a((t=>{var n=e().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;t.c=function(e){return n.H.useMemoCache(e)}})),Gp=a(((e,t)=>{t.exports=Wp()})),Kp=a(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n})),H=Gp(),qp=n(Kp(),1);function Jp(e,t){return t==null?e:(0,qp.default)(e,t)}function Yp(e){return Array.isArray(e)?[...e]:typeof e==`object`&&e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var Xp=class{#e;#t;#n;#r;#i;#a;constructor(e=[]){this.#t=`ready`,this.#n=void 0,this.#r=new Set,this.#i=new Set,this.#a=new Set,this.pushMessage=e=>{this.#e=this.#e.concat(e),this.#o()},this.popMessage=()=>{this.#e=this.#e.slice(0,-1),this.#o()},this.replaceMessage=(e,t)=>{this.#e=[...this.#e.slice(0,e),this.snapshot(t),...this.#e.slice(e+1)],this.#o()},this.snapshot=e=>{if(typeof e!=`object`||!e||!(`parts`in e)||!Array.isArray(e.parts))return e;let t=e,n={...t,parts:t.parts.map(e=>({...e}))};return`metadata`in t&&(n.metadata=Yp(t.metadata)),n},this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Jp(e,t):e;return this.#r.add(n),()=>{this.#r.delete(n)}},this[`~registerStatusCallback`]=e=>(this.#i.add(e),()=>{this.#i.delete(e)}),this[`~registerErrorCallback`]=e=>(this.#a.add(e),()=>{this.#a.delete(e)}),this.#o=()=>{this.#r.forEach(e=>e())},this.#s=()=>{this.#i.forEach(e=>e())},this.#c=()=>{this.#a.forEach(e=>e())},this.#e=e}get status(){return this.#t}set status(e){this.#t=e,this.#s()}get error(){return this.#n}set error(e){this.#n=e,this.#c()}get messages(){return this.#e}set messages(e){this.#e=[...e],this.#o()}#o;#s;#c},Zp=class extends Vp{#e;constructor({messages:e,...t}){let n=new Xp(e);super({...t,state:n}),this[`~registerMessagesCallback`]=(e,t)=>this.#e[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>this.#e[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>this.#e[`~registerErrorCallback`](e),this.#e=n}},Qp=new WeakMap;function $p({chat:e,state:t}){if(document.visibilityState!==`visible`||t.pendingVisibilityResume!=null)return;let n=()=>Qp.get(e)===t&&t.registrations.size>0,r=()=>{t.pendingVisibilityResume=void 0};t.pendingVisibilityResume=e[`~resumeStreamIfDisconnected`]({shouldResume:()=>n()&&document.visibilityState===`visible`}).then(r,r)}function em({chat:e,registration:t}){let n=Qp.get(e);if(n==null){let t={registrations:new Set};if(Qp.set(e,t),n=t,typeof document<`u`){let n=()=>$p({chat:e,state:t});document.addEventListener(`visibilitychange`,n),t.cleanupVisibilityListener=()=>{document.removeEventListener(`visibilitychange`,n)}}}let{registrations:r}=n,i=r.size===0;return r.add(t),i&&e.status!==`submitted`&&e.status!==`streaming`&&e.resumeStream(),()=>{r.delete(t),r.size===0&&(n.cleanupVisibilityListener?.(),Qp.delete(e))}}function tm(e){return{chat:e,messages:e.messages,status:e.status,error:e.error}}function nm(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function rm({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){let i=e??t,a=(0,I.useRef)({}),o=(0,I.useRef)({});`chat`in r||(o.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen,transport:r.transport});let s,c=()=>o.current.transport??(s??=new Bp),l={...r,transport:{get resumeStreamIsReplay(){return c().resumeStreamIsReplay},sendMessages:e=>c().sendMessages(e),reconnectToStream:e=>c().reconnectToStream(e)},onToolCall:e=>o.current.onToolCall?.(e),onData:e=>o.current.onData?.(e),onFinish:e=>o.current.onFinish?.(e),onError:e=>o.current.onError?.(e),sendAutomaticallyWhen:e=>o.current.sendAutomaticallyWhen?.(e)??!1},{chat:u,isExternallyManaged:d}=(0,I.useMemo)(()=>({chat:`chat`in r?r.chat:new Zp(l),isExternallyManaged:`chat`in r}),[`chat`in r?r.chat:r.id]);(0,I.useEffect)(()=>{if(!d)return()=>{u.stop()}},[u,d]);let[f,p]=(0,I.useState)(()=>tm(u));f.chat!==u&&p(tm(u)),(0,I.useEffect)(()=>{let e=!0,t=()=>{if(!e)return;let t=tm(u);p(e=>e.chat!==u||nm(e,t)?e:t)},n=[u[`~registerMessagesCallback`](t,i),u[`~registerStatusCallback`](t),u[`~registerErrorCallback`](t)],r=tm(u);return p(e=>nm(e,r)?e:r),()=>{e=!1,n.forEach(e=>e())}},[u,i]);let{messages:m,status:h,error:g}=f,_=(0,I.useCallback)(e=>{typeof e==`function`&&(e=e(u.messages)),u.messages=e},[u]);return(0,I.useEffect)(()=>{if(n)return em({chat:u,registration:a.current})},[n,u]),{get id(){return u.id},messages:m,setMessages:_,sendMessage:u.sendMessage,regenerate:u.regenerate,clearError:u.clearError,stop:u.stop,error:g,resumeStream:u.resumeStream,status:h,addToolResult:u.addToolOutput,addToolOutput:u.addToolOutput,addToolApprovalResponse:u.addToolApprovalResponse}}var im=(0,I.createContext)({});function am(e){let t=(0,I.useRef)(null);return t.current===null&&(t.current=e()),t.current}var om=typeof window<`u`?I.useLayoutEffect:I.useEffect,sm=(0,I.createContext)(null);function cm(e,t){e.indexOf(t)===-1&&e.push(t)}function lm(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var um=(e,t,n)=>n>t?t:n<e?e:n,dm={},fm=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),pm=e=>typeof e==`object`&&!!e,mm=e=>/^0[^.\s]+$/u.test(e);function hm(e){let t;return()=>(t===void 0&&(t=e()),t)}var gm=e=>e,_m=(...e)=>e.reduce((e,t)=>n=>t(e(n))),vm=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},ym=class{constructor(){this.subscriptions=[]}add(e){return cm(this.subscriptions,e),()=>lm(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},bm=e=>e*1e3,xm=e=>e/1e3,Sm=(e,t)=>t?1e3/t*e:0,Cm=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,wm=1e-7,Tm=12;function Em(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Cm(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>wm&&++s<Tm);return o}function Dm(e,t,n,r){if(e===t&&n===r)return gm;let i=t=>Em(t,0,1,e,n);return e=>e===0||e===1?e:Cm(i(e),t,r)}var Om=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,km=e=>t=>1-e(1-t),Am=Dm(.33,1.53,.69,.99),jm=km(Am),Mm=Om(jm),Nm=e=>e>=1?1:(e*=2)<1?.5*jm(e):.5*(2-2**(-10*(e-1))),Pm=e=>1-Math.sin(Math.acos(e)),Fm=km(Pm),Im=Om(Pm),Lm=Dm(.42,0,1,1),Rm=Dm(0,0,.58,1),zm=Dm(.42,0,.58,1),Bm=e=>Array.isArray(e)&&typeof e[0]!=`number`,Vm=e=>Array.isArray(e)&&typeof e[0]==`number`,Hm={linear:gm,easeIn:Lm,easeInOut:zm,easeOut:Rm,circIn:Pm,circInOut:Im,circOut:Fm,backIn:jm,backInOut:Mm,backOut:Am,anticipate:Nm},Um=e=>typeof e==`string`,Wm=e=>{if(Vm(e)){e.length;let[t,n,r,i]=e;return Dm(t,n,r,i)}else if(Um(e))return Hm[e],`${e}`,Hm[e];return e},Gm=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function Km(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var qm=40;function Jm(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Gm.reduce((e,t)=>(e[t]=Km(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=dm.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,qm),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Gm.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Gm.length;t++)o[Gm[t]].cancel(e)},state:i,steps:o}}var{schedule:Ym,cancel:Xm,state:Zm,steps:Qm}=Jm(typeof requestAnimationFrame<`u`?requestAnimationFrame:gm,!0),$m;function eh(){$m=void 0}var th={now:()=>($m===void 0&&th.set(Zm.isProcessing||dm.useManualTiming?Zm.timestamp:performance.now()),$m),set:e=>{$m=e,queueMicrotask(eh)}},nh=e=>t=>typeof t==`string`&&t.startsWith(e),rh=nh(`--`),ih=nh(`var(--`),ah=e=>ih(e)?oh.test(e.split(`/*`)[0].trim()):!1,oh=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function sh(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var ch={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},lh={...ch,transform:e=>um(0,1,e)},uh={...ch,default:1},dh=e=>Math.round(e*1e5)/1e5,fh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ph(e){return e==null}var mh=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,hh=(e,t)=>n=>!!(typeof n==`string`&&mh.test(n)&&n.startsWith(e)||t&&!ph(n)&&Object.prototype.hasOwnProperty.call(n,t)),gh=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(fh);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},_h=e=>um(0,255,e),vh={...ch,transform:e=>Math.round(_h(e))},yh={test:hh(`rgb`,`red`),parse:gh(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+vh.transform(e)+`, `+vh.transform(t)+`, `+vh.transform(n)+`, `+dh(lh.transform(r))+`)`};function bh(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var xh={test:hh(`#`),parse:bh,transform:yh.transform},Sh=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ch=Sh(`deg`),wh=Sh(`%`),U=Sh(`px`),Th=Sh(`vh`),Eh=Sh(`vw`),Dh={...wh,parse:e=>wh.parse(e)/100,transform:e=>wh.transform(e*100)},Oh={test:hh(`hsl`,`hue`),parse:gh(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+wh.transform(dh(t))+`, `+wh.transform(dh(n))+`, `+dh(lh.transform(r))+`)`},kh={test:e=>yh.test(e)||xh.test(e)||Oh.test(e),parse:e=>yh.test(e)?yh.parse(e):Oh.test(e)?Oh.parse(e):xh.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?yh.transform(e):Oh.transform(e),getAnimatableNone:e=>{let t=kh.parse(e);return t.alpha=0,kh.transform(t)}},Ah=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function jh(e){return isNaN(e)&&typeof e==`string`&&(e.match(fh)?.length||0)+(e.match(Ah)?.length||0)>0}var Mh=`number`,Nh=`color`,Ph=`var`,Fh=`var(`,Ih="${}",Lh=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Rh(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Lh,e=>(kh.test(e)?(r.color.push(a),i.push(Nh),n.push(kh.parse(e))):e.startsWith(Fh)?(r.var.push(a),i.push(Ph),n.push(e)):(r.number.push(a),i.push(Mh),n.push(parseFloat(e))),++a,Ih)).split(Ih),indexes:r,types:i}}function zh(e){return Rh(e).values}function Bh({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Mh?i+=dh(r[a]):e===Nh?i+=kh.transform(r[a]):i+=r[a]}return i}}function Vh(e){return Bh(Rh(e))}var Hh=e=>typeof e==`number`?0:kh.test(e)?kh.getAnimatableNone(e):e,Uh=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Hh(e);function Wh(e){let t=Rh(e);return Bh(t)(t.values.map((e,n)=>Uh(e,t.split[n])))}var Gh={test:jh,parse:zh,createTransformer:Vh,getAnimatableNone:Wh};function Kh(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function qh({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Kh(s,r,e+1/3),a=Kh(s,r,e),o=Kh(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Jh(e,t){return n=>n>0?t:e}var Yh=(e,t,n)=>e+(t-e)*n,Xh=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Zh=[xh,yh,Oh],Qh=e=>Zh.find(t=>t.test(e));function $h(e){let t=Qh(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Oh&&(n=qh(n)),n}var eg=(e,t)=>{let n=$h(e),r=$h(t);if(!n||!r)return Jh(e,t);let i={...n};return e=>(i.red=Xh(n.red,r.red,e),i.green=Xh(n.green,r.green,e),i.blue=Xh(n.blue,r.blue,e),i.alpha=Yh(n.alpha,r.alpha,e),yh.transform(i))},tg=new Set([`none`,`hidden`]);function ng(e,t){return tg.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rg(e,t){return n=>Yh(e,t,n)}function ig(e){return typeof e==`number`?rg:typeof e==`string`?ah(e)?Jh:kh.test(e)?eg:cg:Array.isArray(e)?ag:typeof e==`object`?kh.test(e)?eg:og:Jh}function ag(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>ig(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function og(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=ig(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function sg(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var cg=(e,t)=>{let n=Gh.createTransformer(t),r=Rh(e),i=Rh(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tg.has(e)&&!i.values.length||tg.has(t)&&!r.values.length?ng(e,t):_m(ag(sg(r,i),i.values),n):(`${e}${t}`,Jh(e,t))};function lg(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Yh(e,t,n):ig(e)(e,t)}var ug=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Ym.update(t,e),stop:()=>Xm(t),now:()=>Zm.isProcessing?Zm.timestamp:th.now()}},dg=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},fg=2e4;function pg(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function mg(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(pg(r),fg);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:xm(i)}}var hg={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function gg(e,t){return e*Math.sqrt(1-t*t)}var _g=12;function vg(e,t,n){let r=n;for(let n=1;n<_g;n++)r-=e(r)/t(r);return r}var yg=.001;function bg({duration:e=hg.duration,bounce:t=hg.bounce,velocity:n=hg.velocity,mass:r=hg.mass}){let i,a;hg.maxDuration;let o=1-t;o=um(hg.minDamping,hg.maxDamping,o),e=um(hg.minDuration,hg.maxDuration,xm(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=gg(t,o),c=Math.exp(-i);return yg-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=gg(t**2,o);return(-i(t)+yg>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=vg(i,a,s);if(e=bm(e),isNaN(c))return{stiffness:hg.stiffness,damping:hg.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var xg=[`duration`,`bounce`],Sg=[`stiffness`,`damping`,`mass`];function Cg(e,t){return t.some(t=>e[t]!==void 0)}function wg(e){let t={velocity:hg.velocity,stiffness:hg.stiffness,damping:hg.damping,mass:hg.mass,isResolvedFromDuration:!1,...e};if(!Cg(e,Sg)&&Cg(e,xg))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*um(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:hg.mass,stiffness:i,damping:a}}else{let n=bg({...e,velocity:0});t={...t,...n,mass:hg.mass},t.isResolvedFromDuration=!0}return t}function Tg(e=hg.visualDuration,t=hg.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=wg({...n,velocity:-xm(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=xm(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?hg.restSpeed.granular:hg.restSpeed.default,i||=v?hg.restDelta.granular:hg.restDelta.default;let y,b,x,S,C,w;if(h<1)x=gg(_,h),S=(m+h*_*g)/x,y=e=>{let t=Math.exp(-h*_*e);return o-t*(S*Math.sin(x*e)+g*Math.cos(x*e))},C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>bm(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=bm(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=bm(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(pg(T),fg),t=dg(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Tg.applyToOptions=e=>{let t=mg(e,100,Tg);return e.ease=t.ease,e.duration=bm(t.duration),e.type=`keyframes`,e};var Eg=5;function Dg(e,t,n){let r=Math.max(t-Eg,0);return Sm(n-e(r),t-r)}function Og({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Tg({keyframes:[f.value,m(f.value)],velocity:Dg(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function kg(e,t,n){let r=[],i=n||dm.mix||lg,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=_m(Array.isArray(t)?t[n]||gm:t,a)),r.push(a)}return r}function Ag(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=kg(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=vm(e[r],e[r+1],n);return s[r](i)};return n?t=>l(um(e[0],e[a-1],t)):l}function jg(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=vm(0,t,r);e.push(Yh(n,1,i))}}function Mg(e){let t=[0];return jg(t,e.length-1),t}function Ng(e,t){return e.map(e=>e*t)}function Pg(e,t){return e.map(()=>t||zm).splice(0,e.length-1)}function Fg({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Bm(r)?r.map(Wm):Wm(r),a={done:!1,value:t[0]},o=Ag(Ng(n&&n.length===t.length?n:Mg(t),e),t,{ease:Array.isArray(i)?i:Pg(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Ig=e=>e!==null;function Lg(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Ig),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Rg={decay:Og,inertia:Og,tween:Fg,keyframes:Fg,spring:Tg};function zg(e){typeof e.type==`string`&&(e.type=Rg[e.type])}var Bg=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Vg=e=>e/100,Hg=class extends Bg{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==th.now()&&this.tick(th.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;zg(e);let{type:t=Fg,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Fg;s!==Fg&&typeof o[0]!=`number`&&(this.mixKeyframes=_m(Vg,lg(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=pg(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=um(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Og&&(b.value=Lg(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return xm(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+xm(e)}get time(){return xm(this.currentTime)}set time(e){e=bm(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Dg(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(th.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=xm(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ug,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(th.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Ug(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Wg=e=>e*180/Math.PI,Gg=e=>qg(Wg(Math.atan2(e[1],e[0]))),Kg={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Gg,rotateZ:Gg,skewX:e=>Wg(Math.atan(e[1])),skewY:e=>Wg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qg=e=>(e%=360,e<0&&(e+=360),e),Jg=Gg,Yg=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Xg=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Zg={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Yg,scaleY:Xg,scale:e=>(Yg(e)+Xg(e))/2,rotateX:e=>qg(Wg(Math.atan2(e[6],e[5]))),rotateY:e=>qg(Wg(Math.atan2(-e[2],e[0]))),rotateZ:Jg,rotate:Jg,skewX:e=>Wg(Math.atan(e[4])),skewY:e=>Wg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qg(e){return+!!e.includes(`scale`)}function $g(e,t){if(!e||e===`none`)return Qg(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Zg,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Kg,i=t}if(!i)return Qg(t);let a=r[t],o=i[1].split(`,`).map(t_);return typeof a==`function`?a(o):o[a]}var e_=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return $g(n,t)};function t_(e){return parseFloat(e.trim())}var n_=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],r_=new Set([...n_,`pathRotation`]),i_=e=>e===ch||e===U,a_=new Set([`x`,`y`,`z`]),o_=n_.filter(e=>!a_.has(e));function s_(e){let t=[];return o_.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var c_={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>$g(t,`x`),y:(e,{transform:t})=>$g(t,`y`)};c_.translateX=c_.x,c_.translateY=c_.y;var l_=new Set,u_=!1,d_=!1,f_=!1;function p_(){if(d_){let e=Array.from(l_).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=s_(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}d_=!1,u_=!1,l_.forEach(e=>e.complete(f_)),l_.clear()}function m_(){l_.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(d_=!0)})}function h_(){f_=!0,m_(),p_(),f_=!1}var g_=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(l_.add(this),u_||(u_=!0,Ym.read(m_),Ym.resolveKeyframes(p_))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ug(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),l_.delete(this)}cancel(){this.state===`scheduled`&&(l_.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},__=e=>e.startsWith(`--`);function v_(e,t,n){__(t)?e.style.setProperty(t,n):e.style[t]=n}var y_={};function b_(e,t){let n=hm(e);return()=>y_[t]??n()}var x_=b_(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),S_=b_(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),C_=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,w_={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:C_([0,.65,.55,1]),circOut:C_([.55,0,1,.45]),backIn:C_([.31,.01,.66,-.59]),backOut:C_([.33,1.53,.69,.99])};function T_(e,t){if(e)return typeof e==`function`?S_()?dg(e,t):`ease-out`:Vm(e)?C_(e):Array.isArray(e)?e.map(e=>T_(e,t)||w_.easeOut):w_[e]}function E_(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=T_(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function D_(e){return typeof e==`function`&&`applyToOptions`in e}function O_({type:e,...t}){return D_(e)&&S_()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var k_=class extends Bg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=O_(e);this.animation=E_(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Lg(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),v_(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return xm(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+xm(e)}get time(){return xm(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=bm(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&x_()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),gm):r(this)}},A_={anticipate:Nm,backInOut:Mm,circInOut:Im};function j_(e){return e in A_}function M_(e){typeof e.ease==`string`&&j_(e.ease)&&(e.ease=A_[e.ease])}var N_=10,P_=class extends k_{constructor(e){M_(e),zg(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Hg({...a,autoplay:!1}),s=Math.max(N_,th.now()-this.startTime),c=um(0,N_,s-N_),l=o.sample(s).value,{name:u}=this.options;i&&u&&v_(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},F_=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Gh.test(e)||e===`0`)&&!e.startsWith(`url(`));function I_(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function L_(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=F_(i,t),s=F_(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:I_(e)||(n===`spring`||D_(n))&&r}function R_(e){e.duration=0,e.type=`keyframes`}var z_=new Set([`opacity`,`clipPath`,`filter`,`transform`]),B_=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function V_(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&B_.test(e[t]))return!0;return!1}var H_=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),U_=hm(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function W_(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return U_()&&n&&(z_.has(n)||H_.has(n)&&V_(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var G_=40,K_=class extends Bg{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=th.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||g_;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=th.now();let u=!0;L_(e,i,a,o)||(u=!1,(dm.instantAnimations||!s)&&l?.(Lg(e,n,t)),e[0]=e[e.length-1],R_(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>G_?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&W_(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new P_({...d,element:p})}catch{m=new Hg(d)}else m=new Hg(d);m.finished.then(()=>{this.notifyFinished()}).catch(gm),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),h_()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function q_(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var J_=30,Y_=e=>!isNaN(parseFloat(e)),X_={current:void 0},Z_=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=th.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=th.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Y_(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new ym);let n=this.events[e].add(t);return e===`change`?()=>{n(),Ym.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return X_.current&&X_.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=th.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>J_)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,J_);return Sm(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Q_(e,t){return new Z_(e,t)}function $_(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function ev(e,t){let n=e?.[t]??e?.default??e;return n===e?n:$_(n,e)}var tv={type:`spring`,stiffness:500,damping:25,restSpeed:10},nv=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),rv={type:`keyframes`,duration:.8},iv={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},av=(e,{keyframes:t})=>t.length>2?rv:r_.has(e)?e.startsWith(`scale`)?nv(t[1]):tv:iv,ov=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function sv(e){for(let t in e)if(!ov.has(t))return!0;return!1}var cv=(e,t,n,r={},i,a)=>o=>{let s=ev(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=bm(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};sv(s)||Object.assign(u,av(e,u)),u.duration&&=bm(u.duration),u.repeatDelay&&=bm(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(R_(u),u.delay===0&&(d=!0)),(dm.instantAnimations||dm.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,R_(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Lg(u.keyframes,s);if(e!==void 0){Ym.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Hg(u):new K_(u)},lv=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function uv(e){let t=lv.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function dv(e,t,n=1){`${e}`;let[r,i]=uv(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return fm(e)?parseFloat(e):e}return ah(i)?dv(i,t,n+1):i}function fv(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function pv(e,t,n,r){if(typeof t==`function`){let[i,a]=fv(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=fv(r);t=t(n===void 0?e.custom:n,i,a)}return t}function mv(e,t,n){let r=e.getProps();return pv(r,t,n===void 0?r.custom:n,e)}var hv=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...n_]),gv=e=>Array.isArray(e);function _v(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Q_(n))}function vv(e){return gv(e)?e[e.length-1]||0:e}function yv(e,t){let{transitionEnd:n={},transition:r={},...i}=mv(e,t)||{};i={...i,...n};for(let t in i)_v(e,t,vv(i[t]))}var bv=e=>!!(e&&e.getVelocity);function xv(e){return!!(bv(e)&&e.add)}function Sv(e,t){let n=e.getValue(`willChange`);if(xv(n))return n.add(t);if(!n&&dm.WillChange){let n=new dm.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Cv(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var wv=`data-`+Cv(`framerAppearId`);function Tv(e){return e.props[wv]}function Ev({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Dv(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?$_(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Ev(f,t))continue;let o={delay:n,...ev(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){Ym.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=Tv(e);if(n){let e=window.MotionHandoffAnimation(n,t,Ym);e!==null&&(o.startTime=e,p=!0)}}Sv(e,t);let m=l??e.shouldReduceMotion;r.start(cv(t,r,i,m&&hv.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>Ym.update(()=>{o&&yv(e,o)});d.length?Promise.all(d).then(t):t()}return d}function Ov(e,t,n={}){let r=mv(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Dv(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return kv(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function kv(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Ov(c,t,{...o,delay:n+(typeof r==`function`?0:r)+q_(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Av(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ov(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ov(e,t,n);else{let i=typeof t==`function`?mv(e,t,n.custom):t;r=Promise.all(Dv(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var jv={test:e=>e===`auto`,parse:e=>e},Mv=e=>t=>t.test(e),Nv=[ch,U,wh,Ch,Eh,Th,jv],Pv=e=>Nv.find(Mv(e));function Fv(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||mm(e)}var Iv=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Lv(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(fh)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Iv.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Rv=/\b([a-z-]*)\(.*?\)/gu,zv={...Gh,getAnimatableNone:e=>{let t=e.match(Rv);return t?t.map(Lv).join(` `):e}},Bv={...Gh,getAnimatableNone:e=>{let t=Gh.parse(e);return Gh.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Vv={...ch,transform:Math.round},Hv={borderWidth:U,borderTopWidth:U,borderRightWidth:U,borderBottomWidth:U,borderLeftWidth:U,borderRadius:U,borderTopLeftRadius:U,borderTopRightRadius:U,borderBottomRightRadius:U,borderBottomLeftRadius:U,width:U,maxWidth:U,height:U,maxHeight:U,top:U,right:U,bottom:U,left:U,inset:U,insetBlock:U,insetBlockStart:U,insetBlockEnd:U,insetInline:U,insetInlineStart:U,insetInlineEnd:U,padding:U,paddingTop:U,paddingRight:U,paddingBottom:U,paddingLeft:U,paddingBlock:U,paddingBlockStart:U,paddingBlockEnd:U,paddingInline:U,paddingInlineStart:U,paddingInlineEnd:U,margin:U,marginTop:U,marginRight:U,marginBottom:U,marginLeft:U,marginBlock:U,marginBlockStart:U,marginBlockEnd:U,marginInline:U,marginInlineStart:U,marginInlineEnd:U,fontSize:U,backgroundPositionX:U,backgroundPositionY:U,rotate:Ch,pathRotation:Ch,rotateX:Ch,rotateY:Ch,rotateZ:Ch,scale:uh,scaleX:uh,scaleY:uh,scaleZ:uh,skew:Ch,skewX:Ch,skewY:Ch,distance:U,translateX:U,translateY:U,translateZ:U,x:U,y:U,z:U,perspective:U,transformPerspective:U,opacity:lh,originX:Dh,originY:Dh,originZ:U,zIndex:Vv,fillOpacity:lh,strokeOpacity:lh,numOctaves:Vv},Uv={...Hv,color:kh,backgroundColor:kh,outlineColor:kh,fill:kh,stroke:kh,borderColor:kh,borderTopColor:kh,borderRightColor:kh,borderBottomColor:kh,borderLeftColor:kh,filter:zv,WebkitFilter:zv,mask:Bv,WebkitMask:Bv},Wv=e=>Uv[e],Gv=new Set([zv,Bv]);function Kv(e,t){let n=Wv(e);return Gv.has(n)||(n=Gh),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var qv=new Set([`auto`,`none`,`0`]);function Jv(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!qv.has(t)&&Rh(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Kv(n,i)}var Yv=class extends g_{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),ah(r))){let i=dv(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!hv.has(n)||e.length!==2)return;let[r,i]=e,a=Pv(r),o=Pv(i);if(sh(r)!==sh(i)&&c_[n]){this.needsMeasurement=!0;return}if(a!==o)if(i_(a)&&i_(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else c_[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Fv(e[t]))&&n.push(t);n.length&&Jv(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=c_[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=c_[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},Xv=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Zv(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Qv=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function $v(e){return pm(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:ey,cancel:ty}=Jm(queueMicrotask,!1),ny={x:!1,y:!1};function ry(){return ny.x||ny.y}function iy(e){return e===`x`||e===`y`?ny[e]?null:(ny[e]=!0,()=>{ny[e]=!1}):ny.x||ny.y?null:(ny.x=ny.y=!0,()=>{ny.x=ny.y=!1})}function ay(e,t){let n=Zv(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function oy(e){return!(e.pointerType===`touch`||ry())}function sy(e,t,n={}){let[r,i,a]=ay(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!oy(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var cy=(e,t)=>t?e===t||cy(e,t.parentElement):!1,ly=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,uy=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function dy(e){return uy.has(e.tagName)||e.isContentEditable===!0}var fy=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function py(e){return fy.has(e.tagName)||e.isContentEditable===!0}var my=new WeakSet;function hy(e){return t=>{t.key===`Enter`&&e(t)}}function gy(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var _y=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=hy(()=>{if(my.has(n))return;gy(n,`down`);let e=hy(()=>{gy(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>gy(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function vy(e){return ly(e)&&!ry()}var yy=new WeakSet;function by(e,t,n={}){let[r,i,a]=ay(e,n),o=e=>{let r=e.currentTarget;if(!vy(e)||yy.has(e))return;my.add(r),n.stopPropagation&&yy.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),my.has(r)&&my.delete(r),vy(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||cy(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),$v(e)&&(e.addEventListener(`focus`,e=>_y(e,i)),!dy(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function xy(e){return pm(e)&&`ownerSVGElement`in e}var Sy=new WeakMap,Cy,wy=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:xy(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Ty=wy(`inline`,`width`,`offsetWidth`),Ey=wy(`block`,`height`,`offsetHeight`);function Dy({target:e,borderBoxSize:t}){Sy.get(e)?.forEach(n=>{n(e,{get width(){return Ty(e,t)},get height(){return Ey(e,t)}})})}function Oy(e){e.forEach(Dy)}function ky(){typeof ResizeObserver>`u`||(Cy=new ResizeObserver(Oy))}function Ay(e,t){Cy||ky();let n=Zv(e);return n.forEach(e=>{let n=Sy.get(e);n||(n=new Set,Sy.set(e,n)),n.add(t),Cy?.observe(e)}),()=>{n.forEach(e=>{let n=Sy.get(e);n?.delete(t),n?.size||Cy?.unobserve(e)})}}var jy=new Set,My;function Ny(){My=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jy.forEach(t=>t(e))},window.addEventListener(`resize`,My)}function Py(e){return jy.add(e),My||Ny(),()=>{jy.delete(e),!jy.size&&typeof My==`function`&&(window.removeEventListener(`resize`,My),My=void 0)}}function Fy(e,t){return typeof e==`function`?Py(e):Ay(e,t)}var Iy={value:null,addProjectionMetrics:null};function Ly(e){return xy(e)&&e.tagName===`svg`}var Ry=[...Nv,kh,Gh],zy=e=>Ry.find(Mv(e)),By=()=>({translate:0,scale:1,origin:0,originPoint:0}),Vy=()=>({x:By(),y:By()}),Hy=()=>({min:0,max:0}),Uy=()=>({x:Hy(),y:Hy()}),Wy=new WeakMap;function Gy(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Ky(e){return typeof e==`string`||Array.isArray(e)}var qy=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Jy=[`initial`,...qy];function Yy(e){return Gy(e.animate)||Jy.some(t=>Ky(e[t]))}function Xy(e){return!!(Yy(e)||e.variants)}function Zy(e,t,n){for(let r in t){let i=t[r],a=n[r];if(bv(i))e.addValue(r,i);else if(bv(a))e.addValue(r,Q_(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Q_(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Qy={current:null},$y={current:!1},eb=typeof window<`u`;function tb(){if($y.current=!0,eb)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Qy.current=e.matches;e.addEventListener(`change`,t),t()}else Qy.current=!1}var nb=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],rb={};function ib(e){rb=e}function ab(){return rb}var ob=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=g_,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=th.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Ym.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Yy(t),this.isVariantNode=Xy(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&bv(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,Wy.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:($y.current||tb(),this.shouldReduceMotion=Qy.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Xm(this.notifyUpdate),Xm(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&z_.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new k_({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:bm(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=r_.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Ym.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in rb){let t=rb[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Uy()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<nb.length;t++){let n=nb[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Zy(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Q_(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(fm(n)||mm(n))?n=parseFloat(n):!zy(n)&&Gh.test(t)&&(n=Kv(e,t)),this.setBaseTarget(e,bv(n)?n.get():n)),bv(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=pv(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!bv(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new ym),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){ey.render(this.render)}},sb=class extends ob{constructor(){super(...arguments),this.KeyframeResolver=Yv}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;bv(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},cb=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function lb({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function ub({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function db(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function fb(e){return e===void 0||e===1}function pb({scale:e,scaleX:t,scaleY:n}){return!fb(e)||!fb(t)||!fb(n)}function mb(e){return pb(e)||hb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function hb(e){return gb(e.x)||gb(e.y)}function gb(e){return e&&e!==`0%`}function _b(e,t,n){return n+t*(e-n)}function vb(e,t,n,r,i){return i!==void 0&&(e=_b(e,i,r)),_b(e,n,r)+t}function yb(e,t=0,n=1,r,i){e.min=vb(e.min,t,n,r,i),e.max=vb(e.max,t,n,r,i)}function bb(e,{x:t,y:n}){yb(e.x,t.translate,t.scale,t.originPoint),yb(e.y,n.translate,n.scale,n.originPoint)}var xb=.999999999999,Sb=1.0000000000001;function Cb(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(wb(e.x,-a.scroll.offset.x),wb(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,bb(e,o)),r&&mb(a.latestValues)&&Db(e,a.latestValues,a.layout?.layoutBox))}t.x<Sb&&t.x>xb&&(t.x=1),t.y<Sb&&t.y>xb&&(t.y=1)}function wb(e,t){e.min+=t,e.max+=t}function Tb(e,t,n,r,i=.5){yb(e,t,n,Yh(e.min,e.max,i),r)}function Eb(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Db(e,t,n){let r=n??e;Tb(e.x,Eb(t.x,r.x),t.scaleX,t.scale,t.originX),Tb(e.y,Eb(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ob(e,t){return lb(db(e.getBoundingClientRect(),t))}function kb(e,t,n){let r=Ob(e,n),{scroll:i}=t;return i&&(wb(r.x,i.offset.x),wb(r.y,i.offset.y)),r}var Ab={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},jb=n_.length;function Mb(e,t,n){let r=``,i=!0;for(let a=0;a<jb;a++){let o=n_[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=Qv(s,Hv[o]);if(!c){i=!1;let t=Ab[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${Qv(a,Hv.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Nb(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(r_.has(e)){o=!0;continue}else if(rh(e)){i[e]=n;continue}else{let t=Qv(n,Hv[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Mb(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Pb(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Fb(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Ib={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(U.test(e))e=parseFloat(e);else return e;return`${Fb(e,t.target.x)}% ${Fb(e,t.target.y)}%`}},Lb={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Gh.parse(e);if(i.length>5)return r;let a=Gh.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=Yh(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Rb={borderRadius:{...Ib,applyTo:[...Xv]},borderTopLeftRadius:Ib,borderTopRightRadius:Ib,borderBottomLeftRadius:Ib,borderBottomRightRadius:Ib,boxShadow:Lb};function zb(e,{layout:t,layoutId:n}){return r_.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Rb[e]||e===`opacity`)}function Bb(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(bv(r[t])||i&&bv(i[t])||zb(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Vb(e){return window.getComputedStyle(e)}var Hb=class extends sb{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Pb}readValueFromInstance(e,t){if(r_.has(t))return this.projection?.isProjecting?Qg(t):e_(e,t);{let n=Vb(e),r=(rh(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ob(e,t)}build(e,t,n){Nb(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Bb(e,t,n)}},Ub={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Wb={offset:`strokeDashoffset`,array:`strokeDasharray`};function Gb(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Ub:Wb;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Kb=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function qb(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Nb(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Kb)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Gb(d,i,a,o,!1)}var Jb=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Yb=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Xb(e,t,n,r){Pb(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Jb.has(n)?n:Cv(n),t.attrs[n])}function Zb(e,t,n){let r=Bb(e,t,n);for(let n in e)if(bv(e[n])||bv(t[n])){let t=n_.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Qb=class extends sb{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Uy}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(r_.has(t)){let e=Wv(t);return e&&e.default||0}return t=Jb.has(t)?t:Cv(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Zb(e,t,n)}build(e,t,n){qb(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Xb(e,t,n,r)}mount(e){this.isSVGTag=Yb(e.tagName),super.mount(e)}},$b=Jy.length;function ex(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&ex(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<$b;n++){let r=Jy[n],i=e.props[r];(Ky(i)||i===!1)&&(t[r]=i)}return t}function tx(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var nx=[...qy].reverse(),rx=qy.length;function ix(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Av(e,t,n)))}function ax(e){let t=ix(e),n=cx(),r=!0,i=!1,a=t=>(n,r)=>{let i=mv(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=ex(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<rx;t++){let p=nx[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Ky(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||Gy(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=ox(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},ee=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=gv(t)&&gv(n)?!tx(t,n)||y:t!==n,r?t==null?u.add(e):ee(e):t!==void 0&&u.has(e)?ee(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let E=v&&y;b&&(!E||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!E&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=mv(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=q_(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=mv(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=cx(),i=!0}}}function ox(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!tx(t,e):!1}function sx(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cx(){return{animate:sx(!0),whileInView:sx(),whileHover:sx(),whileTap:sx(),whileDrag:sx(),whileFocus:sx(),exit:sx()}}function lx(e,t){e.min=t.min,e.max=t.max}function ux(e,t){lx(e.x,t.x),lx(e.y,t.y)}function dx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var fx=.9999,px=1.0001,mx=-.01,hx=.01;function gx(e){return e.max-e.min}function _x(e,t,n){return Math.abs(e-t)<=n}function vx(e,t,n,r=.5){e.origin=r,e.originPoint=Yh(t.min,t.max,e.origin),e.scale=gx(n)/gx(t),e.translate=Yh(n.min,n.max,e.origin)-e.originPoint,(e.scale>=fx&&e.scale<=px||isNaN(e.scale))&&(e.scale=1),(e.translate>=mx&&e.translate<=hx||isNaN(e.translate))&&(e.translate=0)}function yx(e,t,n,r){vx(e.x,t.x,n.x,r?r.originX:void 0),vx(e.y,t.y,n.y,r?r.originY:void 0)}function bx(e,t,n,r=0){e.min=(r?Yh(n.min,n.max,r):n.min)+t.min,e.max=e.min+gx(t)}function xx(e,t,n,r){bx(e.x,t.x,n.x,r?.x),bx(e.y,t.y,n.y,r?.y)}function Sx(e,t,n,r=0){let i=r?Yh(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+gx(t)}function Cx(e,t,n,r){Sx(e.x,t.x,n.x,r?.x),Sx(e.y,t.y,n.y,r?.y)}function wx(e,t,n,r,i){return e-=t,e=_b(e,1/n,r),i!==void 0&&(e=_b(e,1/i,r)),e}function Tx(e,t=0,n=1,r=.5,i,a=e,o=e){if(wh.test(t)&&(t=parseFloat(t),t=Yh(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Yh(a.min,a.max,r);e===a&&(s-=t),e.min=wx(e.min,t,n,s,i),e.max=wx(e.max,t,n,s,i)}function Ex(e,t,[n,r,i],a,o){Tx(e,t[n],t[r],t[i],t.scale,a,o)}var Dx=[`x`,`scaleX`,`originX`],Ox=[`y`,`scaleY`,`originY`];function kx(e,t,n,r){Ex(e.x,t,Dx,n?n.x:void 0,r?r.x:void 0),Ex(e.y,t,Ox,n?n.y:void 0,r?r.y:void 0)}function Ax(e){return e.translate===0&&e.scale===1}function jx(e){return Ax(e.x)&&Ax(e.y)}function Mx(e,t){return e.min===t.min&&e.max===t.max}function Nx(e,t){return Mx(e.x,t.x)&&Mx(e.y,t.y)}function Px(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Fx(e,t){return Px(e.x,t.x)&&Px(e.y,t.y)}function Ix(e){return gx(e.x)/gx(e.y)}function Lx(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Rx(e){return[e(`x`),e(`y`)]}function zx(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Bx=Xv.length,Vx=e=>typeof e==`string`?parseFloat(e):e,Hx=e=>typeof e==`number`||U.test(e);function Ux(e,t,n,r,i,a){i?(e.opacity=Yh(0,n.opacity??1,Gx(r)),e.opacityExit=Yh(t.opacity??1,0,Kx(r))):a&&(e.opacity=Yh(t.opacity??1,n.opacity??1,r));for(let i=0;i<Bx;i++){let a=Xv[i],o=Wx(t,a),s=Wx(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Hx(o)===Hx(s)?(e[a]=Math.max(Yh(Vx(o),Vx(s),r),0),(wh.test(s)||wh.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Yh(t.rotate||0,n.rotate||0,r))}function Wx(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Gx=qx(0,.5,Fm),Kx=qx(.5,.95,gm);function qx(e,t,n){return r=>r<e?0:r>t?1:n(vm(e,t,r))}function Jx(e,t,n){let r=bv(e)?e:Q_(e);return r.start(cv(``,r,t,n)),r.animation}function Yx(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var Xx=(e,t)=>e.depth-t.depth,Zx=class{constructor(){this.children=[],this.isDirty=!1}add(e){cm(this.children,e),this.isDirty=!0}remove(e){lm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Xx),this.isDirty=!1,this.children.forEach(e)}};function Qx(e,t){let n=th.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(Xm(r),e(a-t))};return Ym.setup(r,!0),()=>Xm(r)}function $x(e){return bv(e)?e.get():e}var eS=class{constructor(){this.members=[]}add(e){cm(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(lm(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(lm(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},tS={hasAnimatedSinceResize:!0,hasEverUpdated:!1},nS={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},rS=[``,`X`,`Y`,`Z`],iS=1e3,aS=0;function oS(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function sS(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Tv(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Ym,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&sS(r)}function cS({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=aS++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Iy.value&&(nS.nodes=nS.calculatedTargetDeltas=nS.calculatedProjections=0),this.nodes.forEach(dS),this.nodes.forEach(bS),this.nodes.forEach(xS),this.nodes.forEach(fS),Iy.addProjectionMetrics&&Iy.addProjectionMetrics(nS)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Zx)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new ym),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=xy(t)&&!Ly(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;Ym.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Qx(i,250),tS.hasAnimatedSinceResize&&(tS.hasAnimatedSinceResize=!1,this.nodes.forEach(yS)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||OS,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Fx(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...ev(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||yS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Xm(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(SS),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&sS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(hS),this.nodes.forEach(mS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(gS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(_S),this.nodes.forEach(vS),this.nodes.forEach(lS),this.nodes.forEach(uS)):this.nodes.forEach(gS),this.clearAllSnapshots();let e=th.now();Zm.delta=um(0,1e3/60,e-Zm.timestamp),Zm.timestamp=e,Zm.isProcessing=!0,Qm.update.process(Zm),Qm.preRender.process(Zm),Qm.render.process(Zm),Zm.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ey.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pS),this.sharedNodes.forEach(CS)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ym.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ym.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!gx(this.snapshot.measuredBox.x)&&!gx(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=Uy(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!jx(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||mb(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),MS(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Uy();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(PS))){let{scroll:e}=this.root;e&&(wb(t.x,e.offset.x),wb(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Uy();if(ux(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&ux(t,e),wb(t.x,i.offset.x),wb(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Uy();ux(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(wb(r.x,-n.scroll.offset.x),wb(r.y,-n.scroll.offset.y)),mb(n.latestValues)&&Db(r,n.latestValues,n.layout?.layoutBox)}return mb(this.latestValues)&&Db(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Uy();ux(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!mb(n.latestValues))continue;let r;n.instance&&(pb(n.latestValues)&&n.updateSnapshot(),r=Uy(),ux(r,n.measurePageBox())),kx(t,n.latestValues,n.snapshot?.layoutBox,r)}return mb(this.latestValues)&&kx(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Zm.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=Zm.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Uy(),this.targetWithTransforms=Uy()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),xx(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ux(this.target,this.layout.layoutBox),bb(this.target,this.targetDelta)):ux(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Iy.value&&nS.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||pb(this.parent.latestValues)||hb(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Uy(),this.relativeTargetOrigin=Uy(),Cx(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ux(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Zm.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;ux(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Cb(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Uy());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(dx(this.prevProjectionDelta.x,this.projectionDelta.x),dx(this.prevProjectionDelta.y,this.projectionDelta.y)),yx(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Lx(this.projectionDelta.x,this.prevProjectionDelta.x)||!Lx(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Iy.value&&nS.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Vy(),this.projectionDelta=Vy(),this.projectionDeltaWithTransform=Vy()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Vy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Uy(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(DS));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=Yh(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=Yh(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(wS(o.x,e.x,n),wS(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cx(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),ES(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Nx(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Uy(),ux(f,this.relativeTarget)),c&&(this.animationValues=a,Ux(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Xm(this.pendingAnimation),void 0),this.pendingAnimation=Ym.update(()=>{tS.hasAnimatedSinceResize=!0,this.motionValue||=Q_(0),this.motionValue.jump(0,!1),this.currentAnimation=Jx(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(iS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&NS(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Uy();let t=gx(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=gx(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}ux(t,n),Db(t,i),yx(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new eS),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&oS(`z`,e,r,this.animationValues);for(let t=0;t<rS.length;t++)oS(`rotate${rS[t]}`,e,r,this.animationValues),oS(`skew${rS[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=$x(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=$x(t?.pointerEvents)||``),this.hasProjected&&!mb(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=zx(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Rb){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Rb[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?$x(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(mS),this.root.sharedNodes.clear()}}}function lS(e){e.updateLayout()}function uS(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Rx(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=gx(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;lx(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else NS(i,t.layoutBox,n)&&Rx(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=gx(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Vy();yx(o,n,t.layoutBox);let s=Vy();a?yx(s,e.applyTransform(r,!0),t.measuredBox):yx(s,n,t.layoutBox);let c=!jx(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Uy();Cx(s,t.layoutBox,i.layoutBox,o);let c=Uy();Cx(c,n,a.layoutBox,o),Fx(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function dS(e){Iy.value&&nS.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function fS(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function pS(e){e.clearSnapshot()}function mS(e){e.clearMeasurements()}function hS(e){e.isLayoutDirty=!0,e.updateLayout()}function gS(e){e.isLayoutDirty=!1}function _S(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function vS(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function yS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function bS(e){e.resolveTargetDelta()}function xS(e){e.calcProjection()}function SS(e){e.resetSkewAndRotation()}function CS(e){e.removeLeadSnapshot()}function wS(e,t,n){e.translate=Yh(t.translate,0,n),e.scale=Yh(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function TS(e,t,n,r){e.min=Yh(t.min,n.min,r),e.max=Yh(t.max,n.max,r)}function ES(e,t,n,r){TS(e.x,t.x,n.x,r),TS(e.y,t.y,n.y,r)}function DS(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var OS={duration:.45,ease:[.4,0,.1,1]},kS=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),AS=kS(`applewebkit/`)&&!kS(`chrome/`)?Math.round:gm;function jS(e){e.min=AS(e.min),e.max=AS(e.max)}function MS(e){jS(e.x),jS(e.y)}function NS(e,t,n){return e===`position`||e===`preserve-aspect`&&!_x(Ix(t),Ix(n),.2)}function PS(e){return e!==e.root&&e.scroll?.wasRoot}var FS=cS({attachResizeListener:(e,t)=>Yx(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),IS={current:void 0},LS=cS({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!IS.current){let e=new FS({});e.mount(window),e.setOptions({layoutScroll:!0}),IS.current=e}return IS.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),RS=(0,I.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function zS(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function BS(...e){return t=>{let n=!1,r=e.map(e=>{let r=zS(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():zS(e[t],null)}}}}function VS(...e){return I.useCallback(BS(...e),e)}var HS=class extends I.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if($v(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=$v(e)&&e.offsetWidth||0,r=$v(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function US({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,I.useId)(),s=(0,I.useRef)(null),c=(0,I.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,I.useContext)(RS),u=VS(s,e.props?.ref??e?.ref);return(0,I.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
15
|
+
]))`;continue}}if(n.s&&r[e]===`.`){i+=o?`${r[e]}\r\n`:`[${r[e]}\r\n]`;continue}i+=r[e],r[e]===`\\`?a=!0:o&&r[e]===`]`?o=!1:!o&&r[e]===`[`&&(o=!0)}try{new RegExp(i)}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 i}function Dd(e,t){let n={type:`object`,additionalProperties:Xd(e.valueType._def,{...t,currentPath:[...t.currentPath,`additionalProperties`]})??t.allowedAdditionalProperties};if(e.keyType?._def.typeName===`ZodString`&&e.keyType._def.checks?.length){let{type:r,...i}=bd(e.keyType._def,t);return{...n,propertyNames:i}}else if(e.keyType?._def.typeName===`ZodEnum`)return{...n,propertyNames:{enum:e.keyType._def.values}};else if(e.keyType?._def.typeName===`ZodBranded`&&e.keyType._def.type._def.typeName===`ZodString`&&e.keyType._def.type._def.checks?.length){let{type:r,...i}=cd(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Od(e,t){return t.mapStrategy===`record`?Dd(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[Xd(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||id(),Xd(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||id()],minItems:2,maxItems:2}}}function kd(e){let t=e.values,n=Object.keys(e.values).filter(e=>typeof t[t[e]]!=`number`).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:r.length===1?r[0]===`string`?`string`:`number`:[`string`,`number`],enum:n}}function Ad(){return{not:id()}}function jd(){return{type:`null`}}var Md={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function Nd(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in Md&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=Md[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}else if(n.every(e=>e._def.typeName===`ZodLiteral`&&!e.description)){let e=n.reduce((e,t)=>{let n=typeof t._def.value;switch(n){case`string`:case`number`:case`boolean`:return[...e,n];case`bigint`:return[...e,`integer`];case`object`:if(t._def.value===null)return[...e,`null`];default:return e}},[]);if(e.length===n.length){let t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>e._def.typeName===`ZodEnum`))return{type:`string`,enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return Pd(e,t)}var Pd=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>Xd(e._def,{...t,currentPath:[...t.currentPath,`anyOf`,`${n}`]})).filter(e=>!!e&&(!t.strictUnions||typeof e==`object`&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function Fd(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Md[e.innerType._def.typeName],`null`]};let n=Xd(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Id(e){let t={type:`number`};if(!e.checks)return t;for(let 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}return t}function Ld(e,t){let n={type:`object`,properties:{}},r=[],i=e.shape();for(let e in i){let a=i[e];if(a===void 0||a._def===void 0)continue;let o=zd(a),s=Xd(a._def,{...t,currentPath:[...t.currentPath,`properties`,e],propertyPath:[...t.currentPath,`properties`,e]});s!==void 0&&(n.properties[e]=s,o||r.push(e))}r.length&&(n.required=r);let a=Rd(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Rd(e,t){if(e.catchall._def.typeName!==`ZodNever`)return Xd(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 zd(e){try{return e.isOptional()}catch{return!0}}var Bd=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return Xd(e.innerType._def,t);let n=Xd(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:id()},n]}:id()},Vd=(e,t)=>{if(t.pipeStrategy===`input`)return Xd(e.in._def,t);if(t.pipeStrategy===`output`)return Xd(e.out._def,t);let n=Xd(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,Xd(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Hd(e,t){return Xd(e.type._def,t)}function Ud(e,t){let n={type:`array`,uniqueItems:!0,items:Xd(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`]})};return e.minSize&&(n.minItems=e.minSize.value),e.maxSize&&(n.maxItems=e.maxSize.value),n}function Wd(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>Xd(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:Xd(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>Xd(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Gd(){return{not:id()}}function Kd(){return id()}var qd=(e,t)=>Xd(e.innerType._def,t),Jd=(e,t,n)=>{switch(t){case`ZodString`:return bd(e,n);case`ZodNumber`:return Id(e);case`ZodObject`:return Ld(e,n);case`ZodBigInt`:return od(e);case`ZodBoolean`:return sd();case`ZodDate`:return ud(e,n);case`ZodUndefined`:return Gd();case`ZodNull`:return jd();case`ZodArray`:return ad(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return Nd(e,n);case`ZodIntersection`:return gd(e,n);case`ZodTuple`:return Wd(e,n);case`ZodRecord`:return Dd(e,n);case`ZodLiteral`:return _d(e);case`ZodEnum`:return md(e);case`ZodNativeEnum`:return kd(e);case`ZodNullable`:return Fd(e,n);case`ZodOptional`:return Bd(e,n);case`ZodMap`:return Od(e,n);case`ZodSet`:return Ud(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return Hd(e,n);case`ZodNaN`:case`ZodNever`:return Ad();case`ZodEffects`:return pd(e,n);case`ZodAny`:return id();case`ZodUnknown`:return Kd();case`ZodDefault`:return fd(e,n);case`ZodBranded`:return cd(e,n);case`ZodReadonly`:return qd(e,n);case`ZodCatch`:return ld(e,n);case`ZodPipeline`:return Vd(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},Yd=(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 Xd(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==td)return i}if(r&&!n){let e=Zd(r,t);if(e!==void 0)return e}let i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);let a=Jd(e,e.typeName,t),o=typeof a==`function`?Xd(a(),t):a;if(o&&Qd(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var Zd=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:Yd(t.currentPath,e.path)};case`none`:case`seen`:return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join(`/`)}! Defaulting to any`),id()):t.$refStrategy===`seen`?id():void 0}},Qd=(e,t,n)=>(e.description&&(n.description=e.description),n),$d=e=>{let t=rd(e),n=t.name===void 0?t.basePath:[...t.basePath,t.definitionPath,t.name];return{...t,currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},ef=(e,t)=>{let n=$d(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:Xd(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??id()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=Xd(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??id(),o=typeof t==`object`&&t.name!==void 0&&t.nameStrategy===`title`?t.name:void 0;o!==void 0&&(a.title=o);let s=i===void 0?r?{...a,[n.definitionPath]:r}:a:{$ref:[...n.$refStrategy===`relative`?[]:n.basePath,n.definitionPath,i].join(`/`),[n.definitionPath]:{...r,[i]:a}};return s.$schema=`http://json-schema.org/draft-07/schema#`,s},tf=Symbol.for(`vercel.ai.schema`);function nf(e){let t;return()=>(t??=e(),t)}function rf(e,{validate:t}={}){return{[tf]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function af(e){return typeof e==`object`&&!!e&&tf in e&&e[tf]===!0&&`jsonSchema`in e&&`validate`in e}function of(e){return e==null?rf({type:`object`,properties:{},additionalProperties:!1}):af(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?ff(e):sf(e):e()}function sf(e){return rf(()=>{if(!cf(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return $u(e[`~standard`].jsonSchema.input({target:`draft-07`}))},{validate:async t=>{let n=await e[`~standard`].validate(t);return`value`in n?{success:!0,value:n.value}:{success:!1,error:new Tu({value:t,cause:n.issues})}}})}function cf(e){return e[`~standard`].jsonSchema!=null}function lf(e,t){let n=t?.useReferences??!1;return rf(()=>ef(e,{$refStrategy:n?`root`:`none`}),{validate:async t=>{let n=await e.safeParseAsync(t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function uf(e,t){let n=t?.useReferences??!1;return rf(()=>$u(Le(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await u(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function df(e){return`_zod`in e}function ff(e,t){return df(e)?uf(e,t):lf(e,t)}async function pf({value:e,schema:t,context:n}){let r=await mf({value:e,schema:t,context:n});if(!r.success)throw Tu.wrap({value:e,cause:r.error,context:n});return r.value}async function mf({value:e,schema:t,context:n}){let r=of(t);try{if(r.validate==null)return{success:!0,value:e,rawValue:e};let t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:Tu.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:Tu.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function hf({text:e,schema:t}){try{let n=Qu(e);return t==null?{success:!0,value:n,rawValue:n}:await mf({value:n,schema:t})}catch(t){return{success:!1,error:xu.isInstance(t)?t:new xu({text:e,cause:t}),rawValue:void 0}}}function gf({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Ru).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await hf({text:e,schema:t}))}}))}async function _f(e){return typeof e==`function`&&(e=e()),e}new TextDecoder;var vf=`AI_InvalidArgumentError`,yf=`vercel.ai.error.${vf}`,bf=Symbol.for(yf),xf=class extends iu{constructor({parameter:e,value:t,message:n}){super({name:vf,message:`Invalid argument for parameter ${e}: ${n}`}),this[bf]=!0,this.parameter=e,this.value=t}static isInstance(e){return iu.hasMarker(e,yf)}},Sf=`AI_UIMessageStreamError`,Cf=`vercel.ai.error.${Sf}`,wf=Symbol.for(Cf),Tf=class extends iu{constructor({chunkType:e,chunkId:t,message:n}){super({name:Sf,message:n}),this[wf]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return iu.hasMarker(e,Cf)}},Ef=new Map([[`generateObject`,`AISDK_DEP_GENERATE_OBJECT`],[`streamObject`,`AISDK_DEP_STREAM_OBJECT`],[`experimental_generateSpeech`,`AISDK_DEP_EXPERIMENTAL_GENERATE_SPEECH`],[`experimental_transcribe`,`AISDK_DEP_EXPERIMENTAL_TRANSCRIBE`],[`"image" content part`,`AISDK_DEP_IMAGE_CONTENT_PART`],[`"tool-result" content of type "file-data"`,`AISDK_DEP_TOOL_RESULT_FILE_DATA`],[`"tool-result" content of type "file-url"`,`AISDK_DEP_TOOL_RESULT_FILE_URL`],[`"tool-result" content of type "file-id"`,`AISDK_DEP_TOOL_RESULT_FILE_ID`],[`"tool-result" content of type "file-reference"`,`AISDK_DEP_TOOL_RESULT_FILE_REFERENCE`],[`"tool-result" content of type "image-data"`,`AISDK_DEP_TOOL_RESULT_IMAGE_DATA`],[`"tool-result" content of type "image-url"`,`AISDK_DEP_TOOL_RESULT_IMAGE_URL`],[`"tool-result" content of type "image-file-id"`,`AISDK_DEP_TOOL_RESULT_IMAGE_FILE_ID`],[`"tool-result" content of type "image-file-reference"`,`AISDK_DEP_TOOL_RESULT_IMAGE_FILE_REFERENCE`],[`rawInput in output-error UI message parts`,`AISDK_DEP_UI_MESSAGE_RAW_INPUT`]]);function Df(e){return e.replace(/[^a-zA-Z0-9]/g,e=>`_${e.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`)}`)}function Of({setting:e,provider:t}){return t==null?Ef.get(e)??`AISDK_DEP_SETTING_${Df(e)}`:`AISDK_DEP_PROVIDER_${Df(t)}__${Df(e)}`}function kf({warning:e,provider:t,model:n}){let r=`AI SDK Warning${t!=null&&n!=null?` (${t} / ${n})`:``}:`;switch(e.type){case`unsupported`:{let t=`${r} The feature "${e.feature}" is not supported.`;return e.details&&(t+=` ${e.details}`),t}case`compatibility`:{let t=`${r} The feature "${e.feature}" is used in a compatibility mode.`;return e.details&&(t+=` ${e.details}`),t}case`deprecated`:return`${r} Deprecated: "${e.setting}". ${e.message}`;case`other`:return`${r} ${e.message}`;default:return`${r} ${JSON.stringify(e,null,2)}`}}var Af=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,jf=!1,Mf=new Set;function Nf({message:e,type:t,code:n}){typeof process<`u`&&typeof process.emitWarning==`function`?process.emitWarning(e,n==null?{type:t}:{type:t,code:n}):console.warn(n==null?e:`[${n}] ${e}`)}var Pf=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}jf||(jf=!0,Nf({message:Af,type:`Warning`}));for(let t of e.warnings){let n=t.type===`deprecated`?Of({setting:t.setting,provider:e.provider}):void 0;if(n!=null){if(Mf.has(n))continue;Mf.add(n)}Nf({message:kf({warning:t,provider:e.provider,model:e.model}),type:t.type===`deprecated`?`DeprecationWarning`:`Warning`,code:n})}}};function Ff(e,t){if(e===void 0&&t===void 0)return;if(e===void 0)return t;if(t===void 0)return e;let n={...e};for(let r in t)if(!(r===`__proto__`||r===`constructor`||r===`prototype`)&&Object.prototype.hasOwnProperty.call(t,r)){let i=t[r];if(i===void 0)continue;let a=r in e?e[r]:void 0,o=typeof i==`object`&&!!i&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof RegExp),s=typeof a==`object`&&!!a&&!Array.isArray(a)&&!(a instanceof Date)&&!(a instanceof RegExp);o&&s?n[r]=Ff(a,i):n[r]=i}return n}var B={array:S,boolean:E,custom:j,discriminatedUnion:me,enum:ie,instanceof:oe,lazy:h,literal:ye,looseObject:T,never:ve,null:le,number:xe,object:w,record:ct,string:P,union:Ce,unknown:Ee},If=B.lazy(()=>B.union([B.null(),B.string(),B.number(),B.boolean(),B.record(B.string(),If.optional()),B.array(If)])),V=B.record(B.string(),B.record(B.string(),If.optional())),Lf=B.union([B.string(),B.instanceof(Uint8Array),B.instanceof(ArrayBuffer),B.custom(qu,{message:`Must be a Buffer`})]),Rf=B.record(B.string(),B.string()),zf=B.object({type:B.literal(`text`),text:B.string(),providerOptions:V.optional()}),Bf=B.object({type:B.literal(`image`),image:B.union([Lf,B.instanceof(URL),Rf]),mediaType:B.string().optional(),providerOptions:V.optional()}),Vf=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:Lf}),B.object({type:B.literal(`url`),url:B.instanceof(URL)}),B.object({type:B.literal(`reference`),reference:Rf}),B.object({type:B.literal(`text`),text:B.string()})]),Hf=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:Lf}),B.object({type:B.literal(`url`),url:B.instanceof(URL)})]),Uf=B.object({type:B.literal(`file`),data:B.union([Vf,Lf,B.instanceof(URL),Rf]),filename:B.string().optional(),mediaType:B.string(),providerOptions:V.optional()}),Wf=B.object({type:B.literal(`reasoning`),text:B.string(),providerOptions:V.optional()}),Gf=B.object({type:B.literal(`custom`),kind:B.string().transform(e=>e),providerOptions:V.optional()}),Kf=B.object({type:B.literal(`reasoning-file`),data:B.union([Hf,Lf,B.instanceof(URL)]),mediaType:B.string(),providerOptions:V.optional()}),qf=B.object({type:B.literal(`tool-call`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerOptions:V.optional(),providerExecuted:B.boolean().optional()}),Jf=B.discriminatedUnion(`type`,[B.object({type:B.literal(`text`),value:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`json`),value:If,providerOptions:V.optional()}),B.object({type:B.literal(`execution-denied`),reason:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`error-text`),value:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`error-json`),value:If,providerOptions:V.optional()}),B.object({type:B.literal(`content`),value:B.array(B.union([B.object({type:B.literal(`text`),text:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`file`),data:Vf,mediaType:B.string(),filename:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`file-data`),data:B.string(),mediaType:B.string(),filename:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`file-url`),url:B.string(),mediaType:B.string().optional(),providerOptions:V.optional()}),B.object({type:B.literal(`file-id`),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:V.optional()}),B.object({type:B.literal(`file-reference`),providerReference:B.record(B.string(),B.string()),providerOptions:V.optional()}),B.object({type:B.literal(`image-data`),data:B.string(),mediaType:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`image-url`),url:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`image-file-id`),fileId:B.union([B.string(),B.record(B.string(),B.string())]),providerOptions:V.optional()}),B.object({type:B.literal(`image-file-reference`),providerReference:B.record(B.string(),B.string()),providerOptions:V.optional()}),B.object({type:B.literal(`custom`),providerOptions:V.optional()})]))})]),Yf=B.object({type:B.literal(`tool-result`),toolCallId:B.string(),toolName:B.string(),output:Jf,providerOptions:V.optional()}),Xf=B.object({type:B.literal(`tool-approval-request`),approvalId:B.string(),toolCallId:B.string(),reason:B.string().optional(),isAutomatic:B.boolean().optional(),signature:B.string().optional(),inputSchemaInput:B.unknown().optional()}),Zf=B.object({type:B.literal(`tool-approval-response`),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional()}),Qf=B.object({role:B.literal(`system`),content:B.string(),providerOptions:V.optional()}),$f=B.object({role:B.literal(`user`),content:B.union([B.string(),B.array(B.union([zf,Bf,Uf]))]),providerOptions:V.optional()}),ep=B.object({role:B.literal(`assistant`),content:B.union([B.string(),B.array(B.union([zf,Gf,Uf,Wf,Kf,qf,Yf,Xf]))]),providerOptions:V.optional()}),tp=B.object({role:B.literal(`tool`),content:B.array(B.union([Yf,Zf])),providerOptions:V.optional()});B.union([Qf,$f,ep,tp]);function np(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function rp(e){let t=[`ROOT`],n=-1,r=null,i=0;function a(e){return e>=`0`&&e<=`9`||e>=`A`&&e<=`F`||e>=`a`&&e<=`f`}function o(e,i,a){switch(e){case`"`:n=i,t.pop(),t.push(a),t.push(`INSIDE_STRING`);break;case`f`:case`t`:case`n`:n=i,r=i,t.pop(),t.push(a),t.push(`INSIDE_LITERAL`);break;case`-`:t.pop(),t.push(a),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=i,t.pop(),t.push(a),t.push(`INSIDE_NUMBER`);break;case`{`:n=i,t.pop(),t.push(a),t.push(`INSIDE_OBJECT_START`);break;case`[`:n=i,t.pop(),t.push(a),t.push(`INSIDE_ARRAY_START`)}}function s(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_COMMA`);break;case`}`:n=r,t.pop()}}function c(e,r){switch(e){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=r,t.pop()}}for(let l=0;l<e.length;l++){let u=e[l];switch(t[t.length-1]){case`ROOT`:o(u,l,`FINISH`);break;case`INSIDE_OBJECT_START`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`);break;case`}`:n=l,t.pop()}break;case`INSIDE_OBJECT_AFTER_COMMA`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_KEY`)}break;case`INSIDE_OBJECT_KEY`:switch(u){case`"`:t.pop(),t.push(`INSIDE_OBJECT_AFTER_KEY`)}break;case`INSIDE_OBJECT_AFTER_KEY`:switch(u){case`:`:t.pop(),t.push(`INSIDE_OBJECT_BEFORE_VALUE`)}break;case`INSIDE_OBJECT_BEFORE_VALUE`:o(u,l,`INSIDE_OBJECT_AFTER_VALUE`);break;case`INSIDE_OBJECT_AFTER_VALUE`:s(u,l);break;case`INSIDE_STRING`:switch(u){case`"`:t.pop(),n=l;break;case`\\`:t.push(`INSIDE_STRING_ESCAPE`);break;default:n=l}break;case`INSIDE_ARRAY_START`:switch(u){case`]`:n=l,t.pop();break;default:n=l,o(u,l,`INSIDE_ARRAY_AFTER_VALUE`)}break;case`INSIDE_ARRAY_AFTER_VALUE`:switch(u){case`,`:t.pop(),t.push(`INSIDE_ARRAY_AFTER_COMMA`);break;case`]`:n=l,t.pop();break;default:n=l}break;case`INSIDE_ARRAY_AFTER_COMMA`:o(u,l,`INSIDE_ARRAY_AFTER_VALUE`);break;case`INSIDE_STRING_ESCAPE`:t.pop(),u===`u`?(i=0,t.push(`INSIDE_STRING_UNICODE_ESCAPE`)):n=l;break;case`INSIDE_STRING_UNICODE_ESCAPE`:a(u)&&(i++,i===4&&(t.pop(),n=l));break;case`INSIDE_NUMBER`:switch(u){case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:case`8`:case`9`:n=l;break;case`e`:case`E`:case`-`:case`.`:break;case`,`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`}`:t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`&&s(u,l);break;case`]`:t.pop(),t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l);break;default:t.pop()}break;case`INSIDE_LITERAL`:{let i=e.substring(r,l+1);!`false`.startsWith(i)&&!`true`.startsWith(i)&&!`null`.startsWith(i)?(t.pop(),t[t.length-1]===`INSIDE_OBJECT_AFTER_VALUE`?s(u,l):t[t.length-1]===`INSIDE_ARRAY_AFTER_VALUE`&&c(u,l)):n=l;break}}}let l=e.slice(0,n+1);for(let n=t.length-1;n>=0;n--)switch(t[n]){case`INSIDE_STRING`:l+=`"`;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`:l+=`}`;break;case`INSIDE_ARRAY_START`:case`INSIDE_ARRAY_AFTER_COMMA`:case`INSIDE_ARRAY_AFTER_VALUE`:l+=`]`;break;case`INSIDE_LITERAL`:{let t=e.substring(r,e.length);`true`.startsWith(t)?l+=`true`.slice(t.length):`false`.startsWith(t)?l+=`false`.slice(t.length):`null`.startsWith(t)&&(l+=`null`.slice(t.length))}}return l}async function ip(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await hf({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await hf({text:rp(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}function ap(e,t){if(e===t)return!0;if(e==null||t==null)return!1;if(typeof e!=`object`&&typeof t!=`object`)return e===t;if(e.constructor!==t.constructor)return!1;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!ap(e[n],t[n]))return!1;return!0}let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||!ap(e[i],t[i]))return!1;return!0}new TextEncoder,new TextEncoder,Gu({prefix:`aitxt`,size:24}),Gu({prefix:`call`,size:24}),TransformStream;var op=B.object({source:B.discriminatedUnion(`sourceType`,[B.object({type:B.literal(`source`),sourceType:B.literal(`url`),id:B.string(),url:B.string(),title:B.string().optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`source`),sourceType:B.literal(`document`),id:B.string(),mediaType:B.string(),title:B.string(),filename:B.string().optional(),providerMetadata:V.optional()})]),startIndex:B.number().int().nonnegative().optional(),endIndex:B.number().int().nonnegative().optional(),citedText:B.string().optional()}),sp=B.record(B.string(),If.optional()),cp=nf(()=>ff(B.union([B.looseObject({type:B.literal(`text-start`),id:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`text-delta`),id:B.string(),delta:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`text-end`),id:B.string(),citations:B.array(op).optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`error`),errorText:B.string()}),B.looseObject({type:B.literal(`tool-input-start`),toolCallId:B.string(),toolName:B.string(),inputEncoding:B.enum([`json`,`text`]).optional(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),title:B.string().optional()}),B.looseObject({type:B.literal(`tool-input-delta`),toolCallId:B.string(),inputTextDelta:B.string()}),B.looseObject({type:B.literal(`tool-input-available`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),title:B.string().optional()}),B.looseObject({type:B.literal(`tool-input-error`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),errorText:B.string(),title:B.string().optional()}),B.looseObject({type:B.literal(`tool-approval-request`),approvalId:B.string(),toolCallId:B.string(),approvalDescriptor:B.unknown().optional(),inputSchemaInput:B.unknown().optional(),reason:B.string().optional(),isAutomatic:B.boolean().optional(),signature:B.string().optional()}),B.looseObject({type:B.literal(`tool-approval-response`),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`tool-output-available`),toolCallId:B.string(),output:B.unknown(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional(),preliminary:B.boolean().optional()}),B.looseObject({type:B.literal(`tool-output-error`),toolCallId:B.string(),errorText:B.string(),providerExecuted:B.boolean().optional(),providerMetadata:V.optional(),toolMetadata:sp.optional(),dynamic:B.boolean().optional()}),B.looseObject({type:B.literal(`tool-output-denied`),toolCallId:B.string()}),B.looseObject({type:B.literal(`reasoning-start`),id:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`reasoning-delta`),id:B.string(),delta:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`reasoning-end`),id:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`custom`),kind:B.string().transform(e=>e),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`source-url`),sourceId:B.string(),url:B.string(),title:B.string().optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`source-document`),sourceId:B.string(),mediaType:B.string(),title:B.string(),filename:B.string().optional(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`file`),url:B.string(),mediaType:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`reasoning-file`),url:B.string(),mediaType:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.custom(e=>typeof e==`string`&&e.startsWith(`data-`),{message:`Type must start with "data-"`}),id:B.string().optional(),data:B.unknown(),transient:B.boolean().optional()}),B.looseObject({type:B.literal(`start-step`)}),B.looseObject({type:B.literal(`finish-step`)}),B.looseObject({type:B.literal(`reset-step`)}),B.looseObject({type:B.literal(`start`),messageId:B.string().optional(),messageMetadata:B.unknown().optional()}),B.looseObject({type:B.literal(`finish`),finishReason:B.enum([`stop`,`length`,`content-filter`,`tool-calls`,`error`,`interrupted`,`other`]).optional(),messageMetadata:B.unknown().optional()}),B.looseObject({type:B.literal(`abort`),reason:B.string().optional()}),B.looseObject({type:B.literal(`message-metadata`),messageMetadata:B.unknown()})])));function lp(e){return e.type.startsWith(`data-`)}function up(){return Object.create(null)}function dp(e){return e.type===`text`}function fp(e){return e.type===`reasoning`}function pp(e){return e.type.startsWith(`tool-`)}function mp(e){return e.type===`dynamic-tool`}function hp(e){return pp(e)||mp(e)}function gp(e){return e.type.split(`-`).slice(1).join(`-`)}function _p(e){return mp(e)?e.toolName:gp(e)}function vp({lastMessage:e,messageId:t}){let n=e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},r=up(),i=n.parts.findLastIndex(e=>e.type===`step-start`),a=0;for(let e of n.parts.slice(i+1)){if(!hp(e))continue;let t=a;pp(e)&&a++,e.state===`input-streaming`&&(r[e.toolCallId]={text:e.rawInput??``,inputEncoding:e.inputEncoding,index:t,toolName:e.type===`dynamic-tool`?e.toolName:gp(e),dynamic:e.type===`dynamic-tool`,title:e.title,toolMetadata:e.toolMetadata})}return{message:n,activeTextParts:up(),activeReasoningParts:up(),partialToolCalls:r}}function yp({stream:e,messageMetadataSchema:t,dataPartSchemas:n,runUpdateMessageJob:r,onError:i,onToolCall:a,onData:o,resetStateOnMessageIdChange:s=!1,resetStateOnFirstMessageStart:c=!1}){let l=!0;return e.pipeThrough(new TransformStream({async transform(e,u){await r(async({state:r,write:d})=>{function f(){let e=r.message.parts,t=e.length-1;for(;t>=0&&e[t].type!==`step-start`;)t--;return e.slice(t+1)}function p(){return f().filter(hp)}function m(e){let t=p().find(t=>t.toolCallId===e);if(t==null){let n=r.message.parts;for(let r=n.length-1;r>=0;r--){let i=n[r];if(hp(i)&&i.toolCallId===e){t=i;break}}}if(t==null)throw new Tf({chunkType:`tool-invocation`,chunkId:e,message:`No tool invocation found for tool call ID "${e}".`});return t}function h(e){let t=r.message.parts.filter(hp).find(t=>t.approval?.id===e);if(t==null)throw new Tf({chunkType:`tool-approval-response`,chunkId:e,message:`No tool invocation found for approval ID "${e}".`});return t}function g(e,t){let n=t??f().find(t=>pp(t)&&t.toolCallId===e.toolCallId),i=e,a=n;if(n!=null){n.state=e.state,a.type=`tool-${e.toolName}`,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,i.inputEncoding==null?delete a.inputEncoding:a.inputEncoding=i.inputEncoding,a.preliminary=i.preliminary,e.title!==void 0&&(a.title=e.title),e.toolMetadata!==void 0&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=i.providerExecuted??n.providerExecuted;let t=i.providerMetadata;if(t!=null)if(e.state===`output-available`||e.state===`output-error`){let e=n;e.resultProviderMetadata=t}else n.callProviderMetadata=t}else r.message.parts.push({type:`tool-${e.toolName}`,toolCallId:e.toolCallId,state:e.state,title:e.title,...e.toolMetadata===void 0?{}:{toolMetadata:e.toolMetadata},input:i.input,...i.inputEncoding==null?{}:{inputEncoding:i.inputEncoding},output:i.output,rawInput:i.rawInput,errorText:i.errorText,providerExecuted:i.providerExecuted,preliminary:i.preliminary,...i.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:i.providerMetadata}:{},...i.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:i.providerMetadata}:{}})}function _(e,t){let n=t??f().find(t=>t.type===`dynamic-tool`&&t.toolCallId===e.toolCallId),i=e,a=n;if(n!=null){n.state=e.state,a.toolName=e.toolName,a.input=i.input,a.output=i.output,a.errorText=i.errorText,a.rawInput=i.rawInput,i.inputEncoding==null?delete a.inputEncoding:a.inputEncoding=i.inputEncoding,a.preliminary=i.preliminary,e.title!==void 0&&(a.title=e.title),e.toolMetadata!==void 0&&(a.toolMetadata=e.toolMetadata),a.providerExecuted=i.providerExecuted??n.providerExecuted;let t=i.providerMetadata;if(t!=null)if(e.state===`output-available`||e.state===`output-error`){let e=n;e.resultProviderMetadata=t}else n.callProviderMetadata=t}else r.message.parts.push({type:`dynamic-tool`,toolName:e.toolName,toolCallId:e.toolCallId,state:e.state,input:i.input,...i.inputEncoding==null?{}:{inputEncoding:i.inputEncoding},output:i.output,errorText:i.errorText,preliminary:i.preliminary,providerExecuted:i.providerExecuted,title:e.title,...e.toolMetadata===void 0?{}:{toolMetadata:e.toolMetadata},...i.providerMetadata!=null&&(e.state===`output-available`||e.state===`output-error`)?{resultProviderMetadata:i.providerMetadata}:{},...i.providerMetadata!=null&&!(e.state===`output-available`||e.state===`output-error`)?{callProviderMetadata:i.providerMetadata}:{}})}async function v(e){if(e!=null){let n=r.message.metadata==null?e:Ff(r.message.metadata,e);t!=null&&await pf({value:n,schema:t,context:{field:`message.metadata`,entityId:r.message.id}}),r.message.metadata=n}}switch(e.type){case`text-start`:{let t={type:`text`,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeTextParts[e.id]=t,r.message.parts.push(t),d();break}case`text-delta`:{let t=r.activeTextParts[e.id];if(t==null)throw new Tf({chunkType:`text-delta`,chunkId:e.id,message:`Received text-delta for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,d();break}case`text-end`:{let t=r.activeTextParts[e.id];if(t==null)throw new Tf({chunkType:`text-end`,chunkId:e.id,message:`Received text-end for missing text part with ID "${e.id}". Ensure a "text-start" chunk is sent before any "text-end" chunks.`});t.state=`done`,e.citations!=null&&(t.citations=e.citations),t.providerMetadata=e.providerMetadata??t.providerMetadata,delete r.activeTextParts[e.id],d();break}case`custom`:{let t={type:`custom`,kind:e.kind,providerMetadata:e.providerMetadata};r.message.parts.push(t),d();break}case`reasoning-start`:{let t={type:`reasoning`,id:e.id,text:``,providerMetadata:e.providerMetadata,state:`streaming`};r.activeReasoningParts[e.id]=t,r.message.parts.push(t),d();break}case`reasoning-delta`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new Tf({chunkType:`reasoning-delta`,chunkId:e.id,message:`Received reasoning-delta for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-delta" chunks.`});t.text+=e.delta,t.providerMetadata=e.providerMetadata??t.providerMetadata,d();break}case`reasoning-end`:{let t=r.activeReasoningParts[e.id];if(t==null)throw new Tf({chunkType:`reasoning-end`,chunkId:e.id,message:`Received reasoning-end for missing reasoning part with ID "${e.id}". Ensure a "reasoning-start" chunk is sent before any "reasoning-end" chunks.`});t.providerMetadata=e.providerMetadata??t.providerMetadata,t.state=`done`,delete r.activeReasoningParts[e.id],d();break}case`file`:case`reasoning-file`:r.message.parts.push({type:e.type,mediaType:e.mediaType,url:e.url,...e.providerMetadata==null?{}:{providerMetadata:e.providerMetadata}}),d();break;case`source-url`:r.message.parts.push({type:`source-url`,sourceId:e.sourceId,url:e.url,title:e.title,providerMetadata:e.providerMetadata}),d();break;case`source-document`:r.message.parts.push({type:`source-document`,sourceId:e.sourceId,mediaType:e.mediaType,title:e.title,filename:e.filename,providerMetadata:e.providerMetadata}),d();break;case`tool-input-start`:{let t=f().filter(pp);r.partialToolCalls[e.toolCallId]={text:``,inputEncoding:e.inputEncoding,toolName:e.toolName,index:t.length,dynamic:e.dynamic,title:e.title,toolMetadata:e.toolMetadata},e.dynamic?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-streaming`,inputEncoding:e.inputEncoding,input:void 0,providerExecuted:e.providerExecuted,title:e.title,toolMetadata:e.toolMetadata,providerMetadata:e.providerMetadata}),d();break}case`tool-input-delta`:{let t=r.partialToolCalls[e.toolCallId];if(t==null)throw new Tf({chunkType:`tool-input-delta`,chunkId:e.toolCallId,message:`Received tool-input-delta for missing tool call with ID "${e.toolCallId}". Ensure a "tool-input-start" chunk is sent before any "tool-input-delta" chunks.`});t.text+=e.inputTextDelta;let n=t.inputEncoding===`text`?t.text:(await ip(t.text)).value;t.dynamic?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}):g({toolCallId:e.toolCallId,toolName:t.toolName,state:`input-streaming`,inputEncoding:t.inputEncoding,input:n,rawInput:t.text,title:t.title,toolMetadata:t.toolMetadata}),d();break}case`tool-input-available`:e.dynamic?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`input-available`,input:e.input,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:e.title,toolMetadata:e.toolMetadata}),d(),a&&!e.providerExecuted&&await a({toolCall:e});break;case`tool-input-error`:{let t=f().filter(hp).find(t=>t.toolCallId===e.toolCallId);(t==null?e.dynamic:t.type===`dynamic-tool`)?_({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}):g({toolCallId:e.toolCallId,toolName:e.toolName,state:`output-error`,input:e.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,toolMetadata:e.toolMetadata}),d();break}case`tool-approval-request`:{let t=m(e.toolCallId);t.state=`approval-requested`,t.approval={id:e.approvalId,...e.approvalDescriptor==null?{}:{descriptor:e.approvalDescriptor},...Object.prototype.hasOwnProperty.call(e,`inputSchemaInput`)?{inputSchemaInput:e.inputSchemaInput}:{},...e.reason==null?{}:{requestReason:e.reason},...e.isAutomatic===!0?{isAutomatic:!0}:{},...e.signature==null?{}:{signature:e.signature}},d();break}case`tool-approval-response`:{let t=h(e.approvalId),n=t.approval==null?{id:e.approvalId}:t.approval;t.state=`approval-responded`,t.approval={...n,id:e.approvalId,approved:e.approved,...e.reason==null?{}:{reason:e.reason}},e.providerExecuted!=null&&(t.providerExecuted=e.providerExecuted),e.providerMetadata!=null&&(t.callProviderMetadata=e.providerMetadata),d();break}case`tool-output-denied`:{let t=m(e.toolCallId);t.state=`output-denied`,d();break}case`tool-output-available`:{let t=m(e.toolCallId);t.type===`dynamic-tool`?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-available`,input:t.input,output:e.output,preliminary:e.preliminary,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):g({toolCallId:e.toolCallId,toolName:gp(t),state:`output-available`,input:t.input,output:e.output,providerExecuted:e.providerExecuted,preliminary:e.preliminary,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),d();break}case`tool-output-error`:{let t=m(e.toolCallId);t.type===`dynamic-tool`?_({toolCallId:e.toolCallId,toolName:t.toolName,state:`output-error`,input:t.input,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t):g({toolCallId:e.toolCallId,toolName:gp(t),state:`output-error`,input:t.input,rawInput:t.rawInput,errorText:e.errorText,providerExecuted:e.providerExecuted,providerMetadata:e.providerMetadata,title:t.title,toolMetadata:e.toolMetadata??t.toolMetadata},t),d();break}case`start-step`:r.message.parts.push({type:`step-start`});break;case`finish-step`:break;case`reset-step`:{let e=f();r.activeTextParts=up(),r.activeReasoningParts=up(),r.partialToolCalls=up(),e.length>0&&(r.message.parts.splice(r.message.parts.length-e.length,e.length),d());break}case`start`:{let t=c&&l||s&&e.messageId!=null&&e.messageId!==r.message.id;l=!1,t&&Object.assign(r,vp({lastMessage:void 0,messageId:e.messageId??r.message.id}),{finishReason:void 0}),e.messageId!=null&&(r.message.id=e.messageId),await v(e.messageMetadata),(t||e.messageId!=null||e.messageMetadata!=null)&&d({updateStatus:!1});break}case`finish`:e.finishReason!=null&&(r.finishReason=e.finishReason),await v(e.messageMetadata),e.messageMetadata!=null&&d();break;case`message-metadata`:await v(e.messageMetadata),e.messageMetadata!=null&&d();break;case`error`:i?.(Error(e.errorText));break;default:if(lp(e)){if(n?.[e.type]!=null){let t=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=t>=0?t:r.message.parts.length;await pf({value:e.data,schema:n[e.type],context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let t=e;if(t.transient){o?.(t);break}let i=t.id==null?void 0:r.message.parts.find(e=>t.type===e.type&&t.id===e.id);i==null?r.message.parts.push(t):i.data=t.data,o?.(t),d()}}u.enqueue(e)})}}))}async function bp({stream:e,onError:t,abortSignal:n}){let r=e.getReader(),i=()=>{r.cancel().catch(()=>{})};n?.aborted?i():n?.addEventListener(`abort`,i,{once:!0});try{for(;;){let{done:e}=await r.read();if(e)break}}catch(e){t?.(e)}finally{n?.removeEventListener(`abort`,i),r.releaseLock()}}function xp(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}Gu({prefix:`aitxt`,size:24}),Gu({prefix:`call`,size:24}),Gu({prefix:`aitxt`,size:24}),Gu({prefix:`call`,size:24});function Sp(e){return e.dynamic=!1,e}var Cp={type:`deprecated`,setting:`rawInput in output-error UI message parts`,message:`Use the "input" field instead. The "rawInput" field will be removed in the next major version.`};function wp(e){e.some(e=>e.parts.some(e=>typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`&&(e.type===`dynamic-tool`||e.type.startsWith(`tool-`))&&`state`in e&&e.state===`output-error`&&Object.prototype.hasOwnProperty.call(e,`rawInput`)&&`rawInput`in e&&e.rawInput!==void 0))&&Pf({warnings:[Cp]})}var Tp=B.record(B.string(),If.optional()),Ep=B.record(B.string(),B.string());function Dp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===0}function Op(e){let{type:t,...n}=e;return Sp({...n,type:`dynamic-tool`,toolName:t.slice(5)})}function kp(e){return e.approval!=null&&Object.prototype.hasOwnProperty.call(e.approval,`inputSchemaInput`)?{value:e.approval.inputSchemaInput}:void 0}var Ap=nf(()=>{let e=B.object({id:B.string(),approved:B.never().optional(),descriptor:B.unknown().optional(),requestReason:B.string().optional(),reason:B.never().optional(),isAutomatic:B.boolean().optional(),signature:B.string().optional(),inputSchemaInput:B.unknown().optional()}),t=e.extend({approved:B.boolean(),reason:B.string().optional()}),n=t.extend({approved:B.literal(!0)}),r=t.extend({approved:B.literal(!1)});return ff(B.array(B.object({id:B.string(),role:B.enum([`system`,`user`,`assistant`]),metadata:B.unknown().optional(),parts:B.array(B.union([B.object({type:B.literal(`text`),text:B.string(),citations:B.array(op).optional(),state:B.enum([`streaming`,`done`]).optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`reasoning`),id:B.string().optional(),text:B.string(),state:B.enum([`streaming`,`done`]).optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`custom`),kind:B.string(),providerMetadata:V.optional()}),B.object({type:B.literal(`source-url`),sourceId:B.string(),url:B.string(),title:B.string().optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`source-document`),sourceId:B.string(),mediaType:B.string(),title:B.string(),filename:B.string().optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`file`),mediaType:B.string(),filename:B.string().optional(),url:B.string(),providerReference:Ep.optional(),providerMetadata:V.optional()}),B.object({type:B.literal(`reasoning-file`),mediaType:B.string(),url:B.string(),providerMetadata:V.optional()}),B.object({type:B.literal(`step-start`)}),B.object({type:B.string().startsWith(`data-`),id:B.string().optional(),data:B.unknown()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-streaming`),input:B.unknown().optional(),rawInput:B.string().optional(),inputEncoding:B.enum([`json`,`text`]).optional(),providerExecuted:B.boolean().optional(),callProviderMetadata:V.optional(),output:B.never().optional(),errorText:B.never().optional(),approval:B.never().optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-available`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:B.never().optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-requested`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:e}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-responded`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:t}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-available`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.unknown(),errorText:B.never().optional(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),preliminary:B.boolean().optional(),approval:n.optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-error`),input:B.unknown().optional(),rawInput:B.unknown().optional(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.string(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),approval:n.optional()}),B.object({type:B.literal(`dynamic-tool`),dynamic:B.literal(!1).optional(),toolName:B.string(),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-denied`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:r}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-streaming`),providerExecuted:B.boolean().optional(),callProviderMetadata:V.optional(),input:B.unknown().optional(),rawInput:B.string().optional(),inputEncoding:B.enum([`json`,`text`]).optional(),output:B.never().optional(),errorText:B.never().optional(),approval:B.never().optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`input-available`),providerExecuted:B.boolean().optional(),input:B.unknown(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:B.never().optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-requested`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:e}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`approval-responded`),input:B.unknown(),providerExecuted:B.boolean().optional(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:t}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-available`),providerExecuted:B.boolean().optional(),input:B.unknown(),output:B.unknown(),errorText:B.never().optional(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),preliminary:B.boolean().optional(),approval:n.optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-error`),providerExecuted:B.boolean().optional(),input:B.unknown().optional(),rawInput:B.unknown().optional(),output:B.never().optional(),errorText:B.string(),callProviderMetadata:V.optional(),resultProviderMetadata:V.optional(),approval:n.optional()}),B.object({type:B.string().startsWith(`tool-`),toolCallId:B.string(),title:B.string().optional(),toolMetadata:Tp.optional(),state:B.literal(`output-denied`),providerExecuted:B.boolean().optional(),input:B.unknown(),output:B.never().optional(),errorText:B.never().optional(),callProviderMetadata:V.optional(),approval:r})]))}).superRefine((e,t)=>{e.role!==`assistant`&&e.parts.length===0&&t.addIssue({origin:`array`,code:`too_small`,minimum:1,inclusive:!0,input:e.parts,path:[`parts`],message:`Message must contain at least one part`})})).nonempty(`Messages array must not be empty`))});async function jp({messages:e,metadataSchema:t,dataSchemas:n,tools:r,experimental_refineToolInput:i},{convertMissingTerminalToolsToDynamic:a}){try{if(e==null)return{success:!1,error:new xf({parameter:`messages`,value:e,message:`messages parameter must be provided`})};let o=await pf({value:e,schema:Ap});if(wp(o),t)for(let[e,n]of o.entries())n.metadata=await pf({value:n.metadata,schema:t,context:{field:`messages[${e}].metadata`,entityId:n.id}});let s=r!=null||a;if(n||s)for(let[e,t]of o.entries())for(let[o,c]of t.parts.entries()){if(n&&c.type.startsWith(`data-`)){let t=c,r=t.type.slice(5),i=n[r];if(!i)return{success:!1,error:new Tu({value:t.data,cause:`No data schema found for data part ${r}`,context:{field:`messages[${e}].parts[${o}].data`,entityName:r,entityId:t.id}})};t.data=await pf({value:t.data,schema:i,context:{field:`messages[${e}].parts[${o}].data`,entityName:r,entityId:t.id}})}if(s&&c.type.startsWith(`tool-`)){let n=c,s=n.type.slice(5),l=r==null?void 0:np(r,s),u=n.state===`output-available`||n.state===`output-error`||n.state===`output-denied`;if(!l&&u){(r!=null||a)&&(t.parts[o]=Op(n));continue}if(!l)return{success:!1,error:new Tu({value:n.input,cause:`No tool schema found for tool part ${s}`,context:{field:`messages[${e}].parts[${o}].input`,entityName:s,entityId:n.toolCallId}})};let d={field:`messages[${e}].parts[${o}].input`,entityName:s,entityId:n.toolCallId},f=kp(n),p=f==null?n.input:f.value,m=!1;if(n.state!==`input-streaming`&&(n.state!==`output-error`||f!=null||n.input!==void 0)){let e=await mf({value:p,schema:l.inputSchema,context:d}),t;if(!e.success)t=e.error;else if(f!=null)try{let r=np(i,s);ap(r==null?e.value:await r(e.value),n.input)||(t=new Tu({value:n.input,cause:`Tool input does not match the output reconstructed from inputSchemaInput.`,context:d}))}catch(e){t=new Tu({value:p,cause:e,context:d})}if(t!=null)if(n.state===`output-error`||n.state===`output-available`&&Dp(n.input))m=!0;else throw t}n.state===`output-available`&&l.outputSchema&&await pf({value:n.output,schema:l.outputSchema,context:{field:`messages[${e}].parts[${o}].output`,entityName:s,entityId:n.toolCallId}}),m&&(t.parts[o]=Op(n))}}return{success:!0,data:o}}catch(e){return{success:!1,error:e}}}async function Mp(e){return jp(e,{convertMissingTerminalToolsToDynamic:!1})}async function Np(e){let t=await Mp(e);if(!t.success)throw t.error;return t.data}Gu({prefix:`call`,size:24}),Gu({prefix:`call`,size:24}),new TextEncoder,Gu({prefix:`call`,size:24}),Gu({prefix:`aiobj`,size:24});var{atob:Pp}=globalThis,Fp=class{constructor(){this.queue=[],this.isProcessing=!1,this.idleWaiters=[]}async processQueue(){if(!this.isProcessing){this.isProcessing=!0;try{for(;this.queue.length>0;)await this.queue[0](),this.queue.shift()}finally{this.isProcessing=!1;for(let e of this.idleWaiters.splice(0))e()}}}async run(e){return new Promise((t,n)=>{this.queue.push(async()=>{try{await e(),t()}catch(e){n(e)}}),this.processQueue()})}async waitForIdle(){!this.isProcessing&&this.queue.length===0||await new Promise(e=>{this.idleWaiters.push(e)})}};Gu({prefix:`aiobj`,size:24}),Gu({prefix:`call`,size:24}),B.object({token:B.string().refine(e=>e.trim().length>0),url:B.string().refine(e=>{try{let t=new URL(e);return(t.protocol===`ws:`||t.protocol===`wss:`)&&t.hostname!==``}catch{return!1}}),expiresAt:B.number().positive().max(2**53-1).optional(),tools:B.array(B.object({type:B.literal(`function`),name:B.string().min(1),description:B.string().optional(),parameters:B.record(B.string(),B.unknown())})).optional()}),Gu({prefix:`call`,size:24}),Gu({prefix:`call`,size:24}),Gu({prefix:`call`,size:24});async function Ip({response:e,url:t,fallbackMessage:n}){let r=await e.text();return new cu({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function Lp(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new ku({functionality:`FileList`,message:`FileList is not supported in the current environment`});return Promise.all(Array.from(e).map(async e=>{let{name:t,type:n}=e;return{type:`file`,mediaType:n,filename:t,url:await new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{t(e.target?.result)},r.onerror=e=>n(e),r.readAsDataURL(e)})}}))}function Rp(e,t){let n=e.search(/[?#]/),r=n===-1?e:e.slice(0,n),i=n===-1?``:e.slice(n);return`${r.endsWith(`/`)&&t.startsWith(`/`)?r.slice(0,-1):r}${t}${i}`}var zp=class{constructor({api:e=`/api/chat`,credentials:t,headers:n,body:r,fetch:i,prepareSendMessagesRequest:a,prepareReconnectToStreamRequest:o}){this.api=e,this.credentials=t,this.headers=n,this.body=r,this.fetch=i,this.prepareSendMessagesRequest=a,this.prepareReconnectToStreamRequest=o}async sendMessages({abortSignal:e,...t}){let n=await _f(this.body),r=await _f(this.headers),i=await _f(this.credentials),a={...Vu(r),...Vu(t.headers)},o=await this.prepareSendMessagesRequest?.({api:this.api,id:t.chatId,messages:t.messages,body:{...n,...t.body},headers:a,credentials:i,requestMetadata:t.metadata,trigger:t.trigger,messageId:t.messageId}),s=o?.api??this.api,c=o?.headers===void 0?a:Vu(o.headers),l=o?.body===void 0?{...n,...t.body,id:t.chatId,messages:t.messages,trigger:t.trigger,messageId:t.messageId}:o.body,u=o?.credentials??i,d=await(this.fetch??globalThis.fetch)(s,{method:`POST`,headers:{"content-type":`application/json`,...c},body:JSON.stringify(l),credentials:u,signal:e});if(!d.ok)throw await Ip({response:d,url:s,fallbackMessage:`Failed to fetch the chat response.`});if(!d.body)throw new fu({message:`The response body is empty.`});return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await _f(this.body),n=await _f(this.headers),r=await _f(this.credentials),i={...Vu(n),...Vu(e.headers)},a=await this.prepareReconnectToStreamRequest?.({api:this.api,id:e.chatId,body:{...t,...e.body},headers:i,credentials:r,requestMetadata:e.metadata}),o=a?.api;if(o==null){if(e.chatId===`.`||e.chatId===`..`)throw new xf({parameter:`chatId`,value:e.chatId,message:`Chat IDs must not be "." or ".." when using the default reconnect URL.`});o=Rp(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}let s=a?.headers===void 0?i:Vu(a.headers),c=a?.credentials??r,l=await(this.fetch??globalThis.fetch)(o,{method:`GET`,headers:s,credentials:c,signal:e.abortSignal});if(l.status===204)return null;if(!l.ok)throw await Ip({response:l,url:o,fallbackMessage:`Failed to fetch the chat response.`});if(!l.body)throw new fu({message:`The response body is empty.`});return this.processResponseStream(l.body)}},Bp=class extends zp{constructor({resumeStreamIsReplay:e=!0,...t}={}){super(t),this.resumeStreamIsReplay=e}processResponseStream(e){return gf({stream:e,schema:cp}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Vp=class{get id(){return this._id??=this.generateId()}constructor({generateId:e=Ku,id:t,transport:n=new Bp,messageMetadataSchema:r,dataPartSchemas:i,state:a,onError:o,onToolCall:s,onFinish:c,onData:l,sendAutomaticallyWhen:u}){this.pendingMessagePreparations=new Set,this.interruptedMessageIds=new Set,this.activeResponse=void 0,this.activeResumeRequest=void 0,this.resumableStreamState=void 0,this.jobExecutor=new Fp,this.activeStopCount=0,this.stopGeneration=0,this.sendMessage=async(e,t)=>{if(e==null){let e=this.pendingApprovalMessageId;if(e==null){e=this.lastMessage?.id;for(let t=this.state.messages.length-1;t>=0;t--){let n=this.state.messages[t];if(n.role===`assistant`&&n.parts.some(e=>hp(e)&&e.state===`approval-responded`)){e=n.id;break}}}let n=e!=null&&e===this.pendingApprovalMessageId?this.state.messages.findIndex(t=>t.id===e):-1;await this.makeRequestForToolApproval({messageId:e,messageIndex:n,...t});return}let n;if(`text`in e||`files`in e){let t=new AbortController;this.pendingMessagePreparations.add(t);let r;try{r=Array.isArray(e.files)?e.files:await Lp(e.files)}finally{this.pendingMessagePreparations.delete(t)}if(t.signal.aborted)return;n={parts:[...r,...`text`in e&&e.text!=null?[{type:`text`,text:e.text}]:[]]}}else n=e;if(e.messageId!=null){let t=this.state.messages.findIndex(t=>t.id===e.messageId);if(t===-1)throw new xf({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} not found`});if(this.state.messages[t].role!==`user`)throw new xf({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} is not a user message`});this.state.messages=this.state.messages.slice(0,t+1),this.state.replaceMessage(t,{id:e.messageId,...n,role:n.role??`user`,metadata:e.metadata})}else this.state.pushMessage({...n,id:n.id??this.generateId(),role:n.role??`user`,metadata:e.metadata});await this.makeRequest({trigger:`submit-message`,messageId:e.messageId,...t})},this.regenerate=async({messageId:e,...t}={})=>{let n=e==null?this.state.messages.length-1:this.state.messages.findIndex(t=>t.id===e);if(n===-1)throw new xf({parameter:`messageId`,value:e,message:`message ${e} not found`});this.state.messages=this.state.messages.slice(0,this.messages[n].role===`assistant`?n:n+1),await this.makeRequest({trigger:`regenerate-message`,messageId:e,...t})},this.resumeStream=async(e={})=>{await this.makeRequest({trigger:`resume-stream`,...e})},this[`~resumeStreamIfDisconnected`]=async({shouldResume:e=()=>!0}={})=>{let t=this.activeResponse;this.resumableStreamState==null&&t!=null&&(await t.completionPromise,this.resumableStreamState!==t.state)||this.resumableStreamState!=null&&e()&&await this.resumeStream()},this.clearError=()=>{this.status===`error`&&(this.state.error=void 0,this.setStatus({status:`ready`}))},this.addToolApprovalResponse=async({id:e,approved:t,reason:n,options:r})=>this.jobExecutor.run(async()=>{let i=this.state.messages,a=r=>hp(r)&&r.state===`approval-requested`&&r.approval.id===e?{...r,state:`approval-responded`,approval:{...r.approval,id:e,approved:t,reason:n}}:r,o=i.findIndex(t=>t.parts.some(t=>hp(t)&&t.state===`approval-requested`&&t.approval.id===e));if(o!==-1){let e=i[o];this.state.replaceMessage(o,{...e,parts:e.parts.map(a)}),this.pendingApprovalMessageId=e.id}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(a)),o!==-1&&this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen){let e=await this.shouldSendAutomatically(i[o].id);e&&this.runAutomaticRequest(()=>{let e=o===-1?this.lastMessage?.id:i[o].id;return this.makeRequestForToolApproval({messageId:e,messageIndex:o,...r})},e)}}),this.addToolOutput=async({state:e,toolCallId:t,output:n,errorText:r,options:i})=>this.jobExecutor.run(async()=>{let a=this.state.messages,o=i=>{if(!hp(i)||i.toolCallId!==t)return i;let{approval:a,...o}=i,s=a?.approved===!0?{approval:{...a,approved:a.approved}}:{};return e===`output-error`?{...o,...s,state:e,input:i.input,output:void 0,errorText:r}:{...o,...s,state:`output-available`,input:i.input,output:n,errorText:void 0}},s=a.findIndex(e=>e.parts.some(e=>hp(e)&&e.toolCallId===t));if(s!==-1){let e=a[s];this.state.replaceMessage(s,{...e,parts:e.parts.map(o)})}if(this.activeResponse&&(this.activeResponse.state.message.parts=this.activeResponse.state.message.parts.map(o)),s!==-1&&this.status!==`streaming`&&this.status!==`submitted`&&this.sendAutomaticallyWhen){let e=await this.shouldSendAutomatically(a[s].id);e&&this.runAutomaticRequest(()=>this.makeRequest({trigger:`submit-message`,messageId:a[s].id,...i}),e)}}),this.addToolResult=this.addToolOutput,this.stop=async()=>{this.activeStopCount++,this.stopGeneration++;try{let e=this.activeResumeRequest,t=this.activeResponse;for(let e of this.pendingMessagePreparations)e.abort();e?.abortController.abort(),t?.abortController.abort(),await Promise.all([e?.completionPromise,t?.completionPromise]),await this.jobExecutor.waitForIdle()}finally{this.activeStopCount--}},this.dispose=async()=>{await this.stop(),this.transport.close?.()},this._id=t,this.transport=n,this.generateId=e,this.messageMetadataSchema=r,this.dataPartSchemas=i,this.state=a,this.onError=o,this.onToolCall=s,this.onFinish=c,this.onData=l,this.sendAutomaticallyWhen=u}get status(){return this.state.status}setStatus({status:e,error:t}){if(this.status===e){this.error!==t&&(this.state.error=t);return}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(e=this.lastMessage?.id){let t=e=>e!=null&&this.interruptedMessageIds.has(e);return!this.sendAutomaticallyWhen||t(e)||t(this.lastMessage?.id)?!1:await this.sendAutomaticallyWhen({messages:this.state.messages})&&!t(e)&&!t(this.lastMessage?.id)}async runAutomaticRequest(e,t){let n=this.stopGeneration,r=this.activeStopCount>0;(t??await this.shouldSendAutomatically())&&(r||n!==this.stopGeneration||this.activeStopCount>0||await e())}async makeRequestForToolApproval({messageId:e,messageIndex:t,...n}){let r=e!=null&&e===this.pendingApprovalMessageId;r&&(this.pendingApprovalMessageId=void 0),await this.makeRequest({trigger:`submit-message`,messageId:e,...n}),r&&this.status===`error`&&this.pendingApprovalMessageId==null&&(this.pendingApprovalMessageId=this.state.messages[t]?.id??e)}async makeRequest(e){let t=xp();try{await this.makeRequestImpl({...e,completionPromise:t.promise})}finally{t.resolve()}}async makeRequestImpl({trigger:e,metadata:t,headers:n,body:r,messageId:i,completionPromise:a}){e!==`resume-stream`&&(this.resumableStreamState=void 0);let o=new AbortController,s=e===`resume-stream`?{abortController:o,completionPromise:a}:void 0;s&&(this.activeResumeRequest?.abortController.abort(),this.activeResumeRequest=s);let c=()=>s==null||this.activeResumeRequest===s,l=()=>{this.activeResumeRequest===s&&(this.activeResumeRequest=void 0)},u;if(e===`resume-stream`)try{let e=await this.transport.reconnectToStream({chatId:this.id,abortSignal:o.signal,metadata:t,headers:n,body:r});if(o.signal.aborted||!c()){await e?.cancel().catch(()=>{}),c()&&(this.setStatus({status:`ready`}),this.resumableStreamState=void 0),l();return}if(e==null){this.setStatus({status:`ready`}),this.resumableStreamState=void 0,l();return}u=e}catch(e){if(o.signal.aborted||e.name===`AbortError`){c()&&(this.setStatus({status:`ready`}),this.resumableStreamState=void 0),l();return}if(!c())return;this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e}),l();return}this.setStatus({status:`submitted`,error:void 0});let d=this.lastMessage,f=e===`submit-message`&&i!=null?this.state.messages.findIndex(e=>e.id===i):this.state.messages.length-1,p=f===-1?d:this.state.messages[f],m=p?.id,h=e===`resume-stream`&&p?.role===`assistant`&&p.parts.some(e=>hp(e)&&(e.state===`input-streaming`||e.state===`input-available`&&e.providerExecuted||e.state===`approval-responded`))?this.state.snapshot(p):void 0,g=f!==-1&&f<this.state.messages.length-1&&p?.role===`assistant`,_=!1,v=!1,y=!1,b;try{let s={state:e===`resume-stream`&&this.resumableStreamState!=null?this.resumableStreamState:vp({lastMessage:e===`resume-stream`?h:e===`regenerate-message`?void 0:this.state.snapshot(p),messageId:this.generateId()}),abortController:o,completionPromise:a};b=s,s.abortController.signal.addEventListener(`abort`,()=>{_=!0}),this.activeResponse=s;let l;if(l=e===`resume-stream`?u:await this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:s.abortController.signal,metadata:t,headers:n,body:r,trigger:e,messageId:i}),await bp({stream:yp({stream:l,resetStateOnMessageIdChange:e===`resume-stream`,resetStateOnFirstMessageStart:e===`resume-stream`&&this.transport.resumeStreamIsReplay,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:e=>this.jobExecutor.run(()=>s.abortController.signal.aborted?Promise.resolve():e({state:s.state,write:({updateStatus:e=!0}={})=>{if(s.abortController.signal.aborted)return;e&&this.setStatus({status:`streaming`});let t=this.state.messages.findLastIndex(e=>e.id===s.state.message.id);if(t!==-1)this.state.replaceMessage(t,s.state.message);else if(g){let e=this.state.messages.findLastIndex(e=>e.id===m);e===-1?this.state.pushMessage(s.state.message):this.state.replaceMessage(e,s.state.message)}else this.state.pushMessage(s.state.message)}})),onError:e=>{throw e}}),abortSignal:s.abortController.signal,onError:e=>{throw e}}),_)return c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===s.state&&(this.resumableStreamState=void 0)),null;c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===s.state&&(this.resumableStreamState=void 0))}catch(e){if(_||e.name===`AbortError`)return _=!0,c()&&(this.setStatus({status:`ready`}),this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0)),null;if(!c())return null;if(y=!0,e instanceof TypeError){let t=e.message.toLowerCase();v=t.includes(`fetch`)||t.includes(`network`)||t===`load failed`}v?this.resumableStreamState=b?.state:this.resumableStreamState===b?.state&&(this.resumableStreamState=void 0),this.onError&&e instanceof Error&&this.onError(e),this.setStatus({status:`error`,error:e})}finally{try{if(b){let{message:e,finishReason:t}=b.state;t===`interrupted`?this.interruptedMessageIds.add(e.id):!_&&!y&&this.interruptedMessageIds.delete(e.id),this.onFinish?.({message:b.state.message,messages:this.state.messages,isAbort:_,isDisconnect:v,isError:y,finishReason:b.state.finishReason})}}finally{this.activeResponse===b&&(this.activeResponse=void 0),l()}}!_&&!y&&b?.state.finishReason!==`interrupted`&&await this.runAutomaticRequest(()=>this.makeRequest({trigger:`submit-message`,messageId:this.lastMessage?.id,metadata:t,headers:n,body:r}))}};function Hp({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1).filter(hp);return r.filter(e=>e.state===`approval-responded`).length>0&&r.every(e=>e.state===`output-available`&&e.preliminary!==!0||e.state===`output-error`||e.state===`output-denied`||e.state===`approval-responded`)}function Up({messages:e}){let t=e[e.length-1];if(!t||t.role!==`assistant`)return!1;let n=t.parts.reduce((e,t,n)=>t.type===`step-start`?n:e,-1),r=t.parts.slice(n+1),i=r.filter(hp).filter(e=>!e.providerExecuted),a=r.reduce((e,t,n)=>hp(t)&&!t.providerExecuted?n:e,-1);return i.length>0&&!r.slice(a+1).some(e=>e.type===`text`&&e.state!==`done`)&&i.every(e=>e.state===`output-available`&&e.preliminary!==!0||e.state===`output-error`)}var Wp=a((t=>{var n=e().__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;t.c=function(e){return n.H.useMemoCache(e)}})),Gp=a(((e,t)=>{t.exports=Wp()})),Kp=a(((e,t)=>{function n(e,t){if(typeof e!=`function`)throw TypeError(`Expected the first argument to be a \`function\`, got \`${typeof e}\`.`);let n,r=0;return function(...i){clearTimeout(n);let a=Date.now(),o=t-(a-r);o<=0?(r=a,e.apply(this,i)):n=setTimeout(()=>{r=Date.now(),e.apply(this,i)},o)}}t.exports=n})),H=Gp(),qp=n(Kp(),1);function Jp(e,t){return t==null?e:(0,qp.default)(e,t)}function Yp(e){return Array.isArray(e)?[...e]:typeof e==`object`&&e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var Xp=class{#e;#t;#n;#r;#i;#a;constructor(e=[]){this.#t=`ready`,this.#n=void 0,this.#r=new Set,this.#i=new Set,this.#a=new Set,this.pushMessage=e=>{this.#e=this.#e.concat(e),this.#o()},this.popMessage=()=>{this.#e=this.#e.slice(0,-1),this.#o()},this.replaceMessage=(e,t)=>{this.#e=[...this.#e.slice(0,e),this.snapshot(t),...this.#e.slice(e+1)],this.#o()},this.snapshot=e=>{if(typeof e!=`object`||!e||!(`parts`in e)||!Array.isArray(e.parts))return e;let t=e,n={...t,parts:t.parts.map(e=>({...e}))};return`metadata`in t&&(n.metadata=Yp(t.metadata)),n},this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Jp(e,t):e;return this.#r.add(n),()=>{this.#r.delete(n)}},this[`~registerStatusCallback`]=e=>(this.#i.add(e),()=>{this.#i.delete(e)}),this[`~registerErrorCallback`]=e=>(this.#a.add(e),()=>{this.#a.delete(e)}),this.#o=()=>{this.#r.forEach(e=>e())},this.#s=()=>{this.#i.forEach(e=>e())},this.#c=()=>{this.#a.forEach(e=>e())},this.#e=e}get status(){return this.#t}set status(e){this.#t=e,this.#s()}get error(){return this.#n}set error(e){this.#n=e,this.#c()}get messages(){return this.#e}set messages(e){this.#e=[...e],this.#o()}#o;#s;#c},Zp=class extends Vp{#e;constructor({messages:e,...t}){let n=new Xp(e);super({...t,state:n}),this[`~registerMessagesCallback`]=(e,t)=>this.#e[`~registerMessagesCallback`](e,t),this[`~registerStatusCallback`]=e=>this.#e[`~registerStatusCallback`](e),this[`~registerErrorCallback`]=e=>this.#e[`~registerErrorCallback`](e),this.#e=n}},Qp=new WeakMap;function $p({chat:e,state:t}){if(document.visibilityState!==`visible`||t.pendingVisibilityResume!=null)return;let n=()=>Qp.get(e)===t&&t.registrations.size>0,r=()=>{t.pendingVisibilityResume=void 0};t.pendingVisibilityResume=e[`~resumeStreamIfDisconnected`]({shouldResume:()=>n()&&document.visibilityState===`visible`}).then(r,r)}function em({chat:e,registration:t}){let n=Qp.get(e);if(n==null){let t={registrations:new Set};if(Qp.set(e,t),n=t,typeof document<`u`){let n=()=>$p({chat:e,state:t});document.addEventListener(`visibilitychange`,n),t.cleanupVisibilityListener=()=>{document.removeEventListener(`visibilitychange`,n)}}}let{registrations:r}=n,i=r.size===0;return r.add(t),i&&e.status!==`submitted`&&e.status!==`streaming`&&e.resumeStream(),()=>{r.delete(t),r.size===0&&(n.cleanupVisibilityListener?.(),Qp.delete(e))}}function tm(e){return{chat:e,messages:e.messages,status:e.status,error:e.error}}function nm(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function rm({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){let i=e??t,a=(0,I.useRef)({}),o=(0,I.useRef)({});`chat`in r||(o.current={onToolCall:r.onToolCall,onData:r.onData,onFinish:r.onFinish,onError:r.onError,sendAutomaticallyWhen:r.sendAutomaticallyWhen,transport:r.transport});let s,c=()=>o.current.transport??(s??=new Bp),l={...r,transport:{get resumeStreamIsReplay(){return c().resumeStreamIsReplay},sendMessages:e=>c().sendMessages(e),reconnectToStream:e=>c().reconnectToStream(e)},onToolCall:e=>o.current.onToolCall?.(e),onData:e=>o.current.onData?.(e),onFinish:e=>o.current.onFinish?.(e),onError:e=>o.current.onError?.(e),sendAutomaticallyWhen:e=>o.current.sendAutomaticallyWhen?.(e)??!1},{chat:u,isExternallyManaged:d}=(0,I.useMemo)(()=>({chat:`chat`in r?r.chat:new Zp(l),isExternallyManaged:`chat`in r}),[`chat`in r?r.chat:r.id]);(0,I.useEffect)(()=>{if(!d)return()=>{u.stop()}},[u,d]);let[f,p]=(0,I.useState)(()=>tm(u));f.chat!==u&&p(tm(u)),(0,I.useEffect)(()=>{let e=!0,t=()=>{if(!e)return;let t=tm(u);p(e=>e.chat!==u||nm(e,t)?e:t)},n=[u[`~registerMessagesCallback`](t,i),u[`~registerStatusCallback`](t),u[`~registerErrorCallback`](t)],r=tm(u);return p(e=>nm(e,r)?e:r),()=>{e=!1,n.forEach(e=>e())}},[u,i]);let{messages:m,status:h,error:g}=f,_=(0,I.useCallback)(e=>{typeof e==`function`&&(e=e(u.messages)),u.messages=e},[u]);return(0,I.useEffect)(()=>{if(n)return em({chat:u,registration:a.current})},[n,u]),{get id(){return u.id},messages:m,setMessages:_,sendMessage:u.sendMessage,regenerate:u.regenerate,clearError:u.clearError,stop:u.stop,error:g,resumeStream:u.resumeStream,status:h,addToolResult:u.addToolOutput,addToolOutput:u.addToolOutput,addToolApprovalResponse:u.addToolApprovalResponse}}var im=(0,I.createContext)({});function am(e){let t=(0,I.useRef)(null);return t.current===null&&(t.current=e()),t.current}var om=typeof window<`u`?I.useLayoutEffect:I.useEffect,sm=(0,I.createContext)(null);function cm(e,t){e.indexOf(t)===-1&&e.push(t)}function lm(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var um=(e,t,n)=>n>t?t:n<e?e:n,dm={},fm=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),pm=e=>typeof e==`object`&&!!e,mm=e=>/^0[^.\s]+$/u.test(e);function hm(e){let t;return()=>(t===void 0&&(t=e()),t)}var gm=e=>e,_m=(...e)=>e.reduce((e,t)=>n=>t(e(n))),vm=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},ym=class{constructor(){this.subscriptions=[]}add(e){return cm(this.subscriptions,e),()=>lm(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},bm=e=>e*1e3,xm=e=>e/1e3,Sm=(e,t)=>t?1e3/t*e:0,Cm=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,wm=1e-7,Tm=12;function Em(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Cm(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>wm&&++s<Tm);return o}function Dm(e,t,n,r){if(e===t&&n===r)return gm;let i=t=>Em(t,0,1,e,n);return e=>e===0||e===1?e:Cm(i(e),t,r)}var Om=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,km=e=>t=>1-e(1-t),Am=Dm(.33,1.53,.69,.99),jm=km(Am),Mm=Om(jm),Nm=e=>e>=1?1:(e*=2)<1?.5*jm(e):.5*(2-2**(-10*(e-1))),Pm=e=>1-Math.sin(Math.acos(e)),Fm=km(Pm),Im=Om(Pm),Lm=Dm(.42,0,1,1),Rm=Dm(0,0,.58,1),zm=Dm(.42,0,.58,1),Bm=e=>Array.isArray(e)&&typeof e[0]!=`number`,Vm=e=>Array.isArray(e)&&typeof e[0]==`number`,Hm={linear:gm,easeIn:Lm,easeInOut:zm,easeOut:Rm,circIn:Pm,circInOut:Im,circOut:Fm,backIn:jm,backInOut:Mm,backOut:Am,anticipate:Nm},Um=e=>typeof e==`string`,Wm=e=>{if(Vm(e)){e.length;let[t,n,r,i]=e;return Dm(t,n,r,i)}else if(Um(e))return Hm[e],`${e}`,Hm[e];return e},Gm=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function Km(e){let t=new Set,n=new Set,r=!1,i=!1,a=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function s(t){a.has(t)&&(c.schedule(t),e()),t(o)}let c={schedule:(e,i=!1,o=!1)=>{let s=o&&r?t:n;return i&&a.add(e),s.add(e),e},cancel:e=>{n.delete(e),a.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0;let a=t;t=n,n=a,t.forEach(s),t.clear(),r=!1,i&&(i=!1,c.process(e))}};return c}var qm=40;function Jm(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Gm.reduce((e,t)=>(e[t]=Km(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=dm.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,qm),1)),i.timestamp=o,i.isProcessing=!0,s.process(i),c.process(i),l.process(i),u.process(i),d.process(i),f.process(i),p.process(i),m.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(h))},g=()=>{n=!0,r=!0,i.isProcessing||e(h)};return{schedule:Gm.reduce((e,t)=>{let r=o[t];return e[t]=(e,t=!1,i=!1)=>(n||g(),r.schedule(e,t,i)),e},{}),cancel:e=>{for(let t=0;t<Gm.length;t++)o[Gm[t]].cancel(e)},state:i,steps:o}}var{schedule:Ym,cancel:Xm,state:Zm,steps:Qm}=Jm(typeof requestAnimationFrame<`u`?requestAnimationFrame:gm,!0),$m;function eh(){$m=void 0}var th={now:()=>($m===void 0&&th.set(Zm.isProcessing||dm.useManualTiming?Zm.timestamp:performance.now()),$m),set:e=>{$m=e,queueMicrotask(eh)}},nh=e=>t=>typeof t==`string`&&t.startsWith(e),rh=nh(`--`),ih=nh(`var(--`),ah=e=>ih(e)?oh.test(e.split(`/*`)[0].trim()):!1,oh=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function sh(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var ch={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},lh={...ch,transform:e=>um(0,1,e)},uh={...ch,default:1},dh=e=>Math.round(e*1e5)/1e5,fh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ph(e){return e==null}var mh=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,hh=(e,t)=>n=>!!(typeof n==`string`&&mh.test(n)&&n.startsWith(e)||t&&!ph(n)&&Object.prototype.hasOwnProperty.call(n,t)),gh=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(fh);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},_h=e=>um(0,255,e),vh={...ch,transform:e=>Math.round(_h(e))},yh={test:hh(`rgb`,`red`),parse:gh(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+vh.transform(e)+`, `+vh.transform(t)+`, `+vh.transform(n)+`, `+dh(lh.transform(r))+`)`};function bh(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var xh={test:hh(`#`),parse:bh,transform:yh.transform},Sh=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Ch=Sh(`deg`),wh=Sh(`%`),U=Sh(`px`),Th=Sh(`vh`),Eh=Sh(`vw`),Dh={...wh,parse:e=>wh.parse(e)/100,transform:e=>wh.transform(e*100)},Oh={test:hh(`hsl`,`hue`),parse:gh(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+wh.transform(dh(t))+`, `+wh.transform(dh(n))+`, `+dh(lh.transform(r))+`)`},kh={test:e=>yh.test(e)||xh.test(e)||Oh.test(e),parse:e=>yh.test(e)?yh.parse(e):Oh.test(e)?Oh.parse(e):xh.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?yh.transform(e):Oh.transform(e),getAnimatableNone:e=>{let t=kh.parse(e);return t.alpha=0,kh.transform(t)}},Ah=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function jh(e){return isNaN(e)&&typeof e==`string`&&(e.match(fh)?.length||0)+(e.match(Ah)?.length||0)>0}var Mh=`number`,Nh=`color`,Ph=`var`,Fh=`var(`,Ih="${}",Lh=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Rh(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Lh,e=>(kh.test(e)?(r.color.push(a),i.push(Nh),n.push(kh.parse(e))):e.startsWith(Fh)?(r.var.push(a),i.push(Ph),n.push(e)):(r.number.push(a),i.push(Mh),n.push(parseFloat(e))),++a,Ih)).split(Ih),indexes:r,types:i}}function zh(e){return Rh(e).values}function Bh({split:e,types:t}){let n=e.length;return r=>{let i=``;for(let a=0;a<n;a++)if(i+=e[a],r[a]!==void 0){let e=t[a];e===Mh?i+=dh(r[a]):e===Nh?i+=kh.transform(r[a]):i+=r[a]}return i}}function Vh(e){return Bh(Rh(e))}var Hh=e=>typeof e==`number`?0:kh.test(e)?kh.getAnimatableNone(e):e,Uh=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Hh(e);function Wh(e){let t=Rh(e);return Bh(t)(t.values.map((e,n)=>Uh(e,t.split[n])))}var Gh={test:jh,parse:zh,createTransformer:Vh,getAnimatableNone:Wh};function Kh(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function qh({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Kh(s,r,e+1/3),a=Kh(s,r,e),o=Kh(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Jh(e,t){return n=>n>0?t:e}var Yh=(e,t,n)=>e+(t-e)*n,Xh=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},Zh=[xh,yh,Oh],Qh=e=>Zh.find(t=>t.test(e));function $h(e){let t=Qh(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Oh&&(n=qh(n)),n}var eg=(e,t)=>{let n=$h(e),r=$h(t);if(!n||!r)return Jh(e,t);let i={...n};return e=>(i.red=Xh(n.red,r.red,e),i.green=Xh(n.green,r.green,e),i.blue=Xh(n.blue,r.blue,e),i.alpha=Yh(n.alpha,r.alpha,e),yh.transform(i))},tg=new Set([`none`,`hidden`]);function ng(e,t){return tg.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function rg(e,t){return n=>Yh(e,t,n)}function ig(e){return typeof e==`number`?rg:typeof e==`string`?ah(e)?Jh:kh.test(e)?eg:cg:Array.isArray(e)?ag:typeof e==`object`?kh.test(e)?eg:og:Jh}function ag(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>ig(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function og(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=ig(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function sg(e,t){let n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){let a=t.types[i],o=e.indexes[a][r[a]];n[i]=e.values[o]??0,r[a]++}return n}var cg=(e,t)=>{let n=Gh.createTransformer(t),r=Rh(e),i=Rh(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tg.has(e)&&!i.values.length||tg.has(t)&&!r.values.length?ng(e,t):_m(ag(sg(r,i),i.values),n):(`${e}${t}`,Jh(e,t))};function lg(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Yh(e,t,n):ig(e)(e,t)}var ug=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Ym.update(t,e),stop:()=>Xm(t),now:()=>Zm.isProcessing?Zm.timestamp:th.now()}},dg=(e,t,n=10)=>{let r=``,i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=Math.round(e(t/(i-1))*1e4)/1e4+`, `;return`linear(${r.substring(0,r.length-2)})`},fg=2e4;function pg(e){let t=0,n=e.next(t);for(;!n.done&&t<2e4;)t+=50,n=e.next(t);return t>=2e4?1/0:t}function mg(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(pg(r),fg);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:xm(i)}}var hg={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function gg(e,t){return e*Math.sqrt(1-t*t)}var _g=12;function vg(e,t,n){let r=n;for(let n=1;n<_g;n++)r-=e(r)/t(r);return r}var yg=.001;function bg({duration:e=hg.duration,bounce:t=hg.bounce,velocity:n=hg.velocity,mass:r=hg.mass}){let i,a;hg.maxDuration;let o=1-t;o=um(hg.minDamping,hg.maxDamping,o),e=um(hg.minDuration,hg.maxDuration,xm(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=gg(t,o),c=Math.exp(-i);return yg-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=gg(t**2,o);return(-i(t)+yg>0?-1:1)*((a-s)*c)/l}):(i=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=vg(i,a,s);if(e=bm(e),isNaN(c))return{stiffness:hg.stiffness,damping:hg.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var xg=[`duration`,`bounce`],Sg=[`stiffness`,`damping`,`mass`];function Cg(e,t){return t.some(t=>e[t]!==void 0)}function wg(e){let t={velocity:hg.velocity,stiffness:hg.stiffness,damping:hg.damping,mass:hg.mass,isResolvedFromDuration:!1,...e};if(!Cg(e,Sg)&&Cg(e,xg))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*um(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:hg.mass,stiffness:i,damping:a}}else{let n=bg({...e,velocity:0});t={...t,...n,mass:hg.mass},t.isResolvedFromDuration=!0}return t}function Tg(e=hg.visualDuration,t=hg.bounce){let n=typeof e==`object`?e:{visualDuration:e,keyframes:[0,1],bounce:t},{restSpeed:r,restDelta:i}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],s={done:!1,value:a},{stiffness:c,damping:l,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=wg({...n,velocity:-xm(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=xm(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?hg.restSpeed.granular:hg.restSpeed.default,i||=v?hg.restDelta.granular:hg.restDelta.default;let y,b,x,S,C,w;if(h<1)x=gg(_,h),S=(m+h*_*g)/x,y=e=>{let t=Math.exp(-h*_*e);return o-t*(S*Math.sin(x*e)+g*Math.cos(x*e))},C=h*_*S+g*x,w=h*_*g-S*x,b=e=>Math.exp(-h*_*e)*(C*Math.sin(x*e)+w*Math.cos(x*e));else if(h===1){y=e=>o-Math.exp(-_*e)*(g+(m+_*g)*e);let e=m+_*g;b=t=>Math.exp(-_*t)*(_*e*t-m)}else{let e=_*Math.sqrt(h*h-1);y=t=>{let n=Math.exp(-h*_*t),r=Math.min(e*t,300);return o-n*((m+h*_*g)*Math.sinh(r)+e*g*Math.cosh(r))/e};let t=(m+h*_*g)/e,n=h*_*t-g*e,r=h*_*g-t*e;b=t=>{let i=Math.exp(-h*_*t),a=Math.min(e*t,300);return i*(n*Math.sinh(a)+r*Math.cosh(a))}}let T={calculatedDuration:p&&d||null,velocity:e=>bm(b(e)),next:e=>{if(!p&&h<1){let t=Math.exp(-h*_*e),n=Math.sin(x*e),a=Math.cos(x*e),c=o-t*(S*n+g*a),l=bm(t*(C*n+w*a));return s.done=Math.abs(l)<=r&&Math.abs(o-c)<=i,s.value=s.done?o:c,s}let t=y(e);if(p)s.done=e>=d;else{let n=bm(b(e));s.done=Math.abs(n)<=r&&Math.abs(o-t)<=i}return s.value=s.done?o:t,s},toString:()=>{let e=Math.min(pg(T),fg),t=dg(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Tg.applyToOptions=e=>{let t=mg(e,100,Tg);return e.ease=t.ease,e.duration=bm(t.duration),e.type=`keyframes`,e};var Eg=5;function Dg(e,t,n){let r=Math.max(t-Eg,0);return Sm(n-e(r),t-r)}function Og({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=Tg({keyframes:[f.value,m(f.value)],velocity:Dg(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>=x?S.next(e-x):(!t&&b(e),f)}}}function kg(e,t,n){let r=[],i=n||dm.mix||lg,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=_m(Array.isArray(t)?t[n]||gm:t,a)),r.push(a)}return r}function Ag(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(t.length,a===1)return()=>t[0];if(a===2&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let s=kg(t,r,i),c=s.length,l=n=>{if(o&&n<e[0])return t[0];let r=0;if(c>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=vm(e[r],e[r+1],n);return s[r](i)};return n?t=>l(um(e[0],e[a-1],t)):l}function jg(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=vm(0,t,r);e.push(Yh(n,1,i))}}function Mg(e){let t=[0];return jg(t,e.length-1),t}function Ng(e,t){return e.map(e=>e*t)}function Pg(e,t){return e.map(()=>t||zm).splice(0,e.length-1)}function Fg({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Bm(r)?r.map(Wm):Wm(r),a={done:!1,value:t[0]},o=Ag(Ng(n&&n.length===t.length?n:Mg(t),e),t,{ease:Array.isArray(i)?i:Pg(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Ig=e=>e!==null;function Lg(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Ig),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Rg={decay:Og,inertia:Og,tween:Fg,keyframes:Fg,spring:Tg};function zg(e){typeof e.type==`string`&&(e.type=Rg[e.type])}var Bg=class{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}},Vg=e=>e/100,Hg=class extends Bg{constructor(e){super(),this.state=`idle`,this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{let{motionValue:e}=this.options;e&&e.updatedAt!==th.now()&&this.tick(th.now()),this.isStopped=!0,this.state!==`idle`&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){let{options:e}=this;zg(e);let{type:t=Fg,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Fg;s!==Fg&&typeof o[0]!=`number`&&(this.mixKeyframes=_m(Vg,lg(o[0],o[1])),o=[0,100]);let c=s({...e,keyframes:o});i===`mirror`&&(this.mirroredGenerator=s({...e,keyframes:[...o].reverse(),velocity:-a})),c.calculatedDuration===null&&(c.calculatedDuration=pg(c));let{calculatedDuration:l}=c;this.calculatedDuration=l,this.resolvedDuration=l+r,this.totalDuration=this.resolvedDuration*(n+1)-r,this.generator=c}updateTime(e){let t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime===null?this.currentTime=t:this.currentTime=this.holdTime}tick(e,t=!1){let{generator:n,totalDuration:r,mixKeyframes:i,mirroredGenerator:a,resolvedDuration:o,calculatedDuration:s}=this;if(this.startTime===null)return n.next(0);let{delay:c=0,keyframes:l,repeat:u,repeatType:d,repeatDelay:f,type:p,onUpdate:m,finalKeyframe:h}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);let g=this.currentTime-c*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?g<0:g>r;this.currentTime=Math.max(g,0),this.state===`finished`&&this.holdTime===null&&(this.currentTime=r);let v=this.currentTime,y=n;if(u){let e=Math.min(this.currentTime,r)/o,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,u+1),t%2&&(d===`reverse`?(n=1-n,f&&(n-=f/o)):d===`mirror`&&(y=a)),v=um(0,1,n)*o}let b;_?(this.delayState.value=l[0],b=this.delayState):b=y.next(v),i&&!_&&(b.value=i(b.value));let{done:x}=b;!_&&s!==null&&(x=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);let S=this.holdTime===null&&(this.state===`finished`||this.state===`running`&&x);return S&&p!==Og&&(b.value=Lg(l,this.options,h,this.speed)),m&&m(b.value),S&&this.finish(),b}then(e,t){return this.finished.then(e,t)}get duration(){return xm(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+xm(e)}get time(){return xm(this.currentTime)}set time(e){e=bm(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state=`paused`,this.holdTime=e,this.tick(e))}getGeneratorVelocity(){let e=this.currentTime;if(e<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(e);let t=this.generator.next(e).value;return Dg(e=>this.generator.next(e).value,e,t)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;t&&this.driver&&this.updateTime(th.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=xm(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=ug,startTime:t}=this.options;this.driver||=e(e=>this.tick(e)),this.options.onPlay?.();let n=this.driver.now();this.state===`finished`?(this.updateFinished(),this.startTime=n):this.holdTime===null?this.startTime||=t??n:this.startTime=n-this.holdTime,this.state===`finished`&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state=`running`,this.driver.start()}pause(){this.state=`paused`,this.updateTime(th.now()),this.holdTime=this.currentTime}complete(){this.state!==`running`&&this.play(),this.state=`finished`,this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state=`finished`,this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state=`idle`,this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&=(this.driver.stop(),void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type=`keyframes`,this.options.ease=`linear`,this.initAnimation()),this.driver?.stop(),e.observe(this)}};function Ug(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Wg=e=>e*180/Math.PI,Gg=e=>qg(Wg(Math.atan2(e[1],e[0]))),Kg={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Gg,rotateZ:Gg,skewX:e=>Wg(Math.atan(e[1])),skewY:e=>Wg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},qg=e=>(e%=360,e<0&&(e+=360),e),Jg=Gg,Yg=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Xg=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Zg={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Yg,scaleY:Xg,scale:e=>(Yg(e)+Xg(e))/2,rotateX:e=>qg(Wg(Math.atan2(e[6],e[5]))),rotateY:e=>qg(Wg(Math.atan2(-e[2],e[0]))),rotateZ:Jg,rotate:Jg,skewX:e=>Wg(Math.atan(e[4])),skewY:e=>Wg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function Qg(e){return+!!e.includes(`scale`)}function $g(e,t){if(!e||e===`none`)return Qg(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=Zg,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Kg,i=t}if(!i)return Qg(t);let a=r[t],o=i[1].split(`,`).map(t_);return typeof a==`function`?a(o):o[a]}var e_=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return $g(n,t)};function t_(e){return parseFloat(e.trim())}var n_=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],r_=new Set([...n_,`pathRotation`]),i_=e=>e===ch||e===U,a_=new Set([`x`,`y`,`z`]),o_=n_.filter(e=>!a_.has(e));function s_(e){let t=[];return o_.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var c_={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`,boxSizing:r})=>{let i=e.max-e.min;return r===`border-box`?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>$g(t,`x`),y:(e,{transform:t})=>$g(t,`y`)};c_.translateX=c_.x,c_.translateY=c_.y;var l_=new Set,u_=!1,d_=!1,f_=!1;function p_(){if(d_){let e=Array.from(l_).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=s_(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{e.getValue(t)?.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{e.suspendedScrollY!==void 0&&window.scrollTo(0,e.suspendedScrollY)})}d_=!1,u_=!1,l_.forEach(e=>e.complete(f_)),l_.clear()}function m_(){l_.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(d_=!0)})}function h_(){f_=!0,m_(),p_(),f_=!1}var g_=class{constructor(e,t,n,r,i,a=!1){this.state=`pending`,this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=a}scheduleResolve(){this.state=`scheduled`,this.isAsync?(l_.add(this),u_||(u_=!0,Ym.read(m_),Ym.resolveKeyframes(p_))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;if(e[0]===null){let i=r?.get(),a=e[e.length-1];if(i!==void 0)e[0]=i;else if(n&&t){let r=n.readValue(t,a);r!=null&&(e[0]=r)}e[0]===void 0&&(e[0]=a),r&&i===void 0&&r.set(e[0])}Ug(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),l_.delete(this)}cancel(){this.state===`scheduled`&&(l_.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},__=e=>e.startsWith(`--`);function v_(e,t,n){__(t)?e.style.setProperty(t,n):e.style[t]=n}var y_={};function b_(e,t){let n=hm(e);return()=>y_[t]??n()}var x_=b_(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),S_=b_(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),C_=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,w_={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:C_([0,.65,.55,1]),circOut:C_([.55,0,1,.45]),backIn:C_([.31,.01,.66,-.59]),backOut:C_([.33,1.53,.69,.99])};function T_(e,t){if(e)return typeof e==`function`?S_()?dg(e,t):`ease-out`:Vm(e)?C_(e):Array.isArray(e)?e.map(e=>T_(e,t)||w_.easeOut):w_[e]}function E_(e,t,n,{delay:r=0,duration:i=300,repeat:a=0,repeatType:o=`loop`,ease:s=`easeOut`,times:c}={},l=void 0){let u={[t]:n};c&&(u.offset=c);let d=T_(s,i);Array.isArray(d)&&(u.easing=d);let f={delay:r,duration:i,easing:Array.isArray(d)?`linear`:d,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`};return l&&(f.pseudoElement=l),e.animate(u,f)}function D_(e){return typeof e==`function`&&`applyToOptions`in e}function O_({type:e,...t}){return D_(e)&&S_()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var k_=class extends Bg{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;let{element:t,name:n,keyframes:r,pseudoElement:i,allowFlatten:a=!1,finalKeyframe:o,onComplete:s}=e;this.isPseudoElement=!!i,this.allowFlatten=a,this.options=e,e.type;let c=O_(e);this.animation=E_(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Lg(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),v_(t,n,e),this.animation.cancel()}s?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state===`finished`&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:e}=this;e===`idle`||e===`finished`||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){let e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){let e=this.animation.effect?.getComputedTiming?.().duration||0;return xm(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+xm(e)}get time(){return xm(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=bm(e),t&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime===null?this.animation.playState:`finished`}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,rangeStart:t,rangeEnd:n,observe:r}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:`linear`}),this.animation.onfinish=null,e&&x_()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),gm):r(this)}},A_={anticipate:Nm,backInOut:Mm,circInOut:Im};function j_(e){return e in A_}function M_(e){typeof e.ease==`string`&&j_(e.ease)&&(e.ease=A_[e.ease])}var N_=10,P_=class extends k_{constructor(e){M_(e),zg(e),super(e),e.startTime!==void 0&&e.autoplay!==!1&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){let{motionValue:t,onUpdate:n,onComplete:r,element:i,...a}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}let o=new Hg({...a,autoplay:!1}),s=Math.max(N_,th.now()-this.startTime),c=um(0,N_,s-N_),l=o.sample(s).value,{name:u}=this.options;i&&u&&v_(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},F_=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Gh.test(e)||e===`0`)&&!e.startsWith(`url(`));function I_(e){let t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function L_(e,t,n,r){let i=e[0];if(i===null)return!1;if(t===`display`||t===`visibility`)return!0;let a=e[e.length-1],o=F_(i,t),s=F_(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:I_(e)||(n===`spring`||D_(n))&&r}function R_(e){e.duration=0,e.type=`keyframes`}var z_=new Set([`opacity`,`clipPath`,`filter`,`transform`]),B_=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function V_(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&B_.test(e[t]))return!0;return!1}var H_=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),U_=hm(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function W_(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:a,type:o,keyframes:s}=e;if(!(t?.owner?.current instanceof HTMLElement))return!1;let{onUpdate:c,transformTemplate:l}=t.owner.getProps();return U_()&&n&&(z_.has(n)||H_.has(n)&&V_(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var G_=40,K_=class extends Bg{constructor({autoplay:e=!0,delay:t=0,type:n=`keyframes`,repeat:r=0,repeatDelay:i=0,repeatType:a=`loop`,keyframes:o,name:s,motionValue:c,element:l,...u}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=th.now();let d={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:a,name:s,motionValue:c,element:l,...u},f=l?.KeyframeResolver||g_;this.keyframeResolver=new f(o,(e,t,n)=>this.onKeyframesResolved(e,t,d,!n),s,c,l),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,t,n,r){this.keyframeResolver=void 0;let{name:i,type:a,velocity:o,delay:s,isHandoff:c,onUpdate:l}=n;this.resolvedAt=th.now();let u=!0;L_(e,i,a,o)||(u=!1,(dm.instantAnimations||!s)&&l?.(Lg(e,n,t)),e[0]=e[e.length-1],R_(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>G_?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&W_(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new P_({...d,element:p})}catch{m=new Hg(d)}else m=new Hg(d);m.finished.then(()=>{this.notifyFinished()}).catch(gm),this.pendingTimeline&&=(this.stopTimeline=m.attachTimeline(this.pendingTimeline),void 0),this._animation=m}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),h_()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}};function q_(e,t,n,r=0,i=1){let a=Array.from(e).sort((e,t)=>e.sortNodePosition(t)).indexOf(t),o=e.size,s=(o-1)*r;return typeof n==`function`?n(a,o):i===1?a*r:s-a*r}var J_=30,Y_=e=>!isNaN(parseFloat(e)),X_={current:void 0},Z_=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=th.now();if(this.updatedAt!==t&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let e of this.dependents)e.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=th.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Y_(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new ym);let n=this.events[e].add(t);return e===`change`?()=>{n(),Ym.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||=new Set,this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return X_.current&&X_.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=th.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>J_)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,J_);return Sm(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function Q_(e,t){return new Z_(e,t)}function $_(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function ev(e,t){let n=e?.[t]??e?.default??e;return n===e?n:$_(n,e)}var tv={type:`spring`,stiffness:500,damping:25,restSpeed:10},nv=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),rv={type:`keyframes`,duration:.8},iv={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},av=(e,{keyframes:t})=>t.length>2?rv:r_.has(e)?e.startsWith(`scale`)?nv(t[1]):tv:iv,ov=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function sv(e){for(let t in e)if(!ov.has(t))return!0;return!1}var cv=(e,t,n,r={},i,a)=>o=>{let s=ev(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=bm(c);let u={keyframes:Array.isArray(n)?n:[null,n],ease:`easeOut`,velocity:t.getVelocity(),...s,delay:-l,onUpdate:e=>{t.set(e),s.onUpdate&&s.onUpdate(e)},onComplete:()=>{o(),s.onComplete&&s.onComplete()},name:e,motionValue:t,element:a?void 0:i};sv(s)||Object.assign(u,av(e,u)),u.duration&&=bm(u.duration),u.repeatDelay&&=bm(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(R_(u),u.delay===0&&(d=!0)),(dm.instantAnimations||dm.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,R_(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Lg(u.keyframes,s);if(e!==void 0){Ym.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Hg(u):new K_(u)},lv=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function uv(e){let t=lv.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function dv(e,t,n=1){`${e}`;let[r,i]=uv(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return fm(e)?parseFloat(e):e}return ah(i)?dv(i,t,n+1):i}function fv(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function pv(e,t,n,r){if(typeof t==`function`){let[i,a]=fv(r);t=t(n===void 0?e.custom:n,i,a)}if(typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`){let[i,a]=fv(r);t=t(n===void 0?e.custom:n,i,a)}return t}function mv(e,t,n){let r=e.getProps();return pv(r,t,n===void 0?r.custom:n,e)}var hv=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...n_]),gv=e=>Array.isArray(e);function _v(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Q_(n))}function vv(e){return gv(e)?e[e.length-1]||0:e}function yv(e,t){let{transitionEnd:n={},transition:r={},...i}=mv(e,t)||{};i={...i,...n};for(let t in i)_v(e,t,vv(i[t]))}var bv=e=>!!(e&&e.getVelocity);function xv(e){return!!(bv(e)&&e.add)}function Sv(e,t){let n=e.getValue(`willChange`);if(xv(n))return n.add(t);if(!n&&dm.WillChange){let n=new dm.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Cv(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var wv=`data-`+Cv(`framerAppearId`);function Tv(e){return e.props[wv]}function Ev({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Dv(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?$_(a,c):c;let l=a?.reduceMotion,u=a?.skipAnimations;r&&(a=r);let d=[],f=i&&e.animationState&&e.animationState.getState()[i],p=a?.path;p&&p.animateVisualElement(e,s,a,n,d);for(let t in s){let r=e.getValue(t,e.latestValues[t]??null),i=s[t];if(i===void 0||f&&Ev(f,t))continue;let o={delay:n,...ev(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){Ym.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=Tv(e);if(n){let e=window.MotionHandoffAnimation(n,t,Ym);e!==null&&(o.startTime=e,p=!0)}}Sv(e,t);let m=l??e.shouldReduceMotion;r.start(cv(t,r,i,m&&hv.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>Ym.update(()=>{o&&yv(e,o)});d.length?Promise.all(d).then(t):t()}return d}function Ov(e,t,n={}){let r=mv(e,t,n.type===`exit`?e.presenceContext?.custom:void 0),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Dv(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return kv(e,t,r,a,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function kv(e,t,n=0,r=0,i=0,a=1,o){let s=[];for(let c of e.variantChildren)c.notify(`AnimationStart`,t),s.push(Ov(c,t,{...o,delay:n+(typeof r==`function`?0:r)+q_(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Av(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Ov(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Ov(e,t,n);else{let i=typeof t==`function`?mv(e,t,n.custom):t;r=Promise.all(Dv(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var jv={test:e=>e===`auto`,parse:e=>e},Mv=e=>t=>t.test(e),Nv=[ch,U,wh,Ch,Eh,Th,jv],Pv=e=>Nv.find(Mv(e));function Fv(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||mm(e)}var Iv=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Lv(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(fh)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Iv.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Rv=/\b([a-z-]*)\(.*?\)/gu,zv={...Gh,getAnimatableNone:e=>{let t=e.match(Rv);return t?t.map(Lv).join(` `):e}},Bv={...Gh,getAnimatableNone:e=>{let t=Gh.parse(e);return Gh.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Vv={...ch,transform:Math.round},Hv={borderWidth:U,borderTopWidth:U,borderRightWidth:U,borderBottomWidth:U,borderLeftWidth:U,borderRadius:U,borderTopLeftRadius:U,borderTopRightRadius:U,borderBottomRightRadius:U,borderBottomLeftRadius:U,width:U,maxWidth:U,height:U,maxHeight:U,top:U,right:U,bottom:U,left:U,inset:U,insetBlock:U,insetBlockStart:U,insetBlockEnd:U,insetInline:U,insetInlineStart:U,insetInlineEnd:U,padding:U,paddingTop:U,paddingRight:U,paddingBottom:U,paddingLeft:U,paddingBlock:U,paddingBlockStart:U,paddingBlockEnd:U,paddingInline:U,paddingInlineStart:U,paddingInlineEnd:U,margin:U,marginTop:U,marginRight:U,marginBottom:U,marginLeft:U,marginBlock:U,marginBlockStart:U,marginBlockEnd:U,marginInline:U,marginInlineStart:U,marginInlineEnd:U,fontSize:U,backgroundPositionX:U,backgroundPositionY:U,rotate:Ch,pathRotation:Ch,rotateX:Ch,rotateY:Ch,rotateZ:Ch,scale:uh,scaleX:uh,scaleY:uh,scaleZ:uh,skew:Ch,skewX:Ch,skewY:Ch,distance:U,translateX:U,translateY:U,translateZ:U,x:U,y:U,z:U,perspective:U,transformPerspective:U,opacity:lh,originX:Dh,originY:Dh,originZ:U,zIndex:Vv,fillOpacity:lh,strokeOpacity:lh,numOctaves:Vv},Uv={...Hv,color:kh,backgroundColor:kh,outlineColor:kh,fill:kh,stroke:kh,borderColor:kh,borderTopColor:kh,borderRightColor:kh,borderBottomColor:kh,borderLeftColor:kh,filter:zv,WebkitFilter:zv,mask:Bv,WebkitMask:Bv},Wv=e=>Uv[e],Gv=new Set([zv,Bv]);function Kv(e,t){let n=Wv(e);return Gv.has(n)||(n=Gh),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var qv=new Set([`auto`,`none`,`0`]);function Jv(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!qv.has(t)&&Rh(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Kv(n,i)}var Yv=class extends g_{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if(typeof r==`string`&&(r=r.trim(),ah(r))){let i=dv(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!hv.has(n)||e.length!==2)return;let[r,i]=e,a=Pv(r),o=Pv(i);if(sh(r)!==sh(i)&&c_[n]){this.needsMeasurement=!0;return}if(a!==o)if(i_(a)&&i_(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else c_[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Fv(e[t]))&&n.push(t);n.length&&Jv(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;n===`height`&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=c_[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];r!==void 0&&e.getValue(n,r).jump(r,!1)}measureEndState(){let{element:e,name:t,unresolvedKeyframes:n}=this;if(!e||!e.current)return;let r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);let i=n.length-1,a=n[i];n[i]=c_[t](e.measureViewportBox(),window.getComputedStyle(e.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),this.removedTransforms?.length&&this.removedTransforms.forEach(([t,n])=>{e.getValue(t).set(n)}),this.resolveNoneKeyframes()}},Xv=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function Zv(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e==`string`){let r=document;t&&(r=t.current);let i=n?.[e]??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(e=>e!=null)}var Qv=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function $v(e){return pm(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:ey,cancel:ty}=Jm(queueMicrotask,!1),ny={x:!1,y:!1};function ry(){return ny.x||ny.y}function iy(e){return e===`x`||e===`y`?ny[e]?null:(ny[e]=!0,()=>{ny[e]=!1}):ny.x||ny.y?null:(ny.x=ny.y=!0,()=>{ny.x=ny.y=!1})}function ay(e,t){let n=Zv(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function oy(e){return!(e.pointerType===`touch`||ry())}function sy(e,t,n={}){let[r,i,a]=ay(e,n);return r.forEach(e=>{let n=!1,r=!1,a,o=()=>{e.removeEventListener(`pointerleave`,u)},s=e=>{a&&=(a(e),void 0),o()},c=e=>{n=!1,window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c),r&&(r=!1,s(e))},l=()=>{n=!0,window.addEventListener(`pointerup`,c,i),window.addEventListener(`pointercancel`,c,i)},u=e=>{if(e.pointerType!==`touch`){if(n){r=!0;return}s(e)}};e.addEventListener(`pointerenter`,n=>{if(!oy(n))return;r=!1;let o=t(e,n);typeof o==`function`&&(a=o,e.addEventListener(`pointerleave`,u,i))},i),e.addEventListener(`pointerdown`,l,i)}),a}var cy=(e,t)=>t?e===t||cy(e,t.parentElement):!1,ly=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,uy=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function dy(e){return uy.has(e.tagName)||e.isContentEditable===!0}var fy=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function py(e){return fy.has(e.tagName)||e.isContentEditable===!0}var my=new WeakSet;function hy(e){return t=>{t.key===`Enter`&&e(t)}}function gy(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var _y=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=hy(()=>{if(my.has(n))return;gy(n,`down`);let e=hy(()=>{gy(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>gy(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function vy(e){return ly(e)&&!ry()}var yy=new WeakSet;function by(e,t,n={}){let[r,i,a]=ay(e,n),o=e=>{let r=e.currentTarget;if(!vy(e)||yy.has(e))return;my.add(r),n.stopPropagation&&yy.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),my.has(r)&&my.delete(r),vy(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||cy(r,e.target))},l=e=>{s(e,!1)};window.addEventListener(`pointerup`,c,o),window.addEventListener(`pointercancel`,l,o)};return r.forEach(e=>{(n.useGlobalTarget?window:e).addEventListener(`pointerdown`,o,i),$v(e)&&(e.addEventListener(`focus`,e=>_y(e,i)),!dy(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function xy(e){return pm(e)&&`ownerSVGElement`in e}var Sy=new WeakMap,Cy,wy=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:xy(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Ty=wy(`inline`,`width`,`offsetWidth`),Ey=wy(`block`,`height`,`offsetHeight`);function Dy({target:e,borderBoxSize:t}){Sy.get(e)?.forEach(n=>{n(e,{get width(){return Ty(e,t)},get height(){return Ey(e,t)}})})}function Oy(e){e.forEach(Dy)}function ky(){typeof ResizeObserver>`u`||(Cy=new ResizeObserver(Oy))}function Ay(e,t){Cy||ky();let n=Zv(e);return n.forEach(e=>{let n=Sy.get(e);n||(n=new Set,Sy.set(e,n)),n.add(t),Cy?.observe(e)}),()=>{n.forEach(e=>{let n=Sy.get(e);n?.delete(t),n?.size||Cy?.unobserve(e)})}}var jy=new Set,My;function Ny(){My=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};jy.forEach(t=>t(e))},window.addEventListener(`resize`,My)}function Py(e){return jy.add(e),My||Ny(),()=>{jy.delete(e),!jy.size&&typeof My==`function`&&(window.removeEventListener(`resize`,My),My=void 0)}}function Fy(e,t){return typeof e==`function`?Py(e):Ay(e,t)}var Iy={value:null,addProjectionMetrics:null};function Ly(e){return xy(e)&&e.tagName===`svg`}var Ry=[...Nv,kh,Gh],zy=e=>Ry.find(Mv(e)),By=()=>({translate:0,scale:1,origin:0,originPoint:0}),Vy=()=>({x:By(),y:By()}),Hy=()=>({min:0,max:0}),Uy=()=>({x:Hy(),y:Hy()}),Wy=new WeakMap;function Gy(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Ky(e){return typeof e==`string`||Array.isArray(e)}var qy=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Jy=[`initial`,...qy];function Yy(e){return Gy(e.animate)||Jy.some(t=>Ky(e[t]))}function Xy(e){return!!(Yy(e)||e.variants)}function Zy(e,t,n){for(let r in t){let i=t[r],a=n[r];if(bv(i))e.addValue(r,i);else if(bv(a))e.addValue(r,Q_(i,{owner:e}));else if(a!==i)if(e.hasValue(r)){let t=e.getValue(r);t.liveStyle===!0?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,Q_(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var Qy={current:null},$y={current:!1},eb=typeof window<`u`;function tb(){if($y.current=!0,eb)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>Qy.current=e.matches;e.addEventListener(`change`,t),t()}else Qy.current=!1}var nb=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],rb={};function ib(e){rb=e}function ab(){return rb}var ob=class{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,skipAnimations:i,blockInitialAnimation:a,visualState:o},s={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=g_,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=th.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Ym.render(this.render,!1,!0))};let{latestValues:c,renderState:l}=o;this.latestValues=c,this.baseTarget={...c},this.initialValues=t.initial?{...c}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=i,this.options=s,this.blockInitialAnimation=!!a,this.isControllingVariants=Yy(t),this.isVariantNode=Xy(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:u,...d}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in d){let t=d[e];c[e]!==void 0&&bv(t)&&t.set(c[e])}}mount(e){if(this.hasBeenMounted)for(let e in this.initialValues)this.values.get(e)?.jump(this.initialValues[e]),this.latestValues[e]=this.initialValues[e];this.current=e,Wy.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),this.reducedMotionConfig===`never`?this.shouldReduceMotion=!1:this.reducedMotionConfig===`always`?this.shouldReduceMotion=!0:($y.current||tb(),this.shouldReduceMotion=Qy.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Xm(this.notifyUpdate),Xm(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(let e in this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??=new Set,this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&z_.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new k_({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:bm(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=r_.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Ym.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()}),i;typeof window<`u`&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),i&&i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e=`animation`;for(e in rb){let t=rb[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Uy()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<nb.length;t++){let n=nb[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=Zy(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=Q_(t===null?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){let n=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return n!=null&&(typeof n==`string`&&(fm(n)||mm(n))?n=parseFloat(n):!zy(n)&&Gh.test(t)&&(n=Kv(e,t)),this.setBaseTarget(e,bv(n)?n.get():n)),bv(n)?n.get():n}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n;if(typeof t==`string`||typeof t==`object`){let r=pv(this.props,t,this.presenceContext?.custom);r&&(n=r[e])}if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!bv(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new ym),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){ey.render(this.render)}},sb=class extends ob{constructor(){super(...arguments),this.KeyframeResolver=Yv}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){let n=e.style;return n?n[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;bv(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},cb=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function lb({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function ub({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function db(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function fb(e){return e===void 0||e===1}function pb({scale:e,scaleX:t,scaleY:n}){return!fb(e)||!fb(t)||!fb(n)}function mb(e){return pb(e)||hb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function hb(e){return gb(e.x)||gb(e.y)}function gb(e){return e&&e!==`0%`}function _b(e,t,n){return n+t*(e-n)}function vb(e,t,n,r,i){return i!==void 0&&(e=_b(e,i,r)),_b(e,n,r)+t}function yb(e,t=0,n=1,r,i){e.min=vb(e.min,t,n,r,i),e.max=vb(e.max,t,n,r,i)}function bb(e,{x:t,y:n}){yb(e.x,t.translate,t.scale,t.originPoint),yb(e.y,n.translate,n.scale,n.originPoint)}var xb=.999999999999,Sb=1.0000000000001;function Cb(e,t,n,r=!1){let i=n.length;if(!i)return;t.x=t.y=1;let a,o;for(let s=0;s<i;s++){a=n[s],o=a.projectionDelta;let{visualElement:i}=a.options;i&&i.props.style&&i.props.style.display===`contents`||(r&&a.options.layoutScroll&&a.scroll&&a!==a.root&&(wb(e.x,-a.scroll.offset.x),wb(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,bb(e,o)),r&&mb(a.latestValues)&&Db(e,a.latestValues,a.layout?.layoutBox))}t.x<Sb&&t.x>xb&&(t.x=1),t.y<Sb&&t.y>xb&&(t.y=1)}function wb(e,t){e.min+=t,e.max+=t}function Tb(e,t,n,r,i=.5){yb(e,t,n,Yh(e.min,e.max,i),r)}function Eb(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Db(e,t,n){let r=n??e;Tb(e.x,Eb(t.x,r.x),t.scaleX,t.scale,t.originX),Tb(e.y,Eb(t.y,r.y),t.scaleY,t.scale,t.originY)}function Ob(e,t){return lb(db(e.getBoundingClientRect(),t))}function kb(e,t,n){let r=Ob(e,n),{scroll:i}=t;return i&&(wb(r.x,i.offset.x),wb(r.y,i.offset.y)),r}var Ab={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},jb=n_.length;function Mb(e,t,n){let r=``,i=!0;for(let a=0;a<jb;a++){let o=n_[a],s=e[o];if(s===void 0)continue;let c=!0;if(typeof s==`number`)c=s===+!!o.startsWith(`scale`);else{let e=parseFloat(s);c=o.startsWith(`scale`)?e===1:e===0}if(!c||n){let e=Qv(s,Hv[o]);if(!c){i=!1;let t=Ab[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${Qv(a,Hv.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Nb(e,t,n){let{style:r,vars:i,transformOrigin:a}=e,o=!1,s=!1;for(let e in t){let n=t[e];if(r_.has(e)){o=!0;continue}else if(rh(e)){i[e]=n;continue}else{let t=Qv(n,Hv[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Mb(t,e.transform,n):r.transform&&=`none`),s){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=a;r.transformOrigin=`${e} ${t} ${n}`}}function Pb(e,{style:t,vars:n},r,i){let a=e.style,o;for(o in t)a[o]=t[o];for(o in i?.applyProjectionStyles(a,r),n)a.setProperty(o,n[o])}function Fb(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Ib={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(U.test(e))e=parseFloat(e);else return e;return`${Fb(e,t.target.x)}% ${Fb(e,t.target.y)}%`}},Lb={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Gh.parse(e);if(i.length>5)return r;let a=Gh.createTransformer(e),o=typeof i[0]==`number`?0:1,s=n.x.scale*t.x,c=n.y.scale*t.y;i[0+o]/=s,i[1+o]/=c;let l=Yh(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Rb={borderRadius:{...Ib,applyTo:[...Xv]},borderTopLeftRadius:Ib,borderTopRightRadius:Ib,borderBottomLeftRadius:Ib,borderBottomRightRadius:Ib,boxShadow:Lb};function zb(e,{layout:t,layoutId:n}){return r_.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Rb[e]||e===`opacity`)}function Bb(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(bv(r[t])||i&&bv(i[t])||zb(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Vb(e){return window.getComputedStyle(e)}var Hb=class extends sb{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Pb}readValueFromInstance(e,t){if(r_.has(t))return this.projection?.isProjecting?Qg(t):e_(e,t);{let n=Vb(e),r=(rh(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Ob(e,t)}build(e,t,n){Nb(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Bb(e,t,n)}},Ub={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Wb={offset:`strokeDashoffset`,array:`strokeDasharray`};function Gb(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Ub:Wb;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Kb=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function qb(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Nb(e,s,l),c){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f}=e;d.transform&&(f.transform=d.transform,delete d.transform),(f.transform||d.transformOrigin)&&(f.transformOrigin=d.transformOrigin??`50% 50%`,delete d.transformOrigin),f.transform&&(f.transformBox=u?.transformBox??`fill-box`,delete d.transformBox);for(let e of Kb)d[e]!==void 0&&(f[e]=d[e],delete d[e]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&Gb(d,i,a,o,!1)}var Jb=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]),Yb=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Xb(e,t,n,r){Pb(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Jb.has(n)?n:Cv(n),t.attrs[n])}function Zb(e,t,n){let r=Bb(e,t,n);for(let n in e)if(bv(e[n])||bv(t[n])){let t=n_.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var Qb=class extends sb{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Uy}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(r_.has(t)){let e=Wv(t);return e&&e.default||0}return t=Jb.has(t)?t:Cv(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return Zb(e,t,n)}build(e,t,n){qb(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){Xb(e,t,n,r)}mount(e){this.isSVGTag=Yb(e.tagName),super.mount(e)}},$b=Jy.length;function ex(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&ex(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<$b;n++){let r=Jy[n],i=e.props[r];(Ky(i)||i===!1)&&(t[r]=i)}return t}function tx(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}var nx=[...qy].reverse(),rx=qy.length;function ix(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Av(e,t,n)))}function ax(e){let t=ix(e),n=cx(),r=!0,i=!1,a=t=>(n,r)=>{let i=mv(e,r,t===`exit`?e.presenceContext?.custom:void 0);if(i){let{transition:e,transitionEnd:t,...r}=i;n={...n,...r,...t}}return n};function o(n){t=n(e)}function s(o){let{props:s}=e,c=ex(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<rx;t++){let p=nx[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Ky(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&(r||i)&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||Gy(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=ox(m.prevProp,h),b=y||p===o&&m.isActive&&!v&&g||t>f&&g,x=!1,S=Array.isArray(h)?h:[h],C=S.reduce(a(p),{});_===!1&&(C={});let{prevResolvedValues:w={}}=m,T={...w,...C},ee=t=>{b=!0,u.has(t)&&(x=!0,u.delete(t)),m.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in T){let t=C[e],n=w[e];if(d.hasOwnProperty(e))continue;let r=!1;r=gv(t)&&gv(n)?!tx(t,n)||y:t!==n,r?t==null?u.add(e):ee(e):t!==void 0&&u.has(e)?ee(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=C,m.isActive&&(d={...d,...C}),(r||i)&&e.blockInitialAnimation&&(b=!1);let E=v&&y;b&&(!E||x)&&l.push(...S.map(t=>{let n={type:p};if(typeof t==`string`&&(r||i)&&!E&&e.manuallyAnimateOnMount&&e.parent){let{parent:r}=e,i=mv(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=q_(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=mv(e,Array.isArray(s.initial)?s.initial[0]:s.initial);n&&n.transition&&(t.transition=n.transition)}u.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=r??null}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,i=!1,p?t(l):Promise.resolve()}function c(t,r){if(n[t].isActive===r)return Promise.resolve();e.variantChildren?.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let i=s(t);for(let e in n)n[e].protectedKeys={};return i}return{animateChanges:s,setActive:c,setAnimateFunction:o,getState:()=>n,reset:()=>{n=cx(),i=!0}}}function ox(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!tx(t,e):!1}function sx(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cx(){return{animate:sx(!0),whileInView:sx(),whileHover:sx(),whileTap:sx(),whileDrag:sx(),whileFocus:sx(),exit:sx()}}function lx(e,t){e.min=t.min,e.max=t.max}function ux(e,t){lx(e.x,t.x),lx(e.y,t.y)}function dx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var fx=.9999,px=1.0001,mx=-.01,hx=.01;function gx(e){return e.max-e.min}function _x(e,t,n){return Math.abs(e-t)<=n}function vx(e,t,n,r=.5){e.origin=r,e.originPoint=Yh(t.min,t.max,e.origin),e.scale=gx(n)/gx(t),e.translate=Yh(n.min,n.max,e.origin)-e.originPoint,(e.scale>=fx&&e.scale<=px||isNaN(e.scale))&&(e.scale=1),(e.translate>=mx&&e.translate<=hx||isNaN(e.translate))&&(e.translate=0)}function yx(e,t,n,r){vx(e.x,t.x,n.x,r?r.originX:void 0),vx(e.y,t.y,n.y,r?r.originY:void 0)}function bx(e,t,n,r=0){e.min=(r?Yh(n.min,n.max,r):n.min)+t.min,e.max=e.min+gx(t)}function xx(e,t,n,r){bx(e.x,t.x,n.x,r?.x),bx(e.y,t.y,n.y,r?.y)}function Sx(e,t,n,r=0){let i=r?Yh(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+gx(t)}function Cx(e,t,n,r){Sx(e.x,t.x,n.x,r?.x),Sx(e.y,t.y,n.y,r?.y)}function wx(e,t,n,r,i){return e-=t,e=_b(e,1/n,r),i!==void 0&&(e=_b(e,1/i,r)),e}function Tx(e,t=0,n=1,r=.5,i,a=e,o=e){if(wh.test(t)&&(t=parseFloat(t),t=Yh(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Yh(a.min,a.max,r);e===a&&(s-=t),e.min=wx(e.min,t,n,s,i),e.max=wx(e.max,t,n,s,i)}function Ex(e,t,[n,r,i],a,o){Tx(e,t[n],t[r],t[i],t.scale,a,o)}var Dx=[`x`,`scaleX`,`originX`],Ox=[`y`,`scaleY`,`originY`];function kx(e,t,n,r){Ex(e.x,t,Dx,n?n.x:void 0,r?r.x:void 0),Ex(e.y,t,Ox,n?n.y:void 0,r?r.y:void 0)}function Ax(e){return e.translate===0&&e.scale===1}function jx(e){return Ax(e.x)&&Ax(e.y)}function Mx(e,t){return e.min===t.min&&e.max===t.max}function Nx(e,t){return Mx(e.x,t.x)&&Mx(e.y,t.y)}function Px(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Fx(e,t){return Px(e.x,t.x)&&Px(e.y,t.y)}function Ix(e){return gx(e.x)/gx(e.y)}function Lx(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Rx(e){return[e(`x`),e(`y`)]}function zx(e,t,n){let r=``,i=e.x.translate/t.x,a=e.y.translate/t.y,o=n?.z||0;if((i||a||o)&&(r=`translate3d(${i}px, ${a}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,pathRotation:i,rotateX:a,rotateY:o,skewX:s,skewY:c}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotate(${i}deg) `),a&&(r+=`rotateX(${a}deg) `),o&&(r+=`rotateY(${o}deg) `),s&&(r+=`skewX(${s}deg) `),c&&(r+=`skewY(${c}deg) `)}let s=e.x.scale*t.x,c=e.y.scale*t.y;return(s!==1||c!==1)&&(r+=`scale(${s}, ${c})`),r||`none`}var Bx=Xv.length,Vx=e=>typeof e==`string`?parseFloat(e):e,Hx=e=>typeof e==`number`||U.test(e);function Ux(e,t,n,r,i,a){i?(e.opacity=Yh(0,n.opacity??1,Gx(r)),e.opacityExit=Yh(t.opacity??1,0,Kx(r))):a&&(e.opacity=Yh(t.opacity??1,n.opacity??1,r));for(let i=0;i<Bx;i++){let a=Xv[i],o=Wx(t,a),s=Wx(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Hx(o)===Hx(s)?(e[a]=Math.max(Yh(Vx(o),Vx(s),r),0),(wh.test(s)||wh.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Yh(t.rotate||0,n.rotate||0,r))}function Wx(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Gx=qx(0,.5,Fm),Kx=qx(.5,.95,gm);function qx(e,t,n){return r=>r<e?0:r>t?1:n(vm(e,t,r))}function Jx(e,t,n){let r=bv(e)?e:Q_(e);return r.start(cv(``,r,t,n)),r.animation}function Yx(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var Xx=(e,t)=>e.depth-t.depth,Zx=class{constructor(){this.children=[],this.isDirty=!1}add(e){cm(this.children,e),this.isDirty=!0}remove(e){lm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Xx),this.isDirty=!1,this.children.forEach(e)}};function Qx(e,t){let n=th.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(Xm(r),e(a-t))};return Ym.setup(r,!0),()=>Xm(r)}function $x(e){return bv(e)?e.get():e}var eS=class{constructor(){this.members=[]}add(e){cm(this.members,e);for(let t=this.members.length-1;t>=0;t--){let n=this.members[t];if(n===e||n===this.lead||n===this.prevLead)continue;let r=n.instance;(!r||r.isConnected===!1)&&!n.snapshot&&(lm(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(lm(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){for(let t=this.members.indexOf(e)-1;t>=0;t--){let e=this.members[t];if(e.isPresent!==!1&&e.instance?.isConnected!==!1)return this.promote(e),!0}return!1}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.updateSnapshot(),e.scheduleRender();let{layoutDependency:r}=n.options,{layoutDependency:i}=e.options;(r===void 0||r!==i)&&(e.resumeFrom=n,t&&(n.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root?.isUpdating&&(e.isLayoutDirty=!0)),e.options.crossfade===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{e.options.onExitComplete?.(),e.resumingFrom?.options.onExitComplete?.()})}scheduleRender(){this.members.forEach(e=>e.instance&&e.scheduleRender(!1))}removeLeadSnapshot(){this.lead?.snapshot&&(this.lead.snapshot=void 0)}},tS={hasAnimatedSinceResize:!0,hasEverUpdated:!1},nS={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},rS=[``,`X`,`Y`,`Z`],iS=1e3,aS=0;function oS(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function sS(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Tv(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Ym,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&sS(r)}function cS({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=aS++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,Iy.value&&(nS.nodes=nS.calculatedTargetDeltas=nS.calculatedProjections=0),this.nodes.forEach(dS),this.nodes.forEach(bS),this.nodes.forEach(xS),this.nodes.forEach(fS),Iy.addProjectionMetrics&&Iy.addProjectionMetrics(nS)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new Zx)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new ym),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t){if(this.instance)return;this.isSVG=xy(t)&&!Ly(t),this.instance=t;let{layoutId:n,layout:r,visualElement:i}=this.options;if(i&&!i.current&&i.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(r||n)&&(this.isLayoutDirty=!0),e){let n,r=0,i=()=>this.root.updateBlockedByResize=!1;Ym.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=Qx(i,250),tS.hasAnimatedSinceResize&&(tS.hasAnimatedSinceResize=!1,this.nodes.forEach(yS)))})}n&&this.root.registerSharedNode(n,this),this.options.animate!==!1&&i&&(n||r)&&this.addEventListener(`didUpdate`,({delta:e,hasLayoutChanged:t,hasRelativeLayoutChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let a=this.options.transition||i.getDefaultTransition()||OS,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Fx(this.targetLayout,r),l=!t&&n;if(this.options.layoutRoot||this.resumeFrom||l||t&&(c||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);let t={...ev(a,`layout`),onPlay:o,onComplete:s};(i.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t),this.setAnimationOrigin(e,l,t.path)}else t||yS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Xm(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(SS),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&sS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,(typeof t.latestValues.x==`string`||typeof t.latestValues.y==`string`)&&(t.isLayoutDirty=!0),t.updateScroll(`snapshot`),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(t===void 0&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,``):void 0,this.updateSnapshot(),e&&this.notifyListeners(`willUpdate`)}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){let e=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),e&&this.nodes.forEach(hS),this.nodes.forEach(mS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(gS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(_S),this.nodes.forEach(vS),this.nodes.forEach(lS),this.nodes.forEach(uS)):this.nodes.forEach(gS),this.clearAllSnapshots();let e=th.now();Zm.delta=um(0,1e3/60,e-Zm.timestamp),Zm.timestamp=e,Zm.isProcessing=!0,Qm.update.process(Zm),Qm.preRender.process(Zm),Qm.render.process(Zm),Zm.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ey.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(pS),this.sharedNodes.forEach(CS)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ym.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ym.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!gx(this.snapshot.measuredBox.x)&&!gx(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||=Uy(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners(`measure`,this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify(`LayoutMeasure`,this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e=`measure`){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t&&this.instance){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!jx(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||mb(this.latestValues)||a)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){let t=this.measurePageBox(),n=this.removeElementScroll(t);return e&&(n=this.removeTransform(n)),MS(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Uy();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(PS))){let{scroll:e}=this.root;e&&(wb(t.x,e.offset.x),wb(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Uy();if(ux(t,e),this.scroll?.wasRoot)return t;for(let n=0;n<this.path.length;n++){let r=this.path[n],{scroll:i,options:a}=r;r!==this.root&&i&&a.layoutScroll&&(i.wasRoot&&ux(t,e),wb(t.x,i.offset.x),wb(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Uy();ux(r,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];!t&&n.options.layoutScroll&&n.scroll&&n!==n.root&&(wb(r.x,-n.scroll.offset.x),wb(r.y,-n.scroll.offset.y)),mb(n.latestValues)&&Db(r,n.latestValues,n.layout?.layoutBox)}return mb(this.latestValues)&&Db(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Uy();ux(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!mb(n.latestValues))continue;let r;n.instance&&(pb(n.latestValues)&&n.updateSnapshot(),r=Uy(),ux(r,n.measurePageBox())),kx(t,n.latestValues,n.snapshot?.layoutBox,r)}return mb(this.latestValues)&&kx(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:e.crossfade===void 0||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Zm.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){let t=this.getLead();this.isProjectionDirty||=t.isProjectionDirty,this.isTransformDirty||=t.isTransformDirty,this.isSharedProjectionDirty||=t.isSharedProjectionDirty;let n=!!this.resumingFrom||this!==t;if(!(e||n&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:r,layoutId:i}=this.options;if(!this.layout||!(r||i))return;this.resolvedRelativeTargetAt=Zm.timestamp;let a=this.getClosestProjectingParent();a&&this.linkedParentVersion!==a.layoutVersion&&!a.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&a&&a.layout?this.createRelativeTarget(a,this.layout.layoutBox,a.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Uy(),this.targetWithTransforms=Uy()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),xx(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):ux(this.target,this.layout.layoutBox),bb(this.target,this.targetDelta)):ux(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&a&&!!a.resumingFrom==!!this.resumingFrom&&!a.options.layoutScroll&&a.target&&this.animationProgress!==1?this.createRelativeTarget(a,this.target,a.target):this.relativeParent=this.relativeTarget=void 0),Iy.value&&nS.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||pb(this.parent.latestValues)||hb(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(e,t,n){this.relativeParent=e,this.linkedParentVersion=e.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Uy(),this.relativeTargetOrigin=Uy(),Cx(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),ux(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){let e=this.getLead(),t=!!this.resumingFrom||this!==e,n=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(n=!1),t&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(n=!1),this.resolvedRelativeTargetAt===Zm.timestamp&&(n=!1),n)return;let{layout:r,layoutId:i}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||i))return;ux(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Cb(this.layoutCorrected,this.treeScale,this.path,t),e.layout&&!e.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(e.target=e.layout.layoutBox,e.targetWithTransforms=Uy());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(dx(this.prevProjectionDelta.x,this.projectionDelta.x),dx(this.prevProjectionDelta.y,this.projectionDelta.y)),yx(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Lx(this.projectionDelta.x,this.prevProjectionDelta.x)||!Lx(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),Iy.value&&nS.calculatedProjections++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){if(this.options.visualElement?.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Vy(),this.projectionDelta=Vy(),this.projectionDeltaWithTransform=Vy()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Vy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Uy(),c=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),l=this.getStack(),u=!l||l.members.length<=1,d=!!(c&&!u&&this.options.crossfade===!0&&!this.path.some(DS));this.animationProgress=0;let f,p=n?.interpolateProjection(e);this.mixTargetDelta=t=>{let n=t/1e3,r=p?.(n);r?(o.x.translate=r.x,o.x.scale=Yh(e.x.scale,1,n),o.x.origin=e.x.origin,o.x.originPoint=e.x.originPoint,o.y.translate=r.y,o.y.scale=Yh(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(wS(o.x,e.x,n),wS(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Cx(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),ES(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Nx(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Uy(),ux(f,this.relativeTarget)),c&&(this.animationValues=a,Ux(a,i,this.latestValues,n,d,u)),r&&r.rotate!==void 0&&(this.animationValues||=a,this.animationValues.pathRotation=r.rotate),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=n},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(e){this.notifyListeners(`animationStart`),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&=(Xm(this.pendingAnimation),void 0),this.pendingAnimation=Ym.update(()=>{tS.hasAnimatedSinceResize=!0,this.motionValue||=Q_(0),this.motionValue.jump(0,!1),this.currentAnimation=Jx(this.motionValue,[0,1e3],{...e,velocity:0,isSync:!0,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners(`animationComplete`)}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(iS),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(!(!t||!n||!r)){if(this!==e&&this.layout&&r&&NS(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Uy();let t=gx(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=gx(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}ux(t,n),Db(t,i),yx(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new eS),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){let{layoutId:e}=this.options;return e&&this.getStack()?.lead||this}getPrevLead(){let{layoutId:e}=this.options;return e?this.getStack()?.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return e?e.relegate(this):!1}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&oS(`z`,e,r,this.animationValues);for(let t=0;t<rS.length;t++)oS(`rotate${rS[t]}`,e,r,this.animationValues),oS(`skew${rS[t]}`,e,r,this.animationValues);e.render();for(let t in r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}applyProjectionStyles(e,t){if(!this.instance||this.isSVG)return;if(!this.isVisible){e.visibility=`hidden`;return}let n=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,e.visibility=``,e.opacity=``,e.pointerEvents=$x(t?.pointerEvents)||``,e.transform=n?n(this.latestValues,``):`none`;return}let r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(e.opacity=this.latestValues.opacity===void 0?1:this.latestValues.opacity,e.pointerEvents=$x(t?.pointerEvents)||``),this.hasProjected&&!mb(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=zx(this.projectionDeltaWithTransform,this.treeScale,i);n&&(a=n(i,a)),e.transform=a;let{x:o,y:s}=this.projectionDelta;e.transformOrigin=`${o.origin*100}% ${s.origin*100}% 0`,r.animationValues?e.opacity=r===this?i.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:i.opacityExit:e.opacity=r===this?i.opacity===void 0?``:i.opacity:i.opacityExit===void 0?0:i.opacityExit;for(let t in Rb){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Rb[t],c=a===`none`?i[t]:n(i[t],r);if(o){let t=o.length;for(let n=0;n<t;n++)e[o[n]]=c}else s?this.options.visualElement.renderState.vars[t]=c:e[t]=c}this.options.layoutId&&(e.pointerEvents=r===this?$x(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(mS),this.root.sharedNodes.clear()}}}function lS(e){e.updateLayout()}function uS(e){let t=e.resumeFrom?.snapshot||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners(`didUpdate`)){let{layoutBox:n,measuredBox:r}=e.layout,{animationType:i}=e.options,a=t.source!==e.layout.source;if(i===`size`)Rx(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=gx(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;lx(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else NS(i,t.layoutBox,n)&&Rx(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=gx(n[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=Vy();yx(o,n,t.layoutBox);let s=Vy();a?yx(s,e.applyTransform(r,!0),t.measuredBox):yx(s,n,t.layoutBox);let c=!jx(o),l=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:a}=r;if(i&&a){let o=e.options.layoutAnchor||void 0,s=Uy();Cx(s,t.layoutBox,i.layoutBox,o);let c=Uy();Cx(c,n,a.layoutBox,o),Fx(s,c)||(l=!0),r.options.layoutRoot&&(e.relativeTarget=c,e.relativeTargetOrigin=s,e.relativeParent=r)}}}e.notifyListeners(`didUpdate`,{layout:n,snapshot:t,delta:s,layoutDelta:o,hasLayoutChanged:c,hasRelativeLayoutChanged:l})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function dS(e){Iy.value&&nS.nodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty),e.isTransformDirty||=e.parent.isTransformDirty)}function fS(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function pS(e){e.clearSnapshot()}function mS(e){e.clearMeasurements()}function hS(e){e.isLayoutDirty=!0,e.updateLayout()}function gS(e){e.isLayoutDirty=!1}function _S(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function vS(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function yS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function bS(e){e.resolveTargetDelta()}function xS(e){e.calcProjection()}function SS(e){e.resetSkewAndRotation()}function CS(e){e.removeLeadSnapshot()}function wS(e,t,n){e.translate=Yh(t.translate,0,n),e.scale=Yh(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function TS(e,t,n,r){e.min=Yh(t.min,n.min,r),e.max=Yh(t.max,n.max,r)}function ES(e,t,n,r){TS(e.x,t.x,n.x,r),TS(e.y,t.y,n.y,r)}function DS(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var OS={duration:.45,ease:[.4,0,.1,1]},kS=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),AS=kS(`applewebkit/`)&&!kS(`chrome/`)?Math.round:gm;function jS(e){e.min=AS(e.min),e.max=AS(e.max)}function MS(e){jS(e.x),jS(e.y)}function NS(e,t,n){return e===`position`||e===`preserve-aspect`&&!_x(Ix(t),Ix(n),.2)}function PS(e){return e!==e.root&&e.scroll?.wasRoot}var FS=cS({attachResizeListener:(e,t)=>Yx(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),IS={current:void 0},LS=cS({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!IS.current){let e=new FS({});e.mount(window),e.setOptions({layoutScroll:!0}),IS.current=e}return IS.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),RS=(0,I.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function zS(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function BS(...e){return t=>{let n=!1,r=e.map(e=>{let r=zS(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():zS(e[t],null)}}}}function VS(...e){return I.useCallback(BS(...e),e)}var HS=class extends I.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if($v(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=$v(e)&&e.offsetWidth||0,r=$v(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function US({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,I.useId)(),s=(0,I.useRef)(null),c=(0,I.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,I.useContext)(RS),u=VS(s,e.props?.ref??e?.ref);return(0,I.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
16
16
|
[data-motion-pop-id="${o}"] {
|
|
17
17
|
position: absolute !important;
|
|
18
18
|
width: ${e}px !important;
|
|
@@ -3500,7 +3500,7 @@ img.ProseMirror-separator {
|
|
|
3500
3500
|
`,d0),slice:r.toJSON()};return e.chain().focus().deleteRange({from:t,to:n}).run(),i}function d0(e){return e.type.name===`composerMention`?String(e.attrs.label??``)||`${String(e.attrs.trigger??``)}${String(e.attrs.value??``)}`:e.type.name===`composerAtom`?String(e.attrs.label??``):``}function f0(e,t){let{selection:n}=e.state;if(typeof t==`string`){if(!n.empty){e.chain().focus().deleteSelection().insertContent(t).run();return}e.chain().focus().insertContent(t).run();return}let r=G.fromJSON(e.state.schema,t.slice);e.view.dispatch(e.state.tr.replaceSelection(r).scrollIntoView()),e.view.focus()}function p0(e,t){let{selection:n}=e.state;if(!n.empty)return!1;let r=n.$from,i=t===`Backspace`?r.nodeBefore:r.nodeAfter;if(!i||!m0(i))return!1;let a=t===`Backspace`?n.from-i.nodeSize:n.from,o=t===`Backspace`?n.from:n.from+i.nodeSize;return e.chain().focus().deleteRange({from:a,to:o}).run(),!0}function m0(e){return e.isAtom&&(e.type.name===`composerMention`||e.type.name===`composerAtom`)}function h0(e){try{return e.state.doc.textBetween(0,e.state.selection.from,`
|
|
3501
3501
|
`,``).length}catch{return 0}}function g0(e){return e.state.selection.empty&&h0(e)===0}function _0(e,t){return AQ(e.persistedPrompt,t)?`ParseSlash`:e.action}function v0(e){return e.key===`ArrowUp`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`p`}function y0(e){return e.key===`ArrowDown`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`n`}function b0(e){return[...e].sort((e,t)=>e.range.start-t.range.start)}function x0(e){let t=new Map;for(let n of e)t.set(`${n.kind}:${n.range.start}:${n.range.end}:${n.label}`,n);return b0([...t.values()])}function S0(e){return e.replace(/\r\n?/g,`
|
|
3502
3502
|
`)}function C0(e){return Array.from(e).length}function w0(e){return e.startsWith(`file://`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||/^[A-Za-z]:[\\/]/.test(e)}function T0(e){let t=e.trim();if(!t.startsWith(`file://`))return t;try{return decodeURI(new URL(t).pathname)}catch{return t}}function E0(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop();return t?decodeURIComponent(t):e}function D0(e){return/[\\/]$/.test(e)}function O0(e){return e.split(/\r?\n/).map(e=>e.trim()).find(e=>e&&!e.startsWith(`#`))??``}function k0(e){let t=O0(e);return t?t.match(/^[\w.+-]+\/[\w.+-]+:[^:\n]+:(.+)$/)?.[1]?.trim()??t:``}function A0(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function j0(e){return g$(e.trim())}function M0(e,t){return(e%t+t)%t}function N0(e,t,n){return`${e}:${n}:${t}`}function P0(e){let t=(0,H.c)(3),n=e.draftKey??``,r;return t[0]!==e||t[1]!==n?(r=(0,L.jsx)(I0,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function F0(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function I0({initialDraft:e,draftKey:t,disabled:n=!1,isTaskRunning:r=!1,queueSubmissions:i=!1,hasInteracted:a=!1,maxExpandedTextChars:o,editorAriaLabel:s=`Rich prompt composer`,className:c,children:l,validateSubmission:u,onSubmit:d,onStateChange:f}){let p=r1(l),m=(0,I.useRef)({signature:i1(p),slashCommands:p.slashCommands,mentionCandidates:p.mentionCandidates,commandTriggers:p.commandTriggers,mentionTriggers:p.mentionTriggers}),h=i1(p);h!==m.current.signature&&(m.current={signature:h,slashCommands:p.slashCommands,mentionCandidates:p.mentionCandidates,commandTriggers:p.commandTriggers,mentionTriggers:p.mentionTriggers});let{slashCommands:g,mentionCandidates:_,commandTriggers:v,mentionTriggers:y}=m.current,b=(0,I.useMemo)(()=>({commandTriggers:v,mentionTriggers:y}),[v,y]),x=(0,I.useRef)(y);x.current=y;let[S]=(0,I.useState)(()=>{if(e)return e;if(t===void 0)return;let n=K$(t);return n?m$({source:n,slashCommands:g,mentionCandidates:_}):void 0}),C=(0,I.useRef)(S?.remoteImages??[]),w=(0,I.useRef)(y1({state:S,slashCommands:g,mentionCandidates:_,triggers:b})),T=(0,I.useRef)(0),ee=(0,I.useRef)(!0);(0,I.useEffect)(()=>(ee.current=!0,()=>{ee.current=!1}),[]);let[E,D]=(0,I.useState)(C.current),[te,O]=(0,I.useState)(null),[ne,k]=(0,I.useState)(()=>w1(w.current,C.current,g,r,i,0)),A=(0,I.useRef)(ne),j=(0,I.useRef)(E),re=(0,I.useRef)(te),ie=(0,I.useRef)(null),ae=(0,I.useRef)(null),oe=(0,I.useRef)(void 0),M=(0,I.useRef)(null),se=(0,I.useRef)(null),ce=(0,I.useRef)(null),le=(0,I.useRef)(f),ue=(0,I.useRef)(u),de=(0,I.useRef)(d),fe=(0,I.useRef)(new Map),pe=(0,I.useRef)(()=>null),me=(0,I.useRef)(()=>void 0),he=(0,I.useRef)(()=>void 0),ge=(0,I.useRef)(()=>!1),N=GW({extensions:(0,I.useMemo)(()=>d1({getMentionTrigger:()=>x.current[0]??`@`,getRemoteImageCount:()=>j.current.length,attachImageFile:e=>pe.current(e)}),[]),content:w.current,editable:!n,editorProps:{attributes:{"data-slot":`composer-editor`,role:`textbox`,"aria-label":s,"aria-disabled":n?`true`:`false`,dir:`auto`,spellcheck:`false`},handleKeyDown(e,t){return ge.current(t)}},immediatelyRender:!1,onUpdate({editor:e}){me.current(e),he.current(e)},onSelectionUpdate({editor:e}){me.current(e),he.current(e)}}),_e=(0,I.useMemo)(()=>te?l1(te,g,_,a):[],[te,a,_,g]),ve=(0,I.useMemo)(()=>PQ(ne,g,v),[v,ne,g]);(0,I.useEffect)(()=>{A.current=ne},[ne]),(0,I.useEffect)(()=>{j.current=E},[E]),(0,I.useEffect)(()=>{re.current=te},[te]),(0,I.useEffect)(()=>{ne.shortcutsOpen&&(te||ne.reverseSearch!==null||!NQ(ne))&&k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:e)},[te,ne]),(0,I.useEffect)(()=>{le.current=f},[f]),(0,I.useEffect)(()=>{ue.current=u},[u]),(0,I.useEffect)(()=>{de.current=d},[d]),(0,I.useEffect)(()=>{N&&(N.setEditable(!n),N.view.dom.setAttribute(`aria-disabled`,n?`true`:`false`),n&&O(null))},[n,N]),(0,I.useEffect)(()=>{N?.view.dom.setAttribute(`aria-label`,s)},[N,s]),(0,I.useEffect)(()=>{le.current?.(ne,ve),t!==void 0&&(ve?q$(t,d$(ne,ve.persistedPrompt)):T.current===0&&q$(t,null))},[ne,t,ve]),(0,I.useEffect)(()=>{k(e=>e.isTaskRunning===r&&e.queueSubmissions===i?e:{...e,isTaskRunning:r,queueSubmissions:i})},[r,i]),me.current=e=>{if(n)return;let t=w1(e.getJSON(),j.current,g,r,i,h0(e)),a=ae.current,o=oe.current;ae.current=null,oe.current=void 0,k(e=>{let n=o===void 0?M.current:o;M.current=n;let r=e.shortcutsOpen&&NQ(t);return{...t,error:e.error,history:e.history,historyCursor:n,killBuffer:e.killBuffer,reverseSearch:e.reverseSearch,shortcutsOpen:r,selectedRemoteImageId:a}})},he.current=e=>{if(n){O(null);return}let t=I1(e,b);if(!t){O(null);return}if(v.includes(t.trigger)){let e={trigger:t.trigger,query:t.query,selectedIndex:0},n=l1(e,g,_,a);O(t=>n.length===0?null:{...e,selectedIndex:t?.trigger===e.trigger?Math.min(t.selectedIndex,n.length-1):0});return}O(e=>{let n=t.trigger,r={trigger:n,query:t.query,selectedIndex:e?.trigger===n?e.selectedIndex:0},i=l1(r,g,_,a);return{...r,selectedIndex:e?.trigger===n?Math.min(e.selectedIndex,Math.max(i.length-1,0)):0}})};function ye(e){N?.commands.setContent(e),N&&(me.current(N),he.current(N))}function be(e){if(n||!N)return;let t=I1(N,b),r=[{type:`text`,text:`${e.trigger}${e.value}`,marks:[{type:`composerSlashCommand`,attrs:{value:e.value,detail:e.detail}}]},{type:`text`,text:` `}];t&&t.trigger===e.trigger?N.chain().focus().deleteRange({from:t.from,to:t.to}).insertContent(r).run():N.chain().focus().insertContent(r).run(),O(null)}function xe({index:e=re.current?.selectedIndex??0}={}){let t=re.current;if(n||!N||!t)return;let r=l1(t,g,_,a),i=r[e]??r[0];if(!i)return;if(!i.atomic){be(i);return}let o=I1(N,b),s=o?.trigger===t.trigger,c=N.chain().focus();s&&o&&c.deleteRange({from:o.from,to:o.to}),c.insertContent([M1(i),{type:`text`,text:` `}]).run(),O(null)}function Se(){if(n||!N)return;N.commands.focus();let e=v[0];e&&O(t=>t?.trigger===e?null:{trigger:e,query:``,selectedIndex:0})}function Ce(e){return NQ(e)&&e.reverseSearch===null&&re.current===null}function we(){n||k(e=>Ce(e)&&!e.shortcutsOpen?{...e,shortcutsOpen:!0,selectedRemoteImageId:null,error:null}:e)}function P(){k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:e)}function Te(){n||k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:Ce(e)?{...e,shortcutsOpen:!0,selectedRemoteImageId:null,error:null}:e)}function Ee(e){n||!N||!e||N.chain().focus().insertContent(e).run()}function De(e){if(i$(e)===null)return k(t=>({...t,error:`Only image, video, or audio files can be attached: ${e.name||`unnamed file`}`,shortcutsOpen:!1})),O(null),null;let t=crypto.randomUUID();return fe.current.set(t,e),t}function Oe(e,t){let n=De(t);if(n===null)return;let r=Be(),i=r.remoteImages.length+r.imageAttachments.length+1,a=i$(t)??`image`;e.chain().focus().insertContent([F1(n,o$(a,i),a),{type:`text`,text:` `}]).run()}function ke(e){if(!(n||!N))for(let t of e)Oe(N,t)}function Ae(e){n||!N||(fe.current.delete(e),ye(J1(X1(N.getJSON(),e),j.current.length)))}function je(e){if(n||!N)return;let t=[...j.current,{id:N0(`remote-image`,e,Date.now()),url:e}];j.current=t,D(t),ye(J1(N.getJSON(),t.length))}function Me(e){return n||!N?!1:v1(N.view,e,j.current.length,y[0]??`@`,De)}function Ne(e){if(n)return;let t=j.current[e]??A.current.remoteImages[e];t&&(ae.current=t.id,k(e=>({...e,selectedRemoteImageId:t.id,shortcutsOpen:!1})))}function Pe(){n||(ae.current=null,k(e=>e.selectedRemoteImageId?{...e,selectedRemoteImageId:null,shortcutsOpen:!1}:e))}function Fe(e){return A.current.selectedRemoteImageId?e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`Escape`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`?(Pe(),O(null),!0):e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey?(Pe(),!0):!1:!1}function Ie(e){if(n)return e.preventDefault(),!0;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`)return e.preventDefault(),Pe(),O(null),N?.commands.selectAll(),!0;let t=Be(),r=A.current.selectedRemoteImageId;if(!re.current&&e.key===`ArrowUp`){let n=c$({...t,selectedRemoteImageId:r},r);if(n!==null)return e.preventDefault(),Ne(Math.max(0,n-1)),!0;if((N&&g0(N)||t.cursor===0)&&t.remoteImages.length>0)return e.preventDefault(),Ne(t.remoteImages.length-1),!0}if(!re.current&&r&&e.key===`ArrowDown`){e.preventDefault();let n=c$({...t,selectedRemoteImageId:r},r);return n!==null&&n+1<t.remoteImages.length?Ne(n+1):Pe(),!0}return!re.current&&r&&(e.key===`Backspace`||e.key===`Delete`)?(e.preventDefault(),Le(r),!0):(Fe(e),!1)}function Le(e){if(n||!N)return;let t=Be(),r=t.remoteImages.findIndex(t=>t.id===e),i=t.remoteImages.filter(t=>t.id!==e),a=r===-1?null:i[r]??i[r-1]??null;ae.current=a?.id??null,j.current=i,D(i),ye(J1(N.getJSON(),i.length)),k(e=>({...e,remoteImages:i,selectedRemoteImageId:a?.id??null,shortcutsOpen:!1}))}function Re(e){if(n||!N)return;let t=Q1(N.getJSON(),C0(e));N.chain().focus().insertContent(P1({kind:`paste`,label:t,detail:`${C0(e)} chars`,content:e})).run()}function ze(e,t=e,r){n||N?.chain().focus().insertContent(P1({kind:`rich-link`,label:t,detail:e,href:e,metadata:r})).run()}function Be(){return N?{...w1(N.getJSON(),j.current,g,r,i,h0(N)),error:A.current.error,history:A.current.history,historyCursor:M.current??A.current.historyCursor,killBuffer:A.current.killBuffer,reverseSearch:A.current.reverseSearch,shortcutsOpen:A.current.shortcutsOpen,selectedRemoteImageId:A.current.selectedRemoteImageId}:A.current}function Ve(e){let t=ue.current?.(e);return t?(k(e=>({...e,error:t,shortcutsOpen:!1})),O(null),!0):!1}function He(){if(n)return;let e=Be(),r=N?.getJSON()??k1(),i=e.isTaskRunning||e.queueSubmissions,a=i?null:BQ(e.text,g,v);if(a){k(e=>({...e,error:`Unrecognized command: /${a}`,shortcutsOpen:!1})),O(null);return}let s=PQ(e,g,v),c=s??{mode:`submitted`,prompt:``,persistedPrompt:``,historyPrompt:``,action:`Plain`,command:void 0,args:void 0,items:[],elements:[],payloadElements:[],mentionBindings:[]},l=FQ(c,o);if(l){k(e=>({...e,error:l,shortcutsOpen:!1})),O(null);return}let u=new Map,d=[];for(let t of e.imageAttachments){let e=fe.current.get(t.id);if(!e){k(e=>({...e,error:`Attached image is no longer available: ${t.placeholder}`,shortcutsOpen:!1})),O(null);return}u.set(t.id,e),d.push({type:t.media,placeholder:t.placeholder,file:e})}let f=[...c.items.filter(e=>e.type===`remote_image`),...d,...c.items.filter(e=>e.type!==`remote_image`)],p={id:crypto.randomUUID(),at:new Date().toLocaleTimeString(),mode:i?`queued`:c.mode,prompt:c.prompt,persistedPrompt:c.persistedPrompt,action:i?_0(c,v):c.action,command:c.command,args:c.args,items:f};if(Ve(p))return;for(let e of u.keys())fe.current.delete(e);let m=d$(e,c.persistedPrompt),h=de.current?.(p,{editableSource:m});F0(h)&&(T.current+=1,h.then(()=>{t!==void 0&&q$(t,null)}).catch(e=>{for(let[e,t]of u)fe.current.set(e,t);t!==void 0&&q$(t,m),ee.current&&(ye(r),N?.commands.focus(`end`),k(t=>({...t,error:e instanceof Error?e.message:`Could not send prompt`})))}).finally(()=>{--T.current}));let _=s?f$(e,c.historyPrompt):e.history;M.current=null,j.current=[],D([]),O(null),ye(k1()),k(e=>({...e,text:``,cursor:0,elements:[],mentionBindings:[],imageAttachments:[],remoteImages:[],pendingPastes:[],selectedRemoteImageId:null,error:null,shortcutsOpen:!1,history:_,historyCursor:null}))}function Ue(){if(n)return;let e=A.current.history,t=A.current.killBuffer;M.current=null,ce.current=null,fe.current.clear(),j.current=C.current,D(C.current),O(null),ye(w.current),N?.commands.focus(`end`),k(n=>({...n,history:e,historyCursor:null,killBuffer:t,reverseSearch:null,selectedRemoteImageId:null,error:null,shortcutsOpen:!1}))}function We(e){if(n||!N||A.current.history.length===0)return;let t=A.current,r=M.current??t.historyCursor;if(e>0&&r===0&&se.current){Ke(se.current,null),se.current=null;return}let i=r===null?e<0?0:t.history.length-1:M0(r+e,t.history.length);r===null&&(se.current=u$(Be()));let a=t.history[i];Ge(a,i)}function Ge(e,t){Ke(m$({source:e,slashCommands:g,mentionCandidates:_}),t)}function Ke(e,t){let n=e.remoteImages??[];j.current=n,A.current={...A.current,historyCursor:t,shortcutsOpen:!1},M.current=t,oe.current=t,D(n),ye(y1({state:e,slashCommands:g,mentionCandidates:_,triggers:b})),N?.commands.focus(`end`),k(e=>({...e,historyCursor:t,shortcutsOpen:!1}))}function qe(){n||(O(null),M.current=null,ce.current=Be(),k(e=>({...e,reverseSearch:``,historyCursor:null,shortcutsOpen:!1})))}function Je(e){if(n){e.preventDefault();return}if(e.preventDefault(),e.key===`Escape`){Qe(null),ce.current=null;return}if(e.key===`Enter`){ce.current=null,k(e=>({...e,reverseSearch:null,shortcutsOpen:!1}));return}if(e.key===`Backspace`){Ye(e=>e.slice(0,-1));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`r`){Xe(1);return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){Xe(-1);return}e.key.length===1&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&Ye(t=>`${t}${e.key}`)}function Ye(e){if(n)return;let t=A.current,r=e(t.reverseSearch??``),i=O$(t.history,r,null);if(!N||!i){Qe(r);return}Ze(i.entry,i.index,r)}function Xe(e){if(n||!N)return;let t=A.current,r=t.reverseSearch??``,i=O$(t.history,r,t.historyCursor,e);i&&Ze(i.entry,i.index,r)}function Ze(e,t,n){let r=N;if(!r)return;let i=m$({source:e,slashCommands:g,mentionCandidates:_}),a=i.remoteImages??[];j.current=a,D(a),ye(y1({state:i,slashCommands:g,mentionCandidates:_,triggers:b})),r.commands.focus(`end`),k(e=>({...e,historyCursor:t,reverseSearch:n,selectedRemoteImageId:null,shortcutsOpen:!1}))}function Qe(e){if(n)return;let t=ce.current;if(!t||!N){k(t=>({...t,reverseSearch:e,shortcutsOpen:!1}));return}let r={...t,history:A.current.history,killBuffer:A.current.killBuffer,reverseSearch:e,historyCursor:null,selectedRemoteImageId:null,shortcutsOpen:!1};M.current=null,j.current=r.remoteImages,D(r.remoteImages),ye(y1({state:r,slashCommands:g,mentionCandidates:_,triggers:b})),N.commands.focus(`end`),k(r)}ge.current=n?e=>(e.preventDefault(),!0):Ie,pe.current=De;function $e(e){if(!(e.target instanceof Element)||!e.target.closest(`[data-slot="composer-editor"]`))return;if(n){e.preventDefault();return}if(!N||Ie(e))return;if(A.current.reverseSearch!==null){Je(e);return}if(A.current.shortcutsOpen&&e.key===`Escape`){e.preventDefault(),P();return}if(e.key===`?`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&Ce(Be())){e.preventDefault(),Te();return}if(a2(e)){e.preventDefault(),N.chain().focus().setHardBreak().run(),M.current=null,O(null);return}if(re.current){if(v0(e)||y0(e)){e.preventDefault(),tt(v0(e)?-1:1);return}if(e.key===`Tab`){e.preventDefault(),xe();return}if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),_e.length===0){O(null),He();return}xe();return}if(e.key===`Escape`){e.preventDefault(),O(null);return}}if(o2(e)){let t=r0(N);t&&(e.preventDefault(),ie.current=t,k(e=>({...e,killBuffer:t.text}))),M.current=null;return}let t=s2(e);if(t!==null){e.preventDefault(),a0(N,t),M.current=null;return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`e`){e.preventDefault(),i0(N),M.current=null;return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){let t=t0(N);t&&(e.preventDefault(),ie.current=t,k(e=>({...e,killBuffer:t.text})));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`u`){let t=n0(N);t&&(e.preventDefault(),ie.current=t,k(e=>({...e,killBuffer:t.text})));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`y`&&A.current.killBuffer){e.preventDefault(),f0(N,ie.current??A.current.killBuffer);return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`r`){e.preventDefault(),qe();return}if((e.key===`Backspace`||e.key===`Delete`)&&l2(N)){e.preventDefault(),M.current=null,O(null);return}if((e.key===`Backspace`||e.key===`Delete`)&&p0(N,e.key)){e.preventDefault(),M.current=null;return}if((e.key===`Backspace`||e.key===`Delete`||e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey)&&(M.current=null),e.key===`Enter`&&!e.shiftKey&&!e.altKey){e.preventDefault(),He();return}let r=c2(e);if(r!==null&&!re.current){let t=Be();if(e.key===`ArrowUp`&&(g0(N)||t.cursor===0)&&t.remoteImages.length>0){e.preventDefault(),Ne(t.remoteImages.length-1);return}k$(t.text,t.cursor,r)&&(e.preventDefault(),We(r))}}function et(e){if(n){e.preventDefault();return}e.target instanceof Element&&e.target.closest(`[data-slot="composer-editor"]`)&&Pe()}function tt(e){n||O(t=>{if(!t)return t;let n=l1(t,g,_,a).length;return n===0?t:{...t,selectedIndex:M0(t.selectedIndex+e,n)}})}return(0,L.jsx)(cQ,{value:{state:ne,disabled:n,commandTriggers:v,activePopup:te,suggestions:_e,attachedImages:fe.current,actions:{acceptSuggestion:xe,toggleSlashMenu:Se,insertText:Ee,attachImageFiles:ke,removeImageAttachment:Ae,addRemoteImage:je,handleDrop:Me,insertPaste:Re,insertRichLink:ze,openShortcuts:we,closeShortcuts:P,toggleShortcuts:Te,submit:He,reset:Ue},meta:{editor:N}},children:(0,L.jsx)(`section`,{"data-slot":`composer`,className:F(`border-border bg-card relative border font-[inherit]`,c),children:(0,L.jsxs)(`div`,{onKeyDownCapture:$e,onMouseDownCapture:et,children:[l,p.hasLayoutChildren?null:(0,L.jsx)(L0,{})]})})})}function L0(){let e=(0,H.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(U0,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,L.jsxs)(L.Fragment,{children:[t,(0,L.jsxs)(R0,{children:[(0,L.jsx)(B0,{}),(0,L.jsx)(dQ,{}),(0,L.jsx)(V0,{}),(0,L.jsx)(H0,{})]}),(0,L.jsx)(q0,{}),(0,L.jsx)(X0,{})]}),e[1]=n):n=e[1],n}function R0(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`space-y-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function z0(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`flex flex-wrap items-center gap-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B0(e){let t=(0,H.c)(14),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{state:i}=lQ(`Composer.RemoteImages`);if(i.remoteImages.length===0)return null;let a;t[3]===n?a=t[4]:(a=F(`border-border space-y-1 border-b pb-2 text-sm`,n),t[3]=n,t[4]=a);let o;if(t[5]!==i.remoteImages||t[6]!==i.selectedRemoteImageId){let e;t[8]===i.selectedRemoteImageId?e=t[9]:(e=(e,t)=>(0,L.jsxs)(`div`,{className:F(`flex h-6 items-center gap-2 rounded-sm px-2`,i.selectedRemoteImageId===e.id?`bg-primary text-primary-foreground`:`text-sky-500`),children:[(0,L.jsxs)(`span`,{className:`shrink-0`,children:[`[Image #`,t+1,`]`]}),(0,L.jsx)(`span`,{className:`truncate text-xs opacity-70`,children:e.url})]},e.id),t[8]=i.selectedRemoteImageId,t[9]=e),o=i.remoteImages.map(e),t[5]=i.remoteImages,t[6]=i.selectedRemoteImageId,t[7]=o}else o=t[7];let s;return t[10]!==r||t[11]!==a||t[12]!==o?(s=(0,L.jsx)(`div`,{className:a,...r,children:o}),t[10]=r,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function V0(e){let t=(0,H.c)(21),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,onDrop:r,placeholder:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?`Type a message or / for commands`:a,{state:s,disabled:c,meta:l,actions:u}=lQ(`Composer.Editor`),d=c?``:void 0,f;t[5]!==u||t[6]!==r?(f=e=>{r?.(e),!e.defaultPrevented&&u.handleDrop(e.dataTransfer)&&e.preventDefault()},t[5]=u,t[6]=r,t[7]=f):f=t[7];let p;t[8]!==o||t[9]!==s.text.length?(p=s.text.length===0?(0,L.jsx)(`div`,{"data-slot":`composer-placeholder`,children:o}):null,t[8]=o,t[9]=s.text.length,t[10]=p):p=t[10];let m;t[11]===l.editor?m=t[12]:(m=(0,L.jsx)(RW,{editor:l.editor}),t[11]=l.editor,t[12]=m);let h;return t[13]!==n||t[14]!==c||t[15]!==i||t[16]!==d||t[17]!==f||t[18]!==p||t[19]!==m?(h=(0,L.jsxs)(`div`,{"data-slot":`composer-frame`,className:n,"aria-disabled":c,"data-disabled":d,onDrop:f,...i,children:[p,m]}),t[13]=n,t[14]=c,t[15]=i,t[16]=d,t[17]=f,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function H0(e){let t=(0,H.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{state:i}=lQ(`Composer.Error`);if(!i.error)return null;let a;t[3]===n?a=t[4]:(a=F(`border-primary/30 bg-primary/10 text-primary rounded-md border px-3 py-2 text-xs`,n),t[3]=n,t[4]=a);let o;return t[5]!==r||t[6]!==i.error||t[7]!==a?(o=(0,L.jsx)(`div`,{className:a,...r,children:i.error}),t[5]=r,t[6]=i.error,t[7]=a,t[8]=o):o=t[8],o}function U0(e){let t=(0,H.c)(25),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{activePopup:i,suggestions:a,actions:o}=lQ(`Composer.Popup`),{acceptSuggestion:s}=o;if(!i)return null;let c;t[3]===a?c=t[4]:(c=a.some(W0),t[3]=a,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=F(`border-border bg-popover absolute inset-x-0 bottom-[calc(100%+0.5rem)] z-10 rounded-xl border shadow-lg`,n),t[5]=n,t[6]=u);let d;if(t[7]!==s||t[8]!==i||t[9]!==a||t[10]!==l){let e;t[12]!==s||t[13]!==i||t[14]!==l?(e=(e,t)=>(0,L.jsx)(G0,{selected:t===i.selectedIndex,icon:l?e.icon:null,token:jQ(e),takesArgs:e.supportsArgs===!0,description:e.detail,onMouseDown:()=>s({index:t})},`item:${e.id}`),t[12]=s,t[13]=i,t[14]=l,t[15]=e):e=t[15],d=a.map(e),t[7]=s,t[8]=i,t[9]=a,t[10]=l,t[11]=d}else d=t[11];let f;t[16]===a.length?f=t[17]:(f=a.length===0?(0,L.jsx)(`div`,{className:`text-muted-foreground px-2 py-1 text-[13px] leading-4`,children:`no matches`}):null,t[16]=a.length,t[17]=f);let p;t[18]!==d||t[19]!==f?(p=(0,L.jsxs)(`div`,{className:`flex max-h-72 flex-col gap-1 overflow-y-auto p-1`,role:`listbox`,"aria-label":`Suggestions`,children:[d,f]}),t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;return t[21]!==r||t[22]!==u||t[23]!==p?(m=(0,L.jsx)(`div`,{className:u,...r,children:p}),t[21]=r,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function W0(e){return e.icon}function G0(e){let t=(0,H.c)(23),{selected:n,icon:r,token:i,takesArgs:a,description:o,onMouseDown:s}=e,c=(0,I.useRef)(null),l,u;t[0]===n?(l=t[1],u=t[2]):(l=()=>{n&&c.current?.scrollIntoView({block:`nearest`})},u=[n],t[0]=n,t[1]=l,t[2]=u),(0,I.useEffect)(l,u);let d=n?`bg-accent text-foreground`:`text-foreground/80 hover:bg-accent/60`,f;t[3]===d?f=t[4]:(f=F(`flex w-full items-center gap-2 rounded-md px-2 py-1 text-start text-[13px] leading-4 [&_svg]:size-4 [&_svg]:shrink-0`,d),t[3]=d,t[4]=f);let p;t[5]===s?p=t[6]:(p=e=>{e.preventDefault(),s()},t[5]=s,t[6]=p);let m;t[7]===r?m=t[8]:(m=r===null?null:(0,L.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center`,children:r}),t[7]=r,t[8]=m);let h;t[9]===i?h=t[10]:(h=(0,L.jsx)(`span`,{className:`truncate`,children:i}),t[9]=i,t[10]=h);let g;t[11]===a?g=t[12]:(g=a?(0,L.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`args`}):null,t[11]=a,t[12]=g);let _;t[13]===o?_=t[14]:(_=(0,L.jsx)(`span`,{className:`text-muted-foreground truncate`,children:o}),t[13]=o,t[14]=_);let v;return t[15]!==n||t[16]!==f||t[17]!==p||t[18]!==m||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,L.jsxs)(`button`,{ref:c,type:`button`,role:`option`,"aria-selected":n,className:f,onMouseDown:p,children:[m,h,g,_]}),t[15]=n,t[16]=f,t[17]=p,t[18]=m,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var K0=[{title:`Send`,items:[[`Enter`,`send or queue`],[`Shift Enter`,`newline`],[`Alt Enter`,`newline`]]},{title:`Edit`,items:[[`Ctrl K`,`kill to end`],[`Ctrl U`,`kill to start`],[`Ctrl W`,`kill word`],[`Ctrl Y`,`yank`]]},{title:`Navigate`,items:[[`Ctrl P/N`,`history`],[`Ctrl R`,`reverse search`],[`Ctrl E`,`line end`],[`Alt B/F`,`word move`]]}];function q0(e){let t=(0,H.c)(13),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{state:i,actions:a}=lQ(`Composer.Shortcuts`),{closeShortcuts:o}=a;if(!i.shortcutsOpen||!NQ(i))return null;let s;t[3]===n?s=t[4]:(s=F(`border-border bg-popover border-t px-3 py-3 text-xs`,n),t[3]=n,t[4]=s);let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,L.jsx)(`div`,{className:`text-foreground font-medium`,children:`Keyboard shortcuts`}),t[5]=c):c=t[5];let l;t[6]===o?l=t[7]:(l=(0,L.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[c,(0,L.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:bg-muted hover:text-foreground rounded-sm px-2 py-1`,onClick:o,children:`close`})]}),t[6]=o,t[7]=l);let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,L.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:K0.map(J0)}),t[8]=u):u=t[8];let d;return t[9]!==r||t[10]!==s||t[11]!==l?(d=(0,L.jsxs)(`div`,{role:`dialog`,"aria-label":`Keyboard shortcuts`,className:s,...r,children:[l,u]}),t[9]=r,t[10]=s,t[11]=l,t[12]=d):d=t[12],d}function J0(e){return(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(`div`,{className:`text-muted-foreground text-[11px]`,children:e.title}),(0,L.jsx)(`div`,{className:`space-y-1`,children:e.items.map(Y0)})]},e.title)}function Y0(e){let[t,n]=e;return(0,L.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,L.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:t}),(0,L.jsx)(`span`,{className:`text-muted-foreground text-right`,children:n})]},`${t}-${n}`)}function X0(e){let t=(0,H.c)(30),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{activePopup:i,state:a,commandTriggers:o}=lQ(`Composer.Footer`);if(a.reverseSearch!==null){let e;t[3]===n?e=t[4]:(e=F(`border-border text-muted-foreground flex items-center gap-2 border-t px-3 py-2 text-[11px]`,n),t[3]=n,t[4]=e);let i,o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,L.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:`Ctrl R`}),o=(0,L.jsx)(`span`,{children:`reverse-i-search:`}),t[5]=i,t[6]=o):(i=t[5],o=t[6]);let s=a.reverseSearch||`_`,c;t[7]===s?c=t[8]:(c=(0,L.jsx)(`span`,{className:`text-foreground`,children:s}),t[7]=s,t[8]=c);let l,u,d,f;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,L.jsx)(`span`,{children:`Ctrl R previous`}),u=(0,L.jsx)(`span`,{children:`Ctrl S next`}),d=(0,L.jsx)(`span`,{children:`Enter accept`}),f=(0,L.jsx)(`span`,{children:`Esc cancel`}),t[9]=l,t[10]=u,t[11]=d,t[12]=f):(l=t[9],u=t[10],d=t[11],f=t[12]);let p;return t[13]!==r||t[14]!==e||t[15]!==c?(p=(0,L.jsxs)(`div`,{className:e,...r,children:[i,o,c,l,u,d,f]}),t[13]=r,t[14]=e,t[15]=c,t[16]=p):p=t[16],p}let s;t[17]!==i||t[18]!==o||t[19]!==a.isTaskRunning||t[20]!==a.queueSubmissions?(s=i!==null&&o.includes(i.trigger)||i?[[`Enter`,`insert`],[`Tab`,`insert`],[`Esc`,`dismiss`]]:[[`Enter`,a.isTaskRunning||a.queueSubmissions?`queue`:`send`],[`Shift Enter`,`newline`],[`Alt Enter`,`newline`],[`Ctrl J/M`,`newline`],[`Ctrl P/N`,`history`],[`Ctrl E`,`line end`],[`Ctrl K`,`kill`],[`Ctrl U`,`kill back`],[`Ctrl W`,`word kill`],[`Alt B/F`,`word move`],[`Ctrl Y`,`yank`]],t[17]=i,t[18]=o,t[19]=a.isTaskRunning,t[20]=a.queueSubmissions,t[21]=s):s=t[21];let c=s,l;t[22]===n?l=t[23]:(l=F(`border-border text-muted-foreground flex flex-wrap items-center gap-x-4 gap-y-1 border-t px-3 py-2 text-[11px]`,n),t[22]=n,t[23]=l);let u;t[24]===c?u=t[25]:(u=c.map(Z0),t[24]=c,t[25]=u);let d;return t[26]!==r||t[27]!==l||t[28]!==u?(d=(0,L.jsx)(`div`,{className:l,...r,children:u}),t[26]=r,t[27]=l,t[28]=u,t[29]=d):d=t[29],d}function Z0(e){let[t,n]=e;return(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,L.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:t}),n]},`${t}-${n}`)}function Q0(e){let t=(0,H.c)(19),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({accept:i,multiple:a,disabled:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=i===void 0?`image/*,video/*,audio/*`:i,s=a===void 0||a,{actions:c,disabled:l}=lQ(`Composer.AttachFiles`),u=(0,I.useRef)(null),d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>u.current?.click(),t[5]=d):d=t[5];let f;t[6]!==n||t[7]!==r?(f=(0,L.jsx)(i2,{action:d,disabled:n,...r}),t[6]=n,t[7]=r,t[8]=f):f=t[8];let p=l||n,m;t[9]===c?m=t[10]:(m=e=>{let t=e.currentTarget;t.files&&c.attachImageFiles(t.files),t.value=``},t[9]=c,t[10]=m);let h;t[11]!==o||t[12]!==s||t[13]!==p||t[14]!==m?(h=(0,L.jsx)(`input`,{ref:u,type:`file`,accept:o,multiple:s,"aria-label":`Attach media files`,hidden:!0,disabled:p,onChange:m}),t[11]=o,t[12]=s,t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==f||t[17]!==h?(g=(0,L.jsxs)(L.Fragment,{children:[f,h]}),t[16]=f,t[17]=h,t[18]=g):g=t[18],g}function $0(e){let t=(0,H.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({url:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let{actions:i}=lQ(`Composer.AddRemoteImage`),a;t[3]!==i||t[4]!==r?(a=()=>i.addRemoteImage(r),t[3]=i,t[4]=r,t[5]=a):a=t[5];let o;return t[6]!==n||t[7]!==a?(o=(0,L.jsx)(i2,{action:a,...n}),t[6]=n,t[7]=a,t[8]=o):o=t[8],o}function e2(e){let t=(0,H.c)(9),n,r;t[0]===e?(n=t[1],r=t[2]):({content:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let{actions:i}=lQ(`Composer.InsertPaste`),a;t[3]!==i||t[4]!==n?(a=()=>i.insertPaste(n),t[3]=i,t[4]=n,t[5]=a):a=t[5];let o;return t[6]!==r||t[7]!==a?(o=(0,L.jsx)(i2,{action:a,...r}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function t2(e){let t=(0,H.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({href:n,label:r,metadata:i,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{actions:o}=lQ(`Composer.InsertRichLink`),s;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==i?(s=()=>o.insertRichLink(n,r,i),t[5]=o,t[6]=n,t[7]=r,t[8]=i,t[9]=s):s=t[9];let c;return t[10]!==a||t[11]!==s?(c=(0,L.jsx)(i2,{action:s,...a}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function n2(e){let t=(0,H.c)(3),{actions:n}=lQ(`Composer.Submit`),r;return t[0]!==n.submit||t[1]!==e?(r=(0,L.jsx)(i2,{action:n.submit,...e}),t[0]=n.submit,t[1]=e,t[2]=r):r=t[2],r}function r2(e){let t=(0,H.c)(3),{actions:n}=lQ(`Composer.Reset`),r;return t[0]!==n.reset||t[1]!==e?(r=(0,L.jsx)(i2,{action:n.reset,...e}),t[0]=n.reset,t[1]=e,t[2]=r):r=t[2],r}function i2(e){let t=(0,H.c)(12),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({action:n,onClick:i,disabled:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let{disabled:o}=lQ(`Composer.ActionTrigger`),s=o||r,c;t[5]!==n||t[6]!==i?(c=e=>{i?.(e),e.defaultPrevented||n()},t[5]=n,t[6]=i,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==s||t[10]!==c?(l=(0,L.jsx)(D,{...a,disabled:s,onClick:c}),t[8]=a,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function a2(e){if(e.metaKey)return!1;if(e.key===`Enter`)return e.altKey&&!e.ctrlKey;let t=e.key.toLowerCase();return e.ctrlKey&&!e.altKey&&(t===`j`||t===`m`)}function o2(e){if(e.metaKey)return!1;if(e.key===`Backspace`)return e.ctrlKey||e.altKey;let t=e.key.toLowerCase();return e.ctrlKey&&!e.altKey&&t===`w`||e.ctrlKey&&e.altKey&&t===`h`}function s2(e){if(e.metaKey||e.shiftKey)return null;if(e.key===`ArrowLeft`&&(e.altKey||e.ctrlKey))return-1;if(e.key===`ArrowRight`&&(e.altKey||e.ctrlKey))return 1;if(!e.altKey||e.ctrlKey)return null;let t=e.key.toLowerCase();return t===`b`?-1:t===`f`?1:null}function c2(e){if(e.key===`ArrowUp`)return-1;if(e.key===`ArrowDown`)return 1;if(e.metaKey||e.altKey||e.shiftKey||!e.ctrlKey)return null;let t=e.key.toLowerCase();return t===`p`?-1:t===`n`?1:null}function l2(e){let{doc:t,selection:n}=e.state;return n.empty||n.from>1||n.to<t.content.size-1?!1:(e.commands.setContent(k1(),{emitUpdate:!0}),e.commands.focus(`start`),e.commands.setTextSelection(1),!0)}var u2={Root:P0,Trigger:e1,Command:t1,Mention:n1,Content:R0,Toolbar:z0,RemoteImages:B0,Attachments:dQ,Editor:V0,Error:H0,Popup:U0,Shortcuts:q0,Footer:X0,AttachFiles:Q0,AddRemoteImage:$0,InsertPaste:e2,InsertRichLink:t2,Submit:n2,Reset:r2};function d2(e,t){if(!t||t.isCollapsed||t.rangeCount===0)return null;let n=t.getRangeAt(0);if(!e.contains(n.commonAncestorContainer))return null;let r=n.cloneContents();for(let e of r.querySelectorAll(`[data-persisted-source]`)){let t=e.getAttribute(`data-persisted-source`);t!==null&&e.replaceWith(t)}return r.textContent??``}function f2(e){let t=(0,H.c)(6),{text:n}=e,r,i;if(t[0]!==n){let e=zA(n);r=h2,i=e.map(p2),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,L.jsx)(`span`,{onCopy:r,children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function p2(e){switch(e.kind){case`text`:return e.value;case`inline-code`:return(0,L.jsx)(`code`,{"data-persisted-source":e.source,className:`bg-muted rounded px-1 py-0.5 font-mono text-[0.9em]`,children:e.value},e.start);case`code-block`:return(0,L.jsx)(`span`,{"data-persisted-source":e.source,className:`bg-muted my-2 block overflow-x-auto rounded-md px-3 py-2`,children:(0,L.jsx)(`code`,{className:`font-mono text-[0.9em]`,children:e.value})},e.start);case`skill-link`:return(0,L.jsx)(m2,{name:e.name,source:e.source,skillId:e.skillId,title:e.href},e.start);case`standalone-skill`:return(0,L.jsx)(m2,{name:e.name,source:e.source},e.start);case`mention`:return(0,L.jsx)(`span`,{"data-token":`mention`,"data-persisted-source":e.source,className:`bg-foreground/10 rounded-sm px-0.5 font-medium`,children:e.label},e.start);case`link`:return/^(?:https?:|mailto:)/.test(e.href)?(0,L.jsx)(`a`,{href:e.href,"data-persisted-source":e.source,className:`text-primary underline underline-offset-2`,target:`_blank`,rel:`noreferrer`,children:e.label},e.start):e.source}}function m2(e){let t=(0,H.c)(9),{name:n,source:r,skillId:i,title:a}=e,o=i?void 0:n,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(an,{"aria-hidden":`true`,className:`size-3.5 self-center`}),t[0]=s):s=t[0];let c;t[1]===n?c=t[2]:(c=(0,L.jsx)(`span`,{children:n}),t[1]=n,t[2]=c);let l;return t[3]!==i||t[4]!==r||t[5]!==o||t[6]!==c||t[7]!==a?(l=(0,L.jsxs)(`span`,{"data-skill-id":i,"data-skill-name":o,"data-persisted-source":r,title:a,className:`text-primary inline-flex items-baseline gap-1`,children:[s,c]}),t[3]=i,t[4]=r,t[5]=o,t[6]=c,t[7]=a,t[8]=l):l=t[8],l}function h2(e){let t=d2(e.currentTarget,window.getSelection());t!==null&&(e.clipboardData.setData(`text/plain`,t),e.preventDefault())}function g2(e){if(!e)return{};let t={...e};return delete t.whenNullish,delete t.locale,t}function _2(e,t){return e==null||Number.isNaN(e)?t?.whenNullish??`—`:new Intl.NumberFormat(t?.locale??`en-US`,g2(t)).format(e)}function v2(e,t){return _2(e,{notation:`compact`,maximumFractionDigits:1,...t})}var Q;(function(e){e[e.NONE=0]=`NONE`,e[e._abstract=1]=`_abstract`,e[e._accessor=2]=`_accessor`,e[e._as=3]=`_as`,e[e._assert=4]=`_assert`,e[e._asserts=5]=`_asserts`,e[e._async=6]=`_async`,e[e._await=7]=`_await`,e[e._checks=8]=`_checks`,e[e._constructor=9]=`_constructor`,e[e._declare=10]=`_declare`,e[e._enum=11]=`_enum`,e[e._exports=12]=`_exports`,e[e._from=13]=`_from`,e[e._get=14]=`_get`,e[e._global=15]=`_global`,e[e._implements=16]=`_implements`,e[e._infer=17]=`_infer`,e[e._interface=18]=`_interface`,e[e._is=19]=`_is`,e[e._keyof=20]=`_keyof`,e[e._mixins=21]=`_mixins`,e[e._module=22]=`_module`,e[e._namespace=23]=`_namespace`,e[e._of=24]=`_of`,e[e._opaque=25]=`_opaque`,e[e._out=26]=`_out`,e[e._override=27]=`_override`,e[e._private=28]=`_private`,e[e._protected=29]=`_protected`,e[e._proto=30]=`_proto`,e[e._public=31]=`_public`,e[e._readonly=32]=`_readonly`,e[e._require=33]=`_require`,e[e._satisfies=34]=`_satisfies`,e[e._set=35]=`_set`,e[e._static=36]=`_static`,e[e._symbol=37]=`_symbol`,e[e._type=38]=`_type`,e[e._unique=39]=`_unique`,e[e._using=40]=`_using`})(Q||={});var $;(function(e){e[e.PRECEDENCE_MASK=15]=`PRECEDENCE_MASK`,e[e.IS_KEYWORD=16]=`IS_KEYWORD`,e[e.IS_ASSIGN=32]=`IS_ASSIGN`,e[e.IS_RIGHT_ASSOCIATIVE=64]=`IS_RIGHT_ASSOCIATIVE`,e[e.IS_PREFIX=128]=`IS_PREFIX`,e[e.IS_POSTFIX=256]=`IS_POSTFIX`,e[e.IS_EXPRESSION_START=512]=`IS_EXPRESSION_START`,e[e.num=512]=`num`,e[e.bigint=1536]=`bigint`,e[e.decimal=2560]=`decimal`,e[e.regexp=3584]=`regexp`,e[e.string=4608]=`string`,e[e.name=5632]=`name`,e[e.eof=6144]=`eof`,e[e.bracketL=7680]=`bracketL`,e[e.bracketR=8192]=`bracketR`,e[e.braceL=9728]=`braceL`,e[e.braceBarL=10752]=`braceBarL`,e[e.braceR=11264]=`braceR`,e[e.braceBarR=12288]=`braceBarR`,e[e.parenL=13824]=`parenL`,e[e.parenR=14336]=`parenR`,e[e.comma=15360]=`comma`,e[e.semi=16384]=`semi`,e[e.colon=17408]=`colon`,e[e.doubleColon=18432]=`doubleColon`,e[e.dot=19456]=`dot`,e[e.question=20480]=`question`,e[e.questionDot=21504]=`questionDot`,e[e.arrow=22528]=`arrow`,e[e.template=23552]=`template`,e[e.ellipsis=24576]=`ellipsis`,e[e.backQuote=25600]=`backQuote`,e[e.dollarBraceL=27136]=`dollarBraceL`,e[e.at=27648]=`at`,e[e.hash=29184]=`hash`,e[e.eq=29728]=`eq`,e[e.assign=30752]=`assign`,e[e.preIncDec=32640]=`preIncDec`,e[e.postIncDec=33664]=`postIncDec`,e[e.bang=34432]=`bang`,e[e.tilde=35456]=`tilde`,e[e.pipeline=35841]=`pipeline`,e[e.nullishCoalescing=36866]=`nullishCoalescing`,e[e.logicalOR=37890]=`logicalOR`,e[e.logicalAND=38915]=`logicalAND`,e[e.bitwiseOR=39940]=`bitwiseOR`,e[e.bitwiseXOR=40965]=`bitwiseXOR`,e[e.bitwiseAND=41990]=`bitwiseAND`,e[e.equality=43015]=`equality`,e[e.lessThan=44040]=`lessThan`,e[e.greaterThan=45064]=`greaterThan`,e[e.relationalOrEqual=46088]=`relationalOrEqual`,e[e.bitShiftL=47113]=`bitShiftL`,e[e.bitShiftR=48137]=`bitShiftR`,e[e.plus=49802]=`plus`,e[e.minus=50826]=`minus`,e[e.modulo=51723]=`modulo`,e[e.star=52235]=`star`,e[e.slash=53259]=`slash`,e[e.exponent=54348]=`exponent`,e[e.jsxName=55296]=`jsxName`,e[e.jsxText=56320]=`jsxText`,e[e.jsxEmptyText=57344]=`jsxEmptyText`,e[e.jsxTagStart=58880]=`jsxTagStart`,e[e.jsxTagEnd=59392]=`jsxTagEnd`,e[e.typeParameterStart=60928]=`typeParameterStart`,e[e.nonNullAssertion=61440]=`nonNullAssertion`,e[e._break=62480]=`_break`,e[e._case=63504]=`_case`,e[e._catch=64528]=`_catch`,e[e._continue=65552]=`_continue`,e[e._debugger=66576]=`_debugger`,e[e._default=67600]=`_default`,e[e._do=68624]=`_do`,e[e._else=69648]=`_else`,e[e._finally=70672]=`_finally`,e[e._for=71696]=`_for`,e[e._function=73232]=`_function`,e[e._if=73744]=`_if`,e[e._return=74768]=`_return`,e[e._switch=75792]=`_switch`,e[e._throw=77456]=`_throw`,e[e._try=77840]=`_try`,e[e._var=78864]=`_var`,e[e._let=79888]=`_let`,e[e._const=80912]=`_const`,e[e._while=81936]=`_while`,e[e._with=82960]=`_with`,e[e._new=84496]=`_new`,e[e._this=85520]=`_this`,e[e._super=86544]=`_super`,e[e._class=87568]=`_class`,e[e._extends=88080]=`_extends`,e[e._export=89104]=`_export`,e[e._import=90640]=`_import`,e[e._yield=91664]=`_yield`,e[e._null=92688]=`_null`,e[e._true=93712]=`_true`,e[e._false=94736]=`_false`,e[e._in=95256]=`_in`,e[e._instanceof=96280]=`_instanceof`,e[e._typeof=97936]=`_typeof`,e[e._void=98960]=`_void`,e[e._delete=99984]=`_delete`,e[e._async=100880]=`_async`,e[e._get=101904]=`_get`,e[e._set=102928]=`_set`,e[e._declare=103952]=`_declare`,e[e._readonly=104976]=`_readonly`,e[e._abstract=106e3]=`_abstract`,e[e._static=107024]=`_static`,e[e._public=107536]=`_public`,e[e._private=108560]=`_private`,e[e._protected=109584]=`_protected`,e[e._override=110608]=`_override`,e[e._as=112144]=`_as`,e[e._enum=113168]=`_enum`,e[e._type=114192]=`_type`,e[e._implements=115216]=`_implements`})($||={});var y2;(function(e){e[e.backSpace=8]=`backSpace`,e[e.lineFeed=10]=`lineFeed`,e[e.tab=9]=`tab`,e[e.carriageReturn=13]=`carriageReturn`,e[e.shiftOut=14]=`shiftOut`,e[e.space=32]=`space`,e[e.exclamationMark=33]=`exclamationMark`,e[e.quotationMark=34]=`quotationMark`,e[e.numberSign=35]=`numberSign`,e[e.dollarSign=36]=`dollarSign`,e[e.percentSign=37]=`percentSign`,e[e.ampersand=38]=`ampersand`,e[e.apostrophe=39]=`apostrophe`,e[e.leftParenthesis=40]=`leftParenthesis`,e[e.rightParenthesis=41]=`rightParenthesis`,e[e.asterisk=42]=`asterisk`,e[e.plusSign=43]=`plusSign`,e[e.comma=44]=`comma`,e[e.dash=45]=`dash`,e[e.dot=46]=`dot`,e[e.slash=47]=`slash`,e[e.digit0=48]=`digit0`,e[e.digit1=49]=`digit1`,e[e.digit2=50]=`digit2`,e[e.digit3=51]=`digit3`,e[e.digit4=52]=`digit4`,e[e.digit5=53]=`digit5`,e[e.digit6=54]=`digit6`,e[e.digit7=55]=`digit7`,e[e.digit8=56]=`digit8`,e[e.digit9=57]=`digit9`,e[e.colon=58]=`colon`,e[e.semicolon=59]=`semicolon`,e[e.lessThan=60]=`lessThan`,e[e.equalsTo=61]=`equalsTo`,e[e.greaterThan=62]=`greaterThan`,e[e.questionMark=63]=`questionMark`,e[e.atSign=64]=`atSign`,e[e.uppercaseA=65]=`uppercaseA`,e[e.uppercaseB=66]=`uppercaseB`,e[e.uppercaseC=67]=`uppercaseC`,e[e.uppercaseD=68]=`uppercaseD`,e[e.uppercaseE=69]=`uppercaseE`,e[e.uppercaseF=70]=`uppercaseF`,e[e.uppercaseG=71]=`uppercaseG`,e[e.uppercaseH=72]=`uppercaseH`,e[e.uppercaseI=73]=`uppercaseI`,e[e.uppercaseJ=74]=`uppercaseJ`,e[e.uppercaseK=75]=`uppercaseK`,e[e.uppercaseL=76]=`uppercaseL`,e[e.uppercaseM=77]=`uppercaseM`,e[e.uppercaseN=78]=`uppercaseN`,e[e.uppercaseO=79]=`uppercaseO`,e[e.uppercaseP=80]=`uppercaseP`,e[e.uppercaseQ=81]=`uppercaseQ`,e[e.uppercaseR=82]=`uppercaseR`,e[e.uppercaseS=83]=`uppercaseS`,e[e.uppercaseT=84]=`uppercaseT`,e[e.uppercaseU=85]=`uppercaseU`,e[e.uppercaseV=86]=`uppercaseV`,e[e.uppercaseW=87]=`uppercaseW`,e[e.uppercaseX=88]=`uppercaseX`,e[e.uppercaseY=89]=`uppercaseY`,e[e.uppercaseZ=90]=`uppercaseZ`,e[e.leftSquareBracket=91]=`leftSquareBracket`,e[e.backslash=92]=`backslash`,e[e.rightSquareBracket=93]=`rightSquareBracket`,e[e.caret=94]=`caret`,e[e.underscore=95]=`underscore`,e[e.graveAccent=96]=`graveAccent`,e[e.lowercaseA=97]=`lowercaseA`,e[e.lowercaseB=98]=`lowercaseB`,e[e.lowercaseC=99]=`lowercaseC`,e[e.lowercaseD=100]=`lowercaseD`,e[e.lowercaseE=101]=`lowercaseE`,e[e.lowercaseF=102]=`lowercaseF`,e[e.lowercaseG=103]=`lowercaseG`,e[e.lowercaseH=104]=`lowercaseH`,e[e.lowercaseI=105]=`lowercaseI`,e[e.lowercaseJ=106]=`lowercaseJ`,e[e.lowercaseK=107]=`lowercaseK`,e[e.lowercaseL=108]=`lowercaseL`,e[e.lowercaseM=109]=`lowercaseM`,e[e.lowercaseN=110]=`lowercaseN`,e[e.lowercaseO=111]=`lowercaseO`,e[e.lowercaseP=112]=`lowercaseP`,e[e.lowercaseQ=113]=`lowercaseQ`,e[e.lowercaseR=114]=`lowercaseR`,e[e.lowercaseS=115]=`lowercaseS`,e[e.lowercaseT=116]=`lowercaseT`,e[e.lowercaseU=117]=`lowercaseU`,e[e.lowercaseV=118]=`lowercaseV`,e[e.lowercaseW=119]=`lowercaseW`,e[e.lowercaseX=120]=`lowercaseX`,e[e.lowercaseY=121]=`lowercaseY`,e[e.lowercaseZ=122]=`lowercaseZ`,e[e.leftCurlyBrace=123]=`leftCurlyBrace`,e[e.verticalBar=124]=`verticalBar`,e[e.rightCurlyBrace=125]=`rightCurlyBrace`,e[e.tilde=126]=`tilde`,e[e.nonBreakingSpace=160]=`nonBreakingSpace`,e[e.oghamSpaceMark=5760]=`oghamSpaceMark`,e[e.lineSeparator=8232]=`lineSeparator`,e[e.paragraphSeparator=8233]=`paragraphSeparator`})(y2||={});var b2=[9,11,12,y2.space,y2.nonBreakingSpace,y2.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],x2=new Uint8Array(65536);for(let e of b2)x2[e]=1;function S2(e){if(e<48)return e===36;if(e<58)return!0;if(e<65)return!1;if(e<91)return!0;if(e<97)return e===95;if(e<123)return!0;if(e<128)return!1;throw Error(`Should not be called with non-ASCII char code.`)}var C2=new Uint8Array(65536);for(let e=0;e<128;e++)C2[e]=+!!S2(e);for(let e=128;e<65536;e++)C2[e]=1;for(let e of b2)C2[e]=0;C2[8232]=0,C2[8233]=0;var w2=C2.slice();for(let e=y2.digit0;e<=y2.digit9;e++)w2[e]=0;new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,Q._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,324,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,351,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,378,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,405,-1,-1,-1,-1,-1,-1,-1,-1,Q._accessor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._as<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,459,-1,-1,-1,-1,-1,594,-1,-1,-1,-1,-1,-1,486,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,513,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,540,-1,-1,-1,-1,-1,-1,Q._assert<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,567,-1,-1,-1,-1,-1,-1,-1,Q._asserts<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,621,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,648,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._async<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,702,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,729,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,756,-1,-1,-1,-1,-1,-1,Q._await<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,810,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,837,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,864,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,891,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._break<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,945,-1,-1,-1,-1,-1,-1,1107,-1,-1,-1,1242,-1,-1,1350,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,972,1026,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,999,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._case<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1053,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1080,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._catch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1134,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1161,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1188,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1215,-1,-1,-1,-1,-1,-1,-1,Q._checks<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1269,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1296,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1323,-1,-1,-1,-1,-1,-1,-1,($._class<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1377,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1404,1620,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1431,-1,-1,-1,-1,-1,-1,($._const<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1458,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1485,-1,-1,-1,-1,-1,-1,-1,-1,1512,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1539,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1566,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1593,-1,-1,-1,-1,-1,-1,-1,-1,Q._constructor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1647,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1674,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1701,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1728,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._continue<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1782,-1,-1,-1,-1,-1,-1,-1,-1,-1,2349,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1809,1971,-1,-1,2106,-1,-1,-1,-1,-1,2241,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1836,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1863,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1890,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1917,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1944,-1,-1,-1,-1,-1,-1,-1,-1,($._debugger<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1998,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2025,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2052,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2079,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._declare<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2133,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2160,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2187,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2214,-1,-1,-1,-1,-1,-1,($._default<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2268,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2295,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2322,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._delete<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._do<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2403,-1,2484,-1,-1,-1,-1,-1,-1,-1,-1,-1,2565,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2430,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2457,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._else<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2511,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2538,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._enum<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2592,-1,-1,-1,2727,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2619,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2646,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2673,-1,-1,-1,-1,-1,-1,($._export<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2700,-1,-1,-1,-1,-1,-1,-1,Q._exports<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2754,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2781,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2808,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2835,-1,-1,-1,-1,-1,-1,-1,($._extends<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2889,-1,-1,-1,-1,-1,-1,-1,2997,-1,-1,-1,-1,-1,3159,-1,-1,3213,-1,-1,3294,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2916,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2943,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2970,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._false<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3024,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3051,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3078,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3105,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3132,-1,($._finally<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3186,-1,-1,-1,-1,-1,-1,-1,-1,($._for<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3240,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3267,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._from<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3321,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3348,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3375,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3402,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3429,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3456,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._function<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3510,-1,-1,-1,-1,-1,-1,3564,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3537,-1,-1,-1,-1,-1,-1,Q._get<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3591,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3618,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3645,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3672,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._global<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3726,-1,-1,-1,-1,-1,-1,3753,4077,-1,-1,-1,-1,4590,-1,-1,-1,-1,-1,-1,-1,($._if<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3780,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3807,-1,-1,3996,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3834,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3861,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3888,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3915,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3942,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3969,-1,-1,-1,-1,-1,-1,-1,Q._implements<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4023,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4050,-1,-1,-1,-1,-1,-1,($._import<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._in<<1)+1,-1,-1,-1,-1,-1,4104,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4185,4401,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4131,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4158,-1,-1,-1,-1,-1,-1,-1,-1,Q._infer<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4212,-1,-1,-1,-1,-1,-1,-1,4239,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4266,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4293,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4320,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4347,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4374,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._instanceof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4428,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4455,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4482,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4509,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4536,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4563,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._interface<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._is<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4644,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4671,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4698,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4725,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._keyof<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4779,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4806,-1,-1,-1,-1,-1,-1,($._let<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4860,-1,-1,-1,-1,-1,4995,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4887,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4914,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4941,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4968,-1,-1,-1,-1,-1,-1,-1,Q._mixins<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5022,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5049,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5076,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5103,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._module<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5157,-1,-1,-1,5373,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5427,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5184,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5211,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5238,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5265,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5292,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5319,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5346,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._namespace<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5400,-1,-1,-1,($._new<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5454,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5481,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._null<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5535,-1,-1,-1,-1,-1,-1,-1,-1,-1,5562,-1,-1,-1,-1,5697,5751,-1,-1,-1,-1,Q._of<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5589,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5616,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5643,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5670,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._opaque<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5724,-1,-1,-1,-1,-1,-1,Q._out<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5778,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5805,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5832,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5859,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5886,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5913,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._override<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5967,-1,-1,6345,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5994,-1,-1,-1,-1,-1,6129,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6021,-1,-1,-1,-1,-1,6048,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6075,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6102,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._private<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6156,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6183,-1,-1,-1,-1,-1,-1,-1,-1,-1,6318,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6210,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6237,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6264,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6291,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._protected<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._proto<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6372,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6399,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6426,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6453,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._public<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6507,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6534,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6696,-1,-1,6831,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6561,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6588,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6615,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6642,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6669,-1,Q._readonly<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6723,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6750,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6777,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6804,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._require<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6858,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6885,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6912,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._return<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6966,-1,-1,-1,7182,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7236,7371,-1,7479,-1,7614,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6993,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7047,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7074,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7101,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7128,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7155,-1,-1,-1,-1,-1,-1,-1,Q._satisfies<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7209,-1,-1,-1,-1,-1,-1,Q._set<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7263,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7290,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7317,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7344,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._static<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7398,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7425,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7452,-1,-1,-1,-1,-1,-1,-1,-1,($._super<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7506,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7533,-1,-1,-1,-1,-1,-1,-1,-1,-1,7560,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7587,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._switch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7641,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7668,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7695,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7722,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._symbol<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7776,-1,-1,-1,-1,-1,-1,-1,-1,-1,7938,-1,-1,-1,-1,-1,-1,8046,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7803,-1,-1,-1,-1,-1,-1,-1,-1,7857,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7830,-1,-1,-1,-1,-1,-1,-1,($._this<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7884,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7911,-1,-1,-1,($._throw<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7965,-1,-1,-1,8019,-1,-1,-1,-1,-1,-1,7992,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._true<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._try<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8073,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._type<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8127,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8154,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._typeof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8208,-1,-1,-1,-1,8343,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8235,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8262,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8289,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8316,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._unique<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8370,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8397,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8424,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,Q._using<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8478,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8532,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8505,-1,-1,-1,-1,-1,-1,-1,-1,($._var<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8559,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8586,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._void<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8640,8748,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8667,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8694,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8721,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._while<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8775,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8802,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._with<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,($._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);var T2;(function(e){e[e.Access=0]=`Access`,e[e.ExportAccess=1]=`ExportAccess`,e[e.TopLevelDeclaration=2]=`TopLevelDeclaration`,e[e.FunctionScopedDeclaration=3]=`FunctionScopedDeclaration`,e[e.BlockScopedDeclaration=4]=`BlockScopedDeclaration`,e[e.ObjectShorthandTopLevelDeclaration=5]=`ObjectShorthandTopLevelDeclaration`,e[e.ObjectShorthandFunctionScopedDeclaration=6]=`ObjectShorthandFunctionScopedDeclaration`,e[e.ObjectShorthandBlockScopedDeclaration=7]=`ObjectShorthandBlockScopedDeclaration`,e[e.ObjectShorthand=8]=`ObjectShorthand`,e[e.ImportDeclaration=9]=`ImportDeclaration`,e[e.ObjectKey=10]=`ObjectKey`,e[e.ImportAccess=11]=`ImportAccess`})(T2||={});var E2;(function(e){e[e.NoChildren=0]=`NoChildren`,e[e.OneChild=1]=`OneChild`,e[e.StaticChildren=2]=`StaticChildren`,e[e.KeyAfterPropSpread=3]=`KeyAfterPropSpread`})(E2||={});var D2=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,O2=new Uint8Array(64),k2=new Uint8Array(128);for(let e=0;e<D2.length;e++){let t=D2.charCodeAt(e);O2[e]=t,k2[t]=e}a(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=r())})(e,(function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path===`/`?e.path=t.path:e.path=f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];if(!t){o=!0;continue}if(o=!1,t!==`.`){if(t===`..`){a?(o=!0,a--,i--):n&&(r[i++]=t);continue}r[i++]=t,a++}}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))}))();var A2=a((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.DetailContext=e.NoopContext=e.VError=void 0;var n=function(e){t(n,e);function n(t,r){var i=e.call(this,r)||this;return i.path=t,Object.setPrototypeOf(i,n.prototype),i}return n}(Error);e.VError=n,e.NoopContext=function(){function e(){}return e.prototype.fail=function(e,t,n){return!1},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(e){},e}();var r=function(){function e(){this._propNames=[``],this._messages=[null],this._score=0}return e.prototype.fail=function(e,t,n){return this._propNames.push(e),this._messages.push(t),this._score+=n,!1},e.prototype.unionResolver=function(){return new i},e.prototype.resolveUnion=function(e){for(var t,n,r=e,i=null,a=0,o=r.contexts;a<o.length;a++){var s=o[a];(!i||s._score>=i._score)&&(i=s)}i&&i._score>0&&((t=this._propNames).push.apply(t,i._propNames),(n=this._messages).push.apply(n,i._messages))},e.prototype.getError=function(e){for(var t=[],r=this._propNames.length-1;r>=0;r--){var i=this._propNames[r];e+=typeof i==`number`?`[`+i+`]`:i?`.`+i:``;var a=this._messages[r];a&&t.push(e+` `+a)}return new n(e,t.join(`; `))},e.prototype.getErrorDetail=function(e){for(var t=[],n=this._propNames.length-1;n>=0;n--){var r=this._propNames[n];e+=typeof r==`number`?`[`+r+`]`:r?`.`+r:``;var i=this._messages[n];i&&t.push({path:e,message:i})}for(var a=null,n=t.length-1;n>=0;n--)a&&(t[n].nested=[a]),a=t[n];return a},e}();e.DetailContext=r;var i=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var e=new r;return this.contexts.push(e),e},e}()})),j2=a((e=>{var t=e&&e.__extends||(function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})();Object.defineProperty(e,"__esModule",{value:!0}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var n=A2(),r=function(){function e(){}return e}();e.TType=r;function i(e){return typeof e==`string`?o(e):e}function a(e,t){var n=e[t];if(!n)throw Error(`Unknown type `+t);return n}function o(e){return new s(e)}e.name=o;var s=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.name=t,n._failMsg=`is not a `+t,n}return n.prototype.getChecker=function(e,t,r){var i=this,o=a(e,this.name),s=o.getChecker(e,t,r);return o instanceof j||o instanceof n?s:function(e,t){return s(e,t)?!0:t.fail(null,i._failMsg,0)}},n}(r);e.TName=s;function c(e){return new l(e)}e.lit=c;var l=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.value=t,n.name=JSON.stringify(t),n._failMsg=`is not `+n.name,n}return n.prototype.getChecker=function(e,t){var n=this;return function(e,t){return e===n.value||t.fail(null,n._failMsg,-1)}},n}(r);e.TLiteral=l;function u(e){return new d(i(e))}e.array=u;var d=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.ttype=t,n}return n.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<e.length;r++)if(!n(e[r],t))return t.fail(r,null,1);return!0}},n}(r);e.TArray=d;function f(){return new p([...arguments].map(function(e){return i(e)}))}e.tuple=f;var p=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.ttypes=t,n}return n.prototype.getChecker=function(e,t){var n=this.ttypes.map(function(n){return n.getChecker(e,t)}),r=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var r=0;r<n.length;r++)if(!n[r](e[r],t))return t.fail(r,null,1);return!0};return t?function(e,t){return r(e,t)?e.length<=n.length||t.fail(n.length,`is extraneous`,2):!1}:r},n}(r);e.TTuple=p;function m(){return new h([...arguments].map(function(e){return i(e)}))}e.union=m;var h=function(e){t(n,e);function n(t){var n=e.call(this)||this;n.ttypes=t;var r=t.map(function(e){return e instanceof s||e instanceof l?e.name:null}).filter(function(e){return e}),i=t.length-r.length;return r.length?(i>0&&r.push(i+` more`),n._failMsg=`is none of `+r.join(`, `)):n._failMsg=`is none of `+i+` types`,n}return n.prototype.getChecker=function(e,t){var n=this,r=this.ttypes.map(function(n){return n.getChecker(e,t)});return function(e,t){for(var i=t.unionResolver(),a=0;a<r.length;a++)if(r[a](e,i.createContext()))return!0;return t.resolveUnion(i),t.fail(null,n._failMsg,0)}},n}(r);e.TUnion=h;function g(){return new _([...arguments].map(function(e){return i(e)}))}e.intersection=g;var _=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.ttypes=t,n}return n.prototype.getChecker=function(e,t){var n=new Set,r=this.ttypes.map(function(r){return r.getChecker(e,t,n)});return function(e,t){return r.every(function(n){return n(e,t)})?!0:t.fail(null,null,0)}},n}(r);e.TIntersection=_;function v(e){return new y(e)}e.enumtype=v;var y=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.members=t,n.validValues=new Set,n._failMsg=`is not a valid enum value`,n.validValues=new Set(Object.keys(t).map(function(e){return t[e]})),n}return n.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validValues.has(e)?!0:t.fail(null,n._failMsg,0)}},n}(r);e.TEnumType=y;function b(e,t){return new x(e,t)}e.enumlit=b;var x=function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.enumName=t,r.prop=n,r._failMsg=`is not `+t+`.`+n,r}return n.prototype.getChecker=function(e,t){var n=this,r=a(e,this.enumName);if(!(r instanceof y))throw Error(`Type `+this.enumName+` used in enumlit is not an enum type`);var i=r.members[this.prop];if(!r.members.hasOwnProperty(this.prop))throw Error(`Unknown value `+this.enumName+`.`+this.prop+` used in enumlit`);return function(e,t){return e===i||t.fail(null,n._failMsg,-1)}},n}(r);e.TEnumLiteral=x;function S(e){return Object.keys(e).map(function(t){return C(t,e[t])})}function C(e,t){return t instanceof E?new D(e,t.ttype,!0):new D(e,i(t),!1)}function w(e,t){return new T(e,S(t))}e.iface=w;var T=function(e){t(r,e);function r(t,n){var r=e.call(this)||this;return r.bases=t,r.props=n,r.propSet=new Set(n.map(function(e){return e.name})),r}return r.prototype.getChecker=function(e,t,r){var i=this,o=this.bases.map(function(n){return a(e,n).getChecker(e,t)}),s=this.props.map(function(n){return n.ttype.getChecker(e,t)}),c=new n.NoopContext,l=this.props.map(function(e,t){return!e.isOpt&&!s[t](void 0,c)}),u=function(e,t){if(typeof e!=`object`||!e)return t.fail(null,`is not an object`,0);for(var n=0;n<o.length;n++)if(!o[n](e,t))return!1;for(var n=0;n<s.length;n++){var r=i.props[n].name,a=e[r];if(a===void 0){if(l[n])return t.fail(r,`is missing`,1)}else if(!s[n](a,t))return t.fail(r,null,1)}return!0};if(!t)return u;var d=this.propSet;return r&&(this.propSet.forEach(function(e){return r.add(e)}),d=r),function(e,t){if(!u(e,t))return!1;for(var n in e)if(!d.has(n))return t.fail(n,`is extraneous`,2);return!0}},r}(r);e.TIface=T;function ee(e){return new E(i(e))}e.opt=ee;var E=function(e){t(n,e);function n(t){var n=e.call(this)||this;return n.ttype=t,n}return n.prototype.getChecker=function(e,t){var n=this.ttype.getChecker(e,t);return function(e,t){return e===void 0||n(e,t)}},n}(r);e.TOptional=E;var D=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TProp=D;function te(e){return new O(new A([...arguments].slice(1)),i(e))}e.func=te;var O=function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.paramList=t,r.result=n,r}return n.prototype.getChecker=function(e,t){return function(e,t){return typeof e==`function`||t.fail(null,`is not a function`,0)}},n}(r);e.TFunc=O;function ne(e,t,n){return new k(e,i(t),!!n)}e.param=ne;var k=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TParam=k;var A=function(e){t(r,e);function r(t){var n=e.call(this)||this;return n.params=t,n}return r.prototype.getChecker=function(e,t){var r=this,i=this.params.map(function(n){return n.ttype.getChecker(e,t)}),a=new n.NoopContext,o=this.params.map(function(e,t){return!e.isOpt&&!i[t](void 0,a)}),s=function(e,t){if(!Array.isArray(e))return t.fail(null,`is not an array`,0);for(var n=0;n<i.length;n++){var a=r.params[n];if(e[n]===void 0){if(o[n])return t.fail(a.name,`is missing`,1)}else if(!i[n](e[n],t))return t.fail(a.name,null,1)}return!0};return t?function(e,t){return s(e,t)?e.length<=i.length||t.fail(i.length,`is extraneous`,2):!1}:s},r}(r);e.TParamList=A;var j=function(e){t(n,e);function n(t,n){var r=e.call(this)||this;return r.validator=t,r.message=n,r}return n.prototype.getChecker=function(e,t){var n=this;return function(e,t){return n.validator(e)?!0:t.fail(null,n.message,0)}},n}(r);e.BasicType=j,e.basicTypes={any:new j(function(e){return!0},`is invalid`),number:new j(function(e){return typeof e==`number`},`is not a number`),object:new j(function(e){return typeof e==`object`&&e},`is not an object`),boolean:new j(function(e){return typeof e==`boolean`},`is not a boolean`),string:new j(function(e){return typeof e==`string`},`is not a string`),symbol:new j(function(e){return typeof e==`symbol`},`is not a symbol`),void:new j(function(e){return e==null},`is not void`),undefined:new j(function(e){return e===void 0},`is not undefined`),null:new j(function(e){return e===null},`is not null`),never:new j(function(e){return!1},`is unexpected`),Date:new j(ie(`[object Date]`),`is not a Date`),RegExp:new j(ie(`[object RegExp]`),`is not a RegExp`)};var re=Object.prototype.toString;function ie(e){return function(t){return typeof t==`object`&&t&&re.call(t)===e}}typeof Buffer<`u`&&(e.basicTypes.Buffer=new j(function(e){return Buffer.isBuffer(e)},`is not a Buffer`));for(var ae=function(t){e.basicTypes[t.name]=new j(function(e){return e instanceof t},`is not a `+t.name)},oe=0,M=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];oe<M.length;oe++){var se=M[oe];ae(se)}})),M2=n(a((e=>{var t=e&&e.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r};Object.defineProperty(e,"__esModule",{value:!0}),e.Checker=e.createCheckers=void 0;var n=j2(),r=A2(),i=j2();Object.defineProperty(e,"TArray",{enumerable:!0,get:function(){return i.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:!0,get:function(){return i.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:!0,get:function(){return i.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:!0,get:function(){return i.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:!0,get:function(){return i.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:!0,get:function(){return i.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:!0,get:function(){return i.TName}}),Object.defineProperty(e,"TOptional",{enumerable:!0,get:function(){return i.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:!0,get:function(){return i.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:!0,get:function(){return i.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:!0,get:function(){return i.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:!0,get:function(){return i.TTuple}}),Object.defineProperty(e,"TType",{enumerable:!0,get:function(){return i.TType}}),Object.defineProperty(e,"TUnion",{enumerable:!0,get:function(){return i.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:!0,get:function(){return i.TIntersection}}),Object.defineProperty(e,"array",{enumerable:!0,get:function(){return i.array}}),Object.defineProperty(e,"enumlit",{enumerable:!0,get:function(){return i.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:!0,get:function(){return i.enumtype}}),Object.defineProperty(e,"func",{enumerable:!0,get:function(){return i.func}}),Object.defineProperty(e,"iface",{enumerable:!0,get:function(){return i.iface}}),Object.defineProperty(e,"lit",{enumerable:!0,get:function(){return i.lit}}),Object.defineProperty(e,"name",{enumerable:!0,get:function(){return i.name}}),Object.defineProperty(e,"opt",{enumerable:!0,get:function(){return i.opt}}),Object.defineProperty(e,"param",{enumerable:!0,get:function(){return i.param}}),Object.defineProperty(e,"tuple",{enumerable:!0,get:function(){return i.tuple}}),Object.defineProperty(e,"union",{enumerable:!0,get:function(){return i.union}}),Object.defineProperty(e,"intersection",{enumerable:!0,get:function(){return i.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:!0,get:function(){return i.BasicType}});var a=A2();Object.defineProperty(e,"VError",{enumerable:!0,get:function(){return a.VError}});function o(){for(var e=[...arguments],r=Object.assign.apply(Object,t([{},n.basicTypes],e)),i={},a=0,o=e;a<o.length;a++)for(var c=o[a],l=0,u=Object.keys(c);l<u.length;l++){var d=u[l];i[d]=new s(r,c[d])}return i}e.createCheckers=o;var s=function(){function e(e,t,r){if(r===void 0&&(r=`value`),this.suite=e,this.ttype=t,this._path=r,this.props=new Map,t instanceof n.TIface)for(var i=0,a=t.props;i<a.length;i++){var o=a[i];this.props.set(o.name,o.ttype)}this.checkerPlain=this.ttype.getChecker(e,!1),this.checkerStrict=this.ttype.getChecker(e,!0)}return e.prototype.setReportedPath=function(e){this._path=e},e.prototype.check=function(e){return this._doCheck(this.checkerPlain,e)},e.prototype.test=function(e){return this.checkerPlain(e,new r.NoopContext)},e.prototype.validate=function(e){return this._doValidate(this.checkerPlain,e)},e.prototype.strictCheck=function(e){return this._doCheck(this.checkerStrict,e)},e.prototype.strictTest=function(e){return this.checkerStrict(e,new r.NoopContext)},e.prototype.strictValidate=function(e){return this._doValidate(this.checkerStrict,e)},e.prototype.getProp=function(t){var n=this.props.get(t);if(!n)throw Error(`Type has no property `+t);return new e(this.suite,n,this._path+`.`+t)},e.prototype.methodArgs=function(t){var n=this._getMethod(t);return new e(this.suite,n.paramList)},e.prototype.methodResult=function(t){var n=this._getMethod(t);return new e(this.suite,n.result)},e.prototype.getArgs=function(){if(!(this.ttype instanceof n.TFunc))throw Error(`getArgs() applied to non-function`);return new e(this.suite,this.ttype.paramList)},e.prototype.getResult=function(){if(!(this.ttype instanceof n.TFunc))throw Error(`getResult() applied to non-function`);return new e(this.suite,this.ttype.result)},e.prototype.getType=function(){return this.ttype},e.prototype._doCheck=function(e,t){if(!e(t,new r.NoopContext)){var n=new r.DetailContext;throw e(t,n),n.getError(this._path)}},e.prototype._doValidate=function(e,t){if(e(t,new r.NoopContext))return null;var n=new r.DetailContext;return e(t,n),n.getErrorDetail(this._path)},e.prototype._getMethod=function(e){var t=this.props.get(e);if(!t)throw Error(`Type has no property `+e);if(!(t instanceof n.TFunc))throw Error(`Property `+e+` is not a method`);return t},e}();e.Checker=s}))()),N2={Transform:M2.union(M2.lit(`jsx`),M2.lit(`typescript`),M2.lit(`flow`),M2.lit(`imports`),M2.lit(`react-hot-loader`),M2.lit(`jest`)),SourceMapOptions:M2.iface([],{compiledFilename:`string`}),Options:M2.iface([],{transforms:M2.array(`Transform`),disableESTransforms:M2.opt(`boolean`),jsxRuntime:M2.opt(M2.union(M2.lit(`classic`),M2.lit(`automatic`),M2.lit(`preserve`))),production:M2.opt(`boolean`),jsxImportSource:M2.opt(`string`),jsxPragma:M2.opt(`string`),jsxFragmentPragma:M2.opt(`string`),keepUnusedImports:M2.opt(`boolean`),preserveDynamicImport:M2.opt(`boolean`),injectCreateRequireForImportRequire:M2.opt(`boolean`),enableLegacyTypeScriptModuleInterop:M2.opt(`boolean`),enableLegacyBabel5ModuleInterop:M2.opt(`boolean`),sourceMapOptions:M2.opt(`SourceMapOptions`),filePath:M2.opt(`string`)})},{Options:P2}=(0,M2.createCheckers)(N2),F2;(function(e){e[e.TSFunctionType=0]=`TSFunctionType`,e[e.TSConstructorType=1]=`TSConstructorType`,e[e.TSAbstractConstructorType=2]=`TSAbstractConstructorType`})(F2||={}),a((e=>{e.__esModule=!0,e.LinesAndColumns=void 0;var t=`
|
|
3503
|
-
`,n=`\r`;e.LinesAndColumns=function(){function e(e){this.string=e;for(var r=[0],i=0;i<e.length;)switch(e[i]){case t:i+=t.length,r.push(i);break;case n:i+=n.length,e[i]===t&&(i+=t.length),r.push(i);break;default:i++;break}this.offsets=r}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;var r=e-n[t];return{line:t,column:r}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length||n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}()}))();var I2=`pending-chat-prefill`;function L2(){try{let e=sessionStorage.getItem(I2);return e?JSON.parse(e):null}catch{return sessionStorage.removeItem(I2),null}}function R2(e){sessionStorage.setItem(I2,JSON.stringify(e))}function z2(){sessionStorage.removeItem(I2)}function B2(e){return e===`streaming`||e===`submitted`}var V2=class{chat=null;prevStatus=`ready`;listeners=new Set;_queue=[];_queueEnabled;uploadFile;submissions=new Fp;onResetChat;constructor(e){this._queueEnabled=e.queueEnabled??!0,this.uploadFile=e.uploadFile,this.onResetChat=e.onResetChat}bind(e){this.chat=e}syncStatus(e){let t=this.prevStatus;this.prevStatus=e,B2(t)&&e===`ready`&&this.processQueue()}initialize(e){this.chat&&e&&this.consumePrefill(e)}submit(e){if(!this.chat)return Promise.resolve();let{files:t=[],...n}=e,r=this.chat.id;return this.submissions.run(async()=>{if(t.length===0){this.assertCurrentChat(r),this.dispatch(n);return}let e=await this.uploadFiles(r,t);this.assertCurrentChat(r),this.dispatch({...n,uploads:e})})}async uploadFiles(e,t){return Promise.all(t.map(t=>this.uploadFile(e,t)))}assertCurrentChat(e){if(this.chat?.id!==e)throw Error(`The chat changed before the submission was sent.`)}dispatch(e){if(this.chat){if(this._queueEnabled&&this.isChatBusy()){this._queue=[...this._queue,{id:crypto.randomUUID(),...e}],this.notify();return}this.directSubmit(e)}}isChatBusy(){return this.chat!==null&&B2(this.chat.status)}directSubmit(e){this.chat&&(this.chat.sendMessage({role:`user`,parts:[{type:`text`,text:e.prompt}],metadata:e.uploads?{...e.metadata,uploads:e.uploads}:e.metadata}),this.notify())}processQueue(){if(!this._queueEnabled||this._queue.length===0)return;let[e,...t]=this._queue;this._queue=t,this.notify(),queueMicrotask(()=>this.directSubmit(e))}removeFromQueue(e){let t=this._queue.filter(t=>t.id!==e);t.length!==this._queue.length&&(this._queue=t,this.notify())}clearQueue(){this._queue.length!==0&&(this._queue=[],this.notify())}get queue(){return this._queue}get queueEnabled(){return this._queueEnabled}clearChat(){this.chat&&(this.chat.messages=[],this.clearQueue(),this.notify())}setChat(e){this.chat&&(this.chat.messages=e,this.notify())}stop(){this.chat&&this.chat.stop()}resetChat(e){let t=crypto.randomUUID();e&&R2({prompt:e,targetChatId:t}),this.onResetChat(t)}consumePrefill(e){let t=L2();!t||t.targetChatId!==e||(z2(),this.submit({prompt:t.prompt,persistedPrompt:t.prompt}))}getTriggeringUserMessage(e){if(!this.chat)return null;let{messages:t}=this.chat,n=t.findIndex(t=>t.role===`assistant`&&t.parts.some(t=>`toolCallId`in t&&t.toolCallId===e));if(n<=0)return null;let r=t[n-1];return r?.role===`user`?r:null}getLastUserMessageId(){if(!this.chat)return null;let{messages:e}=this.chat;for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`)return e[t].id;return null}getLastAssistantMessage(){if(!this.chat)return null;let{messages:e}=this.chat;for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`)return e[t];return null}get hasSubmitted(){return(this.chat?.messages.length??0)>0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});notify(){for(let e of this.listeners)e()}};async function H2(e,t,n){let r=t?.[n.toolName];n.toolName.startsWith(`render`)&&r?.static===!1&&r.requiresUserInput!==!0&&await e.addToolOutput({toolCallId:n.toolCallId,tool:n.toolName,output:`rendered`,state:`output-available`})}function U2(e){let t=I.useRef(e);I.useEffect(()=>{t.current=e});let n=I.useMemo(()=>new Zp({id:e.chatId,messages:e.initialMessages,transport:{sendMessages:e=>t.current.transport.sendMessages(e),reconnectToStream:e=>t.current.transport.reconnectToStream(e)},sendAutomaticallyWhen:e=>Up(e)||Hp(e),async onToolCall({toolCall:e}){await H2(n,t.current.registry,e)},onData:e=>t.current.onData?.(e),onFinish:e=>t.current.onFinish?.(e)}),[e.chatId]);return I.useEffect(()=>()=>{n.stop()},[n]),{chat:n,helpers:rm({chat:n,experimental_throttle:50,resume:e.resume})}}function W2(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(G2,{...e}),t[0]=e,t[1]=n),n}function G2(e){let t=(0,H.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={initial:`smooth`},t[0]=n):n=t[0];let{scrollRef:r,contentRef:i}=aT(n),{hasSubmitted:a}=a4(),o;t[1]===e.className?o=t[2]:(o=F(`@container mx-auto h-full w-full overflow-y-auto`,e.className),t[1]=e.className,t[2]=o);let s=a?`min-h-full`:`h-full justify-center`,c;t[3]===s?c=t[4]:(c=F(`relative mx-auto flex w-full flex-col`,s),t[3]=s,t[4]=c);let l;t[5]!==i||t[6]!==e.children||t[7]!==c?(l=(0,L.jsx)(`div`,{ref:i,"data-slot":`content`,className:c,children:e.children}),t[5]=i,t[6]=e.children,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==o||t[11]!==l?(u=(0,L.jsx)(`div`,{id:`agent`,"data-slot":`agent`,className:o,ref:r,children:l}),t[9]=r,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function K2(e){let t=(0,H.c)(12),{hasSubmitted:n}=a4(),r;t[0]!==n||t[1]!==e.className?(r=F(n?F(`bg-background sticky top-0 z-10 shrink-0 space-y-1 backdrop-blur-md`,e.className):`relative flex justify-center py-4`),t[0]=n,t[1]=e.className,t[2]=r):r=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={layout:{type:`tween`,ease:[.4,0,.2,1],duration:.4}},t[3]=i):i=t[3];let a=n?`text-left`:`space-y-3 text-center`,o;t[4]===a?o=t[5]:(o=F(a),t[4]=a,t[5]=o);let s;t[6]!==e.children||t[7]!==o?(s=(0,L.jsx)(`div`,{className:o,children:e.children}),t[6]=e.children,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==r||t[10]!==s?(c=(0,L.jsx)($w.div,{layout:!0,className:r,transition:i,children:s}),t[9]=r,t[10]=s,t[11]=c):c=t[11],c}K2.displayName=`AgentHeader.Root`;function q2(e){let t=(0,H.c)(6),{hasSubmitted:n}=a4(),r;t[0]!==n||t[1]!==e.children||t[2]!==e.icon?(r=!n&&(0,L.jsx)($w.div,{exit:{opacity:0},transition:{duration:.2},children:(0,L.jsxs)(`h1`,{className:`flex items-center justify-center gap-2 text-2xl font-medium tracking-tight`,children:[e.icon,e.children??`How can I help today?`]})},`agent-header-initial`),t[0]=n,t[1]=e.children,t[2]=e.icon,t[3]=r):r=t[3];let i;return t[4]===r?i=t[5]:(i=(0,L.jsx)(YS,{mode:`sync`,children:r}),t[4]=r,t[5]=i),i}q2.displayName=`AgentHeader.Hero`;function J2(e){let t=(0,H.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,L.jsx)($w.h2,{layout:`position`,className:`text-muted-foreground text-sm font-medium`,children:e.children}),t[0]=e.children,t[1]=n),n}J2.displayName=`AgentHeader.Title`;function Y2(e){let t=(0,H.c)(5),{hasSubmitted:n}=a4(),r;t[0]!==n||t[1]!==e.children?(r=n&&e.children&&(0,L.jsx)($w.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.25},className:`text-muted-foreground text-sm`,children:e.children}),t[0]=n,t[1]=e.children,t[2]=r):r=t[2];let i;return t[3]===r?i=t[4]:(i=(0,L.jsx)(YS,{children:r}),t[3]=r,t[4]=i),i}Y2.displayName=`AgentHeader.Description`;var X2={Root:K2,Hero:q2,Title:J2,Description:Y2},Z2=(0,I.createContext)(void 0),Q2=(0,I.createContext)(`ready`),$2=(0,I.createContext)(void 0),e4=(0,I.createContext)(null),t4=(0,I.createContext)(void 0);function n4({chatId:e,children:t,skipInitialView:n,debugMode:r,registry:i,initialMessages:a,transport:o,resume:s,onData:c,onFinish:l,onResetChat:u,queueEnabled:d=!0}){let{chat:f,helpers:p}=U2({chatId:e,transport:o,registry:i,initialMessages:a,resume:s,onData:c,onFinish:l}),[m,h]=(0,I.useState)(r),g=(0,I.useCallback)(()=>h(e=>!e),[]),_=(0,I.useRef)(u);(0,I.useEffect)(()=>{_.current=u},[u]);let v=(0,I.useCallback)(e=>{_.current(e)},[]),[y]=(0,I.useState)(()=>new V2({queueEnabled:d,uploadFile:o.uploadFile.bind(o),onResetChat:v}));y.bind(f),(0,I.useEffect)(()=>{y.initialize(e)},[y,e]),(0,I.useEffect)(()=>{y.syncStatus(p.status)},[y,p.status]);let b=(0,I.useMemo)(()=>({clearChat:()=>y.clearChat(),resetChat:e=>y.resetChat(e),submit:e=>y.submit(e),setChat:e=>y.setChat(e),getTriggeringUserMessage:e=>y.getTriggeringUserMessage(e),getLastUserMessageId:()=>y.getLastUserMessageId(),stop:()=>y.stop()}),[y]),x=(0,I.useMemo)(()=>({chatId:e,registry:i,debugMode:m,toggleDebugMode:g,...b}),[e,i,m,g,b]),S=(0,I.useMemo)(()=>p,[p.messages,p.status,p.error]),C=!!n||p.messages.length>0,w=(0,I.useMemo)(()=>({hasSubmitted:C}),[C]);return(0,L.jsx)(e4,{value:y,children:(0,L.jsx)(Z2.Provider,{value:x,children:(0,L.jsx)(Q2.Provider,{value:p.status,children:(0,L.jsx)($2.Provider,{value:S,children:(0,L.jsx)(t4.Provider,{value:w,children:t})})})})})}function r4(){let e=(0,I.useContext)(Z2);if(e===void 0)throw Error(`useAgent must be used within an AgentProvider`);return e}function i4(){let e=(0,H.c)(2),t=(0,I.useContext)(Q2),n;return e[0]===t?n=e[1]:(n={status:t},e[0]=t,e[1]=n),n}function a4(){let e=(0,I.useContext)(t4);if(e===void 0)throw Error(`useAgentMeta must be used within an AgentProvider`);return e}function o4(){let e=(0,I.useContext)($2);if(e===void 0)throw Error(`useAgentMessages must be used within an AgentProvider`);return e}function s4(){let e=(0,I.useContext)(e4);if(!e)throw Error(`useChatManager must be used within an AgentProvider`);return e}function c4(e){let t=new Set,n=[];for(let r of e)for(let e of r.parts)e.type===`source-url`&&(t.has(e.url)||(t.add(e.url),n.push({url:e.url,title:e.title})));return n}function l4(e,t){let n=e.findIndex(e=>e.url===t);return n===-1?null:n+1}function u4(e,t){return t===`streaming`||t===`submitted`?!1:e===`input-streaming`||e===`input-available`}function d4(e,t){return u4(e.state,t)}function f4(e){return Object.entries(e).reduce((e,[t,n])=>(n.static||(e[t]={inputSchema:Le(n.inputSchema,{io:`input`,unrepresentable:`any`}),description:n.description}),e),{})}function p4(e){let t=(0,H.c)(11),{children:n,as:r,className:i,duration:a,enabled:o}=e,s=r===void 0?`p`:r,c=o===void 0||o,l=c&&`shimmer`,u;t[0]!==i||t[1]!==l?(u=F(l,i),t[0]=i,t[1]=l,t[2]=u):u=t[2];let d;t[3]!==a||t[4]!==c?(d=c&&a!==void 0?{animationDuration:`${a}s`}:void 0,t[3]=a,t[4]=c,t[5]=d):d=t[5];let f;return t[6]!==s||t[7]!==n||t[8]!==u||t[9]!==d?(f=(0,L.jsx)(s,{className:u,style:d,children:n}),t[6]=s,t[7]=n,t[8]=u,t[9]=d,t[10]=f):f=t[10],f}function m4(e){let t=(0,H.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=F(`size-3.5 shrink-0 transition-transform group-data-[panel-open]:rotate-90`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,L.jsx)(kT,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}function h4(e){return F(`group hover:bg-muted/30 flex min-h-7 w-full gap-2 rounded-sm py-1 text-left transition-colors`,e)}(0,I.createContext)(null);var g4=(0,I.createContext)(void 0),_4=(0,I.createContext)(void 0);function v4(){let e=(0,I.use)(g4);if(!e)throw Error(`useMessagesContext must be used within <Messages>`);return e}function y4(){let e=(0,I.use)(g4),{status:t}=i4();return e?.status??t}function b4(){let e=(0,I.use)(_4);if(!e)throw Error(`useMessageItem must be used within <Messages.Item>`);return e}function x4(e){let t=(0,H.c)(4),{source:n,index:r}=e,i=n.title??n.url,a;return t[0]!==r||t[1]!==n.url||t[2]!==i?(a=(0,L.jsx)(`sup`,{className:`ml-0.5 inline-block`,children:(0,L.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,title:i,className:`text-primary bg-primary/10 hover:bg-primary/20 focus-visible:ring-ring focus-visible:ring-offset-background inline-block rounded px-1 font-mono text-[10px] leading-tight no-underline transition-colors focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none`,children:r})}),t[0]=r,t[1]=n.url,t[2]=i,t[3]=a):a=t[3],a}var S4=I.forwardRef(function(e,t){let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`border-border bg-background relative min-w-0 gap-0 overflow-visible rounded-md border py-0 text-sm/normal ring-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,L.jsx)(jn,{ref:t,"data-slot":`table-panel`,size:`default`,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});S4.displayName=`TablePanel.Root`;function C4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`border-border flex items-center justify-between gap-4 border-b px-4 py-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Mn,{"data-slot":`table-panel-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function w4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`min-w-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(`div`,{"data-slot":`table-panel-heading`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function T4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`text-base font-medium text-balance wrap-anywhere`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Nn,{"data-slot":`table-panel-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`text-muted-foreground text-xs text-pretty wrap-anywhere`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Pn,{"data-slot":`table-panel-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`flex shrink-0 items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Fn,{"data-slot":`table-panel-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function O4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`min-w-0 flex-1 overflow-auto p-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(In,{"data-slot":`table-panel-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var k4=Object.assign(S4,{Header:C4,Heading:w4,Title:T4,Description:E4,Actions:D4,Content:O4}),A4=/<\w[\w-]*(?:"(?:\\.|[^"])*"|[^>"])*>/g,j4=/\b([\w-]+)="((?:\\.|[^"])*)"/g;function M4(e){return e.replace(A4,e=>e.replace(j4,(e,t,n)=>`${t}="${n.replace(/\\"/g,`"`)}"`))}function N4(e,t){if(typeof e!=`string`)return e;let n=M4(e).replace(/<(\w[\w-]*)((?:\s+[\w-]+="[^"]*")+)\s*(\/?>)/g,(e,t,n,r)=>`<${t}${n.replace(/\s+/g,` `).replace(/"([^"]*)"/g,(e,t)=>`"${t.replace(/\*/g,`*`)}"`)}${r}`);return n=n.replace(/\/>\s*</g,`/>
|
|
3503
|
+
`,n=`\r`;e.LinesAndColumns=function(){function e(e){this.string=e;for(var r=[0],i=0;i<e.length;)switch(e[i]){case t:i+=t.length,r.push(i);break;case n:i+=n.length,e[i]===t&&(i+=t.length),r.push(i);break;default:i++;break}this.offsets=r}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;var r=e-n[t];return{line:t,column:r}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length||n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}()}))();var I2=`pending-chat-prefill`;function L2(){try{let e=sessionStorage.getItem(I2);return e?JSON.parse(e):null}catch{return sessionStorage.removeItem(I2),null}}function R2(e){sessionStorage.setItem(I2,JSON.stringify(e))}function z2(){sessionStorage.removeItem(I2)}var B2=class{chat=null;listeners=new Set;_queue=[];_queueEnabled;uploadFile;submissions=new Fp;onResetChat;constructor(e){this._queueEnabled=e.queueEnabled??!0,this.uploadFile=e.uploadFile,this.onResetChat=e.onResetChat}bind(e){this.chat=e}initialize(e){this.chat&&e&&this.consumePrefill(e)}submit(e){if(!this.chat)return Promise.resolve();this.chat.clearError();let{files:t=[],...n}=e,r=this.chat.id;return this.submissions.run(async()=>{if(t.length===0){this.assertCurrentChat(r),this.dispatch(n);return}let e=await this.uploadFiles(r,t);this.assertCurrentChat(r),this.dispatch({...n,uploads:e})})}async uploadFiles(e,t){return Promise.all(t.map(t=>this.uploadFile(e,t)))}assertCurrentChat(e){if(this.chat?.id!==e)throw Error(`The chat changed before the submission was sent.`)}dispatch(e){if(this.chat){if(this._queueEnabled){this._queue=[...this._queue,{id:crypto.randomUUID(),...e}],this.notify();return}this.directSubmit(e)}}directSubmit(e){this.chat&&(this.chat.sendMessage({role:`user`,parts:[{type:`text`,text:e.prompt}],metadata:e.uploads?{...e.metadata,uploads:e.uploads}:e.metadata}),this.notify())}processQueue(e){if(e!==this._queue||this.chat?.status!==`ready`||!this._queueEnabled||e.length===0)return;let[t,...n]=e;this._queue=n,this.directSubmit(t)}removeFromQueue(e){let t=this._queue.filter(t=>t.id!==e);t.length!==this._queue.length&&(this._queue=t,this.notify())}clearQueue(){this._queue.length!==0&&(this._queue=[],this.notify())}get queue(){return this._queue}get queueEnabled(){return this._queueEnabled}clearChat(){this.chat&&(this.chat.setMessages([]),this.clearQueue(),this.notify())}setChat(e){this.chat&&(this.chat.setMessages(e),this.notify())}stop(){this.chat&&this.chat.stop()}resetChat(e){let t=crypto.randomUUID();e&&R2({prompt:e,targetChatId:t}),this.onResetChat(t)}consumePrefill(e){let t=L2();!t||t.targetChatId!==e||(z2(),this.submit({prompt:t.prompt,persistedPrompt:t.prompt}))}getTriggeringUserMessage(e){if(!this.chat)return null;let{messages:t}=this.chat,n=t.findIndex(t=>t.role===`assistant`&&t.parts.some(t=>`toolCallId`in t&&t.toolCallId===e));if(n<=0)return null;let r=t[n-1];return r?.role===`user`?r:null}getLastUserMessageId(){if(!this.chat)return null;let{messages:e}=this.chat;for(let t=e.length-1;t>=0;t--)if(e[t].role===`user`)return e[t].id;return null}getLastAssistantMessage(){if(!this.chat)return null;let{messages:e}=this.chat;for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`)return e[t];return null}get hasSubmitted(){return(this.chat?.messages.length??0)>0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});notify(){for(let e of this.listeners)e()}};async function V2(e,t,n){let r=t?.[n.toolName];n.toolName.startsWith(`render`)&&r?.static===!1&&r.requiresUserInput!==!0&&await e.addToolOutput({toolCallId:n.toolCallId,tool:n.toolName,output:`rendered`,state:`output-available`})}function H2(e){let t=rm({id:e.chatId,messages:e.initialMessages,transport:e.transport,throttle:50,resume:e.resume,onData:e.onData,onFinish:e.onFinish,sendAutomaticallyWhen:U2,onToolCall(n){let{toolCall:r}=n;V2(t,e.registry,r)}});return t}function U2(e){return Up(e)||Hp(e)}function W2(e){let t=(0,H.c)(2),n;return t[0]===e?n=t[1]:(n=(0,L.jsx)(G2,{...e}),t[0]=e,t[1]=n),n}function G2(e){let t=(0,H.c)(13),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={initial:`smooth`},t[0]=n):n=t[0];let{scrollRef:r,contentRef:i}=aT(n),{hasSubmitted:a}=a4(),o;t[1]===e.className?o=t[2]:(o=F(`@container mx-auto h-full w-full overflow-y-auto`,e.className),t[1]=e.className,t[2]=o);let s=a?`min-h-full`:`h-full justify-center`,c;t[3]===s?c=t[4]:(c=F(`relative mx-auto flex w-full flex-col`,s),t[3]=s,t[4]=c);let l;t[5]!==i||t[6]!==e.children||t[7]!==c?(l=(0,L.jsx)(`div`,{ref:i,"data-slot":`content`,className:c,children:e.children}),t[5]=i,t[6]=e.children,t[7]=c,t[8]=l):l=t[8];let u;return t[9]!==r||t[10]!==o||t[11]!==l?(u=(0,L.jsx)(`div`,{id:`agent`,"data-slot":`agent`,className:o,ref:r,children:l}),t[9]=r,t[10]=o,t[11]=l,t[12]=u):u=t[12],u}function K2(e){let t=(0,H.c)(12),{hasSubmitted:n}=a4(),r;t[0]!==n||t[1]!==e.className?(r=F(n?F(`bg-background sticky top-0 z-10 shrink-0 space-y-1 backdrop-blur-md`,e.className):`relative flex justify-center py-4`),t[0]=n,t[1]=e.className,t[2]=r):r=t[2];let i;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(i={layout:{type:`tween`,ease:[.4,0,.2,1],duration:.4}},t[3]=i):i=t[3];let a=n?`text-left`:`space-y-3 text-center`,o;t[4]===a?o=t[5]:(o=F(a),t[4]=a,t[5]=o);let s;t[6]!==e.children||t[7]!==o?(s=(0,L.jsx)(`div`,{className:o,children:e.children}),t[6]=e.children,t[7]=o,t[8]=s):s=t[8];let c;return t[9]!==r||t[10]!==s?(c=(0,L.jsx)($w.div,{layout:!0,className:r,transition:i,children:s}),t[9]=r,t[10]=s,t[11]=c):c=t[11],c}K2.displayName=`AgentHeader.Root`;function q2(e){let t=(0,H.c)(6),{hasSubmitted:n}=a4(),r;t[0]!==n||t[1]!==e.children||t[2]!==e.icon?(r=!n&&(0,L.jsx)($w.div,{exit:{opacity:0},transition:{duration:.2},children:(0,L.jsxs)(`h1`,{className:`flex items-center justify-center gap-2 text-2xl font-medium tracking-tight`,children:[e.icon,e.children??`How can I help today?`]})},`agent-header-initial`),t[0]=n,t[1]=e.children,t[2]=e.icon,t[3]=r):r=t[3];let i;return t[4]===r?i=t[5]:(i=(0,L.jsx)(YS,{mode:`sync`,children:r}),t[4]=r,t[5]=i),i}q2.displayName=`AgentHeader.Hero`;function J2(e){let t=(0,H.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,L.jsx)($w.h2,{layout:`position`,className:`text-muted-foreground text-sm font-medium`,children:e.children}),t[0]=e.children,t[1]=n),n}J2.displayName=`AgentHeader.Title`;function Y2(e){let t=(0,H.c)(5),{hasSubmitted:n}=a4(),r;t[0]!==n||t[1]!==e.children?(r=n&&e.children&&(0,L.jsx)($w.p,{initial:{opacity:0},animate:{opacity:1},transition:{delay:.25},className:`text-muted-foreground text-sm`,children:e.children}),t[0]=n,t[1]=e.children,t[2]=r):r=t[2];let i;return t[3]===r?i=t[4]:(i=(0,L.jsx)(YS,{children:r}),t[3]=r,t[4]=i),i}Y2.displayName=`AgentHeader.Description`;var X2={Root:K2,Hero:q2,Title:J2,Description:Y2},Z2=(0,I.createContext)(void 0),Q2=(0,I.createContext)(`ready`),$2=(0,I.createContext)(void 0),e4=(0,I.createContext)(null),t4=(0,I.createContext)(void 0);function n4({chatId:e,children:t,skipInitialView:n,debugMode:r,registry:i,initialMessages:a,transport:o,resume:s,onData:c,onFinish:l,onResetChat:u,queueEnabled:d=!0}){let f=H2({chatId:e,transport:o,registry:i,initialMessages:a,resume:s,onData:c,onFinish:l}),[p,m]=(0,I.useState)(r),h=(0,I.useCallback)(()=>m(e=>!e),[]),g=(0,I.useRef)(u);(0,I.useEffect)(()=>{g.current=u},[u]);let _=(0,I.useCallback)(e=>{g.current(e)},[]),[v]=(0,I.useState)(()=>new B2({queueEnabled:d,uploadFile:o.uploadFile.bind(o),onResetChat:_}));v.bind(f);let y=(0,I.useSyncExternalStore)(v.subscribe,()=>v.queue,()=>v.queue);(0,I.useEffect)(()=>{v.initialize(e)},[v,e]),(0,I.useEffect)(()=>{v.processQueue(y)},[v,f.status,y]);let b=(0,I.useMemo)(()=>({clearChat:()=>v.clearChat(),resetChat:e=>v.resetChat(e),submit:e=>v.submit(e),setChat:e=>v.setChat(e),getTriggeringUserMessage:e=>v.getTriggeringUserMessage(e),getLastUserMessageId:()=>v.getLastUserMessageId(),stop:()=>v.stop()}),[v]),x=(0,I.useMemo)(()=>({chatId:e,registry:i,debugMode:p,toggleDebugMode:h,...b}),[e,i,p,h,b]),S=(0,I.useMemo)(()=>f,[f.id,f.messages,f.status,f.error]),C=!!n||f.messages.length>0,w=(0,I.useMemo)(()=>({hasSubmitted:C}),[C]);return(0,L.jsx)(e4,{value:v,children:(0,L.jsx)(Z2.Provider,{value:x,children:(0,L.jsx)(Q2.Provider,{value:f.status,children:(0,L.jsx)($2.Provider,{value:S,children:(0,L.jsx)(t4.Provider,{value:w,children:t})})})})})}function r4(){let e=(0,I.useContext)(Z2);if(e===void 0)throw Error(`useAgent must be used within an AgentProvider`);return e}function i4(){let e=(0,H.c)(2),t=(0,I.useContext)(Q2),n;return e[0]===t?n=e[1]:(n={status:t},e[0]=t,e[1]=n),n}function a4(){let e=(0,I.useContext)(t4);if(e===void 0)throw Error(`useAgentMeta must be used within an AgentProvider`);return e}function o4(){let e=(0,I.useContext)($2);if(e===void 0)throw Error(`useAgentMessages must be used within an AgentProvider`);return e}function s4(){let e=(0,I.useContext)(e4);if(!e)throw Error(`useChatManager must be used within an AgentProvider`);return e}function c4(e){let t=new Set,n=[];for(let r of e)for(let e of r.parts)e.type===`source-url`&&(t.has(e.url)||(t.add(e.url),n.push({url:e.url,title:e.title})));return n}function l4(e,t){let n=e.findIndex(e=>e.url===t);return n===-1?null:n+1}function u4(e,t){return t===`streaming`||t===`submitted`?!1:e===`input-streaming`||e===`input-available`}function d4(e,t){return u4(e.state,t)}function f4(e){return Object.entries(e).reduce((e,[t,n])=>(n.static||(e[t]={inputSchema:Le(n.inputSchema,{io:`input`,unrepresentable:`any`}),description:n.description}),e),{})}function p4(e){let t=(0,H.c)(11),{children:n,as:r,className:i,duration:a,enabled:o}=e,s=r===void 0?`p`:r,c=o===void 0||o,l=c&&`shimmer`,u;t[0]!==i||t[1]!==l?(u=F(l,i),t[0]=i,t[1]=l,t[2]=u):u=t[2];let d;t[3]!==a||t[4]!==c?(d=c&&a!==void 0?{animationDuration:`${a}s`}:void 0,t[3]=a,t[4]=c,t[5]=d):d=t[5];let f;return t[6]!==s||t[7]!==n||t[8]!==u||t[9]!==d?(f=(0,L.jsx)(s,{className:u,style:d,children:n}),t[6]=s,t[7]=n,t[8]=u,t[9]=d,t[10]=f):f=t[10],f}function m4(e){let t=(0,H.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=F(`size-3.5 shrink-0 transition-transform group-data-[panel-open]:rotate-90`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,L.jsx)(kT,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}function h4(e){return F(`group hover:bg-muted/30 flex min-h-7 w-full gap-2 rounded-sm py-1 text-left transition-colors`,e)}(0,I.createContext)(null);var g4=(0,I.createContext)(void 0),_4=(0,I.createContext)(void 0);function v4(){let e=(0,I.use)(g4);if(!e)throw Error(`useMessagesContext must be used within <Messages>`);return e}function y4(){let e=(0,I.use)(g4),{status:t}=i4();return e?.status??t}function b4(){let e=(0,I.use)(_4);if(!e)throw Error(`useMessageItem must be used within <Messages.Item>`);return e}function x4(e){let t=(0,H.c)(4),{source:n,index:r}=e,i=n.title??n.url,a;return t[0]!==r||t[1]!==n.url||t[2]!==i?(a=(0,L.jsx)(`sup`,{className:`ml-0.5 inline-block`,children:(0,L.jsx)(`a`,{href:n.url,target:`_blank`,rel:`noopener noreferrer`,title:i,className:`text-primary bg-primary/10 hover:bg-primary/20 focus-visible:ring-ring focus-visible:ring-offset-background inline-block rounded px-1 font-mono text-[10px] leading-tight no-underline transition-colors focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:outline-none`,children:r})}),t[0]=r,t[1]=n.url,t[2]=i,t[3]=a):a=t[3],a}var S4=I.forwardRef(function(e,t){let n=(0,H.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=F(`border-border bg-background relative min-w-0 gap-0 overflow-visible rounded-md border py-0 text-sm/normal ring-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,L.jsx)(jn,{ref:t,"data-slot":`table-panel`,size:`default`,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});S4.displayName=`TablePanel.Root`;function C4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`border-border flex items-center justify-between gap-4 border-b px-4 py-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Mn,{"data-slot":`table-panel-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function w4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`min-w-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(`div`,{"data-slot":`table-panel-heading`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function T4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`text-base font-medium text-balance wrap-anywhere`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Nn,{"data-slot":`table-panel-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`text-muted-foreground text-xs text-pretty wrap-anywhere`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Pn,{"data-slot":`table-panel-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`flex shrink-0 items-center gap-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(Fn,{"data-slot":`table-panel-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function O4(e){let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=F(`min-w-0 flex-1 overflow-auto p-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,L.jsx)(In,{"data-slot":`table-panel-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var k4=Object.assign(S4,{Header:C4,Heading:w4,Title:T4,Description:E4,Actions:D4,Content:O4}),A4=/<\w[\w-]*(?:"(?:\\.|[^"])*"|[^>"])*>/g,j4=/\b([\w-]+)="((?:\\.|[^"])*)"/g;function M4(e){return e.replace(A4,e=>e.replace(j4,(e,t,n)=>`${t}="${n.replace(/\\"/g,`"`)}"`))}function N4(e,t){if(typeof e!=`string`)return e;let n=M4(e).replace(/<(\w[\w-]*)((?:\s+[\w-]+="[^"]*")+)\s*(\/?>)/g,(e,t,n,r)=>`<${t}${n.replace(/\s+/g,` `).replace(/"([^"]*)"/g,(e,t)=>`"${t.replace(/\*/g,`*`)}"`)}${r}`);return n=n.replace(/\/>\s*</g,`/>
|
|
3504
3504
|
|
|
3505
3505
|
<`),P4(n,t)}function P4(e,t,n=!1){let r=t?.length?new Set(t):null,i=r?e=>r.has(e):e=>e.includes(`-`),a=``,o=0;for(;o<e.length;){if(e[o]!==`<`||e[o+1]===`/`){a+=e[o++];continue}let r=o+1;for(;r<e.length&&/[\w-]/.test(e[r]);)r++;let s=e.slice(o+1,r);if(!s||!i(s)){a+=e[o++];continue}let c=F4(e,o);if(c<0){a+=e[o++];continue}if(e[c-1]===`/`){n?a+=`<div>`+e.slice(o,c+1)+`</div>`:a+=e.slice(o,c+1),o=c+1;continue}let l=I4(e,c+1,s);if(!l){if(n){let n=e.slice(o,c+1),r=P4(e.slice(c+1),t,!0);return a+=`<div>`+n+r+`</`+s+`></div>`,a}a+=e.slice(o,c+1),o=c+1;continue}let u=e.slice(o,c+1),d=e.slice(c+1,l.start),f=e.slice(l.start,l.end),p=P4(d,t,!0);n?a+=`<div>`+u+p+f+`</div>`:a=L4(a)+`<div>`+u+p+f+`</div>`,o=l.end}return a}function F4(e,t){let n=t+1;for(;n<e.length;){if(e[n]===`"`)for(n++;n<e.length&&e[n]!==`"`;)n++;else if(e[n]===`>`)return n;n++}return-1}function I4(e,t,n){let r=1,i=t,a=`<`+n,o=`</`+n;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t<0)return null;if(e.startsWith(o,t)&&!/[\w-]/.test(e[t+o.length]||``)){if(r--,r===0){let n=F4(e,t);return n<0?null:{start:t,end:n+1}}let n=e.indexOf(`>`,t+o.length);i=n<0?t+1:n+1}else if(e.startsWith(a,t)&&!/[\w-]/.test(e[t+a.length]||``)){let n=F4(e,t);n>=0&&e[n-1]!==`/`&&r++,i=n<0?t+1:n+1}else if(/[a-zA-Z/]/.test(e[t+1]||``)){let n=F4(e,t);i=n<0?t+1:n+1}else i=t+1}return null}function L4(e){return e.length===0?`
|
|
3506
3506
|
|