@deepagents/devtool 7.9.0 → 7.10.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.
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/traces/file-trace-adapter.d.ts.map +1 -1
- package/dist/traces/http.d.ts.map +1 -1
- package/dist/traces/index.d.ts.map +1 -1
- package/dist/ui/assets/{chat-Idu9i6w_.js → chat-C1QxEgVA.js} +61 -61
- package/dist/ui/assets/{index-C2IaFU2x.js → index-D59zsAp8.js} +5 -5
- package/dist/ui/assets/index-DeJoANLM.css +2 -0
- package/dist/ui/index.html +2 -2
- package/package.json +8 -8
- package/dist/ui/assets/index-Cmy5HKlp.css +0 -2
|
@@ -10,9 +10,9 @@ ${a}`,l++}else zu(e,n,i)?u=e.slice(e.charCodeAt(n+6)===Fu?n+7:n+6,r)||void 0:p(e
|
|
|
10
10
|
`,n)}return e.slice(n)}for(;n<e.length;){let t=e.indexOf(`\r`,n),r=e.indexOf(`
|
|
11
11
|
`,n),i=-1;if(t!==-1&&r!==-1?i=t<r?t:r:t===-1?r!==-1&&(i=r):i=t===e.length-1?-1:t,i===-1)break;p(e,n,i),n=i+1,e.charCodeAt(n-1)===Pu&&e.charCodeAt(n)===Nu&&n++}return e.slice(n)}function p(e,t,n){if(t===n){h();return}let r=e.charCodeAt(t);if(Ru(e,t,r)){let r=e.charCodeAt(t+5)===Fu?t+6:t+5,i=e.slice(r,n);c=l===0?i:`${c}
|
|
12
12
|
${i}`,l++;return}if(zu(e,t,r)){u=e.slice(e.charCodeAt(t+6)===Fu?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)===Fu?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)===Fu?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)===Fu?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
|
-
${t}`,l++;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.test(t)?r(parseInt(t,10)):n(new Mu(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new Mu(`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 Ru(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 zu(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 Bu=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Lu({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:Vu,atob:Hu}=globalThis,Uu=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get,Wu=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get;function Gu(e){return ArrayBuffer.isView(e)&&Uu.call(e)===`Uint8Array`}function Ku(e){if(typeof e!=`object`||!e||!(`byteLength`in e))return!1;try{return Wu.call(e),!0}catch{return!1}}function qu(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 Ju=`vercel.ai.error.${`AI_DownloadError`}`;function Yu(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 Xu(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error(`Capture current module path`);Error.captureStackTrace(e,Xu);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 Zu=({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 yu({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},Qu=Zu();function $u(e){return globalThis.Buffer?.isBuffer(e)??!1}var ed=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,td=/"(?: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 nd(e){let t=JSON.parse(e);return typeof t!=`object`||!t||ed.test(e)===!1&&td.test(e)===!1?t:rd(t)}function rd(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 id(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return nd(e)}try{return nd(e)}finally{Error.stackTraceLimit=t}}function ad(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){let{additionalProperties:t}=e;e.additionalProperties=t!=null&&typeof t!=`boolean`&&od(t);let{properties:n}=e;if(n!=null)for(let e of Object.keys(n))n[e]=od(n[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(od):od(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(od)),e.allOf!=null&&(e.allOf=e.allOf.map(od)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(od));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=od(t[e]);return e}function od(e){return typeof e==`boolean`?e:ad(e)}var sd=Symbol(`Let zodToJsonSchema decide on which parser to use`),cd={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`},ld=e=>typeof e==`string`?{...cd,name:e}:{...cd,...e};function ud(){return{}}function dd(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=nf(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 fd(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 pd(){return{type:`boolean`}}function md(e,t){return nf(e.type._def,t)}var hd=(e,t)=>nf(e.innerType._def,t);function gd(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>gd(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 _d(e)}}var _d=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 vd(e,t){return{...nf(e.innerType._def,t),default:e.defaultValue()}}function yd(e,t){return t.effectStrategy===`input`?nf(e.schema._def,t):ud()}function bd(e){return{type:`string`,enum:Array.from(e.values)}}var xd=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function Sd(e,t){let n=[nf(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),nf(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(xd(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 Cd(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 wd=void 0,Td={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:()=>(wd===void 0&&(wd=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),wd),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 Ed(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`:Ad(n,`email`,r.message,t);break;case`format:idn-email`:Ad(n,`idn-email`,r.message,t);break;case`pattern:zod`:jd(n,Td.email,r.message,t)}break;case`url`:Ad(n,`uri`,r.message,t);break;case`uuid`:Ad(n,`uuid`,r.message,t);break;case`regex`:jd(n,r.regex,r.message,t);break;case`cuid`:jd(n,Td.cuid,r.message,t);break;case`cuid2`:jd(n,Td.cuid2,r.message,t);break;case`startsWith`:jd(n,RegExp(`^${Dd(r.value,t)}`),r.message,t);break;case`endsWith`:jd(n,RegExp(`${Dd(r.value,t)}$`),r.message,t);break;case`datetime`:Ad(n,`date-time`,r.message,t);break;case`date`:Ad(n,`date`,r.message,t);break;case`time`:Ad(n,`time`,r.message,t);break;case`duration`:Ad(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`:jd(n,RegExp(Dd(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&Ad(n,`ipv4`,r.message,t),r.version!==`v4`&&Ad(n,`ipv6`,r.message,t);break;case`base64url`:jd(n,Td.base64url,r.message,t);break;case`jwt`:jd(n,Td.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&jd(n,Td.ipv4Cidr,r.message,t),r.version!==`v4`&&jd(n,Td.ipv6Cidr,r.message,t);break;case`emoji`:jd(n,Td.emoji(),r.message,t);break;case`ulid`:jd(n,Td.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:Ad(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:jd(n,Td.base64,r.message,t)}break;case`nanoid`:jd(n,Td.nanoid,r.message,t)}return n}function Dd(e,t){return t.patternStrategy===`escape`?kd(e):e}var Od=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function kd(e){let t=``;for(let n=0;n<e.length;n++)Od.has(e[n])||(t+=`\\`),t+=e[n];return t}function Ad(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 jd(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:Md(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Md(t,r)}function Md(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
|
|
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 Mu(`Invalid \`retry\` value: "${t}"`,{type:`invalid-retry`,value:t,line:i}));break;default:n(new Mu(`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 Ru(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 zu(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 Bu=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Lu({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:Vu,atob:Hu}=globalThis,Uu=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get,Wu=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,`byteLength`).get;function Gu(e){return ArrayBuffer.isView(e)&&Uu.call(e)===`Uint8Array`}function Ku(e){if(typeof e!=`object`||!e||!(`byteLength`in e))return!1;try{return Wu.call(e),!0}catch{return!1}}function qu(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 Ju=`vercel.ai.error.${`AI_DownloadError`}`;function Yu(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 Xu(){let e=Error.prepareStackTrace;try{Error.prepareStackTrace=(e,t)=>t;let e=Error(`Capture current module path`);Error.captureStackTrace(e,Xu);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 Zu=({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 yu({argument:`separator`,message:`The separator "${r}" must not be part of the alphabet "${n}".`});return()=>`${e}${r}${i()}`},Qu=Zu();function $u(e){return globalThis.Buffer?.isBuffer(e)??!1}function ed(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var td=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,nd=/"(?: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 rd(e){let t=JSON.parse(e);return typeof t!=`object`||!t||td.test(e)===!1&&nd.test(e)===!1?t:id(t)}function id(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 ad(e){let{stackTraceLimit:t}=Error;try{Error.stackTraceLimit=0}catch{return rd(e)}try{return rd(e)}finally{Error.stackTraceLimit=t}}function od(e){if(e.type===`object`||Array.isArray(e.type)&&e.type.includes(`object`)){let{additionalProperties:t}=e;e.additionalProperties=t!=null&&typeof t!=`boolean`&&sd(t);let{properties:n}=e;if(n!=null)for(let e of Object.keys(n))n[e]=sd(n[e])}e.items!=null&&(e.items=Array.isArray(e.items)?e.items.map(sd):sd(e.items)),e.anyOf!=null&&(e.anyOf=e.anyOf.map(sd)),e.allOf!=null&&(e.allOf=e.allOf.map(sd)),e.oneOf!=null&&(e.oneOf=e.oneOf.map(sd));let{definitions:t}=e;if(t!=null)for(let e of Object.keys(t))t[e]=sd(t[e]);return e}function sd(e){return typeof e==`boolean`?e:od(e)}var cd=Symbol(`Let zodToJsonSchema decide on which parser to use`),ld={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`},ud=e=>typeof e==`string`?{...ld,name:e}:{...ld,...e};function dd(){return{}}function fd(e,t){let n={type:`array`};return e.type?._def&&e.type?._def?.typeName!==`ZodAny`&&(n.items=rf(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 pd(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 md(){return{type:`boolean`}}function hd(e,t){return rf(e.type._def,t)}var gd=(e,t)=>rf(e.innerType._def,t);function _d(e,t,n){let r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>_d(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 vd(e)}}var vd=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 yd(e,t){return{...rf(e.innerType._def,t),default:e.defaultValue()}}function bd(e,t){return t.effectStrategy===`input`?rf(e.schema._def,t):dd()}function xd(e){return{type:`string`,enum:Array.from(e.values)}}var Sd=e=>`type`in e&&e.type===`string`?!1:`allOf`in e;function Cd(e,t){let n=[rf(e.left._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]}),rf(e.right._def,{...t,currentPath:[...t.currentPath,`allOf`,`1`]})].filter(e=>!!e),r=[];return n.forEach(e=>{if(Sd(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 wd(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 Td=void 0,Ed={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:()=>(Td===void 0&&(Td=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)),Td),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 Dd(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`:jd(n,`email`,r.message,t);break;case`format:idn-email`:jd(n,`idn-email`,r.message,t);break;case`pattern:zod`:Md(n,Ed.email,r.message,t)}break;case`url`:jd(n,`uri`,r.message,t);break;case`uuid`:jd(n,`uuid`,r.message,t);break;case`regex`:Md(n,r.regex,r.message,t);break;case`cuid`:Md(n,Ed.cuid,r.message,t);break;case`cuid2`:Md(n,Ed.cuid2,r.message,t);break;case`startsWith`:Md(n,RegExp(`^${Od(r.value,t)}`),r.message,t);break;case`endsWith`:Md(n,RegExp(`${Od(r.value,t)}$`),r.message,t);break;case`datetime`:jd(n,`date-time`,r.message,t);break;case`date`:jd(n,`date`,r.message,t);break;case`time`:jd(n,`time`,r.message,t);break;case`duration`:jd(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`:Md(n,RegExp(Od(r.value,t)),r.message,t);break;case`ip`:r.version!==`v6`&&jd(n,`ipv4`,r.message,t),r.version!==`v4`&&jd(n,`ipv6`,r.message,t);break;case`base64url`:Md(n,Ed.base64url,r.message,t);break;case`jwt`:Md(n,Ed.jwt,r.message,t);break;case`cidr`:r.version!==`v6`&&Md(n,Ed.ipv4Cidr,r.message,t),r.version!==`v4`&&Md(n,Ed.ipv6Cidr,r.message,t);break;case`emoji`:Md(n,Ed.emoji(),r.message,t);break;case`ulid`:Md(n,Ed.ulid,r.message,t);break;case`base64`:switch(t.base64Strategy){case`format:binary`:jd(n,`binary`,r.message,t);break;case`contentEncoding:base64`:n.contentEncoding=`base64`;break;case`pattern:zod`:Md(n,Ed.base64,r.message,t)}break;case`nanoid`:Md(n,Ed.nanoid,r.message,t)}return n}function Od(e,t){return t.patternStrategy===`escape`?Ad(e):e}var kd=new Set(`ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789`);function Ad(e){let t=``;for(let n=0;n<e.length;n++)kd.has(e[n])||(t+=`\\`),t+=e[n];return t}function jd(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 Md(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:Nd(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):e.pattern=Nd(t,r)}function Nd(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 Nd(e,t){let n={type:`object`,additionalProperties:nf(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}=Ed(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}=md(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Pd(e,t){return t.mapStrategy===`record`?Nd(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[nf(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||ud(),nf(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||ud()],minItems:2,maxItems:2}}}function Fd(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 Id(){return{not:ud()}}function Ld(){return{type:`null`}}var Rd={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function zd(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in Rd&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=Rd[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 Bd(e,t)}var Bd=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>nf(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 Vd(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[Rd[e.innerType._def.typeName],`null`]};let n=nf(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Hd(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 Ud(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=Gd(a),s=nf(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=Wd(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Wd(e,t){if(e.catchall._def.typeName!==`ZodNever`)return nf(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 Gd(e){try{return e.isOptional()}catch{return!0}}var Kd=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return nf(e.innerType._def,t);let n=nf(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:ud()},n]}:ud()},qd=(e,t)=>{if(t.pipeStrategy===`input`)return nf(e.in._def,t);if(t.pipeStrategy===`output`)return nf(e.out._def,t);let n=nf(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,nf(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Jd(e,t){return nf(e.type._def,t)}function Yd(e,t){let n={type:`array`,uniqueItems:!0,items:nf(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 Xd(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>nf(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:nf(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>nf(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Zd(){return{not:ud()}}function Qd(){return ud()}var $d=(e,t)=>nf(e.innerType._def,t),ef=(e,t,n)=>{switch(t){case`ZodString`:return Ed(e,n);case`ZodNumber`:return Hd(e);case`ZodObject`:return Ud(e,n);case`ZodBigInt`:return fd(e);case`ZodBoolean`:return pd();case`ZodDate`:return gd(e,n);case`ZodUndefined`:return Zd();case`ZodNull`:return Ld();case`ZodArray`:return dd(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return zd(e,n);case`ZodIntersection`:return Sd(e,n);case`ZodTuple`:return Xd(e,n);case`ZodRecord`:return Nd(e,n);case`ZodLiteral`:return Cd(e);case`ZodEnum`:return bd(e);case`ZodNativeEnum`:return Fd(e);case`ZodNullable`:return Vd(e,n);case`ZodOptional`:return Kd(e,n);case`ZodMap`:return Pd(e,n);case`ZodSet`:return Yd(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return Jd(e,n);case`ZodNaN`:case`ZodNever`:return Id();case`ZodEffects`:return yd(e,n);case`ZodAny`:return ud();case`ZodUnknown`:return Qd();case`ZodDefault`:return vd(e,n);case`ZodBranded`:return md(e,n);case`ZodReadonly`:return $d(e,n);case`ZodCatch`:return hd(e,n);case`ZodPipeline`:return qd(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},tf=(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 nf(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==sd)return i}if(r&&!n){let e=rf(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=ef(e,e.typeName,t),o=typeof a==`function`?nf(a(),t):a;if(o&&af(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var rf=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:tf(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`),ud()):t.$refStrategy===`seen`?ud():void 0}},af=(e,t,n)=>(e.description&&(n.description=e.description),n),of=e=>{let t=ld(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}]))}},sf=(e,t)=>{let n=of(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:nf(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??ud()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=nf(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??ud(),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},cf=Symbol.for(`vercel.ai.schema`);function lf(e){let t;return()=>(t??=e(),t)}function uf(e,{validate:t}={}){return{[cf]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function df(e){return typeof e==`object`&&!!e&&cf in e&&e[cf]===!0&&`jsonSchema`in e&&`validate`in e}function ff(e){return e==null?uf({type:`object`,properties:{},additionalProperties:!1}):df(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?vf(e):pf(e):e()}function pf(e){return uf(()=>{if(!mf(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return ad(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 Du({value:t,cause:n.issues})}}})}function mf(e){return e[`~standard`].jsonSchema!=null}function hf(e,t){let n=t?.useReferences??!1;return uf(()=>sf(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 gf(e,t){let n=t?.useReferences??!1;return uf(()=>ad(ye(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await fe(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function _f(e){return`_zod`in e}function vf(e,t){return _f(e)?gf(e,t):hf(e,t)}async function yf({value:e,schema:t,context:n}){let r=await bf({value:e,schema:t,context:n});if(!r.success)throw Du.wrap({value:e,cause:r.error,context:n});return r.value}async function bf({value:e,schema:t,context:n}){let r=ff(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:Du.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:Du.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function xf({text:e,schema:t}){try{let n=id(e);return t==null?{success:!0,value:n,rawValue:n}:await bf({value:n,schema:t})}catch(t){return{success:!1,error:Cu.isInstance(t)?t:new Cu({text:e,cause:t}),rawValue:void 0}}}function Sf({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Bu).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await xf({text:e,schema:t}))}}))}async function Cf(e){return typeof e==`function`&&(e=e()),e}new TextDecoder;var wf=`AI_InvalidArgumentError`,Tf=`vercel.ai.error.${wf}`,Ef=Symbol.for(Tf),Df=class extends ou{constructor({parameter:e,value:t,message:n}){super({name:wf,message:`Invalid argument for parameter ${e}: ${n}`}),this[Ef]=!0,this.parameter=e,this.value=t}static isInstance(e){return ou.hasMarker(e,Tf)}},Of=`AI_UIMessageStreamError`,kf=`vercel.ai.error.${Of}`,Af=Symbol.for(kf),jf=class extends ou{constructor({chunkType:e,chunkId:t,message:n}){super({name:Of,message:n}),this[Af]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return ou.hasMarker(e,kf)}},Mf=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 Nf(e){return e.replace(/[^a-zA-Z0-9]/g,e=>`_${e.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`)}`)}function Pf({setting:e,provider:t}){return t==null?Mf.get(e)??`AISDK_DEP_SETTING_${Nf(e)}`:`AISDK_DEP_PROVIDER_${Nf(t)}__${Nf(e)}`}function Ff({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 If=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,Lf=!1,Rf=new Set;function zf({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 Bf=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}Lf||(Lf=!0,zf({message:If,type:`Warning`}));for(let t of e.warnings){let n=t.type===`deprecated`?Pf({setting:t.setting,provider:e.provider}):void 0;if(n!=null){if(Rf.has(n))continue;Rf.add(n)}zf({message:Ff({warning:t,provider:e.provider,model:e.model}),type:t.type===`deprecated`?`DeprecationWarning`:`Warning`,code:n})}}};function Vf(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]=Vf(a,i):n[r]=i}return n}function Hf(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function Uf(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: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 Wf(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await xf({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await xf({text:Uf(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}Zu({prefix:`steer`,size:24});function Gf(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(!Gf(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)||!Gf(e[i],t[i]))return!1;return!0}new TextEncoder,new TextEncoder,Zu({prefix:`aitxt`,size:24}),Zu({prefix:`call`,size:24}),TransformStream;var B={array:et,boolean:Qe,custom:He,discriminatedUnion:xt,enum:Xe,instanceof:pt,lazy:We,literal:Et,looseObject:Te,never:g,null:lt,number:wt,object:F,record:y,string:I,union:d,unknown:it},Kf=B.lazy(()=>B.union([B.null(),B.string(),B.number(),B.boolean(),B.record(B.string(),Kf.optional()),B.array(Kf)])),V=B.record(B.string(),B.record(B.string(),Kf.optional())),qf=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()}),Jf=B.record(B.string(),Kf.optional()),Yf=lf(()=>vf(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(qf).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:Jf.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:Jf.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:Jf.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:Jf.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:Jf.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.literal(`steering-message`),id:B.string(),parts:B.array(B.union([B.looseObject({type:B.literal(`text`),text:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`file`),mediaType:B.string(),url:B.string(),filename:B.string().optional(),providerReference:B.record(B.string(),B.string()).optional(),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 Xf(e){return e.type.startsWith(`data-`)}function Zf(){return Object.create(null)}function Qf(e){return e.type===`text`}function $f(e){return e.type===`reasoning`}function ep(e){return e.type.startsWith(`tool-`)}function tp(e){return e.type===`dynamic-tool`}function np(e){return ep(e)||tp(e)}function rp(e){return e.type.split(`-`).slice(1).join(`-`)}function ip(e){return tp(e)?e.toolName:rp(e)}function ap({lastMessage:e,messageId:t}){let n=e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},r=Zf(),i=n.parts.findLastIndex(e=>e.type===`step-start`),a=0;for(let e of n.parts.slice(i+1)){if(!np(e))continue;let t=a;ep(e)&&a++,e.state===`input-streaming`&&(r[e.toolCallId]={text:e.rawInput??``,inputEncoding:e.inputEncoding,index:t,toolName:e.type===`dynamic-tool`?e.toolName:rp(e),dynamic:e.type===`dynamic-tool`,title:e.title,toolMetadata:e.toolMetadata})}return{message:n,activeTextParts:Zf(),activeReasoningParts:Zf(),partialToolCalls:r}}function op({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(np)}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(np(i)&&i.toolCallId===e){t=i;break}}}if(t==null)throw new jf({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(np).find(t=>t.approval?.id===e);if(t==null)throw new jf({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=>ep(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:Vf(r.message.metadata,e);t!=null&&await yf({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 jf({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 jf({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 jf({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 jf({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(ep);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 jf({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 Wf(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(np).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:rp(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:rp(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`steering-message`:r.message.parts.push({type:`steering-message`,id:e.id,parts:e.parts}),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=Zf(),r.activeReasoningParts=Zf(),r.partialToolCalls=Zf(),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,ap({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(Xf(e)){let t=n?.[e.type.slice(5)];if(t!=null){let n=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=n>=0?n:r.message.parts.length;await yf({value:e.data,schema:t,context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let i=e;if(i.transient){o?.(i);break}let a=i.id==null?void 0:r.message.parts.find(e=>i.type===e.type&&i.id===e.id);a==null?r.message.parts.push(i):a.data=i.data,o?.(i),d()}}u.enqueue(e)})}}))}async function sp({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 cp(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}Zu({prefix:`aitxt`,size:24}),Zu({prefix:`call`,size:24}),Zu({prefix:`aitxt`,size:24}),Zu({prefix:`call`,size:24});function lp(e){return e.dynamic=!1,e}var up={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 dp(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))&&Bf({warnings:[up]})}var fp=B.record(B.string(),Kf.optional()),pp=B.record(B.string(),B.string());function mp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===0}function hp(e){let{type:t,...n}=e;return lp({...n,type:`dynamic-tool`,toolName:t.slice(5)})}function gp(e){return e.approval!=null&&Object.prototype.hasOwnProperty.call(e.approval,`inputSchemaInput`)?{value:e.approval.inputSchemaInput}:void 0}var _p=lf(()=>{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 vf(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(qf).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:pp.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(`steering-message`),id:B.string(),parts:B.array(B.union([B.object({type:B.literal(`text`),text:B.string(),providerMetadata:V.optional()}),B.object({type:B.literal(`file`),mediaType:B.string(),filename:B.string().optional(),url:B.string(),providerReference:pp.optional(),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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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:fp.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 vp({messages:e,metadataSchema:t,dataSchemas:n,tools:r,experimental_refineToolInput:i},{convertMissingTerminalToolsToDynamic:a}){try{if(e==null)return{success:!1,error:new Df({parameter:`messages`,value:e,message:`messages parameter must be provided`})};let o=await yf({value:e,schema:_p});if(dp(o),t)for(let[e,n]of o.entries())n.metadata=await yf({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 Du({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 yf({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:Hf(r,s),u=n.state===`output-available`||n.state===`output-error`||n.state===`output-denied`;if(!l&&u){(r!=null||a)&&(t.parts[o]=hp(n));continue}if(!l)return{success:!1,error:new Du({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=gp(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 bf({value:p,schema:l.inputSchema,context:d}),t;if(!e.success)t=e.error;else if(f!=null)try{let r=Hf(i,s);Gf(r==null?e.value:await r(e.value),n.input)||(t=new Du({value:n.input,cause:`Tool input does not match the output reconstructed from inputSchemaInput.`,context:d}))}catch(e){t=new Du({value:p,cause:e,context:d})}if(t!=null)if(n.state===`output-error`||n.state===`output-available`&&mp(n.input))m=!0;else throw t}n.state===`output-available`&&l.outputSchema&&await yf({value:n.output,schema:l.outputSchema,context:{field:`messages[${e}].parts[${o}].output`,entityName:s,entityId:n.toolCallId}}),m&&(t.parts[o]=hp(n))}}return{success:!0,data:o}}catch(e){return{success:!1,error:e}}}async function yp(e){return vp(e,{convertMissingTerminalToolsToDynamic:!1})}async function bp(e){let t=await yp(e);if(!t.success)throw t.error;return t.data}Zu({prefix:`call`,size:24}),Zu({prefix:`call`,size:24}),new TextEncoder,Zu({prefix:`call`,size:24}),Zu({prefix:`aiobj`,size:24});var{atob:xp}=globalThis,Sp=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)})}};Zu({prefix:`aiobj`,size:24}),Zu({prefix:`call`,size:24});var Cp=B.union([B.string(),B.custom(Gu,{message:`Must be a Uint8Array`}),B.custom(Ku,{message:`Must be an ArrayBuffer`}),B.custom($u,{message:`Must be a Buffer`})]),wp=B.record(B.string(),B.string()),Tp=B.object({type:B.literal(`text`),text:B.string(),providerOptions:V.optional()}),Ep=B.object({type:B.literal(`image`),image:B.union([Cp,B.instanceof(URL),wp]),mediaType:B.string().optional(),providerOptions:V.optional()}),Dp=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:Cp}),B.object({type:B.literal(`url`),url:B.instanceof(URL)}),B.object({type:B.literal(`reference`),reference:wp}),B.object({type:B.literal(`text`),text:B.string()})]),Op=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:Cp}),B.object({type:B.literal(`url`),url:B.instanceof(URL)})]),kp=B.object({type:B.literal(`file`),data:B.union([Dp,Cp,B.instanceof(URL),wp]),filename:B.string().optional(),mediaType:B.string(),providerOptions:V.optional()}),Ap=B.object({type:B.literal(`reasoning`),text:B.string(),providerOptions:V.optional()}),jp=B.object({type:B.literal(`custom`),kind:B.string().transform(e=>e),providerOptions:V.optional()}),Mp=B.object({type:B.literal(`reasoning-file`),data:B.union([Op,Cp,B.instanceof(URL)]),mediaType:B.string(),providerOptions:V.optional()}),Np=B.object({type:B.literal(`tool-call`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerOptions:V.optional(),providerExecuted:B.boolean().optional()}),Pp=B.discriminatedUnion(`type`,[B.object({type:B.literal(`text`),value:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`json`),value:Kf,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:Kf,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:Dp,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()})]))})]),Fp=B.object({type:B.literal(`tool-result`),toolCallId:B.string(),toolName:B.string(),output:Pp,providerOptions:V.optional()}),Ip=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()}),Lp=B.object({type:B.literal(`tool-approval-response`),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional()}),Rp=B.object({role:B.literal(`system`),content:B.string(),providerOptions:V.optional()}),zp=B.object({role:B.literal(`user`),content:B.union([B.string(),B.array(B.union([Tp,Ep,kp]))]),providerOptions:V.optional()}),Bp=B.object({role:B.literal(`assistant`),content:B.union([B.string(),B.array(B.union([Tp,jp,kp,Ap,Mp,Np,Fp,Ip]))]),providerOptions:V.optional()}),Vp=B.object({role:B.literal(`tool`),content:B.array(B.union([Fp,Lp])),providerOptions:V.optional()});B.union([Rp,zp,Bp,Vp]),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()}),Zu({prefix:`call`,size:24}),Zu({prefix:`call`,size:24}),Zu({prefix:`call`,size:24});async function Hp({response:e,url:t,fallbackMessage:n}){let r=await e.text();return new uu({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function Up(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new ju({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 Wp(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 Gp=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 Cf(this.body),r=await Cf(this.headers),i=await Cf(this.credentials),a={...qu(r),...qu(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:qu(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 Hp({response:d,url:s,fallbackMessage:`Failed to fetch the chat response.`});if(!d.body)throw new mu({message:`The response body is empty.`});return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await Cf(this.body),n=await Cf(this.headers),r=await Cf(this.credentials),i={...qu(n),...qu(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 Df({parameter:`chatId`,value:e.chatId,message:`Chat IDs must not be "." or ".." when using the default reconnect URL.`});o=Wp(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}let s=a?.headers===void 0?i:qu(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 Hp({response:l,url:o,fallbackMessage:`Failed to fetch the chat response.`});if(!l.body)throw new mu({message:`The response body is empty.`});return this.processResponseStream(l.body)}},Kp=class extends Gp{constructor({resumeStreamIsReplay:e=!0,...t}={}){super(t),this.resumeStreamIsReplay=e}processResponseStream(e){return Sf({stream:e,schema:Yf}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},qp=class{get id(){return this._id??=this.generateId()}constructor({generateId:e=Qu,id:t,transport:n=new Kp,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 Sp,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=>np(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 Up(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 Df({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} not found`});if(this.state.messages[t].role!==`user`)throw new Df({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 Df({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=>np(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=>np(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(!np(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=>np(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=cp();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=>np(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:ap({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 sp({stream:op({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 Jp({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(np);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 Yp({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(np).filter(e=>!e.providerExecuted),a=r.reduce((e,t,n)=>np(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 Xp=n(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}))(),1);function Zp(e,t){return t==null?e:(0,Xp.default)(e,t)}function Qp(e){return Array.isArray(e)?[...e]:typeof e==`object`&&e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var $p=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=Qp(t.metadata)),n},this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Zp(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},em=class extends qp{#e;constructor({messages:e,...t}){let n=new $p(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}},tm=new WeakMap;function nm({chat:e,state:t}){if(document.visibilityState!==`visible`||t.pendingVisibilityResume!=null)return;let n=()=>tm.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 rm({chat:e,registration:t}){let n=tm.get(e);if(n==null){let t={registrations:new Set};if(tm.set(e,t),n=t,typeof document<`u`){let n=()=>nm({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?.(),tm.delete(e))}}function im(e){return{chat:e,messages:e.messages,status:e.status,error:e.error}}function am(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function om({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){let i=e??t,a=(0,L.useRef)({}),o=(0,L.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 Kp),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,L.useMemo)(()=>({chat:`chat`in r?r.chat:new em(l),isExternallyManaged:`chat`in r}),[`chat`in r?r.chat:r.id]);(0,L.useEffect)(()=>{if(!d)return()=>{u.stop()}},[u,d]);let[f,p]=(0,L.useState)(()=>im(u));f.chat!==u&&p(im(u)),(0,L.useEffect)(()=>{let e=!0,t=()=>{if(!e)return;let t=im(u);p(e=>e.chat!==u||am(e,t)?e:t)},n=[u[`~registerMessagesCallback`](t,i),u[`~registerStatusCallback`](t),u[`~registerErrorCallback`](t)],r=im(u);return p(e=>am(e,r)?e:r),()=>{e=!1,n.forEach(e=>e())}},[u,i]);let{messages:m,status:h,error:g}=f,_=(0,L.useCallback)(e=>{typeof e==`function`&&(e=e(u.messages)),u.messages=e},[u]);return(0,L.useEffect)(()=>{if(n)return rm({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 sm=(0,L.createContext)({});function cm(e){let t=(0,L.useRef)(null);return t.current===null&&(t.current=e()),t.current}var lm=typeof window<`u`?L.useLayoutEffect:L.useEffect,um=(0,L.createContext)(null);function dm(e,t){e.indexOf(t)===-1&&e.push(t)}function fm(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var pm=(e,t,n)=>n>t?t:n<e?e:n,mm={},hm=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),gm=e=>typeof e==`object`&&!!e,_m=e=>/^0[^.\s]+$/u.test(e);function vm(e){let t;return()=>(t===void 0&&(t=e()),t)}var ym=e=>e,bm=(...e)=>e.reduce((e,t)=>n=>t(e(n))),xm=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},Sm=class{constructor(){this.subscriptions=[]}add(e){return dm(this.subscriptions,e),()=>fm(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}},Cm=e=>e*1e3,wm=e=>e/1e3,Tm=(e,t)=>t?1e3/t*e:0,Em=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Dm=1e-7,Om=12;function km(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Em(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Dm&&++s<Om);return o}function Am(e,t,n,r){if(e===t&&n===r)return ym;let i=t=>km(t,0,1,e,n);return e=>e===0||e===1?e:Em(i(e),t,r)}var jm=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Mm=e=>t=>1-e(1-t),Nm=Am(.33,1.53,.69,.99),Pm=Mm(Nm),Fm=jm(Pm),Im=e=>e>=1?1:(e*=2)<1?.5*Pm(e):.5*(2-2**(-10*(e-1))),Lm=e=>1-Math.sin(Math.acos(e)),Rm=Mm(Lm),zm=jm(Lm),Bm=Am(.42,0,1,1),Vm=Am(0,0,.58,1),Hm=Am(.42,0,.58,1),Um=e=>Array.isArray(e)&&typeof e[0]!=`number`,Wm=e=>Array.isArray(e)&&typeof e[0]==`number`,Gm={linear:ym,easeIn:Bm,easeInOut:Hm,easeOut:Vm,circIn:Lm,circInOut:zm,circOut:Rm,backIn:Pm,backInOut:Fm,backOut:Nm,anticipate:Im},Km=e=>typeof e==`string`,qm=e=>{if(Wm(e)){e.length;let[t,n,r,i]=e;return Am(t,n,r,i)}else if(Km(e))return Gm[e],`${e}`,Gm[e];return e},Jm=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function Ym(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 Xm=40;function Zm(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Jm.reduce((e,t)=>(e[t]=Ym(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=mm.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Xm),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:Jm.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<Jm.length;t++)o[Jm[t]].cancel(e)},state:i,steps:o}}var{schedule:Qm,cancel:$m,state:eh,steps:th}=Zm(typeof requestAnimationFrame<`u`?requestAnimationFrame:ym,!0),nh;function rh(){nh=void 0}var ih={now:()=>(nh===void 0&&ih.set(eh.isProcessing||mm.useManualTiming?eh.timestamp:performance.now()),nh),set:e=>{nh=e,queueMicrotask(rh)}},ah=e=>t=>typeof t==`string`&&t.startsWith(e),oh=ah(`--`),sh=ah(`var(--`),ch=e=>sh(e)?lh.test(e.split(`/*`)[0].trim()):!1,lh=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function uh(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var dh={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},fh={...dh,transform:e=>pm(0,1,e)},ph={...dh,default:1},mh=e=>Math.round(e*1e5)/1e5,hh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function gh(e){return e==null}var _h=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,vh=(e,t)=>n=>!!(typeof n==`string`&&_h.test(n)&&n.startsWith(e)||t&&!gh(n)&&Object.prototype.hasOwnProperty.call(n,t)),yh=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(hh);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},bh=e=>pm(0,255,e),xh={...dh,transform:e=>Math.round(bh(e))},Sh={test:vh(`rgb`,`red`),parse:yh(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+xh.transform(e)+`, `+xh.transform(t)+`, `+xh.transform(n)+`, `+mh(fh.transform(r))+`)`};function Ch(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 wh={test:vh(`#`),parse:Ch,transform:Sh.transform},Th=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Eh=Th(`deg`),Dh=Th(`%`),H=Th(`px`),Oh=Th(`vh`),kh=Th(`vw`),Ah={...Dh,parse:e=>Dh.parse(e)/100,transform:e=>Dh.transform(e*100)},jh={test:vh(`hsl`,`hue`),parse:yh(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Dh.transform(mh(t))+`, `+Dh.transform(mh(n))+`, `+mh(fh.transform(r))+`)`},Mh={test:e=>Sh.test(e)||wh.test(e)||jh.test(e),parse:e=>Sh.test(e)?Sh.parse(e):jh.test(e)?jh.parse(e):wh.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Sh.transform(e):jh.transform(e),getAnimatableNone:e=>{let t=Mh.parse(e);return t.alpha=0,Mh.transform(t)}},Nh=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Ph(e){return isNaN(e)&&typeof e==`string`&&(e.match(hh)?.length||0)+(e.match(Nh)?.length||0)>0}var Fh=`number`,Ih=`color`,Lh=`var`,Rh=`var(`,zh="${}",Bh=/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 Vh(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Bh,e=>(Mh.test(e)?(r.color.push(a),i.push(Ih),n.push(Mh.parse(e))):e.startsWith(Rh)?(r.var.push(a),i.push(Lh),n.push(e)):(r.number.push(a),i.push(Fh),n.push(parseFloat(e))),++a,zh)).split(zh),indexes:r,types:i}}function Hh(e){return Vh(e).values}function Uh({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===Fh?i+=mh(r[a]):e===Ih?i+=Mh.transform(r[a]):i+=r[a]}return i}}function Wh(e){return Uh(Vh(e))}var Gh=e=>typeof e==`number`?0:Mh.test(e)?Mh.getAnimatableNone(e):e,Kh=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Gh(e);function qh(e){let t=Vh(e);return Uh(t)(t.values.map((e,n)=>Kh(e,t.split[n])))}var Jh={test:Ph,parse:Hh,createTransformer:Wh,getAnimatableNone:qh};function Yh(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 Xh({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=Yh(s,r,e+1/3),a=Yh(s,r,e),o=Yh(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Zh(e,t){return n=>n>0?t:e}var Qh=(e,t,n)=>e+(t-e)*n,$h=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},eg=[wh,Sh,jh],tg=e=>eg.find(t=>t.test(e));function ng(e){let t=tg(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===jh&&(n=Xh(n)),n}var rg=(e,t)=>{let n=ng(e),r=ng(t);if(!n||!r)return Zh(e,t);let i={...n};return e=>(i.red=$h(n.red,r.red,e),i.green=$h(n.green,r.green,e),i.blue=$h(n.blue,r.blue,e),i.alpha=Qh(n.alpha,r.alpha,e),Sh.transform(i))},ig=new Set([`none`,`hidden`]);function ag(e,t){return ig.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function og(e,t){return n=>Qh(e,t,n)}function sg(e){return typeof e==`number`?og:typeof e==`string`?ch(e)?Zh:Mh.test(e)?rg:dg:Array.isArray(e)?cg:typeof e==`object`?Mh.test(e)?rg:lg:Zh}function cg(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>sg(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function lg(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=sg(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function ug(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 dg=(e,t)=>{let n=Jh.createTransformer(t),r=Vh(e),i=Vh(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?ig.has(e)&&!i.values.length||ig.has(t)&&!r.values.length?ag(e,t):bm(cg(ug(r,i),i.values),n):(`${e}${t}`,Zh(e,t))};function fg(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?Qh(e,t,n):sg(e)(e,t)}var pg=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>Qm.update(t,e),stop:()=>$m(t),now:()=>eh.isProcessing?eh.timestamp:ih.now()}},mg=(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)})`},hg=2e4;function gg(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 _g(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(gg(r),hg);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:wm(i)}}var vg={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 yg(e,t){return e*Math.sqrt(1-t*t)}var bg=12;function xg(e,t,n){let r=n;for(let n=1;n<bg;n++)r-=e(r)/t(r);return r}var Sg=.001;function Cg({duration:e=vg.duration,bounce:t=vg.bounce,velocity:n=vg.velocity,mass:r=vg.mass}){let i,a;vg.maxDuration;let o=1-t;o=pm(vg.minDamping,vg.maxDamping,o),e=pm(vg.minDuration,vg.maxDuration,wm(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=yg(t,o),c=Math.exp(-i);return Sg-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=yg(t**2,o);return(-i(t)+Sg>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=xg(i,a,s);if(e=Cm(e),isNaN(c))return{stiffness:vg.stiffness,damping:vg.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var wg=[`duration`,`bounce`],Tg=[`stiffness`,`damping`,`mass`];function Eg(e,t){return t.some(t=>e[t]!==void 0)}function Dg(e){let t={velocity:vg.velocity,stiffness:vg.stiffness,damping:vg.damping,mass:vg.mass,isResolvedFromDuration:!1,...e};if(!Eg(e,Tg)&&Eg(e,wg))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*pm(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:vg.mass,stiffness:i,damping:a}}else{let n=Cg({...e,velocity:0});t={...t,...n,mass:vg.mass},t.isResolvedFromDuration=!0}return t}function Og(e=vg.visualDuration,t=vg.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}=Dg({...n,velocity:-wm(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=wm(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?vg.restSpeed.granular:vg.restSpeed.default,i||=v?vg.restDelta.granular:vg.restDelta.default;let y,b,x,S,C,w;if(h<1)x=yg(_,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=>Cm(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=Cm(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=Cm(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(gg(T),hg),t=mg(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}Og.applyToOptions=e=>{let t=_g(e,100,Og);return e.ease=t.ease,e.duration=Cm(t.duration),e.type=`keyframes`,e};var kg=5;function Ag(e,t,n){let r=Math.max(t-kg,0);return Tm(n-e(r),t-r)}function jg({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=Og({keyframes:[f.value,m(f.value)],velocity:Ag(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 Mg(e,t,n){let r=[],i=n||mm.mix||fg,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=bm(Array.isArray(t)?t[n]||ym:t,a)),r.push(a)}return r}function Ng(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=Mg(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=xm(e[r],e[r+1],n);return s[r](i)};return n?t=>l(pm(e[0],e[a-1],t)):l}function Pg(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=xm(0,t,r);e.push(Qh(n,1,i))}}function Fg(e){let t=[0];return Pg(t,e.length-1),t}function Ig(e,t){return e.map(e=>e*t)}function Lg(e,t){return e.map(()=>t||Hm).splice(0,e.length-1)}function Rg({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Um(r)?r.map(qm):qm(r),a={done:!1,value:t[0]},o=Ng(Ig(n&&n.length===t.length?n:Fg(t),e),t,{ease:Array.isArray(i)?i:Lg(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var zg=e=>e!==null;function Bg(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(zg),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Vg={decay:jg,inertia:jg,tween:Rg,keyframes:Rg,spring:Og};function Hg(e){typeof e.type==`string`&&(e.type=Vg[e.type])}var Ug=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)}},Wg=e=>e/100,Gg=class extends Ug{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!==ih.now()&&this.tick(ih.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;Hg(e);let{type:t=Rg,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||Rg;s!==Rg&&typeof o[0]!=`number`&&(this.mixKeyframes=bm(Wg,fg(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=gg(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=pm(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!==jg&&(b.value=Bg(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 wm(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+wm(e)}get time(){return wm(this.currentTime)}set time(e){e=Cm(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 Ag(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(ih.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=wm(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=pg,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(ih.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 Kg(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var qg=e=>e*180/Math.PI,Jg=e=>Xg(qg(Math.atan2(e[1],e[0]))),Yg={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Jg,rotateZ:Jg,skewX:e=>qg(Math.atan(e[1])),skewY:e=>qg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Xg=e=>(e%=360,e<0&&(e+=360),e),Zg=Jg,Qg=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),$g=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),e_={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Qg,scaleY:$g,scale:e=>(Qg(e)+$g(e))/2,rotateX:e=>Xg(qg(Math.atan2(e[6],e[5]))),rotateY:e=>Xg(qg(Math.atan2(-e[2],e[0]))),rotateZ:Zg,rotate:Zg,skewX:e=>qg(Math.atan(e[4])),skewY:e=>qg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function t_(e){return+!!e.includes(`scale`)}function n_(e,t){if(!e||e===`none`)return t_(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=e_,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Yg,i=t}if(!i)return t_(t);let a=r[t],o=i[1].split(`,`).map(i_);return typeof a==`function`?a(o):o[a]}var r_=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return n_(n,t)};function i_(e){return parseFloat(e.trim())}var a_=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],o_=new Set([...a_,`pathRotation`]),s_=e=>e===dh||e===H,c_=new Set([`x`,`y`,`z`]),l_=a_.filter(e=>!c_.has(e));function u_(e){let t=[];return l_.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var d_={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})=>n_(t,`x`),y:(e,{transform:t})=>n_(t,`y`)};d_.translateX=d_.x,d_.translateY=d_.y;var f_=new Set,p_=!1,m_=!1,h_=!1;function g_(){if(m_){let e=Array.from(f_).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=u_(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)})}m_=!1,p_=!1,f_.forEach(e=>e.complete(h_)),f_.clear()}function __(){f_.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(m_=!0)})}function v_(){h_=!0,__(),g_(),h_=!1}var y_=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?(f_.add(this),p_||(p_=!0,Qm.read(__),Qm.resolveKeyframes(g_))):(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])}Kg(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),f_.delete(this)}cancel(){this.state===`scheduled`&&(f_.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},b_=e=>e.startsWith(`--`);function x_(e,t,n){b_(t)?e.style.setProperty(t,n):e.style[t]=n}var S_={};function C_(e,t){let n=vm(e);return()=>S_[t]??n()}var w_=C_(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),T_=C_(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),E_=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,D_={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:E_([0,.65,.55,1]),circOut:E_([.55,0,1,.45]),backIn:E_([.31,.01,.66,-.59]),backOut:E_([.33,1.53,.69,.99])};function O_(e,t){if(e)return typeof e==`function`?T_()?mg(e,t):`ease-out`:Wm(e)?E_(e):Array.isArray(e)?e.map(e=>O_(e,t)||D_.easeOut):D_[e]}function k_(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=O_(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 A_(e){return typeof e==`function`&&`applyToOptions`in e}function j_({type:e,...t}){return A_(e)&&T_()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var M_=class extends Ug{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=j_(e);this.animation=k_(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Bg(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),x_(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 wm(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+wm(e)}get time(){return wm(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Cm(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&&w_()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),ym):r(this)}},N_={anticipate:Im,backInOut:Fm,circInOut:zm};function P_(e){return e in N_}function F_(e){typeof e.ease==`string`&&P_(e.ease)&&(e.ease=N_[e.ease])}var I_=10,L_=class extends M_{constructor(e){F_(e),Hg(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 Gg({...a,autoplay:!1}),s=Math.max(I_,ih.now()-this.startTime),c=pm(0,I_,s-I_),l=o.sample(s).value,{name:u}=this.options;i&&u&&x_(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},R_=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Jh.test(e)||e===`0`)&&!e.startsWith(`url(`));function z_(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 B_(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=R_(i,t),s=R_(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:z_(e)||(n===`spring`||A_(n))&&r}function V_(e){e.duration=0,e.type=`keyframes`}var H_=new Set([`opacity`,`clipPath`,`filter`,`transform`]),U_=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function W_(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&U_.test(e[t]))return!0;return!1}var G_=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),K_=vm(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function q_(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 K_()&&n&&(H_.has(n)||G_.has(n)&&W_(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var J_=40,Y_=class extends Ug{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=ih.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||y_;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=ih.now();let u=!0;B_(e,i,a,o)||(u=!1,(mm.instantAnimations||!s)&&l?.(Bg(e,n,t)),e[0]=e[e.length-1],V_(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>J_?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&q_(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new L_({...d,element:p})}catch{m=new Gg(d)}else m=new Gg(d);m.finished.then(()=>{this.notifyFinished()}).catch(ym),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(),v_()),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 X_(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 Z_=30,Q_=e=>!isNaN(parseFloat(e)),$_={current:void 0},ev=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ih.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=ih.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Q_(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 Sm);let n=this.events[e].add(t);return e===`change`?()=>{n(),Qm.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 $_.current&&$_.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=ih.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Z_)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Z_);return Tm(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 tv(e,t){return new ev(e,t)}function nv(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function rv(e,t){let n=e?.[t]??e?.default??e;return n===e?n:nv(n,e)}var iv={type:`spring`,stiffness:500,damping:25,restSpeed:10},av=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ov={type:`keyframes`,duration:.8},sv={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},cv=(e,{keyframes:t})=>t.length>2?ov:o_.has(e)?e.startsWith(`scale`)?av(t[1]):iv:sv,lv=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function uv(e){for(let t in e)if(!lv.has(t))return!0;return!1}var dv=(e,t,n,r={},i,a)=>o=>{let s=rv(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=Cm(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};uv(s)||Object.assign(u,cv(e,u)),u.duration&&=Cm(u.duration),u.repeatDelay&&=Cm(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(V_(u),u.delay===0&&(d=!0)),(mm.instantAnimations||mm.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,V_(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Bg(u.keyframes,s);if(e!==void 0){Qm.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Gg(u):new Y_(u)},fv=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function pv(e){let t=fv.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function mv(e,t,n=1){`${e}`;let[r,i]=pv(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return hm(e)?parseFloat(e):e}return ch(i)?mv(i,t,n+1):i}function hv(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function gv(e,t,n,r){if(typeof t==`function`){let[i,a]=hv(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]=hv(r);t=t(n===void 0?e.custom:n,i,a)}return t}function _v(e,t,n){let r=e.getProps();return gv(r,t,n===void 0?r.custom:n,e)}var vv=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...a_]),yv=e=>Array.isArray(e);function bv(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,tv(n))}function xv(e){return yv(e)?e[e.length-1]||0:e}function Sv(e,t){let{transitionEnd:n={},transition:r={},...i}=_v(e,t)||{};i={...i,...n};for(let t in i)bv(e,t,xv(i[t]))}var Cv=e=>!!(e&&e.getVelocity);function wv(e){return!!(Cv(e)&&e.add)}function Tv(e,t){let n=e.getValue(`willChange`);if(wv(n))return n.add(t);if(!n&&mm.WillChange){let n=new mm.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Ev(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Dv=`data-`+Ev(`framerAppearId`);function Ov(e){return e.props[Dv]}function kv({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function Av(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?nv(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&&kv(f,t))continue;let o={delay:n,...rv(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){Qm.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=Ov(e);if(n){let e=window.MotionHandoffAnimation(n,t,Qm);e!==null&&(o.startTime=e,p=!0)}}Tv(e,t);let m=l??e.shouldReduceMotion;r.start(dv(t,r,i,m&&vv.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>Qm.update(()=>{o&&Sv(e,o)});d.length?Promise.all(d).then(t):t()}return d}function jv(e,t,n={}){let r=_v(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(Av(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Mv(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 Mv(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(jv(c,t,{...o,delay:n+(typeof r==`function`?0:r)+X_(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Nv(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>jv(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=jv(e,t,n);else{let i=typeof t==`function`?_v(e,t,n.custom):t;r=Promise.all(Av(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Pv={test:e=>e===`auto`,parse:e=>e},Fv=e=>t=>t.test(e),Iv=[dh,H,Dh,Eh,kh,Oh,Pv],Lv=e=>Iv.find(Fv(e));function Rv(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||_m(e)}var zv=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Bv(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(hh)||[];if(!r)return e;let i=n.replace(r,``),a=+!!zv.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Vv=/\b([a-z-]*)\(.*?\)/gu,Hv={...Jh,getAnimatableNone:e=>{let t=e.match(Vv);return t?t.map(Bv).join(` `):e}},Uv={...Jh,getAnimatableNone:e=>{let t=Jh.parse(e);return Jh.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Wv={...dh,transform:Math.round},Gv={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:Eh,pathRotation:Eh,rotateX:Eh,rotateY:Eh,rotateZ:Eh,scale:ph,scaleX:ph,scaleY:ph,scaleZ:ph,skew:Eh,skewX:Eh,skewY:Eh,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:fh,originX:Ah,originY:Ah,originZ:H,zIndex:Wv,fillOpacity:fh,strokeOpacity:fh,numOctaves:Wv},Kv={...Gv,color:Mh,backgroundColor:Mh,outlineColor:Mh,fill:Mh,stroke:Mh,borderColor:Mh,borderTopColor:Mh,borderRightColor:Mh,borderBottomColor:Mh,borderLeftColor:Mh,filter:Hv,WebkitFilter:Hv,mask:Uv,WebkitMask:Uv},qv=e=>Kv[e],Jv=new Set([Hv,Uv]);function Yv(e,t){let n=qv(e);return Jv.has(n)||(n=Jh),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Xv=new Set([`auto`,`none`,`0`]);function Zv(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Xv.has(t)&&Vh(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Yv(n,i)}var Qv=class extends y_{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(),ch(r))){let i=mv(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!vv.has(n)||e.length!==2)return;let[r,i]=e,a=Lv(r),o=Lv(i);if(uh(r)!==uh(i)&&d_[n]){this.needsMeasurement=!0;return}if(a!==o)if(s_(a)&&s_(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else d_[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||Rv(e[t]))&&n.push(t);n.length&&Zv(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=d_[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]=d_[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()}},$v=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function ey(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 ty=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function ny(e){return gm(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:ry,cancel:iy}=Zm(queueMicrotask,!1),ay={x:!1,y:!1};function oy(){return ay.x||ay.y}function sy(e){return e===`x`||e===`y`?ay[e]?null:(ay[e]=!0,()=>{ay[e]=!1}):ay.x||ay.y?null:(ay.x=ay.y=!0,()=>{ay.x=ay.y=!1})}function cy(e,t){let n=ey(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function ly(e){return!(e.pointerType===`touch`||oy())}function uy(e,t,n={}){let[r,i,a]=cy(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(!ly(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 dy=(e,t)=>t?e===t||dy(e,t.parentElement):!1,fy=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,py=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function my(e){return py.has(e.tagName)||e.isContentEditable===!0}var hy=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function gy(e){return hy.has(e.tagName)||e.isContentEditable===!0}var _y=new WeakSet;function vy(e){return t=>{t.key===`Enter`&&e(t)}}function yy(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var by=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=vy(()=>{if(_y.has(n))return;yy(n,`down`);let e=vy(()=>{yy(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>yy(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function xy(e){return fy(e)&&!oy()}var Sy=new WeakSet;function Cy(e,t,n={}){let[r,i,a]=cy(e,n),o=e=>{let r=e.currentTarget;if(!xy(e)||Sy.has(e))return;_y.add(r),n.stopPropagation&&Sy.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),_y.has(r)&&_y.delete(r),xy(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||dy(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),ny(e)&&(e.addEventListener(`focus`,e=>by(e,i)),!my(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function wy(e){return gm(e)&&`ownerSVGElement`in e}var Ty=new WeakMap,Ey,Dy=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:wy(r)&&`getBBox`in r?r.getBBox()[t]:r[n],Oy=Dy(`inline`,`width`,`offsetWidth`),ky=Dy(`block`,`height`,`offsetHeight`);function Ay({target:e,borderBoxSize:t}){Ty.get(e)?.forEach(n=>{n(e,{get width(){return Oy(e,t)},get height(){return ky(e,t)}})})}function jy(e){e.forEach(Ay)}function My(){typeof ResizeObserver>`u`||(Ey=new ResizeObserver(jy))}function Ny(e,t){Ey||My();let n=ey(e);return n.forEach(e=>{let n=Ty.get(e);n||(n=new Set,Ty.set(e,n)),n.add(t),Ey?.observe(e)}),()=>{n.forEach(e=>{let n=Ty.get(e);n?.delete(t),n?.size||Ey?.unobserve(e)})}}var Py=new Set,Fy;function Iy(){Fy=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Py.forEach(t=>t(e))},window.addEventListener(`resize`,Fy)}function Ly(e){return Py.add(e),Fy||Iy(),()=>{Py.delete(e),!Py.size&&typeof Fy==`function`&&(window.removeEventListener(`resize`,Fy),Fy=void 0)}}function Ry(e,t){return typeof e==`function`?Ly(e):Ny(e,t)}var zy={value:null,addProjectionMetrics:null};function By(e){return wy(e)&&e.tagName===`svg`}var Vy=[...Iv,Mh,Jh],Hy=e=>Vy.find(Fv(e)),Uy=()=>({translate:0,scale:1,origin:0,originPoint:0}),Wy=()=>({x:Uy(),y:Uy()}),Gy=()=>({min:0,max:0}),Ky=()=>({x:Gy(),y:Gy()}),qy=new WeakMap;function Jy(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Yy(e){return typeof e==`string`||Array.isArray(e)}var Xy=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Zy=[`initial`,...Xy];function Qy(e){return Jy(e.animate)||Zy.some(t=>Yy(e[t]))}function $y(e){return!!(Qy(e)||e.variants)}function eb(e,t,n){for(let r in t){let i=t[r],a=n[r];if(Cv(i))e.addValue(r,i);else if(Cv(a))e.addValue(r,tv(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,tv(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var tb={current:null},nb={current:!1},rb=typeof window<`u`;function ib(){if(nb.current=!0,rb)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>tb.current=e.matches;e.addEventListener(`change`,t),t()}else tb.current=!1}var ab=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],ob={};function sb(e){ob=e}function cb(){return ob}var lb=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=y_,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=ih.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,Qm.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=Qy(t),this.isVariantNode=$y(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&&Cv(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,qy.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:(nb.current||ib(),this.shouldReduceMotion=tb.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(),$m(this.notifyUpdate),$m(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&&H_.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new M_({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:Cm(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=o_.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&Qm.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 ob){let t=ob[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):Ky()}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<ab.length;t++){let n=ab[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=eb(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=tv(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`&&(hm(n)||_m(n))?n=parseFloat(n):!Hy(n)&&Jh.test(t)&&(n=Yv(e,t)),this.setBaseTarget(e,Cv(n)?n.get():n)),Cv(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=gv(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&&!Cv(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 Sm),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){ry.render(this.render)}},ub=class extends lb{constructor(){super(...arguments),this.KeyframeResolver=Qv}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;Cv(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},db=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function fb({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function pb({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function mb(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 hb(e){return e===void 0||e===1}function gb({scale:e,scaleX:t,scaleY:n}){return!hb(e)||!hb(t)||!hb(n)}function _b(e){return gb(e)||vb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function vb(e){return yb(e.x)||yb(e.y)}function yb(e){return e&&e!==`0%`}function bb(e,t,n){return n+t*(e-n)}function xb(e,t,n,r,i){return i!==void 0&&(e=bb(e,i,r)),bb(e,n,r)+t}function Sb(e,t=0,n=1,r,i){e.min=xb(e.min,t,n,r,i),e.max=xb(e.max,t,n,r,i)}function Cb(e,{x:t,y:n}){Sb(e.x,t.translate,t.scale,t.originPoint),Sb(e.y,n.translate,n.scale,n.originPoint)}var wb=.999999999999,Tb=1.0000000000001;function Eb(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&&(Db(e.x,-a.scroll.offset.x),Db(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,Cb(e,o)),r&&_b(a.latestValues)&&Ab(e,a.latestValues,a.layout?.layoutBox))}t.x<Tb&&t.x>wb&&(t.x=1),t.y<Tb&&t.y>wb&&(t.y=1)}function Db(e,t){e.min+=t,e.max+=t}function Ob(e,t,n,r,i=.5){Sb(e,t,n,Qh(e.min,e.max,i),r)}function kb(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function Ab(e,t,n){let r=n??e;Ob(e.x,kb(t.x,r.x),t.scaleX,t.scale,t.originX),Ob(e.y,kb(t.y,r.y),t.scaleY,t.scale,t.originY)}function jb(e,t){return fb(mb(e.getBoundingClientRect(),t))}function Mb(e,t,n){let r=jb(e,n),{scroll:i}=t;return i&&(Db(r.x,i.offset.x),Db(r.y,i.offset.y)),r}var Nb={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Pb=a_.length;function Fb(e,t,n){let r=``,i=!0;for(let a=0;a<Pb;a++){let o=a_[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=ty(s,Gv[o]);if(!c){i=!1;let t=Nb[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${ty(a,Gv.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Ib(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(o_.has(e)){o=!0;continue}else if(oh(e)){i[e]=n;continue}else{let t=ty(n,Gv[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Fb(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 Lb(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 Rb(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var zb={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(H.test(e))e=parseFloat(e);else return e;return`${Rb(e,t.target.x)}% ${Rb(e,t.target.y)}%`}},Bb={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Jh.parse(e);if(i.length>5)return r;let a=Jh.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=Qh(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Vb={borderRadius:{...zb,applyTo:[...$v]},borderTopLeftRadius:zb,borderTopRightRadius:zb,borderBottomLeftRadius:zb,borderBottomRightRadius:zb,boxShadow:Bb};function Hb(e,{layout:t,layoutId:n}){return o_.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Vb[e]||e===`opacity`)}function Ub(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(Cv(r[t])||i&&Cv(i[t])||Hb(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Wb(e){return window.getComputedStyle(e)}var Gb=class extends ub{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Lb}readValueFromInstance(e,t){if(o_.has(t))return this.projection?.isProjecting?t_(t):r_(e,t);{let n=Wb(e),r=(oh(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return jb(e,t)}build(e,t,n){Ib(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Ub(e,t,n)}},Kb={offset:`stroke-dashoffset`,array:`stroke-dasharray`},qb={offset:`strokeDashoffset`,array:`strokeDasharray`};function Jb(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Kb:qb;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Yb=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Xb(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Ib(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 Yb)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&&Jb(d,i,a,o,!1)}var Zb=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`]),Qb=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function $b(e,t,n,r){Lb(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Zb.has(n)?n:Ev(n),t.attrs[n])}function ex(e,t,n){let r=Ub(e,t,n);for(let n in e)if(Cv(e[n])||Cv(t[n])){let t=a_.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var tx=class extends ub{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=Ky}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(o_.has(t)){let e=qv(t);return e&&e.default||0}return t=Zb.has(t)?t:Ev(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return ex(e,t,n)}build(e,t,n){Xb(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){$b(e,t,n,r)}mount(e){this.isSVGTag=Qb(e.tagName),super.mount(e)}},nx=Zy.length;function rx(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&rx(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<nx;n++){let r=Zy[n],i=e.props[r];(Yy(i)||i===!1)&&(t[r]=i)}return t}function ix(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 ax=[...Xy].reverse(),ox=Xy.length;function sx(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Nv(e,t,n)))}function cx(e){let t=sx(e),n=dx(),r=!0,i=!1,a=t=>(n,r)=>{let i=_v(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=rx(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<ox;t++){let p=ax[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Yy(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||Jy(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=lx(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=yv(t)&&yv(n)?!ix(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=_v(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=X_(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=_v(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=dx(),i=!0}}}function lx(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!ix(t,e):!1}function ux(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function dx(){return{animate:ux(!0),whileInView:ux(),whileHover:ux(),whileTap:ux(),whileDrag:ux(),whileFocus:ux(),exit:ux()}}function fx(e,t){e.min=t.min,e.max=t.max}function px(e,t){fx(e.x,t.x),fx(e.y,t.y)}function mx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var hx=.9999,gx=1.0001,_x=-.01,vx=.01;function yx(e){return e.max-e.min}function bx(e,t,n){return Math.abs(e-t)<=n}function xx(e,t,n,r=.5){e.origin=r,e.originPoint=Qh(t.min,t.max,e.origin),e.scale=yx(n)/yx(t),e.translate=Qh(n.min,n.max,e.origin)-e.originPoint,(e.scale>=hx&&e.scale<=gx||isNaN(e.scale))&&(e.scale=1),(e.translate>=_x&&e.translate<=vx||isNaN(e.translate))&&(e.translate=0)}function Sx(e,t,n,r){xx(e.x,t.x,n.x,r?r.originX:void 0),xx(e.y,t.y,n.y,r?r.originY:void 0)}function Cx(e,t,n,r=0){e.min=(r?Qh(n.min,n.max,r):n.min)+t.min,e.max=e.min+yx(t)}function wx(e,t,n,r){Cx(e.x,t.x,n.x,r?.x),Cx(e.y,t.y,n.y,r?.y)}function Tx(e,t,n,r=0){let i=r?Qh(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+yx(t)}function Ex(e,t,n,r){Tx(e.x,t.x,n.x,r?.x),Tx(e.y,t.y,n.y,r?.y)}function Dx(e,t,n,r,i){return e-=t,e=bb(e,1/n,r),i!==void 0&&(e=bb(e,1/i,r)),e}function Ox(e,t=0,n=1,r=.5,i,a=e,o=e){if(Dh.test(t)&&(t=parseFloat(t),t=Qh(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=Qh(a.min,a.max,r);e===a&&(s-=t),e.min=Dx(e.min,t,n,s,i),e.max=Dx(e.max,t,n,s,i)}function kx(e,t,[n,r,i],a,o){Ox(e,t[n],t[r],t[i],t.scale,a,o)}var Ax=[`x`,`scaleX`,`originX`],jx=[`y`,`scaleY`,`originY`];function Mx(e,t,n,r){kx(e.x,t,Ax,n?n.x:void 0,r?r.x:void 0),kx(e.y,t,jx,n?n.y:void 0,r?r.y:void 0)}function Nx(e){return e.translate===0&&e.scale===1}function Px(e){return Nx(e.x)&&Nx(e.y)}function Fx(e,t){return e.min===t.min&&e.max===t.max}function Ix(e,t){return Fx(e.x,t.x)&&Fx(e.y,t.y)}function Lx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function Rx(e,t){return Lx(e.x,t.x)&&Lx(e.y,t.y)}function zx(e){return yx(e.x)/yx(e.y)}function Bx(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Vx(e){return[e(`x`),e(`y`)]}function Hx(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 Ux=$v.length,Wx=e=>typeof e==`string`?parseFloat(e):e,Gx=e=>typeof e==`number`||H.test(e);function Kx(e,t,n,r,i,a){i?(e.opacity=Qh(0,n.opacity??1,Jx(r)),e.opacityExit=Qh(t.opacity??1,0,Yx(r))):a&&(e.opacity=Qh(t.opacity??1,n.opacity??1,r));for(let i=0;i<Ux;i++){let a=$v[i],o=qx(t,a),s=qx(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Gx(o)===Gx(s)?(e[a]=Math.max(Qh(Wx(o),Wx(s),r),0),(Dh.test(s)||Dh.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=Qh(t.rotate||0,n.rotate||0,r))}function qx(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Jx=Xx(0,.5,Rm),Yx=Xx(.5,.95,ym);function Xx(e,t,n){return r=>r<e?0:r>t?1:n(xm(e,t,r))}function Zx(e,t,n){let r=Cv(e)?e:tv(e);return r.start(dv(``,r,t,n)),r.animation}function Qx(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var $x=(e,t)=>e.depth-t.depth,eS=class{constructor(){this.children=[],this.isDirty=!1}add(e){dm(this.children,e),this.isDirty=!0}remove(e){fm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort($x),this.isDirty=!1,this.children.forEach(e)}};function tS(e,t){let n=ih.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&($m(r),e(a-t))};return Qm.setup(r,!0),()=>$m(r)}function nS(e){return Cv(e)?e.get():e}var rS=class{constructor(){this.members=[]}add(e){dm(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&&(fm(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(fm(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)}},iS={hasAnimatedSinceResize:!0,hasEverUpdated:!1},aS={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},oS=[``,`X`,`Y`,`Z`],sS=1e3,cS=0;function lS(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function uS(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=Ov(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,Qm,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&uS(r)}function dS({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=cS++,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,zy.value&&(aS.nodes=aS.calculatedTargetDeltas=aS.calculatedProjections=0),this.nodes.forEach(mS),this.nodes.forEach(CS),this.nodes.forEach(wS),this.nodes.forEach(hS),zy.addProjectionMetrics&&zy.addProjectionMetrics(aS)},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 eS)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Sm),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=wy(t)&&!By(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;Qm.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=tS(i,250),iS.hasAnimatedSinceResize&&(iS.hasAnimatedSinceResize=!1,this.nodes.forEach(SS)))})}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()||jS,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!Rx(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={...rv(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||SS(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(),$m(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(TS),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&&uS(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(vS),this.nodes.forEach(_S);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(yS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(bS),this.nodes.forEach(xS),this.nodes.forEach(fS),this.nodes.forEach(pS)):this.nodes.forEach(yS),this.clearAllSnapshots();let e=ih.now();eh.delta=pm(0,1e3/60,e-eh.timestamp),eh.timestamp=e,eh.isProcessing=!0,th.update.process(eh),th.preRender.process(eh),th.render.process(eh),eh.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ry.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(gS),this.sharedNodes.forEach(ES)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Qm.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Qm.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!yx(this.snapshot.measuredBox.x)&&!yx(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||=Ky(),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&&!Px(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||_b(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)),FS(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return Ky();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(LS))){let{scroll:e}=this.root;e&&(Db(t.x,e.offset.x),Db(t.y,e.offset.y))}return t}removeElementScroll(e){let t=Ky();if(px(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&&px(t,e),Db(t.x,i.offset.x),Db(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||Ky();px(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&&(Db(r.x,-n.scroll.offset.x),Db(r.y,-n.scroll.offset.y)),_b(n.latestValues)&&Ab(r,n.latestValues,n.layout?.layoutBox)}return _b(this.latestValues)&&Ab(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=Ky();px(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!_b(n.latestValues))continue;let r;n.instance&&(gb(n.latestValues)&&n.updateSnapshot(),r=Ky(),px(r,n.measurePageBox())),Mx(t,n.latestValues,n.snapshot?.layoutBox,r)}return _b(this.latestValues)&&Mx(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!==eh.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=eh.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=Ky(),this.targetWithTransforms=Ky()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),wx(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):px(this.target,this.layout.layoutBox),Cb(this.target,this.targetDelta)):px(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),zy.value&&aS.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||gb(this.parent.latestValues)||vb(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=Ky(),this.relativeTargetOrigin=Ky(),Ex(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),px(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===eh.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;px(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Eb(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=Ky());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(mx(this.prevProjectionDelta.x,this.projectionDelta.x),mx(this.prevProjectionDelta.y,this.projectionDelta.y)),Sx(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Bx(this.projectionDelta.x,this.prevProjectionDelta.x)||!Bx(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),zy.value&&aS.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=Wy(),this.projectionDelta=Wy(),this.projectionDeltaWithTransform=Wy()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Wy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=Ky(),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(AS));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=Qh(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=Qh(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(DS(o.x,e.x,n),DS(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Ex(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),kS(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Ix(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=Ky(),px(f,this.relativeTarget)),c&&(this.animationValues=a,Kx(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&&=($m(this.pendingAnimation),void 0),this.pendingAnimation=Qm.update(()=>{iS.hasAnimatedSinceResize=!0,this.motionValue||=tv(0),this.motionValue.jump(0,!1),this.currentAnimation=Zx(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(sS),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&&IS(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||Ky();let t=yx(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=yx(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}px(t,n),Ab(t,i),Sx(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new rS),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&&lS(`z`,e,r,this.animationValues);for(let t=0;t<oS.length;t++)lS(`rotate${oS[t]}`,e,r,this.animationValues),lS(`skew${oS[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=nS(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=nS(t?.pointerEvents)||``),this.hasProjected&&!_b(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Hx(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 Vb){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Vb[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?nS(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(_S),this.root.sharedNodes.clear()}}}function fS(e){e.updateLayout()}function pS(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`)Vx(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=yx(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;fx(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else IS(i,t.layoutBox,n)&&Vx(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=yx(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=Wy();Sx(o,n,t.layoutBox);let s=Wy();a?Sx(s,e.applyTransform(r,!0),t.measuredBox):Sx(s,n,t.layoutBox);let c=!Px(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=Ky();Ex(s,t.layoutBox,i.layoutBox,o);let c=Ky();Ex(c,n,a.layoutBox,o),Rx(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 mS(e){zy.value&&aS.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 hS(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gS(e){e.clearSnapshot()}function _S(e){e.clearMeasurements()}function vS(e){e.isLayoutDirty=!0,e.updateLayout()}function yS(e){e.isLayoutDirty=!1}function bS(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function xS(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function SS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function CS(e){e.resolveTargetDelta()}function wS(e){e.calcProjection()}function TS(e){e.resetSkewAndRotation()}function ES(e){e.removeLeadSnapshot()}function DS(e,t,n){e.translate=Qh(t.translate,0,n),e.scale=Qh(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function OS(e,t,n,r){e.min=Qh(t.min,n.min,r),e.max=Qh(t.max,n.max,r)}function kS(e,t,n,r){OS(e.x,t.x,n.x,r),OS(e.y,t.y,n.y,r)}function AS(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var jS={duration:.45,ease:[.4,0,.1,1]},MS=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),NS=MS(`applewebkit/`)&&!MS(`chrome/`)?Math.round:ym;function PS(e){e.min=NS(e.min),e.max=NS(e.max)}function FS(e){PS(e.x),PS(e.y)}function IS(e,t,n){return e===`position`||e===`preserve-aspect`&&!bx(zx(t),zx(n),.2)}function LS(e){return e!==e.root&&e.scroll?.wasRoot}var RS=dS({attachResizeListener:(e,t)=>Qx(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),zS={current:void 0},BS=dS({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!zS.current){let e=new RS({});e.mount(window),e.setOptions({layoutScroll:!0}),zS.current=e}return zS.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),VS=(0,L.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function HS(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function US(...e){return t=>{let n=!1,r=e.map(e=>{let r=HS(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():HS(e[t],null)}}}}function WS(...e){return L.useCallback(US(...e),e)}var GS=class extends L.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(ny(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=ny(e)&&e.offsetWidth||0,r=ny(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 KS({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,L.useId)(),s=(0,L.useRef)(null),c=(0,L.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,L.useContext)(VS),u=WS(s,e.props?.ref??e?.ref);return(0,L.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 Pd(e,t){let n={type:`object`,additionalProperties:rf(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}=Dd(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}=hd(e.keyType._def,t);return{...n,propertyNames:i}}return n}function Fd(e,t){return t.mapStrategy===`record`?Pd(e,t):{type:`array`,maxItems:125,items:{type:`array`,items:[rf(e.keyType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`0`]})||dd(),rf(e.valueType._def,{...t,currentPath:[...t.currentPath,`items`,`items`,`1`]})||dd()],minItems:2,maxItems:2}}}function Id(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 Ld(){return{not:dd()}}function Rd(){return{type:`null`}}var zd={ZodString:`string`,ZodNumber:`number`,ZodBigInt:`integer`,ZodBoolean:`boolean`,ZodNull:`null`};function Bd(e,t){let n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in zd&&(!e._def.checks||!e._def.checks.length))){let e=n.reduce((e,t)=>{let n=zd[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 Vd(e,t)}var Vd=(e,t)=>{let n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>rf(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 Hd(e,t){if([`ZodString`,`ZodNumber`,`ZodBigInt`,`ZodBoolean`,`ZodNull`].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[zd[e.innerType._def.typeName],`null`]};let n=rf(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`0`]});return n&&{anyOf:[n,{type:`null`}]}}function Ud(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 Wd(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=Kd(a),s=rf(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=Gd(e,t);return a!==void 0&&(n.additionalProperties=a),n}function Gd(e,t){if(e.catchall._def.typeName!==`ZodNever`)return rf(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 Kd(e){try{return e.isOptional()}catch{return!0}}var qd=(e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return rf(e.innerType._def,t);let n=rf(e.innerType._def,{...t,currentPath:[...t.currentPath,`anyOf`,`1`]});return n?{anyOf:[{not:dd()},n]}:dd()},Jd=(e,t)=>{if(t.pipeStrategy===`input`)return rf(e.in._def,t);if(t.pipeStrategy===`output`)return rf(e.out._def,t);let n=rf(e.in._def,{...t,currentPath:[...t.currentPath,`allOf`,`0`]});return{allOf:[n,rf(e.out._def,{...t,currentPath:[...t.currentPath,`allOf`,n?`1`:`0`]})].filter(e=>e!==void 0)}};function Yd(e,t){return rf(e.type._def,t)}function Xd(e,t){let n={type:`array`,uniqueItems:!0,items:rf(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 Zd(e,t){return e.rest?{type:`array`,minItems:e.items.length,items:e.items.map((e,n)=>rf(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[]),additionalItems:rf(e.rest._def,{...t,currentPath:[...t.currentPath,`additionalItems`]})}:{type:`array`,minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>rf(e._def,{...t,currentPath:[...t.currentPath,`items`,`${n}`]})).reduce((e,t)=>t===void 0?e:[...e,t],[])}}function Qd(){return{not:dd()}}function $d(){return dd()}var ef=(e,t)=>rf(e.innerType._def,t),tf=(e,t,n)=>{switch(t){case`ZodString`:return Dd(e,n);case`ZodNumber`:return Ud(e);case`ZodObject`:return Wd(e,n);case`ZodBigInt`:return pd(e);case`ZodBoolean`:return md();case`ZodDate`:return _d(e,n);case`ZodUndefined`:return Qd();case`ZodNull`:return Rd();case`ZodArray`:return fd(e,n);case`ZodUnion`:case`ZodDiscriminatedUnion`:return Bd(e,n);case`ZodIntersection`:return Cd(e,n);case`ZodTuple`:return Zd(e,n);case`ZodRecord`:return Pd(e,n);case`ZodLiteral`:return wd(e);case`ZodEnum`:return xd(e);case`ZodNativeEnum`:return Id(e);case`ZodNullable`:return Hd(e,n);case`ZodOptional`:return qd(e,n);case`ZodMap`:return Fd(e,n);case`ZodSet`:return Xd(e,n);case`ZodLazy`:return()=>e.getter()._def;case`ZodPromise`:return Yd(e,n);case`ZodNaN`:case`ZodNever`:return Ld();case`ZodEffects`:return bd(e,n);case`ZodAny`:return dd();case`ZodUnknown`:return $d();case`ZodDefault`:return yd(e,n);case`ZodBranded`:return hd(e,n);case`ZodReadonly`:return ef(e,n);case`ZodCatch`:return gd(e,n);case`ZodPipeline`:return Jd(e,n);case`ZodFunction`:case`ZodVoid`:case`ZodSymbol`:return;default:return(e=>void 0)(t)}},nf=(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 rf(e,t,n=!1){let r=t.seen.get(e);if(t.override){let i=t.override?.(e,t,r,n);if(i!==cd)return i}if(r&&!n){let e=af(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=tf(e,e.typeName,t),o=typeof a==`function`?rf(a(),t):a;if(o&&of(e,t,o),t.postProcess){let n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}var af=(e,t)=>{switch(t.$refStrategy){case`root`:return{$ref:e.path.join(`/`)};case`relative`:return{$ref:nf(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`),dd()):t.$refStrategy===`seen`?dd():void 0}},of=(e,t,n)=>(e.description&&(n.description=e.description),n),sf=e=>{let t=ud(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}]))}},cf=(e,t)=>{let n=sf(t),r=typeof t==`object`&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>({...e,[t]:rf(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0)??dd()}),{}):void 0,i=typeof t==`string`?t:t?.nameStrategy===`title`?void 0:t?.name,a=rf(e._def,i===void 0?n:{...n,currentPath:[...n.basePath,n.definitionPath,i]},!1)??dd(),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},lf=Symbol.for(`vercel.ai.schema`);function uf(e){let t;return()=>(t??=e(),t)}function df(e,{validate:t}={}){return{[lf]:!0,_type:void 0,get jsonSchema(){return typeof e==`function`&&(e=e()),e},validate:t}}function ff(e){return typeof e==`object`&&!!e&&lf in e&&e[lf]===!0&&`jsonSchema`in e&&`validate`in e}function pf(e){return e==null?df({type:`object`,properties:{},additionalProperties:!1}):ff(e)?e:`~standard`in e?e[`~standard`].vendor===`zod`?yf(e):mf(e):e()}function mf(e){return df(()=>{if(!hf(e))throw Error(`Standard schema vendor '${e[`~standard`].vendor}' does not support JSON Schema conversion.`);return od(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 Du({value:t,cause:n.issues})}}})}function hf(e){return e[`~standard`].jsonSchema!=null}function gf(e,t){let n=t?.useReferences??!1;return df(()=>cf(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 _f(e,t){let n=t?.useReferences??!1;return df(()=>od(ye(e,{target:`draft-7`,io:`input`,reused:n?`ref`:`inline`})),{validate:async t=>{let n=await fe(e,t);return n.success?{success:!0,value:n.data}:{success:!1,error:n.error}}})}function vf(e){return`_zod`in e}function yf(e,t){return vf(e)?_f(e,t):gf(e,t)}async function bf({value:e,schema:t,context:n}){let r=await xf({value:e,schema:t,context:n});if(!r.success)throw Du.wrap({value:e,cause:r.error,context:n});return r.value}async function xf({value:e,schema:t,context:n}){let r=pf(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:Du.wrap({value:e,cause:t.error,context:n}),rawValue:e}}catch(t){return{success:!1,error:Du.wrap({value:e,cause:t,context:n}),rawValue:e}}}async function Sf({text:e,schema:t}){try{let n=ad(e);return t==null?{success:!0,value:n,rawValue:n}:await xf({value:n,schema:t})}catch(t){return{success:!1,error:Cu.isInstance(t)?t:new Cu({text:e,cause:t}),rawValue:void 0}}}function Cf({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new Bu).pipeThrough(new TransformStream({async transform({data:e},n){e!==`[DONE]`&&n.enqueue(await Sf({text:e,schema:t}))}}))}async function wf(e){return typeof e==`function`&&(e=e()),e}new TextDecoder;var Tf=`AI_InvalidArgumentError`,Ef=`vercel.ai.error.${Tf}`,Df=Symbol.for(Ef),Of=class extends ou{constructor({parameter:e,value:t,message:n}){super({name:Tf,message:`Invalid argument for parameter ${e}: ${n}`}),this[Df]=!0,this.parameter=e,this.value=t}static isInstance(e){return ou.hasMarker(e,Ef)}},kf=`AI_UIMessageStreamError`,Af=`vercel.ai.error.${kf}`,jf=Symbol.for(Af),Mf=class extends ou{constructor({chunkType:e,chunkId:t,message:n}){super({name:kf,message:n}),this[jf]=!0,this.chunkType=e,this.chunkId=t}static isInstance(e){return ou.hasMarker(e,Af)}},Nf=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 Pf(e){return e.replace(/[^a-zA-Z0-9]/g,e=>`_${e.charCodeAt(0).toString(16).toUpperCase().padStart(4,`0`)}`)}function Ff({setting:e,provider:t}){return t==null?Nf.get(e)??`AISDK_DEP_SETTING_${Pf(e)}`:`AISDK_DEP_PROVIDER_${Pf(t)}__${Pf(e)}`}function If({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 Lf=`AI SDK Warning System: To turn off warning logging, set the AI_SDK_LOG_WARNINGS global to false.`,Rf=!1,zf=new Set;function Bf({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 Vf=e=>{if(e.warnings.length===0)return;let t=globalThis.AI_SDK_LOG_WARNINGS;if(t!==!1){if(typeof t==`function`){t(e);return}Rf||(Rf=!0,Bf({message:Lf,type:`Warning`}));for(let t of e.warnings){let n=t.type===`deprecated`?Ff({setting:t.setting,provider:e.provider}):void 0;if(n!=null){if(zf.has(n))continue;zf.add(n)}Bf({message:If({warning:t,provider:e.provider,model:e.model}),type:t.type===`deprecated`?`DeprecationWarning`:`Warning`,code:n})}}};function Hf(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]=Hf(a,i):n[r]=i}return n}function Uf(e,t){return e!=null&&Object.hasOwn(e,t)?e[t]:void 0}function Wf(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: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 Gf(e){if(e===void 0)return{value:void 0,state:`undefined-input`};let t=await Sf({text:e});return t.success?{value:t.value,state:`successful-parse`}:(t=await Sf({text:Wf(e)}),t.success?{value:t.value,state:`repaired-parse`}:{value:void 0,state:`failed-parse`})}Zu({prefix:`steer`,size:24});function Kf(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(!Kf(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)||!Kf(e[i],t[i]))return!1;return!0}new TextEncoder,new TextEncoder,Zu({prefix:`aitxt`,size:24}),Zu({prefix:`call`,size:24}),TransformStream;var B={array:et,boolean:Qe,custom:He,discriminatedUnion:xt,enum:Xe,instanceof:pt,lazy:We,literal:Et,looseObject:Te,never:g,null:lt,number:wt,object:F,record:y,string:I,union:d,unknown:it},qf=B.lazy(()=>B.union([B.null(),B.string(),B.number(),B.boolean(),B.record(B.string(),qf.optional()),B.array(qf)])),V=B.record(B.string(),B.record(B.string(),qf.optional())),Jf=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()}),Yf=B.record(B.string(),qf.optional()),Xf=uf(()=>yf(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(Jf).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:Yf.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:Yf.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:Yf.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:Yf.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:Yf.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.literal(`steering-message`),id:B.string(),parts:B.array(B.union([B.looseObject({type:B.literal(`text`),text:B.string(),providerMetadata:V.optional()}),B.looseObject({type:B.literal(`file`),mediaType:B.string(),url:B.string(),filename:B.string().optional(),providerReference:B.record(B.string(),B.string()).optional(),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 Zf(e){return e.type.startsWith(`data-`)}function Qf(){return Object.create(null)}function $f(e){return e.type===`text`}function ep(e){return e.type===`reasoning`}function tp(e){return e.type.startsWith(`tool-`)}function np(e){return e.type===`dynamic-tool`}function rp(e){return tp(e)||np(e)}function ip(e){return e.type.split(`-`).slice(1).join(`-`)}function ap(e){return np(e)?e.toolName:ip(e)}function op({lastMessage:e,messageId:t}){let n=e?.role===`assistant`?e:{id:t,metadata:void 0,role:`assistant`,parts:[]},r=Qf(),i=n.parts.findLastIndex(e=>e.type===`step-start`),a=0;for(let e of n.parts.slice(i+1)){if(!rp(e))continue;let t=a;tp(e)&&a++,e.state===`input-streaming`&&(r[e.toolCallId]={text:e.rawInput??``,inputEncoding:e.inputEncoding,index:t,toolName:e.type===`dynamic-tool`?e.toolName:ip(e),dynamic:e.type===`dynamic-tool`,title:e.title,toolMetadata:e.toolMetadata})}return{message:n,activeTextParts:Qf(),activeReasoningParts:Qf(),partialToolCalls:r}}function sp({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(rp)}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(rp(i)&&i.toolCallId===e){t=i;break}}}if(t==null)throw new Mf({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(rp).find(t=>t.approval?.id===e);if(t==null)throw new Mf({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=>tp(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:Hf(r.message.metadata,e);t!=null&&await bf({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 Mf({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 Mf({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 Mf({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 Mf({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(tp);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 Mf({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 Gf(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(rp).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:ip(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:ip(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`steering-message`:r.message.parts.push({type:`steering-message`,id:e.id,parts:e.parts}),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=Qf(),r.activeReasoningParts=Qf(),r.partialToolCalls=Qf(),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,op({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(Zf(e)){let t=n?.[e.type.slice(5)];if(t!=null){let n=r.message.parts.findIndex(t=>`id`in t&&`data`in t&&t.id===e.id&&t.type===e.type),i=n>=0?n:r.message.parts.length;await bf({value:e.data,schema:t,context:{field:`message.parts[${i}].data`,entityName:e.type,entityId:e.id}})}let i=e;if(i.transient){o?.(i);break}let a=i.id==null?void 0:r.message.parts.find(e=>i.type===e.type&&i.id===e.id);a==null?r.message.parts.push(i):a.data=i.data,o?.(i),d()}}u.enqueue(e)})}}))}async function cp({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 lp(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}Zu({prefix:`aitxt`,size:24}),Zu({prefix:`call`,size:24}),Zu({prefix:`aitxt`,size:24}),Zu({prefix:`call`,size:24});function up(e){return e.dynamic=!1,e}var dp={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 fp(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))&&Vf({warnings:[dp]})}var pp=B.record(B.string(),qf.optional()),mp=B.record(B.string(),B.string());function hp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.keys(e).length===0}function gp(e){let{type:t,...n}=e;return up({...n,type:`dynamic-tool`,toolName:t.slice(5)})}function _p(e){return e.approval!=null&&Object.prototype.hasOwnProperty.call(e.approval,`inputSchemaInput`)?{value:e.approval.inputSchemaInput}:void 0}var vp=uf(()=>{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 yf(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(Jf).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:mp.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(`steering-message`),id:B.string(),parts:B.array(B.union([B.object({type:B.literal(`text`),text:B.string(),providerMetadata:V.optional()}),B.object({type:B.literal(`file`),mediaType:B.string(),filename:B.string().optional(),url:B.string(),providerReference:mp.optional(),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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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:pp.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 yp({messages:e,metadataSchema:t,dataSchemas:n,tools:r,experimental_refineToolInput:i},{convertMissingTerminalToolsToDynamic:a}){try{if(e==null)return{success:!1,error:new Of({parameter:`messages`,value:e,message:`messages parameter must be provided`})};let o=await bf({value:e,schema:vp});if(fp(o),t)for(let[e,n]of o.entries())n.metadata=await bf({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 Du({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 bf({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:Uf(r,s),u=n.state===`output-available`||n.state===`output-error`||n.state===`output-denied`;if(!l&&u){(r!=null||a)&&(t.parts[o]=gp(n));continue}if(!l)return{success:!1,error:new Du({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=_p(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 xf({value:p,schema:l.inputSchema,context:d}),t;if(!e.success)t=e.error;else if(f!=null)try{let r=Uf(i,s);Kf(r==null?e.value:await r(e.value),n.input)||(t=new Du({value:n.input,cause:`Tool input does not match the output reconstructed from inputSchemaInput.`,context:d}))}catch(e){t=new Du({value:p,cause:e,context:d})}if(t!=null)if(n.state===`output-error`||n.state===`output-available`&&hp(n.input))m=!0;else throw t}n.state===`output-available`&&l.outputSchema&&await bf({value:n.output,schema:l.outputSchema,context:{field:`messages[${e}].parts[${o}].output`,entityName:s,entityId:n.toolCallId}}),m&&(t.parts[o]=gp(n))}}return{success:!0,data:o}}catch(e){return{success:!1,error:e}}}async function bp(e){return yp(e,{convertMissingTerminalToolsToDynamic:!1})}async function xp(e){let t=await bp(e);if(!t.success)throw t.error;return t.data}Zu({prefix:`call`,size:24}),Zu({prefix:`call`,size:24}),new TextEncoder,Zu({prefix:`call`,size:24}),Zu({prefix:`aiobj`,size:24});var{atob:Sp}=globalThis,Cp=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)})}};Zu({prefix:`aiobj`,size:24}),Zu({prefix:`call`,size:24});var wp=B.union([B.string(),B.custom(Gu,{message:`Must be a Uint8Array`}),B.custom(Ku,{message:`Must be an ArrayBuffer`}),B.custom($u,{message:`Must be a Buffer`})]),Tp=B.record(B.string(),B.string()),Ep=B.object({type:B.literal(`text`),text:B.string(),providerOptions:V.optional()}),Dp=B.object({type:B.literal(`image`),image:B.union([wp,B.instanceof(URL),Tp]),mediaType:B.string().optional(),providerOptions:V.optional()}),Op=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:wp}),B.object({type:B.literal(`url`),url:B.instanceof(URL)}),B.object({type:B.literal(`reference`),reference:Tp}),B.object({type:B.literal(`text`),text:B.string()})]),kp=B.discriminatedUnion(`type`,[B.object({type:B.literal(`data`),data:wp}),B.object({type:B.literal(`url`),url:B.instanceof(URL)})]),Ap=B.object({type:B.literal(`file`),data:B.union([Op,wp,B.instanceof(URL),Tp]),filename:B.string().optional(),mediaType:B.string(),providerOptions:V.optional()}),jp=B.object({type:B.literal(`reasoning`),text:B.string(),providerOptions:V.optional()}),Mp=B.object({type:B.literal(`custom`),kind:B.string().transform(e=>e),providerOptions:V.optional()}),Np=B.object({type:B.literal(`reasoning-file`),data:B.union([kp,wp,B.instanceof(URL)]),mediaType:B.string(),providerOptions:V.optional()}),Pp=B.object({type:B.literal(`tool-call`),toolCallId:B.string(),toolName:B.string(),input:B.unknown(),providerOptions:V.optional(),providerExecuted:B.boolean().optional()}),Fp=B.discriminatedUnion(`type`,[B.object({type:B.literal(`text`),value:B.string(),providerOptions:V.optional()}),B.object({type:B.literal(`json`),value:qf,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:qf,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:Op,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()})]))})]),Ip=B.object({type:B.literal(`tool-result`),toolCallId:B.string(),toolName:B.string(),output:Fp,providerOptions:V.optional()}),Lp=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()}),Rp=B.object({type:B.literal(`tool-approval-response`),approvalId:B.string(),approved:B.boolean(),reason:B.string().optional()}),zp=B.object({role:B.literal(`system`),content:B.string(),providerOptions:V.optional()}),Bp=B.object({role:B.literal(`user`),content:B.union([B.string(),B.array(B.union([Ep,Dp,Ap]))]),providerOptions:V.optional()}),Vp=B.object({role:B.literal(`assistant`),content:B.union([B.string(),B.array(B.union([Ep,Mp,Ap,jp,Np,Pp,Ip,Lp]))]),providerOptions:V.optional()}),Hp=B.object({role:B.literal(`tool`),content:B.array(B.union([Ip,Rp])),providerOptions:V.optional()});B.union([zp,Bp,Vp,Hp]),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()}),Zu({prefix:`call`,size:24}),Zu({prefix:`call`,size:24}),Zu({prefix:`call`,size:24});async function Up({response:e,url:t,fallbackMessage:n}){let r=await e.text();return new uu({message:r||n,url:t,requestBodyValues:void 0,statusCode:e.status,responseBody:r})}async function Wp(e){if(e==null)return[];if(!globalThis.FileList||!(e instanceof globalThis.FileList))throw new ju({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 Gp(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 Kp=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 wf(this.body),r=await wf(this.headers),i=await wf(this.credentials),a={...qu(r),...qu(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:qu(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 Up({response:d,url:s,fallbackMessage:`Failed to fetch the chat response.`});if(!d.body)throw new mu({message:`The response body is empty.`});return this.processResponseStream(d.body)}async reconnectToStream(e){let t=await wf(this.body),n=await wf(this.headers),r=await wf(this.credentials),i={...qu(n),...qu(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 Of({parameter:`chatId`,value:e.chatId,message:`Chat IDs must not be "." or ".." when using the default reconnect URL.`});o=Gp(this.api,`/${encodeURIComponent(e.chatId)}/stream`)}let s=a?.headers===void 0?i:qu(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 Up({response:l,url:o,fallbackMessage:`Failed to fetch the chat response.`});if(!l.body)throw new mu({message:`The response body is empty.`});return this.processResponseStream(l.body)}},qp=class extends Kp{constructor({resumeStreamIsReplay:e=!0,...t}={}){super(t),this.resumeStreamIsReplay=e}processResponseStream(e){return Cf({stream:e,schema:Xf}).pipeThrough(new TransformStream({async transform(e,t){if(!e.success)throw e.error;t.enqueue(e.value)}}))}},Jp=class{get id(){return this._id??=this.generateId()}constructor({generateId:e=Qu,id:t,transport:n=new qp,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 Cp,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=>rp(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 Wp(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 Of({parameter:`message.messageId`,value:e.messageId,message:`message with id ${e.messageId} not found`});if(this.state.messages[t].role!==`user`)throw new Of({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 Of({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=>rp(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=>rp(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(!rp(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=>rp(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=lp();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=>rp(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:op({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 cp({stream:sp({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 Yp({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(rp);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 Xp({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(rp).filter(e=>!e.providerExecuted),a=r.reduce((e,t,n)=>rp(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 Zp=n(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}))(),1);function Qp(e,t){return t==null?e:(0,Zp.default)(e,t)}function $p(e){return Array.isArray(e)?[...e]:typeof e==`object`&&e&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null)?{...e}:e}var em=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=$p(t.metadata)),n},this[`~registerMessagesCallback`]=(e,t)=>{let n=t?Qp(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},tm=class extends Jp{#e;constructor({messages:e,...t}){let n=new em(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}},nm=new WeakMap;function rm({chat:e,state:t}){if(document.visibilityState!==`visible`||t.pendingVisibilityResume!=null)return;let n=()=>nm.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 im({chat:e,registration:t}){let n=nm.get(e);if(n==null){let t={registrations:new Set};if(nm.set(e,t),n=t,typeof document<`u`){let n=()=>rm({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?.(),nm.delete(e))}}function am(e){return{chat:e,messages:e.messages,status:e.status,error:e.error}}function om(e,t){return e.chat===t.chat&&e.messages===t.messages&&e.status===t.status&&e.error===t.error}function sm({throttle:e,experimental_throttle:t,resume:n=!1,...r}={}){let i=e??t,a=(0,L.useRef)({}),o=(0,L.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 qp),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,L.useMemo)(()=>({chat:`chat`in r?r.chat:new tm(l),isExternallyManaged:`chat`in r}),[`chat`in r?r.chat:r.id]);(0,L.useEffect)(()=>{if(!d)return()=>{u.stop()}},[u,d]);let[f,p]=(0,L.useState)(()=>am(u));f.chat!==u&&p(am(u)),(0,L.useEffect)(()=>{let e=!0,t=()=>{if(!e)return;let t=am(u);p(e=>e.chat!==u||om(e,t)?e:t)},n=[u[`~registerMessagesCallback`](t,i),u[`~registerStatusCallback`](t),u[`~registerErrorCallback`](t)],r=am(u);return p(e=>om(e,r)?e:r),()=>{e=!1,n.forEach(e=>e())}},[u,i]);let{messages:m,status:h,error:g}=f,_=(0,L.useCallback)(e=>{typeof e==`function`&&(e=e(u.messages)),u.messages=e},[u]);return(0,L.useEffect)(()=>{if(n)return im({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 cm=(0,L.createContext)({});function lm(e){let t=(0,L.useRef)(null);return t.current===null&&(t.current=e()),t.current}var um=typeof window<`u`?L.useLayoutEffect:L.useEffect,dm=(0,L.createContext)(null);function fm(e,t){e.indexOf(t)===-1&&e.push(t)}function pm(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var mm=(e,t,n)=>n>t?t:n<e?e:n,hm={},gm=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e),_m=e=>typeof e==`object`&&!!e,vm=e=>/^0[^.\s]+$/u.test(e);function ym(e){let t;return()=>(t===void 0&&(t=e()),t)}var bm=e=>e,xm=(...e)=>e.reduce((e,t)=>n=>t(e(n))),Sm=(e,t,n)=>{let r=t-e;return r?(n-e)/r:1},Cm=class{constructor(){this.subscriptions=[]}add(e){return fm(this.subscriptions,e),()=>pm(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}},wm=e=>e*1e3,Tm=e=>e/1e3,Em=(e,t)=>t?1e3/t*e:0,Dm=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Om=1e-7,km=12;function Am(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Dm(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>Om&&++s<km);return o}function jm(e,t,n,r){if(e===t&&n===r)return bm;let i=t=>Am(t,0,1,e,n);return e=>e===0||e===1?e:Dm(i(e),t,r)}var Mm=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Nm=e=>t=>1-e(1-t),Pm=jm(.33,1.53,.69,.99),Fm=Nm(Pm),Im=Mm(Fm),Lm=e=>e>=1?1:(e*=2)<1?.5*Fm(e):.5*(2-2**(-10*(e-1))),Rm=e=>1-Math.sin(Math.acos(e)),zm=Nm(Rm),Bm=Mm(Rm),Vm=jm(.42,0,1,1),Hm=jm(0,0,.58,1),Um=jm(.42,0,.58,1),Wm=e=>Array.isArray(e)&&typeof e[0]!=`number`,Gm=e=>Array.isArray(e)&&typeof e[0]==`number`,Km={linear:bm,easeIn:Vm,easeInOut:Um,easeOut:Hm,circIn:Rm,circInOut:Bm,circOut:zm,backIn:Fm,backInOut:Im,backOut:Pm,anticipate:Lm},qm=e=>typeof e==`string`,Jm=e=>{if(Gm(e)){e.length;let[t,n,r,i]=e;return jm(t,n,r,i)}else if(qm(e))return Km[e],`${e}`,Km[e];return e},Ym=[`setup`,`read`,`resolveKeyframes`,`preUpdate`,`update`,`preRender`,`render`,`postRender`];function Xm(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 Zm=40;function Qm(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,o=Ym.reduce((e,t)=>(e[t]=Xm(a),e),{}),{setup:s,read:c,resolveKeyframes:l,preUpdate:u,update:d,preRender:f,render:p,postRender:m}=o,h=()=>{let a=hm.useManualTiming,o=a?i.timestamp:performance.now();n=!1,a||(i.delta=r?1e3/60:Math.max(Math.min(o-i.timestamp,Zm),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:Ym.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<Ym.length;t++)o[Ym[t]].cancel(e)},state:i,steps:o}}var{schedule:$m,cancel:eh,state:th,steps:nh}=Qm(typeof requestAnimationFrame<`u`?requestAnimationFrame:bm,!0),rh;function ih(){rh=void 0}var ah={now:()=>(rh===void 0&&ah.set(th.isProcessing||hm.useManualTiming?th.timestamp:performance.now()),rh),set:e=>{rh=e,queueMicrotask(ih)}},oh=e=>t=>typeof t==`string`&&t.startsWith(e),sh=oh(`--`),ch=oh(`var(--`),lh=e=>ch(e)?uh.test(e.split(`/*`)[0].trim()):!1,uh=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function dh(e){return typeof e==`string`&&e.split(`/*`)[0].includes(`var(--`)}var fh={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},ph={...fh,transform:e=>mm(0,1,e)},mh={...fh,default:1},hh=e=>Math.round(e*1e5)/1e5,gh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function _h(e){return e==null}var vh=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,yh=(e,t)=>n=>!!(typeof n==`string`&&vh.test(n)&&n.startsWith(e)||t&&!_h(n)&&Object.prototype.hasOwnProperty.call(n,t)),bh=(e,t,n)=>r=>{if(typeof r!=`string`)return r;let[i,a,o,s]=r.match(gh);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},xh=e=>mm(0,255,e),Sh={...fh,transform:e=>Math.round(xh(e))},Ch={test:yh(`rgb`,`red`),parse:bh(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+Sh.transform(e)+`, `+Sh.transform(t)+`, `+Sh.transform(n)+`, `+hh(ph.transform(r))+`)`};function wh(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 Th={test:yh(`#`),parse:wh,transform:Ch.transform},Eh=e=>({test:t=>typeof t==`string`&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),Dh=Eh(`deg`),Oh=Eh(`%`),H=Eh(`px`),kh=Eh(`vh`),Ah=Eh(`vw`),jh={...Oh,parse:e=>Oh.parse(e)/100,transform:e=>Oh.transform(e*100)},Mh={test:yh(`hsl`,`hue`),parse:bh(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+Oh.transform(hh(t))+`, `+Oh.transform(hh(n))+`, `+hh(ph.transform(r))+`)`},Nh={test:e=>Ch.test(e)||Th.test(e)||Mh.test(e),parse:e=>Ch.test(e)?Ch.parse(e):Mh.test(e)?Mh.parse(e):Th.parse(e),transform:e=>typeof e==`string`?e:e.hasOwnProperty(`red`)?Ch.transform(e):Mh.transform(e),getAnimatableNone:e=>{let t=Nh.parse(e);return t.alpha=0,Nh.transform(t)}},Ph=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Fh(e){return isNaN(e)&&typeof e==`string`&&(e.match(gh)?.length||0)+(e.match(Ph)?.length||0)>0}var Ih=`number`,Lh=`color`,Rh=`var`,zh=`var(`,Bh="${}",Vh=/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 Hh(e){let t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[],a=0;return{values:n,split:t.replace(Vh,e=>(Nh.test(e)?(r.color.push(a),i.push(Lh),n.push(Nh.parse(e))):e.startsWith(zh)?(r.var.push(a),i.push(Rh),n.push(e)):(r.number.push(a),i.push(Ih),n.push(parseFloat(e))),++a,Bh)).split(Bh),indexes:r,types:i}}function Uh(e){return Hh(e).values}function Wh({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===Ih?i+=hh(r[a]):e===Lh?i+=Nh.transform(r[a]):i+=r[a]}return i}}function Gh(e){return Wh(Hh(e))}var Kh=e=>typeof e==`number`?0:Nh.test(e)?Nh.getAnimatableNone(e):e,qh=(e,t)=>typeof e==`number`?t?.trim().endsWith(`/`)?e:0:Kh(e);function Jh(e){let t=Hh(e);return Wh(t)(t.values.map((e,n)=>qh(e,t.split[n])))}var Yh={test:Fh,parse:Uh,createTransformer:Gh,getAnimatableNone:Jh};function Xh(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 Zh({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=Xh(s,r,e+1/3),a=Xh(s,r,e),o=Xh(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}function Qh(e,t){return n=>n>0?t:e}var $h=(e,t,n)=>e+(t-e)*n,eg=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},tg=[Th,Ch,Mh],ng=e=>tg.find(t=>t.test(e));function rg(e){let t=ng(e);if(`${e}`,!t)return!1;let n=t.parse(e);return t===Mh&&(n=Zh(n)),n}var ig=(e,t)=>{let n=rg(e),r=rg(t);if(!n||!r)return Qh(e,t);let i={...n};return e=>(i.red=eg(n.red,r.red,e),i.green=eg(n.green,r.green,e),i.blue=eg(n.blue,r.blue,e),i.alpha=$h(n.alpha,r.alpha,e),Ch.transform(i))},ag=new Set([`none`,`hidden`]);function og(e,t){return ag.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function sg(e,t){return n=>$h(e,t,n)}function cg(e){return typeof e==`number`?sg:typeof e==`string`?lh(e)?Qh:Nh.test(e)?ig:fg:Array.isArray(e)?lg:typeof e==`object`?Nh.test(e)?ig:ug:Qh}function lg(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>cg(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function ug(e,t){let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=cg(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}function dg(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 fg=(e,t)=>{let n=Yh.createTransformer(t),r=Hh(e),i=Hh(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?ag.has(e)&&!i.values.length||ag.has(t)&&!r.values.length?og(e,t):xm(lg(dg(r,i),i.values),n):(`${e}${t}`,Qh(e,t))};function pg(e,t,n){return typeof e==`number`&&typeof t==`number`&&typeof n==`number`?$h(e,t,n):cg(e)(e,t)}var mg=e=>{let t=({timestamp:t})=>e(t);return{start:(e=!0)=>$m.update(t,e),stop:()=>eh(t),now:()=>th.isProcessing?th.timestamp:ah.now()}},hg=(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)})`},gg=2e4;function _g(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 vg(e,t=100,n){let r=n({...e,keyframes:[0,t]}),i=Math.min(_g(r),gg);return{type:`keyframes`,ease:e=>r.next(i*e).value/t,duration:Tm(i)}}var yg={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 bg(e,t){return e*Math.sqrt(1-t*t)}var xg=12;function Sg(e,t,n){let r=n;for(let n=1;n<xg;n++)r-=e(r)/t(r);return r}var Cg=.001;function wg({duration:e=yg.duration,bounce:t=yg.bounce,velocity:n=yg.velocity,mass:r=yg.mass}){let i,a;yg.maxDuration;let o=1-t;o=mm(yg.minDamping,yg.maxDamping,o),e=mm(yg.minDuration,yg.maxDuration,Tm(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=bg(t,o),c=Math.exp(-i);return Cg-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=bg(t**2,o);return(-i(t)+Cg>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=Sg(i,a,s);if(e=wm(e),isNaN(c))return{stiffness:yg.stiffness,damping:yg.damping,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var Tg=[`duration`,`bounce`],Eg=[`stiffness`,`damping`,`mass`];function Dg(e,t){return t.some(t=>e[t]!==void 0)}function Og(e){let t={velocity:yg.velocity,stiffness:yg.stiffness,damping:yg.damping,mass:yg.mass,isResolvedFromDuration:!1,...e};if(!Dg(e,Eg)&&Dg(e,Tg))if(t.velocity=0,e.visualDuration){let n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,a=2*mm(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:yg.mass,stiffness:i,damping:a}}else{let n=wg({...e,velocity:0});t={...t,...n,mass:yg.mass},t.isResolvedFromDuration=!0}return t}function kg(e=yg.visualDuration,t=yg.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}=Og({...n,velocity:-Tm(n.velocity||0)}),m=f||0,h=l/(2*Math.sqrt(c*u)),g=o-a,_=Tm(Math.sqrt(c/u)),v=Math.abs(g)<5;r||=v?yg.restSpeed.granular:yg.restSpeed.default,i||=v?yg.restDelta.granular:yg.restDelta.default;let y,b,x,S,C,w;if(h<1)x=bg(_,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=>wm(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=wm(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=wm(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(_g(T),gg),t=hg(t=>T.next(e*t).value,e,30);return e+`ms `+t},toTransition:()=>{}};return T}kg.applyToOptions=e=>{let t=vg(e,100,kg);return e.ease=t.ease,e.duration=wm(t.duration),e.type=`keyframes`,e};var Ag=5;function jg(e,t,n){let r=Math.max(t-Ag,0);return Em(n-e(r),t-r)}function Mg({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=kg({keyframes:[f.value,m(f.value)],velocity:jg(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 Ng(e,t,n){let r=[],i=n||hm.mix||pg,a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=xm(Array.isArray(t)?t[n]||bm:t,a)),r.push(a)}return r}function Pg(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=Ng(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=Sm(e[r],e[r+1],n);return s[r](i)};return n?t=>l(mm(e[0],e[a-1],t)):l}function Fg(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Sm(0,t,r);e.push($h(n,1,i))}}function Ig(e){let t=[0];return Fg(t,e.length-1),t}function Lg(e,t){return e.map(e=>e*t)}function Rg(e,t){return e.map(()=>t||Um).splice(0,e.length-1)}function zg({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=Wm(r)?r.map(Jm):Jm(r),a={done:!1,value:t[0]},o=Pg(Lg(n&&n.length===t.length?n:Ig(t),e),t,{ease:Array.isArray(i)?i:Rg(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}var Bg=e=>e!==null;function Vg(e,{repeat:t,repeatType:n=`loop`},r,i=1){let a=e.filter(Bg),o=i<0||t&&n!==`loop`&&t%2==1?0:a.length-1;return!o||r===void 0?a[o]:r}var Hg={decay:Mg,inertia:Mg,tween:zg,keyframes:zg,spring:kg};function Ug(e){typeof e.type==`string`&&(e.type=Hg[e.type])}var Wg=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)}},Gg=e=>e/100,Kg=class extends Wg{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!==ah.now()&&this.tick(ah.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;Ug(e);let{type:t=zg,repeat:n=0,repeatDelay:r=0,repeatType:i,velocity:a=0}=e,{keyframes:o}=e,s=t||zg;s!==zg&&typeof o[0]!=`number`&&(this.mixKeyframes=xm(Gg,pg(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=_g(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=mm(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!==Mg&&(b.value=Vg(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 Tm(this.calculatedDuration)}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Tm(e)}get time(){return Tm(this.currentTime)}set time(e){e=wm(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 jg(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(ah.now()),this.playbackSpeed=e,t&&this.driver&&(this.time=Tm(this.currentTime))}play(){if(this.isStopped)return;let{driver:e=mg,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(ah.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 qg(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}var Jg=e=>e*180/Math.PI,Yg=e=>Zg(Jg(Math.atan2(e[1],e[0]))),Xg={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:Yg,rotateZ:Yg,skewX:e=>Jg(Math.atan(e[1])),skewY:e=>Jg(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},Zg=e=>(e%=360,e<0&&(e+=360),e),Qg=Yg,$g=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),e_=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),t_={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:$g,scaleY:e_,scale:e=>($g(e)+e_(e))/2,rotateX:e=>Zg(Jg(Math.atan2(e[6],e[5]))),rotateY:e=>Zg(Jg(Math.atan2(-e[2],e[0]))),rotateZ:Qg,rotate:Qg,skewX:e=>Jg(Math.atan(e[4])),skewY:e=>Jg(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function n_(e){return+!!e.includes(`scale`)}function r_(e,t){if(!e||e===`none`)return n_(t);let n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u),r,i;if(n)r=t_,i=n;else{let t=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Xg,i=t}if(!i)return n_(t);let a=r[t],o=i[1].split(`,`).map(a_);return typeof a==`function`?a(o):o[a]}var i_=(e,t)=>{let{transform:n=`none`}=getComputedStyle(e);return r_(n,t)};function a_(e){return parseFloat(e.trim())}var o_=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],s_=new Set([...o_,`pathRotation`]),c_=e=>e===fh||e===H,l_=new Set([`x`,`y`,`z`]),u_=o_.filter(e=>!l_.has(e));function d_(e){let t=[];return u_.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(+!!n.startsWith(`scale`)))}),t}var f_={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})=>r_(t,`x`),y:(e,{transform:t})=>r_(t,`y`)};f_.translateX=f_.x,f_.translateY=f_.y;var p_=new Set,m_=!1,h_=!1,g_=!1;function __(){if(h_){let e=Array.from(p_).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=d_(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)})}h_=!1,m_=!1,p_.forEach(e=>e.complete(g_)),p_.clear()}function v_(){p_.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(h_=!0)})}function y_(){g_=!0,v_(),__(),g_=!1}var b_=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?(p_.add(this),m_||(m_=!0,$m.read(v_),$m.resolveKeyframes(__))):(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])}qg(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state=`complete`,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),p_.delete(this)}cancel(){this.state===`scheduled`&&(p_.delete(this),this.state=`pending`)}resume(){this.state===`pending`&&this.scheduleResolve()}},x_=e=>e.startsWith(`--`);function S_(e,t,n){x_(t)?e.style.setProperty(t,n):e.style[t]=n}var C_={};function w_(e,t){let n=ym(e);return()=>C_[t]??n()}var T_=w_(()=>window.ScrollTimeline!==void 0,`scrollTimeline`),E_=w_(()=>{try{document.createElement(`div`).animate({opacity:0},{easing:`linear(0, 1)`})}catch{return!1}return!0},`linearEasing`),D_=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,O_={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:D_([0,.65,.55,1]),circOut:D_([.55,0,1,.45]),backIn:D_([.31,.01,.66,-.59]),backOut:D_([.33,1.53,.69,.99])};function k_(e,t){if(e)return typeof e==`function`?E_()?hg(e,t):`ease-out`:Gm(e)?D_(e):Array.isArray(e)?e.map(e=>k_(e,t)||O_.easeOut):O_[e]}function A_(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=k_(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 j_(e){return typeof e==`function`&&`applyToOptions`in e}function M_({type:e,...t}){return j_(e)&&E_()?e.applyToOptions(t):(t.duration??=300,t.ease??=`easeOut`,t)}var N_=class extends Wg{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=M_(e);this.animation=A_(t,n,r,c,i),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){let e=Vg(r,this.options,o,this.speed);this.updateMotionValue&&this.updateMotionValue(e),S_(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 Tm(Number(e))}get iterationDuration(){let{delay:e=0}=this.options||{};return this.duration+Tm(e)}get time(){return Tm(Number(this.animation.currentTime)||0)}set time(e){let t=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=wm(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&&T_()?(this.animation.timeline=e,t&&(this.animation.rangeStart=t),n&&(this.animation.rangeEnd=n),bm):r(this)}},P_={anticipate:Lm,backInOut:Im,circInOut:Bm};function F_(e){return e in P_}function I_(e){typeof e.ease==`string`&&F_(e.ease)&&(e.ease=P_[e.ease])}var L_=10,R_=class extends N_{constructor(e){I_(e),Ug(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 Kg({...a,autoplay:!1}),s=Math.max(L_,ah.now()-this.startTime),c=mm(0,L_,s-L_),l=o.sample(s).value,{name:u}=this.options;i&&u&&S_(i,u,l),t.setWithVelocity(o.sample(Math.max(0,s-c)).value,l,c),o.stop()}},z_=(e,t)=>t!==`zIndex`&&!!(typeof e==`number`||Array.isArray(e)||typeof e==`string`&&(Yh.test(e)||e===`0`)&&!e.startsWith(`url(`));function B_(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 V_(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=z_(i,t),s=z_(a,t);return`${t}${i}${a}${o?a:i}`,!o||!s?!1:B_(e)||(n===`spring`||j_(n))&&r}function H_(e){e.duration=0,e.type=`keyframes`}var U_=new Set([`opacity`,`clipPath`,`filter`,`transform`]),W_=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function G_(e){for(let t=0;t<e.length;t++)if(typeof e[t]==`string`&&W_.test(e[t]))return!0;return!1}var K_=new Set([`color`,`backgroundColor`,`outlineColor`,`fill`,`stroke`,`borderColor`,`borderTopColor`,`borderRightColor`,`borderBottomColor`,`borderLeftColor`]),q_=ym(()=>Object.hasOwnProperty.call(Element.prototype,`animate`));function J_(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 q_()&&n&&(U_.has(n)||K_.has(n)&&G_(s))&&(n!==`transform`||!l)&&!c&&!r&&i!==`mirror`&&a!==0&&o!==`inertia`}var Y_=40,X_=class extends Wg{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=ah.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||b_;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=ah.now();let u=!0;V_(e,i,a,o)||(u=!1,(hm.instantAnimations||!s)&&l?.(Vg(e,n,t)),e[0]=e[e.length-1],H_(n),n.repeat=0);let d={startTime:r?this.resolvedAt&&this.resolvedAt-this.createdAt>Y_?this.resolvedAt:this.createdAt:void 0,finalKeyframe:t,...n,keyframes:e},f=u&&!c&&J_(d),p=d.motionValue?.owner?.current,m;if(f)try{m=new R_({...d,element:p})}catch{m=new Kg(d)}else m=new Kg(d);m.finished.then(()=>{this.notifyFinished()}).catch(bm),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(),y_()),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 Z_(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 Q_=30,$_=e=>!isNaN(parseFloat(e)),ev={current:void 0},tv=class{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=e=>{let t=ah.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=ah.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=$_(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 Cm);let n=this.events[e].add(t);return e===`change`?()=>{n(),$m.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 ev.current&&ev.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=ah.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Q_)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,Q_);return Em(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 nv(e,t){return new tv(e,t)}function rv(e,t){if(e?.inherit&&t){let{inherit:n,...r}=e;return{...t,...r}}return e}function iv(e,t){let n=e?.[t]??e?.default??e;return n===e?n:rv(n,e)}var av={type:`spring`,stiffness:500,damping:25,restSpeed:10},ov=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),sv={type:`keyframes`,duration:.8},cv={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},lv=(e,{keyframes:t})=>t.length>2?sv:s_.has(e)?e.startsWith(`scale`)?ov(t[1]):av:cv,uv=new Set([`when`,`delay`,`delayChildren`,`staggerChildren`,`staggerDirection`,`repeat`,`repeatType`,`repeatDelay`,`from`,`elapsed`]);function dv(e){for(let t in e)if(!uv.has(t))return!0;return!1}var fv=(e,t,n,r={},i,a)=>o=>{let s=iv(r,e)||{},c=s.delay||r.delay||0,{elapsed:l=0}=r;l-=wm(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};dv(s)||Object.assign(u,lv(e,u)),u.duration&&=wm(u.duration),u.repeatDelay&&=wm(u.repeatDelay),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(H_(u),u.delay===0&&(d=!0)),(hm.instantAnimations||hm.skipAnimations||i?.shouldSkipAnimations||s.skipAnimations)&&(d=!0,H_(u),u.delay=0),u.allowFlatten=!s.type&&!s.ease,d&&!a&&t.get()!==void 0){let e=Vg(u.keyframes,s);if(e!==void 0){$m.update(()=>{u.onUpdate(e),u.onComplete()});return}}return s.isSync?new Kg(u):new X_(u)},pv=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function mv(e){let t=pv.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${n??r}`,i]}function hv(e,t,n=1){`${e}`;let[r,i]=mv(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return gm(e)?parseFloat(e):e}return lh(i)?hv(i,t,n+1):i}function gv(e){let t=[{},{}];return e?.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function _v(e,t,n,r){if(typeof t==`function`){let[i,a]=gv(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]=gv(r);t=t(n===void 0?e.custom:n,i,a)}return t}function vv(e,t,n){let r=e.getProps();return _v(r,t,n===void 0?r.custom:n,e)}var yv=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,...o_]),bv=e=>Array.isArray(e);function xv(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,nv(n))}function Sv(e){return bv(e)?e[e.length-1]||0:e}function Cv(e,t){let{transitionEnd:n={},transition:r={},...i}=vv(e,t)||{};i={...i,...n};for(let t in i)xv(e,t,Sv(i[t]))}var wv=e=>!!(e&&e.getVelocity);function Tv(e){return!!(wv(e)&&e.add)}function Ev(e,t){let n=e.getValue(`willChange`);if(Tv(n))return n.add(t);if(!n&&hm.WillChange){let n=new hm.WillChange(`auto`);e.addValue(`willChange`,n),n.add(t)}}function Dv(e){return e.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}var Ov=`data-`+Dv(`framerAppearId`);function kv(e){return e.props[Ov]}function Av({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function jv(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a,transitionEnd:o,...s}=t,c=e.getDefaultTransition();a=a?rv(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&&Av(f,t))continue;let o={delay:n,...iv(a||{},t)};u&&(o.skipAnimations=!0);let c=r.get();if(c!==void 0&&!r.isAnimating()&&!Array.isArray(i)&&i===c&&!o.velocity){$m.update(()=>r.set(i));continue}let p=!1;if(window.MotionHandoffAnimation){let n=kv(e);if(n){let e=window.MotionHandoffAnimation(n,t,$m);e!==null&&(o.startTime=e,p=!0)}}Ev(e,t);let m=l??e.shouldReduceMotion;r.start(fv(t,r,i,m&&yv.has(t)?{type:!1}:o,e,p));let h=r.animation;h&&d.push(h)}if(o){let t=()=>$m.update(()=>{o&&Cv(e,o)});d.length?Promise.all(d).then(t):t()}return d}function Mv(e,t,n={}){let r=vv(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(jv(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return Nv(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 Nv(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(Mv(c,t,{...o,delay:n+(typeof r==`function`?0:r)+Z_(e.variantChildren,c,r,i,a)}).then(()=>c.notify(`AnimationComplete`,t)));return Promise.all(s)}function Pv(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Mv(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Mv(e,t,n);else{let i=typeof t==`function`?vv(e,t,n.custom):t;r=Promise.all(jv(e,i,n))}return r.then(()=>{e.notify(`AnimationComplete`,t)})}var Fv={test:e=>e===`auto`,parse:e=>e},Iv=e=>t=>t.test(e),Lv=[fh,H,Oh,Dh,Ah,kh,Fv],Rv=e=>Lv.find(Iv(e));function zv(e){return typeof e==`number`?e===0:e===null||e===`none`||e===`0`||vm(e)}var Bv=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Vv(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(gh)||[];if(!r)return e;let i=n.replace(r,``),a=+!!Bv.has(t);return r!==n&&(a*=100),t+`(`+a+i+`)`}var Hv=/\b([a-z-]*)\(.*?\)/gu,Uv={...Yh,getAnimatableNone:e=>{let t=e.match(Hv);return t?t.map(Vv).join(` `):e}},Wv={...Yh,getAnimatableNone:e=>{let t=Yh.parse(e);return Yh.createTransformer(e)(t.map(e=>typeof e==`number`?0:typeof e==`object`?{...e,alpha:1}:e))}},Gv={...fh,transform:Math.round},Kv={borderWidth:H,borderTopWidth:H,borderRightWidth:H,borderBottomWidth:H,borderLeftWidth:H,borderRadius:H,borderTopLeftRadius:H,borderTopRightRadius:H,borderBottomRightRadius:H,borderBottomLeftRadius:H,width:H,maxWidth:H,height:H,maxHeight:H,top:H,right:H,bottom:H,left:H,inset:H,insetBlock:H,insetBlockStart:H,insetBlockEnd:H,insetInline:H,insetInlineStart:H,insetInlineEnd:H,padding:H,paddingTop:H,paddingRight:H,paddingBottom:H,paddingLeft:H,paddingBlock:H,paddingBlockStart:H,paddingBlockEnd:H,paddingInline:H,paddingInlineStart:H,paddingInlineEnd:H,margin:H,marginTop:H,marginRight:H,marginBottom:H,marginLeft:H,marginBlock:H,marginBlockStart:H,marginBlockEnd:H,marginInline:H,marginInlineStart:H,marginInlineEnd:H,fontSize:H,backgroundPositionX:H,backgroundPositionY:H,rotate:Dh,pathRotation:Dh,rotateX:Dh,rotateY:Dh,rotateZ:Dh,scale:mh,scaleX:mh,scaleY:mh,scaleZ:mh,skew:Dh,skewX:Dh,skewY:Dh,distance:H,translateX:H,translateY:H,translateZ:H,x:H,y:H,z:H,perspective:H,transformPerspective:H,opacity:ph,originX:jh,originY:jh,originZ:H,zIndex:Gv,fillOpacity:ph,strokeOpacity:ph,numOctaves:Gv},qv={...Kv,color:Nh,backgroundColor:Nh,outlineColor:Nh,fill:Nh,stroke:Nh,borderColor:Nh,borderTopColor:Nh,borderRightColor:Nh,borderBottomColor:Nh,borderLeftColor:Nh,filter:Uv,WebkitFilter:Uv,mask:Wv,WebkitMask:Wv},Jv=e=>qv[e],Yv=new Set([Uv,Wv]);function Xv(e,t){let n=Jv(e);return Yv.has(n)||(n=Yh),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Zv=new Set([`auto`,`none`,`0`]);function Qv(e,t,n){let r=0,i;for(;r<e.length&&!i;){let t=e[r];typeof t==`string`&&!Zv.has(t)&&Hh(t).values.length&&(i=e[r]),r++}if(i&&n)for(let r of t)e[r]=Xv(n,i)}var $v=class extends b_{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(),lh(r))){let i=hv(r,t.current);i!==void 0&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!yv.has(n)||e.length!==2)return;let[r,i]=e,a=Rv(r),o=Rv(i);if(dh(r)!==dh(i)&&f_[n]){this.needsMeasurement=!0;return}if(a!==o)if(c_(a)&&c_(o))for(let t=0;t<e.length;t++){let n=e[t];typeof n==`string`&&(e[t]=parseFloat(n))}else f_[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++)(e[t]===null||zv(e[t]))&&n.push(t);n.length&&Qv(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=f_[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]=f_[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()}},ey=[`borderTopLeftRadius`,`borderTopRightRadius`,`borderBottomRightRadius`,`borderBottomLeftRadius`];function ty(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 ny=(e,t)=>t&&typeof e==`number`?t.transform(e):e;function ry(e){return _m(e)&&`offsetHeight`in e&&!(`ownerSVGElement`in e)}var{schedule:iy,cancel:ay}=Qm(queueMicrotask,!1),oy={x:!1,y:!1};function sy(){return oy.x||oy.y}function cy(e){return e===`x`||e===`y`?oy[e]?null:(oy[e]=!0,()=>{oy[e]=!1}):oy.x||oy.y?null:(oy.x=oy.y=!0,()=>{oy.x=oy.y=!1})}function ly(e,t){let n=ty(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function uy(e){return!(e.pointerType===`touch`||sy())}function dy(e,t,n={}){let[r,i,a]=ly(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(!uy(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 fy=(e,t)=>t?e===t||fy(e,t.parentElement):!1,py=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1,my=new Set([`BUTTON`,`INPUT`,`SELECT`,`TEXTAREA`,`A`]);function hy(e){return my.has(e.tagName)||e.isContentEditable===!0}var gy=new Set([`INPUT`,`SELECT`,`TEXTAREA`]);function _y(e){return gy.has(e.tagName)||e.isContentEditable===!0}var vy=new WeakSet;function yy(e){return t=>{t.key===`Enter`&&e(t)}}function by(e,t){e.dispatchEvent(new PointerEvent(`pointer`+t,{isPrimary:!0,bubbles:!0}))}var xy=(e,t)=>{let n=e.currentTarget;if(!n)return;let r=yy(()=>{if(vy.has(n))return;by(n,`down`);let e=yy(()=>{by(n,`up`)});n.addEventListener(`keyup`,e,t),n.addEventListener(`blur`,()=>by(n,`cancel`),t)});n.addEventListener(`keydown`,r,t),n.addEventListener(`blur`,()=>n.removeEventListener(`keydown`,r),t)};function Sy(e){return py(e)&&!sy()}var Cy=new WeakSet;function wy(e,t,n={}){let[r,i,a]=ly(e,n),o=e=>{let r=e.currentTarget;if(!Sy(e)||Cy.has(e))return;vy.add(r),n.stopPropagation&&Cy.add(e);let a=t(r,e),o={...i,capture:!0},s=(e,t)=>{window.removeEventListener(`pointerup`,c,o),window.removeEventListener(`pointercancel`,l,o),vy.has(r)&&vy.delete(r),Sy(e)&&typeof a==`function`&&a(e,{success:t})},c=e=>{s(e,r===window||r===document||n.useGlobalTarget||fy(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),ry(e)&&(e.addEventListener(`focus`,e=>xy(e,i)),!hy(e)&&!e.hasAttribute(`tabindex`)&&(e.tabIndex=0))}),a}function Ty(e){return _m(e)&&`ownerSVGElement`in e}var Ey=new WeakMap,Dy,Oy=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+`Size`]:Ty(r)&&`getBBox`in r?r.getBBox()[t]:r[n],ky=Oy(`inline`,`width`,`offsetWidth`),Ay=Oy(`block`,`height`,`offsetHeight`);function jy({target:e,borderBoxSize:t}){Ey.get(e)?.forEach(n=>{n(e,{get width(){return ky(e,t)},get height(){return Ay(e,t)}})})}function My(e){e.forEach(jy)}function Ny(){typeof ResizeObserver>`u`||(Dy=new ResizeObserver(My))}function Py(e,t){Dy||Ny();let n=ty(e);return n.forEach(e=>{let n=Ey.get(e);n||(n=new Set,Ey.set(e,n)),n.add(t),Dy?.observe(e)}),()=>{n.forEach(e=>{let n=Ey.get(e);n?.delete(t),n?.size||Dy?.unobserve(e)})}}var Fy=new Set,Iy;function Ly(){Iy=()=>{let e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Fy.forEach(t=>t(e))},window.addEventListener(`resize`,Iy)}function Ry(e){return Fy.add(e),Iy||Ly(),()=>{Fy.delete(e),!Fy.size&&typeof Iy==`function`&&(window.removeEventListener(`resize`,Iy),Iy=void 0)}}function zy(e,t){return typeof e==`function`?Ry(e):Py(e,t)}var By={value:null,addProjectionMetrics:null};function Vy(e){return Ty(e)&&e.tagName===`svg`}var Hy=[...Lv,Nh,Yh],Uy=e=>Hy.find(Iv(e)),Wy=()=>({translate:0,scale:1,origin:0,originPoint:0}),Gy=()=>({x:Wy(),y:Wy()}),Ky=()=>({min:0,max:0}),qy=()=>({x:Ky(),y:Ky()}),Jy=new WeakMap;function Yy(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}function Xy(e){return typeof e==`string`||Array.isArray(e)}var Zy=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],Qy=[`initial`,...Zy];function $y(e){return Yy(e.animate)||Qy.some(t=>Xy(e[t]))}function eb(e){return!!($y(e)||e.variants)}function tb(e,t,n){for(let r in t){let i=t[r],a=n[r];if(wv(i))e.addValue(r,i);else if(wv(a))e.addValue(r,nv(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,nv(t===void 0?i:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var nb={current:null},rb={current:!1},ib=typeof window<`u`;function ab(){if(rb.current=!0,ib)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>nb.current=e.matches;e.addEventListener(`change`,t),t()}else nb.current=!1}var ob=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],sb={};function cb(e){sb=e}function lb(){return sb}var ub=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=b_,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=ah.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,$m.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=$y(t),this.isVariantNode=eb(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&&wv(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,Jy.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:(rb.current||ab(),this.shouldReduceMotion=nb.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(),eh(this.notifyUpdate),eh(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&&U_.has(e)&&this.current instanceof HTMLElement){let{factory:n,keyframes:r,times:i,ease:a,duration:o}=t.accelerate,s=new N_({element:this.current,name:e,keyframes:r,times:i,ease:a,duration:wm(o)}),c=n(s);this.valueSubscriptions.set(e,()=>{c(),s.cancel()});return}let n=s_.has(e);n&&this.onBindTransform&&this.onBindTransform();let r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&$m.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 sb){let t=sb[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):qy()}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<ob.length;t++){let n=ob[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=tb(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=nv(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`&&(gm(n)||vm(n))?n=parseFloat(n):!Uy(n)&&Yh.test(t)&&(n=Xv(e,t)),this.setBaseTarget(e,wv(n)?n.get():n)),wv(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=_v(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&&!wv(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 Cm),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){iy.render(this.render)}},db=class extends ub{constructor(){super(...arguments),this.KeyframeResolver=$v}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;wv(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}},fb=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function pb({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function mb({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function hb(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 gb(e){return e===void 0||e===1}function _b({scale:e,scaleX:t,scaleY:n}){return!gb(e)||!gb(t)||!gb(n)}function vb(e){return _b(e)||yb(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function yb(e){return bb(e.x)||bb(e.y)}function bb(e){return e&&e!==`0%`}function xb(e,t,n){return n+t*(e-n)}function Sb(e,t,n,r,i){return i!==void 0&&(e=xb(e,i,r)),xb(e,n,r)+t}function Cb(e,t=0,n=1,r,i){e.min=Sb(e.min,t,n,r,i),e.max=Sb(e.max,t,n,r,i)}function wb(e,{x:t,y:n}){Cb(e.x,t.translate,t.scale,t.originPoint),Cb(e.y,n.translate,n.scale,n.originPoint)}var Tb=.999999999999,Eb=1.0000000000001;function Db(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&&(Ob(e.x,-a.scroll.offset.x),Ob(e.y,-a.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,wb(e,o)),r&&vb(a.latestValues)&&jb(e,a.latestValues,a.layout?.layoutBox))}t.x<Eb&&t.x>Tb&&(t.x=1),t.y<Eb&&t.y>Tb&&(t.y=1)}function Ob(e,t){e.min+=t,e.max+=t}function kb(e,t,n,r,i=.5){Cb(e,t,n,$h(e.min,e.max,i),r)}function Ab(e,t){return typeof e==`string`?parseFloat(e)/100*(t.max-t.min):e}function jb(e,t,n){let r=n??e;kb(e.x,Ab(t.x,r.x),t.scaleX,t.scale,t.originX),kb(e.y,Ab(t.y,r.y),t.scaleY,t.scale,t.originY)}function Mb(e,t){return pb(hb(e.getBoundingClientRect(),t))}function Nb(e,t,n){let r=Mb(e,n),{scroll:i}=t;return i&&(Ob(r.x,i.offset.x),Ob(r.y,i.offset.y)),r}var Pb={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Fb=o_.length;function Ib(e,t,n){let r=``,i=!0;for(let a=0;a<Fb;a++){let o=o_[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=ny(s,Kv[o]);if(!c){i=!1;let t=Pb[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}let a=e.pathRotation;return a&&(i=!1,r+=`rotate(${ny(a,Kv.pathRotation)}) `),r=r.trim(),n?r=n(t,i?``:r):i&&(r=`none`),r}function Lb(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(s_.has(e)){o=!0;continue}else if(sh(e)){i[e]=n;continue}else{let t=ny(n,Kv[e]);e.startsWith(`origin`)?(s=!0,a[e]=t):r[e]=t}}if(t.transform||(o||n?r.transform=Ib(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 Rb(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 zb(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}var Bb={correct:(e,t)=>{if(!t.target)return e;if(typeof e==`string`)if(H.test(e))e=parseFloat(e);else return e;return`${zb(e,t.target.x)}% ${zb(e,t.target.y)}%`}},Vb={correct:(e,{treeScale:t,projectionDelta:n})=>{let r=e,i=Yh.parse(e);if(i.length>5)return r;let a=Yh.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=$h(s,c,.5);return typeof i[2+o]==`number`&&(i[2+o]/=l),typeof i[3+o]==`number`&&(i[3+o]/=l),a(i)}},Hb={borderRadius:{...Bb,applyTo:[...ey]},borderTopLeftRadius:Bb,borderTopRightRadius:Bb,borderBottomLeftRadius:Bb,borderBottomRightRadius:Bb,boxShadow:Vb};function Ub(e,{layout:t,layoutId:n}){return s_.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Hb[e]||e===`opacity`)}function Wb(e,t,n){let r=e.style,i=t?.style,a={};if(!r)return a;for(let t in r)(wv(r[t])||i&&wv(i[t])||Ub(t,e)||n?.getValue(t)?.liveStyle!==void 0)&&(a[t]=r[t]);return a}function Gb(e){return window.getComputedStyle(e)}var Kb=class extends db{constructor(){super(...arguments),this.type=`html`,this.renderInstance=Rb}readValueFromInstance(e,t){if(s_.has(t))return this.projection?.isProjecting?n_(t):i_(e,t);{let n=Gb(e),r=(sh(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Mb(e,t)}build(e,t,n){Lb(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return Wb(e,t,n)}},qb={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Jb={offset:`strokeDashoffset`,array:`strokeDasharray`};function Yb(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?qb:Jb;e[a.offset]=`${-r}`,e[a.array]=`${t} ${n}`}var Xb=[`offsetDistance`,`offsetPath`,`offsetRotate`,`offsetAnchor`];function Zb(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:a=1,pathOffset:o=0,...s},c,l,u){if(Lb(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 Xb)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&&Yb(d,i,a,o,!1)}var Qb=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`]),$b=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function ex(e,t,n,r){Rb(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Qb.has(n)?n:Dv(n),t.attrs[n])}function tx(e,t,n){let r=Wb(e,t,n);for(let n in e)if(wv(e[n])||wv(t[n])){let t=o_.indexOf(n)===-1?n:`attr`+n.charAt(0).toUpperCase()+n.substring(1);r[t]=e[n]}return r}var nx=class extends db{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1,this.measureInstanceViewportBox=qy}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(s_.has(t)){let e=Jv(t);return e&&e.default||0}return t=Qb.has(t)?t:Dv(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return tx(e,t,n)}build(e,t,n){Zb(e,t,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(e,t,n,r){ex(e,t,n,r)}mount(e){this.isSVGTag=$b(e.tagName),super.mount(e)}},rx=Qy.length;function ix(e){if(!e)return;if(!e.isControllingVariants){let t=e.parent&&ix(e.parent)||{};return e.props.initial!==void 0&&(t.initial=e.props.initial),t}let t={};for(let n=0;n<rx;n++){let r=Qy[n],i=e.props[r];(Xy(i)||i===!1)&&(t[r]=i)}return t}function ax(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 ox=[...Zy].reverse(),sx=Zy.length;function cx(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Pv(e,t,n)))}function lx(e){let t=cx(e),n=fx(),r=!0,i=!1,a=t=>(n,r)=>{let i=vv(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=ix(e.parent)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<sx;t++){let p=ox[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=Xy(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||Yy(h)||typeof h==`boolean`)continue;if(p===`exit`&&m.isActive&&_!==!0){m.prevResolvedValues&&(d={...d,...m.prevResolvedValues});continue}let y=ux(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=bv(t)&&bv(n)?!ax(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=vv(r,t);if(r.enteringChildren&&i){let{delayChildren:t}=i.transition||{};n.delay=Z_(r.enteringChildren,e,t)}}return{animation:t,options:n}}))}if(u.size){let t={};if(typeof s.initial!=`boolean`){let n=vv(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=fx(),i=!0}}}function ux(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!ax(t,e):!1}function dx(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function fx(){return{animate:dx(!0),whileInView:dx(),whileHover:dx(),whileTap:dx(),whileDrag:dx(),whileFocus:dx(),exit:dx()}}function px(e,t){e.min=t.min,e.max=t.max}function mx(e,t){px(e.x,t.x),px(e.y,t.y)}function hx(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}var gx=.9999,_x=1.0001,vx=-.01,yx=.01;function bx(e){return e.max-e.min}function xx(e,t,n){return Math.abs(e-t)<=n}function Sx(e,t,n,r=.5){e.origin=r,e.originPoint=$h(t.min,t.max,e.origin),e.scale=bx(n)/bx(t),e.translate=$h(n.min,n.max,e.origin)-e.originPoint,(e.scale>=gx&&e.scale<=_x||isNaN(e.scale))&&(e.scale=1),(e.translate>=vx&&e.translate<=yx||isNaN(e.translate))&&(e.translate=0)}function Cx(e,t,n,r){Sx(e.x,t.x,n.x,r?r.originX:void 0),Sx(e.y,t.y,n.y,r?r.originY:void 0)}function wx(e,t,n,r=0){e.min=(r?$h(n.min,n.max,r):n.min)+t.min,e.max=e.min+bx(t)}function Tx(e,t,n,r){wx(e.x,t.x,n.x,r?.x),wx(e.y,t.y,n.y,r?.y)}function Ex(e,t,n,r=0){let i=r?$h(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+bx(t)}function Dx(e,t,n,r){Ex(e.x,t.x,n.x,r?.x),Ex(e.y,t.y,n.y,r?.y)}function Ox(e,t,n,r,i){return e-=t,e=xb(e,1/n,r),i!==void 0&&(e=xb(e,1/i,r)),e}function kx(e,t=0,n=1,r=.5,i,a=e,o=e){if(Oh.test(t)&&(t=parseFloat(t),t=$h(o.min,o.max,t/100)-o.min),typeof t!=`number`)return;let s=$h(a.min,a.max,r);e===a&&(s-=t),e.min=Ox(e.min,t,n,s,i),e.max=Ox(e.max,t,n,s,i)}function Ax(e,t,[n,r,i],a,o){kx(e,t[n],t[r],t[i],t.scale,a,o)}var jx=[`x`,`scaleX`,`originX`],Mx=[`y`,`scaleY`,`originY`];function Nx(e,t,n,r){Ax(e.x,t,jx,n?n.x:void 0,r?r.x:void 0),Ax(e.y,t,Mx,n?n.y:void 0,r?r.y:void 0)}function Px(e){return e.translate===0&&e.scale===1}function Fx(e){return Px(e.x)&&Px(e.y)}function Ix(e,t){return e.min===t.min&&e.max===t.max}function Lx(e,t){return Ix(e.x,t.x)&&Ix(e.y,t.y)}function Rx(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function zx(e,t){return Rx(e.x,t.x)&&Rx(e.y,t.y)}function Bx(e){return bx(e.x)/bx(e.y)}function Vx(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function Hx(e){return[e(`x`),e(`y`)]}function Ux(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 Wx=ey.length,Gx=e=>typeof e==`string`?parseFloat(e):e,Kx=e=>typeof e==`number`||H.test(e);function qx(e,t,n,r,i,a){i?(e.opacity=$h(0,n.opacity??1,Yx(r)),e.opacityExit=$h(t.opacity??1,0,Xx(r))):a&&(e.opacity=$h(t.opacity??1,n.opacity??1,r));for(let i=0;i<Wx;i++){let a=ey[i],o=Jx(t,a),s=Jx(n,a);o===void 0&&s===void 0||(o||=0,s||=0,o===0||s===0||Kx(o)===Kx(s)?(e[a]=Math.max($h(Gx(o),Gx(s),r),0),(Oh.test(s)||Oh.test(o))&&(e[a]+=`%`)):e[a]=s)}(t.rotate||n.rotate)&&(e.rotate=$h(t.rotate||0,n.rotate||0,r))}function Jx(e,t){return e[t]===void 0?e.borderRadius:e[t]}var Yx=Zx(0,.5,zm),Xx=Zx(.5,.95,bm);function Zx(e,t,n){return r=>r<e?0:r>t?1:n(Sm(e,t,r))}function Qx(e,t,n){let r=wv(e)?e:nv(e);return r.start(fv(``,r,t,n)),r.animation}function $x(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}var eS=(e,t)=>e.depth-t.depth,tS=class{constructor(){this.children=[],this.isDirty=!1}add(e){fm(this.children,e),this.isDirty=!0}remove(e){pm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(eS),this.isDirty=!1,this.children.forEach(e)}};function nS(e,t){let n=ah.now(),r=({timestamp:i})=>{let a=i-n;a>=t&&(eh(r),e(a-t))};return $m.setup(r,!0),()=>eh(r)}function rS(e){return wv(e)?e.get():e}var iS=class{constructor(){this.members=[]}add(e){fm(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&&(pm(this.members,n),n.unmount())}e.scheduleRender()}remove(e){if(pm(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)}},aS={hasAnimatedSinceResize:!0,hasEverUpdated:!1},oS={nodes:0,calculatedTargetDeltas:0,calculatedProjections:0},sS=[``,`X`,`Y`,`Z`],cS=1e3,lS=0;function uS(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function dS(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;let{visualElement:t}=e.options;if(!t)return;let n=kv(t);if(window.MotionHasOptimisedAnimation(n,`transform`)){let{layout:t,layoutId:r}=e.options;window.MotionCancelOptimisedAnimation(n,`transform`,$m,!(t||r))}let{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&dS(r)}function fS({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=t?.()){this.id=lS++,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,By.value&&(oS.nodes=oS.calculatedTargetDeltas=oS.calculatedProjections=0),this.nodes.forEach(hS),this.nodes.forEach(wS),this.nodes.forEach(TS),this.nodes.forEach(gS),By.addProjectionMetrics&&By.addProjectionMetrics(oS)},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 tS)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new Cm),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=Ty(t)&&!Vy(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;$m.read(()=>{r=window.innerWidth}),e(t,()=>{let e=window.innerWidth;e!==r&&(r=e,this.root.updateBlockedByResize=!0,n&&n(),n=nS(i,250),aS.hasAnimatedSinceResize&&(aS.hasAnimatedSinceResize=!1,this.nodes.forEach(CS)))})}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()||MS,{onLayoutAnimationStart:o,onLayoutAnimationComplete:s}=i.getProps(),c=!this.targetLayout||!zx(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={...iv(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||CS(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(),eh(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(ES),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&&dS(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(yS),this.nodes.forEach(vS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(bS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(xS),this.nodes.forEach(SS),this.nodes.forEach(pS),this.nodes.forEach(mS)):this.nodes.forEach(bS),this.clearAllSnapshots();let e=ah.now();th.delta=mm(0,1e3/60,e-th.timestamp),th.timestamp=e,th.isProcessing=!0,nh.update.process(th),nh.preRender.process(th),nh.render.process(th),th.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,iy.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(_S),this.sharedNodes.forEach(DS)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,$m.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){$m.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!bx(this.snapshot.measuredBox.x)&&!bx(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||=qy(),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&&!Fx(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,``):void 0,a=r!==this.prevTransformTemplateValue;e&&this.instance&&(t||vb(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)),IS(n),{animationId:this.root.animationId,measuredBox:t,layoutBox:n,latestValues:{},source:this.id}}measurePageBox(){let{visualElement:e}=this.options;if(!e)return qy();let t=e.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(RS))){let{scroll:e}=this.root;e&&(Ob(t.x,e.offset.x),Ob(t.y,e.offset.y))}return t}removeElementScroll(e){let t=qy();if(mx(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&&mx(t,e),Ob(t.x,i.offset.x),Ob(t.y,i.offset.y))}return t}applyTransform(e,t=!1,n){let r=n||qy();mx(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&&(Ob(r.x,-n.scroll.offset.x),Ob(r.y,-n.scroll.offset.y)),vb(n.latestValues)&&jb(r,n.latestValues,n.layout?.layoutBox)}return vb(this.latestValues)&&jb(r,this.latestValues,this.layout?.layoutBox),r}removeTransform(e){let t=qy();mx(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!vb(n.latestValues))continue;let r;n.instance&&(_b(n.latestValues)&&n.updateSnapshot(),r=qy(),mx(r,n.measurePageBox())),Nx(t,n.latestValues,n.snapshot?.layoutBox,r)}return vb(this.latestValues)&&Nx(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!==th.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=th.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=qy(),this.targetWithTransforms=qy()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Tx(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):mx(this.target,this.layout.layoutBox),wb(this.target,this.targetDelta)):mx(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),By.value&&oS.calculatedTargetDeltas++)}getClosestProjectingParent(){if(!(!this.parent||_b(this.parent.latestValues)||yb(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=qy(),this.relativeTargetOrigin=qy(),Dx(this.relativeTargetOrigin,t,n,this.options.layoutAnchor||void 0),mx(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===th.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;mx(this.layoutCorrected,this.layout.layoutBox);let a=this.treeScale.x,o=this.treeScale.y;Db(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=qy());let{target:s}=e;if(!s){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(hx(this.prevProjectionDelta.x,this.projectionDelta.x),hx(this.prevProjectionDelta.y,this.projectionDelta.y)),Cx(this.projectionDelta,this.layoutCorrected,s,this.latestValues),(this.treeScale.x!==a||this.treeScale.y!==o||!Vx(this.projectionDelta.x,this.prevProjectionDelta.x)||!Vx(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners(`projectionUpdate`,s)),By.value&&oS.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=Gy(),this.projectionDelta=Gy(),this.projectionDeltaWithTransform=Gy()}setAnimationOrigin(e,t=!1,n){let r=this.snapshot,i=r?r.latestValues:{},a={...this.latestValues},o=Gy();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let s=qy(),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(jS));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=$h(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=$h(e.y.scale,1,n),o.y.origin=e.y.origin,o.y.originPoint=e.y.originPoint):(OS(o.x,e.x,n),OS(o.y,e.y,n)),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Dx(s,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),AS(this.relativeTarget,this.relativeTargetOrigin,s,n),f&&Lx(this.relativeTarget,f)&&(this.isProjectionDirty=!1),f||=qy(),mx(f,this.relativeTarget)),c&&(this.animationValues=a,qx(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&&=(eh(this.pendingAnimation),void 0),this.pendingAnimation=$m.update(()=>{aS.hasAnimatedSinceResize=!0,this.motionValue||=nv(0),this.motionValue.jump(0,!1),this.currentAnimation=Qx(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(cS),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&&LS(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||qy();let t=bx(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=bx(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}mx(t,n),jb(t,i),Cx(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new iS),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&&uS(`z`,e,r,this.animationValues);for(let t=0;t<sS.length;t++)uS(`rotate${sS[t]}`,e,r,this.animationValues),uS(`skew${sS[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=rS(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=rS(t?.pointerEvents)||``),this.hasProjected&&!vb(this.latestValues)&&(e.transform=n?n({},``):`none`,this.hasProjected=!1);return}e.visibility=``;let i=r.animationValues||r.latestValues;this.applyTransformsToTarget();let a=Ux(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 Hb){if(i[t]===void 0)continue;let{correct:n,applyTo:o,isCSSVariable:s}=Hb[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?rS(t?.pointerEvents)||``:`none`)}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>e.currentAnimation?.stop()),this.root.nodes.forEach(vS),this.root.sharedNodes.clear()}}}function pS(e){e.updateLayout()}function mS(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`)Hx(e=>{let r=a?t.measuredBox[e]:t.layoutBox[e],i=bx(r);r.min=n[e].min,r.max=r.min+i});else if(i===`x`||i===`y`){let e=i===`x`?`y`:`x`;px(a?t.measuredBox[e]:t.layoutBox[e],n[e])}else LS(i,t.layoutBox,n)&&Hx(r=>{let i=a?t.measuredBox[r]:t.layoutBox[r],o=bx(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=Gy();Cx(o,n,t.layoutBox);let s=Gy();a?Cx(s,e.applyTransform(r,!0),t.measuredBox):Cx(s,n,t.layoutBox);let c=!Fx(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=qy();Dx(s,t.layoutBox,i.layoutBox,o);let c=qy();Dx(c,n,a.layoutBox,o),zx(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 hS(e){By.value&&oS.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 gS(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function _S(e){e.clearSnapshot()}function vS(e){e.clearMeasurements()}function yS(e){e.isLayoutDirty=!0,e.updateLayout()}function bS(e){e.isLayoutDirty=!1}function xS(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function SS(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify(`BeforeLayoutMeasure`),e.resetTransform()}function CS(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function wS(e){e.resolveTargetDelta()}function TS(e){e.calcProjection()}function ES(e){e.resetSkewAndRotation()}function DS(e){e.removeLeadSnapshot()}function OS(e,t,n){e.translate=$h(t.translate,0,n),e.scale=$h(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function kS(e,t,n,r){e.min=$h(t.min,n.min,r),e.max=$h(t.max,n.max,r)}function AS(e,t,n,r){kS(e.x,t.x,n.x,r),kS(e.y,t.y,n.y,r)}function jS(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}var MS={duration:.45,ease:[.4,0,.1,1]},NS=e=>typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),PS=NS(`applewebkit/`)&&!NS(`chrome/`)?Math.round:bm;function FS(e){e.min=PS(e.min),e.max=PS(e.max)}function IS(e){FS(e.x),FS(e.y)}function LS(e,t,n){return e===`position`||e===`preserve-aspect`&&!xx(Bx(t),Bx(n),.2)}function RS(e){return e!==e.root&&e.scroll?.wasRoot}var zS=fS({attachResizeListener:(e,t)=>$x(e,`resize`,t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),BS={current:void 0},VS=fS({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!BS.current){let e=new zS({});e.mount(window),e.setOptions({layoutScroll:!0}),BS.current=e}return BS.current},resetTransform:(e,t)=>{e.style.transform=t===void 0?`none`:t},checkIsScrollRoot:e=>window.getComputedStyle(e).position===`fixed`}),HS=(0,L.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`});function US(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function WS(...e){return t=>{let n=!1,r=e.map(e=>{let r=US(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():US(e[t],null)}}}}function GS(...e){return L.useCallback(WS(...e),e)}var KS=class extends L.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(ry(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=ry(e)&&e.offsetWidth||0,r=ry(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 qS({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,L.useId)(),s=(0,L.useRef)(null),c=(0,L.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,L.useContext)(HS),u=GS(s,e.props?.ref??e?.ref);return(0,L.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;
|
|
@@ -20,17 +20,17 @@ ${t}`,l++;break;case`id`:s=t.includes(`\0`)?void 0:t;break;case`retry`:/^\d+$/.t
|
|
|
20
20
|
${_}px !important;
|
|
21
21
|
${v}px !important;
|
|
22
22
|
}
|
|
23
|
-
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,R.jsx)(GS,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:L.cloneElement(e,{ref:u})})}var qS=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=cm(JS),d=(0,L.useId)(),f=(0,L.useRef)(n),p=(0,L.useRef)(r);lm(()=>{f.current=n,p.current=r});let m=!0,h=(0,L.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,L.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),L.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,R.jsx)(KS,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,R.jsx)(um.Provider,{value:h,children:e})};function JS(){return new Map}function YS(e=!0){let t=(0,L.useContext)(um);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,L.useId)();(0,L.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,L.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var XS=e=>e.key||``;function ZS(e){let t=[];return L.Children.forEach(e,e=>{(0,L.isValidElement)(e)&&t.push(e)}),t}var QS=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=YS(o),f=(0,L.useMemo)(()=>ZS(e),[e]),p=o&&!u?[]:f.map(XS),m=(0,L.useRef)(!0),h=(0,L.useRef)(f),g=cm(()=>new Map),_=(0,L.useRef)(new Set),[v,y]=(0,L.useState)(f),[b,x]=(0,L.useState)(f);lm(()=>{m.current=!1,h.current=f;for(let e=0;e<b.length;e++){let t=XS(b[e]);p.includes(t)?(g.delete(t),_.current.delete(t)):g.get(t)!==!0&&g.set(t,!1)}},[b,p.length,p.join(`-`)]);let S=[];if(f!==v){let e=[...f];for(let t=0;t<b.length;t++){let n=b[t],r=XS(n);p.includes(r)||(e.splice(t,0,n),S.push(n))}return a===`wait`&&S.length&&(e=S),x(ZS(e)),y(f),null}let{forceRender:C}=(0,L.useContext)(sm);return(0,R.jsx)(R.Fragment,{children:b.map(e=>{let v=XS(e),y=o&&!u?!1:f===b||p.includes(v);return(0,R.jsx)(qS,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(g.has(v))_.current.add(v),g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(C?.(),x(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},$S=(0,L.createContext)({strict:!1}),eC={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},tC=!1;function nC(){if(tC)return;let e={};for(let t in eC)e[t]={isEnabled:e=>eC[t].some(t=>!!e[t])};sb(e),tC=!0}function rC(){return nC(),cb()}function iC(e){let t=rC();for(let n in e)t[n]={...t[n],...e[n]};sb(t)}var aC=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function oC(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||aC.has(e)}var sC=t({default:()=>cC}),cC,lC=s((()=>{throw cC={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),uC=e=>!oC(e);function dC(e){typeof e==`function`&&(uC=t=>t.startsWith(`on`)?!oC(t):e(t))}try{dC((lC(),c(sC)).default)}catch{}function fC(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||Cv(e[i])||(uC(i)||n===!0&&oC(i)||!t&&!oC(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var pC=(0,L.createContext)({});function mC(e,t){if(Qy(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Yy(t)?t:void 0,animate:Yy(n)?n:void 0}}return e.inherit===!1?{}:t}function hC(e){let{initial:t,animate:n}=mC(e,(0,L.useContext)(pC));return(0,L.useMemo)(()=>({initial:t,animate:n}),[gC(t),gC(n)])}function gC(e){return Array.isArray(e)?e.join(` `):e}var _C=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function vC(e,t,n){for(let r in t)!Cv(t[r])&&!Hb(r,n)&&(e[r]=t[r])}function yC({transformTemplate:e},t){return(0,L.useMemo)(()=>{let n=_C();return Ib(n,t,e),Object.assign({},n.vars,n.style)},[t])}function bC(e,t){let n=e.style||{},r={};return vC(r,n,e),Object.assign(r,yC(e,t)),r}function xC(e,t){let n={},r=bC(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var SC=()=>({..._C(),attrs:{}});function CC(e,t,n,r){let i=(0,L.useMemo)(()=>{let n=SC();return Xb(n,t,Qb(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};vC(t,e.style,e),i.style={...t,...i.style}}return i}var wC=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function TC(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(wC.indexOf(e)>-1||/[A-Z]/u.test(e))}function EC(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??TC(e)?CC:xC)(t,r,i,e),c=fC(t,typeof e==`string`,a),l=e===L.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,L.useMemo)(()=>Cv(u)?u.get():u,[u]);return(0,L.createElement)(e,{...l,children:d})}function DC({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:OC(n,r,i,e),renderState:t()}}function OC(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=nS(a[e]);let{initial:o,animate:s}=e,c=Qy(e),l=$y(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Jy(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=gv(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var kC=e=>(t,n)=>{let r=(0,L.useContext)(pC),i=(0,L.useContext)(um),a=()=>DC(e,t,r,i);return n?a():cm(a)},AC=kC({scrapeMotionValuesFromProps:Ub,createRenderState:_C}),jC=kC({scrapeMotionValuesFromProps:ex,createRenderState:SC}),MC=Symbol.for(`motionComponentSymbol`);function NC(e,t,n){let r=(0,L.useRef)(n);(0,L.useInsertionEffect)(()=>{r.current=n});let i=(0,L.useRef)(null);return(0,L.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var PC=(0,L.createContext)({});function FC(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function IC(e,t,n,r,i,a){let{visualElement:o}=(0,L.useContext)(pC),s=(0,L.useContext)($S),c=(0,L.useContext)(um),l=(0,L.useContext)(VS),u=l.reducedMotion,d=l.skipAnimations,f=(0,L.useRef)(null),p=(0,L.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,L.useContext)(PC);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&LC(f.current,n,i,h);let g=(0,L.useRef)(!1);(0,L.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[Dv],v=(0,L.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return lm(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,L.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function LC(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:RC(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&FC(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function RC(e){if(e)return e.options.allowProjection===!1?RC(e.parent):e.projection}function zC(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&iC(r);let a=n?n===`svg`:TC(e),o=a?jC:AC;function s(n,s){let c,l={...(0,L.useContext)(VS),...n,layoutId:BC(n)},{isStatic:u}=l,d=hC(n),f=o(n,u);if(!u&&typeof window<`u`){VC(l,r);let t=HC(l);c=t.MeasureLayout,d.visualElement=IC(e,f,l,i,t.ProjectionNode,a)}return(0,R.jsxs)(pC.Provider,{value:d,children:[c&&d.visualElement?(0,R.jsx)(c,{visualElement:d.visualElement,...l}):null,EC(e,n,NC(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,L.forwardRef)(s);return c[MC]=e,c}function BC({layoutId:e}){let t=(0,L.useContext)(sm).id;return t&&e!==void 0?t+`-`+e:e}function VC(e,t){(0,L.useContext)($S).strict}function HC(e){let{drag:t,layout:n}=rC();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function UC(e,t){if(typeof Proxy>`u`)return zC;let n=new Map,r=(n,r)=>zC(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,zC(a,void 0,e,t)),n.get(a))})}var WC=(e,t)=>t.isSVG??TC(e)?new tx(t):new Gb(t,{allowProjection:e!==L.Fragment}),GC=class extends db{constructor(e){super(e),e.animationState||=cx(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Jy(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},KC=0,qC={animation:{Feature:GC},exit:{Feature:class extends db{constructor(){super(...arguments),this.id=KC++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=_v(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function JC(e){return{point:{x:e.pageX,y:e.pageY}}}var YC=e=>t=>fy(t)&&e(t,JC(t));function XC(e,t,n,r){return Qx(e,t,YC(n),r)}var ZC=({current:e})=>e?e.ownerDocument.defaultView:null,QC=(e,t)=>Math.abs(e-t);function $C(e,t){let n=QC(e.x,t.x),r=QC(e.y,t.y);return Math.sqrt(n**2+r**2)}var ew=new Set([`auto`,`scroll`]),tw=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=nw(this.lastRawMoveEventInfo,this.transformPagePoint));let e=iw(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=$C(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=eh;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=nw(t,this.transformPagePoint),Qm.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=iw(e.type===`pointercancel`?this.lastMoveEventInfo:nw(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!fy(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=nw(JC(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=eh;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,iw(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=bm(XC(this.contextWindow,`pointermove`,this.handlePointerMove,d),XC(this.contextWindow,`pointerup`,this.handlePointerUp,d),XC(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(ew.has(e.overflowX)||ew.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),Qm.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),$m(this.updatePoint)}};function nw(e,t){return t?{point:t(e.point)}:e}function rw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function iw({point:e},t){return{point:e,delta:rw(e,ow(t)),offset:rw(e,aw(t)),velocity:sw(t,.1)}}function aw(e){return e[0]}function ow(e){return e[e.length-1]}function sw(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=ow(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>Cm(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>Cm(t)*2&&(r=e[1]);let a=wm(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function cw(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?Qh(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?Qh(n,e,r.max):Math.min(e,n)),e}function lw(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function uw(e,{top:t,left:n,bottom:r,right:i}){return{x:lw(e.x,n,i),y:lw(e.y,t,r)}}function dw(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function fw(e,t){return{x:dw(e.x,t.x),y:dw(e.y,t.y)}}function pw(e,t){let n=.5,r=yx(e),i=yx(t);return i>r?n=xm(t.min,t.max-r,e.min):r>i&&(n=xm(e.min,e.max-i,t.min)),pm(0,1,n)}function mw(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var hw=.35;function gw(e=hw){return e===!1?e=0:e===!0&&(e=hw),{x:_w(e,`left`,`right`),y:_w(e,`top`,`bottom`)}}function _w(e,t,n){return{min:vw(e,t),max:vw(e,n)}}function vw(e,t){return typeof e==`number`?e:e[t]||0}var yw=new WeakMap,bw=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Ky(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(JC(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=sy(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Vx(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Dh.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=yx(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&Qm.update(()=>i(e,t),!1,!0),Tv(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=ww(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&Qm.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new tw(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:ZC(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&Qm.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!Cw(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=cw(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&FC(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=uw(n.layoutBox,e):this.constraints=!1,this.elastic=gw(t),r!==this.constraints&&!FC(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Vx(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=mw(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!FC(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=Mb(n,r.root,this.visualElement.getTransformPagePoint()),a=fw(r.layout.layoutBox,i);if(t){let e=t(pb(a));this.hasMutatedConstraints=!!e,e&&(a=fb(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Vx(o=>{if(!Cw(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Tv(this.visualElement,e),n.start(dv(e,n,0,t,this.visualElement,!1))}stopAnimation(){Vx(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){Vx(t=>{let{drag:n}=this.getProps();if(!Cw(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-Qh(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!FC(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};Vx(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=pw({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Vx(t=>{if(!Cw(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set(Qh(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;yw.set(this.visualElement,this);let e=this.visualElement.current,t=XC(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&gy(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();FC(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=Sw(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Qm.read(r);let o=Qx(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Vx(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=hw,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function xw(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Sw(e,t,n){let r=Ry(e,xw(n)),i=Ry(t,xw(n));return()=>{r(),i()}}function Cw(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function ww(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Tw=class extends db{constructor(e){super(e),this.removeGroupControls=ym,this.removeListeners=ym,this.controls=new bw(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ym}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Ew=e=>(t,n)=>{e&&Qm.update(()=>e(t,n),!1,!0)},Dw=class extends db{constructor(){super(...arguments),this.removePointerDownListener=ym}onPointerDown(e){this.session=new tw(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:ZC(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Ew(e),onStart:Ew(t),onMove:Ew(n),onEnd:(e,t)=>{delete this.session,r&&Qm.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=XC(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},Ow=!1,kw=class extends L.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),Ow&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),iS.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),Ow=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||Qm.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),ry.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;Ow=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function Aw(e){let[t,n]=YS(),r=(0,L.useContext)(sm);return(0,R.jsx)(kw,{...e,layoutGroup:r,switchLayoutGroup:(0,L.useContext)(PC),isPresent:t,safeToRemove:n})}var jw={pan:{Feature:Dw},drag:{Feature:Tw,ProjectionNode:BS,MeasureLayout:Aw}};function Mw(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&Qm.postRender(()=>i(t,JC(t)))}var Nw=class extends db{mount(){let{current:e}=this.node;e&&(this.unmount=uy(e,(e,t)=>(Mw(this.node,t,`Start`),e=>Mw(this.node,e,`End`))))}unmount(){}},Pw=class extends db{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=bm(Qx(this.node.current,`focus`,()=>this.onFocus()),Qx(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Fw(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&Qm.postRender(()=>i(t,JC(t)))}var Iw=class extends db{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=Cy(e,(e,t)=>(Fw(this.node,t,`Start`),(e,{success:t})=>Fw(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Lw=new WeakMap,Rw=new WeakMap,zw=e=>{let t=Lw.get(e.target);t&&t(e)},Bw=e=>{e.forEach(zw)};function Vw({root:e,...t}){let n=e||document;Rw.has(n)||Rw.set(n,{});let r=Rw.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Bw,{root:e,...t})),r[i]}function Hw(e,t,n){let r=Vw(t);return Lw.set(e,n),r.observe(e),()=>{Lw.delete(e),r.unobserve(e)}}var Uw={some:0,all:1},Ww=class extends db{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Uw[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Hw(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Gw(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Gw({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Kw={inView:{Feature:Ww},tap:{Feature:Iw},focus:{Feature:Pw},hover:{Feature:Nw}},qw={layout:{ProjectionNode:BS,MeasureLayout:Aw}},Jw=UC({...qC,...Kw,...jw,...qw},WC);function Yw(){!nb.current&&ib();let[e]=(0,L.useState)(tb.current);return e}function Xw(e){e.values.forEach(e=>e.stop())}function Zw(e,t){[...t].reverse().forEach(n=>{let r=e.getVariant(n);r&&Sv(e,r),e.variantChildren&&e.variantChildren.forEach(e=>{Zw(e,t)})})}function Qw(e,t){if(Array.isArray(t))return Zw(e,t);if(typeof t==`string`)return Zw(e,[t]);Sv(e,t)}function $w(){let e=new Set,t={subscribe(t){return e.add(t),()=>void e.delete(t)},start(t,n){let r=[];return e.forEach(e=>{r.push(Nv(e,t,{transitionOverride:n}))}),Promise.all(r)},set(t){return e.forEach(e=>{Qw(e,t)})},stop(){e.forEach(e=>{Xw(e)})},mount(){return()=>{t.stop()}}};return t}function eT(){let e=cm($w);return lm(e.mount,[]),e}var tT=eT,U=ze(),nT=Jw,rT={damping:.7,stiffness:.05,mass:1.25},iT=70,aT=1e3/60,oT=350,sT=!1;globalThis.document?.addEventListener(`mousedown`,()=>{sT=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{sT=!1}),globalThis.document?.addEventListener(`click`,()=>{sT=!1});var cT=(e={})=>{let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(e.initial!==!1),[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null);s.current=e;let c=(0,L.useCallback)(()=>{if(!sT)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,L.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,L.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,L.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){if(g.current){let{scrollBehavior:t}=getComputedStyle(g.current);t!==`auto`&&(g.current.style.scrollBehavior=`auto`),g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop,t!==`auto`&&(g.current.style.scrollBehavior=t)}},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=iT}}},[]),f=(0,L.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=dT(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/aT;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:dT(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,L.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,L.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,L.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=lT(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=lT(e=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=dT(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:oT})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function lT(e,t){let n=(0,L.useCallback)(t=>(n.current=t,e(t)),t);return n}var uT=new Map;function dT(...e){let t={...rT},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return uT.has(r)||uT.set(r,Object.freeze(t)),n?`instant`:uT.get(r)}var fT=new Set([`name`,`id`,`aria-describedby`,`aria-labelledby`]);function pT(e){let t=new Set;for(let{name:n}of e){if(t.has(n))return n;t.add(n)}}function mT(e){let t=e.allowedAttributes.filter(e=>fT.has(e));if(t.length>0)throw Error(`Interactive element <${e.name}> declares reserved attribute(s) ${t.join(`, `)}. The markdown sanitizer rewrites these to "user-content-<value>" (DOM-clobbering protection), so the component would receive a mangled value. Use a domain attribute instead (e.g. "param").`)}var hT=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/,gT=I().min(1).max(64).regex(hT).refine(e=>!fT.has(e),{message:`Attribute is reserved: the markdown sanitizer rewrites it to "user-content-<value>". Use a domain attribute instead (e.g. "param").`}),_T=he({name:I().min(1).max(64).regex(hT),description:I().max(512).optional(),allowedAttributes:et(gT).max(20)});et(_T).max(100).superRefine((e,t)=>{let n=pT(e);n!==void 0&&t.addIssue({code:`custom`,message:`Duplicate element name "${n}": a catalog must map each tag to exactly one element.`})}).optional();function vT(e){let{name:t,allowedAttributes:n,description:r}=e;return{name:t,allowedAttributes:n,description:r}}function yT(e){for(let t of e){let e=_T.safeParse(vT(t));if(!e.success)throw Error(`Interactive element <${t.name}> is invalid:
|
|
24
|
-
${E(e.error)}`)}let t=
|
|
25
|
-
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=
|
|
23
|
+
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,R.jsx)(KS,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:L.cloneElement(e,{ref:u})})}var JS=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o,anchorX:s,anchorY:c,root:l})=>{let u=lm(YS),d=(0,L.useId)(),f=(0,L.useRef)(n),p=(0,L.useRef)(r);um(()=>{f.current=n,p.current=r});let m=!0,h=(0,L.useMemo)(()=>(m=!1,{id:d,initial:t,isPresent:n,custom:i,onExitComplete:e=>{u.set(e,!0);for(let e of u.values())if(!e)return;r&&r()},register:e=>(u.set(e,!1),()=>{u.delete(e),!f.current&&!u.size&&p.current?.()})}),[n,u,r]);return a&&m&&(h={...h}),(0,L.useMemo)(()=>{u.forEach((e,t)=>u.set(t,!1))},[n]),L.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),e=(0,R.jsx)(qS,{pop:o===`popLayout`,isPresent:n,anchorX:s,anchorY:c,root:l,children:e}),(0,R.jsx)(dm.Provider,{value:h,children:e})};function YS(){return new Map}function XS(e=!0){let t=(0,L.useContext)(dm);if(t===null)return[!0,null];let{isPresent:n,onExitComplete:r,register:i}=t,a=(0,L.useId)();(0,L.useEffect)(()=>{if(e)return i(a)},[e]);let o=(0,L.useCallback)(()=>e&&r&&r(a),[a,r,e]);return!n&&r?[!1,o]:[!0]}var ZS=e=>e.key||``;function QS(e){let t=[];return L.Children.forEach(e,e=>{(0,L.isValidElement)(e)&&t.push(e)}),t}var $S=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:a=`sync`,propagate:o=!1,anchorX:s=`left`,anchorY:c=`top`,root:l})=>{let[u,d]=XS(o),f=(0,L.useMemo)(()=>QS(e),[e]),p=o&&!u?[]:f.map(ZS),m=(0,L.useRef)(!0),h=(0,L.useRef)(f),g=lm(()=>new Map),_=(0,L.useRef)(new Set),[v,y]=(0,L.useState)(f),[b,x]=(0,L.useState)(f);um(()=>{m.current=!1,h.current=f;for(let e=0;e<b.length;e++){let t=ZS(b[e]);p.includes(t)?(g.delete(t),_.current.delete(t)):g.get(t)!==!0&&g.set(t,!1)}},[b,p.length,p.join(`-`)]);let S=[];if(f!==v){let e=[...f];for(let t=0;t<b.length;t++){let n=b[t],r=ZS(n);p.includes(r)||(e.splice(t,0,n),S.push(n))}return a===`wait`&&S.length&&(e=S),x(QS(e)),y(f),null}let{forceRender:C}=(0,L.useContext)(cm);return(0,R.jsx)(R.Fragment,{children:b.map(e=>{let v=ZS(e),y=o&&!u?!1:f===b||p.includes(v);return(0,R.jsx)(JS,{isPresent:y,initial:!m.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:a,root:l,onExitComplete:y?void 0:()=>{if(_.current.has(v))return;if(g.has(v))_.current.add(v),g.set(v,!0);else return;let e=!0;g.forEach(t=>{t||(e=!1)}),e&&(C?.(),x(h.current),o&&d?.(),r&&r())},anchorX:s,anchorY:c,children:e},v)})})},eC=(0,L.createContext)({strict:!1}),tC={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},nC=!1;function rC(){if(nC)return;let e={};for(let t in tC)e[t]={isEnabled:e=>tC[t].some(t=>!!e[t])};cb(e),nC=!0}function iC(){return rC(),lb()}function aC(e){let t=iC();for(let n in e)t[n]={...t[n],...e[n]};cb(t)}var oC=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.propagate.ignoreStrict.viewport`.split(`.`));function sC(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||oC.has(e)}var cC=t({default:()=>lC}),lC,uC=s((()=>{throw lC={},Error(`Could not resolve "@emotion/is-prop-valid" imported by "framer-motion". Is it installed?`)})),dC=e=>!sC(e);function fC(e){typeof e==`function`&&(dC=t=>t.startsWith(`on`)?!sC(t):e(t))}try{fC((uC(),c(cC)).default)}catch{}function pC(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||wv(e[i])||(dC(i)||n===!0&&sC(i)||!t&&!sC(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}var mC=(0,L.createContext)({});function hC(e,t){if($y(e)){let{initial:t,animate:n}=e;return{initial:t===!1||Xy(t)?t:void 0,animate:Xy(n)?n:void 0}}return e.inherit===!1?{}:t}function gC(e){let{initial:t,animate:n}=hC(e,(0,L.useContext)(mC));return(0,L.useMemo)(()=>({initial:t,animate:n}),[_C(t),_C(n)])}function _C(e){return Array.isArray(e)?e.join(` `):e}var vC=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function yC(e,t,n){for(let r in t)!wv(t[r])&&!Ub(r,n)&&(e[r]=t[r])}function bC({transformTemplate:e},t){return(0,L.useMemo)(()=>{let n=vC();return Lb(n,t,e),Object.assign({},n.vars,n.style)},[t])}function xC(e,t){let n=e.style||{},r={};return yC(r,n,e),Object.assign(r,bC(e,t)),r}function SC(e,t){let n={},r=xC(e,t);return e.drag&&e.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout=`none`,r.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n}var CC=()=>({...vC(),attrs:{}});function wC(e,t,n,r){let i=(0,L.useMemo)(()=>{let n=CC();return Zb(n,t,$b(r),e.transformTemplate,e.style),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};yC(t,e.style,e),i.style={...t,...i.style}}return i}var TC=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function EC(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(TC.indexOf(e)>-1||/[A-Z]/u.test(e))}function DC(e,t,n,{latestValues:r},i,a=!1,o){let s=(o??EC(e)?wC:SC)(t,r,i,e),c=pC(t,typeof e==`string`,a),l=e===L.Fragment?{}:{...c,...s,ref:n},{children:u}=t,d=(0,L.useMemo)(()=>wv(u)?u.get():u,[u]);return(0,L.createElement)(e,{...l,children:d})}function OC({scrapeMotionValuesFromProps:e,createRenderState:t},n,r,i){return{latestValues:kC(n,r,i,e),renderState:t()}}function kC(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=rS(a[e]);let{initial:o,animate:s}=e,c=$y(e),l=eb(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;if(d&&typeof d!=`boolean`&&!Yy(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=_v(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let t in e)i[t]=e[t]}}}return i}var AC=e=>(t,n)=>{let r=(0,L.useContext)(mC),i=(0,L.useContext)(dm),a=()=>OC(e,t,r,i);return n?a():lm(a)},jC=AC({scrapeMotionValuesFromProps:Wb,createRenderState:vC}),MC=AC({scrapeMotionValuesFromProps:tx,createRenderState:CC}),NC=Symbol.for(`motionComponentSymbol`);function PC(e,t,n){let r=(0,L.useRef)(n);(0,L.useInsertionEffect)(()=>{r.current=n});let i=(0,L.useRef)(null);return(0,L.useCallback)(n=>{n&&e.onMount?.(n),t&&(n?t.mount(n):t.unmount());let a=r.current;if(typeof a==`function`)if(n){let e=a(n);typeof e==`function`&&(i.current=e)}else i.current?(i.current(),i.current=null):a(n);else a&&(a.current=n)},[t])}var FC=(0,L.createContext)({});function IC(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function LC(e,t,n,r,i,a){let{visualElement:o}=(0,L.useContext)(mC),s=(0,L.useContext)(eC),c=(0,L.useContext)(dm),l=(0,L.useContext)(HS),u=l.reducedMotion,d=l.skipAnimations,f=(0,L.useRef)(null),p=(0,L.useRef)(!1);r||=s.renderer,!f.current&&r&&(f.current=r(e,{visualState:t,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:d,isSVG:a}),p.current&&f.current&&(f.current.manuallyAnimateOnMount=!0));let m=f.current,h=(0,L.useContext)(FC);m&&!m.projection&&i&&(m.type===`html`||m.type===`svg`)&&RC(f.current,n,i,h);let g=(0,L.useRef)(!1);(0,L.useInsertionEffect)(()=>{m&&g.current&&m.update(n,c)});let _=n[Ov],v=(0,L.useRef)(!!_&&typeof window<`u`&&!window.MotionHandoffIsComplete?.(_)&&window.MotionHasOptimisedAnimation?.(_));return um(()=>{p.current=!0,m&&(g.current=!0,window.MotionIsMounted=!0,m.updateFeatures(),m.scheduleRenderMicrotask(),v.current&&m.animationState&&m.animationState.animateChanges())}),(0,L.useEffect)(()=>{m&&(!v.current&&m.animationState&&m.animationState.animateChanges(),v.current&&=(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(_)}),!1),m.enteringChildren=void 0)}),m}function RC(e,t,n,r){let{layoutId:i,layout:a,drag:o,dragConstraints:s,layoutScroll:c,layoutRoot:l,layoutAnchor:u,layoutCrossfade:d}=t;e.projection=new n(e.latestValues,t[`data-framer-portal-id`]?void 0:zC(e.parent)),e.projection.setOptions({layoutId:i,layout:a,alwaysMeasureLayout:!!o||s&&IC(s),visualElement:e,animationType:typeof a==`string`?a:`both`,initialPromotionConfig:r,crossfade:d,layoutScroll:c,layoutRoot:l,layoutAnchor:u})}function zC(e){if(e)return e.options.allowProjection===!1?zC(e.parent):e.projection}function BC(e,{forwardMotionProps:t=!1,type:n}={},r,i){r&&aC(r);let a=n?n===`svg`:EC(e),o=a?MC:jC;function s(n,s){let c,l={...(0,L.useContext)(HS),...n,layoutId:VC(n)},{isStatic:u}=l,d=gC(n),f=o(n,u);if(!u&&typeof window<`u`){HC(l,r);let t=UC(l);c=t.MeasureLayout,d.visualElement=LC(e,f,l,i,t.ProjectionNode,a)}return(0,R.jsxs)(mC.Provider,{value:d,children:[c&&d.visualElement?(0,R.jsx)(c,{visualElement:d.visualElement,...l}):null,DC(e,n,PC(f,d.visualElement,s),f,u,t,a)]})}s.displayName=`motion.${typeof e==`string`?e:`create(${e.displayName??e.name??``})`}`;let c=(0,L.forwardRef)(s);return c[NC]=e,c}function VC({layoutId:e}){let t=(0,L.useContext)(cm).id;return t&&e!==void 0?t+`-`+e:e}function HC(e,t){(0,L.useContext)(eC).strict}function UC(e){let{drag:t,layout:n}=iC();if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:t?.isEnabled(e)||n?.isEnabled(e)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function WC(e,t){if(typeof Proxy>`u`)return BC;let n=new Map,r=(n,r)=>BC(n,r,e,t);return new Proxy((e,t)=>r(e,t),{get:(i,a)=>a===`create`?r:(n.has(a)||n.set(a,BC(a,void 0,e,t)),n.get(a))})}var GC=(e,t)=>t.isSVG??EC(e)?new nx(t):new Kb(t,{allowProjection:e!==L.Fragment}),KC=class extends fb{constructor(e){super(e),e.animationState||=lx(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();Yy(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}},qC=0,JC={animation:{Feature:KC},exit:{Feature:class extends fb{constructor(){super(...arguments),this.id=qC++,this.isExitComplete=!1}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;if(e&&n===!1){if(this.isExitComplete){let{initial:e,custom:t}=this.node.getProps();if(typeof e==`string`||typeof e==`object`&&e&&!Array.isArray(e)){let n=vv(this.node,e,t);if(n){let{transition:e,transitionEnd:t,...r}=n;for(let e in r)this.node.getValue(e)?.jump(r[e])}}this.node.animationState.reset(),this.node.animationState.animateChanges()}else this.node.animationState.setActive(`exit`,!1);this.isExitComplete=!1;return}let r=this.node.animationState.setActive(`exit`,!e);t&&!e&&r.then(()=>{this.isExitComplete=!0,t(this.id)})}mount(){let{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}}};function YC(e){return{point:{x:e.pageX,y:e.pageY}}}var XC=e=>t=>py(t)&&e(t,YC(t));function ZC(e,t,n,r){return $x(e,t,XC(n),r)}var QC=({current:e})=>e?e.ownerDocument.defaultView:null,$C=(e,t)=>Math.abs(e-t);function ew(e,t){let n=$C(e.x,t.x),r=$C(e.y,t.y);return Math.sqrt(n**2+r**2)}var tw=new Set([`auto`,`scroll`]),nw=class{constructor(e,t,{transformPagePoint:n,contextWindow:r=window,dragSnapToOrigin:i=!1,distanceThreshold:a=3,element:o}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.lastRawMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=e=>{this.handleScroll(e.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;this.lastRawMoveEventInfo&&(this.lastMoveEventInfo=rw(this.lastRawMoveEventInfo,this.transformPagePoint));let e=aw(this.lastMoveEventInfo,this.history),t=this.startEvent!==null,n=ew(e.offset,{x:0,y:0})>=this.distanceThreshold;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=th;this.history.push({...r,timestamp:i});let{onStart:a,onMove:o}=this.handlers;t||(a&&a(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastRawMoveEventInfo=t,this.lastMoveEventInfo=rw(t,this.transformPagePoint),$m.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let a=aw(e.type===`pointercancel`?this.lastMoveEventInfo:rw(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,a),r&&r(e,a)},!py(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.distanceThreshold=a,this.contextWindow=r||window;let s=rw(YC(e),this.transformPagePoint),{point:c}=s,{timestamp:l}=th;this.history=[{...c,timestamp:l}];let{onSessionStart:u}=t;u&&u(e,aw(s,this.history));let d={passive:!0,capture:!0};this.removeListeners=xm(ZC(this.contextWindow,`pointermove`,this.handlePointerMove,d),ZC(this.contextWindow,`pointerup`,this.handlePointerUp,d),ZC(this.contextWindow,`pointercancel`,this.handlePointerUp,d)),o&&this.startScrollTracking(o)}startScrollTracking(e){let t=e.parentElement;for(;t;){let e=getComputedStyle(t);(tw.has(e.overflowX)||tw.has(e.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.addEventListener(`scroll`,this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener(`scroll`,this.onElementScroll,{capture:!0}),window.removeEventListener(`scroll`,this.onWindowScroll)}}handleScroll(e){let t=this.scrollPositions.get(e);if(!t)return;let n=e===window,r=n?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:r.x-t.x,y:r.y-t.y};i.x===0&&i.y===0||(n?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,r),$m.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),eh(this.updatePoint)}};function rw(e,t){return t?{point:t(e.point)}:e}function iw(e,t){return{x:e.x-t.x,y:e.y-t.y}}function aw({point:e},t){return{point:e,delta:iw(e,sw(t)),offset:iw(e,ow(t)),velocity:cw(t,.1)}}function ow(e){return e[0]}function sw(e){return e[e.length-1]}function cw(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=sw(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>wm(t)));)n--;if(!r)return{x:0,y:0};r===e[0]&&e.length>2&&i.timestamp-r.timestamp>wm(t)*2&&(r=e[1]);let a=Tm(i.timestamp-r.timestamp);if(a===0)return{x:0,y:0};let o={x:(i.x-r.x)/a,y:(i.y-r.y)/a};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function lw(e,{min:t,max:n},r){return t!==void 0&&e<t?e=r?$h(t,e,r.min):Math.max(e,t):n!==void 0&&e>n&&(e=r?$h(n,e,r.max):Math.min(e,n)),e}function uw(e,t,n){return{min:t===void 0?void 0:e.min+t,max:n===void 0?void 0:e.max+n-(e.max-e.min)}}function dw(e,{top:t,left:n,bottom:r,right:i}){return{x:uw(e.x,n,i),y:uw(e.y,t,r)}}function fw(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function pw(e,t){return{x:fw(e.x,t.x),y:fw(e.y,t.y)}}function mw(e,t){let n=.5,r=bx(e),i=bx(t);return i>r?n=Sm(t.min,t.max-r,e.min):r>i&&(n=Sm(e.min,e.max-i,t.min)),mm(0,1,n)}function hw(e,t){let n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}var gw=.35;function _w(e=gw){return e===!1?e=0:e===!0&&(e=gw),{x:vw(e,`left`,`right`),y:vw(e,`top`,`bottom`)}}function vw(e,t,n){return{min:yw(e,t),max:yw(e,n)}}function yw(e,t){return typeof e==`number`?e:e[t]||0}var bw=new WeakMap,xw=class{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=qy(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:n}={}){let{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;let i=e=>{t&&this.snapToCursor(YC(e).point),this.stopAnimation()},a=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=cy(n),!this.openDragLock))return;this.latestPointerEvent=e,this.latestPanInfo=t,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Hx(e=>{let t=this.getAxisMotionValue(e).get()||0;if(Oh.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=bx(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&$m.update(()=>i(e,t),!1,!0),Ev(this.visualElement,`transform`);let{animationState:a}=this.visualElement;a&&a.setActive(`whileDrag`,!0)},o=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t;let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:a}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&this.currentDirection===null){this.currentDirection=Tw(o),this.currentDirection!==null&&i&&i(this.currentDirection);return}this.updateAxis(`x`,t.point,o),this.updateAxis(`y`,t.point,o),this.visualElement.render(),a&&$m.update(()=>a(e,t),!1,!0)},s=(e,t)=>{this.latestPointerEvent=e,this.latestPanInfo=t,this.stop(e,t),this.latestPointerEvent=null,this.latestPanInfo=null},c=()=>{let{dragSnapToOrigin:e}=this.getProps();(e||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:l}=this.getProps();this.panSession=new nw(e,{onSessionStart:i,onStart:a,onMove:o,onSessionEnd:s,resumeAnimation:c},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,distanceThreshold:n,contextWindow:QC(this.visualElement),element:this.visualElement.current})}stop(e,t){let n=e||this.latestPointerEvent,r=t||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!r||!n)return;let{velocity:a}=r;this.startAnimation(a);let{onDragEnd:o}=this.getProps();o&&$m.postRender(()=>o(n,r))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive(`whileDrag`,!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!ww(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),a=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(a=lw(a,this.constraints[e],this.elastic[e])),i.set(a)}resolveConstraints(){let{dragConstraints:e,dragElastic:t}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,r=this.constraints;e&&IC(e)?this.constraints||=this.resolveRefConstraints():e&&n?this.constraints=dw(n.layoutBox,e):this.constraints=!1,this.elastic=_w(t),r!==this.constraints&&!IC(e)&&n&&this.constraints&&!this.hasMutatedConstraints&&Hx(e=>{this.constraints!==!1&&this.getAxisMotionValue(e)&&(this.constraints[e]=hw(n.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){let{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!IC(e))return!1;let n=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;r.root&&(r.root.scroll=void 0,r.root.updateScroll());let i=Nb(n,r.root,this.visualElement.getTransformPagePoint()),a=pw(r.layout.layoutBox,i);if(t){let e=t(mb(a));this.hasMutatedConstraints=!!e,e&&(a=pb(e))}return a}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:a,onDragTransitionEnd:o}=this.getProps(),s=this.constraints||{},c=Hx(o=>{if(!ww(o,t,this.currentDirection))return;let c=s&&s[o]||{};(a===!0||a===o)&&(c={min:0,max:0});let l=r?200:1e6,u=r?40:1e7,d={type:`inertia`,velocity:n?e[o]:0,bounceStiffness:l,bounceDamping:u,timeConstant:750,restDelta:1,restSpeed:10,...i,...c};return this.startAxisValueAnimation(o,d)});return Promise.all(c).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return Ev(this.visualElement,e),n.start(fv(e,n,0,t,this.visualElement,!1))}stopAnimation(){Hx(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`;return this.visualElement.getProps()[t]||this.visualElement.getValue(e,this.visualElement.latestValues[e]??0)}snapToCursor(e){Hx(t=>{let{drag:n}=this.getProps();if(!ww(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:a}=r.layout.layoutBox[t],o=i.get()||0;i.set(e[t]-$h(n,a,.5)+o)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!IC(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};Hx(e=>{let t=this.getAxisMotionValue(e);if(t&&this.constraints!==!1){let n=t.get();r[e]=mw({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},``):`none`,n.root&&n.root.updateScroll(),n.updateLayout(),this.constraints=!1,this.resolveConstraints(),Hx(t=>{if(!ww(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:a}=this.constraints[t];n.set($h(i,a,r[t]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;bw.set(this.visualElement,this);let e=this.visualElement.current,t=ZC(e,`pointerdown`,t=>{let{drag:n,dragListener:r=!0}=this.getProps(),i=t.target,a=i!==e&&_y(i);n&&r&&!a&&this.start(t)}),n,r=()=>{let{dragConstraints:t}=this.getProps();IC(t)&&t.current&&(this.constraints=this.resolveRefConstraints(),n||=Cw(e,t.current,()=>this.scalePositionWithinConstraints()))},{projection:i}=this.visualElement,a=i.addEventListener(`measure`,r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),$m.read(r);let o=$x(window,`resize`,()=>this.scalePositionWithinConstraints()),s=i.addEventListener(`didUpdate`,(({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(Hx(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())}));return()=>{o(),t(),a(),s&&s(),n&&n()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:a=gw,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:a,dragMomentum:o}}};function Sw(e){let t=!0;return()=>{if(t){t=!1;return}e()}}function Cw(e,t,n){let r=zy(e,Sw(n)),i=zy(t,Sw(n));return()=>{r(),i()}}function ww(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function Tw(e,t=10){let n=null;return Math.abs(e.y)>t?n=`y`:Math.abs(e.x)>t&&(n=`x`),n}var Ew=class extends fb{constructor(e){super(e),this.removeGroupControls=bm,this.removeListeners=bm,this.controls=new xw(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||bm}update(){let{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}},Dw=e=>(t,n)=>{e&&$m.update(()=>e(t,n),!1,!0)},Ow=class extends fb{constructor(){super(...arguments),this.removePointerDownListener=bm}onPointerDown(e){this.session=new nw(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:QC(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:Dw(e),onStart:Dw(t),onMove:Dw(n),onEnd:(e,t)=>{delete this.session,r&&$m.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=ZC(this.node.current,`pointerdown`,e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}},kw=!1,Aw=class extends L.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),kw&&i.root.didUpdate(),i.addEventListener(`animationComplete`,()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),aS.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,{projection:a}=n;return a?(a.isPresent=i,e.layoutDependency!==t&&a.setOptions({...a.options,layoutDependency:t}),kw=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==i?a.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?a.promote():a.relegate()||$m.postRender(()=>{let e=a.getStack();(!e||!e.members.length)&&this.safeToRemove()})),null):null}componentDidUpdate(){let{visualElement:e,layoutAnchor:t}=this.props,{projection:n}=e;n&&(n.options.layoutAnchor=t,n.root.didUpdate(),iy.postRender(()=>{!n.currentAnimation&&n.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;kw=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}};function jw(e){let[t,n]=XS(),r=(0,L.useContext)(cm);return(0,R.jsx)(Aw,{...e,layoutGroup:r,switchLayoutGroup:(0,L.useContext)(FC),isPresent:t,safeToRemove:n})}var Mw={pan:{Feature:Ow},drag:{Feature:Ew,ProjectionNode:VS,MeasureLayout:jw}};function Nw(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive(`whileHover`,n===`Start`);let i=r[`onHover`+n];i&&$m.postRender(()=>i(t,YC(t)))}var Pw=class extends fb{mount(){let{current:e}=this.node;e&&(this.unmount=dy(e,(e,t)=>(Nw(this.node,t,`Start`),e=>Nw(this.node,e,`End`))))}unmount(){}},Fw=class extends fb{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=xm($x(this.node.current,`focus`,()=>this.onFocus()),$x(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}};function Iw(e,t,n){let{props:r}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&r.whileTap&&e.animationState.setActive(`whileTap`,n===`Start`);let i=r[`onTap`+(n===`End`?``:n)];i&&$m.postRender(()=>i(t,YC(t)))}var Lw=class extends fb{mount(){let{current:e}=this.node;if(!e)return;let{globalTapTarget:t,propagate:n}=this.node.props;this.unmount=wy(e,(e,t)=>(Iw(this.node,t,`Start`),(e,{success:t})=>Iw(this.node,e,t?`End`:`Cancel`)),{useGlobalTarget:t,stopPropagation:n?.tap===!1})}unmount(){}},Rw=new WeakMap,zw=new WeakMap,Bw=e=>{let t=Rw.get(e.target);t&&t(e)},Vw=e=>{e.forEach(Bw)};function Hw({root:e,...t}){let n=e||document;zw.has(n)||zw.set(n,{});let r=zw.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(Vw,{root:e,...t})),r[i]}function Uw(e,t,n){let r=Hw(t);return Rw.set(e,n),r.observe(e),()=>{Rw.delete(e),r.unobserve(e)}}var Ww={some:0,all:1},Gw=class extends fb{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.stopObserver?.();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Ww[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)};this.stopObserver=Uw(this.node.current,a,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Kw(e,t))&&this.startObserver()}unmount(){this.stopObserver?.(),this.hasEnteredView=!1,this.isInView=!1}};function Kw({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var qw={inView:{Feature:Gw},tap:{Feature:Lw},focus:{Feature:Fw},hover:{Feature:Pw}},Jw={layout:{ProjectionNode:VS,MeasureLayout:jw}},Yw=WC({...JC,...qw,...Mw,...Jw},GC);function Xw(){!rb.current&&ab();let[e]=(0,L.useState)(nb.current);return e}function Zw(e){e.values.forEach(e=>e.stop())}function Qw(e,t){[...t].reverse().forEach(n=>{let r=e.getVariant(n);r&&Cv(e,r),e.variantChildren&&e.variantChildren.forEach(e=>{Qw(e,t)})})}function $w(e,t){if(Array.isArray(t))return Qw(e,t);if(typeof t==`string`)return Qw(e,[t]);Cv(e,t)}function eT(){let e=new Set,t={subscribe(t){return e.add(t),()=>void e.delete(t)},start(t,n){let r=[];return e.forEach(e=>{r.push(Pv(e,t,{transitionOverride:n}))}),Promise.all(r)},set(t){return e.forEach(e=>{$w(e,t)})},stop(){e.forEach(e=>{Zw(e)})},mount(){return()=>{t.stop()}}};return t}function tT(){let e=lm(eT);return um(e.mount,[]),e}var nT=tT,U=ze(),rT=Yw,iT={damping:.7,stiffness:.05,mass:1.25},aT=70,oT=1e3/60,sT=350,cT=!1;globalThis.document?.addEventListener(`mousedown`,()=>{cT=!0}),globalThis.document?.addEventListener(`mouseup`,()=>{cT=!1}),globalThis.document?.addEventListener(`click`,()=>{cT=!1});var lT=(e={})=>{let[t,n]=(0,L.useState)(!1),[r,i]=(0,L.useState)(e.initial!==!1),[a,o]=(0,L.useState)(!1),s=(0,L.useRef)(null);s.current=e;let c=(0,L.useCallback)(()=>{if(!cT)return!1;let e=window.getSelection();if(!e||!e.rangeCount)return!1;let t=e.getRangeAt(0);return t.commonAncestorContainer.contains(g.current)||g.current?.contains(t.commonAncestorContainer)},[]),l=(0,L.useCallback)(e=>{d.isAtBottom=e,i(e)},[]),u=(0,L.useCallback)(e=>{d.escapedFromLock=e,n(e)},[]),d=(0,L.useMemo)(()=>{let n;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return g.current?.scrollTop??0},set scrollTop(e){if(g.current){let{scrollBehavior:t}=getComputedStyle(g.current);t!==`auto`&&(g.current.style.scrollBehavior=`auto`),g.current.scrollTop=e,d.ignoreScrollToTop=g.current.scrollTop,t!==`auto`&&(g.current.style.scrollBehavior=t)}},get targetScrollTop(){return!g.current||!_.current?0:g.current.scrollHeight-1-g.current.clientHeight},get calculatedTargetScrollTop(){if(!g.current||!_.current)return 0;let{targetScrollTop:t}=this;if(!e.targetScrollTop)return t;if(n?.targetScrollTop===t)return n.calculatedScrollTop;let r=Math.max(Math.min(e.targetScrollTop(t,{scrollElement:g.current,contentElement:_.current}),t),0);return n={targetScrollTop:t,calculatedScrollTop:r},requestAnimationFrame(()=>{n=void 0}),r},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=aT}}},[]),f=(0,L.useCallback)((e={})=>{typeof e==`string`&&(e={animation:e}),e.preserveScrollPosition||l(!0);let t=Date.now()+(Number(e.wait)||0),n=fT(s.current,e.animation),{ignoreEscapes:r=!1}=e,i,a=d.calculatedTargetScrollTop;e.duration instanceof Promise?e.duration.finally(()=>{i=Date.now()}):i=t+(e.duration??0);let o=async()=>{let e=new Promise(requestAnimationFrame).then(()=>{if(!d.isAtBottom)return d.animation=void 0,!1;let{scrollTop:l}=d,u=performance.now(),p=(u-(d.lastTick??u))/oT;if(d.animation||={behavior:n,promise:e,ignoreEscapes:r},d.animation.behavior===n&&(d.lastTick=u),c()||t>Date.now())return o();if(l<Math.min(a,d.calculatedTargetScrollTop)){if(d.animation?.behavior===n){if(n===`instant`)return d.scrollTop=d.calculatedTargetScrollTop,o();d.velocity=(n.damping*d.velocity+n.stiffness*d.scrollDifference)/n.mass,d.accumulated+=d.velocity*p,d.scrollTop+=d.accumulated,d.scrollTop!==l&&(d.accumulated=0)}return o()}return i>Date.now()?(a=d.calculatedTargetScrollTop,o()):(d.animation=void 0,d.scrollTop<d.calculatedTargetScrollTop?f({animation:fT(s.current,s.current.resize),ignoreEscapes:r,duration:Math.max(0,i-Date.now())||void 0}):d.isAtBottom)});return e.then(e=>(requestAnimationFrame(()=>{d.animation||(d.lastTick=void 0,d.velocity=0)}),e))};return e.wait!==!0&&(d.animation=void 0),d.animation?.behavior===n?d.animation.promise:o()},[l,c,d]),p=(0,L.useCallback)(()=>{u(!0),l(!1)},[u,l]),m=(0,L.useCallback)(({target:e})=>{if(e!==g.current)return;let{scrollTop:t,ignoreScrollToTop:n}=d,{lastScrollTop:r=t}=d;d.lastScrollTop=t,d.ignoreScrollToTop=void 0,n&&n>t&&(r=n),o(d.isNearBottom),setTimeout(()=>{if(d.resizeDifference||t===n)return;if(c()){u(!0),l(!1);return}let e=t>r,i=t<r;if(d.animation?.ignoreEscapes){d.scrollTop=r;return}i&&(u(!0),l(!1)),e&&u(!1),!d.escapedFromLock&&d.isNearBottom&&l(!0)},1)},[u,l,c,d]),h=(0,L.useCallback)(({target:e,deltaY:t})=>{let n=e;for(;![`scroll`,`auto`].includes(getComputedStyle(n).overflow);){if(!n.parentElement)return;n=n.parentElement}n===g.current&&t<0&&g.current.scrollHeight>g.current.clientHeight&&!d.animation?.ignoreEscapes&&(u(!0),l(!1))},[u,l,d]),g=uT(e=>{g.current?.removeEventListener(`scroll`,m),g.current?.removeEventListener(`wheel`,h),e?.addEventListener(`scroll`,m,{passive:!0}),e?.addEventListener(`wheel`,h,{passive:!0})},[]),_=uT(e=>{if(d.resizeObserver?.disconnect(),d.resizeObserver=void 0,!e)return;let t;d.resizeObserver=new ResizeObserver(([e])=>{let{height:n}=e.contentRect,r=n-(t??n);if(d.resizeDifference=r,d.scrollTop>d.targetScrollTop&&(d.scrollTop=d.targetScrollTop),o(d.isNearBottom),r>=0){let e=fT(s.current,t?s.current.resize:s.current.initial);f({animation:e,wait:!0,preserveScrollPosition:!0,duration:e===`instant`?void 0:sT})}else d.isNearBottom&&(u(!1),l(!0));t=n,requestAnimationFrame(()=>{setTimeout(()=>{d.resizeDifference===r&&(d.resizeDifference=0)},1)})}),d.resizeObserver?.observe(e)},[]);return{contentRef:_,scrollRef:g,scrollToBottom:f,stopScroll:p,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:d}};function uT(e,t){let n=(0,L.useCallback)(t=>(n.current=t,e(t)),t);return n}var dT=new Map;function fT(...e){let t={...iT},n=!1;for(let r of e){if(r===`instant`){n=!0;continue}typeof r==`object`&&(n=!1,t.damping=r.damping??t.damping,t.stiffness=r.stiffness??t.stiffness,t.mass=r.mass??t.mass)}let r=JSON.stringify(t);return dT.has(r)||dT.set(r,Object.freeze(t)),n?`instant`:dT.get(r)}var pT=new Set([`name`,`id`,`aria-describedby`,`aria-labelledby`]);function mT(e){let t=new Set;for(let{name:n}of e){if(t.has(n))return n;t.add(n)}}function hT(e){let t=e.allowedAttributes.filter(e=>pT.has(e));if(t.length>0)throw Error(`Interactive element <${e.name}> declares reserved attribute(s) ${t.join(`, `)}. The markdown sanitizer rewrites these to "user-content-<value>" (DOM-clobbering protection), so the component would receive a mangled value. Use a domain attribute instead (e.g. "param").`)}var gT=/^[a-z][a-z0-9]*(-[a-z0-9]+)*$/,_T=I().min(1).max(64).regex(gT).refine(e=>!pT.has(e),{message:`Attribute is reserved: the markdown sanitizer rewrites it to "user-content-<value>". Use a domain attribute instead (e.g. "param").`}),vT=he({name:I().min(1).max(64).regex(gT),description:I().max(512).optional(),allowedAttributes:et(_T).max(20)});et(vT).max(100).superRefine((e,t)=>{let n=mT(e);n!==void 0&&t.addIssue({code:`custom`,message:`Duplicate element name "${n}": a catalog must map each tag to exactly one element.`})}).optional();function yT(e){let{name:t,allowedAttributes:n,description:r}=e;return{name:t,allowedAttributes:n,description:r}}function bT(e){for(let t of e){let e=vT.safeParse(yT(t));if(!e.success)throw Error(`Interactive element <${t.name}> is invalid:
|
|
24
|
+
${E(e.error)}`)}let t=mT(e);if(t!==void 0)throw Error(`Duplicate element name <${t}>: a catalog must map each tag to exactly one element.`);return[...e]}var xT=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ST=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),CT=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),wT=e=>{let t=CT(e);return t.charAt(0).toUpperCase()+t.slice(1)},TT={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ET=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},DT=(0,L.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,L.createElement)(`svg`,{ref:c,...TT,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:xT(`lucide`,i),...!a&&!ET(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,L.createElement)(e,t)),...Array.isArray(a)?a:[a]])),OT=(e,t)=>{let n=(0,L.forwardRef)(({className:n,...r},i)=>(0,L.createElement)(DT,{ref:i,iconNode:t,className:xT(`lucide-${ST(wT(e))}`,`lucide-${e}`,n),...r}));return n.displayName=wT(e),n},kT=OT(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),AT=OT(`braces`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),jT=OT(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),MT=OT(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),NT=OT(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),PT=OT(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),FT=OT(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),IT=OT(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),LT=OT(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),RT=OT(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),zT=OT(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),BT=OT(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),VT=OT(`list-plus`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M16 19H3`,key:`zzsher`}],[`path`,{d:`M18 9v6`,key:`1twb98`}],[`path`,{d:`M21 12h-6`,key:`bt1uis`}]]),HT=OT(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),UT=OT(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),WT=OT(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),GT=OT(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),KT=OT(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),qT=OT(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),JT=OT(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),YT=OT(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),XT=OT(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),ZT=OT(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),QT={}.hasOwnProperty,$T={},eE=/^[^\t\n\r "#'.<=>`}]+$/,tE=/^[^\t\n\r "'<=>`}]+$/;function nE(){return{canContainEols:[`textDirective`],enter:{directiveContainer:iE,directiveContainerAttributes:dE,directiveContainerLabel:lE,directiveLeaf:aE,directiveLeafAttributes:dE,directiveText:oE,directiveTextAttributes:dE},exit:{directiveContainer:_E,directiveContainerAttributeClassValue:pE,directiveContainerAttributeIdValue:fE,directiveContainerAttributeName:hE,directiveContainerAttributeValue:mE,directiveContainerAttributes:gE,directiveContainerLabel:uE,directiveContainerName:cE,directiveLeaf:_E,directiveLeafAttributeClassValue:pE,directiveLeafAttributeIdValue:fE,directiveLeafAttributeName:hE,directiveLeafAttributeValue:mE,directiveLeafAttributes:gE,directiveLeafName:cE,directiveText:_E,directiveTextAttributeClassValue:pE,directiveTextAttributeIdValue:fE,directiveTextAttributeName:hE,directiveTextAttributeValue:mE,directiveTextAttributes:gE,directiveTextName:cE}}}function rE(e){let t=e||$T;if(t.quote!==`"`&&t.quote!==`'`&&t.quote!==null&&t.quote!==void 0)throw Error("Invalid quote `"+t.quote+"`, expected `'` or `\"`");return n.peek=vE,{handlers:{containerDirective:n,leafDirective:n,textDirective:n},unsafe:[{character:`\r`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{character:`
|
|
25
|
+
`,inConstruct:[`leafDirectiveLabel`,`containerDirectiveLabel`]},{before:`[^:]`,character:`:`,after:`[A-Za-z]`,inConstruct:[`phrasing`]},{atBreak:!0,character:`:`,after:`:`}]};function n(e,t,n,i){let a=n.createTracker(i),o=bE(e),s=n.enter(e.type),c=a.move(o+(e.name||``)),l;if(e.type===`containerDirective`){let t=(e.children||[])[0];l=yE(t)?t:void 0}else l=e;if(l&&l.children&&l.children.length>0){let t=n.enter(`label`),r=`${e.type}Label`,i=n.enter(r);c+=a.move(`[`),c+=a.move(n.containerPhrasing(l,{...a.current(),before:c,after:`]`})),c+=a.move(`]`),i(),t()}if(c+=a.move(r(e,n)),e.type===`containerDirective`){let t=(e.children||[])[0],r=e;yE(t)&&(r=Object.assign({},e,{children:e.children.slice(1)})),r&&r.children&&r.children.length>0&&(c+=a.move(`
|
|
26
26
|
`),c+=a.move(n.containerFlow(r,a.current()))),c+=a.move(`
|
|
27
|
-
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(
|
|
28
|
-
`,`\r`];return e+`=`+s+$r(n,{subset:c})+s}}function rE(e){oE.call(this,`containerDirective`,e)}function iE(e){oE.call(this,`leafDirective`,e)}function aE(e){oE.call(this,`textDirective`,e)}function oE(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function sE(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function cE(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function lE(e){this.exit(e)}function uE(){this.data.directiveAttributes=[],this.buffer()}function dE(e){this.data.directiveAttributes.push([`id`,Fl(this.sliceSerialize(e),{attribute:!0})])}function fE(e){this.data.directiveAttributes.push([`class`,Fl(this.sliceSerialize(e),{attribute:!0})])}function pE(e){let t=this.data.directiveAttributes;t[t.length-1][1]=Fl(this.sliceSerialize(e),{attribute:!0})}function mE(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function hE(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function gE(e){this.exit(e)}function _E(){return`:`}function vE(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function yE(e){let t=0;return e.type===`containerDirective`?(Mt(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function bE(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Rt(t)?Vt(e,v,`whitespace`)(t):!m&&en(t)?Ht(e,v)(t):t===null||Zt(t)||Pt(t)||$t(t)&&t!==45&&t!==95?re(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||en(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||en(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Zt(t)||Pt(t)||$t(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Rt(t)?Vt(e,C,`whitespace`)(t):!m&&en(t)?Ht(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Zt(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,ee):m&&Rt(t)?Vt(e,w,`whitespace`)(t):!m&&en(t)?Ht(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||en(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function ee(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),ne):(e.enter(d),E(t))}function E(t){return t===g?(e.exit(d),ee(t)):t===null?n(t):Zt(t)?m?n(t):Ht(e,E)(t):(e.enter(p),e.consume(t),te)}function te(t){return t===g||t===null||Zt(t)?(e.exit(p),E(t)):(e.consume(t),te)}function ne(e){return e===125||en(e)?v(e):re(e)}function re(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function xE(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Zt(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function SE(e,t,n,r){let i=this;return a;function a(t){return t===null||Zt(t)||$t(t)||Pt(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Zt(a)||Pt(a)||$t(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var CE={tokenize:DE,concrete:!0},wE={tokenize:OE,partial:!0},TE={tokenize:kE,partial:!0},EE={tokenize:AE,partial:!0};function DE(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),SE.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(wE,d,d)(t):d(t)}function d(t){return t===123?e.attempt(TE,f,f)(t):f(t)}function f(t){return Vt(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Zt(i)?r.interrupt?t(i):e.attempt(EE,m,C)(i):n(i)}function m(t){return t===null?C(t):Zt(t)?e.check(EE,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Vt(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Zt(t)?e.check(EE,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Zt(t)?e.check(EE,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Vt(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Vt(e,c,`whitespace`)(t))}function c(r){return r===null||Zt(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function OE(e,t,n){return xE(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function kE(e,t,n){return bE(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function AE(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var jE={tokenize:PE},ME={tokenize:FE,partial:!0},NE={tokenize:IE,partial:!0};function PE(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),SE.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(ME,s,s)(t):s(t)}function s(t){return t===123?e.attempt(NE,c,c)(t):c(t)}function c(t){return Vt(e,l,`whitespace`)(t)}function l(r){return r===null||Zt(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function FE(e,t,n){return xE(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function IE(e,t,n){return bE(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var LE={tokenize:VE,previous:BE},RE={tokenize:HE,partial:!0},zE={tokenize:UE,partial:!0};function BE(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function VE(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),SE.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(RE,o,o)(t):o(t)}function o(t){return t===123?e.attempt(zE,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function HE(e,t,n){return xE(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function UE(e,t,n){return bE(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function WE(){return{text:{58:LE},flow:{58:[CE,jE]}}}function GE(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(WE()),n.push(tE()),r.push(nE())}function KE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function qE(e,t){if(e==null)return{};var n,r,i=KE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function JE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function YE(e){if(Array.isArray(e))return JE(e)}function XE(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ZE(e,t){if(e){if(typeof e==`string`)return JE(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?JE(e,t):void 0}}function QE(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
29
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
30
|
-
`)})}function
|
|
31
|
-
`),style:o,startingLineNumber:s}))}function
|
|
27
|
+
`+o)}return s(),c}function r(e,n){let r=e.attributes||{},a=[],o,s,c,l;for(l in r)if(QT.call(r,l)&&r[l]!==void 0&&r[l]!==null){let u=String(r[l]);if(l===`id`)c=t.preferShortcut!==!1&&eE.test(u)?`#`+u:i(`id`,u,e,n);else if(l===`class`){let r=u.split(/[\t\n\r ]+/g),a=[],c=[],l=-1;for(;++l<r.length;)(t.preferShortcut!==!1&&eE.test(r[l])?c:a).push(r[l]);o=a.length>0?i(`class`,a.join(` `),e,n):``,s=c.length>0?`.`+c.join(`.`):``}else a.push(i(l,u,e,n))}return o&&a.unshift(o),s&&a.unshift(s),c&&a.unshift(c),a.length>0?`{`+a.join(` `)+`}`:``}function i(e,n,r,i){if(t.collapseEmptyAttributes!==!1&&!n)return e;if(t.preferUnquoted&&tE.test(n))return e+`=`+n;let a=t.quote||i.options.quote||`"`,o=a===`"`?`'`:`"`,s=t.quoteSmart&&Wt(n,a)>Wt(n,o)?o:a,c=r.type===`textDirective`?[s]:[s,`
|
|
28
|
+
`,`\r`];return e+`=`+s+$r(n,{subset:c})+s}}function iE(e){sE.call(this,`containerDirective`,e)}function aE(e){sE.call(this,`leafDirective`,e)}function oE(e){sE.call(this,`textDirective`,e)}function sE(e,t){this.enter({type:e,name:``,attributes:{},children:[]},t)}function cE(e){let t=this.stack[this.stack.length-1];t.type===`containerDirective`||t.type===`leafDirective`||t.type,t.name=this.sliceSerialize(e)}function lE(e){this.enter({type:`paragraph`,data:{directiveLabel:!0},children:[]},e)}function uE(e){this.exit(e)}function dE(){this.data.directiveAttributes=[],this.buffer()}function fE(e){this.data.directiveAttributes.push([`id`,Fl(this.sliceSerialize(e),{attribute:!0})])}function pE(e){this.data.directiveAttributes.push([`class`,Fl(this.sliceSerialize(e),{attribute:!0})])}function mE(e){let t=this.data.directiveAttributes;t[t.length-1][1]=Fl(this.sliceSerialize(e),{attribute:!0})}function hE(e){this.data.directiveAttributes.push([this.sliceSerialize(e),``])}function gE(){let e=this.data.directiveAttributes,t={},n=-1;for(;++n<e.length;){let r=e[n];r[0]===`class`&&t.class?t.class+=` `+r[1]:t[r[0]]=r[1]}this.data.directiveAttributes=void 0,this.resume();let r=this.stack[this.stack.length-1];r.type===`containerDirective`||r.type===`leafDirective`||r.type,r.attributes=t}function _E(e){this.exit(e)}function vE(){return`:`}function yE(e){return!!(e&&e.type===`paragraph`&&e.data&&e.data.directiveLabel)}function bE(e){let t=0;return e.type===`containerDirective`?(Mt(e,function(e,n){if(e.type===`containerDirective`){let e=n.length,r=0;for(;e--;)n[e].type===`containerDirective`&&r++;r>t&&(t=r)}}),t+=3):t=e.type===`leafDirective`?2:1,`:`.repeat(t)}function xE(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){let h,g;return _;function _(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),v}function v(t){return t===35?(h=o,y(t)):t===46?(h=s,y(t)):m&&Rt(t)?Vt(e,v,`whitespace`)(t):!m&&en(t)?Ht(e,v)(t):t===null||Zt(t)||Pt(t)||$t(t)&&t!==45&&t!==95?re(t):(e.enter(a),e.enter(c),e.consume(t),S)}function y(t){let n=h+`Marker`;return e.enter(a),e.enter(h),e.enter(n),e.consume(t),e.exit(n),b}function b(t){if(t===null||t===34||t===35||t===39||t===46||t===60||t===61||t===62||t===96||t===125||en(t))return n(t);let r=h+`Value`;return e.enter(r),e.consume(t),x}function x(t){if(t===null||t===34||t===39||t===60||t===61||t===62||t===96)return n(t);if(t===35||t===46||t===125||en(t)){let n=h+`Value`;return e.exit(n),e.exit(h),e.exit(a),v(t)}return e.consume(t),x}function S(t){return t===null||Zt(t)||Pt(t)||$t(t)&&t!==45&&t!==46&&t!==58&&t!==95?(e.exit(c),m&&Rt(t)?Vt(e,C,`whitespace`)(t):!m&&en(t)?Ht(e,C)(t):C(t)):(e.consume(t),S)}function C(t){return t===61?(e.enter(l),e.consume(t),e.exit(l),w):(e.exit(a),v(t))}function w(t){return t===null||t===60||t===61||t===62||t===96||t===125||m&&Zt(t)?n(t):t===34||t===39?(e.enter(u),e.enter(f),e.consume(t),e.exit(f),g=t,ee):m&&Rt(t)?Vt(e,w,`whitespace`)(t):!m&&en(t)?Ht(e,w)(t):(e.enter(d),e.enter(p),e.consume(t),g=void 0,T)}function T(t){return t===null||t===34||t===39||t===60||t===61||t===62||t===96?n(t):t===125||en(t)?(e.exit(p),e.exit(d),e.exit(a),v(t)):(e.consume(t),T)}function ee(t){return t===g?(e.enter(f),e.consume(t),e.exit(f),e.exit(u),e.exit(a),ne):(e.enter(d),E(t))}function E(t){return t===g?(e.exit(d),ee(t)):t===null?n(t):Zt(t)?m?n(t):Ht(e,E)(t):(e.enter(p),e.consume(t),te)}function te(t){return t===g||t===null||Zt(t)?(e.exit(p),E(t)):(e.consume(t),te)}function ne(e){return e===125||en(e)?v(e):re(e)}function re(a){return a===125?(e.enter(i),e.consume(a),e.exit(i),e.exit(r),t):n(a)}}function SE(e,t,n,r,i,a,o){let s=0,c=0,l;return u;function u(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),d}function d(n){return n===93?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),f(n))}function f(t){if(t===93&&!c)return h(t);let n=e.enter(`chunkText`,{_contentTypeTextTrailing:!0,contentType:`text`,previous:l});return l&&(l.next=n),l=n,p(t)}function p(t){return t===null||s>999||t===91&&++c>32?n(t):t===93&&!c--?(e.exit(`chunkText`),h(t)):Zt(t)?o?n(t):(e.consume(t),e.exit(`chunkText`),f):(e.consume(t),t===92?m:p)}function m(t){return t===91||t===92||t===93?(e.consume(t),s++,p):p(t)}function h(n){return e.exit(a),e.enter(i),e.consume(n),e.exit(i),e.exit(r),t}}function CE(e,t,n,r){let i=this;return a;function a(t){return t===null||Zt(t)||$t(t)||Pt(t)?n(t):(e.enter(r),e.consume(t),o)}function o(a){return a===null||Zt(a)||Pt(a)||$t(a)&&a!==45&&a!==95?(e.exit(r),i.previous===45||i.previous===95?n(a):t(a)):(e.consume(a),o)}}var wE={tokenize:OE,concrete:!0},TE={tokenize:kE,partial:!0},EE={tokenize:AE,partial:!0},DE={tokenize:jE,partial:!0};function OE(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0,s;return c;function c(t){return e.enter(`directiveContainer`),e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),l(t)}function l(t){return t===58?(e.consume(t),o++,l):o<3?n(t):(e.exit(`directiveContainerSequence`),CE.call(r,e,u,n,`directiveContainerName`)(t))}function u(t){return t===91?e.attempt(TE,d,d)(t):d(t)}function d(t){return t===123?e.attempt(EE,f,f)(t):f(t)}function f(t){return Vt(e,p,`whitespace`)(t)}function p(i){return e.exit(`directiveContainerFence`),i===null?C(i):Zt(i)?r.interrupt?t(i):e.attempt(DE,m,C)(i):n(i)}function m(t){return t===null?C(t):Zt(t)?e.check(DE,y,C)(t):(e.enter(`directiveContainerContent`),h(t))}function h(t){return e.attempt({tokenize:w,partial:!0},S,a?Vt(e,g,`linePrefix`,a+1):g)(t)}function g(t){return t===null?S(t):Zt(t)?e.check(DE,v,S)(t):v(t)}function _(t){if(t===null){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}return Zt(t)?e.check(DE,b,x)(t):(e.consume(t),_)}function v(t){let n=e.enter(`chunkDocument`,{contentType:`document`,previous:s});return s&&(s.next=n),s=n,_(t)}function y(t){return e.enter(`directiveContainerContent`),h(t)}function b(t){e.consume(t);let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,h}function x(t){let n=e.exit(`chunkDocument`);return r.parser.lazy[n.start.line]=!1,S(t)}function S(t){return e.exit(`directiveContainerContent`),C(t)}function C(n){return e.exit(`directiveContainer`),t(n)}function w(e,t,n){let i=0;return Vt(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4);function a(t){return e.enter(`directiveContainerFence`),e.enter(`directiveContainerSequence`),s(t)}function s(t){return t===58?(e.consume(t),i++,s):i<o?n(t):(e.exit(`directiveContainerSequence`),Vt(e,c,`whitespace`)(t))}function c(r){return r===null||Zt(r)?(e.exit(`directiveContainerFence`),t(r)):n(r)}}}function kE(e,t,n){return SE(e,t,n,`directiveContainerLabel`,`directiveContainerLabelMarker`,`directiveContainerLabelString`,!0)}function AE(e,t,n){return xE(e,t,n,`directiveContainerAttributes`,`directiveContainerAttributesMarker`,`directiveContainerAttribute`,`directiveContainerAttributeId`,`directiveContainerAttributeClass`,`directiveContainerAttributeName`,`directiveContainerAttributeInitializerMarker`,`directiveContainerAttributeValueLiteral`,`directiveContainerAttributeValue`,`directiveContainerAttributeValueMarker`,`directiveContainerAttributeValueData`,!0)}function jE(e,t,n){let r=this;return i;function i(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var ME={tokenize:FE},NE={tokenize:IE,partial:!0},PE={tokenize:LE,partial:!0};function FE(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveLeaf`),e.enter(`directiveLeafSequence`),e.consume(t),a}function a(t){return t===58?(e.consume(t),e.exit(`directiveLeafSequence`),CE.call(r,e,o,n,`directiveLeafName`)):n(t)}function o(t){return t===91?e.attempt(NE,s,s)(t):s(t)}function s(t){return t===123?e.attempt(PE,c,c)(t):c(t)}function c(t){return Vt(e,l,`whitespace`)(t)}function l(r){return r===null||Zt(r)?(e.exit(`directiveLeaf`),t(r)):n(r)}}function IE(e,t,n){return SE(e,t,n,`directiveLeafLabel`,`directiveLeafLabelMarker`,`directiveLeafLabelString`,!0)}function LE(e,t,n){return xE(e,t,n,`directiveLeafAttributes`,`directiveLeafAttributesMarker`,`directiveLeafAttribute`,`directiveLeafAttributeId`,`directiveLeafAttributeClass`,`directiveLeafAttributeName`,`directiveLeafAttributeInitializerMarker`,`directiveLeafAttributeValueLiteral`,`directiveLeafAttributeValue`,`directiveLeafAttributeValueMarker`,`directiveLeafAttributeValueData`,!0)}var RE={tokenize:HE,previous:VE},zE={tokenize:UE,partial:!0},BE={tokenize:WE,partial:!0};function VE(e){return e!==58||this.events[this.events.length-1][1].type===`characterEscape`}function HE(e,t,n){let r=this;return i;function i(t){return e.enter(`directiveText`),e.enter(`directiveTextMarker`),e.consume(t),e.exit(`directiveTextMarker`),CE.call(r,e,a,n,`directiveTextName`)}function a(t){return t===58?n(t):t===91?e.attempt(zE,o,o)(t):o(t)}function o(t){return t===123?e.attempt(BE,s,s)(t):s(t)}function s(n){return e.exit(`directiveText`),t(n)}}function UE(e,t,n){return SE(e,t,n,`directiveTextLabel`,`directiveTextLabelMarker`,`directiveTextLabelString`)}function WE(e,t,n){return xE(e,t,n,`directiveTextAttributes`,`directiveTextAttributesMarker`,`directiveTextAttribute`,`directiveTextAttributeId`,`directiveTextAttributeClass`,`directiveTextAttributeName`,`directiveTextAttributeInitializerMarker`,`directiveTextAttributeValueLiteral`,`directiveTextAttributeValue`,`directiveTextAttributeValueMarker`,`directiveTextAttributeValueData`)}function GE(){return{text:{58:RE},flow:{58:[wE,ME]}}}function KE(){let e=this.data(),t=e.micromarkExtensions||=[],n=e.fromMarkdownExtensions||=[],r=e.toMarkdownExtensions||=[];t.push(GE()),n.push(nE()),r.push(rE())}function qE(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function JE(e,t){if(e==null)return{};var n,r,i=qE(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function YE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function XE(e){if(Array.isArray(e))return YE(e)}function ZE(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function QE(e,t){if(e){if(typeof e==`string`)return YE(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?YE(e,t):void 0}}function $E(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
29
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eD(e){return XE(e)||ZE(e)||QE(e)||$E()}function tD(e){"@babel/helpers - typeof";return tD=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},tD(e)}function nD(e,t){if(tD(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(tD(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function rD(e){var t=nD(e,`string`);return tD(t)==`symbol`?t:t+``}function iD(e,t,n){return(t=rD(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function aD(){return aD=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},aD.apply(null,arguments)}function oD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?oD(Object(n),!0).forEach(function(t){iD(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cD(e){var t=e.length;if(t===0||t===1)return e;if(t===2)return[e[0],e[1],`${e[0]}.${e[1]}`,`${e[1]}.${e[0]}`];if(t===3)return[e[0],e[1],e[2],`${e[0]}.${e[1]}`,`${e[0]}.${e[2]}`,`${e[1]}.${e[0]}`,`${e[1]}.${e[2]}`,`${e[2]}.${e[0]}`,`${e[2]}.${e[1]}`,`${e[0]}.${e[1]}.${e[2]}`,`${e[0]}.${e[2]}.${e[1]}`,`${e[1]}.${e[0]}.${e[2]}`,`${e[1]}.${e[2]}.${e[0]}`,`${e[2]}.${e[0]}.${e[1]}`,`${e[2]}.${e[1]}.${e[0]}`];if(t>=4)return[e[0],e[1],e[2],e[3],`${e[0]}.${e[1]}`,`${e[0]}.${e[2]}`,`${e[0]}.${e[3]}`,`${e[1]}.${e[0]}`,`${e[1]}.${e[2]}`,`${e[1]}.${e[3]}`,`${e[2]}.${e[0]}`,`${e[2]}.${e[1]}`,`${e[2]}.${e[3]}`,`${e[3]}.${e[0]}`,`${e[3]}.${e[1]}`,`${e[3]}.${e[2]}`,`${e[0]}.${e[1]}.${e[2]}`,`${e[0]}.${e[1]}.${e[3]}`,`${e[0]}.${e[2]}.${e[1]}`,`${e[0]}.${e[2]}.${e[3]}`,`${e[0]}.${e[3]}.${e[1]}`,`${e[0]}.${e[3]}.${e[2]}`,`${e[1]}.${e[0]}.${e[2]}`,`${e[1]}.${e[0]}.${e[3]}`,`${e[1]}.${e[2]}.${e[0]}`,`${e[1]}.${e[2]}.${e[3]}`,`${e[1]}.${e[3]}.${e[0]}`,`${e[1]}.${e[3]}.${e[2]}`,`${e[2]}.${e[0]}.${e[1]}`,`${e[2]}.${e[0]}.${e[3]}`,`${e[2]}.${e[1]}.${e[0]}`,`${e[2]}.${e[1]}.${e[3]}`,`${e[2]}.${e[3]}.${e[0]}`,`${e[2]}.${e[3]}.${e[1]}`,`${e[3]}.${e[0]}.${e[1]}`,`${e[3]}.${e[0]}.${e[2]}`,`${e[3]}.${e[1]}.${e[0]}`,`${e[3]}.${e[1]}.${e[2]}`,`${e[3]}.${e[2]}.${e[0]}`,`${e[3]}.${e[2]}.${e[1]}`,`${e[0]}.${e[1]}.${e[2]}.${e[3]}`,`${e[0]}.${e[1]}.${e[3]}.${e[2]}`,`${e[0]}.${e[2]}.${e[1]}.${e[3]}`,`${e[0]}.${e[2]}.${e[3]}.${e[1]}`,`${e[0]}.${e[3]}.${e[1]}.${e[2]}`,`${e[0]}.${e[3]}.${e[2]}.${e[1]}`,`${e[1]}.${e[0]}.${e[2]}.${e[3]}`,`${e[1]}.${e[0]}.${e[3]}.${e[2]}`,`${e[1]}.${e[2]}.${e[0]}.${e[3]}`,`${e[1]}.${e[2]}.${e[3]}.${e[0]}`,`${e[1]}.${e[3]}.${e[0]}.${e[2]}`,`${e[1]}.${e[3]}.${e[2]}.${e[0]}`,`${e[2]}.${e[0]}.${e[1]}.${e[3]}`,`${e[2]}.${e[0]}.${e[3]}.${e[1]}`,`${e[2]}.${e[1]}.${e[0]}.${e[3]}`,`${e[2]}.${e[1]}.${e[3]}.${e[0]}`,`${e[2]}.${e[3]}.${e[0]}.${e[1]}`,`${e[2]}.${e[3]}.${e[1]}.${e[0]}`,`${e[3]}.${e[0]}.${e[1]}.${e[2]}`,`${e[3]}.${e[0]}.${e[2]}.${e[1]}`,`${e[3]}.${e[1]}.${e[0]}.${e[2]}`,`${e[3]}.${e[1]}.${e[2]}.${e[0]}`,`${e[3]}.${e[2]}.${e[0]}.${e[1]}`,`${e[3]}.${e[2]}.${e[1]}.${e[0]}`]}var lD={};function uD(e){if(e.length===0||e.length===1)return e;var t=e.join(`.`);return lD[t]||(lD[t]=cD(e)),lD[t]}function dD(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return uD(e.filter(function(e){return e!==`token`})).reduce(function(e,t){return sD(sD({},e),n[t])},t)}function fD(e){return e.join(` `)}function pD(e,t){var n=0;return function(r){return n+=1,r.map(function(r,i){return mD({node:r,stylesheet:e,useInlineStyles:t,key:`code-segment-${n}-${i}`})})}}function mD(e){var t=e.node,n=e.stylesheet,r=e.style,i=r===void 0?{}:r,a=e.useInlineStyles,o=e.key,s=t.properties,c=t.type,l=t.tagName,u=t.value;if(c===`text`)return u;if(l){var d=pD(n,a),f;if(!a)f=sD(sD({},s),{},{className:fD(s.className)});else{var p=Object.keys(n).reduce(function(e,t){return t.split(`.`).forEach(function(t){e.includes(t)||e.push(t)}),e},[]),m=s.className&&s.className.includes(`token`)?[`token`]:[],h=s.className&&m.concat(s.className.filter(function(e){return!p.includes(e)}));f=sD(sD({},s),{},{className:fD(h)||void 0,style:dD(s.className,Object.assign({},s.style,i),n)})}var g=d(t.children);return L.createElement(l,aD({key:o},f),g)}}var hD=(function(e,t){return e.listLanguages().indexOf(t)!==-1}),gD=[`language`,`children`,`style`,`customStyle`,`codeTagProps`,`useInlineStyles`,`showLineNumbers`,`showInlineLineNumbers`,`startingLineNumber`,`lineNumberContainerStyle`,`lineNumberStyle`,`wrapLines`,`wrapLongLines`,`lineProps`,`renderer`,`PreTag`,`CodeTag`,`code`,`astGenerator`];function _D(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function vD(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?_D(Object(n),!0).forEach(function(t){iD(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_D(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var yD=/\n/g;function bD(e){return e.match(yD)}function xD(e){var t=e.lines,n=e.startingLineNumber,r=e.style;return t.map(function(e,t){var i=t+n;return L.createElement(`span`,{key:`line-${t}`,className:`react-syntax-highlighter-line-number`,style:typeof r==`function`?r(i):r},`${i}
|
|
30
|
+
`)})}function SD(e){var t=e.codeString,n=e.codeStyle,r=e.containerStyle,i=r===void 0?{float:`left`,paddingRight:`10px`}:r,a=e.numberStyle,o=a===void 0?{}:a,s=e.startingLineNumber;return L.createElement(`code`,{style:Object.assign({},n,i)},xD({lines:t.replace(/\n$/,``).split(`
|
|
31
|
+
`),style:o,startingLineNumber:s}))}function CD(e){return`${e.toString().length}.25em`}function wD(e,t){return{type:`element`,tagName:`span`,properties:{key:`line-number--${e}`,className:[`comment`,`linenumber`,`react-syntax-highlighter-line-number`],style:t},children:[{type:`text`,value:e}]}}function TD(e,t,n){var r={display:`inline-block`,minWidth:CD(n),paddingRight:`1em`,textAlign:`right`,userSelect:`none`},i=typeof e==`function`?e(t):e;return vD(vD({},r),i)}function ED(e){var t=e.children,n=e.lineNumber,r=e.lineNumberStyle,i=e.largestLineNumber,a=e.showInlineLineNumbers,o=e.lineProps,s=o===void 0?{}:o,c=e.className,l=c===void 0?[]:c,u=e.showLineNumbers,d=e.wrapLongLines,f=e.wrapLines,p=f!==void 0&&f?vD({},typeof s==`function`?s(n):s):{};if(p.className=p.className?[].concat(eD(p.className.trim().split(/\s+/)),eD(l)):l,n&&a){var m=TD(r,n,i);t.unshift(wD(n,m))}return d&u&&(p.style=vD({display:`flex`},p.style)),{type:`element`,tagName:`span`,properties:p,children:t}}function DD(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];e.length===void 0&&(e=[e]);for(var r=0;r<e.length;r++){var i=e[r];if(i.type===`text`)n.push(ED({children:[i],className:eD(new Set(t))}));else if(i.children){var a=t.concat(i.properties?.className||[]);DD(i.children,a).forEach(function(e){return n.push(e)})}}return n}function OD(e,t,n,r,i,a,o,s,c){var l,u=DD(e.value),d=[],f=-1,p=0;function m(e,a){return ED({children:e,lineNumber:a,lineNumberStyle:s,largestLineNumber:o,showInlineLineNumbers:i,lineProps:n,className:arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],showLineNumbers:r,wrapLongLines:c,wrapLines:t})}function h(e,t){if(r&&t&&i){var n=TD(s,t,o);e.unshift(wD(t,n))}return e}function g(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];return t||r.length>0?m(e,n,r):h(e,n)}for(var _=function(){var e=u[p],t=e.children[0].value;if(bD(t)){var n=t.split(`
|
|
32
32
|
`);n.forEach(function(t,i){var o=r&&d.length+a,s={type:`text`,value:`${t}
|
|
33
|
-
`};if(i===0){var c=g(u.slice(f+1,p).concat(TD({children:[s],className:e.properties.className})),o);d.push(c)}else if(i===n.length-1){var l=u[p+1]&&u[p+1].children&&u[p+1].children[0],m={type:`text`,value:`${t}`};if(l){var h=TD({children:[m],className:e.properties.className});u.splice(p+1,0,h)}else{var _=g([m],o,e.properties.className);d.push(_)}}else{var v=g([s],o,e.properties.className);d.push(v)}}),f=p}p++};p<u.length;)_();if(f!==u.length-1){var v=u.slice(f+1,u.length);if(v&&v.length){var y=g(v,r&&d.length+a);d.push(y)}}return t?d:(l=[]).concat.apply(l,d)}function OD(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map(function(e,t){return pD({node:e,stylesheet:n,useInlineStyles:r,key:`code-segment-${t}`})})}function kD(e){return e&&e.highlightAuto!==void 0}function AD(e){var t=e.astGenerator,n=e.language,r=e.code,i=e.defaultCodeValue;if(kD(t)){var a=mD(t,n);return n===`text`?{value:i,language:`text`}:a?t.highlight(n,r):t.highlightAuto(r)}try{return n&&n!==`text`?{value:t.highlight(r,n)}:{value:i}}catch{return{value:i}}}function jD(e,t){return function(n){var r=n.language,i=n.children,a=n.style,o=a===void 0?t:a,s=n.customStyle,c=s===void 0?{}:s,l=n.codeTagProps,u=l===void 0?{className:r?`language-${r}`:void 0,style:_D(_D({},o[`code[class*="language-"]`]),o[`code[class*="language-${r}"]`])}:l,d=n.useInlineStyles,f=d===void 0||d,p=n.showLineNumbers,m=p!==void 0&&p,h=n.showInlineLineNumbers,g=h===void 0||h,_=n.startingLineNumber,v=_===void 0?1:_,y=n.lineNumberContainerStyle,b=n.lineNumberStyle,x=b===void 0?{}:b,S=n.wrapLines,C=n.wrapLongLines,w=C!==void 0&&C,T=n.lineProps,ee=T===void 0?{}:T,E=n.renderer,te=n.PreTag,ne=te===void 0?`pre`:te,re=n.CodeTag,ie=re===void 0?`code`:re,D=n.code,O=D===void 0?(Array.isArray(i)?i[0]:i)||``:D,k=n.astGenerator,A=qE(n,hD);k||=e;var ae=m?L.createElement(xD,{containerStyle:y,codeStyle:u.style||{},numberStyle:x,startingLineNumber:v,codeString:O}):null,oe=o.hljs||o[`pre[class*="language-"]`]||{backgroundColor:`#fff`},se=kD(k)?`hljs`:`prismjs`,j=f?Object.assign({},A,{style:Object.assign({},oe,c)}):Object.assign({},A,{className:A.className?`${se} ${A.className}`:se,style:Object.assign({},c)});if(w?u.style=_D({whiteSpace:`pre-wrap`},u.style):u.style=_D({whiteSpace:`pre`},u.style),!k)return L.createElement(ne,j,ae,L.createElement(ie,u,O));(S===void 0&&E||w)&&(S=!0),E||=OD;var ce=[{type:`text`,value:O}],M=AD({astGenerator:k,language:r,code:O,defaultCodeValue:ce});M.language===null&&(M.value=ce);var le=v+(O.match(/\n/g)?.length??0),N=DD(M,S,ee,m,g,v,le,x,w);return L.createElement(ne,j,L.createElement(ie,u,!g&&ae,E({rows:N,stylesheet:o,useInlineStyles:f})))}}var MD=`abap.abnf.actionscript.ada.agda.al.antlr4.apacheconf.apex.apl.applescript.aql.arduino.arff.armasm.arturo.asciidoc.asm6502.asmatmel.aspnet.autohotkey.autoit.avisynth.avro-idl.awk.bash.basic.batch.bbcode.bbj.bicep.birb.bison.bnf.bqn.brainfuck.brightscript.bro.bsl.c.cfscript.chaiscript.cil.cilkc.cilkcpp.clike.clojure.cmake.cobol.coffeescript.concurnas.cooklang.coq.cpp.crystal.csharp.cshtml.csp.css-extras.css.csv.cue.cypher.d.dart.dataweave.dax.dhall.diff.django.dns-zone-file.docker.dot.ebnf.editorconfig.eiffel.ejs.elixir.elm.erb.erlang.etlua.excel-formula.factor.false.firestore-security-rules.flow.fortran.fsharp.ftl.gap.gcode.gdscript.gedcom.gettext.gherkin.git.glsl.gml.gn.go-module.go.gradle.graphql.groovy.haml.handlebars.haskell.haxe.hcl.hlsl.hoon.hpkp.hsts.http.ichigojam.icon.icu-message-format.idris.iecst.ignore.inform7.ini.io.j.java.javadoc.javadoclike.javascript.javastacktrace.jexl.jolie.jq.js-extras.js-templates.jsdoc.json.json5.jsonp.jsstacktrace.jsx.julia.keepalived.keyman.kotlin.kumir.kusto.latex.latte.less.lilypond.linker-script.liquid.lisp.livescript.llvm.log.lolcode.lua.magma.makefile.markdown.markup-templating.markup.mata.matlab.maxscript.mel.mermaid.metafont.mizar.mongodb.monkey.moonscript.n1ql.n4js.nand2tetris-hdl.naniscript.nasm.neon.nevod.nginx.nim.nix.nsis.objectivec.ocaml.odin.opencl.openqasm.oz.parigp.parser.pascal.pascaligo.pcaxis.peoplecode.perl.php-extras.php.phpdoc.plant-uml.plsql.powerquery.powershell.processing.prolog.promql.properties.protobuf.psl.pug.puppet.pure.purebasic.purescript.python.q.qml.qore.qsharp.r.racket.reason.regex.rego.renpy.rescript.rest.rip.roboconf.robotframework.ruby.rust.sas.sass.scala.scheme.scss.shell-session.smali.smalltalk.smarty.sml.solidity.solution-file.soy.sparql.splunk-spl.sqf.sql.squirrel.stan.stata.stylus.supercollider.swift.systemd.t4-cs.t4-templating.t4-vb.tap.tcl.textile.toml.tremor.tsx.tt2.turtle.twig.typescript.typoscript.unrealscript.uorazor.uri.v.vala.vbnet.velocity.verilog.vhdl.vim.visual-basic.warpscript.wasm.web-idl.wgsl.wiki.wolfram.wren.xeora.xml-doc.xojo.xquery.yaml.yang.zig`.split(`.`),ND=jD(z,{'code[class*="language-"]':{color:`black`,background:`none`,textShadow:`0 1px white`,fontFamily:`Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace`,fontSize:`1em`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,wordWrap:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{color:`black`,background:`#f5f2f0`,textShadow:`0 1px white`,fontFamily:`Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace`,fontSize:`1em`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,wordWrap:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`.5em 0`,overflow:`auto`},'pre[class*="language-"]::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'pre[class*="language-"] ::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"]::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"] ::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'pre[class*="language-"]::selection':{textShadow:`none`,background:`#b3d4fc`},'pre[class*="language-"] ::selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"]::selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"] ::selection':{textShadow:`none`,background:`#b3d4fc`},':not(pre) > code[class*="language-"]':{background:`#f5f2f0`,padding:`.1em`,borderRadius:`.3em`,whiteSpace:`normal`},comment:{color:`slategray`},prolog:{color:`slategray`},doctype:{color:`slategray`},cdata:{color:`slategray`},punctuation:{color:`#999`},namespace:{Opacity:`.7`},property:{color:`#905`},tag:{color:`#905`},boolean:{color:`#905`},number:{color:`#905`},constant:{color:`#905`},symbol:{color:`#905`},deleted:{color:`#905`},selector:{color:`#690`},"attr-name":{color:`#690`},string:{color:`#690`},char:{color:`#690`},builtin:{color:`#690`},inserted:{color:`#690`},operator:{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},entity:{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`,cursor:`help`},url:{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},".language-css .token.string":{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},".style .token.string":{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},atrule:{color:`#07a`},"attr-value":{color:`#07a`},keyword:{color:`#07a`},function:{color:`#DD4A68`},"class-name":{color:`#DD4A68`},regex:{color:`#e90`},important:{color:`#e90`,fontWeight:`bold`},variable:{color:`#e90`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`}});ND.supportedLanguages=MD;var PD={'code[class*="language-"]':{background:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{background:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`0.5em 0`,overflow:`auto`,borderRadius:`0.3em`},'code[class*="language-"]::-moz-selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'code[class*="language-"] *::-moz-selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'pre[class*="language-"] *::-moz-selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'code[class*="language-"]::selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'code[class*="language-"] *::selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'pre[class*="language-"] *::selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},':not(pre) > code[class*="language-"]':{padding:`0.2em 0.3em`,borderRadius:`0.3em`,whiteSpace:`normal`},comment:{color:`hsl(220, 10%, 40%)`,fontStyle:`italic`},prolog:{color:`hsl(220, 10%, 40%)`},cdata:{color:`hsl(220, 10%, 40%)`},doctype:{color:`hsl(220, 14%, 71%)`},punctuation:{color:`hsl(220, 14%, 71%)`},entity:{color:`hsl(220, 14%, 71%)`,cursor:`help`},"attr-name":{color:`hsl(29, 54%, 61%)`},"class-name":{color:`hsl(29, 54%, 61%)`},boolean:{color:`hsl(29, 54%, 61%)`},constant:{color:`hsl(29, 54%, 61%)`},number:{color:`hsl(29, 54%, 61%)`},atrule:{color:`hsl(29, 54%, 61%)`},keyword:{color:`hsl(286, 60%, 67%)`},property:{color:`hsl(355, 65%, 65%)`},tag:{color:`hsl(355, 65%, 65%)`},symbol:{color:`hsl(355, 65%, 65%)`},deleted:{color:`hsl(355, 65%, 65%)`},important:{color:`hsl(355, 65%, 65%)`},selector:{color:`hsl(95, 38%, 62%)`},string:{color:`hsl(95, 38%, 62%)`},char:{color:`hsl(95, 38%, 62%)`},builtin:{color:`hsl(95, 38%, 62%)`},inserted:{color:`hsl(95, 38%, 62%)`},regex:{color:`hsl(95, 38%, 62%)`},"attr-value":{color:`hsl(95, 38%, 62%)`},"attr-value > .token.punctuation":{color:`hsl(95, 38%, 62%)`},variable:{color:`hsl(207, 82%, 66%)`},operator:{color:`hsl(207, 82%, 66%)`},function:{color:`hsl(207, 82%, 66%)`},url:{color:`hsl(187, 47%, 55%)`},"attr-value > .token.punctuation.attr-equals":{color:`hsl(220, 14%, 71%)`},"special-attr > .token.attr-value > .token.value.css":{color:`hsl(220, 14%, 71%)`},".language-css .token.selector":{color:`hsl(355, 65%, 65%)`},".language-css .token.property":{color:`hsl(220, 14%, 71%)`},".language-css .token.function":{color:`hsl(187, 47%, 55%)`},".language-css .token.url > .token.function":{color:`hsl(187, 47%, 55%)`},".language-css .token.url > .token.string.url":{color:`hsl(95, 38%, 62%)`},".language-css .token.important":{color:`hsl(286, 60%, 67%)`},".language-css .token.atrule .token.rule":{color:`hsl(286, 60%, 67%)`},".language-javascript .token.operator":{color:`hsl(286, 60%, 67%)`},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:`hsl(5, 48%, 51%)`},".language-json .token.operator":{color:`hsl(220, 14%, 71%)`},".language-json .token.null.keyword":{color:`hsl(29, 54%, 61%)`},".language-markdown .token.url":{color:`hsl(220, 14%, 71%)`},".language-markdown .token.url > .token.operator":{color:`hsl(220, 14%, 71%)`},".language-markdown .token.url-reference.url > .token.string":{color:`hsl(220, 14%, 71%)`},".language-markdown .token.url > .token.content":{color:`hsl(207, 82%, 66%)`},".language-markdown .token.url > .token.url":{color:`hsl(187, 47%, 55%)`},".language-markdown .token.url-reference.url":{color:`hsl(187, 47%, 55%)`},".language-markdown .token.blockquote.punctuation":{color:`hsl(220, 10%, 40%)`,fontStyle:`italic`},".language-markdown .token.hr.punctuation":{color:`hsl(220, 10%, 40%)`,fontStyle:`italic`},".language-markdown .token.code-snippet":{color:`hsl(95, 38%, 62%)`},".language-markdown .token.bold .token.content":{color:`hsl(29, 54%, 61%)`},".language-markdown .token.italic .token.content":{color:`hsl(286, 60%, 67%)`},".language-markdown .token.strike .token.content":{color:`hsl(355, 65%, 65%)`},".language-markdown .token.strike .token.punctuation":{color:`hsl(355, 65%, 65%)`},".language-markdown .token.list.punctuation":{color:`hsl(355, 65%, 65%)`},".language-markdown .token.title.important > .token.punctuation":{color:`hsl(355, 65%, 65%)`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`},namespace:{Opacity:`0.8`},"token.tab:not(:empty):before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"token.cr:before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"token.lf:before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"token.space:before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:`0.4em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 9%, 55%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 9%, 55%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 9%, 55%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},".line-highlight.line-highlight":{background:`hsla(220, 100%, 80%, 0.04)`},".line-highlight.line-highlight:before":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 14%, 71%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},".line-highlight.line-highlight[data-end]:after":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 14%, 71%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:`hsla(220, 100%, 80%, 0.04)`},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:`hsla(220, 14%, 71%, 0.15)`},".command-line .command-line-prompt":{borderRightColor:`hsla(220, 14%, 71%, 0.15)`},".line-numbers .line-numbers-rows > span:before":{color:`hsl(220, 14%, 45%)`},".command-line .command-line-prompt > span:before":{color:`hsl(220, 14%, 45%)`},".rainbow-braces .token.token.punctuation.brace-level-1":{color:`hsl(355, 65%, 65%)`},".rainbow-braces .token.token.punctuation.brace-level-5":{color:`hsl(355, 65%, 65%)`},".rainbow-braces .token.token.punctuation.brace-level-9":{color:`hsl(355, 65%, 65%)`},".rainbow-braces .token.token.punctuation.brace-level-2":{color:`hsl(95, 38%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-6":{color:`hsl(95, 38%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-10":{color:`hsl(95, 38%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-3":{color:`hsl(207, 82%, 66%)`},".rainbow-braces .token.token.punctuation.brace-level-7":{color:`hsl(207, 82%, 66%)`},".rainbow-braces .token.token.punctuation.brace-level-11":{color:`hsl(207, 82%, 66%)`},".rainbow-braces .token.token.punctuation.brace-level-4":{color:`hsl(286, 60%, 67%)`},".rainbow-braces .token.token.punctuation.brace-level-8":{color:`hsl(286, 60%, 67%)`},".rainbow-braces .token.token.punctuation.brace-level-12":{color:`hsl(286, 60%, 67%)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},".prism-previewer.prism-previewer:before":{borderColor:`hsl(224, 13%, 17%)`},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:`hsl(224, 13%, 17%)`,borderRadius:`0.3em`},".prism-previewer-color.prism-previewer-color:before":{borderRadius:`0.3em`},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:`0.3em`},".prism-previewer.prism-previewer:after":{borderTopColor:`hsl(224, 13%, 17%)`},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:`hsl(224, 13%, 17%)`},".prism-previewer-angle.prism-previewer-angle:before":{background:`hsl(219, 13%, 22%)`},".prism-previewer-time.prism-previewer-time:before":{background:`hsl(219, 13%, 22%)`},".prism-previewer-easing.prism-previewer-easing":{background:`hsl(219, 13%, 22%)`},".prism-previewer-angle.prism-previewer-angle circle":{stroke:`hsl(220, 14%, 71%)`,strokeOpacity:`1`},".prism-previewer-time.prism-previewer-time circle":{stroke:`hsl(220, 14%, 71%)`,strokeOpacity:`1`},".prism-previewer-easing.prism-previewer-easing circle":{stroke:`hsl(220, 14%, 71%)`,fill:`transparent`},".prism-previewer-easing.prism-previewer-easing path":{stroke:`hsl(220, 14%, 71%)`},".prism-previewer-easing.prism-previewer-easing line":{stroke:`hsl(220, 14%, 71%)`}},FD={'code[class*="language-"]':{background:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{background:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`0.5em 0`,overflow:`auto`,borderRadius:`0.3em`},'code[class*="language-"]::-moz-selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'code[class*="language-"] *::-moz-selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'pre[class*="language-"] *::-moz-selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'code[class*="language-"]::selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'code[class*="language-"] *::selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'pre[class*="language-"] *::selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},':not(pre) > code[class*="language-"]':{padding:`0.2em 0.3em`,borderRadius:`0.3em`,whiteSpace:`normal`},comment:{color:`hsl(230, 4%, 64%)`,fontStyle:`italic`},prolog:{color:`hsl(230, 4%, 64%)`},cdata:{color:`hsl(230, 4%, 64%)`},doctype:{color:`hsl(230, 8%, 24%)`},punctuation:{color:`hsl(230, 8%, 24%)`},entity:{color:`hsl(230, 8%, 24%)`,cursor:`help`},"attr-name":{color:`hsl(35, 99%, 36%)`},"class-name":{color:`hsl(35, 99%, 36%)`},boolean:{color:`hsl(35, 99%, 36%)`},constant:{color:`hsl(35, 99%, 36%)`},number:{color:`hsl(35, 99%, 36%)`},atrule:{color:`hsl(35, 99%, 36%)`},keyword:{color:`hsl(301, 63%, 40%)`},property:{color:`hsl(5, 74%, 59%)`},tag:{color:`hsl(5, 74%, 59%)`},symbol:{color:`hsl(5, 74%, 59%)`},deleted:{color:`hsl(5, 74%, 59%)`},important:{color:`hsl(5, 74%, 59%)`},selector:{color:`hsl(119, 34%, 47%)`},string:{color:`hsl(119, 34%, 47%)`},char:{color:`hsl(119, 34%, 47%)`},builtin:{color:`hsl(119, 34%, 47%)`},inserted:{color:`hsl(119, 34%, 47%)`},regex:{color:`hsl(119, 34%, 47%)`},"attr-value":{color:`hsl(119, 34%, 47%)`},"attr-value > .token.punctuation":{color:`hsl(119, 34%, 47%)`},variable:{color:`hsl(221, 87%, 60%)`},operator:{color:`hsl(221, 87%, 60%)`},function:{color:`hsl(221, 87%, 60%)`},url:{color:`hsl(198, 99%, 37%)`},"attr-value > .token.punctuation.attr-equals":{color:`hsl(230, 8%, 24%)`},"special-attr > .token.attr-value > .token.value.css":{color:`hsl(230, 8%, 24%)`},".language-css .token.selector":{color:`hsl(5, 74%, 59%)`},".language-css .token.property":{color:`hsl(230, 8%, 24%)`},".language-css .token.function":{color:`hsl(198, 99%, 37%)`},".language-css .token.url > .token.function":{color:`hsl(198, 99%, 37%)`},".language-css .token.url > .token.string.url":{color:`hsl(119, 34%, 47%)`},".language-css .token.important":{color:`hsl(301, 63%, 40%)`},".language-css .token.atrule .token.rule":{color:`hsl(301, 63%, 40%)`},".language-javascript .token.operator":{color:`hsl(301, 63%, 40%)`},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:`hsl(344, 84%, 43%)`},".language-json .token.operator":{color:`hsl(230, 8%, 24%)`},".language-json .token.null.keyword":{color:`hsl(35, 99%, 36%)`},".language-markdown .token.url":{color:`hsl(230, 8%, 24%)`},".language-markdown .token.url > .token.operator":{color:`hsl(230, 8%, 24%)`},".language-markdown .token.url-reference.url > .token.string":{color:`hsl(230, 8%, 24%)`},".language-markdown .token.url > .token.content":{color:`hsl(221, 87%, 60%)`},".language-markdown .token.url > .token.url":{color:`hsl(198, 99%, 37%)`},".language-markdown .token.url-reference.url":{color:`hsl(198, 99%, 37%)`},".language-markdown .token.blockquote.punctuation":{color:`hsl(230, 4%, 64%)`,fontStyle:`italic`},".language-markdown .token.hr.punctuation":{color:`hsl(230, 4%, 64%)`,fontStyle:`italic`},".language-markdown .token.code-snippet":{color:`hsl(119, 34%, 47%)`},".language-markdown .token.bold .token.content":{color:`hsl(35, 99%, 36%)`},".language-markdown .token.italic .token.content":{color:`hsl(301, 63%, 40%)`},".language-markdown .token.strike .token.content":{color:`hsl(5, 74%, 59%)`},".language-markdown .token.strike .token.punctuation":{color:`hsl(5, 74%, 59%)`},".language-markdown .token.list.punctuation":{color:`hsl(5, 74%, 59%)`},".language-markdown .token.title.important > .token.punctuation":{color:`hsl(5, 74%, 59%)`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`},namespace:{Opacity:`0.8`},"token.tab:not(:empty):before":{color:`hsla(230, 8%, 24%, 0.2)`},"token.cr:before":{color:`hsla(230, 8%, 24%, 0.2)`},"token.lf:before":{color:`hsla(230, 8%, 24%, 0.2)`},"token.space:before":{color:`hsla(230, 8%, 24%, 0.2)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:`0.4em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 6%, 44%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 6%, 44%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 6%, 44%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},".line-highlight.line-highlight":{background:`hsla(230, 8%, 24%, 0.05)`},".line-highlight.line-highlight:before":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 8%, 24%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},".line-highlight.line-highlight[data-end]:after":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 8%, 24%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:`hsla(230, 8%, 24%, 0.05)`},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:`hsla(230, 8%, 24%, 0.2)`},".command-line .command-line-prompt":{borderRightColor:`hsla(230, 8%, 24%, 0.2)`},".line-numbers .line-numbers-rows > span:before":{color:`hsl(230, 1%, 62%)`},".command-line .command-line-prompt > span:before":{color:`hsl(230, 1%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-1":{color:`hsl(5, 74%, 59%)`},".rainbow-braces .token.token.punctuation.brace-level-5":{color:`hsl(5, 74%, 59%)`},".rainbow-braces .token.token.punctuation.brace-level-9":{color:`hsl(5, 74%, 59%)`},".rainbow-braces .token.token.punctuation.brace-level-2":{color:`hsl(119, 34%, 47%)`},".rainbow-braces .token.token.punctuation.brace-level-6":{color:`hsl(119, 34%, 47%)`},".rainbow-braces .token.token.punctuation.brace-level-10":{color:`hsl(119, 34%, 47%)`},".rainbow-braces .token.token.punctuation.brace-level-3":{color:`hsl(221, 87%, 60%)`},".rainbow-braces .token.token.punctuation.brace-level-7":{color:`hsl(221, 87%, 60%)`},".rainbow-braces .token.token.punctuation.brace-level-11":{color:`hsl(221, 87%, 60%)`},".rainbow-braces .token.token.punctuation.brace-level-4":{color:`hsl(301, 63%, 40%)`},".rainbow-braces .token.token.punctuation.brace-level-8":{color:`hsl(301, 63%, 40%)`},".rainbow-braces .token.token.punctuation.brace-level-12":{color:`hsl(301, 63%, 40%)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},".prism-previewer.prism-previewer:before":{borderColor:`hsl(0, 0, 95%)`},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:`hsl(0, 0, 95%)`,borderRadius:`0.3em`},".prism-previewer-color.prism-previewer-color:before":{borderRadius:`0.3em`},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:`0.3em`},".prism-previewer.prism-previewer:after":{borderTopColor:`hsl(0, 0, 95%)`},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:`hsl(0, 0, 95%)`},".prism-previewer-angle.prism-previewer-angle:before":{background:`hsl(0, 0%, 100%)`},".prism-previewer-time.prism-previewer-time:before":{background:`hsl(0, 0%, 100%)`},".prism-previewer-easing.prism-previewer-easing":{background:`hsl(0, 0%, 100%)`},".prism-previewer-angle.prism-previewer-angle circle":{stroke:`hsl(230, 8%, 24%)`,strokeOpacity:`1`},".prism-previewer-time.prism-previewer-time circle":{stroke:`hsl(230, 8%, 24%)`,strokeOpacity:`1`},".prism-previewer-easing.prism-previewer-easing circle":{stroke:`hsl(230, 8%, 24%)`,fill:`transparent`},".prism-previewer-easing.prism-previewer-easing path":{stroke:`hsl(230, 8%, 24%)`},".prism-previewer-easing.prism-previewer-easing line":{stroke:`hsl(230, 8%, 24%)`}},ID=n(o(),1),LD=[`!`,`"`,`#`,`$`,`%`,`&`,`'`,`(`,`)`,`*`,`+`,`,`,`-`,`.`,`/`,`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`:`,`;`,`<`,`=`,`>`,`?`,`@`,`A`,`B`,`C`,`D`,`E`,`F`,`G`,`H`,`I`,`J`,`K`,`L`,`M`,`N`,`O`,`P`,`Q`,`R`,`S`,`T`,`U`,`V`,`W`,`X`,`Y`,`Z`,`[`,`\\`,`]`,`^`,`_`,"`",`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`,`j`,`k`,`l`,`m`,`n`,`o`,`p`,`q`,`r`,`s`,`t`,`u`,`v`,`w`,`x`,`y`,`z`,`{`,`|`,`}`,`~`,[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],`\0`,``,``,``,``,``,``,`\x07`,`\b`,` `,`
|
|
33
|
+
`};if(i===0){var c=g(u.slice(f+1,p).concat(ED({children:[s],className:e.properties.className})),o);d.push(c)}else if(i===n.length-1){var l=u[p+1]&&u[p+1].children&&u[p+1].children[0],m={type:`text`,value:`${t}`};if(l){var h=ED({children:[m],className:e.properties.className});u.splice(p+1,0,h)}else{var _=g([m],o,e.properties.className);d.push(_)}}else{var v=g([s],o,e.properties.className);d.push(v)}}),f=p}p++};p<u.length;)_();if(f!==u.length-1){var v=u.slice(f+1,u.length);if(v&&v.length){var y=g(v,r&&d.length+a);d.push(y)}}return t?d:(l=[]).concat.apply(l,d)}function kD(e){var t=e.rows,n=e.stylesheet,r=e.useInlineStyles;return t.map(function(e,t){return mD({node:e,stylesheet:n,useInlineStyles:r,key:`code-segment-${t}`})})}function AD(e){return e&&e.highlightAuto!==void 0}function jD(e){var t=e.astGenerator,n=e.language,r=e.code,i=e.defaultCodeValue;if(AD(t)){var a=hD(t,n);return n===`text`?{value:i,language:`text`}:a?t.highlight(n,r):t.highlightAuto(r)}try{return n&&n!==`text`?{value:t.highlight(r,n)}:{value:i}}catch{return{value:i}}}function MD(e,t){return function(n){var r=n.language,i=n.children,a=n.style,o=a===void 0?t:a,s=n.customStyle,c=s===void 0?{}:s,l=n.codeTagProps,u=l===void 0?{className:r?`language-${r}`:void 0,style:vD(vD({},o[`code[class*="language-"]`]),o[`code[class*="language-${r}"]`])}:l,d=n.useInlineStyles,f=d===void 0||d,p=n.showLineNumbers,m=p!==void 0&&p,h=n.showInlineLineNumbers,g=h===void 0||h,_=n.startingLineNumber,v=_===void 0?1:_,y=n.lineNumberContainerStyle,b=n.lineNumberStyle,x=b===void 0?{}:b,S=n.wrapLines,C=n.wrapLongLines,w=C!==void 0&&C,T=n.lineProps,ee=T===void 0?{}:T,E=n.renderer,te=n.PreTag,ne=te===void 0?`pre`:te,re=n.CodeTag,ie=re===void 0?`code`:re,D=n.code,O=D===void 0?(Array.isArray(i)?i[0]:i)||``:D,k=n.astGenerator,A=JE(n,gD);k||=e;var ae=m?L.createElement(SD,{containerStyle:y,codeStyle:u.style||{},numberStyle:x,startingLineNumber:v,codeString:O}):null,oe=o.hljs||o[`pre[class*="language-"]`]||{backgroundColor:`#fff`},se=AD(k)?`hljs`:`prismjs`,j=f?Object.assign({},A,{style:Object.assign({},oe,c)}):Object.assign({},A,{className:A.className?`${se} ${A.className}`:se,style:Object.assign({},c)});if(w?u.style=vD({whiteSpace:`pre-wrap`},u.style):u.style=vD({whiteSpace:`pre`},u.style),!k)return L.createElement(ne,j,ae,L.createElement(ie,u,O));(S===void 0&&E||w)&&(S=!0),E||=kD;var ce=[{type:`text`,value:O}],M=jD({astGenerator:k,language:r,code:O,defaultCodeValue:ce});M.language===null&&(M.value=ce);var le=v+(O.match(/\n/g)?.length??0),N=OD(M,S,ee,m,g,v,le,x,w);return L.createElement(ne,j,L.createElement(ie,u,!g&&ae,E({rows:N,stylesheet:o,useInlineStyles:f})))}}var ND=`abap.abnf.actionscript.ada.agda.al.antlr4.apacheconf.apex.apl.applescript.aql.arduino.arff.armasm.arturo.asciidoc.asm6502.asmatmel.aspnet.autohotkey.autoit.avisynth.avro-idl.awk.bash.basic.batch.bbcode.bbj.bicep.birb.bison.bnf.bqn.brainfuck.brightscript.bro.bsl.c.cfscript.chaiscript.cil.cilkc.cilkcpp.clike.clojure.cmake.cobol.coffeescript.concurnas.cooklang.coq.cpp.crystal.csharp.cshtml.csp.css-extras.css.csv.cue.cypher.d.dart.dataweave.dax.dhall.diff.django.dns-zone-file.docker.dot.ebnf.editorconfig.eiffel.ejs.elixir.elm.erb.erlang.etlua.excel-formula.factor.false.firestore-security-rules.flow.fortran.fsharp.ftl.gap.gcode.gdscript.gedcom.gettext.gherkin.git.glsl.gml.gn.go-module.go.gradle.graphql.groovy.haml.handlebars.haskell.haxe.hcl.hlsl.hoon.hpkp.hsts.http.ichigojam.icon.icu-message-format.idris.iecst.ignore.inform7.ini.io.j.java.javadoc.javadoclike.javascript.javastacktrace.jexl.jolie.jq.js-extras.js-templates.jsdoc.json.json5.jsonp.jsstacktrace.jsx.julia.keepalived.keyman.kotlin.kumir.kusto.latex.latte.less.lilypond.linker-script.liquid.lisp.livescript.llvm.log.lolcode.lua.magma.makefile.markdown.markup-templating.markup.mata.matlab.maxscript.mel.mermaid.metafont.mizar.mongodb.monkey.moonscript.n1ql.n4js.nand2tetris-hdl.naniscript.nasm.neon.nevod.nginx.nim.nix.nsis.objectivec.ocaml.odin.opencl.openqasm.oz.parigp.parser.pascal.pascaligo.pcaxis.peoplecode.perl.php-extras.php.phpdoc.plant-uml.plsql.powerquery.powershell.processing.prolog.promql.properties.protobuf.psl.pug.puppet.pure.purebasic.purescript.python.q.qml.qore.qsharp.r.racket.reason.regex.rego.renpy.rescript.rest.rip.roboconf.robotframework.ruby.rust.sas.sass.scala.scheme.scss.shell-session.smali.smalltalk.smarty.sml.solidity.solution-file.soy.sparql.splunk-spl.sqf.sql.squirrel.stan.stata.stylus.supercollider.swift.systemd.t4-cs.t4-templating.t4-vb.tap.tcl.textile.toml.tremor.tsx.tt2.turtle.twig.typescript.typoscript.unrealscript.uorazor.uri.v.vala.vbnet.velocity.verilog.vhdl.vim.visual-basic.warpscript.wasm.web-idl.wgsl.wiki.wolfram.wren.xeora.xml-doc.xojo.xquery.yaml.yang.zig`.split(`.`),PD=MD(z,{'code[class*="language-"]':{color:`black`,background:`none`,textShadow:`0 1px white`,fontFamily:`Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace`,fontSize:`1em`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,wordWrap:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{color:`black`,background:`#f5f2f0`,textShadow:`0 1px white`,fontFamily:`Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace`,fontSize:`1em`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,wordWrap:`normal`,lineHeight:`1.5`,MozTabSize:`4`,OTabSize:`4`,tabSize:`4`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`.5em 0`,overflow:`auto`},'pre[class*="language-"]::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'pre[class*="language-"] ::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"]::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"] ::-moz-selection':{textShadow:`none`,background:`#b3d4fc`},'pre[class*="language-"]::selection':{textShadow:`none`,background:`#b3d4fc`},'pre[class*="language-"] ::selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"]::selection':{textShadow:`none`,background:`#b3d4fc`},'code[class*="language-"] ::selection':{textShadow:`none`,background:`#b3d4fc`},':not(pre) > code[class*="language-"]':{background:`#f5f2f0`,padding:`.1em`,borderRadius:`.3em`,whiteSpace:`normal`},comment:{color:`slategray`},prolog:{color:`slategray`},doctype:{color:`slategray`},cdata:{color:`slategray`},punctuation:{color:`#999`},namespace:{Opacity:`.7`},property:{color:`#905`},tag:{color:`#905`},boolean:{color:`#905`},number:{color:`#905`},constant:{color:`#905`},symbol:{color:`#905`},deleted:{color:`#905`},selector:{color:`#690`},"attr-name":{color:`#690`},string:{color:`#690`},char:{color:`#690`},builtin:{color:`#690`},inserted:{color:`#690`},operator:{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},entity:{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`,cursor:`help`},url:{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},".language-css .token.string":{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},".style .token.string":{color:`#9a6e3a`,background:`hsla(0, 0%, 100%, .5)`},atrule:{color:`#07a`},"attr-value":{color:`#07a`},keyword:{color:`#07a`},function:{color:`#DD4A68`},"class-name":{color:`#DD4A68`},regex:{color:`#e90`},important:{color:`#e90`,fontWeight:`bold`},variable:{color:`#e90`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`}});PD.supportedLanguages=ND;var FD={'code[class*="language-"]':{background:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{background:`hsl(220, 13%, 18%)`,color:`hsl(220, 14%, 71%)`,textShadow:`0 1px rgba(0, 0, 0, 0.3)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`0.5em 0`,overflow:`auto`,borderRadius:`0.3em`},'code[class*="language-"]::-moz-selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'code[class*="language-"] *::-moz-selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'pre[class*="language-"] *::-moz-selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'code[class*="language-"]::selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'code[class*="language-"] *::selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},'pre[class*="language-"] *::selection':{background:`hsl(220, 13%, 28%)`,color:`inherit`,textShadow:`none`},':not(pre) > code[class*="language-"]':{padding:`0.2em 0.3em`,borderRadius:`0.3em`,whiteSpace:`normal`},comment:{color:`hsl(220, 10%, 40%)`,fontStyle:`italic`},prolog:{color:`hsl(220, 10%, 40%)`},cdata:{color:`hsl(220, 10%, 40%)`},doctype:{color:`hsl(220, 14%, 71%)`},punctuation:{color:`hsl(220, 14%, 71%)`},entity:{color:`hsl(220, 14%, 71%)`,cursor:`help`},"attr-name":{color:`hsl(29, 54%, 61%)`},"class-name":{color:`hsl(29, 54%, 61%)`},boolean:{color:`hsl(29, 54%, 61%)`},constant:{color:`hsl(29, 54%, 61%)`},number:{color:`hsl(29, 54%, 61%)`},atrule:{color:`hsl(29, 54%, 61%)`},keyword:{color:`hsl(286, 60%, 67%)`},property:{color:`hsl(355, 65%, 65%)`},tag:{color:`hsl(355, 65%, 65%)`},symbol:{color:`hsl(355, 65%, 65%)`},deleted:{color:`hsl(355, 65%, 65%)`},important:{color:`hsl(355, 65%, 65%)`},selector:{color:`hsl(95, 38%, 62%)`},string:{color:`hsl(95, 38%, 62%)`},char:{color:`hsl(95, 38%, 62%)`},builtin:{color:`hsl(95, 38%, 62%)`},inserted:{color:`hsl(95, 38%, 62%)`},regex:{color:`hsl(95, 38%, 62%)`},"attr-value":{color:`hsl(95, 38%, 62%)`},"attr-value > .token.punctuation":{color:`hsl(95, 38%, 62%)`},variable:{color:`hsl(207, 82%, 66%)`},operator:{color:`hsl(207, 82%, 66%)`},function:{color:`hsl(207, 82%, 66%)`},url:{color:`hsl(187, 47%, 55%)`},"attr-value > .token.punctuation.attr-equals":{color:`hsl(220, 14%, 71%)`},"special-attr > .token.attr-value > .token.value.css":{color:`hsl(220, 14%, 71%)`},".language-css .token.selector":{color:`hsl(355, 65%, 65%)`},".language-css .token.property":{color:`hsl(220, 14%, 71%)`},".language-css .token.function":{color:`hsl(187, 47%, 55%)`},".language-css .token.url > .token.function":{color:`hsl(187, 47%, 55%)`},".language-css .token.url > .token.string.url":{color:`hsl(95, 38%, 62%)`},".language-css .token.important":{color:`hsl(286, 60%, 67%)`},".language-css .token.atrule .token.rule":{color:`hsl(286, 60%, 67%)`},".language-javascript .token.operator":{color:`hsl(286, 60%, 67%)`},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:`hsl(5, 48%, 51%)`},".language-json .token.operator":{color:`hsl(220, 14%, 71%)`},".language-json .token.null.keyword":{color:`hsl(29, 54%, 61%)`},".language-markdown .token.url":{color:`hsl(220, 14%, 71%)`},".language-markdown .token.url > .token.operator":{color:`hsl(220, 14%, 71%)`},".language-markdown .token.url-reference.url > .token.string":{color:`hsl(220, 14%, 71%)`},".language-markdown .token.url > .token.content":{color:`hsl(207, 82%, 66%)`},".language-markdown .token.url > .token.url":{color:`hsl(187, 47%, 55%)`},".language-markdown .token.url-reference.url":{color:`hsl(187, 47%, 55%)`},".language-markdown .token.blockquote.punctuation":{color:`hsl(220, 10%, 40%)`,fontStyle:`italic`},".language-markdown .token.hr.punctuation":{color:`hsl(220, 10%, 40%)`,fontStyle:`italic`},".language-markdown .token.code-snippet":{color:`hsl(95, 38%, 62%)`},".language-markdown .token.bold .token.content":{color:`hsl(29, 54%, 61%)`},".language-markdown .token.italic .token.content":{color:`hsl(286, 60%, 67%)`},".language-markdown .token.strike .token.content":{color:`hsl(355, 65%, 65%)`},".language-markdown .token.strike .token.punctuation":{color:`hsl(355, 65%, 65%)`},".language-markdown .token.list.punctuation":{color:`hsl(355, 65%, 65%)`},".language-markdown .token.title.important > .token.punctuation":{color:`hsl(355, 65%, 65%)`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`},namespace:{Opacity:`0.8`},"token.tab:not(:empty):before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"token.cr:before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"token.lf:before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"token.space:before":{color:`hsla(220, 14%, 71%, 0.15)`,textShadow:`none`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:`0.4em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 9%, 55%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 9%, 55%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 9%, 55%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:`hsl(220, 13%, 28%)`,color:`hsl(220, 14%, 71%)`},".line-highlight.line-highlight":{background:`hsla(220, 100%, 80%, 0.04)`},".line-highlight.line-highlight:before":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 14%, 71%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},".line-highlight.line-highlight[data-end]:after":{background:`hsl(220, 13%, 26%)`,color:`hsl(220, 14%, 71%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:`hsla(220, 100%, 80%, 0.04)`},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:`hsla(220, 14%, 71%, 0.15)`},".command-line .command-line-prompt":{borderRightColor:`hsla(220, 14%, 71%, 0.15)`},".line-numbers .line-numbers-rows > span:before":{color:`hsl(220, 14%, 45%)`},".command-line .command-line-prompt > span:before":{color:`hsl(220, 14%, 45%)`},".rainbow-braces .token.token.punctuation.brace-level-1":{color:`hsl(355, 65%, 65%)`},".rainbow-braces .token.token.punctuation.brace-level-5":{color:`hsl(355, 65%, 65%)`},".rainbow-braces .token.token.punctuation.brace-level-9":{color:`hsl(355, 65%, 65%)`},".rainbow-braces .token.token.punctuation.brace-level-2":{color:`hsl(95, 38%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-6":{color:`hsl(95, 38%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-10":{color:`hsl(95, 38%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-3":{color:`hsl(207, 82%, 66%)`},".rainbow-braces .token.token.punctuation.brace-level-7":{color:`hsl(207, 82%, 66%)`},".rainbow-braces .token.token.punctuation.brace-level-11":{color:`hsl(207, 82%, 66%)`},".rainbow-braces .token.token.punctuation.brace-level-4":{color:`hsl(286, 60%, 67%)`},".rainbow-braces .token.token.punctuation.brace-level-8":{color:`hsl(286, 60%, 67%)`},".rainbow-braces .token.token.punctuation.brace-level-12":{color:`hsl(286, 60%, 67%)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},".prism-previewer.prism-previewer:before":{borderColor:`hsl(224, 13%, 17%)`},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:`hsl(224, 13%, 17%)`,borderRadius:`0.3em`},".prism-previewer-color.prism-previewer-color:before":{borderRadius:`0.3em`},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:`0.3em`},".prism-previewer.prism-previewer:after":{borderTopColor:`hsl(224, 13%, 17%)`},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:`hsl(224, 13%, 17%)`},".prism-previewer-angle.prism-previewer-angle:before":{background:`hsl(219, 13%, 22%)`},".prism-previewer-time.prism-previewer-time:before":{background:`hsl(219, 13%, 22%)`},".prism-previewer-easing.prism-previewer-easing":{background:`hsl(219, 13%, 22%)`},".prism-previewer-angle.prism-previewer-angle circle":{stroke:`hsl(220, 14%, 71%)`,strokeOpacity:`1`},".prism-previewer-time.prism-previewer-time circle":{stroke:`hsl(220, 14%, 71%)`,strokeOpacity:`1`},".prism-previewer-easing.prism-previewer-easing circle":{stroke:`hsl(220, 14%, 71%)`,fill:`transparent`},".prism-previewer-easing.prism-previewer-easing path":{stroke:`hsl(220, 14%, 71%)`},".prism-previewer-easing.prism-previewer-easing line":{stroke:`hsl(220, 14%, 71%)`}},ID={'code[class*="language-"]':{background:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`},'pre[class*="language-"]':{background:`hsl(230, 1%, 98%)`,color:`hsl(230, 8%, 24%)`,fontFamily:`"Fira Code", "Fira Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace`,direction:`ltr`,textAlign:`left`,whiteSpace:`pre`,wordSpacing:`normal`,wordBreak:`normal`,lineHeight:`1.5`,MozTabSize:`2`,OTabSize:`2`,tabSize:`2`,WebkitHyphens:`none`,MozHyphens:`none`,msHyphens:`none`,hyphens:`none`,padding:`1em`,margin:`0.5em 0`,overflow:`auto`,borderRadius:`0.3em`},'code[class*="language-"]::-moz-selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'code[class*="language-"] *::-moz-selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'pre[class*="language-"] *::-moz-selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'code[class*="language-"]::selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'code[class*="language-"] *::selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},'pre[class*="language-"] *::selection':{background:`hsl(230, 1%, 90%)`,color:`inherit`},':not(pre) > code[class*="language-"]':{padding:`0.2em 0.3em`,borderRadius:`0.3em`,whiteSpace:`normal`},comment:{color:`hsl(230, 4%, 64%)`,fontStyle:`italic`},prolog:{color:`hsl(230, 4%, 64%)`},cdata:{color:`hsl(230, 4%, 64%)`},doctype:{color:`hsl(230, 8%, 24%)`},punctuation:{color:`hsl(230, 8%, 24%)`},entity:{color:`hsl(230, 8%, 24%)`,cursor:`help`},"attr-name":{color:`hsl(35, 99%, 36%)`},"class-name":{color:`hsl(35, 99%, 36%)`},boolean:{color:`hsl(35, 99%, 36%)`},constant:{color:`hsl(35, 99%, 36%)`},number:{color:`hsl(35, 99%, 36%)`},atrule:{color:`hsl(35, 99%, 36%)`},keyword:{color:`hsl(301, 63%, 40%)`},property:{color:`hsl(5, 74%, 59%)`},tag:{color:`hsl(5, 74%, 59%)`},symbol:{color:`hsl(5, 74%, 59%)`},deleted:{color:`hsl(5, 74%, 59%)`},important:{color:`hsl(5, 74%, 59%)`},selector:{color:`hsl(119, 34%, 47%)`},string:{color:`hsl(119, 34%, 47%)`},char:{color:`hsl(119, 34%, 47%)`},builtin:{color:`hsl(119, 34%, 47%)`},inserted:{color:`hsl(119, 34%, 47%)`},regex:{color:`hsl(119, 34%, 47%)`},"attr-value":{color:`hsl(119, 34%, 47%)`},"attr-value > .token.punctuation":{color:`hsl(119, 34%, 47%)`},variable:{color:`hsl(221, 87%, 60%)`},operator:{color:`hsl(221, 87%, 60%)`},function:{color:`hsl(221, 87%, 60%)`},url:{color:`hsl(198, 99%, 37%)`},"attr-value > .token.punctuation.attr-equals":{color:`hsl(230, 8%, 24%)`},"special-attr > .token.attr-value > .token.value.css":{color:`hsl(230, 8%, 24%)`},".language-css .token.selector":{color:`hsl(5, 74%, 59%)`},".language-css .token.property":{color:`hsl(230, 8%, 24%)`},".language-css .token.function":{color:`hsl(198, 99%, 37%)`},".language-css .token.url > .token.function":{color:`hsl(198, 99%, 37%)`},".language-css .token.url > .token.string.url":{color:`hsl(119, 34%, 47%)`},".language-css .token.important":{color:`hsl(301, 63%, 40%)`},".language-css .token.atrule .token.rule":{color:`hsl(301, 63%, 40%)`},".language-javascript .token.operator":{color:`hsl(301, 63%, 40%)`},".language-javascript .token.template-string > .token.interpolation > .token.interpolation-punctuation.punctuation":{color:`hsl(344, 84%, 43%)`},".language-json .token.operator":{color:`hsl(230, 8%, 24%)`},".language-json .token.null.keyword":{color:`hsl(35, 99%, 36%)`},".language-markdown .token.url":{color:`hsl(230, 8%, 24%)`},".language-markdown .token.url > .token.operator":{color:`hsl(230, 8%, 24%)`},".language-markdown .token.url-reference.url > .token.string":{color:`hsl(230, 8%, 24%)`},".language-markdown .token.url > .token.content":{color:`hsl(221, 87%, 60%)`},".language-markdown .token.url > .token.url":{color:`hsl(198, 99%, 37%)`},".language-markdown .token.url-reference.url":{color:`hsl(198, 99%, 37%)`},".language-markdown .token.blockquote.punctuation":{color:`hsl(230, 4%, 64%)`,fontStyle:`italic`},".language-markdown .token.hr.punctuation":{color:`hsl(230, 4%, 64%)`,fontStyle:`italic`},".language-markdown .token.code-snippet":{color:`hsl(119, 34%, 47%)`},".language-markdown .token.bold .token.content":{color:`hsl(35, 99%, 36%)`},".language-markdown .token.italic .token.content":{color:`hsl(301, 63%, 40%)`},".language-markdown .token.strike .token.content":{color:`hsl(5, 74%, 59%)`},".language-markdown .token.strike .token.punctuation":{color:`hsl(5, 74%, 59%)`},".language-markdown .token.list.punctuation":{color:`hsl(5, 74%, 59%)`},".language-markdown .token.title.important > .token.punctuation":{color:`hsl(5, 74%, 59%)`},bold:{fontWeight:`bold`},italic:{fontStyle:`italic`},namespace:{Opacity:`0.8`},"token.tab:not(:empty):before":{color:`hsla(230, 8%, 24%, 0.2)`},"token.cr:before":{color:`hsla(230, 8%, 24%, 0.2)`},"token.lf:before":{color:`hsla(230, 8%, 24%, 0.2)`},"token.space:before":{color:`hsla(230, 8%, 24%, 0.2)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item":{marginRight:`0.4em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 6%, 44%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 6%, 44%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 6%, 44%)`,padding:`0.1em 0.4em`,borderRadius:`0.3em`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:hover":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > button:focus":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:hover":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > a:focus":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:hover":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},"div.code-toolbar > .toolbar.toolbar > .toolbar-item > span:focus":{background:`hsl(230, 1%, 78%)`,color:`hsl(230, 8%, 24%)`},".line-highlight.line-highlight":{background:`hsla(230, 8%, 24%, 0.05)`},".line-highlight.line-highlight:before":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 8%, 24%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},".line-highlight.line-highlight[data-end]:after":{background:`hsl(230, 1%, 90%)`,color:`hsl(230, 8%, 24%)`,padding:`0.1em 0.6em`,borderRadius:`0.3em`,boxShadow:`0 2px 0 0 rgba(0, 0, 0, 0.2)`},"pre[id].linkable-line-numbers.linkable-line-numbers span.line-numbers-rows > span:hover:before":{backgroundColor:`hsla(230, 8%, 24%, 0.05)`},".line-numbers.line-numbers .line-numbers-rows":{borderRightColor:`hsla(230, 8%, 24%, 0.2)`},".command-line .command-line-prompt":{borderRightColor:`hsla(230, 8%, 24%, 0.2)`},".line-numbers .line-numbers-rows > span:before":{color:`hsl(230, 1%, 62%)`},".command-line .command-line-prompt > span:before":{color:`hsl(230, 1%, 62%)`},".rainbow-braces .token.token.punctuation.brace-level-1":{color:`hsl(5, 74%, 59%)`},".rainbow-braces .token.token.punctuation.brace-level-5":{color:`hsl(5, 74%, 59%)`},".rainbow-braces .token.token.punctuation.brace-level-9":{color:`hsl(5, 74%, 59%)`},".rainbow-braces .token.token.punctuation.brace-level-2":{color:`hsl(119, 34%, 47%)`},".rainbow-braces .token.token.punctuation.brace-level-6":{color:`hsl(119, 34%, 47%)`},".rainbow-braces .token.token.punctuation.brace-level-10":{color:`hsl(119, 34%, 47%)`},".rainbow-braces .token.token.punctuation.brace-level-3":{color:`hsl(221, 87%, 60%)`},".rainbow-braces .token.token.punctuation.brace-level-7":{color:`hsl(221, 87%, 60%)`},".rainbow-braces .token.token.punctuation.brace-level-11":{color:`hsl(221, 87%, 60%)`},".rainbow-braces .token.token.punctuation.brace-level-4":{color:`hsl(301, 63%, 40%)`},".rainbow-braces .token.token.punctuation.brace-level-8":{color:`hsl(301, 63%, 40%)`},".rainbow-braces .token.token.punctuation.brace-level-12":{color:`hsl(301, 63%, 40%)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)":{backgroundColor:`hsla(353, 100%, 66%, 0.15)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix)::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre > code.diff-highlight .token.token.deleted:not(.prefix) *::selection":{backgroundColor:`hsla(353, 95%, 66%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)":{backgroundColor:`hsla(137, 100%, 55%, 0.15)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::-moz-selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre.diff-highlight > code .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix)::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},"pre > code.diff-highlight .token.token.inserted:not(.prefix) *::selection":{backgroundColor:`hsla(135, 73%, 55%, 0.25)`},".prism-previewer.prism-previewer:before":{borderColor:`hsl(0, 0, 95%)`},".prism-previewer-gradient.prism-previewer-gradient div":{borderColor:`hsl(0, 0, 95%)`,borderRadius:`0.3em`},".prism-previewer-color.prism-previewer-color:before":{borderRadius:`0.3em`},".prism-previewer-easing.prism-previewer-easing:before":{borderRadius:`0.3em`},".prism-previewer.prism-previewer:after":{borderTopColor:`hsl(0, 0, 95%)`},".prism-previewer-flipped.prism-previewer-flipped.after":{borderBottomColor:`hsl(0, 0, 95%)`},".prism-previewer-angle.prism-previewer-angle:before":{background:`hsl(0, 0%, 100%)`},".prism-previewer-time.prism-previewer-time:before":{background:`hsl(0, 0%, 100%)`},".prism-previewer-easing.prism-previewer-easing":{background:`hsl(0, 0%, 100%)`},".prism-previewer-angle.prism-previewer-angle circle":{stroke:`hsl(230, 8%, 24%)`,strokeOpacity:`1`},".prism-previewer-time.prism-previewer-time circle":{stroke:`hsl(230, 8%, 24%)`,strokeOpacity:`1`},".prism-previewer-easing.prism-previewer-easing circle":{stroke:`hsl(230, 8%, 24%)`,fill:`transparent`},".prism-previewer-easing.prism-previewer-easing path":{stroke:`hsl(230, 8%, 24%)`},".prism-previewer-easing.prism-previewer-easing line":{stroke:`hsl(230, 8%, 24%)`}},LD=n(o(),1),RD=[`!`,`"`,`#`,`$`,`%`,`&`,`'`,`(`,`)`,`*`,`+`,`,`,`-`,`.`,`/`,`0`,`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`:`,`;`,`<`,`=`,`>`,`?`,`@`,`A`,`B`,`C`,`D`,`E`,`F`,`G`,`H`,`I`,`J`,`K`,`L`,`M`,`N`,`O`,`P`,`Q`,`R`,`S`,`T`,`U`,`V`,`W`,`X`,`Y`,`Z`,`[`,`\\`,`]`,`^`,`_`,"`",`a`,`b`,`c`,`d`,`e`,`f`,`g`,`h`,`i`,`j`,`k`,`l`,`m`,`n`,`o`,`p`,`q`,`r`,`s`,`t`,`u`,`v`,`w`,`x`,`y`,`z`,`{`,`|`,`}`,`~`,[161],[162],[163],[164],[165],[166],[167],[168],[169],[170],[171],[172],[174],[175],[176],[177],[178],[179],[180],[181],[182],[183],[184],[185],[186],[187],[188],[189],[190],[191],[192],[193],[194],[195],[196],[197],[198],[199],[200],[201],[202],[203],[204],[205],[206],[207],[208],[209],[210],[211],[212],[213],[214],[215],[216],[217],[218],[219],[220],[221],[222],[223],[224],[225],[226],[227],[228],[229],[230],[231],[232],[233],[234],[235],[236],[237],[238],[239],[240],[241],[242],[243],[244],[245],[246],[247],[248],[249],[250],[251],[252],[253],[254],[255],`\0`,``,``,``,``,``,``,`\x07`,`\b`,` `,`
|
|
34
34
|
`,`\v`,`\f`,`\r`,``,``,``,``,``,``,``,``,``,``,``,``,``,`\x1B`,``,``,``,``,` `,``,[128],[129],[130],[131],[132],[133],[134],[135],[136],[137],[138],[139],[140],[141],[142],[143],[144],[145],[146],[147],[148],[149],[150],[151],[152],[153],[154],[155],[156],[157],[158],[159],[160],[173],` `,` `,`in`,`er`,` t`,` a`,`en`,`on`,`re`,` s`,`at`,`or`,`es`,` `,`an`,` `,` d`,`he`,` c`,` p`,`is`,`ar`,`it`,`
|
|
35
35
|
|
|
36
36
|
`,`al`,[224,164],`le`,`ou`,` m`,` f`,` w`,` b`,`as`,`ing`,` the`,`ic`,`et`,` o`,`ion`,`ed`,`el`,` n`,`ro`,`ent`,[32,208],`nd`,`st`,[225,131],`а`,` l`,` in`,`;
|
|
@@ -1846,7 +1846,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1846
1846
|
|
|
1847
1847
|
`,` dépass`,`ƒ`,`פקיד`,`nera`,`เมือง`,` vaya`,` particulars`,` moreover`,` gato`,` aner`,` Hale`,`Floating`,`еқин`,`.Math`,`annual`,`_gain`,`.Infrastructure`,`.ignore`,` waits`,`wk`,` dispro`,`Tin`,` anima`,`宋`,`ذف`,` десят`,` moderation`,`截图`,`-match`,` promoción`,` vergeten`,` Providence`,`swiper`,`"י`,`amua`,`winner`,`BUILD`,`具有`,`>';`,` bilden`,` कुनै`,` Sellers`,`Innen`,`okin`,`trat`,` sega`,`-ն`,`.Contact`,` equipments`,`IPA`,`েশন`,`>Name`,`(EXIT`,` durchgeführt`,` 大发快三开奖`,`_adapter`,` aaye`,`ಬಹುದು`,`izzato`,` demolition`,` adem`,` చెందిన`,` shines`,` SECTION`,` pade`,` lifespan`,` 连`,` Hes`,` Roles`,`ASCADE`,`ngo`,` moni`,`Expansion`,`Ranking`,` வக`,`veyor`,` Sharma`,` тиг`,`(Chat`,` SCORE`,` pointe`,` मन्त`,` الدكتور`,` ტერ`,`ర్చ`,` любом`,` воспал`,` हमारी`,` alimento`,` hant`,` ministère`,` Ney`,` воздух`,` Benedict`,` advises`,` informazioni`,` garantía`,`:C`,`kert`,`etcode`,`(Enum`,`рала`,`.DATA`,`_老司机`,` теат`,` proportional`,` ગયો`,` Admir`,`ря`,` tööt`,` якая`,` Él`,`stände`,` dyr`,`imbali`,` siunners`,`১২`,` ára`,` ممت`,`Expiry`,`addir`,` neatly`,` Буд`,` ►`,`าหาร`,` hawa`,` liitty`,` капит`,` aisle`,`_character`,` Yen`,`十分`,` ഉയ`,`(hr`,` ukuth`,` Gecko`,` considerada`,` Seasons`,`quettes`,` certificado`,`utterstock`,` તાલ`,`asarkan`,`วม`,` четвер`,` שהם`,` আয়`,`েস্ক`,` onuň`,` 看`,` रखा`,` Insight`,`ديو`,`(",",`,` biased`,`ुळे`,`NBA`,`“As`,` tört`,` вокруг`,` Gad`,`.buf`,`ampang`,` incompet`,` പല`,`isque`,` 海南`,` chorus`,`nus`,` handbook`,` Ner`,` Mkuu`,` زمینه`,`sce`,` lawa`,`틀`,` incremento`,`ειτουργ`,` Risiko`,` Nationale`,` iwwer`,` ).
|
|
1848
1848
|
|
|
1849
|
-
`,`iplina`,`үүх`,`ignty`,`tracker`,` Absch`,`bett`,`adto`,` Activation`,`’l`,` conjunt`,` mounts`,`需求`,` Alleg`,`(binding`,` banget`,`)Math`,` metu`,`亚洲精品`,` имени`,` помочь`,` convierte`,` નવા`,` psychologist`,`σουμε`,` mitigation`,`Deadline`,`IRS`,`renia`,`ుతూ`,` revela`,` მიმდინ`,` آسی`,` apparaat`,` seldom`,`ऐ`,` gland`,`الش`,`;;;`,` Primer`,`ramer`,` downtime`,` דאר`,`Chunks`,`усов`,` inscription`,` kjer`,`ైత`,`đa`,` colaboradores`,` portfolios`,`ार्ट`,`ìomh`,` dropout`,`孙`,` daemon`,` ocupa`,`eterangan`,`ując`,` dirs`],
|
|
1849
|
+
`,`iplina`,`үүх`,`ignty`,`tracker`,` Absch`,`bett`,`adto`,` Activation`,`’l`,` conjunt`,` mounts`,`需求`,` Alleg`,`(binding`,` banget`,`)Math`,` metu`,`亚洲精品`,` имени`,` помочь`,` convierte`,` નવા`,` psychologist`,`σουμε`,` mitigation`,`Deadline`,`IRS`,`renia`,`ుతూ`,` revela`,` მიმდინ`,` آسی`,` apparaat`,` seldom`,`ऐ`,` gland`,`الش`,`;;;`,` Primer`,`ramer`,` downtime`,` דאר`,`Chunks`,`усов`,` inscription`,` kjer`,`ైత`,`đa`,` colaboradores`,` portfolios`,`ार्ट`,`ìomh`,` dropout`,`孙`,` daemon`,` ocupa`,`eterangan`,`ując`,` dirs`],zD=[` dew`,` сумму`,` reciente`,`.?`,` Temporary`,`Hints`,` אַלע`,` 台湾`,` aseguró`,`handlers`,` исем`,`(normal`,` Webcam`,`التالي`,` Kenny`,` შესაბამის`,` läbi`,`letso`,`核心`,` blant`,` btw`,` 少妇`,` chew`,`ალდ`,`计划网`,`’école`,` Xana`,` zase`,` Helena`,`ivariate`,`ико`,`(Field`,` unacceptable`,` probabilities`,`mynd`,` похуд`,` 활용`,`exual`,` piloto`,` complicado`,` svol`,`enciales`,` donating`,`-engine`,`("'`,`OMS`,`leton`,`анк`,` Наш`,` CLICK`,`ուք`,` 않은`,`ונת`,` юл`,` वाह`,`terminate`,`,「`,`ությունից`,` בעולם`,` аҭыԥ`,` Investor`,` Brace`,` erros`,` bree`,`yre`,`anggan`,[233,143],` payouts`,` addon`,`ัตร`,` kyllä`,` POT`,` 활동`,` ukuf`,`وين`,`ibazo`,` ])`,` Dragons`,` REALLY`,`-shop`,` DBG`,` राष्ट्रीय`,` humain`,`zyk`,`aload`,` electrons`,` فرص`,`/questions`,` მოძ`,`итов`,`ACING`,` bởi`,` per`,` overleg`,` liés`,` especializada`,` siun`,` decreto`,`:http`,`כשיו`,` Constructs`,`.IM`,`#\r
|
|
1850
1850
|
`,` хоть`,` Junk`,` gesto`,` interdisciplinary`,`ပ်`,`麦`,` Արցախ`,` creams`,`aması`,` Twig`,`ождение`,` магазин`,` cea`,` cemetery`,`>?`,`pthread`,` zacht`,`_PERIOD`,` pearl`,`-rel`,` بالح`,`loge`,`рыв`,`=?,`,`ائها`,`Kap`,` faig`,` ভাব`,`ాస్`,`"testing`,`layers`,` experiências`,` monna`,` Heel`,`ਰਾ`,`-manager`,` بشأن`,` reduzir`,` говорить`,`Elig`,` dejado`,`Monitoring`,` GTX`,`.ie`,` 据`,`ின்ன`,` serviced`,` impeccable`,`Alice`,`qb`,` concre`,`-task`,` kommune`,` ставки`,`Adapt`,` coste`,`entation`,` pares`,`-breaking`,` Tata`,` велич`,` textual`,`监听`,`-mar`,` infatti`,`ograma`,`ِي`,` وړاندې`,`ക്കാര`,`Looks`,` ceann`,` americana`,` новой`,`_STORE`,` upholstery`,` கண`,` ethnicity`,` પ્લ`,`מער`,` candidats`,`Favorites`,` વિવિધ`,`onstruk`,`Balancer`,`blica`,`varo`,`вычай`,` orchestra`,` النج`,` সংবাদ`,`ilta`,` হয়েছে`,`κρα`,` Yon`,`יאל`,`ätta`,`characters`,`appel`,`-public`,` bagaimana`,`(asset`,` kommenden`,`laag`,` comforting`,` свидетель`,` *@`,`hift`,`eteilig`,`actér`,`ہور`,`aurante`,`abulous`,` cunt`,` وغيرها`,` cooled`,` abak`,` prisoner`,` посад`,` swings`,`birds`,` Düss`,` ș`,`ასტ`,`Infinity`,` Sohn`,`จ๊ก`,` ভূ`,` vacancy`,` ANG`,` المقد`,` )(`,` jk`,` Muito`,`.python`,`орати`,` frontier`,` vode`,` organiseren`,` bumps`,`?page`,`organic`,`.cy`,`ายุ`,``,`-standing`,`-variable`,` pertenec`,` ట్ర`,`Լ`,`*****
|
|
1851
1851
|
`,` kuka`,` `,` tuổi`,`dro`,`قامة`,`議`,`Quota`,` Lange`,`samples`,`ographers`,` მთელი`,`screens`,`.drag`,`-board`,`leyo`,` dagegen`,` نقطة`,`ಲೇ`,` держав`,` sosyal`,` ਸਮ`,` svært`,` webinars`,`gard`,`гӡ`,`ordo`,` ghosts`,` Heap`,` VMware`,` احمد`,` óleo`,` Beiträge`,`_GO`,` تريد`,`jc`,` كتب`,` WK`,` Leser`,`ービ`,`otov`,` descuento`,`폭`,`日上午`,` saad`,`ोस`,` yanzu`,` Roo`,` raster`,`-written`,` ((((`,` Older`,` dnia`,` geniş`,`Hace`,` restit`,` tasi`,` ?>"><?`,`ימות`,` Notebook`,` Благ`,` Porém`,` Zusammenhang`,`_special`,`_北京pk`,` Dup`,` эки`,`izzling`,`ceptors`,` supermerc`,` congel`,` Interpret`,` ದೇಶ`,`_WORLD`,`ڪن`,` pocas`,` Techniques`,` bmp`,` Prev`,`atables`,`\(^`,`estaan`,` 자동`,` endereço`,` depan`,` словам`,` ทุก`,`.variable`,`หมาย`,`-------------</`,` сна`,` Grâce`,` مارس`,`));
|
|
1852
1852
|
|
|
@@ -3320,19 +3320,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3320
3320
|
`,` ffur`,`-All`,`Constru`,`Retrieved`,` incríveis`,` имко`,` foliga`,` Balanced`,`အသ`,` schlechten`,` αλλαγ`,` жасап`,` Sơn`,`ираи`,`ინე`,` milioane`,`EMU`,`’éviter`,` hyr`,` encontre`,` hallar`,` tablas`,`_Long`,`<Cell`,` interacted`,` figsize`,` ზღ`,` човек`,` Codigo`,` dedicação`,` stolet`,` Orten`,`Philip`,` émission`,`าหลี`,` bearbeiten`,` mierda`,`holde`,`ував`,`<Component`,` WPA`,`צילום`,`SSA`,` Allies`,` Bár`,`_mer`,`_SMS`,` घूम`,` Fixtures`,` Bask`,` 徐`,` tradução`,`blicke`,` hammered`,` сүп`,` биг`,`olução`,` electricians`,`ریشن`,` pitsaaner`,` cier`,` Receita`,`麻将`,` законодательства`,` პასუხისმგ`,`-operated`,`ൊപ്പം`,` hassles`,`ातर`,`анагара`,`נטר`,`Japgolly`,` doeleinden`,` перейти`,` temsil`,` olímp`,` Spazier`,` السما`,` pressione`,` fiscais`,`lərini`,` abode`,` tantric`,`()],`,`rello`,` зачастую`,`微软雅黑`,`سرائيلية`,` uitzending`,`flok`,` escult`,` Cerro`,` især`,` kobiet`,`uree`,`ಕೊ`,`encha`,` adhesives`,` paura`,`ッピング`,`วัย`,` names`,` slimmer`,`milk`,` કરતી`,` Cim`,` связан`,`న్`,` Chauff`,` vingers`,`ацарт`,` webcast`,`.notice`,` mặc`,`Passengers`,` פּראָדוקטן`,`аметр`,` VBA`,` развивается`,`])));
|
|
3321
3321
|
`,` surfers`,` מתאים`,`')):
|
|
3322
3322
|
`,`.apk`,`ớm`,` המז`,` brincar`,` AMOLED`,` nate`,` ayaan`,` phosphorylation`,` অপেক্ষ`,` Eats`,` Converse`,`्यूटर`,`Traveler`,`inggi`,`ורג`,` almoh`,` إفريقيا`,` Magazin`,` Arme`,`รกิจ`,` aşk`,`-lines`,` الأماكن`,`公平`,` kväll`,` mlx`,` मन्त्री`,`ავია`,` teks`,` lumea`,` legyen`,` zwing`,` boost`,` Jú`,`彩票论坛`,` дэ`,` ошибок`,`ականի`,`ฤษภาคม`,`ebwa`,` tipu`,` domini`,` Gurgaon`,`combat`,` Resist`,` रोजगार`,`strategie`,`ਗੀ`,`(locator`,`MONTH`,` atlik`,` 랜`,`السي`,` rzecz`,` Wä`,` deportivos`,` Facilit`,`-able`,` evitare`,` thong`,` 活`,`무료`,` mace`,` Extraordinary`,`धा`,` konflik`,` livelihoods`,` компонентов`,` kuitenkaan`,`幸运飞艇`,`Corpus`,` beschäd`,` דוד`,` dentant`,` nweta`,` heath`,` शुक्रबार`,` mnemonic`,`.Filters`,`','".$`,` अस्त`,`isite`,` asawa`,`年月`,` gotas`,` పనిచ`,`Dek`,` Pact`,`'agence`,`feiço`,` Böyle`,`venteen`,`notif`,` Андрей`,`多年`,`mittedly`,`財布`,` компакт`,`trk`,`न्द्रीय`,` miesto`,` Kait`,` ಬಸ`,` spec`,` Injector`,` logarith`,`entions`,` чел`,`Collateral`,` confes`,`िहर`,` sufrió`,`CRI`,` tuge`,`urllib`,` kļ`,` verpleeg`,` application's`,`(Constructor`,`ালা`,` vulputate`,` опух`,` Nordrhein`,`allage`,`ísimas`,`ornado`,`идер`,`mények`,`Qua`,` pelicula`,`성과`,`】-`,` hemi`,` touristes`,` absentee`,` Nether`,`.PAGE`,` işgär`,` efectivos`,` saav`,` `,`flashdata`,` sembler`,` ikuku`,` টাই`,` ”
|
|
3323
|
-
`,`彩票平台开户`,`旁`,`.Г`,`uckles`,` الخار`,`воль`,` невозмож`,`.gradient`,` ebile`,` Athlete`,` тұрған`,` Syrie`,`.processing`,` Consultancy`,` thrills`,`قراء`,`(varargin`,`künfte`,` 彭`,`-knit`,`riedenheit`,` tänka`,`']//`,`udies`,`hacer`,` Théâtre`,`av电影`,` Armada`,`-techn`,`ibris`,`veli`,` razloga`,`-Hop`,` מחדש`,` Bloggers`,` controversies`,` చర్య`,` പ്രമുഖ`,`_unc`,`werfen`,` лом`,` покупателей`,` глазами`,` בעוד`,` nanot`,` ws`,` кездес`,`):(`,` Produit`,`Aircraft`,`iffen`,` patrones`,` parâmetros`,`Cursos`,` cocos`],
|
|
3324
|
-
`;function
|
|
3325
|
-
`)}function
|
|
3326
|
-
${
|
|
3327
|
-
${` `.repeat(t)}}`;default:return`any`}}function
|
|
3328
|
-
`)}function
|
|
3323
|
+
`,`彩票平台开户`,`旁`,`.Г`,`uckles`,` الخار`,`воль`,` невозмож`,`.gradient`,` ebile`,` Athlete`,` тұрған`,` Syrie`,`.processing`,` Consultancy`,` thrills`,`قراء`,`(varargin`,`künfte`,` 彭`,`-knit`,`riedenheit`,` tänka`,`']//`,`udies`,`hacer`,` Théâtre`,`av电影`,` Armada`,`-techn`,`ibris`,`veli`,` razloga`,`-Hop`,` מחדש`,` Bloggers`,` controversies`,` చర్య`,` പ്രമുഖ`,`_unc`,`werfen`,` лом`,` покупателей`,` глазами`,` בעוד`,` nanot`,` ws`,` кездес`,`):(`,` Produit`,`Aircraft`,`iffen`,` patrones`,` parâmetros`,`Cursos`,` cocos`],BD=RD.concat(zD);RD.length=0,zD.length=0;var VD=1e5,HD=e=>e<=127,UD=55296,WD=56319;function GD(e){if(e.length===0)return!1;let t=e.charCodeAt(e.length-1);return t>=UD&&t<=WD}function KD(e){let t=0;for(;t<e.length;){let n=e[t],r=0,i=0;if(n<=127)r=1,i=n;else if((n&224)==192){if(r=2,i=n&31,n<=193)return!1}else if((n&240)==224)r=3,i=n&15;else if((n&248)==240){if(r=4,i=n&7,n>244)return!1}else return!1;if(t+r>e.length)return!1;for(let n=1;n<r;n++){let r=e[t+n];if(r===void 0||(r&192)!=128)return!1;i=i<<6|r&63}if(r===2&&i<128||r===3&&i<2048||r===4&&i<65536||i>=55296&&i<=57343||i>1114111)return!1;t+=r}return!0}var qD=new TextDecoder(`utf8`,{fatal:!1});function JD(e){if(KD(e))return qD.decode(e)}function YD(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e[r]!==t[r])return e[r]-t[r];return e.length-t.length}function XD(e){let t=0;return e.forEach(e=>{t=Math.max(t,e)}),t}function ZD(e){return e.replace(/[$()*+.?[\\\]^{|}]/g,`\\$&`)}function QD(e){let t=[...e].map(ZD).join(`|`);return RegExp(`(${t})`)}var $D=new Uint8Array,eO=new TextDecoder(`utf8`),tO=class{mergeableBytePairRankCount;bytePairRankDecoder;bytePairNonUtfRankDecoder=new Map;bytePairNonUtfSortedEncoder;bytePairStringRankEncoder;tokenSplitRegex;specialTokensEncoder;specialTokensDecoder;specialTokenPatternRegex;textEncoder=new TextEncoder;mergeCache;mergeCacheSize;constructor({bytePairRankDecoder:e,specialTokensEncoder:t,tokenSplitRegex:n,mergeCacheSize:r=VD}){this.bytePairRankDecoder=e,this.bytePairStringRankEncoder=new Map,this.mergeCacheSize=r,r>0&&(this.mergeCache=new Map),this.mergeableBytePairRankCount=Object.keys(e).length;let i=[];e.forEach((e,t)=>{if(typeof e==`string`){this.bytePairStringRankEncoder.set(e,t);return}let n=new Uint8Array(e);i.push([n,t]),this.bytePairNonUtfRankDecoder.set(t,n)}),this.bytePairNonUtfSortedEncoder=i.sort((e,t)=>YD(e[0],t[0])),this.specialTokensEncoder=t??new Map,this.specialTokensDecoder=t?new Map([...t].map(([e,t])=>[t,e])):new Map,this.tokenSplitRegex=n;let a=[...this.specialTokensEncoder.keys()].map(ZD).join(`|`);try{this.specialTokenPatternRegex=new RegExp(a,`y`)}catch{throw Error(`Invalid regular expression pattern.`)}}setMergeCacheSize(e){this.mergeCacheSize===0&&e>0&&(this.mergeCache=new Map),this.mergeCacheSize=e,e===0&&(this.mergeCache=void 0)}clearMergeCache(){this.mergeCache?.clear()}*encodeNativeGenerator(e,t){let n=0,r=0;for(;;){let i=this.findNextSpecialToken(e,t,n),a=i?.[0],o=a??e.length,s=n===0&&o===e.length?e:e.slice(n,o);for(let[e]of s.matchAll(this.tokenSplitRegex)){let t=this.getBpeRankFromString(e);if(t!==void 0){r=1,yield[t];continue}let n=this.bytePairEncode(e);r=n.length,yield n}if(a!==void 0){let e=i[1],t=this.specialTokensEncoder.get(e);if(t===void 0)throw Error(`Special token "${e}" is not in the special token encoder.`);yield[t],n=a+e.length,r=1}else break}return r}encodeNative(e,t){let n=0,r=[];for(;;){let i=this.findNextSpecialToken(e,t,n),a=i?.[0],o=a??e.length,s=n===0&&o===e.length?e:e.slice(n,o);for(let[e]of s.matchAll(this.tokenSplitRegex)){let t=this.getBpeRankFromString(e);if(t!==void 0){r.push(t);continue}let n=this.bytePairEncode(e);r.push(...n)}if(a!==void 0){let e=i[1],t=this.specialTokensEncoder.get(e);if(t===void 0)throw Error(`Special token "${e}" is not in the special token encoder.`);r.push(t),n=a+e.length}else break}return r}countNative(e,t){let n=0,r=0;for(;;){let i=this.findNextSpecialToken(e,t,n),a=i?.[0],o=a??e.length,s=n===0&&o===e.length?e:e.slice(n,o);for(let[e]of s.matchAll(this.tokenSplitRegex)){if(this.getBpeRankFromString(e)!==void 0){r++;continue}let t=this.bytePairEncode(e);r+=t.length}if(a!==void 0){let e=i[1];if(this.specialTokensEncoder.get(e)===void 0)throw Error(`Special token "${e}" is not in the special token encoder.`);r++,n=a+e.length}else break}return r}*decodeNativeGenerator(e){for(let t of e){let e=this.tryDecodeToken(t);e&&(yield e)}}decodeNative(e){let t=``,n=$D;for(let r of e){let e=this.tryDecodeToken(r);if(e===void 0)throw Error(`Token ${r} is not in the byte pair encoder.`);if(typeof e==`string`)n!==$D&&(t+=eO.decode(n,{stream:!0}),n=$D),t+=e;else{let t=new Uint8Array(n.length+e.length);t.set(n),t.set(e,n.length),n=t}}return n!==$D&&(t+=eO.decode(n,{stream:!0})),t}async*decodeNativeAsyncIterable(e){for await(let t of e){let e=this.tryDecodeToken(t);e&&(yield e)}}getBpeRankFromString(e){return this.bytePairStringRankEncoder.get(e)}getBpeRankFromStringOrThrow(e){let t=this.getBpeRankFromString(e);if(t===void 0)throw Error(`The byte-pair encoding does not contain a value for: ${e}`);return t}getBpeRankFromBytes(e){let t=JD(e);if(t!==void 0)return this.getBpeRankFromString(t);let n=this.binarySearch(e);if(n!==-1)return this.bytePairNonUtfSortedEncoder[n][1]}getBpeRankFromBytesOrThrow(e){let t=this.getBpeRankFromBytes(e);if(t===void 0)throw Error(`The byte-pair encoding does not contain a value for: ${e.toString()}`);return t}binarySearch(e){let t=0,n=this.bytePairNonUtfSortedEncoder.length-1;for(;t<=n;){let r=t+n>>>1,i=this.bytePairNonUtfSortedEncoder[r][0],a=0,o=Math.min(i.length,e.length);for(let t=0;t<o&&(a=i[t]-e[t],a===0);t++);if(a===0&&(a=i.length-e.length),a===0)return r;a<0?t=r+1:n=r-1}return-1}findNextSpecialToken(e,t,n){let r=n;for(;;){this.specialTokenPatternRegex.lastIndex=r;let n=this.specialTokenPatternRegex.exec(e);if(!n)return;let i=n[0];if(t?.has(i))return[n.index+r,i];r=n.index+r+1}}tryDecodeToken(e){let t=this.bytePairRankDecoder[e];if(typeof t==`string`)return t;if(typeof t==`object`){let t=this.bytePairNonUtfRankDecoder.get(e);if(t)return t}return this.specialTokensDecoder.get(e)}addToMergeCache(e,t){if(this.mergeCache){if(this.mergeCache.size>=this.mergeCacheSize){let e=this.mergeCache.keys().next().value;this.mergeCache.delete(e)}this.mergeCache.set(e,t)}}bytePairEncode(e){if(e.length===1&&HD(e.codePointAt(0)))return[this.getBpeRankFromStringOrThrow(e)];if(this.mergeCache?.has(e)){let t=this.mergeCache.get(e);return this.mergeCache.delete(e),this.mergeCache.set(e,t),t}let t=this.textEncoder.encode(e),n=this.bytePairMerge(t);return this.addToMergeCache(e,n),n}bytePairMerge(e){let t=[],n=[],r=(n,r=t[n],i=t[n+2])=>{if(i===void 0)return 1/0;let a=e.subarray(r,i);return this.getBpeRankFromBytes(a)??1/0};for(let i=0;i<=e.length;i++)t.push(i),i<e.length-1?n.push(r(i,i,i+2)):n.push(1/0);for(;t.length>1;){let e=1/0,i=-1;for(let t=0;t<n.length-1;t++){let r=n[t];r<e&&(e=r,i=t)}if(e===1/0||i===-1)break;t.splice(i+1,1),n.splice(i,1),n[i]=r(i),i>0&&(n[i-1]=r(i-1))}let i=[];for(let n=0;n<t.length-1;n++){let r=t[n],a=t[n+1],o=this.getBpeRankFromBytesOrThrow(e.subarray(r,a));i.push(o)}return i}},nO=`
|
|
3324
|
+
`;function rO(e,t){let n=0;if(e.role&&(n+=t(e.role)),e.content&&(n+=t(e.content)),e.name&&(n+=t(e.name)+1),e.function_call){let{name:r,arguments:i}=e.function_call;r&&(n+=t(r)),i&&(n+=t(i)),n+=3}return n+=3,e.role===`function`&&(n-=2),n}function iO(e,t,n){if(!e.properties)return``;let r=[],i=new Set(e.required??[]),a=` `.repeat(t);for(let[o,s]of Object.entries(e.properties)){s.description&&t<2&&r.push(`${a}// ${s.description}`);let e=i.has(o),c=n(s,t);r.push(`${a}${o}${e?``:`?`}: ${c},`)}return r.join(`
|
|
3325
|
+
`)}function aO(e,t){switch(e.type){case`string`:return e.enum?.map(e=>JSON.stringify(e)).join(` | `)??`string`;case`integer`:case`number`:return e.enum?.map(e=>`${e}`).join(` | `)??`number`;case`boolean`:return`boolean`;case`null`:return`null`;case`array`:return e.items?`${aO(e.items,t)}[]`:`any[]`;case`object`:return`{
|
|
3326
|
+
${iO(e,t+2,aO)}
|
|
3327
|
+
${` `.repeat(t)}}`;default:return`any`}}function oO(e){let t=[`namespace functions {`,``];for(let n of e){n.description&&t.push(`// ${n.description}`);let{parameters:e}=n,r=e?.properties;if(!e||!r||Object.keys(r).length===0)t.push(`type ${n.name} = () => any;`);else{t.push(`type ${n.name} = (_: {`);let r=iO(e,0,aO);r.length>0&&t.push(r),t.push(`}) => any;`)}t.push(``)}return t.push(`} // namespace functions`),t.join(`
|
|
3328
|
+
`)}function sO(e,t){let n=t(oO(e));return n+=9,n}function cO(e,t,n){return!t||n||e.role!==`system`||!e.content||e.content.endsWith(nO)?e:{...e,content:`${e.content}${nO}`}}function lO(e,t){let{messages:n,functions:r,function_call:i}=e,a=!!(r&&r.length>0),o=!1,s=0;for(let e of n){let n=cO(e,a,o);(n!==e&&e.role===`system`||e.role===`system`&&a&&!o)&&(o=!0),s+=rO(n,t)}return s+=3,a&&r&&(s+=sO(r,t),n.some(e=>e.role===`system`)&&(s-=4)),i&&i!==`auto`&&(i===`none`?s+=1:typeof i==`object`&&i.name&&(s+=t(i.name)+4)),s}var uO=`chatgpt-4o-latest,codex-mini-latest,computer-use-preview,computer-use-preview-2025-03-11,gpt-3.5,gpt-3.5-0301,gpt-3.5-turbo,gpt-3.5-turbo-0125,gpt-3.5-turbo-0613,gpt-3.5-turbo-1106,gpt-3.5-turbo-16k-0613,gpt-3.5-turbo-instruct,gpt-4,gpt-4-0125-preview,gpt-4-0314,gpt-4-0613,gpt-4-1106-preview,gpt-4-1106-vision-preview,gpt-4-32k,gpt-4-turbo,gpt-4-turbo-2024-04-09,gpt-4-turbo-preview,gpt-4.1,gpt-4.1-2025-04-14,gpt-4.1-mini,gpt-4.1-mini-2025-04-14,gpt-4.1-nano,gpt-4.1-nano-2025-04-14,gpt-4.5-preview,gpt-4.5-preview-2025-02-27,gpt-4o,gpt-4o-2024-05-13,gpt-4o-2024-08-06,gpt-4o-2024-11-20,gpt-4o-audio-preview,gpt-4o-audio-preview-2024-10-01,gpt-4o-audio-preview-2024-12-17,gpt-4o-audio-preview-2025-06-03,gpt-4o-mini,gpt-4o-mini-2024-07-18,gpt-4o-mini-audio-preview,gpt-4o-mini-audio-preview-2024-12-17,gpt-4o-mini-search-preview,gpt-4o-mini-search-preview-2025-03-11,gpt-4o-search-preview,gpt-4o-search-preview-2025-03-11,gpt-5,gpt-5-2025-08-07,gpt-5-chat-latest,gpt-5-codex,gpt-5-mini,gpt-5-mini-2025-08-07,gpt-5-nano,gpt-5-nano-2025-08-07,gpt-5-pro,gpt-5-pro-2025-10-06,gpt-audio,gpt-audio-2025-08-28,gpt-audio-mini,gpt-audio-mini-2025-10-06,gpt-oss-120b,gpt-oss-20b,o1,o1-2024-12-17,o1-mini,o1-mini-2024-09-12,o1-preview,o1-preview-2024-09-12,o1-pro,o1-pro-2025-03-19,o3,o3-2025-04-16,o3-deep-research,o3-deep-research-2025-06-26,o3-mini,o3-mini-2025-01-31,o3-pro,o3-pro-2025-06-10,o4-mini,o4-mini-2025-04-16,o4-mini-deep-research,o4-mini-deep-research-2025-06-26`.split(`,`),dO=t({cl100k_base:()=>hO,o200k_base:()=>gO,o200k_harmony:()=>_O,p50k_base:()=>fO,p50k_edit:()=>mO,r50k_base:()=>pO}),fO=[`text-davinci-002`,`text-davinci-003`,`code-davinci-001`,`code-davinci-002`,`davinci-codex`,`code-cushman-001`,`code-cushman-002`,`cushman-codex`],pO=[`text-ada-001`,`text-babbage-001`,`text-curie-001`,`text-davinci-001`,`ada`,`babbage`,`curie`,`davinci`,`code-search-ada-code-001`,`code-search-ada-text-001`,`text-similarity-ada-001`,`text-search-ada-doc-001`,`text-search-ada-query-001`,`text-similarity-babbage-001`,`text-search-babbage-doc-001`,`text-search-babbage-query-001`,`code-search-babbage-code-001`,`code-search-babbage-text-001`,`text-similarity-curie-001`,`text-search-curie-doc-001`,`text-search-curie-query-001`,`text-similarity-davinci-001`,`text-search-davinci-doc-001`,`text-search-davinci-query-001`],mO=[`code-davinci-edit-001`,`text-davinci-edit-001`],hO=[`gpt-3.5`,`gpt-3.5-0301`,`gpt-3.5-turbo`,`gpt-3.5-turbo-0125`,`gpt-3.5-turbo-0613`,`gpt-3.5-turbo-1106`,`gpt-3.5-turbo-16k-0613`,`gpt-3.5-turbo-instruct`,`gpt-4`,`gpt-4-0125-preview`,`gpt-4-0314`,`gpt-4-0613`,`gpt-4-1106-preview`,`gpt-4-1106-vision-preview`,`gpt-4-32k`,`gpt-4-turbo`,`gpt-4-turbo-2024-04-09`,`gpt-4-turbo-preview`,`text-embedding-3-large`,`text-embedding-3-small`,`text-embedding-ada-002`,`babbage-002`,`davinci-002`],gO=[],_O=[`gpt-oss-20b`,`gpt-oss-120b`],vO=`<|endoftext|>`,yO=`<|fim_prefix|>`,bO=`<|fim_middle|>`,xO=`<|fim_suffix|>`,SO=`<|im_start|>`,CO=`<|im_end|>`,wO=`<|im_sep|>`,TO=`<|endofprompt|>`,EO=`<|startoftext|>`,DO=`<|start|>`,OO=`<|end|>`,kO=`<|message|>`,AO=`<|channel|>`,jO=`<|return|>`,MO=`<|constrain|>`,NO=`<|call|>`,PO=Object.fromEntries(Object.entries(dO).flatMap(([e,t])=>t.map(t=>[t,e]))),FO={messageSeparator:`
|
|
3329
3329
|
`,roleSeparator:`
|
|
3330
|
-
`},FO={messageSeparator:``,roleSeparator:CO},IO=Object.fromEntries(lO.flatMap(e=>e.startsWith(`gpt-3.5`)?[[e,PO]]:[[e,FO]])),LO=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,RO=String.raw`'(?:[sS]|[dD]|[mM]|[tT]|[lL][lL]|[vV][eE]|[rR][eE])`,zO=String.raw`(?:${RO})?`,BO=String.raw`${RO}|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s+$|\s*[\r\n]|\s+(?!\S)|\s`,VO=new RegExp(BO,`gu`),HO=String.raw`[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]*[\p{Ll}\p{Lm}\p{Lo}\p{M}]+${zO}|[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]+[\p{Ll}\p{Lm}\p{Lo}\p{M}]*${zO}|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n/]*|\s*[\r\n]+|\s+(?!\S)|\s+`,UO=new RegExp(HO,`gu`);function WO(e){return{tokenSplitRegex:VO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[_O,100257],[vO,100258],[yO,100259],[bO,100260],[xO,100264],[SO,100265],[CO,100266],[wO,100276]])}}var GO=[[_O,199999],[vO,2e5],[yO,200001],[bO,200002],[xO,200003],[SO,200004],[CO,200005],[wO,200006]],KO=()=>new Map(GO);function qO(e){return{tokenSplitRegex:UO,bytePairRankDecoder:e,specialTokensEncoder:KO()}}var JO=200013,YO=201088,XO=[[TO,199998],[_O,199999],[`<|reserved_200000|>`,2e5],[`<|reserved_200001|>`,200001],[AO,200002],[jO,200003],[`<|reserved_200004|>`,200004],[kO,200005],[EO,200006],[DO,200007],[OO,200008],[`<|reserved_200009|>`,200009],[`<|reserved_200010|>`,200010],[`<|reserved_200011|>`,200011],[MO,200012]];function ZO(e){let t=new Map(XO);for(let e=JO;e<YO;e+=1)t.set(`<|reserved_${e}|>`,e);return t.set(wO,200018),{tokenSplitRegex:UO,bytePairRankDecoder:e,specialTokensEncoder:t,chatFormatter:`harmony`}}function QO(e){return{expectedVocabularySize:50281,tokenSplitRegex:LO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[_O,50256]])}}function $O(e){return{tokenSplitRegex:LO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[_O,50256],[vO,50281],[yO,50282],[bO,50283]])}}function ek(e){return{expectedVocabularySize:50257,tokenSplitRegex:LO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[_O,50256]])}}function tk(e,t){let n=t(e);switch(e.toLowerCase()){case`r50k_base`:return ek(n);case`p50k_base`:return QO(n);case`p50k_edit`:return $O(n);case`cl100k_base`:return WO(n);case`o200k_base`:return qO(n);case`o200k_harmony`:return ZO(n);default:throw Error(`Unknown encoding name: ${e}`)}}var{decode:nk,decodeAsyncGenerator:rk,decodeGenerator:ik,encode:ak,encodeGenerator:ok,isWithinTokenLimit:sk,countTokens:ck,encodeChat:lk,encodeChatGenerator:uk,vocabularySize:dk,setMergeCacheSize:fk,clearMergeCache:pk,estimateCost:mk}=class e{static EndOfPrompt=wO;static EndOfText=_O;static FimMiddle=yO;static FimPrefix=vO;static FimSuffix=bO;modelName;modelSpec;bytePairEncodingCoreProcessor;specialTokensEncoder;specialTokensSet;allSpecialTokenRegex;defaultSpecialTokenConfig;chatFormatter;countChatCompletionTokens;vocabularySize;constructor({bytePairRankDecoder:e,specialTokensEncoder:t,expectedVocabularySize:n,modelName:r,modelSpec:i,chatFormatter:a,...o}){this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=ZD(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new eO({bytePairRankDecoder:e,specialTokensEncoder:t,...o}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let s=Math.max(e.length-1,YD(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,n!==void 0){if(this.vocabularySize!==n)throw Error(`The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.`);if(s!==n-1)throw Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${s}, expected ${n-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),i?.supported_features?.includes(`function_calling`)&&(this.countChatCompletionTokens=this.countChatCompletionTokensInternal.bind(this)),this.modelName=r,this.modelSpec=i,this.chatFormatter=a??`chatml`}*encodeHarmonyChatGenerator(e,t){let n=this.specialTokensEncoder.get(EO),r=this.specialTokensEncoder.get(OO),i=this.specialTokensEncoder.get(DO),a=this.specialTokensEncoder.get(AO),o=this.specialTokensEncoder.get(MO),s=this.specialTokensEncoder.get(kO),c=this.specialTokensEncoder.get(jO);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||c===void 0)throw Error(`Harmony chat format requires dedicated special tokens.`);let l=e=>e.length>0?this.encode(e):[],u=e=>{switch(e){case`<|return|>`:return a;case`<|call|>`:return o;default:return i}};for(let i of e){if(i.content===void 0)throw Error(`Content must be defined for all messages.`);let e=i.name??i.role??`user`;yield[n],yield l(e);let a=i.recipient&&(i.recipientPlacement===`role`||!i.channel),o=i.recipient&&!a;a&&(yield l(` to=${i.recipient}`)),i.channel&&(yield[s],yield l(i.channel),o&&(yield l(` to=${i.recipient}`))),i.constraint&&(yield[c],yield l(i.constraint)),yield[r],yield*this.encodeGenerator(i.content,t),yield[u(i.terminator)]}let d=t?.primeWithAssistantResponse??`assistant`;d.length>0&&(yield[n],yield l(d))}static getEncodingApi(t,n){let r=tk(t,n);return new e(r)}static getEncodingApiForModel(t,n,r){let i=tk(NO[t]??`o200k_base`,n);return new e({...i,modelName:t,modelSpec:r})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:t}={}){let n;if(e===`all`||e?.has(`all`)){e=new Set(this.specialTokensSet);let n=e;if(t===`all`)throw Error(`allowedSpecial and disallowedSpecial cannot both be set to "all".`);typeof t==`object`?t.forEach(e=>n.delete(e)):t=new Set}if(!t||t===`all`||t.has(`all`)){t=new Set(this.specialTokensSet);let r=t;e?.size?(e.forEach(e=>r.delete(e)),t.forEach(t=>e.delete(t)),t.size>0&&(n=ZD(t))):n=this.allSpecialTokenRegex}return{allowedSpecial:e,regexPattern:n}}encodeGenerator(e,t){let n=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(n.regexPattern){let t=e.match(n.regexPattern);if(t!==null)throw Error(`Disallowed special token found: ${t[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(e,n.allowedSpecial)}encode(e,t){let n=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(n.regexPattern){let t=e.match(n.regexPattern);if(t!==null)throw Error(`Disallowed special token found: ${t[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(e,n.allowedSpecial)}*encodeChatGenerator(e,t=this.modelName,n){if(!t)throw Error(`Model name must be provided either during initialization or passed in to the method.`);let r=IO[t];if(!r)throw Error(`Model '${t}' does not support chat.`);if(this.chatFormatter===`harmony`){yield*this.encodeHarmonyChatGenerator(e,n);return}let i=this.specialTokensEncoder.get(xO),a=this.specialTokensEncoder.get(SO);if(i===void 0||a===void 0)throw Error(`Model '${t}' does not support chat.`);let o=new Set([CO]),{messageSeparator:s,roleSeparator:c}=r,l=s.length>0?this.encode(s):[],u=c.length>0?this.encode(c,{allowedSpecial:o}):[],d=new Map;for(let{role:t=`system`,name:r=t,content:o}of e){if(o===void 0)throw Error(`Content must be defined for all messages.`);yield[i];let e=d.get(r)??this.encode(r);d.set(r,e),yield e,u.length>0&&(yield u),yield*this.encodeGenerator(o,n),yield[a],yield l}let f=n?.primeWithAssistantResponse??`assistant`;f.length>0&&(yield[i],yield*this.encodeGenerator(f,n)),u.length>0&&(yield u)}encodeChat(e,t=this.modelName,n){return[...this.encodeChatGenerator(e,t,n)].flat()}isWithinTokenLimit(e,t,n){let r=typeof e==`string`?this.encodeGenerator(e,n):this.encodeChatGenerator(e,void 0,n),i=0;for(let e of r)if(i+=e.length,i>t)return!1;return i}countTokens(e,t){if(typeof e==`string`){let n=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(n.regexPattern){let t=e.match(n.regexPattern);if(t!==null)throw Error(`Disallowed special token found: ${t[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(e,n.allowedSpecial)}let n=this.encodeChatGenerator(e,void 0,t),r=0;for(let e of n)r+=e.length;return r}countStringTokens(e){return e?this.bytePairEncodingCoreProcessor.countNative(e):0}countChatCompletionTokensInternal(e){return cO(e,e=>this.countStringTokens(e))}setMergeCacheSize(e){this.bytePairEncodingCoreProcessor.setMergeCacheSize(e)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(e){return this.bytePairEncodingCoreProcessor.decodeNative(e)}*decodeGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(e),n=``;for(let e of t)n+=typeof e==`string`?e:$D.decode(e,{stream:!0}),!(n.length===0||WD(n))&&(yield n,n=``);n.length>0&&(yield n)}async*decodeAsyncGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n=``;for await(let e of t)n+=typeof e==`string`?e:$D.decode(e,{stream:!0}),!(n.length===0||WD(n))&&(yield n,n=``);n.length>0&&(yield n)}async decodeAsync(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n=``;for await(let e of t)n+=typeof e==`string`?e:$D.decode(e,{stream:!0});return n}estimateCost(e,t=this.modelSpec){if(!t)throw Error(`Model spec must be provided either during initialization or passed in to the method.`);if(!t.price_data)throw Error(`No cost information available for model: ${t.name}`);let n=t.price_data,r={},i=e/1e6;return n.main&&(r.main={input:n.main.input&&n.main.input*i,output:n.main.output&&n.main.output*i,cached_input:n.main.cached_input&&n.main.cached_input*i,cached_output:n.main.cached_output&&n.main.cached_output*i}),n.batch&&(r.batch={input:n.batch.input&&n.batch.input*i,output:n.batch.output&&n.batch.output*i,cached_input:n.batch.cached_input&&n.batch.cached_input*i,cached_output:n.batch.cached_output&&n.batch.cached_output*i}),r}}.getEncodingApi(`o200k_base`,()=>zD),hk=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);!gk(i,a)&&r||Object.defineProperty(e,n,a)},gk=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},_k=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},vk=(e,t)=>`/* Wrapped ${e}*/\n${t}`,yk=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),bk=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),xk=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=vk.bind(null,r,t.toString());Object.defineProperty(i,"name",bk);let{writable:a,enumerable:o,configurable:s}=yk;Object.defineProperty(e,"toString",{value:i,writable:a,enumerable:o,configurable:s})};function Sk(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))hk(e,t,r,n);return _k(e,t),xk(e,t,r),e}var Ck=new WeakMap;function wk(e,t){let n=([e])=>e,{cacheKey:r=n,cache:i=new Map}=t??{},a=new Map,o=function(...n){let o=r(n);if(a.has(o))return a.get(o);let s=(async()=>{try{if(i&&await i.has(o))return await i.get(o);let r=await e.apply(this,n);try{return r}finally{i&&(!t?.shouldCache||await t.shouldCache(r,{key:o,argumentsList:n}))&&await i.set(o,r)}}finally{a.delete(o)}})();return a.set(o,s),s};return Sk(o,e,{ignoreNonConfigurable:!0}),Ck.set(o,i),o}var Tk=a(((e,t)=>{(function(n,r){typeof i==`function`&&typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(function(){return r()}):n.pluralize=r()})(e,function(){var e=[],t=[],n={},r={},i={};function a(e){return typeof e==`string`?RegExp(`^`+e+`$`,`i`):e}function o(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t){return e.replace(/\$(\d{1,2})/g,function(e,n){return t[n]||``})}function c(e,t){return e.replace(t[0],function(n,r){var i=s(t[1],arguments);return o(n===``?e[r-1]:n,i)})}function l(e,t,r){if(!e.length||n.hasOwnProperty(e))return t;for(var i=r.length;i--;){var a=r[i];if(a[0].test(t))return c(t,a)}return t}function u(e,t,n){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?o(r,i):e.hasOwnProperty(i)?o(r,e[i]):l(i,r,n)}}function d(e,t,n,r){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?!0:!e.hasOwnProperty(i)&&l(i,i,n)===i}}function f(e,t,n){var r=t===1?f.singular(e):f.plural(e);return(n?t+` `:``)+r}return f.plural=u(i,r,e),f.isPlural=d(i,r,e),f.singular=u(r,i,t),f.isSingular=d(r,i,t),f.addPluralRule=function(t,n){e.push([a(t),n])},f.addSingularRule=function(e,n){t.push([a(e),n])},f.addUncountableRule=function(e){if(typeof e==`string`){n[e.toLowerCase()]=!0;return}f.addPluralRule(e,`$0`),f.addSingularRule(e,`$0`)},f.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,r[t]=e},[[`I`,`we`],[`me`,`us`],[`he`,`they`],[`she`,`they`],[`them`,`them`],[`myself`,`ourselves`],[`yourself`,`yourselves`],[`itself`,`themselves`],[`herself`,`themselves`],[`himself`,`themselves`],[`themself`,`themselves`],[`is`,`are`],[`was`,`were`],[`has`,`have`],[`this`,`these`],[`that`,`those`],[`echo`,`echoes`],[`dingo`,`dingoes`],[`volcano`,`volcanoes`],[`tornado`,`tornadoes`],[`torpedo`,`torpedoes`],[`genus`,`genera`],[`viscus`,`viscera`],[`stigma`,`stigmata`],[`stoma`,`stomata`],[`dogma`,`dogmata`],[`lemma`,`lemmata`],[`schema`,`schemata`],[`anathema`,`anathemata`],[`ox`,`oxen`],[`axe`,`axes`],[`die`,`dice`],[`yes`,`yeses`],[`foot`,`feet`],[`eave`,`eaves`],[`goose`,`geese`],[`tooth`,`teeth`],[`quiz`,`quizzes`],[`human`,`humans`],[`proof`,`proofs`],[`carve`,`carves`],[`valve`,`valves`],[`looey`,`looies`],[`thief`,`thieves`],[`groove`,`grooves`],[`pickaxe`,`pickaxes`],[`passerby`,`passersby`]].forEach(function(e){return f.addIrregularRule(e[0],e[1])}),[[/s?$/i,`s`],[/[^\u0000-\u007F]$/i,`$0`],[/([^aeiou]ese)$/i,`$1`],[/(ax|test)is$/i,`$1es`],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,`$1es`],[/(e[mn]u)s?$/i,`$1s`],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,`$1`],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,`$1i`],[/(alumn|alg|vertebr)(?:a|ae)$/i,`$1ae`],[/(seraph|cherub)(?:im)?$/i,`$1im`],[/(her|at|gr)o$/i,`$1oes`],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,`$1a`],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,`$1a`],[/sis$/i,`ses`],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,`$1$2ves`],[/([^aeiouy]|qu)y$/i,`$1ies`],[/([^ch][ieo][ln])ey$/i,`$1ies`],[/(x|ch|ss|sh|zz)$/i,`$1es`],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,`$1ices`],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,`$1ice`],[/(pe)(?:rson|ople)$/i,`$1ople`],[/(child)(?:ren)?$/i,`$1ren`],[/eaux$/i,`$0`],[/m[ae]n$/i,`men`],[`thou`,`you`]].forEach(function(e){return f.addPluralRule(e[0],e[1])}),[[/s$/i,``],[/(ss)$/i,`$1`],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,`$1fe`],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,`$1f`],[/ies$/i,`y`],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,`$1ie`],[/\b(mon|smil)ies$/i,`$1ey`],[/\b((?:tit)?m|l)ice$/i,`$1ouse`],[/(seraph|cherub)im$/i,`$1`],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,`$1`],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,`$1sis`],[/(movie|twelve|abuse|e[mn]u)s$/i,`$1`],[/(test)(?:is|es)$/i,`$1is`],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,`$1us`],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,`$1um`],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,`$1on`],[/(alumn|alg|vertebr)ae$/i,`$1a`],[/(cod|mur|sil|vert|ind)ices$/i,`$1ex`],[/(matr|append)ices$/i,`$1ix`],[/(pe)(rson|ople)$/i,`$1rson`],[/(child)ren$/i,`$1`],[/(eau)x?$/i,`$1`],[/men$/i,`man`]].forEach(function(e){return f.addSingularRule(e[0],e[1])}),[`adulthood`,`advice`,`agenda`,`aid`,`aircraft`,`alcohol`,`ammo`,`analytics`,`anime`,`athletics`,`audio`,`bison`,`blood`,`bream`,`buffalo`,`butter`,`carp`,`cash`,`chassis`,`chess`,`clothing`,`cod`,`commerce`,`cooperation`,`corps`,`debris`,`diabetes`,`digestion`,`elk`,`energy`,`equipment`,`excretion`,`expertise`,`firmware`,`flounder`,`fun`,`gallows`,`garbage`,`graffiti`,`hardware`,`headquarters`,`health`,`herpes`,`highjinks`,`homework`,`housework`,`information`,`jeans`,`justice`,`kudos`,`labour`,`literature`,`machinery`,`mackerel`,`mail`,`media`,`mews`,`moose`,`music`,`mud`,`manga`,`news`,`only`,`personnel`,`pike`,`plankton`,`pliers`,`police`,`pollution`,`premises`,`rain`,`research`,`rice`,`salmon`,`scissors`,`series`,`sewage`,`shambles`,`shrimp`,`software`,`species`,`staff`,`swine`,`tennis`,`traffic`,`transportation`,`trout`,`tuna`,`wealth`,`welfare`,`whiting`,`wildebeest`,`wildlife`,`you`,/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(f.addUncountableRule),f})})),Ek=a(((e,t)=>{function n(e){return e=String(e),e&&e.toLowerCase()}n.isLowercase=function(e){return e&&!/[A-Z]+/.test(e)},t.exports=n})),Dk=a(((e,t)=>{function n(e){return e=String(e),e&&e.toUpperCase()}n.isUppercase=function(e){return e&&!/[a-z]+/.test(e)},t.exports=n})),Ok=a(((e,t)=>{var n=Ek(),r=Dk(),i={from:/[\-_:\.\s]([a-zA-Z])([a-zA-Z]*)/g,to:function(e,t,n,i,a){return t.length,r(t)+n}};function a(e){return a.isCamelcase(e)||(e=String(e).replace(/^[\-_:\.\s]/,``),!e)?e:(r.isUppercase(e)&&(e=n(e)),n(e[0])+e.replace(i.from,i.to).slice(1).replace(/^([A-Z]+)([A-Z])/,function(e,t,r){return n(t)+r}))}a.isCamelcase=function(e){return e&&/^[a-zA-Z]+$/.test(e)&&n(e[0])===e[0]},t.exports=a})),kk=a(((e,t)=>{var n=Dk();function r(e){return e=String(e),e&&n(e[0])+e.slice(1)}t.exports=r})),Ak=a(((e,t)=>{var n=Ek(),r=Dk(),i=`_`,a={from:/([A-Z]+)/g,to:function(e,t,a,o){var s=a===0?``:i,c=t.length;if(c===1)return s+n(t);var l=o.slice(a+t.length);return r.isUppercase(t)&&l[0]===i?s+n(t):s+(n(t.substr(0,c-1))+i+n(t[c-1]))}};function o(e){return o.isSnakecase(e)||(e=String(e).replace(/[\-.:\s]/g,i),!e)?e:(r.isUppercase(e)&&(e=n(e)),e.replace(a.from,a.to).replace(/_+/g,`_`))}o.isSnakecase=function(e){return e&&/^[a-z_]+$/.test(e)},t.exports=o})),jk=a(((e,t)=>{var n=Dk(),r=Ak();function i(e){return i.isConstcase(e)?e:n(r(e))}i.isConstcase=function(e){return e&&/^[A-Z_]+$/.test(e)},t.exports=i})),Mk=a(((e,t)=>{var n=Ak();function r(e){return n(e).replace(/_/g,``)}t.exports=r})),Nk=a(((e,t)=>{var n=Ek();function r(e){return e=String(e),e&&n(e[0])+e.slice(1)}t.exports=r})),Pk=a(((e,t)=>{var n=Ak();function r(e){return n(e).replace(/_/g,`.`)}t.exports=r})),Fk=a(((e,t)=>{var n=Ak();function r(e){return n(e).replace(/_/g,`:`)}t.exports=r})),Ik=a(((e,t)=>{var n=Ok(),r=kk();function i(e){return r(n(e))}t.exports=i})),Lk=a(((e,t)=>{var n=Ak();function r(e){return n(e).replace(/_/g,`/`)}t.exports=r})),Rk=a(((e,t)=>{function n(e){return String(e).trim()}t.exports=n})),zk=a(((e,t)=>{Ek();var n=Rk(),r=Ak(),i=kk(),a=` `;function o(e){return e=String(e).replace(/^[\-_\.\s]/g,a),e&&i(r(n(e)).replace(/_/g,a))}t.exports=o})),Bk=a(((e,t)=>{var n=Ak();function r(e){return n(e).replace(/_/g,` `)}t.exports=r})),Vk=a(((e,t)=>{var n=Ak();function r(e){return n(e).replace(/_/g,`-`)}t.exports=r})),Hk=a(((e,t)=>{var n=Ak(),r=Ek(),i=Rk(),a=kk(),o=`a,the,and,or,not,but,for,of`.split(`,`);function s(e){return n(e).split(/_/g).map(i).map(function(e){return~o.indexOf(e)?r(e):a(e)}).join(` `)}t.exports=s})),Uk=a(((e,t)=>{var n=Ok(),r=kk(),i=jk(),a=Mk(),o=Nk(),s=Pk(),c=Fk(),l=Ek(),u=Ik(),d=Lk(),f=zk(),p=Ak(),m=Bk(),h=Vk(),g=Hk(),_=Rk(),v=Dk();e.camelcase=n,e.capitalcase=r,e.constcase=i,e.cramcase=a,e.decapitalcase=o,e.dotcase=s,e.enumcase=c,e.lowercase=l,e.pascalcase=u,e.pathcase=d,e.sentencecase=f,e.snakecase=p,e.spacecase=m,e.spinalcase=h,e.titlecase=g,e.trimcase=_,e.uppercase=v,t.exports={camelcase:n,capitalcase:r,constcase:i,cramcase:a,decapitalcase:o,dotcase:s,enumcase:c,lowercase:l,pascalcase:u,pathcase:d,sentencecase:f,snakecase:p,spacecase:m,spinalcase:h,titlecase:g,trimcase:_,uppercase:v}}));Tk(),Uk();function Wk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Wk(Object(n),!0).forEach(function(t){Kk(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wk(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kk(e,t,n){return t=qk(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qk(e){var t=Jk(e,`string`);return typeof t==`symbol`?t:String(t)}function Jk(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Yk=Xk({});function Xk(e){return t.withOptions=t=>Xk(Gk(Gk({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Zk(n[e],s):n[e];s+=t}}let c=s.split(`
|
|
3330
|
+
`},IO={messageSeparator:``,roleSeparator:wO},LO=Object.fromEntries(uO.flatMap(e=>e.startsWith(`gpt-3.5`)?[[e,FO]]:[[e,IO]])),RO=/'s|'t|'re|'ve|'m|'ll|'d| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+/gu,zO=String.raw`'(?:[sS]|[dD]|[mM]|[tT]|[lL][lL]|[vV][eE]|[rR][eE])`,BO=String.raw`(?:${zO})?`,VO=String.raw`${zO}|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]*|\s+$|\s*[\r\n]|\s+(?!\S)|\s`,HO=new RegExp(VO,`gu`),UO=String.raw`[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]*[\p{Ll}\p{Lm}\p{Lo}\p{M}]+${BO}|[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]+[\p{Ll}\p{Lm}\p{Lo}\p{M}]*${BO}|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n/]*|\s*[\r\n]+|\s+(?!\S)|\s+`,WO=new RegExp(UO,`gu`);function GO(e){return{tokenSplitRegex:HO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[vO,100257],[yO,100258],[bO,100259],[xO,100260],[SO,100264],[CO,100265],[wO,100266],[TO,100276]])}}var KO=[[vO,199999],[yO,2e5],[bO,200001],[xO,200002],[SO,200003],[CO,200004],[wO,200005],[TO,200006]],qO=()=>new Map(KO);function JO(e){return{tokenSplitRegex:WO,bytePairRankDecoder:e,specialTokensEncoder:qO()}}var YO=200013,XO=201088,ZO=[[EO,199998],[vO,199999],[`<|reserved_200000|>`,2e5],[`<|reserved_200001|>`,200001],[jO,200002],[MO,200003],[`<|reserved_200004|>`,200004],[AO,200005],[DO,200006],[OO,200007],[kO,200008],[`<|reserved_200009|>`,200009],[`<|reserved_200010|>`,200010],[`<|reserved_200011|>`,200011],[NO,200012]];function QO(e){let t=new Map(ZO);for(let e=YO;e<XO;e+=1)t.set(`<|reserved_${e}|>`,e);return t.set(TO,200018),{tokenSplitRegex:WO,bytePairRankDecoder:e,specialTokensEncoder:t,chatFormatter:`harmony`}}function $O(e){return{expectedVocabularySize:50281,tokenSplitRegex:RO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[vO,50256]])}}function ek(e){return{tokenSplitRegex:RO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[vO,50256],[yO,50281],[bO,50282],[xO,50283]])}}function tk(e){return{expectedVocabularySize:50257,tokenSplitRegex:RO,bytePairRankDecoder:e,specialTokensEncoder:new Map([[vO,50256]])}}function nk(e,t){let n=t(e);switch(e.toLowerCase()){case`r50k_base`:return tk(n);case`p50k_base`:return $O(n);case`p50k_edit`:return ek(n);case`cl100k_base`:return GO(n);case`o200k_base`:return JO(n);case`o200k_harmony`:return QO(n);default:throw Error(`Unknown encoding name: ${e}`)}}var{decode:rk,decodeAsyncGenerator:ik,decodeGenerator:ak,encode:ok,encodeGenerator:sk,isWithinTokenLimit:ck,countTokens:lk,encodeChat:uk,encodeChatGenerator:dk,vocabularySize:fk,setMergeCacheSize:pk,clearMergeCache:mk,estimateCost:hk}=class e{static EndOfPrompt=TO;static EndOfText=vO;static FimMiddle=bO;static FimPrefix=yO;static FimSuffix=xO;modelName;modelSpec;bytePairEncodingCoreProcessor;specialTokensEncoder;specialTokensSet;allSpecialTokenRegex;defaultSpecialTokenConfig;chatFormatter;countChatCompletionTokens;vocabularySize;constructor({bytePairRankDecoder:e,specialTokensEncoder:t,expectedVocabularySize:n,modelName:r,modelSpec:i,chatFormatter:a,...o}){this.specialTokensEncoder=t,this.specialTokensSet=new Set(this.specialTokensEncoder.keys()),this.allSpecialTokenRegex=QD(this.specialTokensSet),this.bytePairEncodingCoreProcessor=new tO({bytePairRankDecoder:e,specialTokensEncoder:t,...o}),this.defaultSpecialTokenConfig=this.processSpecialTokens();let s=Math.max(e.length-1,XD(t));if(this.vocabularySize=this.bytePairEncodingCoreProcessor.mergeableBytePairRankCount+t.size,n!==void 0){if(this.vocabularySize!==n)throw Error(`The number of mergeable tokens and special tokens must be equal to expectedVocabularySize.`);if(s!==n-1)throw Error(`The model encodings are invalid. The maximum token value must be equal to expectedVocabularySize - 1. Currently ${s}, expected ${n-1}`)}this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),this.encodeGenerator=this.encodeGenerator.bind(this),this.decodeGenerator=this.decodeGenerator.bind(this),this.decodeAsyncGenerator=this.decodeAsyncGenerator.bind(this),this.decodeAsync=this.decodeAsync.bind(this),this.isWithinTokenLimit=this.isWithinTokenLimit.bind(this),this.encodeChat=this.encodeChat.bind(this),this.encodeChatGenerator=this.encodeChatGenerator.bind(this),this.countTokens=this.countTokens.bind(this),this.setMergeCacheSize=this.setMergeCacheSize.bind(this),this.clearMergeCache=this.clearMergeCache.bind(this),this.estimateCost=this.estimateCost.bind(this),i?.supported_features?.includes(`function_calling`)&&(this.countChatCompletionTokens=this.countChatCompletionTokensInternal.bind(this)),this.modelName=r,this.modelSpec=i,this.chatFormatter=a??`chatml`}*encodeHarmonyChatGenerator(e,t){let n=this.specialTokensEncoder.get(DO),r=this.specialTokensEncoder.get(kO),i=this.specialTokensEncoder.get(OO),a=this.specialTokensEncoder.get(jO),o=this.specialTokensEncoder.get(NO),s=this.specialTokensEncoder.get(AO),c=this.specialTokensEncoder.get(MO);if(n===void 0||r===void 0||i===void 0||a===void 0||o===void 0||s===void 0||c===void 0)throw Error(`Harmony chat format requires dedicated special tokens.`);let l=e=>e.length>0?this.encode(e):[],u=e=>{switch(e){case`<|return|>`:return a;case`<|call|>`:return o;default:return i}};for(let i of e){if(i.content===void 0)throw Error(`Content must be defined for all messages.`);let e=i.name??i.role??`user`;yield[n],yield l(e);let a=i.recipient&&(i.recipientPlacement===`role`||!i.channel),o=i.recipient&&!a;a&&(yield l(` to=${i.recipient}`)),i.channel&&(yield[s],yield l(i.channel),o&&(yield l(` to=${i.recipient}`))),i.constraint&&(yield[c],yield l(i.constraint)),yield[r],yield*this.encodeGenerator(i.content,t),yield[u(i.terminator)]}let d=t?.primeWithAssistantResponse??`assistant`;d.length>0&&(yield[n],yield l(d))}static getEncodingApi(t,n){let r=nk(t,n);return new e(r)}static getEncodingApiForModel(t,n,r){let i=nk(PO[t]??`o200k_base`,n);return new e({...i,modelName:t,modelSpec:r})}processSpecialTokens({allowedSpecial:e,disallowedSpecial:t}={}){let n;if(e===`all`||e?.has(`all`)){e=new Set(this.specialTokensSet);let n=e;if(t===`all`)throw Error(`allowedSpecial and disallowedSpecial cannot both be set to "all".`);typeof t==`object`?t.forEach(e=>n.delete(e)):t=new Set}if(!t||t===`all`||t.has(`all`)){t=new Set(this.specialTokensSet);let r=t;e?.size?(e.forEach(e=>r.delete(e)),t.forEach(t=>e.delete(t)),t.size>0&&(n=QD(t))):n=this.allSpecialTokenRegex}return{allowedSpecial:e,regexPattern:n}}encodeGenerator(e,t){let n=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(n.regexPattern){let t=e.match(n.regexPattern);if(t!==null)throw Error(`Disallowed special token found: ${t[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNativeGenerator(e,n.allowedSpecial)}encode(e,t){let n=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(n.regexPattern){let t=e.match(n.regexPattern);if(t!==null)throw Error(`Disallowed special token found: ${t[0]}`)}return this.bytePairEncodingCoreProcessor.encodeNative(e,n.allowedSpecial)}*encodeChatGenerator(e,t=this.modelName,n){if(!t)throw Error(`Model name must be provided either during initialization or passed in to the method.`);let r=LO[t];if(!r)throw Error(`Model '${t}' does not support chat.`);if(this.chatFormatter===`harmony`){yield*this.encodeHarmonyChatGenerator(e,n);return}let i=this.specialTokensEncoder.get(SO),a=this.specialTokensEncoder.get(CO);if(i===void 0||a===void 0)throw Error(`Model '${t}' does not support chat.`);let o=new Set([wO]),{messageSeparator:s,roleSeparator:c}=r,l=s.length>0?this.encode(s):[],u=c.length>0?this.encode(c,{allowedSpecial:o}):[],d=new Map;for(let{role:t=`system`,name:r=t,content:o}of e){if(o===void 0)throw Error(`Content must be defined for all messages.`);yield[i];let e=d.get(r)??this.encode(r);d.set(r,e),yield e,u.length>0&&(yield u),yield*this.encodeGenerator(o,n),yield[a],yield l}let f=n?.primeWithAssistantResponse??`assistant`;f.length>0&&(yield[i],yield*this.encodeGenerator(f,n)),u.length>0&&(yield u)}encodeChat(e,t=this.modelName,n){return[...this.encodeChatGenerator(e,t,n)].flat()}isWithinTokenLimit(e,t,n){let r=typeof e==`string`?this.encodeGenerator(e,n):this.encodeChatGenerator(e,void 0,n),i=0;for(let e of r)if(i+=e.length,i>t)return!1;return i}countTokens(e,t){if(typeof e==`string`){let n=t?this.processSpecialTokens(t):this.defaultSpecialTokenConfig;if(n.regexPattern){let t=e.match(n.regexPattern);if(t!==null)throw Error(`Disallowed special token found: ${t[0]}`)}return this.bytePairEncodingCoreProcessor.countNative(e,n.allowedSpecial)}let n=this.encodeChatGenerator(e,void 0,t),r=0;for(let e of n)r+=e.length;return r}countStringTokens(e){return e?this.bytePairEncodingCoreProcessor.countNative(e):0}countChatCompletionTokensInternal(e){return lO(e,e=>this.countStringTokens(e))}setMergeCacheSize(e){this.bytePairEncodingCoreProcessor.setMergeCacheSize(e)}clearMergeCache(){this.bytePairEncodingCoreProcessor.clearMergeCache()}decode(e){return this.bytePairEncodingCoreProcessor.decodeNative(e)}*decodeGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeGenerator(e),n=``;for(let e of t)n+=typeof e==`string`?e:eO.decode(e,{stream:!0}),!(n.length===0||GD(n))&&(yield n,n=``);n.length>0&&(yield n)}async*decodeAsyncGenerator(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n=``;for await(let e of t)n+=typeof e==`string`?e:eO.decode(e,{stream:!0}),!(n.length===0||GD(n))&&(yield n,n=``);n.length>0&&(yield n)}async decodeAsync(e){let t=this.bytePairEncodingCoreProcessor.decodeNativeAsyncIterable(e),n=``;for await(let e of t)n+=typeof e==`string`?e:eO.decode(e,{stream:!0});return n}estimateCost(e,t=this.modelSpec){if(!t)throw Error(`Model spec must be provided either during initialization or passed in to the method.`);if(!t.price_data)throw Error(`No cost information available for model: ${t.name}`);let n=t.price_data,r={},i=e/1e6;return n.main&&(r.main={input:n.main.input&&n.main.input*i,output:n.main.output&&n.main.output*i,cached_input:n.main.cached_input&&n.main.cached_input*i,cached_output:n.main.cached_output&&n.main.cached_output*i}),n.batch&&(r.batch={input:n.batch.input&&n.batch.input*i,output:n.batch.output&&n.batch.output*i,cached_input:n.batch.cached_input&&n.batch.cached_input*i,cached_output:n.batch.cached_output&&n.batch.cached_output*i}),r}}.getEncodingApi(`o200k_base`,()=>BD),gk=(e,t,n,r)=>{if(n===`length`||n===`prototype`||n===`arguments`||n===`caller`)return;let i=Object.getOwnPropertyDescriptor(e,n),a=Object.getOwnPropertyDescriptor(t,n);!_k(i,a)&&r||Object.defineProperty(e,n,a)},_k=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},vk=(e,t)=>{let n=Object.getPrototypeOf(t);n!==Object.getPrototypeOf(e)&&Object.setPrototypeOf(e,n)},yk=(e,t)=>`/* Wrapped ${e}*/\n${t}`,bk=Object.getOwnPropertyDescriptor(Function.prototype,`toString`),xk=Object.getOwnPropertyDescriptor(Function.prototype.toString,`name`),Sk=(e,t,n)=>{let r=n===``?``:`with ${n.trim()}() `,i=yk.bind(null,r,t.toString());Object.defineProperty(i,"name",xk);let{writable:a,enumerable:o,configurable:s}=bk;Object.defineProperty(e,"toString",{value:i,writable:a,enumerable:o,configurable:s})};function Ck(e,t,{ignoreNonConfigurable:n=!1}={}){let{name:r}=e;for(let r of Reflect.ownKeys(t))gk(e,t,r,n);return vk(e,t),Sk(e,t,r),e}var wk=new WeakMap;function Tk(e,t){let n=([e])=>e,{cacheKey:r=n,cache:i=new Map}=t??{},a=new Map,o=function(...n){let o=r(n);if(a.has(o))return a.get(o);let s=(async()=>{try{if(i&&await i.has(o))return await i.get(o);let r=await e.apply(this,n);try{return r}finally{i&&(!t?.shouldCache||await t.shouldCache(r,{key:o,argumentsList:n}))&&await i.set(o,r)}}finally{a.delete(o)}})();return a.set(o,s),s};return Ck(o,e,{ignoreNonConfigurable:!0}),wk.set(o,i),o}var Ek=a(((e,t)=>{(function(n,r){typeof i==`function`&&typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define(function(){return r()}):n.pluralize=r()})(e,function(){var e=[],t=[],n={},r={},i={};function a(e){return typeof e==`string`?RegExp(`^`+e+`$`,`i`):e}function o(e,t){return e===t?t:e===e.toLowerCase()?t.toLowerCase():e===e.toUpperCase()?t.toUpperCase():e[0]===e[0].toUpperCase()?t.charAt(0).toUpperCase()+t.substr(1).toLowerCase():t.toLowerCase()}function s(e,t){return e.replace(/\$(\d{1,2})/g,function(e,n){return t[n]||``})}function c(e,t){return e.replace(t[0],function(n,r){var i=s(t[1],arguments);return o(n===``?e[r-1]:n,i)})}function l(e,t,r){if(!e.length||n.hasOwnProperty(e))return t;for(var i=r.length;i--;){var a=r[i];if(a[0].test(t))return c(t,a)}return t}function u(e,t,n){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?o(r,i):e.hasOwnProperty(i)?o(r,e[i]):l(i,r,n)}}function d(e,t,n,r){return function(r){var i=r.toLowerCase();return t.hasOwnProperty(i)?!0:!e.hasOwnProperty(i)&&l(i,i,n)===i}}function f(e,t,n){var r=t===1?f.singular(e):f.plural(e);return(n?t+` `:``)+r}return f.plural=u(i,r,e),f.isPlural=d(i,r,e),f.singular=u(r,i,t),f.isSingular=d(r,i,t),f.addPluralRule=function(t,n){e.push([a(t),n])},f.addSingularRule=function(e,n){t.push([a(e),n])},f.addUncountableRule=function(e){if(typeof e==`string`){n[e.toLowerCase()]=!0;return}f.addPluralRule(e,`$0`),f.addSingularRule(e,`$0`)},f.addIrregularRule=function(e,t){t=t.toLowerCase(),e=e.toLowerCase(),i[e]=t,r[t]=e},[[`I`,`we`],[`me`,`us`],[`he`,`they`],[`she`,`they`],[`them`,`them`],[`myself`,`ourselves`],[`yourself`,`yourselves`],[`itself`,`themselves`],[`herself`,`themselves`],[`himself`,`themselves`],[`themself`,`themselves`],[`is`,`are`],[`was`,`were`],[`has`,`have`],[`this`,`these`],[`that`,`those`],[`echo`,`echoes`],[`dingo`,`dingoes`],[`volcano`,`volcanoes`],[`tornado`,`tornadoes`],[`torpedo`,`torpedoes`],[`genus`,`genera`],[`viscus`,`viscera`],[`stigma`,`stigmata`],[`stoma`,`stomata`],[`dogma`,`dogmata`],[`lemma`,`lemmata`],[`schema`,`schemata`],[`anathema`,`anathemata`],[`ox`,`oxen`],[`axe`,`axes`],[`die`,`dice`],[`yes`,`yeses`],[`foot`,`feet`],[`eave`,`eaves`],[`goose`,`geese`],[`tooth`,`teeth`],[`quiz`,`quizzes`],[`human`,`humans`],[`proof`,`proofs`],[`carve`,`carves`],[`valve`,`valves`],[`looey`,`looies`],[`thief`,`thieves`],[`groove`,`grooves`],[`pickaxe`,`pickaxes`],[`passerby`,`passersby`]].forEach(function(e){return f.addIrregularRule(e[0],e[1])}),[[/s?$/i,`s`],[/[^\u0000-\u007F]$/i,`$0`],[/([^aeiou]ese)$/i,`$1`],[/(ax|test)is$/i,`$1es`],[/(alias|[^aou]us|t[lm]as|gas|ris)$/i,`$1es`],[/(e[mn]u)s?$/i,`$1s`],[/([^l]ias|[aeiou]las|[ejzr]as|[iu]am)$/i,`$1`],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,`$1i`],[/(alumn|alg|vertebr)(?:a|ae)$/i,`$1ae`],[/(seraph|cherub)(?:im)?$/i,`$1im`],[/(her|at|gr)o$/i,`$1oes`],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|automat|quor)(?:a|um)$/i,`$1a`],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)(?:a|on)$/i,`$1a`],[/sis$/i,`ses`],[/(?:(kni|wi|li)fe|(ar|l|ea|eo|oa|hoo)f)$/i,`$1$2ves`],[/([^aeiouy]|qu)y$/i,`$1ies`],[/([^ch][ieo][ln])ey$/i,`$1ies`],[/(x|ch|ss|sh|zz)$/i,`$1es`],[/(matr|cod|mur|sil|vert|ind|append)(?:ix|ex)$/i,`$1ices`],[/\b((?:tit)?m|l)(?:ice|ouse)$/i,`$1ice`],[/(pe)(?:rson|ople)$/i,`$1ople`],[/(child)(?:ren)?$/i,`$1ren`],[/eaux$/i,`$0`],[/m[ae]n$/i,`men`],[`thou`,`you`]].forEach(function(e){return f.addPluralRule(e[0],e[1])}),[[/s$/i,``],[/(ss)$/i,`$1`],[/(wi|kni|(?:after|half|high|low|mid|non|night|[^\w]|^)li)ves$/i,`$1fe`],[/(ar|(?:wo|[ae])l|[eo][ao])ves$/i,`$1f`],[/ies$/i,`y`],[/\b([pl]|zomb|(?:neck|cross)?t|coll|faer|food|gen|goon|group|lass|talk|goal|cut)ies$/i,`$1ie`],[/\b(mon|smil)ies$/i,`$1ey`],[/\b((?:tit)?m|l)ice$/i,`$1ouse`],[/(seraph|cherub)im$/i,`$1`],[/(x|ch|ss|sh|zz|tto|go|cho|alias|[^aou]us|t[lm]as|gas|(?:her|at|gr)o|[aeiou]ris)(?:es)?$/i,`$1`],[/(analy|diagno|parenthe|progno|synop|the|empha|cri|ne)(?:sis|ses)$/i,`$1sis`],[/(movie|twelve|abuse|e[mn]u)s$/i,`$1`],[/(test)(?:is|es)$/i,`$1is`],[/(alumn|syllab|vir|radi|nucle|fung|cact|stimul|termin|bacill|foc|uter|loc|strat)(?:us|i)$/i,`$1us`],[/(agend|addend|millenni|dat|extrem|bacteri|desiderat|strat|candelabr|errat|ov|symposi|curricul|quor)a$/i,`$1um`],[/(apheli|hyperbat|periheli|asyndet|noumen|phenomen|criteri|organ|prolegomen|hedr|automat)a$/i,`$1on`],[/(alumn|alg|vertebr)ae$/i,`$1a`],[/(cod|mur|sil|vert|ind)ices$/i,`$1ex`],[/(matr|append)ices$/i,`$1ix`],[/(pe)(rson|ople)$/i,`$1rson`],[/(child)ren$/i,`$1`],[/(eau)x?$/i,`$1`],[/men$/i,`man`]].forEach(function(e){return f.addSingularRule(e[0],e[1])}),[`adulthood`,`advice`,`agenda`,`aid`,`aircraft`,`alcohol`,`ammo`,`analytics`,`anime`,`athletics`,`audio`,`bison`,`blood`,`bream`,`buffalo`,`butter`,`carp`,`cash`,`chassis`,`chess`,`clothing`,`cod`,`commerce`,`cooperation`,`corps`,`debris`,`diabetes`,`digestion`,`elk`,`energy`,`equipment`,`excretion`,`expertise`,`firmware`,`flounder`,`fun`,`gallows`,`garbage`,`graffiti`,`hardware`,`headquarters`,`health`,`herpes`,`highjinks`,`homework`,`housework`,`information`,`jeans`,`justice`,`kudos`,`labour`,`literature`,`machinery`,`mackerel`,`mail`,`media`,`mews`,`moose`,`music`,`mud`,`manga`,`news`,`only`,`personnel`,`pike`,`plankton`,`pliers`,`police`,`pollution`,`premises`,`rain`,`research`,`rice`,`salmon`,`scissors`,`series`,`sewage`,`shambles`,`shrimp`,`software`,`species`,`staff`,`swine`,`tennis`,`traffic`,`transportation`,`trout`,`tuna`,`wealth`,`welfare`,`whiting`,`wildebeest`,`wildlife`,`you`,/pok[eé]mon$/i,/[^aeiou]ese$/i,/deer$/i,/fish$/i,/measles$/i,/o[iu]s$/i,/pox$/i,/sheep$/i].forEach(f.addUncountableRule),f})})),Dk=a(((e,t)=>{function n(e){return e=String(e),e&&e.toLowerCase()}n.isLowercase=function(e){return e&&!/[A-Z]+/.test(e)},t.exports=n})),Ok=a(((e,t)=>{function n(e){return e=String(e),e&&e.toUpperCase()}n.isUppercase=function(e){return e&&!/[a-z]+/.test(e)},t.exports=n})),kk=a(((e,t)=>{var n=Dk(),r=Ok(),i={from:/[\-_:\.\s]([a-zA-Z])([a-zA-Z]*)/g,to:function(e,t,n,i,a){return t.length,r(t)+n}};function a(e){return a.isCamelcase(e)||(e=String(e).replace(/^[\-_:\.\s]/,``),!e)?e:(r.isUppercase(e)&&(e=n(e)),n(e[0])+e.replace(i.from,i.to).slice(1).replace(/^([A-Z]+)([A-Z])/,function(e,t,r){return n(t)+r}))}a.isCamelcase=function(e){return e&&/^[a-zA-Z]+$/.test(e)&&n(e[0])===e[0]},t.exports=a})),Ak=a(((e,t)=>{var n=Ok();function r(e){return e=String(e),e&&n(e[0])+e.slice(1)}t.exports=r})),jk=a(((e,t)=>{var n=Dk(),r=Ok(),i=`_`,a={from:/([A-Z]+)/g,to:function(e,t,a,o){var s=a===0?``:i,c=t.length;if(c===1)return s+n(t);var l=o.slice(a+t.length);return r.isUppercase(t)&&l[0]===i?s+n(t):s+(n(t.substr(0,c-1))+i+n(t[c-1]))}};function o(e){return o.isSnakecase(e)||(e=String(e).replace(/[\-.:\s]/g,i),!e)?e:(r.isUppercase(e)&&(e=n(e)),e.replace(a.from,a.to).replace(/_+/g,`_`))}o.isSnakecase=function(e){return e&&/^[a-z_]+$/.test(e)},t.exports=o})),Mk=a(((e,t)=>{var n=Ok(),r=jk();function i(e){return i.isConstcase(e)?e:n(r(e))}i.isConstcase=function(e){return e&&/^[A-Z_]+$/.test(e)},t.exports=i})),Nk=a(((e,t)=>{var n=jk();function r(e){return n(e).replace(/_/g,``)}t.exports=r})),Pk=a(((e,t)=>{var n=Dk();function r(e){return e=String(e),e&&n(e[0])+e.slice(1)}t.exports=r})),Fk=a(((e,t)=>{var n=jk();function r(e){return n(e).replace(/_/g,`.`)}t.exports=r})),Ik=a(((e,t)=>{var n=jk();function r(e){return n(e).replace(/_/g,`:`)}t.exports=r})),Lk=a(((e,t)=>{var n=kk(),r=Ak();function i(e){return r(n(e))}t.exports=i})),Rk=a(((e,t)=>{var n=jk();function r(e){return n(e).replace(/_/g,`/`)}t.exports=r})),zk=a(((e,t)=>{function n(e){return String(e).trim()}t.exports=n})),Bk=a(((e,t)=>{Dk();var n=zk(),r=jk(),i=Ak(),a=` `;function o(e){return e=String(e).replace(/^[\-_\.\s]/g,a),e&&i(r(n(e)).replace(/_/g,a))}t.exports=o})),Vk=a(((e,t)=>{var n=jk();function r(e){return n(e).replace(/_/g,` `)}t.exports=r})),Hk=a(((e,t)=>{var n=jk();function r(e){return n(e).replace(/_/g,`-`)}t.exports=r})),Uk=a(((e,t)=>{var n=jk(),r=Dk(),i=zk(),a=Ak(),o=`a,the,and,or,not,but,for,of`.split(`,`);function s(e){return n(e).split(/_/g).map(i).map(function(e){return~o.indexOf(e)?r(e):a(e)}).join(` `)}t.exports=s})),Wk=a(((e,t)=>{var n=kk(),r=Ak(),i=Mk(),a=Nk(),o=Pk(),s=Fk(),c=Ik(),l=Dk(),u=Lk(),d=Rk(),f=Bk(),p=jk(),m=Vk(),h=Hk(),g=Uk(),_=zk(),v=Ok();e.camelcase=n,e.capitalcase=r,e.constcase=i,e.cramcase=a,e.decapitalcase=o,e.dotcase=s,e.enumcase=c,e.lowercase=l,e.pascalcase=u,e.pathcase=d,e.sentencecase=f,e.snakecase=p,e.spacecase=m,e.spinalcase=h,e.titlecase=g,e.trimcase=_,e.uppercase=v,t.exports={camelcase:n,capitalcase:r,constcase:i,cramcase:a,decapitalcase:o,dotcase:s,enumcase:c,lowercase:l,pascalcase:u,pathcase:d,sentencecase:f,snakecase:p,spacecase:m,spinalcase:h,titlecase:g,trimcase:_,uppercase:v}}));Ek(),Wk();function Gk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kk(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Gk(Object(n),!0).forEach(function(t){qk(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Gk(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function qk(e,t,n){return t=Jk(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jk(e){var t=Yk(e,`string`);return typeof t==`symbol`?t:String(t)}function Yk(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var Xk=Zk({});function Zk(e){return t.withOptions=t=>Zk(Kk(Kk({},e),t)),t;function t(t,...n){let r=typeof t==`string`?[t]:t.raw,{alignValues:i=!1,escapeSpecialCharacters:a=Array.isArray(t),trimWhitespace:o=!0}=e,s=``;for(let e=0;e<r.length;e++){let t=r[e];if(a&&(t=t.replace(/\\\n[ \t]*/g,``).replace(/\\`/g,"`").replace(/\\\$/g,`$`).replace(/\\\{/g,`{`)),s+=t,e<n.length){let t=i?Qk(n[e],s):n[e];s+=t}}let c=s.split(`
|
|
3331
3331
|
`),l=null;for(let e of c){let t=e.match(/^(\s+)\S+/);if(t){let e=t[1].length;l=l?Math.min(l,e):e}}if(l!==null){let e=l;s=c.map(t=>t[0]===` `||t[0]===` `?t.slice(e):t).join(`
|
|
3332
3332
|
`)}return o&&(s=s.trim()),a&&(s=s.replace(/\\n/g,`
|
|
3333
|
-
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function
|
|
3333
|
+
`).replace(/\\t/g,` `).replace(/\\r/g,`\r`).replace(/\\v/g,`\v`).replace(/\\b/g,`\b`).replace(/\\f/g,`\f`).replace(/\\0/g,`\0`).replace(/\\x([\da-fA-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g,(e,t)=>String.fromCodePoint(parseInt(t,16))).replace(/\\u([\da-fA-F]{4})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))),typeof Bun<`u`&&(s=s.replace(/\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,(e,t,n)=>{let r=t??n??``;return String.fromCodePoint(parseInt(r,16))})),s}}function Qk(e,t){if(typeof e!=`string`||!e.includes(`
|
|
3334
3334
|
`))return e;let n=t.slice(t.lastIndexOf(`
|
|
3335
|
-
`)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}function Qk(e){return typeof e==`object`&&!!e&&`name`in e&&(`data`in e||`codec`in e)&&typeof e.name==`string`}function $k(e){return eA(e,new WeakSet)}function eA(e,t){return typeof e==`object`?e===null||t.has(e)?!0:(t.add(e),Array.isArray(e)?e.every(e=>eA(e,t)):e instanceof Promise?!1:Symbol.asyncIterator in e||Symbol.iterator in e?!0:Qk(e)?eA(e.data,t):Object.values(e).every(e=>eA(e,t))):typeof e!=`bigint`&&typeof e!=`symbol`}function tA(e){return!(typeof e!=`object`||!e||Array.isArray(e)||e instanceof Promise||Symbol.asyncIterator in e||Symbol.iterator in e||Qk(e))}function nA(e){return e.type===`message`}function rA(e){if(Qk(e)){if(nA(e))throw Error(`Message fragments are not supported by serialized fragment conversion`);if(!e.codec)throw Error(`Fragment "${e.name}" is missing codec`);return e.codec.encode()}return Array.isArray(e)?e.map(e=>rA(e)):tA(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,rA(t)])):e}function iA(e,t){return{name:`term`,data:{name:e,definition:t},codec:{encode(){return{type:`term`,name:e,definition:t}},decode(){return{name:e,definition:t}}}}}function aA(e){return{name:`hint`,data:e,codec:{encode(){return{type:`hint`,text:e}},decode(){return e}}}}function oA(e){return{name:`guardrail`,data:{rule:e.rule,...e.reason&&{reason:e.reason},...e.action&&{action:e.action}},codec:{encode(){return{type:`guardrail`,rule:e.rule,...e.reason&&{reason:e.reason},...e.action&&{action:e.action}}},decode(){return{rule:e.rule,...e.reason&&{reason:e.reason},...e.action&&{action:e.action}}}}}}function sA(e){return{name:`explain`,data:{concept:e.concept,explanation:e.explanation,...e.therefore&&{therefore:e.therefore}},codec:{encode(){return{type:`explain`,concept:e.concept,explanation:e.explanation,...e.therefore&&{therefore:e.therefore}}},decode(){return{concept:e.concept,explanation:e.explanation,...e.therefore&&{therefore:e.therefore}}}}}}function cA(e){return{name:`example`,data:{question:e.question,answer:e.answer,...e.note&&{note:e.note}},codec:{encode(){return{type:`example`,question:e.question,answer:e.answer,...e.note&&{note:e.note}}},decode(){return{question:e.question,answer:e.answer,...e.note&&{note:e.note}}}}}}function lA(e){return{name:`clarification`,data:{when:e.when,ask:e.ask,reason:e.reason},codec:{encode(){return{type:`clarification`,when:e.when,ask:e.ask,reason:e.reason}},decode(){return{when:e.when,ask:e.ask,reason:e.reason}}}}}function uA(e){return{name:`workflow`,data:{task:e.task,steps:e.steps,...e.triggers?.length&&{triggers:e.triggers},...e.notes&&{notes:e.notes}},codec:{encode(){return{type:`workflow`,task:e.task,steps:e.steps,...e.triggers?.length&&{triggers:e.triggers},...e.notes&&{notes:e.notes}}},decode(){return{task:e.task,steps:e.steps,...e.triggers?.length&&{triggers:e.triggers},...e.notes&&{notes:e.notes}}}}}}function dA(e){return{name:`quirk`,data:{issue:e.issue,workaround:e.workaround},codec:{encode(){return{type:`quirk`,issue:e.issue,workaround:e.workaround}},decode(){return{issue:e.issue,workaround:e.workaround}}}}}function fA(e){return{name:`styleGuide`,data:{prefer:e.prefer,...e.never&&{never:e.never},...e.always&&{always:e.always}},codec:{encode(){return{type:`styleGuide`,prefer:e.prefer,...e.never&&{never:e.never},...e.always&&{always:e.always}}},decode(){return{prefer:e.prefer,...e.never&&{never:e.never},...e.always&&{always:e.always}}}}}}function pA(e){return{name:`analogy`,data:{concepts:e.concepts,relationship:e.relationship,...e.insight&&{insight:e.insight},...e.therefore&&{therefore:e.therefore},...e.pitfall&&{pitfall:e.pitfall}},codec:{encode(){return{type:`analogy`,concepts:e.concepts,relationship:e.relationship,...e.insight&&{insight:e.insight},...e.therefore&&{therefore:e.therefore},...e.pitfall&&{pitfall:e.pitfall}}},decode(){return{concepts:e.concepts,relationship:e.relationship,...e.insight&&{insight:e.insight},...e.therefore&&{therefore:e.therefore},...e.pitfall&&{pitfall:e.pitfall}}}}}}function mA(e){return{name:`glossary`,data:Object.entries(e).map(([e,t])=>({term:e,expression:t})),codec:{encode(){return{type:`glossary`,entries:e}},decode(){return Object.entries(e).map(([e,t])=>({term:e,expression:t}))}}}}function hA(e){return{name:`role`,data:e,codec:{encode(){return{type:`role`,content:e}},decode(){return e}}}}function gA(e){return{name:`principle`,data:{title:e.title,description:e.description,...e.policies?.length&&{policies:e.policies}},codec:{encode(){return{type:`principle`,title:e.title,description:e.description,...e.policies?.length&&{policies:e.policies.map(e=>rA(e))}}},decode(){return{title:e.title,description:e.description,...e.policies?.length&&{policies:e.policies}}}}}}function _A(e){return{name:`policy`,data:{rule:e.rule,...e.before&&{before:e.before},...e.reason&&{reason:e.reason},...e.policies?.length&&{policies:e.policies}},codec:{encode(){return{type:`policy`,rule:e.rule,...e.before&&{before:e.before},...e.reason&&{reason:e.reason},...e.policies?.length&&{policies:e.policies.map(e=>rA(e))}}},decode(){return{rule:e.rule,...e.before&&{before:e.before},...e.reason&&{reason:e.reason},...e.policies?.length&&{policies:e.policies}}}}}}function vA(e){return{name:`identity`,data:{...e.name&&{name:e.name},...e.role&&{role:e.role}},codec:{encode(){return{type:`identity`,...e.name&&{name:e.name},...e.role&&{role:e.role}}},decode(){return{...e.name&&{name:e.name},...e.role&&{role:e.role}}}}}}function yA(e){return{name:`persona`,data:{name:e.name,...e.role&&{role:e.role},...e.objective&&{objective:e.objective},...e.tone&&{tone:e.tone}},codec:{encode(){return{type:`persona`,name:e.name,...e.role&&{role:e.role},...e.objective&&{objective:e.objective},...e.tone&&{tone:e.tone}}},decode(){return{name:e.name,...e.role&&{role:e.role},...e.objective&&{objective:e.objective},...e.tone&&{tone:e.tone}}}}}}function bA(e,t){return{name:`alias`,data:{term:e,meaning:t},codec:{encode(){return{type:`alias`,term:e,meaning:t}},decode(){return{term:e,meaning:t}}}}}function xA(e,t){return{name:`preference`,data:{aspect:e,value:t},codec:{encode(){return{type:`preference`,aspect:e,value:t}},decode(){return{aspect:e,value:t}}}}}function SA(e,t){return{name:`correction`,data:{subject:e,clarification:t},codec:{encode(){return{type:`correction`,subject:e,clarification:t}},decode(){return{subject:e,clarification:t}}}}}function CA(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function wA(e,t){if(CA(e))return AA(e,t);if(Array.isArray(e))return e.map(e=>wA(e,t));if(tA(e))return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,wA(n,t)]));if(!$k(e))throw Error(`Unsupported serialized value of type ${typeof e}`);return e}function TA(e,t){return{toFragment:(n,r)=>{let i=e.safeParse(n);if(!i.success)throw Error(`Invalid serialized ${n.type} fragment: ${E(i.error)}`);return t(i.data,r)}}}var EA=et(it()).optional(),DA={term:TA(F({name:I(),definition:I()}),e=>iA(e.name,e.definition)),hint:TA(F({text:I()}),e=>aA(e.text)),guardrail:TA(F({rule:I(),reason:I().optional(),action:I().optional()}),e=>oA({rule:e.rule,reason:e.reason,action:e.action})),explain:TA(F({concept:I(),explanation:I(),therefore:I().optional()}),e=>sA({concept:e.concept,explanation:e.explanation,therefore:e.therefore})),example:TA(F({question:I(),answer:I(),note:I().optional()}),e=>cA({question:e.question,answer:e.answer,note:e.note})),clarification:TA(F({when:I(),ask:I(),reason:I()}),e=>lA({when:e.when,ask:e.ask,reason:e.reason})),workflow:TA(F({task:I(),steps:et(I()),triggers:et(I()).optional(),notes:I().optional()}),e=>uA({task:e.task,steps:e.steps,triggers:e.triggers,notes:e.notes})),quirk:TA(F({issue:I(),workaround:I()}),e=>dA({issue:e.issue,workaround:e.workaround})),styleGuide:TA(F({prefer:I(),never:I().optional(),always:I().optional()}),e=>fA({prefer:e.prefer,never:e.never,always:e.always})),analogy:TA(F({concepts:et(I()),relationship:I(),insight:I().optional(),therefore:I().optional(),pitfall:I().optional()}),e=>pA({concepts:e.concepts,relationship:e.relationship,insight:e.insight,therefore:e.therefore,pitfall:e.pitfall})),glossary:TA(F({entries:y(I(),I())}),e=>mA(e.entries)),role:TA(F({content:I()}),e=>hA(e.content)),principle:TA(F({title:I(),description:I(),policies:EA}),(e,t)=>gA({title:e.title,description:e.description,policies:e.policies?.map(e=>wA(e,t))})),policy:TA(F({rule:I(),before:I().optional(),reason:I().optional(),policies:EA}),(e,t)=>_A({rule:e.rule,before:e.before,reason:e.reason,policies:e.policies?.map(e=>wA(e,t))})),identity:TA(F({name:I().optional(),role:I().optional()}),e=>vA({name:e.name,role:e.role})),persona:TA(F({name:I(),role:I().optional(),objective:I().optional(),tone:I().optional()}),e=>yA({name:e.name,role:e.role,objective:e.objective,tone:e.tone})),alias:TA(F({term:I(),meaning:I()}),e=>bA(e.term,e.meaning)),preference:TA(F({aspect:I(),value:I()}),e=>xA(e.aspect,e.value)),correction:TA(F({subject:I(),clarification:I()}),e=>SA(e.subject,e.clarification))};function OA(e){return Object.hasOwn(DA,e)}var kA=new Set([`user`,`assistant`,`message`]);function AA(e,t){if(kA.has(e.type))throw Error(`Message fragments are not supported by serialized fragment conversion`);let n=t?.registry?.[e.type]??(OA(e.type)?DA[e.type]:void 0);if(!n)throw Error(`Unsupported serialized fragment type: ${e.type}`);return n.toFragment(e,t)}var jA={encode(e){return ak(e)},count(e){return ak(e).length}},MA=F({input:wt(),output:wt(),cache_read:wt().optional(),cache_write:wt().optional(),reasoning:wt().optional()}),NA=y(I(),F({models:y(I(),F({id:I(),name:I(),family:I().optional(),cost:MA.optional(),limit:F({context:wt(),output:wt()})}))}));function PA(e){if(!e.cost)throw Error(`Model "${e.provider}:${e.id}" has no pricing data on models.dev`);return e.cost.input}new class{#e=new Map;#t=new Map;#n=jA;#r=wk(()=>this.#i());async load(){await this.#r()}async#i(){let e=await fetch(`https://models.dev/api.json`);if(!e.ok)throw Error(`Failed to fetch models: ${e.statusText}`);let t=NA.parse(await e.json());for(let[e,n]of Object.entries(t))for(let[t,r]of Object.entries(n.models)){let n={id:r.id,name:r.name,family:r.family,cost:r.cost,limit:r.limit,provider:e};this.#e.set(`${e}:${t}`,n)}}get(e){return this.#e.get(e)}has(e){return this.#e.has(e)}list(){return[...this.#e.keys()]}registerTokenizer(e,t){this.#t.set(e,t)}setDefaultTokenizer(e){this.#n=e}getTokenizer(e){let t=this.get(e)?.family;return(t===void 0?void 0:this.#t.get(t))??this.#n}estimate(e,t){let n=this.get(e);if(!n)throw Error(`Model "${e}" not found. Call load() first or check model ID.`);let r=PA(n),i=this.getTokenizer(e).count(t),a=i/1e6*r;return{model:n.id,provider:n.provider,tokens:i,cost:a,limits:{context:n.limit.context,output:n.limit.output,exceedsContext:i>n.limit.context},fragments:[]}}};function FA(e){let t=e?.reminders;return Array.isArray(t)?t.filter(e=>RA(e)&&typeof e.partIndex==`number`&&typeof e.start==`number`&&typeof e.end==`number`):[]}function IA(e,t){if(t.length===0)return e;let n=t.map(t=>({start:Math.max(0,Math.min(e.length,t.start)),end:Math.max(0,Math.min(e.length,t.end))})).filter(e=>e.end>e.start).sort((e,t)=>e.start-t.start);if(n.length===0)return e;let r=0,i=``;for(let t of n){if(t.start<r){t.end>r&&(r=t.end);continue}i+=e.slice(r,t.start),r=t.end}return i+=e.slice(r),i.trimEnd()}function LA(e){if(zA(e))return BA(e);let t=FA(RA(e.metadata)?e.metadata:void 0),n=new Map;for(let e of t){let t=n.get(e.partIndex)??[];t.push({start:e.start,end:e.end}),n.set(e.partIndex,t)}let r=e.parts.flatMap((e,t)=>{let r={...e},i=n.get(t);if(r.type!==`text`||i===void 0)return[r];let a=IA(r.text,i);return a.length===0?[]:[{...r,text:a}]}),i={...e,parts:r};if(RA(e.metadata)){let t={...e.metadata};delete t.reminders,Object.keys(t).length>0?i.metadata=t:delete i.metadata}return i}function RA(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function zA(e){let t=e.metadata;if(!RA(t))return!1;let n=t.synthetic;return RA(n)?n.source===`reminder`:!1}function BA(e){let t={...e,parts:e.parts.filter(e=>e.type!==`text`)};if(RA(e.metadata)){let n={...e.metadata};delete n.synthetic,Object.keys(n).length>0?t.metadata=n:delete t.metadata}return t}Yk`A skill is a set of local instructions to follow that is stored in a \`SKILL.md\` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill.
|
|
3335
|
+
`)+1).match(/^(\s+)/);if(n){let t=n[1];return e.replace(/\n/g,`\n${t}`)}return e}function $k(e){return typeof e==`object`&&!!e&&`name`in e&&(`data`in e||`codec`in e)&&typeof e.name==`string`}function eA(e){return tA(e,new WeakSet)}function tA(e,t){return typeof e==`object`?e===null||t.has(e)?!0:(t.add(e),Array.isArray(e)?e.every(e=>tA(e,t)):e instanceof Promise?!1:Symbol.asyncIterator in e||Symbol.iterator in e?!0:$k(e)?tA(e.data,t):Object.values(e).every(e=>tA(e,t))):typeof e!=`bigint`&&typeof e!=`symbol`}function nA(e){return!(typeof e!=`object`||!e||Array.isArray(e)||e instanceof Promise||Symbol.asyncIterator in e||Symbol.iterator in e||$k(e))}function rA(e){return e.type===`message`}function iA(e){if($k(e)){if(rA(e))throw Error(`Message fragments are not supported by serialized fragment conversion`);if(!e.codec)throw Error(`Fragment "${e.name}" is missing codec`);return e.codec.encode()}return Array.isArray(e)?e.map(e=>iA(e)):nA(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,iA(t)])):e}function aA(e,t){return{name:`term`,data:{name:e,definition:t},codec:{encode(){return{type:`term`,name:e,definition:t}},decode(){return{name:e,definition:t}}}}}function oA(e){return{name:`hint`,data:e,codec:{encode(){return{type:`hint`,text:e}},decode(){return e}}}}function sA(e){return{name:`guardrail`,data:{rule:e.rule,...e.reason&&{reason:e.reason},...e.action&&{action:e.action}},codec:{encode(){return{type:`guardrail`,rule:e.rule,...e.reason&&{reason:e.reason},...e.action&&{action:e.action}}},decode(){return{rule:e.rule,...e.reason&&{reason:e.reason},...e.action&&{action:e.action}}}}}}function cA(e){return{name:`explain`,data:{concept:e.concept,explanation:e.explanation,...e.therefore&&{therefore:e.therefore}},codec:{encode(){return{type:`explain`,concept:e.concept,explanation:e.explanation,...e.therefore&&{therefore:e.therefore}}},decode(){return{concept:e.concept,explanation:e.explanation,...e.therefore&&{therefore:e.therefore}}}}}}function lA(e){return{name:`example`,data:{question:e.question,answer:e.answer,...e.note&&{note:e.note}},codec:{encode(){return{type:`example`,question:e.question,answer:e.answer,...e.note&&{note:e.note}}},decode(){return{question:e.question,answer:e.answer,...e.note&&{note:e.note}}}}}}function uA(e){return{name:`clarification`,data:{when:e.when,ask:e.ask,reason:e.reason},codec:{encode(){return{type:`clarification`,when:e.when,ask:e.ask,reason:e.reason}},decode(){return{when:e.when,ask:e.ask,reason:e.reason}}}}}function dA(e){return{name:`workflow`,data:{task:e.task,steps:e.steps,...e.triggers?.length&&{triggers:e.triggers},...e.notes&&{notes:e.notes}},codec:{encode(){return{type:`workflow`,task:e.task,steps:e.steps,...e.triggers?.length&&{triggers:e.triggers},...e.notes&&{notes:e.notes}}},decode(){return{task:e.task,steps:e.steps,...e.triggers?.length&&{triggers:e.triggers},...e.notes&&{notes:e.notes}}}}}}function fA(e){return{name:`quirk`,data:{issue:e.issue,workaround:e.workaround},codec:{encode(){return{type:`quirk`,issue:e.issue,workaround:e.workaround}},decode(){return{issue:e.issue,workaround:e.workaround}}}}}function pA(e){return{name:`styleGuide`,data:{prefer:e.prefer,...e.never&&{never:e.never},...e.always&&{always:e.always}},codec:{encode(){return{type:`styleGuide`,prefer:e.prefer,...e.never&&{never:e.never},...e.always&&{always:e.always}}},decode(){return{prefer:e.prefer,...e.never&&{never:e.never},...e.always&&{always:e.always}}}}}}function mA(e){return{name:`analogy`,data:{concepts:e.concepts,relationship:e.relationship,...e.insight&&{insight:e.insight},...e.therefore&&{therefore:e.therefore},...e.pitfall&&{pitfall:e.pitfall}},codec:{encode(){return{type:`analogy`,concepts:e.concepts,relationship:e.relationship,...e.insight&&{insight:e.insight},...e.therefore&&{therefore:e.therefore},...e.pitfall&&{pitfall:e.pitfall}}},decode(){return{concepts:e.concepts,relationship:e.relationship,...e.insight&&{insight:e.insight},...e.therefore&&{therefore:e.therefore},...e.pitfall&&{pitfall:e.pitfall}}}}}}function hA(e){return{name:`glossary`,data:Object.entries(e).map(([e,t])=>({term:e,expression:t})),codec:{encode(){return{type:`glossary`,entries:e}},decode(){return Object.entries(e).map(([e,t])=>({term:e,expression:t}))}}}}function gA(e){return{name:`role`,data:e,codec:{encode(){return{type:`role`,content:e}},decode(){return e}}}}function _A(e){return{name:`principle`,data:{title:e.title,description:e.description,...e.policies?.length&&{policies:e.policies}},codec:{encode(){return{type:`principle`,title:e.title,description:e.description,...e.policies?.length&&{policies:e.policies.map(e=>iA(e))}}},decode(){return{title:e.title,description:e.description,...e.policies?.length&&{policies:e.policies}}}}}}function vA(e){return{name:`policy`,data:{rule:e.rule,...e.before&&{before:e.before},...e.reason&&{reason:e.reason},...e.policies?.length&&{policies:e.policies}},codec:{encode(){return{type:`policy`,rule:e.rule,...e.before&&{before:e.before},...e.reason&&{reason:e.reason},...e.policies?.length&&{policies:e.policies.map(e=>iA(e))}}},decode(){return{rule:e.rule,...e.before&&{before:e.before},...e.reason&&{reason:e.reason},...e.policies?.length&&{policies:e.policies}}}}}}function yA(e){return{name:`identity`,data:{...e.name&&{name:e.name},...e.role&&{role:e.role}},codec:{encode(){return{type:`identity`,...e.name&&{name:e.name},...e.role&&{role:e.role}}},decode(){return{...e.name&&{name:e.name},...e.role&&{role:e.role}}}}}}function bA(e){return{name:`persona`,data:{name:e.name,...e.role&&{role:e.role},...e.objective&&{objective:e.objective},...e.tone&&{tone:e.tone}},codec:{encode(){return{type:`persona`,name:e.name,...e.role&&{role:e.role},...e.objective&&{objective:e.objective},...e.tone&&{tone:e.tone}}},decode(){return{name:e.name,...e.role&&{role:e.role},...e.objective&&{objective:e.objective},...e.tone&&{tone:e.tone}}}}}}function xA(e,t){return{name:`alias`,data:{term:e,meaning:t},codec:{encode(){return{type:`alias`,term:e,meaning:t}},decode(){return{term:e,meaning:t}}}}}function SA(e,t){return{name:`preference`,data:{aspect:e,value:t},codec:{encode(){return{type:`preference`,aspect:e,value:t}},decode(){return{aspect:e,value:t}}}}}function CA(e,t){return{name:`correction`,data:{subject:e,clarification:t},codec:{encode(){return{type:`correction`,subject:e,clarification:t}},decode(){return{subject:e,clarification:t}}}}}function wA(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function TA(e,t){if(wA(e))return jA(e,t);if(Array.isArray(e))return e.map(e=>TA(e,t));if(nA(e))return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,TA(n,t)]));if(!eA(e))throw Error(`Unsupported serialized value of type ${typeof e}`);return e}function EA(e,t){return{toFragment:(n,r)=>{let i=e.safeParse(n);if(!i.success)throw Error(`Invalid serialized ${n.type} fragment: ${E(i.error)}`);return t(i.data,r)}}}var DA=et(it()).optional(),OA={term:EA(F({name:I(),definition:I()}),e=>aA(e.name,e.definition)),hint:EA(F({text:I()}),e=>oA(e.text)),guardrail:EA(F({rule:I(),reason:I().optional(),action:I().optional()}),e=>sA({rule:e.rule,reason:e.reason,action:e.action})),explain:EA(F({concept:I(),explanation:I(),therefore:I().optional()}),e=>cA({concept:e.concept,explanation:e.explanation,therefore:e.therefore})),example:EA(F({question:I(),answer:I(),note:I().optional()}),e=>lA({question:e.question,answer:e.answer,note:e.note})),clarification:EA(F({when:I(),ask:I(),reason:I()}),e=>uA({when:e.when,ask:e.ask,reason:e.reason})),workflow:EA(F({task:I(),steps:et(I()),triggers:et(I()).optional(),notes:I().optional()}),e=>dA({task:e.task,steps:e.steps,triggers:e.triggers,notes:e.notes})),quirk:EA(F({issue:I(),workaround:I()}),e=>fA({issue:e.issue,workaround:e.workaround})),styleGuide:EA(F({prefer:I(),never:I().optional(),always:I().optional()}),e=>pA({prefer:e.prefer,never:e.never,always:e.always})),analogy:EA(F({concepts:et(I()),relationship:I(),insight:I().optional(),therefore:I().optional(),pitfall:I().optional()}),e=>mA({concepts:e.concepts,relationship:e.relationship,insight:e.insight,therefore:e.therefore,pitfall:e.pitfall})),glossary:EA(F({entries:y(I(),I())}),e=>hA(e.entries)),role:EA(F({content:I()}),e=>gA(e.content)),principle:EA(F({title:I(),description:I(),policies:DA}),(e,t)=>_A({title:e.title,description:e.description,policies:e.policies?.map(e=>TA(e,t))})),policy:EA(F({rule:I(),before:I().optional(),reason:I().optional(),policies:DA}),(e,t)=>vA({rule:e.rule,before:e.before,reason:e.reason,policies:e.policies?.map(e=>TA(e,t))})),identity:EA(F({name:I().optional(),role:I().optional()}),e=>yA({name:e.name,role:e.role})),persona:EA(F({name:I(),role:I().optional(),objective:I().optional(),tone:I().optional()}),e=>bA({name:e.name,role:e.role,objective:e.objective,tone:e.tone})),alias:EA(F({term:I(),meaning:I()}),e=>xA(e.term,e.meaning)),preference:EA(F({aspect:I(),value:I()}),e=>SA(e.aspect,e.value)),correction:EA(F({subject:I(),clarification:I()}),e=>CA(e.subject,e.clarification))};function kA(e){return Object.hasOwn(OA,e)}var AA=new Set([`user`,`assistant`,`message`]);function jA(e,t){if(AA.has(e.type))throw Error(`Message fragments are not supported by serialized fragment conversion`);let n=t?.registry?.[e.type]??(kA(e.type)?OA[e.type]:void 0);if(!n)throw Error(`Unsupported serialized fragment type: ${e.type}`);return n.toFragment(e,t)}var MA={encode(e){return ok(e)},count(e){return ok(e).length}},NA=F({input:wt(),output:wt(),cache_read:wt().optional(),cache_write:wt().optional(),reasoning:wt().optional()}),PA=y(I(),F({models:y(I(),F({id:I(),name:I(),family:I().optional(),cost:NA.optional(),limit:F({context:wt(),output:wt()})}))}));function FA(e){if(!e.cost)throw Error(`Model "${e.provider}:${e.id}" has no pricing data on models.dev`);return e.cost.input}new class{#e=new Map;#t=new Map;#n=MA;#r=Tk(()=>this.#i());async load(){await this.#r()}async#i(){let e=await fetch(`https://models.dev/api.json`);if(!e.ok)throw Error(`Failed to fetch models: ${e.statusText}`);let t=PA.parse(await e.json());for(let[e,n]of Object.entries(t))for(let[t,r]of Object.entries(n.models)){let n={id:r.id,name:r.name,family:r.family,cost:r.cost,limit:r.limit,provider:e};this.#e.set(`${e}:${t}`,n)}}get(e){return this.#e.get(e)}has(e){return this.#e.has(e)}list(){return[...this.#e.keys()]}registerTokenizer(e,t){this.#t.set(e,t)}setDefaultTokenizer(e){this.#n=e}getTokenizer(e){let t=this.get(e)?.family;return(t===void 0?void 0:this.#t.get(t))??this.#n}estimate(e,t){let n=this.get(e);if(!n)throw Error(`Model "${e}" not found. Call load() first or check model ID.`);let r=FA(n),i=this.getTokenizer(e).count(t),a=i/1e6*r;return{model:n.id,provider:n.provider,tokens:i,cost:a,limits:{context:n.limit.context,output:n.limit.output,exceedsContext:i>n.limit.context},fragments:[]}}};function IA(e){let t=e?.reminders;return Array.isArray(t)?t.filter(e=>ed(e)&&typeof e.partIndex==`number`&&typeof e.start==`number`&&typeof e.end==`number`):[]}function LA(e,t){if(t.length===0)return e;let n=t.map(t=>({start:Math.max(0,Math.min(e.length,t.start)),end:Math.max(0,Math.min(e.length,t.end))})).filter(e=>e.end>e.start).sort((e,t)=>e.start-t.start);if(n.length===0)return e;let r=0,i=``;for(let t of n){if(t.start<r){t.end>r&&(r=t.end);continue}i+=e.slice(r,t.start),r=t.end}return i+=e.slice(r),i.trimEnd()}function RA(e){if(zA(e))return BA(e);let t=IA(ed(e.metadata)?e.metadata:void 0),n=new Map;for(let e of t){let t=n.get(e.partIndex)??[];t.push({start:e.start,end:e.end}),n.set(e.partIndex,t)}let r=e.parts.flatMap((e,t)=>{let r={...e},i=n.get(t);if(r.type!==`text`||i===void 0)return[r];let a=LA(r.text,i);return a.length===0?[]:[{...r,text:a}]}),i={...e,parts:r};if(ed(e.metadata)){let t={...e.metadata};delete t.reminders,Object.keys(t).length>0?i.metadata=t:delete i.metadata}return i}function zA(e){let t=e.metadata;if(!ed(t))return!1;let n=t.synthetic;return ed(n)?n.source===`reminder`:!1}function BA(e){let t={...e,parts:e.parts.filter(e=>e.type!==`text`)};if(ed(e.metadata)){let n={...e.metadata};delete n.synthetic,Object.keys(n).length>0?t.metadata=n:delete t.metadata}return t}Xk`A skill is a set of local instructions to follow that is stored in a \`SKILL.md\` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill.
|
|
3336
3336
|
|
|
3337
3337
|
### How to use skills
|
|
3338
3338
|
- Discovery: The list below shows the skills available in this session (name + description + file path). Skill bodies live on disk at the listed paths.
|
|
@@ -3446,20 +3446,20 @@ img.ProseMirror-separator {
|
|
|
3446
3446
|
display: block;
|
|
3447
3447
|
}`,FU=class extends AH{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:YV,createMappablePosition:XV},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=fB(t,this.options.autofocus);this.editorState=aP.create({doc:t,schema:this.schema,selection:e||void 0})}MU(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():zz.createFakeChain()}can(){return this.commandManager?this.commandManager.can():zz.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=QH(PU,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return jH&&!this.hasWarnedStaleDecorationRead&&kH(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=lV(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[wU,bU.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),xU,EU,DU,kU.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),CU,OU,SU,AU.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new vU(n,this)}createCommandManager(){this.commandManager=new zz({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=eV(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=eV(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=aP.create({doc:t,schema:this.schema,selection:fB(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new gz(e,{...t,attributes:{role:`textbox`,...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return AV(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return VV(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return cV(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
3448
3448
|
|
|
3449
|
-
`,textSerializers:n={}}=e||{};return DV(this.state.doc,{blockSeparator:t,textSerializers:{...OV(this.schema),...n}})}get isEmpty(){return KV(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new NU(t,this,!1,n)}get $doc(){return this.$pos(0)}};function IU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uV(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(PV(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function LU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uV(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function RU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=uV(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function zU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=uV(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&rN(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&hN(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var BU=class e extends uU{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function VU(e){return new fU({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=uV(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(PV(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:HU,getOwnPropertySymbols:UU}=Object,{hasOwnProperty:WU}=Object.prototype;function GU(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function KU(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function qU(e){return e?.[Symbol.toStringTag]}function JU(e){return HU(e).concat(UU(e))}var YU=Object.hasOwn||((e,t)=>WU.call(e,t));function XU(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var ZU=`__v`,QU=`__o`,$U=`_owner`,{getOwnPropertyDescriptor:eW,keys:tW}=Object;function nW(e,t){return e.byteLength===t.byteLength&&hW(new Uint8Array(e),new Uint8Array(t))}function rW(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function iW(e,t){return e.byteLength===t.byteLength&&hW(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function aW(e,t){return XU(e.getTime(),t.getTime())}function oW(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function sW(e,t){return e===t}function cW(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var lW=XU;function uW(e,t,n){let r=tW(e),i=r.length;if(tW(t).length!==i)return!1;for(;i-->0;)if(!_W(e,t,n,r[i]))return!1;return!0}function dW(e,t,n){let r=JU(e),i=r.length;if(JU(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!_W(e,t,n,a)||(o=eW(e,a),s=eW(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function fW(e,t){return XU(e.valueOf(),t.valueOf())}function pW(e,t){return e.source===t.source&&e.flags===t.flags}function mW(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function hW(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function gW(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function _W(e,t,n,r){return(r===$U||r===QU||r===ZU)&&(e.$$typeof||t.$$typeof)?!0:YU(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var vW=`[object ArrayBuffer]`,yW=`[object Arguments]`,bW=`[object Boolean]`,xW=`[object DataView]`,SW=`[object Date]`,CW=`[object Error]`,wW=`[object Map]`,TW=`[object Number]`,EW=`[object Object]`,DW=`[object RegExp]`,OW=`[object Set]`,kW=`[object String]`,AW={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},jW=`[object URL]`,MW=Object.prototype.toString;function NW({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=MW.call(h);if(b===SW)return r(h,g,_);if(b===DW)return u(h,g,_);if(b===wW)return o(h,g,_);if(b===OW)return d(h,g,_);if(b===EW)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===jW)return p(h,g,_);if(b===CW)return i(h,g,_);if(b===yW)return c(h,g,_);if(AW[b])return f(h,g,_);if(b===vW)return e(h,g,_);if(b===xW)return n(h,g,_);if(b===bW||b===TW||b===kW)return l(h,g,_);if(m){let e=m[b];if(!e){let t=qU(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function PW({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:nW,areArraysEqual:n?dW:rW,areDataViewsEqual:iW,areDatesEqual:aW,areErrorsEqual:oW,areFunctionsEqual:sW,areMapsEqual:n?GU(cW,dW):cW,areNumbersEqual:lW,areObjectsEqual:n?dW:uW,arePrimitiveWrappersEqual:fW,areRegExpsEqual:pW,areSetsEqual:n?GU(mW,dW):mW,areTypedArraysEqual:n?GU(hW,dW):hW,areUrlsEqual:gW,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=KU(r.areArraysEqual),t=KU(r.areMapsEqual),n=KU(r.areObjectsEqual),i=KU(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function FW(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function IW({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var LW=RW();RW({strict:!0}),RW({circular:!0}),RW({circular:!0,strict:!0}),RW({createInternalComparator:()=>XU}),RW({strict:!0,createInternalComparator:()=>XU}),RW({circular:!0,createInternalComparator:()=>XU}),RW({circular:!0,createInternalComparator:()=>XU,strict:!0});function RW(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=NW(PW(e));return IW({circular:t,comparator:a,createState:r,equals:n?n(a):FW(a),strict:i})}var zW=Je(),BW=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},VW=({contentComponent:e})=>{let t=(0,tj.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,R.jsx)(R.Fragment,{children:Object.values(t)})};function HW(){let e=new Set,t={},n=!1,r=()=>{n||!e.size||(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:ID.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var UW=class extends L.Component{constructor(e){super(e),this.editorContentRef=L.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=HW(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{ref:BW(t,this.editorContentRef),...n}),e?.contentComponent&&(0,R.jsx)(VW,{contentComponent:e.contentComponent})]})}},WW=(0,L.forwardRef)((e,t)=>{let n=L.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return L.createElement(UW,{key:n,innerRef:t,...e})}),GW=L.memo(WW),KW=typeof window<`u`?L.useLayoutEffect:L.useEffect,qW=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{t?.transaction!==void 0&&t.transaction===e||(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function JW(e){let[t]=(0,L.useState)(()=>new qW(e.editor)),n=(0,zW.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??LW);return KW(()=>t.watch(e.editor),[e.editor,t]),(0,L.useDebugValue)(n),n}var YW=typeof window>`u`,XW=YW||!!(typeof window<`u`&&window.next),ZW=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(YW||XW&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new FU({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function QW(e={},t=[]){let n=(0,L.useRef)(e);n.current=e;let[r]=(0,L.useState)(()=>new ZW(n)),i=(0,tj.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,L.useDebugValue)(i),(0,L.useEffect)(r.onRender(t)),JW({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var $W=(0,L.createContext)({editor:null});$W.Consumer;var eG=(0,L.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),tG=()=>(0,L.useContext)(eG);L.forwardRef((e,t)=>{let{onDragStart:n}=tG();return(0,R.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),L.createContext({markViewContentRef:()=>{}});var nG=(0,L.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});nG.displayName=`TiptapContext`;var rG=()=>(0,L.useContext)(nG);function iG({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,L.useMemo)(()=>({editor:n}),[n]),i=(0,L.useMemo)(()=>({editor:n}),[n]);return(0,R.jsx)($W.Provider,{value:i,children:(0,R.jsx)(nG.Provider,{value:r,children:e})})}iG.displayName=`Tiptap`;function aG({...e}){let{editor:t}=rG();return(0,R.jsx)(GW,{editor:t,...e})}aG.displayName=`Tiptap.Content`,Object.assign(iG,{Content:aG});var oG=typeof global==`object`&&global&&global.Object===Object&&global,sG=typeof self==`object`&&self&&self.Object===Object&&self,cG=oG||sG||Function(`return this`)(),lG=cG.Symbol,uG=Object.prototype,dG=uG.hasOwnProperty,fG=uG.toString,pG=lG?lG.toStringTag:void 0;function mG(e){var t=dG.call(e,pG),n=e[pG];try{e[pG]=void 0;var r=!0}catch{}var i=fG.call(e);return r&&(t?e[pG]=n:delete e[pG]),i}var hG=Object.prototype.toString;function gG(e){return hG.call(e)}var _G=`[object Null]`,vG=`[object Undefined]`,yG=lG?lG.toStringTag:void 0;function bG(e){return e==null?e===void 0?vG:_G:yG&&yG in Object(e)?mG(e):gG(e)}function xG(e){return typeof e==`object`&&!!e}var SG=`[object Symbol]`;function CG(e){return typeof e==`symbol`||xG(e)&&bG(e)==SG}function wG(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var TG=Array.isArray,EG=1/0,DG=lG?lG.prototype:void 0,OG=DG?DG.toString:void 0;function kG(e){if(typeof e==`string`)return e;if(TG(e))return wG(e,kG)+``;if(CG(e))return OG?OG.call(e):``;var t=e+``;return t==`0`&&1/e==-EG?`-0`:t}function AG(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var jG=`[object AsyncFunction]`,MG=`[object Function]`,NG=`[object GeneratorFunction]`,PG=`[object Proxy]`;function FG(e){if(!AG(e))return!1;var t=bG(e);return t==MG||t==NG||t==jG||t==PG}var IG=cG[`__core-js_shared__`],LG=function(){var e=/[^.]+$/.exec(IG&&IG.keys&&IG.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function RG(e){return!!LG&&LG in e}var zG=Function.prototype.toString;function BG(e){if(e!=null){try{return zG.call(e)}catch{}try{return e+``}catch{}}return``}var VG=/[\\^$.*+?()[\]{}|]/g,HG=/^\[object .+?Constructor\]$/,UG=Function.prototype,WG=Object.prototype,GG=UG.toString,KG=WG.hasOwnProperty,qG=RegExp(`^`+GG.call(KG).replace(VG,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function JG(e){return!AG(e)||RG(e)?!1:(FG(e)?qG:HG).test(BG(e))}function YG(e,t){return e?.[t]}function XG(e,t){var n=YG(e,t);return JG(n)?n:void 0}function ZG(e,t){return e===t||e!==e&&t!==t}var QG=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,$G=/^\w*$/;function eK(e,t){if(TG(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||CG(e)?!0:$G.test(e)||!QG.test(e)||t!=null&&e in Object(t)}var tK=XG(Object,`create`);function nK(){this.__data__=tK?tK(null):{},this.size=0}function rK(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var iK=`__lodash_hash_undefined__`,aK=Object.prototype.hasOwnProperty;function oK(e){var t=this.__data__;if(tK){var n=t[e];return n===iK?void 0:n}return aK.call(t,e)?t[e]:void 0}var sK=Object.prototype.hasOwnProperty;function cK(e){var t=this.__data__;return tK?t[e]!==void 0:sK.call(t,e)}var lK=`__lodash_hash_undefined__`;function uK(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=tK&&t===void 0?lK:t,this}function dK(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}dK.prototype.clear=nK,dK.prototype.delete=rK,dK.prototype.get=oK,dK.prototype.has=cK,dK.prototype.set=uK;function fK(){this.__data__=[],this.size=0}function pK(e,t){for(var n=e.length;n--;)if(ZG(e[n][0],t))return n;return-1}var mK=Array.prototype.splice;function hK(e){var t=this.__data__,n=pK(t,e);return n<0?!1:(n==t.length-1?t.pop():mK.call(t,n,1),--this.size,!0)}function gK(e){var t=this.__data__,n=pK(t,e);return n<0?void 0:t[n][1]}function _K(e){return pK(this.__data__,e)>-1}function vK(e,t){var n=this.__data__,r=pK(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function yK(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}yK.prototype.clear=fK,yK.prototype.delete=hK,yK.prototype.get=gK,yK.prototype.has=_K,yK.prototype.set=vK;var bK=XG(cG,`Map`);function xK(){this.size=0,this.__data__={hash:new dK,map:new(bK||yK),string:new dK}}function SK(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function CK(e,t){var n=e.__data__;return SK(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function wK(e){var t=CK(this,e).delete(e);return this.size-=+!!t,t}function TK(e){return CK(this,e).get(e)}function EK(e){return CK(this,e).has(e)}function DK(e,t){var n=CK(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function OK(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}OK.prototype.clear=xK,OK.prototype.delete=wK,OK.prototype.get=TK,OK.prototype.has=EK,OK.prototype.set=DK;var kK=`Expected a function`;function AK(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(kK);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(AK.Cache||OK),n}AK.Cache=OK;var jK=500;function MK(e){var t=AK(e,function(e){return n.size===jK&&n.clear(),e}),n=t.cache;return t}var NK=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,PK=/\\(\\)?/g,FK=MK(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(NK,function(e,n,r,i){t.push(r?i.replace(PK,`$1`):n||e)}),t});function IK(e){return e==null?``:kG(e)}function LK(e,t){return TG(e)?e:eK(e,t)?[e]:FK(IK(e))}var RK=1/0;function zK(e){if(typeof e==`string`||CG(e))return e;var t=e+``;return t==`0`&&1/e==-RK?`-0`:t}function BK(e,t){t=LK(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[zK(t[n++])];return n&&n==r?e:void 0}function VK(e,t,n){var r=e==null?void 0:BK(e,t);return r===void 0?n:r}var HK=/[\\^$.*+?()[\]{}|]/g,UK=RegExp(HK.source);function WK(e){return e=IK(e),e&&UK.test(e)?e.replace(HK,`\\$&`):e}var GK=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,KK=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,qK=`numeric`,JK=`ascii`,YK=`alpha`,XK=`asciinumeric`,ZK=`alphanumeric`,QK=`domain`,$K=`emoji`,eq=`scheme`,tq=`slashscheme`,nq=`whitespace`;function rq(e,t){return e in t||(t[e]=[]),t[e]}function iq(e,t,n){t[qK]&&(t[XK]=!0,t[ZK]=!0),t[JK]&&(t[XK]=!0,t[YK]=!0),t[XK]&&(t[ZK]=!0),t[YK]&&(t[ZK]=!0),t[ZK]&&(t[QK]=!0),t[$K]&&(t[QK]=!0);for(let r in t){let t=rq(r,n);t.indexOf(e)<0&&t.push(e)}}function aq(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function oq(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}oq.groups={},oq.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=oq.groups;let i;return t&&t.j?i=t:(i=new oq(t),n&&r&&iq(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=oq.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new oq,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new oq,a&&(r&&(o.t&&typeof o.t==`string`?iq(a,Object.assign(aq(o.t,r),n),r):n&&iq(a,n,r)),o.t=a),i.j[e]=o,o}};var X=(e,t,n,r,i)=>e.ta(t,n,r,i),sq=(e,t,n,r,i)=>e.tr(t,n,r,i),cq=(e,t,n,r,i)=>e.ts(t,n,r,i),Z=(e,t,n,r,i)=>e.tt(t,n,r,i),lq=`WORD`,uq=`UWORD`,dq=`ASCIINUMERICAL`,fq=`ALPHANUMERICAL`,pq=`LOCALHOST`,mq=`TLD`,hq=`UTLD`,gq=`SCHEME`,_q=`SLASH_SCHEME`,vq=`NUM`,yq=`WS`,bq=`NL`,xq=`OPENBRACE`,Sq=`CLOSEBRACE`,Cq=`OPENBRACKET`,wq=`CLOSEBRACKET`,Tq=`OPENPAREN`,Eq=`CLOSEPAREN`,Dq=`OPENANGLEBRACKET`,Oq=`CLOSEANGLEBRACKET`,kq=`FULLWIDTHLEFTPAREN`,Aq=`FULLWIDTHRIGHTPAREN`,jq=`LEFTCORNERBRACKET`,Mq=`RIGHTCORNERBRACKET`,Nq=`LEFTWHITECORNERBRACKET`,Pq=`RIGHTWHITECORNERBRACKET`,Fq=`FULLWIDTHLESSTHAN`,Iq=`FULLWIDTHGREATERTHAN`,Lq=`AMPERSAND`,Rq=`APOSTROPHE`,zq=`ASTERISK`,Bq=`AT`,Vq=`BACKSLASH`,Hq=`BACKTICK`,Uq=`CARET`,Wq=`COLON`,Gq=`COMMA`,Kq=`DOLLAR`,qq=`DOT`,Jq=`EQUALS`,Yq=`EXCLAMATION`,Xq=`HYPHEN`,Zq=`PERCENT`,Qq=`PIPE`,$q=`PLUS`,eJ=`POUND`,tJ=`QUERY`,nJ=`QUOTE`,rJ=`FULLWIDTHMIDDLEDOT`,iJ=`SEMI`,aJ=`SLASH`,oJ=`TILDE`,sJ=`UNDERSCORE`,cJ=`EMOJI`,lJ=`SYM`,uJ=Object.freeze({__proto__:null,ALPHANUMERICAL:fq,AMPERSAND:Lq,APOSTROPHE:Rq,ASCIINUMERICAL:dq,ASTERISK:zq,AT:Bq,BACKSLASH:Vq,BACKTICK:Hq,CARET:Uq,CLOSEANGLEBRACKET:Oq,CLOSEBRACE:Sq,CLOSEBRACKET:wq,CLOSEPAREN:Eq,COLON:Wq,COMMA:Gq,DOLLAR:Kq,DOT:qq,EMOJI:cJ,EQUALS:Jq,EXCLAMATION:Yq,FULLWIDTHGREATERTHAN:Iq,FULLWIDTHLEFTPAREN:kq,FULLWIDTHLESSTHAN:Fq,FULLWIDTHMIDDLEDOT:rJ,FULLWIDTHRIGHTPAREN:Aq,HYPHEN:Xq,LEFTCORNERBRACKET:jq,LEFTWHITECORNERBRACKET:Nq,LOCALHOST:pq,NL:bq,NUM:vq,OPENANGLEBRACKET:Dq,OPENBRACE:xq,OPENBRACKET:Cq,OPENPAREN:Tq,PERCENT:Zq,PIPE:Qq,PLUS:$q,POUND:eJ,QUERY:tJ,QUOTE:nJ,RIGHTCORNERBRACKET:Mq,RIGHTWHITECORNERBRACKET:Pq,SCHEME:gq,SEMI:iJ,SLASH:aJ,SLASH_SCHEME:_q,SYM:lJ,TILDE:oJ,TLD:mq,UNDERSCORE:sJ,UTLD:hq,UWORD:uq,WORD:lq,WS:yq}),dJ=/[a-z]/,fJ=/\p{L}/u,pJ=/\p{Emoji}/u,mJ=/\d/,hJ=/\s/,gJ=`\r`,_J=`
|
|
3450
|
-
`,
|
|
3449
|
+
`,textSerializers:n={}}=e||{};return DV(this.state.doc,{blockSeparator:t,textSerializers:{...OV(this.schema),...n}})}get isEmpty(){return KV(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new NU(t,this,!1,n)}get $doc(){return this.$pos(0)}};function IU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uV(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(PV(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function LU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r})=>{let i=uV(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function RU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=uV(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function zU(e){return new oU({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=uV(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&rN(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&hN(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var BU=class e extends uU{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}};function VU(e){return new fU({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=uV(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(PV(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var{getOwnPropertyNames:HU,getOwnPropertySymbols:UU}=Object,{hasOwnProperty:WU}=Object.prototype;function GU(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function KU(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function qU(e){return e?.[Symbol.toStringTag]}function JU(e){return HU(e).concat(UU(e))}var YU=Object.hasOwn||((e,t)=>WU.call(e,t));function XU(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var ZU=`__v`,QU=`__o`,$U=`_owner`,{getOwnPropertyDescriptor:eW,keys:tW}=Object;function nW(e,t){return e.byteLength===t.byteLength&&hW(new Uint8Array(e),new Uint8Array(t))}function rW(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function iW(e,t){return e.byteLength===t.byteLength&&hW(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function aW(e,t){return XU(e.getTime(),t.getTime())}function oW(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function sW(e,t){return e===t}function cW(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var lW=XU;function uW(e,t,n){let r=tW(e),i=r.length;if(tW(t).length!==i)return!1;for(;i-->0;)if(!_W(e,t,n,r[i]))return!1;return!0}function dW(e,t,n){let r=JU(e),i=r.length;if(JU(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!_W(e,t,n,a)||(o=eW(e,a),s=eW(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function fW(e,t){return XU(e.valueOf(),t.valueOf())}function pW(e,t){return e.source===t.source&&e.flags===t.flags}function mW(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function hW(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function gW(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function _W(e,t,n,r){return(r===$U||r===QU||r===ZU)&&(e.$$typeof||t.$$typeof)?!0:YU(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var vW=`[object ArrayBuffer]`,yW=`[object Arguments]`,bW=`[object Boolean]`,xW=`[object DataView]`,SW=`[object Date]`,CW=`[object Error]`,wW=`[object Map]`,TW=`[object Number]`,EW=`[object Object]`,DW=`[object RegExp]`,OW=`[object Set]`,kW=`[object String]`,AW={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},jW=`[object URL]`,MW=Object.prototype.toString;function NW({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=MW.call(h);if(b===SW)return r(h,g,_);if(b===DW)return u(h,g,_);if(b===wW)return o(h,g,_);if(b===OW)return d(h,g,_);if(b===EW)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===jW)return p(h,g,_);if(b===CW)return i(h,g,_);if(b===yW)return c(h,g,_);if(AW[b])return f(h,g,_);if(b===vW)return e(h,g,_);if(b===xW)return n(h,g,_);if(b===bW||b===TW||b===kW)return l(h,g,_);if(m){let e=m[b];if(!e){let t=qU(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function PW({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:nW,areArraysEqual:n?dW:rW,areDataViewsEqual:iW,areDatesEqual:aW,areErrorsEqual:oW,areFunctionsEqual:sW,areMapsEqual:n?GU(cW,dW):cW,areNumbersEqual:lW,areObjectsEqual:n?dW:uW,arePrimitiveWrappersEqual:fW,areRegExpsEqual:pW,areSetsEqual:n?GU(mW,dW):mW,areTypedArraysEqual:n?GU(hW,dW):hW,areUrlsEqual:gW,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=KU(r.areArraysEqual),t=KU(r.areMapsEqual),n=KU(r.areObjectsEqual),i=KU(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function FW(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function IW({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var LW=RW();RW({strict:!0}),RW({circular:!0}),RW({circular:!0,strict:!0}),RW({createInternalComparator:()=>XU}),RW({strict:!0,createInternalComparator:()=>XU}),RW({circular:!0,createInternalComparator:()=>XU}),RW({circular:!0,createInternalComparator:()=>XU,strict:!0});function RW(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=NW(PW(e));return IW({circular:t,comparator:a,createState:r,equals:n?n(a):FW(a),strict:i})}var zW=Je(),BW=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},VW=({contentComponent:e})=>{let t=(0,tj.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,R.jsx)(R.Fragment,{children:Object.values(t)})};function HW(){let e=new Set,t={},n=!1,r=()=>{n||!e.size||(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:LD.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var UW=class extends L.Component{constructor(e){super(e),this.editorContentRef=L.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=HW(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{ref:BW(t,this.editorContentRef),...n}),e?.contentComponent&&(0,R.jsx)(VW,{contentComponent:e.contentComponent})]})}},WW=(0,L.forwardRef)((e,t)=>{let n=L.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return L.createElement(UW,{key:n,innerRef:t,...e})}),GW=L.memo(WW),KW=typeof window<`u`?L.useLayoutEffect:L.useEffect,qW=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{t?.transaction!==void 0&&t.transaction===e||(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function JW(e){let[t]=(0,L.useState)(()=>new qW(e.editor)),n=(0,zW.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??LW);return KW(()=>t.watch(e.editor),[e.editor,t]),(0,L.useDebugValue)(n),n}var YW=typeof window>`u`,XW=YW||!!(typeof window<`u`&&window.next),ZW=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(YW||XW&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new FU({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){t&&t.setOptions(this.options.current);return}t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function QW(e={},t=[]){let n=(0,L.useRef)(e);n.current=e;let[r]=(0,L.useState)(()=>new ZW(n)),i=(0,tj.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,L.useDebugValue)(i),(0,L.useEffect)(r.onRender(t)),JW({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var $W=(0,L.createContext)({editor:null});$W.Consumer;var eG=(0,L.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),tG=()=>(0,L.useContext)(eG);L.forwardRef((e,t)=>{let{onDragStart:n}=tG();return(0,R.jsx)(e.as||`div`,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})}),L.createContext({markViewContentRef:()=>{}});var nG=(0,L.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});nG.displayName=`TiptapContext`;var rG=()=>(0,L.useContext)(nG);function iG({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,L.useMemo)(()=>({editor:n}),[n]),i=(0,L.useMemo)(()=>({editor:n}),[n]);return(0,R.jsx)($W.Provider,{value:i,children:(0,R.jsx)(nG.Provider,{value:r,children:e})})}iG.displayName=`Tiptap`;function aG({...e}){let{editor:t}=rG();return(0,R.jsx)(GW,{editor:t,...e})}aG.displayName=`Tiptap.Content`,Object.assign(iG,{Content:aG});var oG=`aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2`,sG=`ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2`,cG=`numeric`,lG=`ascii`,uG=`alpha`,dG=`asciinumeric`,fG=`alphanumeric`,pG=`domain`,mG=`emoji`,hG=`scheme`,gG=`slashscheme`,_G=`whitespace`;function vG(e,t){return e in t||(t[e]=[]),t[e]}function yG(e,t,n){t[cG]&&(t[dG]=!0,t[fG]=!0),t[lG]&&(t[dG]=!0,t[uG]=!0),t[dG]&&(t[fG]=!0),t[uG]&&(t[fG]=!0),t[fG]&&(t[pG]=!0),t[mG]&&(t[pG]=!0);for(let r in t){let t=vG(r,n);t.indexOf(e)<0&&t.push(e)}}function bG(e,t){let n={};for(let r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function xG(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}xG.groups={},xG.prototype={accepts(){return!!this.t},go(e){let t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){let r=t.jr[n][0],i=t.jr[n][1];if(i&&r.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let i=0;i<e.length;i++)this.tt(e[i],t,n,r)},tr(e,t,n,r){r||=xG.groups;let i;return t&&t.j?i=t:(i=new xG(t),n&&r&&yG(t,n,r)),this.jr.push([e,i]),i},ts(e,t,n,r){let i=this,a=e.length;if(!a)return i;for(let t=0;t<a-1;t++)i=i.tt(e[t]);return i.tt(e[a-1],t,n,r)},tt(e,t,n,r){r||=xG.groups;let i=this;if(t&&t.j)return i.j[e]=t,t;let a=t,o,s=i.go(e);return s?(o=new xG,Object.assign(o.j,s.j),o.jr.push.apply(o.jr,s.jr),o.jd=s.jd,o.t=s.t):o=new xG,a&&(r&&(o.t&&typeof o.t==`string`?yG(a,Object.assign(bG(o.t,r),n),r):n&&yG(a,n,r)),o.t=a),i.j[e]=o,o}};var X=(e,t,n,r,i)=>e.ta(t,n,r,i),SG=(e,t,n,r,i)=>e.tr(t,n,r,i),CG=(e,t,n,r,i)=>e.ts(t,n,r,i),Z=(e,t,n,r,i)=>e.tt(t,n,r,i),wG=`WORD`,TG=`UWORD`,EG=`ASCIINUMERICAL`,DG=`ALPHANUMERICAL`,OG=`LOCALHOST`,kG=`TLD`,AG=`UTLD`,jG=`SCHEME`,MG=`SLASH_SCHEME`,NG=`NUM`,PG=`WS`,FG=`NL`,IG=`OPENBRACE`,LG=`CLOSEBRACE`,RG=`OPENBRACKET`,zG=`CLOSEBRACKET`,BG=`OPENPAREN`,VG=`CLOSEPAREN`,HG=`OPENANGLEBRACKET`,UG=`CLOSEANGLEBRACKET`,WG=`FULLWIDTHLEFTPAREN`,GG=`FULLWIDTHRIGHTPAREN`,KG=`LEFTCORNERBRACKET`,qG=`RIGHTCORNERBRACKET`,JG=`LEFTWHITECORNERBRACKET`,YG=`RIGHTWHITECORNERBRACKET`,XG=`FULLWIDTHLESSTHAN`,ZG=`FULLWIDTHGREATERTHAN`,QG=`AMPERSAND`,$G=`APOSTROPHE`,eK=`ASTERISK`,tK=`AT`,nK=`BACKSLASH`,rK=`BACKTICK`,iK=`CARET`,aK=`COLON`,oK=`COMMA`,sK=`DOLLAR`,cK=`DOT`,lK=`EQUALS`,uK=`EXCLAMATION`,dK=`HYPHEN`,fK=`PERCENT`,pK=`PIPE`,mK=`PLUS`,hK=`POUND`,gK=`QUERY`,_K=`QUOTE`,vK=`FULLWIDTHMIDDLEDOT`,yK=`SEMI`,bK=`SLASH`,xK=`TILDE`,SK=`UNDERSCORE`,CK=`EMOJI`,wK=`SYM`,TK=Object.freeze({__proto__:null,ALPHANUMERICAL:DG,AMPERSAND:QG,APOSTROPHE:$G,ASCIINUMERICAL:EG,ASTERISK:eK,AT:tK,BACKSLASH:nK,BACKTICK:rK,CARET:iK,CLOSEANGLEBRACKET:UG,CLOSEBRACE:LG,CLOSEBRACKET:zG,CLOSEPAREN:VG,COLON:aK,COMMA:oK,DOLLAR:sK,DOT:cK,EMOJI:CK,EQUALS:lK,EXCLAMATION:uK,FULLWIDTHGREATERTHAN:ZG,FULLWIDTHLEFTPAREN:WG,FULLWIDTHLESSTHAN:XG,FULLWIDTHMIDDLEDOT:vK,FULLWIDTHRIGHTPAREN:GG,HYPHEN:dK,LEFTCORNERBRACKET:KG,LEFTWHITECORNERBRACKET:JG,LOCALHOST:OG,NL:FG,NUM:NG,OPENANGLEBRACKET:HG,OPENBRACE:IG,OPENBRACKET:RG,OPENPAREN:BG,PERCENT:fK,PIPE:pK,PLUS:mK,POUND:hK,QUERY:gK,QUOTE:_K,RIGHTCORNERBRACKET:qG,RIGHTWHITECORNERBRACKET:YG,SCHEME:jG,SEMI:yK,SLASH:bK,SLASH_SCHEME:MG,SYM:wK,TILDE:xK,TLD:kG,UNDERSCORE:SK,UTLD:AG,UWORD:TG,WORD:wG,WS:PG}),EK=/[a-z]/,DK=/\p{L}/u,OK=/\p{Emoji}/u,kK=/\d/,AK=/\s/,jK=`\r`,MK=`
|
|
3450
|
+
`,NK=`️`,PK=``,FK=``,IK=null,LK=null;function RK(e=[]){let t={};xG.groups=t;let n=new xG;IK??=HK(oG),LK??=HK(sG),Z(n,`'`,$G),Z(n,`{`,IG),Z(n,`}`,LG),Z(n,`[`,RG),Z(n,`]`,zG),Z(n,`(`,BG),Z(n,`)`,VG),Z(n,`<`,HG),Z(n,`>`,UG),Z(n,`(`,WG),Z(n,`)`,GG),Z(n,`「`,KG),Z(n,`」`,qG),Z(n,`『`,JG),Z(n,`』`,YG),Z(n,`<`,XG),Z(n,`>`,ZG),Z(n,`&`,QG),Z(n,`*`,eK),Z(n,`@`,tK),Z(n,"`",rK),Z(n,`^`,iK),Z(n,`:`,aK),Z(n,`,`,oK),Z(n,`$`,sK),Z(n,`.`,cK),Z(n,`=`,lK),Z(n,`!`,uK),Z(n,`-`,dK),Z(n,`%`,fK),Z(n,`|`,pK),Z(n,`+`,mK),Z(n,`#`,hK),Z(n,`?`,gK),Z(n,`"`,_K),Z(n,`/`,bK),Z(n,`;`,yK),Z(n,`~`,xK),Z(n,`_`,SK),Z(n,`\\`,nK),Z(n,`・`,vK);let r=SG(n,kK,NG,{[cG]:!0});SG(r,kK,r);let i=SG(r,EK,EG,{[dG]:!0}),a=SG(r,DK,DG,{[fG]:!0}),o=SG(n,EK,wG,{[lG]:!0});SG(o,kK,i),SG(o,EK,o),SG(i,kK,i),SG(i,EK,i);let s=SG(n,DK,TG,{[uG]:!0});SG(s,EK),SG(s,kK,a),SG(s,DK,s),SG(a,kK,a),SG(a,EK),SG(a,DK,a);let c=Z(n,MK,FG,{[_G]:!0}),l=Z(n,jK,PG,{[_G]:!0}),u=SG(n,AK,PG,{[_G]:!0});Z(n,FK,u),Z(l,MK,c),Z(l,FK,u),SG(l,AK,u),Z(u,jK),Z(u,MK),SG(u,AK,u),Z(u,FK,u);let d=SG(n,OK,CK,{[mG]:!0});Z(d,`#`),SG(d,OK,d),Z(d,NK,d);let f=Z(d,PK);Z(f,`#`),SG(f,OK,d);let p=[[EK,o],[kK,i]],m=[[EK,null],[DK,s],[kK,a]];for(let e=0;e<IK.length;e++)VK(n,IK[e],kG,wG,p);for(let e=0;e<LK.length;e++)VK(n,LK[e],AG,TG,m);yG(kG,{tld:!0,ascii:!0},t),yG(AG,{utld:!0,alpha:!0},t),VK(n,`file`,jG,wG,p),VK(n,`mailto`,jG,wG,p),VK(n,`http`,MG,wG,p),VK(n,`https`,MG,wG,p),VK(n,`ftp`,MG,wG,p),VK(n,`ftps`,MG,wG,p),yG(jG,{scheme:!0,ascii:!0},t),yG(MG,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){let r=e[t][0],i=e[t][1]?{[hG]:!0}:{[gG]:!0};r.indexOf(`-`)>=0?i[pG]=!0:EK.test(r)?kK.test(r)?i[dG]=!0:i[lG]=!0:i[cG]=!0,CG(n,r,r,i)}return CG(n,`localhost`,OG,{ascii:!0}),n.jd=new xG(wK),{start:n,tokens:Object.assign({groups:t},TK)}}function zK(e,t){let n=BK(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,i=[],a=0,o=0;for(;o<r;){let s=e,c=null,l=0,u=null,d=-1,f=-1;for(;o<r&&(c=s.go(n[o]));)s=c,s.accepts()?(d=0,f=0,u=s):d>=0&&(d+=n[o].length,f++),l+=n[o].length,a+=n[o].length,o++;a-=d,o-=f,l-=d,i.push({t:u.t,v:t.slice(a-l,a),s:a-l,e:a})}return i}function BK(e){let t=[],n=e.length,r=0;for(;r<n;){let i=e.charCodeAt(r),a,o=i<55296||i>56319||r+1===n||(a=e.charCodeAt(r+1))<56320||a>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function VK(e,t,n,r,i){let a,o=t.length;for(let n=0;n<o-1;n++){let o=t[n];e.j[o]?a=e.j[o]:(a=new xG(r),a.jr=i.slice(),e.j[o]=a),e=a}return a=new xG(n),a.jr=i.slice(),e.j[t[o-1]]=a,a}function HK(e){let t=[],n=[],r=0;for(;r<e.length;){let i=0;for(;`0123456789`.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(``));for(let t=parseInt(e.substring(r,r+i),10);t>0;t--)n.pop();r+=i}else n.push(e[r]),r++}return t}var UK={defaultProtocol:`http`,events:null,format:GK,formatHref:GK,nl2br:!1,tagName:`a`,target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function WK(e,t=null){let n=Object.assign({},UK);e&&(n=Object.assign(n,e instanceof WK?e.o:e));let r=n.ignoreTags,i=[];for(let e=0;e<r.length;e++)i.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=i}WK.prototype={o:UK,ignoreTags:[],defaultRender(e){return e},check(e){return this.get(`validate`,e.toString(),e)},get(e,t,n){let r=t!=null,i=this.o[e];return i&&(typeof i==`object`?(i=n.t in i?i[n.t]:UK[e],typeof i==`function`&&r&&(i=i(t,n))):typeof i==`function`&&r&&(i=i(t,n.t,n)),i)},getObj(e,t,n){let r=this.o[e];return typeof r==`function`&&t!=null&&(r=r(t,n.t,n)),r},render(e){let t=e.render(this);return(this.get(`render`,null,e)||this.defaultRender)(t,e.t,e)}};function GK(e){return e}function KK(e,t){this.t=`token`,this.v=e,this.tk=t}KK.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){let t=this.toString(),n=e.get(`truncate`,t,this),r=e.get(`format`,t,this);return n&&r.length>n?r.substring(0,n)+`…`:r},toFormattedHref(e){return e.get(`formatHref`,this.toHref(e.get(`defaultProtocol`)),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=UK.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get(`validate`,this.toString(),this)},render(e){let t=this,n=this.toHref(e.get(`defaultProtocol`)),r=e.get(`formatHref`,n,this),i=e.get(`tagName`,n,t),a=this.toFormattedString(e),o={},s=e.get(`className`,n,t),c=e.get(`target`,n,t),l=e.get(`rel`,n,t),u=e.getObj(`attributes`,n,t),d=e.getObj(`events`,n,t);return o.href=r,s&&(o.class=s),c&&(o.target=c),l&&(o.rel=l),u&&Object.assign(o,u),{tagName:i,attributes:o,content:a,eventListeners:d}}};function qK(e,t){class n extends KK{constructor(t,n){super(t,n),this.t=e}}for(let e in t)n.prototype[e]=t[e];return n.t=e,n}var JK=qK(`email`,{isLink:!0,toHref(){return`mailto:`+this.toString()}}),YK=qK(`text`),XK=qK(`nl`),ZK=qK(`url`,{isLink:!0,toHref(e=UK.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){let e=this.tk;return e.length>=2&&e[0].t!==OG&&e[1].t===aK}}),QK=e=>new xG(e);function $K({groups:e}){let t=e.domain.concat([QG,eK,tK,nK,rK,iK,sK,lK,dK,NG,fK,pK,mK,hK,bK,wK,xK,SK]),n=[$G,aK,oK,cK,uK,fK,gK,_K,yK,HG,UG,IG,LG,zG,RG,BG,VG,WG,GG,KG,qG,JG,YG,XG,ZG],r=[QG,$G,eK,nK,rK,iK,sK,lK,dK,IG,LG,fK,pK,mK,hK,gK,bK,wK,xK,SK],i=QK(),a=Z(i,xK);X(a,r,a),X(a,e.domain,a);let o=QK(),s=QK(),c=QK();X(i,e.domain,o),X(i,e.scheme,s),X(i,e.slashscheme,c),X(o,r,a),X(o,e.domain,o);let l=Z(o,tK);Z(a,tK,l),Z(s,tK,l),Z(c,tK,l);let u=Z(a,cK);X(u,r,a),X(u,e.domain,a);let d=QK();X(l,e.domain,d),X(d,e.domain,d);let f=Z(d,cK);X(f,e.domain,d);let p=QK(JK);X(f,e.tld,p),X(f,e.utld,p),Z(l,OG,p);let m=Z(d,dK);Z(m,dK,m),X(m,e.domain,d),X(p,e.domain,d),Z(p,cK,f),Z(p,dK,m);let h=Z(o,dK),g=Z(o,cK);Z(h,dK,h),X(h,e.domain,o),X(g,r,a),X(g,e.domain,o);let _=QK(ZK);X(g,e.tld,_),X(g,e.utld,_),X(_,e.domain,o),X(_,r,a),Z(_,cK,g),Z(_,dK,h),Z(_,tK,l);let v=Z(_,aK),y=QK(ZK);X(v,e.numeric,y);let b=QK(ZK),x=QK();X(b,t,b),X(b,n,x),X(x,t,b),X(x,n,x),Z(_,bK,b),Z(y,bK,b);let S=Z(s,aK),C=Z(Z(Z(c,aK),bK),bK);X(s,e.domain,o),Z(s,cK,g),Z(s,dK,h),X(c,e.domain,o),Z(c,cK,g),Z(c,dK,h),X(S,e.domain,b),Z(S,bK,b),Z(S,gK,b),X(C,e.domain,b),X(C,t,b),Z(C,bK,b);let w=[[IG,LG],[RG,zG],[BG,VG],[HG,UG],[WG,GG],[KG,qG],[JG,YG],[XG,ZG]];for(let e=0;e<w.length;e++){let[r,i]=w[e],a=Z(b,r);Z(x,r,a);let o=QK(ZK);X(a,t,o);let s=QK();X(a,n,s),Z(a,i,b),X(o,t,o),X(o,n,s),X(s,t,o),X(s,n,s),Z(o,i,b),Z(s,i,b)}return Z(i,OG,_),Z(i,FG,XK),{start:i,tokens:TK}}function eq(e,t,n){let r=n.length,i=0,a=[],o=[];for(;i<r;){let s=e,c=null,l=null,u=0,d=null,f=-1;for(;i<r&&!(c=s.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=c||s.go(n[i].t));)c=null,s=l,s.accepts()?(f=0,d=s):f>=0&&f++,i++,u++;if(f<0)i-=u,i<r&&(o.push(n[i]),i++);else{o.length>0&&(a.push(tq(YK,t,o)),o=[]),i-=f,u-=f;let e=d.t,r=n.slice(i-u,i);a.push(tq(e,t,r))}}return o.length>0&&a.push(tq(YK,t,o)),a}function tq(e,t,n){let r=n[0].s,i=n[n.length-1].e;return new e(t.slice(r,i),n)}var nq=typeof console<`u`&&console&&console.warn||(()=>{}),rq=`until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`,iq={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function aq(){return xG.groups={},iq.scanner=null,iq.parser=null,iq.tokenQueue=[],iq.pluginQueue=[],iq.customSchemes=[],iq.initialized=!1,iq}function oq(e,t=!1){if(iq.initialized&&nq(`linkifyjs: already initialized - will not register custom scheme "${e}" ${rq}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw Error(`linkifyjs: incorrect scheme format.
|
|
3451
3451
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
3452
3452
|
2. Cannot start or end with "-"
|
|
3453
|
-
3. "-" cannot repeat`);UJ.customSchemes.push([e,t])}function KJ(){UJ.scanner=CJ(UJ.customSchemes);for(let e=0;e<UJ.tokenQueue.length;e++)UJ.tokenQueue[e][1]({scanner:UJ.scanner});UJ.parser=RJ(UJ.scanner.tokens);for(let e=0;e<UJ.pluginQueue.length;e++)UJ.pluginQueue[e][1]({scanner:UJ.scanner,parser:UJ.parser});return UJ.initialized=!0,UJ}function qJ(e){return UJ.initialized||KJ(),zJ(UJ.parser.start,e,wJ(UJ.scanner.start,e))}qJ.scan=wJ;function JJ(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new kJ(n),i=qJ(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var YJ=`[\0- \xA0 -\u2029 ]`,XJ=new RegExp(YJ),ZJ=RegExp(`${YJ}$`),QJ=new RegExp(YJ,`g`);function $J(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function eY(e){return new sP({key:new uP(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(NV(rV(n.doc,[...t])).forEach(({newRange:t})=>{let n=iV(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!ZJ.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(XJ).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=qJ(n).map(t=>t.toObject(e.defaultProtocol));if(!$J(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{PV(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function tY(e){return new sP({key:new uP(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=AV(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var nY=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,rY=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function iY(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function aY(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"){r+=1;continue}if(n===0&&iY(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function oY(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||iY(e,t.index??0)||aY(e,t.index??0)?!1:!!r.trim()&&n(i)}function sY(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function cY(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function lY(e){return{href:e.data?.href,title:e.data?.title??null}}function uY(e){let t=IU({find:t=>{let n=nY.exec(t);return!n||!oY(t,n,e.isAllowedHref)?null:sY(n)},type:e.type,getAttributes:lY});return new oU({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function dY(e){let t=VU({find:t=>{let n=[];for(let r of t.matchAll(rY))oY(t,r,e.isAllowedHref)&&n.push(sY(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>cY(t,e)));return[...n,...r]},type:e.type,getAttributes:lY});return new fU({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function fY(e){return new sP({key:new uP(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=JJ(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function pY(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(QJ,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var mY=dU.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){GJ(e);return}GJ(e.scheme,e.optionalSlashes)})},onDestroy(){WJ()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!pY(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!pY(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!pY(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,gV(this.options.HTMLAttributes,e),0]:[`a`,gV(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!pY(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!pY(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[uY({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!pY(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;JJ(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!pY(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[dY({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!pY(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[VU({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(eY({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!pY(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(tY({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(fY({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),hY=mY,gY=new WeakSet,_Y=new WeakSet;function vY(e){let t=e;return gY.add(t),t}function yY(e){return Array.isArray(e)&&gY.has(e)}function bY(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&_Y.has(e)&&!yY(e)?bY(e):[e])}function xY(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!yY(n)&&!_Y.has(n)?vY(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(yY(n))return vY([e,r,n]);if(n.length===0)return vY([e,r]);let t=bY(n);return t.length===0?vY([e,r]):vY([e,r,...t])}return vY(n==null?[e,r]:[e,r,n])}var SY=(e,t)=>xY(e,t),CY=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new G(n,0,0);return e.replace(l,i.after(),r),e.setSelection(q.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},wY=/^\s*>\s$/,TY=BU.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return SY(`blockquote`,{...gV(this.options.HTMLAttributes,e),children:SY(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
3453
|
+
3. "-" cannot repeat`);iq.customSchemes.push([e,t])}function sq(){iq.scanner=RK(iq.customSchemes);for(let e=0;e<iq.tokenQueue.length;e++)iq.tokenQueue[e][1]({scanner:iq.scanner});iq.parser=$K(iq.scanner.tokens);for(let e=0;e<iq.pluginQueue.length;e++)iq.pluginQueue[e][1]({scanner:iq.scanner,parser:iq.parser});return iq.initialized=!0,iq}function cq(e){return iq.initialized||sq(),eq(iq.parser.start,e,zK(iq.scanner.start,e))}cq.scan=zK;function lq(e,t=null,n=null){if(t&&typeof t==`object`){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}let r=new WK(n),i=cq(e),a=[];for(let e=0;e<i.length;e++){let n=i[e];n.isLink&&(!t||n.t===t)&&r.check(n)&&a.push(n.toFormattedObject(r))}return a}var uq=`[\0- \xA0 -\u2029 ]`,dq=new RegExp(uq),fq=RegExp(`${uq}$`),pq=new RegExp(uq,`g`);function mq(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?[`()`,`[]`].includes(e[0].value+e[2].value):!1}function hq(e){return new sP({key:new uP(`autolink`),appendTransaction:(t,n,r)=>{let i=t.some(e=>e.docChanged)&&!n.doc.eq(r.doc),a=t.some(e=>e.getMeta(`preventAutolink`));if(!i||a)return;let{tr:o}=r;if(NV(rV(n.doc,[...t])).forEach(({newRange:t})=>{let n=iV(r.doc,t,e=>e.isTextblock),i,a;if(n.length>1)i=n[0],a=r.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0,` `);else if(n.length){let e=r.doc.textBetween(t.from,t.to,` `,` `);if(!fq.test(e))return;i=n[0],a=r.doc.textBetween(i.pos,t.to,void 0,` `)}if(i&&a){let t=a.split(dq).filter(Boolean);if(t.length<=0)return!1;let n=t[t.length-1],s=i.pos+a.lastIndexOf(n);if(!n)return!1;let c=cq(n).map(t=>t.toObject(e.defaultProtocol));if(!mq(c))return!1;c.filter(e=>e.isLink).map(e=>({...e,from:s+e.start+1,to:s+e.end+1})).filter(e=>!r.schema.marks.code||!r.doc.rangeHasMark(e.from,e.to,r.schema.marks.code)).filter(t=>e.validate(t.value)).filter(t=>e.shouldAutoLink(t.value)).forEach(t=>{PV(t.from,t.to,r.doc).some(t=>t.mark.type===e.type)||o.addMark(t.from,t.to,e.type.create({href:t.href}))})}}),o.steps.length)return o}})}function gq(e){return new sP({key:new uP(`handleClickLink`),props:{handleClick:(t,n,r)=>{if(r.button!==0||!t.editable)return!1;let i=null;if(r.target instanceof HTMLAnchorElement)i=r.target;else{let t=r.target;if(!t)return!1;let n=e.editor.view.dom;i=t.closest(`a`),i&&!n.contains(i)&&(i=null)}if(!i)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){let n=AV(t.state,e.type.name),r=i.href??n.href,o=i.target??n.target;r&&(window.open(r,o),a=!0)}return a}}})}var _q=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,vq=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function yq(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;--r)n+=1;return n%2==1}function bq(e,t){let n=0,r=0;for(;r<t;){if(e[r]!=="`"){r+=1;continue}if(n===0&&yq(e,r)){r+=1;continue}let i=0;for(;r<t&&e[r]==="`";)i+=1,r+=1;n===0?n=i:i===n&&(n=0)}return n>0}function xq(e,t,n){let[,r,i]=t;return(t.index?e[t.index-1]:void 0)===`!`||yq(e,t.index??0)||bq(e,t.index??0)?!1:!!r.trim()&&n(i)}function Sq(e){let[t,n,r,,i,a,o]=e,s=i??a??o;return{index:e.index??0,text:t,replaceWith:n,data:{href:r,title:s||null,markdown:!0}}}function Cq(e,t){return e.index<t.index+t.text.length&&t.index<e.index+e.text.length}function wq(e){return{href:e.data?.href,title:e.data?.title??null}}function Tq(e){let t=IU({find:t=>{let n=_q.exec(t);return!n||!xq(t,n,e.isAllowedHref)?null:Sq(n)},type:e.type,getAttributes:wq});return new oU({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Eq(e){let t=VU({find:t=>{let n=[];for(let r of t.matchAll(vq))xq(t,r,e.isAllowedHref)&&n.push(Sq(r));let r=(e.findPlainUrls?.call(e,t)??[]).filter(e=>!n.some(t=>Cq(t,e)));return[...n,...r]},type:e.type,getAttributes:wq});return new fU({find:t.find,handler:e=>{let n=t.handler(e);return n!==null&&e.state.tr.steps.length&&e.match.data?.markdown&&e.state.tr.setMeta(`preventAutolink`,!0),n}})}function Dq(e){return new sP({key:new uP(`handlePasteLink`),props:{handlePaste:(t,n,r)=>{let{shouldAutoLink:i}=e,{state:a}=t,{selection:o}=a,{empty:s}=o;if(s)return!1;let c=``;r.content.forEach(e=>{c+=e.textContent});let l=lq(c,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===c);return!c||!l||i!==void 0&&!i(l.value)?!1:e.editor.commands.setMark(e.type,{href:l.href})}}})}function Oq(e,t){let n=[`http`,`https`,`ftp`,`ftps`,`mailto`,`tel`,`callto`,`sms`,`cid`,`xmpp`];return t&&t.forEach(e=>{let t=typeof e==`string`?e:e.scheme;t&&n.push(t)}),!e||e.replace(pq,``).match(RegExp(`^(?:(?:${n.map(e=>e.replace(/[-/\\^$*+?.()|[\]{}]/g,`\\$&`)).join(`|`)}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,`i`))}var kq=dU.create({name:`link`,priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e==`string`){oq(e);return}oq(e.scheme,e.optionalSlashes)})},onDestroy(){aq()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer nofollow`,class:null},isAllowedUri:(e,t)=>!!Oq(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{let t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes(`@`))return!0;let r=(e.includes(`@`)?e.split(`@`).pop():e).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute(`href`)}},target:{default:this.options.HTMLAttributes.target??null},rel:{default:this.options.HTMLAttributes.rel??null},class:{default:this.options.HTMLAttributes.class??null},title:{default:null}}},parseHTML(){return[{tag:`a[href]`,getAttrs:e=>{let t=e.getAttribute(`href`);return!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!Oq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!Oq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?[`a`,gV(this.options.HTMLAttributes,e),0]:[`a`,gV(this.options.HTMLAttributes,{...e,href:``}),0]},markdownTokenName:`link`,parseMarkdown:(e,t)=>t.applyMark(`link`,t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{let n=e.attrs?.href??``,r=e.attrs?.title??``,i=t.renderChildren(e);return r?`[${i}](${n} "${r}")`:`[${i}](${n})`},addCommands(){return{setLink:e=>({chain:t})=>{let{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:e=>!!Oq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta(`preventAutolink`,!0).run():!1},toggleLink:e=>({chain:t})=>{let{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!Oq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta(`preventAutolink`,!0).run()}},addInputRules(){return this.options.markdownLinks?[Tq({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Oq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let e=e=>{let t=[];if(e){let{protocols:n,defaultProtocol:r}=this.options;lq(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!Oq(e,n),protocols:n,defaultProtocol:r})).forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t};return this.options.markdownLinks?[Eq({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Oq(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:e})]:[VU({find:e,type:this.type,getAttributes:e=>({href:e.data?.href})})]},addProseMirrorPlugins(){let e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(hq({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!Oq(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),e.push(gq({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick===`whenNotEditable`||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(Dq({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),Aq=kq,jq=new WeakSet,Mq=new WeakSet;function Nq(e){let t=e;return jq.add(t),t}function Pq(e){return Array.isArray(e)&&jq.has(e)}function Fq(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&Mq.has(e)&&!Pq(e)?Fq(e):[e])}function Iq(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!Pq(n)&&!Mq.has(n)?Nq(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(Pq(n))return Nq([e,r,n]);if(n.length===0)return Nq([e,r]);let t=Fq(n);return t.length===0?Nq([e,r]):Nq([e,r,...t])}return Nq(n==null?[e,r]:[e,r,n])}var Lq=(e,t)=>Iq(e,t),Rq=(e,t)=>{let{state:n}=e,{selection:r}=n;if(!r.empty)return!1;let{$from:i}=r;if(i.parentOffset!==0)return!1;let a=i.depth-1;if(a<0)return!1;let o=i.node(a),s=i.index(a);if(s===0)return!1;if(o.type===t)return e.commands.lift(t.name);let c=o.child(s-1);if(c.type!==t||!c.lastChild?.isTextblock)return!1;let l=i.before()-1-1;return e.commands.command(({tr:e,dispatch:t})=>{if(!t)return!0;let n=i.parent.content,r=new G(n,0,0);return e.replace(l,i.after(),r),e.setSelection(q.create(e.doc,l+n.size)),e.scrollIntoView(),t(e),!0})},zq=/^\s*>\s$/,Bq=BU.create({name:`blockquote`,addOptions(){return{HTMLAttributes:{}}},content:`block+`,group:`block`,defining:!0,parseHTML(){return[{tag:`blockquote`}]},renderHTML({HTMLAttributes:e}){return Lq(`blockquote`,{...gV(this.options.HTMLAttributes,e),children:Lq(`slot`,{})})},parseMarkdown:(e,t)=>{let n=t.parseBlockChildren??t.parseChildren;return t.createNode(`blockquote`,void 0,n(e.tokens||[]))},renderMarkdown:(e,t)=>{if(!e.content)return``;let n=[];return e.content.forEach((e,r)=>{let i=(t.renderChild?.call(t,e,r)??t.renderChildren([e])).split(`
|
|
3454
3454
|
`).map(e=>e.trim()===``?`>`:`> ${e}`);n.push(i.join(`
|
|
3455
3455
|
`))}),n.join(`
|
|
3456
3456
|
>
|
|
3457
|
-
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>
|
|
3458
|
-
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??
|
|
3457
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>Rq(this.editor,this.type)}},addInputRules(){return[zU({find:zq,type:this.type})]}}),Vq=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Hq=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Uq=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Wq=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Gq=dU.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Lq(`strong`,{...gV(this.options.HTMLAttributes,e),children:Lq(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[IU({find:Vq,type:this.type}),IU({find:Uq,type:this.type})]},addPasteRules(){return[VU({find:Hq,type:this.type}),VU({find:Wq,type:this.type})]}}),Kq=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},qq=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},Jq=dU.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,gV(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:``,addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[IU({find:Kq,type:this.type})]},addPasteRules(){return[VU({find:qq,type:this.type})]}}),Yq=4,Xq=/^```([a-z]+)?[\s\n]$/,Zq=/^~~~([a-z]+)?[\s\n]$/,Qq=BU.create({name:`codeBlock`,addOptions(){return{languageClassPrefix:`language-`,exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Yq,HTMLAttributes:{}}},content:`text*`,marks:``,group:`block`,code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{let{languageClassPrefix:t}=this.options;return t&&[...e.firstElementChild?.classList||[]].filter(e=>e.startsWith(t)).map(e=>e.replace(t,``))[0]||null},rendered:!1}}},parseHTML(){return[{tag:`pre`,preserveWhitespace:`full`}]},renderHTML({node:e,HTMLAttributes:t}){return[`pre`,gV(this.options.HTMLAttributes,t),[`code`,{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:`code`,parseMarkdown:(e,t)=>e.raw?.startsWith("```")===!1&&e.raw?.startsWith(`~~~`)===!1&&e.codeBlockStyle!==`indented`?[]:t.createNode(`codeBlock`,{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[]),renderMarkdown:(e,t)=>{let n=``,r=e.attrs?.language||``;return n=e.content?[`\`\`\`${r}`,t.renderChildren(e.content),"```"].join(`
|
|
3458
|
+
`):`\`\`\`${r}\n\n\`\`\``,n},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,`paragraph`,e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??Yq,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;if(i.parent.type!==this.type)return!1;let o=` `.repeat(t);return a?e.commands.insertContent(o):e.commands.command(({tr:e})=>{let{from:t,to:i}=r,a=n.doc.textBetween(t,i,`
|
|
3459
3459
|
`,`
|
|
3460
3460
|
`).split(`
|
|
3461
3461
|
`).map(e=>o+e).join(`
|
|
3462
|
-
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??
|
|
3462
|
+
`);return e.replaceWith(t,i,n.schema.text(a)),!0})},"Shift-Tab":({editor:e})=>{if(!this.options.enableTabIndentation)return!1;let t=this.options.tabSize??Yq,{state:n}=e,{selection:r}=n,{$from:i,empty:a}=r;return i.parent.type===this.type?a?e.commands.command(({tr:e})=>{let{pos:r}=i,a=i.start(),o=i.end(),s=n.doc.textBetween(a,o,`
|
|
3463
3463
|
`,`
|
|
3464
3464
|
`).split(`
|
|
3465
3465
|
`),c=0,l=0,u=r-a;for(let e=0;e<s.length;e+=1){if(l+s[e].length>=u){c=e;break}l+=s[e].length+1}let d=s[c].match(/^ */)?.[0]||``,f=Math.min(d.length,t);if(f===0)return!0;let p=a;for(let e=0;e<c;e+=1)p+=s[e].length+1;return e.delete(p,p+f),r-p<=f&&e.setSelection(q.create(e.doc,p)),!0}):e.commands.command(({tr:e})=>{let{from:i,to:a}=r,o=n.doc.textBetween(i,a,`
|
|
@@ -3468,41 +3468,41 @@ img.ProseMirror-separator {
|
|
|
3468
3468
|
`).map(e=>{let n=e.match(/^ */)?.[0]||``,r=Math.min(n.length,t);return e.slice(r)}).join(`
|
|
3469
3469
|
`);return e.replaceWith(i,a,n.schema.text(o)),!0}):!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;let a=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
3470
3470
|
|
|
3471
|
-
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(K.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[RU({find:
|
|
3472
|
-
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(q.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}})
|
|
3471
|
+
`);return!a||!o?!1:e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:e})=>{if(!this.options.exitOnArrowUp)return!1;let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type||r.parentOffset!==0)return!1;let a=r.before();return a>0?!1:e.commands.insertDefaultBlock({pos:a})},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=e,{selection:n,doc:r}=t,{$from:i,empty:a}=n;if(!a||i.parent.type!==this.type||i.parentOffset!==i.parent.nodeSize-2)return!1;let o=i.after();return o===void 0?!1:r.nodeAt(o)?e.commands.command(({tr:e})=>(e.setSelection(K.near(r.resolve(o))),!0)):e.commands.exitCode()}}},addInputRules(){return[RU({find:Xq,type:this.type,getAttributes:e=>({language:e[1]})}),RU({find:Zq,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new sP({key:new uP(`codeBlockVSCodeHandler`),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let n=t.clipboardData.getData(`text/plain`),r=t.clipboardData.getData(`vscode-editor-data`),i=(r?JSON.parse(r):void 0)?.mode;if(!n||!i)return!1;let{tr:a,schema:o}=e.state,s=o.text(n.replace(/\r\n?/g,`
|
|
3472
|
+
`));return a.replaceSelectionWith(this.type.create({language:i},s)),a.selection.$from.parent.type!==this.type&&a.setSelection(q.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta(`paste`,!0),e.dispatch(a),!0}}})]}}),$q=BU.create({name:`doc`,topNode:!0,content:`block+`,renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
3473
3473
|
|
|
3474
|
-
`):``}),
|
|
3474
|
+
`):``}),eJ=BU.create({name:`hardBreak`,markdownTokenName:`br`,addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:`inline`,selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:`br`}]},renderHTML({HTMLAttributes:e}){return[`br`,gV(this.options.HTMLAttributes,e)]},renderText(){return`
|
|
3475
3475
|
`},renderMarkdown:()=>`
|
|
3476
|
-
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),
|
|
3477
|
-
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
3476
|
+
`,parseMarkdown:()=>({type:`hardBreak`}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:a}=this.options,{splittableMarks:o}=r.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&s&&a){let t=s.filter(e=>o.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),tJ=BU.create({name:`heading`,addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:`inline*`,group:`block`,defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,gV(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode(`heading`,{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{let n=e.attrs?.level?parseInt(e.attrs.level,10):1,r=`#`.repeat(n);return e.content?`${r} ${t.renderChildren(e.content)}`:``},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,`paragraph`,e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>RU({find:RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),nJ=BU.create({name:`horizontalRule`,addOptions(){return{HTMLAttributes:{},nextNodeType:`paragraph`}},group:`block`,parseHTML(){return[{tag:`hr`}]},renderHTML({HTMLAttributes:e}){return[`hr`,gV(this.options.HTMLAttributes,e)]},markdownTokenName:`hr`,parseMarkdown:(e,t)=>t.createNode(`horizontalRule`),renderMarkdown:()=>`---`,addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!ZH(t,t.schema.nodes[this.name]))return!1;let{selection:n}=t,{$to:r}=n,i=e();return qV(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:e,tr:t,dispatch:n})=>{if(n){let{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(q.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(J.create(t.doc,n.pos)):t.setSelection(q.create(t.doc,n.pos));else{let i=(e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType)?.create();i&&(t.insert(r,i),t.setSelection(q.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[LU({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),rJ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,iJ=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,aJ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,oJ=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sJ=dU.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,gV(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[IU({find:rJ,type:this.type}),IU({find:aJ,type:this.type})]},addPasteRules(){return[VU({find:iJ,type:this.type}),VU({find:oJ,type:this.type})]}}),cJ=`listItem`,lJ=`textStyle`,uJ=/^\s*([-+*])\s$/,dJ=BU.create({name:`bulletList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul`}]},renderHTML({HTMLAttributes:e}){return[`ul`,gV(this.options.HTMLAttributes,e),0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>e.type!==`list`||e.ordered?[]:{type:`bulletList`,content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
3477
|
+
`):``,markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(cJ,this.editor.getAttributes(lJ)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=zU({find:uJ,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=zU({find:uJ,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(lJ),editor:this.editor})),[e]}}),fJ=(e,t,n)=>{let{selection:r}=e;if(!r.empty)return null;let{$from:i}=r;if(!i.parent.isTextblock||i.parentOffset!==i.parent.content.size)return null;let a=-1;for(let e=i.depth;e>0;--e)if(i.node(e).type.name===t){a=e;break}if(a<0)return null;let o=i.node(a),s=i.index(a);if(s+1>=o.childCount)return null;let c=o.child(s+1);if(!n.includes(c.type.name))return null;let l=e.schema.nodes[t],u=!1;if(c.forEach(e=>{e.type===l&&e.childCount>1&&(u=!0)}),!u)return null;let d=e.doc.resolve(i.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(e=>{f.push(e)}),f.length===0?null:{listItemDepth:a,nestedList:d,nestedListPos:i.after(),insertPos:i.after(a),items:f}},pJ=(e,t,n,r)=>{let i=fJ(e,n,r);if(!i)return!1;let{selection:a}=e,{nestedList:o,nestedListPos:s,insertPos:c,items:l}=i,u=e.tr;u.delete(s,s+o.nodeSize);let d=u.mapping.map(c);return u.insert(d,W.from(l)),u.setSelection(a.map(u.doc,u.mapping)),t&&t(u),!0},mJ=(e,t,n)=>pJ(e.state,e.view.dispatch,t,n),hJ=(e,t)=>yU.create({name:`${e}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>mJ(this.editor,e,t);return{Delete:n,"Mod-Delete":n}}}),gJ=[[1e3,`m`],[900,`cm`],[500,`d`],[400,`cd`],[100,`c`],[90,`xc`],[50,`l`],[40,`xl`],[10,`x`],[9,`ix`],[5,`v`],[4,`iv`],[1,`i`]],_J=`abcdefghijklmnopqrstuvwxyz`,vJ=String.raw`\d+|[ivxlcdmIVXLCDM]+|${`[a-zA-Z]{1,2}`}`;function yJ(e){let t=e,n=``;for(let[e,r]of gJ)for(;t>=e;)n+=r,t-=e;return n}function bJ(e){return yJ(e).toUpperCase()}function xJ(e){let t=e.toLowerCase(),n=0,r=0;for(;n<t.length;){let e=!1;for(let[i,a]of gJ)if(t.startsWith(a,n)){r+=i,n+=a.length,e=!0;break}if(!e)return 0}return r}function SJ(e){if(!/^[ivxlcdmIVXLCDM]+$/.test(e))return!1;let t=xJ(e);return t<=0?!1:(e===e.toLowerCase()?yJ(t):bJ(t))===e}function CJ(e){let t=e.toLowerCase();if(t.length===1)return t.charCodeAt(0)-97+1;if(t.length===2){let e=t.charCodeAt(0)-97,n=t.charCodeAt(1)-97;return(e+1)*26+n+1}return 0}function wJ(e){if(e<=26)return _J[e-1];let t=Math.floor((e-1)/26)-1,n=(e-1)%26;return t<0?_J[n]:_J[t]+_J[n]}function TJ(e){if(!(!e||/^\d+$/.test(e))){if(SJ(e))return e===e.toLowerCase()?`i`:`I`;if(/^[a-z]{1,2}$/.test(e))return`a`;if(/^[A-Z]{1,2}$/.test(e))return`A`}}function EJ(e){if(/^\d+$/.test(e))return parseInt(e,10);let t=TJ(e);if(t===`i`||t===`I`)return xJ(e);if(t===`a`||t===`A`){let t=CJ(e);return t>0?t:1}let n=parseInt(e,10);return Number.isNaN(n)?1:n}function DJ(e,t){if(e===`numeric`)return String(t);switch(e){case`a`:return wJ(t);case`A`:return wJ(t).toUpperCase();case`i`:return yJ(t);case`I`:return bJ(t);default:return String(t)}}function OJ(e){if(e.length===0)return!1;let t=TJ(e[0])??`numeric`,n=EJ(e[0]);if(n<1)return!1;for(let r=0;r<e.length;r++){let i=DJ(t,n+r);if(e[r]!==i)return!1}return!0}function kJ(e){return{type:TJ(e),start:EJ(e)}}function AJ(e){let{type:t,start:n}=kJ(e),r={};return t&&(r.type=t),n!==1&&(r.start=n),r}function jJ(e,t,n=`. `){let r=t+1;if(!e||e===`1`)return`${r}${n}`;switch(e){case`a`:return`${wJ(r)}${n}`;case`A`:return`${wJ(r).toUpperCase()}${n}`;case`i`:return`${yJ(r)}${n}`;case`I`:return`${bJ(r)}${n}`;default:return`${r}${n}`}}function MJ(e){let t=e.tokens?.[0];return!!(e.text&&e.tokens?.length===1&&t?.type===`list`&&t.ordered&&t.raw===e.text)}function NJ(e,t){return t.tokenizeInline?t.parseInline(t.tokenizeInline(e)):t.parseInline([{type:`text`,raw:e,text:e}])}var PJ=BU.create({name:`listItem`,addOptions(){return{HTMLAttributes:{},bulletListTypeName:`bulletList`,orderedListTypeName:`orderedList`}},content:`paragraph block*`,defining:!0,parseHTML(){return[{tag:`li`}]},renderHTML({HTMLAttributes:e}){return[`li`,gV(this.options.HTMLAttributes,e),0]},markdownTokenName:`list_item`,parseMarkdown:(e,t)=>{if(e.type!==`list_item`)return[];let n=t.parseBlockChildren??t.parseChildren,r=[];if(e.tokens&&e.tokens.length>0){if(MJ(e))return{type:`listItem`,content:[{type:`paragraph`,content:NJ(e.text||``,t)}]};if(e.tokens.some(e=>e.type===`paragraph`))r=n(e.tokens);else{let i=e.tokens[0];if(i&&i.type===`text`&&i.tokens&&i.tokens.length>0){if(r=[{type:`paragraph`,content:t.parseInline(i.tokens)}],e.tokens.length>1){let t=n(e.tokens.slice(1));r.push(...t)}}else r=n(e.tokens)}}return r.length===0&&(r=[{type:`paragraph`,content:[]}]),{type:`listItem`,content:r}},renderMarkdown:(e,t,n)=>rU(e,t,e=>{if(e.parentType===`bulletList`)return`- `;if(e.parentType===`orderedList`){var t,n;let r=((t=e.meta)==null||(t=t.parentAttrs)==null?void 0:t.start)||1;return jJ((n=e.meta)==null||(n=n.parentAttrs)==null?void 0:n.type,r-1+(e.index||0),`. `)}return`- `},n),addExtensions(){return[hJ(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),FJ=(e,t)=>{let{$from:n}=t.selection,r=qz(e,t.schema),i=null,a=n.depth,o=n.pos,s=null;for(;a>0&&s===null;)i=n.node(a),i.type===r?s=a:(--a,--o);return s===null?null:{$pos:t.doc.resolve(o),depth:s}},IJ=(e,t)=>{let n=FJ(e,t);if(!n)return!1;let[,r]=FV(t,e,n.$pos.pos+4);return r},LJ=(e,t,n)=>{let{$anchor:r}=e.selection,i=Math.max(0,r.pos-2),a=e.doc.resolve(i).node();return!(!a||!n.includes(a.type.name))},RJ=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!zB(e.state,t)&&LJ(e.state,t,n)){let{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),i=[];r.node().descendants((e,n)=>{e.type.name===t&&i.push({node:e,pos:n})});let a=i.at(-1);if(!a)return!1;let o=e.state.doc.resolve(r.start()+a.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},o.end()).joinForward().run()}if(!zB(e.state,t)||!UV(e.state))return!1;let{$from:r}=e.state.selection,i=r.depth-1;return r.node(i).type!==e.schema.nodes[t]||r.index(i)!==0?!1:e.chain().liftListItem(t).run()},zJ=(e,t)=>{let n=IJ(e,t),r=FJ(e,t);return!r||!n?!1:n>r.depth},BJ=(e,t)=>{let n=IJ(e,t),r=FJ(e,t);return!r||!n?!1:n<r.depth},VJ=(e,t)=>{if(!zB(e.state,t)||!HV(e.state,t))return!1;let{selection:n}=e.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:zJ(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():BJ(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},HJ=(e,t,n)=>{let{state:r}=e,{selection:i}=r;if(!i.empty)return!1;let{$from:a}=i;if(a.parentOffset!==0||!a.parent.isTextblock||zB(r,t))return!1;let o=IV(a);if(!o||!n.includes(o.type.name))return!1;let s=o.lastChild;if(!s||s.type.name!==t)return!1;let c=a.parent;if(!s.canReplace(s.childCount,s.childCount,W.from(c)))return!1;let l=a.before(),u=a.after(),d=l-2;return e.commands.command(({tr:e,dispatch:t})=>(t&&(e.delete(l,u).insert(d,W.from(c)),e.setSelection(q.create(e.doc,d+1)),e.scrollIntoView()),!0))},UJ=yU.create({name:`listKeymap`,addOptions(){return{listTypes:[{itemName:`listItem`,wrapperNames:[`bulletList`,`orderedList`]},{itemName:`taskItem`,wrapperNames:[`taskList`]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&VJ(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&VJ(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&RJ(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&RJ(e,n,r)&&(t=!0)}),t},Tab:({editor:e})=>{for(let{itemName:t,wrapperNames:n}of this.options.listTypes)if(e.state.schema.nodes[t]!==void 0&&HJ(e,t,n))return!0;return!1}}}}),WJ=RegExp(`^(\\s*)(${vJ})([.)])\\s+(.*)$`),GJ=/^\s/,KJ={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function qJ(e){return WJ.test(e.trimStart())}function JJ(e){let t=e.trimStart();return KJ.bulletItem.test(t)||qJ(t)||KJ.heading.test(t)||KJ.thematicBreak.test(t)&&!t.startsWith(`-`)||/^>\s?/.test(t)||KJ.codeFence.test(t)||KJ.blockMath.test(t)}function YJ(e){return Object.values(KJ).some(t=>t.test(e))}function XJ(e){let t=[],n=[],r=!1;return e.forEach(e=>{if(r){n.push(e);return}if(e.trim()===``){r=!0,n.push(e);return}if(t.length>0&&JJ(e)){r=!0,n.push(e);return}t.push(e)}),{paragraphLines:t,blockLines:n}}function ZJ(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n],a=i.match(WJ);if(!a)break;let[,o,s,c,l]=a,u=o.length,d=parseInt(s,10),f=isNaN(d)?TJ(s):void 0,p=isNaN(d)?EJ(s):d,m=[l],h=n+1,g=[i],_=!1;for(;h<e.length;){let t=e[h];if(t.match(WJ))break;if(t.trim()===``)g.push(t),m.push(``),_=!0,h+=1;else if(t.match(GJ)){let e=t.length-t.trimStart().length,n=u+s.length+1;g.push(t),m.push(t.slice(Math.min(e,n))),h+=1}else{if(_||YJ(t))break;g.push(t),m.push(t),h+=1}}t.push({indent:u,number:p,type:f,content:m.join(`
|
|
3478
3478
|
`).trim(),contentLines:m,raw:g.join(`
|
|
3479
|
-
`)}),r=h,n=h}return[t,r]}var
|
|
3480
|
-
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(
|
|
3479
|
+
`)}),r=h,n=h}return[t,r]}var QJ=RegExp(`^(${vJ})([.)])\\s+(.+)$`);function $J(e){let t=e.split(`
|
|
3480
|
+
`).filter(e=>e.trim().length>0);if(t.length===0)return null;let n=[];for(let e of t){let t=e.trim().match(QJ);if(!t)return null;n.push({marker:t[1],content:t[3]})}return OJ(n.map(e=>e.marker))?{type:`orderedList`,attrs:AJ(n[0].marker),content:n.map(e=>({type:`listItem`,content:[{type:`paragraph`,content:[{type:`text`,text:e.content}]}]}))}:null}function eY(e,t,n){let r=[],i=0;for(;i<e.length;){let a=e[i];if(a.indent===t){let{paragraphLines:o,blockLines:s}=XJ(a.contentLines),c=o.join(`
|
|
3481
3481
|
`).trim(),l=[];c&&l.push({type:`paragraph`,raw:c,tokens:n.inlineTokens(c)});let u=s.join(`
|
|
3482
|
-
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=
|
|
3483
|
-
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function
|
|
3482
|
+
`).trim();if(u){let e=n.blockTokens(u);l.push(...e)}let d=i+1,f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){let e=eY(f,Math.min(...f.map(e=>e.indent)),n);l.push({type:`list`,ordered:!0,start:f[0].number,typeMarker:f[0].type,items:e,raw:f.map(e=>e.raw).join(`
|
|
3483
|
+
`)})}r.push({type:`list_item`,raw:a.raw,tokens:l}),i=d}else i+=1}return r}function tY(e,t){return e.map(e=>{if(e.type!==`list_item`)return t.parseChildren([e])[0];let n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if(e.type===`paragraph`||e.type===`list`||e.type===`blockquote`||e.type===`code`)n.push(...t.parseChildren([e]));else if(e.type===`text`&&e.tokens){let r=t.parseChildren([e]);n.push({type:`paragraph`,content:r})}else{let r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:`listItem`,content:n}})}var nY=`listItem`,rY=`textStyle`,iY=/^(\d+)\.\s$/;function aY(e){let t=e.match(/list-style-type\s*:\s*([^;]+)/i);if(!t)return null;switch(t[1].trim().toLowerCase()){case`upper-roman`:return`I`;case`lower-roman`:return`i`;case`upper-alpha`:case`upper-latin`:return`A`;case`lower-alpha`:case`lower-latin`:return`a`;default:return null}}var oY=BU.create({name:`orderedList`,addOptions(){return{itemTypeName:`listItem`,HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:`block list`,content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute(`start`)?parseInt(e.getAttribute(`start`)||``,10):1},type:{default:null,parseHTML:e=>{let t=e.getAttribute(`type`);if(t)return t;let n=e.getAttribute(`style`);if(n){let e=aY(n);if(e)return e}let r=e.querySelector(`li`);if(r){let e=r.getAttribute(`style`);if(e){let t=aY(e);if(t)return t}}return null}}}},parseHTML(){return[{tag:`ol`}]},renderHTML({HTMLAttributes:e}){let{start:t,type:n,...r}=e,i=gV(this.options.HTMLAttributes,r);return t!==1&&(i.start=t),n&&n!==`1`&&(i.type=n),[`ol`,i,0]},markdownTokenName:`list`,parseMarkdown:(e,t)=>{if(e.type!==`list`||!e.ordered)return[];let n=e.start||1,r=e.typeMarker,i=e.items?tY(e.items,t):[],a={};return n!==1&&(a.start=n),r&&(a.type=r),Object.keys(a).length>0?{type:`orderedList`,attrs:a,content:i}:{type:`orderedList`,content:i}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
3484
3484
|
`):``,markdownTokenizer:{name:`orderedList`,level:`block`,start:()=>-1,tokenize:(e,t,n)=>{let r=e.split(`
|
|
3485
|
-
`),[i,a]=
|
|
3486
|
-
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(
|
|
3487
|
-
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=nU(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=nU(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});yU.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(XY.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(yX.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(OX.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(GX.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(YX.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(XX.configure(this.options.taskList)),e}});var ZX=` `,QX=`\xA0`,$X=BU.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gV(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===ZX||n[0].text===ZX||n[0].raw===QX||n[0].text===QX)&&r.length===1&&r[0].type===`text`&&(r[0].text===ZX||r[0].text===QX)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?ZX:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),eZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,tZ=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,nZ=dU.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gV(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[IU({find:eZ,type:this.type})]},addPasteRules(){return[VU({find:tZ,type:this.type})]}}),rZ=BU.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),iZ=dU.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gV(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function aZ(e={}){return new sP({view(t){return new oZ(t,e)}})}var oZ=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=xN(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},sZ=class e extends K{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):K.near(r)}content(){return G.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new cZ(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!uZ(e)||!dZ(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!J.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};sZ.prototype.visible=!1,sZ.findFrom=sZ.findGapCursorFrom,K.jsonID(`gapcursor`,sZ);var cZ=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return sZ.valid(t)?new sZ(t):K.near(t)}};function lZ(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function uZ(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||lZ(e.type))return!0;if(e.inlineContent)return!1}}return!0}function dZ(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||lZ(e.type))return!0;if(e.inlineContent)return!1}}return!0}function fZ(){return new sP({props:{decorations:_Z,createSelectionBetween(e,t,n){return t.pos==n.pos&&sZ.valid(n)?new sZ(n):null},handleClick:hZ,handleKeyDown:pZ,handleDOMEvents:{beforeinput:gZ}}})}var pZ=Lz({ArrowLeft:mZ(`horiz`,-1),ArrowRight:mZ(`horiz`,1),ArrowUp:mZ(`vert`,-1),ArrowDown:mZ(`vert`,1)});function mZ(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof q){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=sZ.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new sZ(c))),!0):!1}}function hZ(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!sZ.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&J.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new sZ(r))),!0)}function gZ(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof sZ))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=W.empty;for(let e=r.length-1;e>=0;e--)i=W.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new G(i,0,0));return a.setSelection(q.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function _Z(e){if(!(e.selection instanceof sZ))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,LR.create(e.doc,[PR.widget(e.selection.head,t,{key:`gapcursor`})])}var vZ=200,yZ=function(){};yZ.prototype.append=function(e){return e.length?(e=yZ.from(e),!this.length&&e||e.length<vZ&&this.leafAppend(e)||this.length<vZ&&e.leafPrepend(this)||this.appendInner(e)):this},yZ.prototype.prepend=function(e){return e.length?yZ.from(e).append(this):this},yZ.prototype.appendInner=function(e){return new xZ(this,e)},yZ.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?yZ.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},yZ.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},yZ.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},yZ.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},yZ.from=function(e){return e instanceof yZ?e:e&&e.length?new bZ(e):yZ.empty};var bZ=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=vZ)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=vZ)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(yZ);yZ.empty=new bZ([]);var xZ=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(yZ),SZ=500,CZ=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new TZ(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new TZ(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new TZ(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>DZ&&(s=wZ(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new zM;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new TZ(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new TZ(i,o,l))}else r.push(new TZ(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new TZ(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>SZ&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new TZ(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(yZ.from(i.reverse()),a)}};CZ.empty=new CZ(yZ.empty,0);function wZ(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var TZ=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},EZ=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},DZ=20;function OZ(e,t,n,r){let i=n.getMeta(IZ),a;if(i)return i.historyState;n.getMeta(LZ)&&(e=new EZ(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(IZ))return o.getMeta(IZ).redo?new EZ(e.done.addTransform(n,void 0,r,FZ(t)),e.undone,AZ(n.mapping.maps),e.prevTime,e.prevComposition):new EZ(e.done,e.undone.addTransform(n,void 0,r,FZ(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!kZ(n,e.prevRanges)),s=o?jZ(e.prevRanges,n.mapping):AZ(n.mapping.maps);return new EZ(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,FZ(t)),CZ.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new EZ(e.done.rebased(n,a),e.undone.rebased(n,a),jZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new EZ(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),jZ(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function kZ(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function AZ(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function jZ(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function MZ(e,t,n){let r=FZ(t),i=IZ.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new EZ(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(IZ,{redo:n,historyState:c})}var NZ=!1,PZ=null;function FZ(e){let t=e.plugins;if(PZ!=t){NZ=!1,PZ=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){NZ=!0;break}}return NZ}var IZ=new uP(`history`),LZ=new uP(`closeHistory`);function RZ(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new sP({key:IZ,state:{init(){return new EZ(CZ.empty,CZ.empty,null,0,-1)},apply(t,n,r){return OZ(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?BZ:n==`historyRedo`?VZ:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function zZ(e,t){return(n,r)=>{let i=IZ.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=MZ(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var BZ=zZ(!1,!0),VZ=zZ(!0,!0);yU.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new sP({key:new uP(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var HZ=yU.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[aZ(this.options)]}});yU.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new sP({key:new uP(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return LR.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(PR.node(t,t+e.nodeSize,{class:this.options.className}))}),LR.create(e,a)}}})]}});var UZ=yU.create({name:`gapCursor`,addProseMirrorPlugins(){return[fZ()]},extendNodeSchema(e){return{allowGapCursor:uV(Y(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),WZ=`placeholder`,GZ=new uP(`tiptap__placeholder`);function KZ(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),PR.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function qZ(e,t){return typeof e==`function`?e(t):e}function JZ({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&KV(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(KZ({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:qZ(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function YZ({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&KV(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(KZ({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:qZ(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...JZ({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return LR.create(r,o)}function XZ(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function ZZ(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function QZ(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function $Z(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function eQ(e,t){let n=QZ(e,t.from,t.to);return n.push(ZZ(e,XZ(e,t.from))),t.to>t.from?n.push(ZZ(e,XZ(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(ZZ(e,XZ(e,Math.min(t.from+1,e.content.size)))),n}function tQ(e,t,n){let r=[];if(e.docChanged){let t=NV(e);for(let e of t)r.push(...eQ(n.doc,e.newRange))}return e.selectionSet&&(r.push(ZZ(n.doc,XZ(n.doc,e.mapping.map(t.selection.anchor)))),r.push(ZZ(n.doc,XZ(n.doc,n.selection.anchor)))),$Z(r)}function nQ(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function rQ({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=nQ(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=JZ({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function iQ({editor:e,options:t,dataAttribute:n}){return{init(r,i){return YZ({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??LR.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:rQ({decorations:i.map(r.mapping,r.doc),ranges:tQ(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function aQ(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function oQ({editor:e,options:t}){let n=t.dataAttribute?`data-${aQ(t.dataAttribute)}`:`data-${WZ}`,r=t.showOnlyCurrent&&!t.includeChildren;return new sP({key:GZ,...r?{}:{state:iQ({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>YZ({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?LR.empty:GZ.getState(n)??LR.empty}})}yU.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:WZ,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[oQ({editor:this.editor,options:this.options})]}});function sQ(e,t){return!e.selection.empty&&!qV(e.selection)&&t.isEditable}function cQ(e,t){return sQ(e,t)&&!t.isFocused&&!t.view.dragging}function lQ(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function uQ(e){e.focus()}yU.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new sP({key:new uP(`selection`),props:{decorations(n){return cQ(n,e)?LR.create(n.doc,[PR.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return sQ(t.state,e)&&lQ(),!1},focus(t){return sQ(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&uQ(t)}),!1}}}})]}});function dQ({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var fQ=yU.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new uP(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new sP({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!dQ({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!dQ({node:r,types:n})}}})]}}),pQ=yU.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>BZ(e,t),redo:()=>({state:e,dispatch:t})=>VZ(e,t)}},addProseMirrorPlugins(){return[RZ(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),mQ=yU.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(AY.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(TY.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(XY.configure(this.options.bulletList)),this.options.code!==!1&&e.push(NY.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(LY.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(RY.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(HZ.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(UZ.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(zY.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(BY.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(pQ.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(VY.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(KY.configure(this.options.italic)),this.options.listItem!==!1&&e.push(yX.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(OX.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(mY.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(GX.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push($X.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(nZ.configure(this.options.strike)),this.options.text!==!1&&e.push(rZ.configure(this.options.text)),this.options.underline!==!1&&e.push(iZ.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(fQ.configure(this.options?.trailingNode)),e}}),hQ=(0,L.createContext)(null);function gQ(e){let t=(0,L.use)(hQ);if(!t)throw Error(`${e} must be used inside Composer.Root.`);return t}function _Q(e){let t=(0,U.c)(9),n=gQ(e===void 0?`useComposer`:e),r;t[0]!==n.activePopup||t[1]!==n.disabled||t[2]!==n.meta||t[3]!==n.suggestions?(r={...n.meta,disabled:n.disabled,activePopup:n.activePopup,suggestions:n.suggestions},t[0]=n.activePopup,t[1]=n.disabled,t[2]=n.meta,t[3]=n.suggestions,t[4]=r):r=t[4];let i;return t[5]!==n.actions||t[6]!==n.state||t[7]!==r?(i={state:n.state,actions:n.actions,meta:r},t[5]=n.actions,t[6]=n.state,t[7]=r,t[8]=i):i=t[8],i}function vQ(e){let t=(0,U.c)(23),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,attachedImages:a}=gQ(`Composer.Attachments`),o=i.imageAttachments,s,c,l,u,d,f;if(t[3]!==a||t[4]!==n||t[5]!==r||t[6]!==i.imageAttachments){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[13]===a?e=t[14]:(e=e=>a.has(e.id),t[13]=a,t[14]=e);let i=o.filter(e);if(i.length===0){f=null;break bb0}s=`list`,c=`Attached files`,t[15]===n?l=t[16]:(l=j(`flex flex-wrap gap-2`,n),t[15]=n,t[16]=l),u=r,d=i.map(yQ)}t[3]=a,t[4]=n,t[5]=r,t[6]=i.imageAttachments,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f}else s=t[7],c=t[8],l=t[9],u=t[10],d=t[11],f=t[12];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;return t[17]!==s||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d?(p=(0,R.jsx)(`div`,{role:s,"aria-label":c,className:l,...u,children:d}),t[17]=s,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=p):p=t[22],p}function yQ(e){return(0,R.jsx)(bQ,{attachment:e},e.id)}function bQ(e){let t=(0,U.c)(18),{attachment:n}=e,{id:r,placeholder:i,media:a}=n,{attachedImages:o,disabled:s,actions:c}=gQ(`Composer.Attachments`),l;t[0]!==o||t[1]!==r?(l=o.get(r),t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l;if(!u)return null;let d;t[3]!==u||t[4]!==a||t[5]!==i?(d=a===`video`?(0,R.jsx)(CQ,{placeholder:i,file:u}):a===`audio`?(0,R.jsx)(TQ,{placeholder:i,file:u,glyph:`♪`}):(0,R.jsx)(SQ,{placeholder:i,file:u}),t[3]=u,t[4]=a,t[5]=i,t[6]=d):d=t[6];let f=`Remove ${i}`,p;t[7]!==c||t[8]!==r?(p=()=>c.removeImageAttachment(r),t[7]=c,t[8]=r,t[9]=p):p=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,R.jsx)(m,{"aria-hidden":!0,className:`size-3`}),t[10]=h):h=t[10];let g;t[11]!==s||t[12]!==f||t[13]!==p?(g=(0,R.jsx)(St,{type:`button`,"aria-label":f,disabled:s,onClick:p,className:`bg-background text-foreground border-border hover:bg-muted absolute -top-1.5 -right-1.5 flex size-5 items-center justify-center rounded-full border disabled:opacity-50`,children:h}),t[11]=s,t[12]=f,t[13]=p,t[14]=g):g=t[14];let _;return t[15]!==d||t[16]!==g?(_=(0,R.jsxs)(`div`,{role:`listitem`,className:`relative`,children:[d,g]}),t[15]=d,t[16]=g,t[17]=_):_=t[17],_}function xQ(e){let t=(0,U.c)(3),[n,r]=(0,L.useState)(null),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,L.useEffect)(i,a),n}function SQ(e){let t=(0,U.c)(5),{placeholder:n,file:r}=e,i=xQ(r),[a,o]=(0,L.useState)(null),s;return t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n?(s=i===null?null:i===a?(0,R.jsx)(TQ,{placeholder:n,file:r,glyph:`🖼`}):(0,R.jsx)(`img`,{src:i,alt:n,title:r.name,className:`border-border size-16 rounded-md border object-cover`,onError:()=>o(i)}),t[0]=a,t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4],s}function CQ(e){let t=(0,U.c)(11),{placeholder:n,file:r}=e,i=xQ(r),[a,o]=(0,L.useState)(null),s=i??void 0,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>o(e.currentTarget.duration),t[0]=c):c=t[0];let l;t[1]===s?l=t[2]:(l=(0,R.jsx)(`video`,{src:s,muted:!0,playsInline:!0,preload:`metadata`,className:`size-full object-cover`,onLoadedMetadata:c}),t[1]=s,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,R.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center justify-center text-lg text-white drop-shadow`,children:`▶`}),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a!==null&&Number.isFinite(a)?(0,R.jsx)(`span`,{className:`absolute right-0.5 bottom-0.5 rounded bg-black/70 px-1 text-[10px] leading-4 text-white`,children:wQ(a)}):null,t[4]=a,t[5]=d);let f;return t[6]!==r.name||t[7]!==n||t[8]!==l||t[9]!==d?(f=(0,R.jsxs)(`div`,{role:`img`,"aria-label":n,title:r.name,className:`border-border bg-muted relative size-16 overflow-hidden rounded-md border`,children:[l,u,d]}),t[6]=r.name,t[7]=n,t[8]=l,t[9]=d,t[10]=f):f=t[10],f}function wQ(e){let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function TQ(e){let t=(0,U.c)(12),{placeholder:n,file:r,glyph:i}=e,a;t[0]===i?a=t[1]:(a=(0,R.jsxs)(`span`,{"aria-hidden":!0,children:[i,` `]}),t[0]=i,t[1]=a);let o=r.name||n,s;t[2]!==a||t[3]!==o?(s=(0,R.jsxs)(`span`,{className:`text-foreground truncate`,children:[a,o]}),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c=r.type||`file`,l;t[5]===c?l=t[6]:(l=(0,R.jsx)(`span`,{className:`truncate`,children:c}),t[5]=c,t[6]=l);let u;return t[7]!==r.name||t[8]!==n||t[9]!==s||t[10]!==l?(u=(0,R.jsxs)(`div`,{role:`img`,"aria-label":n,title:r.name,className:`border-border bg-muted text-muted-foreground flex h-16 max-w-48 flex-col justify-center gap-0.5 rounded-md border px-2 text-xs`,children:[s,l]}),t[7]=r.name,t[8]=n,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function EQ(e,t){return e===`hidden`?!1:e===`before-interaction`?!t:e!==`after-interaction`||t}function DQ(e,t,n){let r=kQ(e),i=t.filter(e=>AQ(e)&&EQ(e.visibility,n));return r?i.map((e,t)=>{let n=MQ(r,e);return n===null?null:{command:e,rank:n,index:t}}).filter(e=>!!e).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.command).slice(0,10):i.slice(0,10)}function OQ(e,t){let n=e.toLowerCase();return t.find(e=>AQ(e)&&(e.value.toLowerCase()===n||jQ(e).some(e=>e===n)))}function kQ(e){return e.slice(1).toLowerCase()}function AQ(e){return e.availability!==`disabled`}function jQ(e){return(e.aliases??[]).map(e=>e.toLowerCase())}function MQ(e,t){let n=t.value.toLowerCase(),r=jQ(t),i=[t.label.toLowerCase(),...(t.searchTerms??[]).map(e=>e.toLowerCase())];return n===e?0:r.some(t=>t===e)?1:n.startsWith(e)?2:r.some(t=>t.startsWith(e))?3:i.some(t=>t.startsWith(e))?4:null}function NQ(e){return e.map(WK).join(`|`)}function PQ(e){return`(?:${NQ(e)})[A-Za-z0-9_:-]+`}function FQ(e){return`(?:${NQ(e)})[^\\s]+`}function IQ(e,t){let n=[];return t.length>0&&n.push(FQ(t)),e.length>0&&n.push(PQ(e)),n.length>0?new RegExp(n.join(`|`),`g`):null}function LQ(e,t){return t.some(t=>e.startsWith(t))}function RQ(e){return`${e.trigger}${e.value}`}function zQ({initialDraft:e,text:t=``,slashCommands:n=[],mentionCandidates:r=[],commandTriggers:i=[],remoteImageUrls:a=[],isTaskRunning:o=!1,queueSubmissions:s=!1}={}){let c=e?.text??t,l=r.flatMap(e=>{let t=c$(`mention`,RQ(e),c,{detail:e.detail});return t?[t]:[]}),u=l.flatMap(e=>{let t=r.find(t=>RQ(t)===e.label);return t?[{id:e.id,trigger:t.trigger,value:t.value,payload:t.payload,persistsAs:t.persistsAs}]:[]}),d=e?.remoteImages??(e?.remoteImageUrls??a).map((e,t)=>({id:B$(`remote-image`,e,t),url:e}));return{text:c,cursor:c.length,elements:l$(e?.elements??[...GQ(c,n,i),...l]),mentionBindings:e?.mentionBindings??u,imageAttachments:[],remoteImages:d,pendingPastes:e?.pendingPastes??[],selectedRemoteImageId:null,isTaskRunning:o,queueSubmissions:s,error:null,reverseSearch:null,shortcutsOpen:!1,history:[],historyCursor:null,killBuffer:``}}function BQ(e){return e.text.length===0&&e.imageAttachments.length===0&&e.remoteImages.length===0&&e.pendingPastes.length===0}function VQ(e,t,n){return WQ(e,t,n)}function HQ(e,t){if(!t||t<1)return null;let n=g$(e.prompt);return n<=t?null:`Prompt is too long after expanding pasted content (${n} chars; max ${t} chars).`}function UQ(e,t,n){let r=n$(e.elements,e.text);r=[...r.filter(e=>e.kind!==`slash-command`),...GQ(e.text,t,n)];let i=e.mentionBindings.filter(e=>r.some(t=>t.id===e.id)),a=e.imageAttachments.filter(e=>r.some(t=>t.kind===`image`&&t.label===e.placeholder)),o=e.pendingPastes.filter(e=>r.some(t=>t.kind===`paste`&&t.label===e.placeholder));return{...e,elements:l$(r),mentionBindings:i,imageAttachments:m$(a,e.remoteImages.length),pendingPastes:o}}function WQ(e,t,n){let r=e.text.trim(),i=QQ(e.text,r,e.elements),a=XQ(e.text,e.elements,e.pendingPastes),o=a.text,s=o.trim(),c=QQ(o,s,a.elements),l=e.imageAttachments.filter(t=>e.text.includes(t.placeholder)),u=$Q(r,i),d=S$({text:u.text,elements:u.elements,mentionBindings:e.mentionBindings}),f=S$({text:s,elements:c,mentionBindings:e.mentionBindings});if(!s&&l.length===0&&e.remoteImages.length===0)return null;let p=LQ(o,n)?KQ(s,c,t,n):null,m=p?.prompt===void 0?null:p.args?`${p.prompt}\n\n${S$({text:p.args,elements:p.argsElements,mentionBindings:e.mentionBindings})}`:p.prompt,h=p?.prompt===void 0?null:p.args?(()=>{let t=$Q(p.args,p.argsElements);return`${p.prompt}\n\n${S$({text:t.text,elements:t.elements,mentionBindings:e.mentionBindings})}`})():p.prompt,g=m??f,_=p?.args===void 0?p?`command`:`submitted`:`command-with-args`,v=[...e.remoteImages.map(e=>({type:`remote_image`,url:e.url}))];!p&&s&&v.push({type:`text`,text:s,textElements:c});let y=p?.args??s;for(let t of e.mentionBindings){let e=`${t.trigger}${t.value}`;!e||!y.includes(e)||v.push({type:`item`,id:t.id,trigger:t.trigger,value:t.value,payload:t.payload})}for(let e of c)e.kind===`link`&&e.detail&&v.push({type:`link`,text:e.label,href:e.detail}),e.kind===`rich-link`&&e.detail&&v.push({type:`rich_link`,text:e.label,href:e.detail,metadata:e.metadata});return{mode:_,prompt:g,persistedPrompt:d,historyPrompt:h??d,action:p?.args===void 0?p?`Command`:`Plain`:`CommandWithArgs`,command:p?.command,args:p?.args,items:v,elements:i,payloadElements:c,mentionBindings:e.mentionBindings}}function GQ(e,t,n){let r=[];if(n.length===0)return r;let i=e.matchAll(RegExp(`(^|\\s)((?:${NQ(n)})([A-Za-z0-9_:-]+))(?=\\s|$)`,`g`));for(let e of i){let n=OQ(e[3],t);if(!n)continue;let i=e[2],a=e.index+e[1].length;r.push({id:B$(`slash-command`,i,a),kind:`slash-command`,label:i,range:{start:a,end:a+i.length},detail:n.detail})}return r}function KQ(e,t,n,r){let i=e.match(RegExp(`^(?:${NQ(r)})([A-Za-z0-9_:-]+)(?:\\s+([\\s\\S]+))?$`));if(!i)return null;let a=OQ(i[1],n);if(!a)return null;let o=i[2]??``;if(!o.trim())return{command:a.value,prompt:a.expandsTo};if(!a.supportsArgs)return null;let s=a.trigger.length+a.value.length,c=e.slice(s).search(/\S/),l=c===-1?s:s+c,u=o.trim();return{command:a.value,prompt:a.expandsTo,args:u,argsElements:ZQ(t,l,l+u.length)}}function qQ(e,t,n){if(n.length===0)return null;let r=e.match(RegExp(`^(?:${NQ(n)})([A-Za-z0-9_:-]+)(?:\\s+[\\s\\S]*)?$`));return!r||OQ(r[1],t)||YQ(r[1])?null:r[1]}var JQ=new Set([`Applications`,`Library`,`System`,`Users`,`Volumes`,`bin`,`dev`,`etc`,`home`,`mnt`,`opt`,`private`,`sbin`,`tmp`,`usr`,`var`,`workspace`]);function YQ(e){return JQ.has(e)}function XQ(e,t,n){if(n.length===0||t.length===0)return{text:e,elements:t};let r=new Map;for(let e of n){let t=r.get(e.placeholder)??[];t.push(e.content),r.set(e.placeholder,t)}let i=``,a=[],o=0;for(let n of l$(t)){let t=Math.min(n.range.start,e.length),s=Math.min(n.range.end,e.length);if(t>s)continue;t>o&&(i+=e.slice(o,t));let c=e.slice(t,s),l=r.get(n.label)?.shift();if(l!==void 0)i+=l;else{let e=i.length;i+=c,a.push({...n,range:{start:e,end:i.length}})}o=s}return o<e.length&&(i+=e.slice(o)),{text:i,elements:a}}function ZQ(e,t,n){return e.filter(e=>e.range.end>t&&e.range.start<n).map(e=>({...e,range:{start:Math.max(0,e.range.start-t),end:Math.min(n,e.range.end)-t}})).filter(e=>e.range.start<e.range.end)}function QQ(e,t,n){let r=e.indexOf(t);return r<=0?n:n.filter(e=>e.range.end>r).map(e=>({...e,range:{start:Math.max(0,e.range.start-r),end:Math.max(0,e.range.end-r)}}))}function $Q(e,t){let n=l$(t.filter(e=>e.kind===`image`));for(let t of n.toReversed())e=t$(e,t.range,``);let r=e=>n.reduce((t,n)=>t+Math.max(0,Math.min(e,n.range.end)-n.range.start),0);return{text:e,elements:l$(t.filter(e=>e.kind!==`image`)).map(e=>({...e,range:{start:e.range.start-r(e.range.start),end:e.range.end-r(e.range.end)}}))}}function e$(e,t,n,r){return e<r&&t>n}function t$(e,t,n){return e.slice(0,t.start)+n+e.slice(t.end)}function n$(e,t){let n=new Map;return l$(e).map(e=>{let r=r$(t,e.label);if(r.length===0)return null;let i=`${e.kind}:${e.label}`,a=n.get(i)??[],o=i$(r,e,a)??a$(r,e,a)??o$(r,e);return n.set(i,[...a,o]),{...e,range:o}}).filter(e=>!!e)}function r$(e,t){if(!t)return[];let n=[],r=e.indexOf(t);for(;r!==-1;)n.push({start:r,end:r+t.length}),r=e.indexOf(t,r+t.length);return n}function i$(e,t,n){return e.find(e=>e.start===t.range.start&&e.end===t.range.end&&!s$(e,n))}function a$(e,t,n){return o$(e.filter(e=>!s$(e,n)),t)}function o$(e,t){return[...e].sort((e,n)=>Math.abs(e.start-t.range.start)-Math.abs(n.start-t.range.start)||e.start-n.start)[0]}function s$(e,t){return t.some(t=>e.start===t.start&&e.end===t.end&&e$(e.start,e.end,t.start,t.end))}function c$(e,t,n,r={}){let i=n.indexOf(t);return i===-1?null:{id:B$(e,t,i),kind:e,label:t,range:{start:i,end:i+t.length},detail:r.detail}}function l$(e){return[...e].sort((e,t)=>e.range.start-t.range.start)}var u$={image:`Image`,video:`Video`,audio:`Audio`};function d$(e){let t=e.type.split(`/`)[0];return t===`image`||t===`video`||t===`audio`?t:null}function f$(e){return e===`video`||e===`audio`?e:`image`}function p$(e,t){return`[${u$[e]} #${t}]`}function m$(e,t){return e.map((e,n)=>({...e,placeholder:p$(e.media,t+n+1)}))}function h$(e,t){if(!t)return null;let n=e.remoteImages.findIndex(e=>e.id===t);return n===-1?null:n}function g$(e){return Array.from(e).length}function _$(e){let t=$Q(e.text,e.elements);return{text:t.text,elements:M$(t.elements),mentionBindings:N$(e.mentionBindings),remoteImages:e.remoteImages.map(e=>({...e})),pendingPastes:P$(e.pendingPastes)}}function v$(e,t){return{persistedPrompt:t,remoteImages:e.remoteImages.map(e=>({...e})),pendingPastes:P$(e.pendingPastes)}}function y$(e,t){let n=v$(e,t);return!n.persistedPrompt.trim()&&n.remoteImages.length===0&&n.pendingPastes.length===0?e.history:[n,...e.history].slice(0,8)}function b$({text:e,slashCommands:t=[],commandTriggers:n=[],mentionCandidates:r=[]}){let i=w$(e,r),a=k$(i.text,i.elements,i.protectedRanges,t,r);return _$(UQ(zQ({initialDraft:{text:i.text,elements:l$([...i.elements,...a.elements]),mentionBindings:[...i.mentionBindings,...a.mentionBindings]},slashCommands:t}),t,n))}function x$({source:e,slashCommands:t=[],mentionCandidates:n=[]}){let r=b$({text:e.persistedPrompt,slashCommands:t,mentionCandidates:n}),i=[...e.pendingPastes.flatMap(e=>{let t=c$(`paste`,e.placeholder,r.text??``,{detail:`${g$(e.content)} chars`});return t?[t]:[]})];return{...r,elements:l$([...r.elements??[],...i]),remoteImages:e.remoteImages.map(e=>({...e})),pendingPastes:P$(e.pendingPastes)}}function S$(e){let t=e.text??``,n=l$(e.elements??[]).map(t=>j$(t,e)).filter(e=>!!e).sort((e,t)=>t.range.start-e.range.start);for(let e of n)t=t$(t,e.range,e.text);return t}function C$(e){return e.startsWith(`composer-text-link://`)?decodeURIComponent(e.replace(/^composer-text-link:\/\//,``)):e}function w$(e,t){let n=[],r=[],i=[],a=``;for(let o of KA(e)){if(o.kind===`inline-code`||o.kind===`code-block`){let e=a.length;a+=o.source,i.push({start:e,end:a.length});continue}if(o.kind!==`link`&&o.kind!==`skill-link`&&o.kind!==`mention`){a+=o.source;continue}let e=o.label,s=o.href,c=C$(s),l=T$(e,t),u=l?RQ(l):e,d=a.length;if(a+=u,l){let e=B$(`mention`,u,d);n.push({id:e,kind:`mention`,label:u,range:{start:d,end:d+u.length},detail:l.detail}),r.push({id:e,trigger:l.trigger,value:l.value,payload:l.payload,persistsAs:l.persistsAs})}else n.push({id:B$(`link`,u,d),kind:`link`,label:u,range:{start:d,end:d+u.length},detail:c})}return{text:a,elements:n,mentionBindings:r,protectedRanges:i}}function T$(e,t){return t.find(t=>RQ(t)===e)??null}function E$(e){return[...new Set(e.map(e=>e.trigger).filter(Boolean))].sort((e,t)=>t.length-e.length)}function D$(e){let t=E$(e);return t.length===0?null:RegExp(`(?:${t.map(WK).join(`|`)})[A-Za-z0-9_:-]+`,`g`)}function O$(e,t){return E$(t).find(t=>e.startsWith(t))?.length??0}function k$(e,t,n,r,i){let a=[],o=[],s=[],c=(r,i)=>{let a=r+i.length;return(r===0||/\s/.test(e[r-1]??``))&&!A$(r,i,t)&&!s.some(e=>r<e.end&&a>e.start)&&!n.some(e=>r<e.end&&a>e.start)},l=[...i].sort((e,t)=>RQ(t).length-RQ(e).length);for(let t of l){let n=RQ(t);if(n)for(let r=e.indexOf(n);r!==-1;r=e.indexOf(n,r+n.length)){let i=r+n.length;if(/[\w-]/.test(e[i]??``)||!c(r,n))continue;let l=B$(`mention`,n,r);s.push({start:r,end:i}),a.push({id:l,kind:`mention`,label:n,range:{start:r,end:i},detail:t.detail}),o.push({id:l,trigger:t.trigger,value:t.value,payload:t.payload,persistsAs:t.persistsAs})}}let u=D$(r);for(let t of u?e.matchAll(u):[]){let e=t.index??0,n=t[0];if(!c(e,n))continue;let i=OQ(n.slice(O$(n,r)),r);i&&(s.push({start:e,end:e+n.length}),a.push({id:B$(`slash-command`,n,e),kind:`slash-command`,label:n,range:{start:e,end:e+n.length},detail:i.detail}))}return{elements:a,mentionBindings:o}}function A$(e,t,n){let r=e+t.length;return n.some(t=>e<t.range.end&&r>t.range.start)}function j$(e,t){if(e.kind===`mention`){let n=(t.mentionBindings??[]).find(t=>t.id===e.id||`${t.trigger}${t.value}`===e.label);return n?{range:e.range,text:n.persistsAs??e.label}:null}return(e.kind===`link`||e.kind===`rich-link`)&&e.detail?{range:e.range,text:GA(e.label,e.detail)}:null}function M$(e){return e.map(e=>{let t={...e,range:{...e.range}};return e.metadata?{...t,metadata:{...e.metadata}}:t})}function N$(e){return e.map(e=>({...e}))}function P$(e){return e.map(e=>({...e}))}function F$(e,t,n,r=1){if(t.length===0)return null;let i=t.toLowerCase(),a=e.map((e,t)=>({index:t,entry:e})).filter(e=>e.entry.persistedPrompt.toLowerCase().includes(i));if(a.length===0)return null;if(n===null)return a[0];let o=a.findIndex(e=>e.index===n);return o===-1?a[0]:a[z$(o+r,a.length)]}function I$(e,t,n){return n===-1?t===0||!e.slice(0,t).includes(`
|
|
3485
|
+
`),[i,a]=ZJ(r);if(i.length===0)return;let o=eY(i,i[0].indent,n);if(o.length!==0)return{type:`list`,ordered:!0,start:i[0]?.number||1,typeMarker:i[0]?.type,items:o,raw:r.slice(0,a).join(`
|
|
3486
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(nY,this.editor.getAttributes(rY)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new sP({props:{handlePaste:(e,t)=>{if((t.clipboardData?.getData(`text/html`))?.trim())return!1;let n=t.clipboardData?.getData(`text/plain`);if(!n)return!1;let r=$J(n);if(!r)return!1;try{let t=e.state.schema.nodeFromJSON(r),n=e.state.tr.replaceSelectionWith(t);return e.dispatch(n),!0}catch{return!1}}}})]},addInputRules(){let e=(e,t)=>(!t.attrs.type||t.attrs.type===`1`)&&t.childCount+t.attrs.start===+e[1],t=zU({find:iY,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:e});return(this.options.keepMarks||this.options.keepAttributes)&&(t=zU({find:iY,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(rY)}),joinPredicate:e,editor:this.editor})),[t]}}),sY=/^\s*(\[([( |x])?\])\s$/,cY=`position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0`,lY=(e,t,n)=>{var r;return(n==null||(r=n.checkboxLabel)==null?void 0:r.call(n,e,t))||`Task item checkbox for ${e.textContent||`empty task item`}`},uY=BU.create({name:`taskItem`,addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:`taskList`,a11y:void 0}},content(){return this.options.nested?`paragraph block*`:`paragraph+`},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{let t=e.getAttribute(`data-checked`);return t===``||t===`true`},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:e=>e.querySelector(`div`)??e}]},renderHTML({node:e,HTMLAttributes:t}){return[`li`,gV(this.options.HTMLAttributes,t,{"data-type":this.name}),[`label`,[`input`,{type:`checkbox`,checked:e.attrs.checked?`checked`:null}],[`span`]],[`div`,0]]},parseMarkdown:(e,t)=>{let n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode(`paragraph`,{},t.parseInline(e.tokens))):e.text?n.push(t.createNode(`paragraph`,{},[t.createNode(`text`,{text:e.text})])):n.push(t.createNode(`paragraph`,{},[])),e.nestedTokens&&e.nestedTokens.length>0){let r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode(`taskItem`,{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>rU(e,t,`- [${e.attrs?.checked?`x`:` `}] `),addExtensions(){return this.options.nested?[hJ(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{let i=document.createElement(`li`),a=document.createElement(`label`),o=document.createElement(`span`),s=document.createElement(`input`),c=document.createElement(`div`);o.style.cssText=cY;let l=e=>{let t=lY(e,e.attrs.checked,this.options.a11y);s.setAttribute(`aria-label`,t),o.textContent=t};l(e),a.contentEditable=`false`,s.type=`checkbox`,s.addEventListener(`mousedown`,e=>e.preventDefault()),s.addEventListener(`change`,t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){s.checked=!s.checked;return}let{checked:i}=t.target;r.isEditable&&typeof n==`function`&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{let t=n();if(typeof t!=`number`)return!1;let r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...r?.attrs,checked:i}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,i)||(s.checked=!s.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{i.setAttribute(e,t)}),i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,a.append(s,o),i.append(a,c),Object.entries(t).forEach(([e,t])=>{i.setAttribute(e,t)});let u=new Set(Object.keys(t));return{dom:i,contentDOM:c,update:e=>{if(e.type!==this.type)return!1;i.dataset.checked=e.attrs.checked,s.checked=e.attrs.checked,l(e);let t=r.extensionManager.attributes,n=_V(e,t),a=new Set(Object.keys(n)),o=this.options.HTMLAttributes;return u.forEach(e=>{a.has(e)||(e in o?i.setAttribute(e,o[e]):i.removeAttribute(e))}),Object.entries(n).forEach(([e,t])=>{t==null?e in o?i.setAttribute(e,o[e]):i.removeAttribute(e):i.setAttribute(e,t)}),u=a,!0}}}},addInputRules(){return[zU({find:sY,type:this.type,getAttributes:e=>({checked:e[e.length-1]===`x`})})]}}),dY=BU.create({name:`taskList`,addOptions(){return{itemTypeName:`taskItem`,HTMLAttributes:{}}},group:`block list`,content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return[`ul`,gV(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode(`taskList`,{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
|
|
3487
|
+
`):``,markdownTokenizer:{name:`taskList`,level:`block`,start(e){let t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;return t===void 0?-1:t},tokenize(e,t,n){let r=e=>{let t=nU(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(t){let r={type:`taskList`,raw:t.raw,items:t.items},i=e.slice(t.raw.length);return i.trim()?[r,...n.blockTokens(i)]:[r]}return n.blockTokens(e)},i=nU(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:e[3].toLowerCase()===`x`}),createToken:(e,t)=>({type:`taskItem`,raw:``,mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(i)return{type:`taskList`,raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});yU.create({name:`listKit`,addExtensions(){let e=[];return this.options.bulletList!==!1&&e.push(dJ.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(PJ.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(UJ.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(oY.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(uY.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(dY.configure(this.options.taskList)),e}});var fY=` `,pY=`\xA0`,mY=BU.create({name:`paragraph`,priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:`block`,content:`inline*`,parseHTML(){return[{tag:`p`}]},renderHTML({HTMLAttributes:e}){return[`p`,gV(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(n.length===1&&n[0].type===`image`)return t.parseChildren([n[0]]);let r=t.parseInline(n);return n.length===1&&n[0].type===`text`&&(n[0].raw===fY||n[0].text===fY||n[0].raw===pY||n[0].text===pY)&&r.length===1&&r[0].type===`text`&&(r[0].text===fY||r[0].text===pY)?t.createNode(`paragraph`,void 0,[]):t.createNode(`paragraph`,void 0,r)},renderMarkdown:(e,t,n)=>{if(!e)return``;let r=Array.isArray(e.content)?e.content:[];if(r.length===0){var i,a;let e=Array.isArray(n==null||(i=n.previousNode)==null?void 0:i.content)?n.previousNode.content:[];return(n==null||(a=n.previousNode)==null?void 0:a.type)===`paragraph`&&e.length===0?fY:``}return t.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),hY=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,gY=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,_Y=dU.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,gV(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[IU({find:hY,type:this.type})]},addPasteRules(){return[VU({find:gY,type:this.type})]}}),vY=BU.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),yY=dU.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,gV(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function bY(e={}){return new sP({view(t){return new xY(t,e)}})}var xY=class{constructor(e,t){this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=t.width??1,this.color=t.color===!1?void 0:t.color||`black`,this.class=t.class,this.handlers=[`dragover`,`dragend`,`drop`,`dragleave`].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(this.cursorPos!=null&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,n,r=this.editorView.dom,i=r.getBoundingClientRect(),a=i.width/r.offsetWidth,o=i.height/r.offsetHeight;if(t){let t=e.nodeBefore,r=e.nodeAfter;if(t||r){let e=this.editorView.nodeDOM(this.cursorPos-(t?t.nodeSize:0));if(e){let i=e.getBoundingClientRect(),a=t?i.bottom:i.top;t&&r&&(a=(a+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*o;n={left:i.left,right:i.right,top:a-s,bottom:a+s}}}}if(!n){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*a;n={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let s=this.editorView.dom.offsetParent;this.element||(this.element=s.appendChild(document.createElement(`div`)),this.class&&(this.element.className=this.class),this.element.style.cssText=`position: absolute; z-index: 50; pointer-events: none;`,this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle(`prosemirror-dropcursor-block`,t),this.element.classList.toggle(`prosemirror-dropcursor-inline`,!t);let c,l;if(!s||s==document.body&&getComputedStyle(s).position==`static`)c=-pageXOffset,l=-pageYOffset;else{let e=s.getBoundingClientRect(),t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;c=e.left-s.scrollLeft*t,l=e.top-s.scrollTop*n}this.element.style.left=(n.left-c)/a+`px`,this.element.style.top=(n.top-l)/o+`px`,this.element.style.width=(n.right-n.left)/a+`px`,this.element.style.height=(n.bottom-n.top)/o+`px`}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i=typeof r==`function`?r(this.editorView,t,e):r;if(!t||i)return null;let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=xN(this.editorView.state.doc,a,this.editorView.dragging.slice);e!=null&&(a=e)}return a}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);t!=null&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}},SY=class e extends K{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):K.near(r)}content(){return G.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new CY(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!TY(e)||!EY(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}else if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!J.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};SY.prototype.visible=!1,SY.findFrom=SY.findGapCursorFrom,K.jsonID(`gapcursor`,SY);var CY=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return SY.valid(t)?new SY(t):K.near(t)}};function wY(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function TY(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||wY(e.type))return!0;if(e.inlineContent)return!1}}return!0}function EY(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||wY(e.type))return!0;if(e.inlineContent)return!1}}return!0}function DY(){return new sP({props:{decorations:MY,createSelectionBetween(e,t,n){return t.pos==n.pos&&SY.valid(n)?new SY(n):null},handleClick:AY,handleKeyDown:OY,handleDOMEvents:{beforeinput:jY}}})}var OY=Lz({ArrowLeft:kY(`horiz`,-1),ArrowRight:kY(`horiz`,1),ArrowUp:kY(`vert`,-1),ArrowDown:kY(`vert`,1)});function kY(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof q){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=SY.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new SY(c))),!0):!1}}function AY(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!SY.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&J.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new SY(r))),!0)}function jY(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof SY))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=W.empty;for(let e=r.length-1;e>=0;e--)i=W.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new G(i,0,0));return a.setSelection(q.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function MY(e){if(!(e.selection instanceof SY))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,LR.create(e.doc,[PR.widget(e.selection.head,t,{key:`gapcursor`})])}var NY=200,PY=function(){};PY.prototype.append=function(e){return e.length?(e=PY.from(e),!this.length&&e||e.length<NY&&this.leafAppend(e)||this.length<NY&&e.leafPrepend(this)||this.appendInner(e)):this},PY.prototype.prepend=function(e){return e.length?PY.from(e).append(this):this},PY.prototype.appendInner=function(e){return new IY(this,e)},PY.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?PY.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},PY.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},PY.prototype.forEach=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},PY.prototype.map=function(e,t,n){t===void 0&&(t=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},PY.from=function(e){return e instanceof PY?e:e&&e.length?new FY(e):PY.empty};var FY=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return e==0&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(e(this.values[i],r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(e(this.values[i],r+i)===!1)return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=NY)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=NY)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(PY);PY.empty=new FY([]);var IY=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&this.left.forEachInner(e,t,Math.min(n,i),r)===!1||n>i&&this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i)===!1)return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)===!1||n<i&&this.left.forEachInvertedInner(e,Math.min(t,i),n,r)===!1)return!1},t.prototype.sliceInner=function(e,t){if(e==0&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(PY),LY=500,RY=class e{constructor(e,t){this.items=e,this.eventCount=t}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,c,l=[],u=[];return this.items.forEach((t,n)=>{if(!t.step){i||(i=this.remapping(r,n+1),a=i.maps.length),a--,u.push(t);return}if(i){u.push(new BY(t.map));let e=t.step.map(i.slice(a)),n;e&&o.maybeStep(e).doc&&(n=o.mapping.maps[o.mapping.maps.length-1],l.push(new BY(n,void 0,void 0,l.length+u.length))),a--,n&&i.appendMap(n,a)}else o.maybeStep(t.step);if(t.selection)return s=i?t.selection.map(i.slice(a)):t.selection,c=new e(this.items.slice(0,r).append(u.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,c=!i&&s.length?s.get(s.length-1):null;for(let e=0;e<t.steps.length;e++){let r=t.steps[e].invert(t.docs[e]),l=new BY(t.mapping.maps[e],r,n),u;(u=c&&c.merge(l))&&(l=u,e?a.pop():s=s.slice(0,s.length-1)),a.push(l),n&&=(o++,void 0),i||(c=l)}let l=o-r.depth;return l>HY&&(s=zY(s,l),o-=l),new e(s.append(a),o)}remapping(e,t){let n=new zM;return this.items.forEach((t,r)=>{let i=t.mirrorOffset!=null&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(e=>new BY(e))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},i);let c=n;this.items.forEach(e=>{let n=a.getMirror(--c);if(n==null)return;o=Math.min(o,n);let i=a.maps[n];if(e.step){let o=t.steps[n].invert(t.docs[n]),l=e.selection&&e.selection.map(a.slice(c+1,n));l&&s++,r.push(new BY(i,o,l))}else r.push(new BY(i))},i);let l=[];for(let e=n;e<o;e++)l.push(new BY(a.maps[e]));let u=this.items.slice(0,i).append(l).append(r),d=new e(u,s);return d.emptyItemCount()>LY&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((e,o)=>{if(o>=t)i.push(e),e.selection&&a++;else if(e.step){let t=e.step.map(n.slice(r)),o=t&&t.getMap();if(r--,o&&n.appendMap(o,r),t){let s=e.selection&&e.selection.map(n.slice(r));s&&a++;let c=new BY(o.invert(),t,s),l,u=i.length-1;(l=i.length&&i[u].merge(c))?i[u]=l:i.push(c)}}else e.map&&r--},this.items.length,0),new e(PY.from(i.reverse()),a)}};RY.empty=new RY(PY.empty,0);function zY(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&t--==0)return n=r,!1}),e.slice(n)}var BY=class e{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},VY=class{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}},HY=20;function UY(e,t,n,r){let i=n.getMeta(ZY),a;if(i)return i.historyState;n.getMeta(QY)&&(e=new VY(e.done,e.undone,null,0,-1));let o=n.getMeta(`appendedTransaction`);if(n.steps.length==0)return e;if(o&&o.getMeta(ZY))return o.getMeta(ZY).redo?new VY(e.done.addTransform(n,void 0,r,XY(t)),e.undone,GY(n.mapping.maps),e.prevTime,e.prevComposition):new VY(e.done,e.undone.addTransform(n,void 0,r,XY(t)),null,e.prevTime,e.prevComposition);if(n.getMeta(`addToHistory`)!==!1&&!(o&&o.getMeta(`addToHistory`)===!1)){let i=n.getMeta(`composition`),a=e.prevTime==0||!o&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!WY(n,e.prevRanges)),s=o?KY(e.prevRanges,n.mapping):GY(n.mapping.maps);return new VY(e.done.addTransform(n,a?t.selection.getBookmark():void 0,r,XY(t)),RY.empty,s,n.time,i??e.prevComposition)}else if(a=n.getMeta(`rebased`))return new VY(e.done.rebased(n,a),e.undone.rebased(n,a),KY(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new VY(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),KY(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function WY(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}function GY(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function KY(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),a=t.map(e[r+1],-1);i<=a&&n.push(i,a)}return n}function qY(e,t,n){let r=XY(t),i=ZY.get(t).spec.config,a=(n?e.undone:e.done).popEvent(t,r);if(!a)return null;let o=a.selection.resolve(a.transform.doc),s=(n?e.done:e.undone).addTransform(a.transform,t.selection.getBookmark(),i,r),c=new VY(n?s:a.remaining,n?a.remaining:s,null,0,-1);return a.transform.setSelection(o).setMeta(ZY,{redo:n,historyState:c})}var JY=!1,YY=null;function XY(e){let t=e.plugins;if(YY!=t){JY=!1,YY=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){JY=!0;break}}return JY}var ZY=new uP(`history`),QY=new uP(`closeHistory`);function $Y(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new sP({key:ZY,state:{init(){return new VY(RY.empty,RY.empty,null,0,-1)},apply(t,n,r){return UY(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r=n==`historyUndo`?tX:n==`historyRedo`?nX:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function eX(e,t){return(n,r)=>{let i=ZY.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=qY(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var tX=eX(!1,!0),nX=eX(!0,!0);yU.create({name:`characterCount`,addOptions(){return{limit:null,autoTrim:!0,mode:`textSize`,textCounter:e=>e.length,wordCounter:e=>e.split(` `).filter(e=>e!==``).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{let t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)===`textSize`){let e=t.textBetween(0,t.content.size,void 0,` `);return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size,` `,` `);return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new sP({key:new uP(`characterCount`),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,a=this.options.autoTrim;if(i==null||i===0||a===!1){e=!0;return}let o=this.storage.characters({node:r.doc});if(o>i){let t=o-i;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let n=r.tr.deleteRange(0,t);return e=!0,n}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||n===0||n==null)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;if(r>n&&i>n&&i>r||!e.getMeta(`paste`))return!1;let a=e.selection.$head.pos,o=a-(i-n),s=a;return e.deleteRange(o,s),!(this.storage.characters({node:e.doc})>n)}})]}});var rX=yU.create({name:`dropCursor`,addOptions(){return{color:`currentColor`,width:1,class:void 0}},addProseMirrorPlugins(){return[bY(this.options)]}});yU.create({name:`focus`,addOptions(){return{className:`has-focus`,mode:`all`}},addProseMirrorPlugins(){return[new sP({key:new uP(`focus`),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,a=[];if(!n||!r)return LR.create(e,[]);let o=0;this.options.mode===`deepest`&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;o+=1}});let s=0;return e.descendants((e,t)=>{if(e.isText||!(i>=t&&i<=t+e.nodeSize-1))return!1;if(s+=1,this.options.mode===`deepest`&&o-s>0||this.options.mode===`shallowest`&&s>1)return this.options.mode===`deepest`;a.push(PR.node(t,t+e.nodeSize,{class:this.options.className}))}),LR.create(e,a)}}})]}});var iX=yU.create({name:`gapCursor`,addProseMirrorPlugins(){return[DY()]},extendNodeSchema(e){return{allowGapCursor:uV(Y(e,`allowGapCursor`,{name:e.name,options:e.options,storage:e.storage}))??null}}}),aX=`placeholder`,oX=new uP(`tiptap__placeholder`);function sX(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:a,isEmptyDoc:o,hasAnchor:s,classes:{emptyNode:c,emptyEditor:l}}=e,u=[c];return o&&u.push(l),PR.node(i,i+a.nodeSize,{class:u.join(` `),[r]:typeof n==`function`?n({editor:t,node:a,pos:i,hasAnchor:s}):n})}function cX(e,t){return typeof e==`function`?e(t):e}function lX({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:a,to:o}){let{anchor:s}=i,c=[],l=e.isEmpty;return r.nodesBetween(a,o,(r,i)=>{let a=s>=i&&s<=i+r.nodeSize,o=!r.isLeaf&&KV(r);return r.type.isTextblock&&(a||!t.showOnlyCurrent)&&o&&c.push(sX({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:a,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:cX(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:a})},node:r,pos:i})),t.includeChildren}),c}function uX({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:a}=i,o=[],s=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(a),c=i.depth>0?i.node(1):i.nodeAfter,l=i.depth>0?i.before(1):a;if(c&&c.type.isTextblock&&KV(c)){let r=a>=l&&a<=l+c.nodeSize;o.push(sX({editor:e,isEmptyDoc:s,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:cX(t.emptyNodeClass,{editor:e,node:c,pos:l,hasAnchor:r})},node:c,pos:l}))}}else o.push(...lX({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return LR.create(r,o)}function dX(e,t){let n=e.resolve(t);if(n.depth===0){let e=n.nodeAfter??n.nodeBefore;if(!e)return{from:t,to:t};let r=n.nodeAfter?t:t-e.nodeSize;return{from:r,to:r+e.nodeSize}}let r=n.before(1);return{from:r,to:r+n.node(1).nodeSize}}function fX(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}function pX(e,t,n){let r=[];return e.forEach((e,i)=>{let a=i,o=a+e.nodeSize,s=a+1,c=o+1;s<n&&c>t&&r.push({from:a,to:o})}),r}function mX(e){if(e.length===0)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}function hX(e,t){let n=pX(e,t.from,t.to);return n.push(fX(e,dX(e,t.from))),t.to>t.from?n.push(fX(e,dX(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&n.push(fX(e,dX(e,Math.min(t.from+1,e.content.size)))),n}function gX(e,t,n){let r=[];if(e.docChanged){let t=NV(e);for(let e of t)r.push(...hX(n.doc,e.newRange))}return e.selectionSet&&(r.push(fX(n.doc,dX(n.doc,e.mapping.map(t.selection.anchor)))),r.push(fX(n.doc,dX(n.doc,n.selection.anchor)))),mX(r)}function _X(e,t,n){let r=Math.max(0,Math.min(e,n.content.size));return{from:r,to:Math.max(r,Math.min(t,n.content.size))}}function vX({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:a,selection:o}){let s=e;for(let e of t){let{from:t,to:c}=_X(e.from,e.to,a),l=s.find(t,c).filter(e=>e.from>=t&&e.to<=c);l.length&&(s=s.remove(l));let u=lX({editor:n,options:r,dataAttribute:i,doc:a,selection:o,from:t,to:c});u.length&&(s=s.add(a,u))}return s}function yX({editor:e,options:t,dataAttribute:n}){return{init(r,i){return uX({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection})??LR.empty},apply(r,i,a,o){return!r.docChanged&&!r.selectionSet?i:vX({decorations:i.map(r.mapping,r.doc),ranges:gX(r,a,o),editor:e,options:t,dataAttribute:n,doc:o.doc,selection:o.selection})}}}function bX(e){return e.replace(/\s+/g,`-`).replace(/[^a-zA-Z0-9-]/g,``).replace(/^[0-9-]+/,``).replace(/^-+/,``).toLowerCase()}function xX({editor:e,options:t}){let n=t.dataAttribute?`data-${bX(t.dataAttribute)}`:`data-${aX}`,r=t.showOnlyCurrent&&!t.includeChildren;return new sP({key:oX,...r?{}:{state:yX({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>uX({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>t.showOnlyWhenEditable&&!e.isEditable?LR.empty:oX.getState(n)??LR.empty}})}yU.create({name:`placeholder`,addOptions(){return{emptyEditorClass:`is-editor-empty`,emptyNodeClass:`is-empty`,dataAttribute:aX,placeholder:`Write something …`,showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[xX({editor:this.editor,options:this.options})]}});function SX(e,t){return!e.selection.empty&&!qV(e.selection)&&t.isEditable}function CX(e,t){return SX(e,t)&&!t.isFocused&&!t.view.dragging}function wX(){var e;(e=window.getSelection())==null||e.removeAllRanges()}function TX(e){e.focus()}yU.create({name:`selection`,addOptions(){return{className:`selection`}},addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new sP({key:new uP(`selection`),props:{decorations(n){return CX(n,e)?LR.create(n.doc,[PR.inline(n.selection.from,n.selection.to,{class:t.className})]):null},handleDOMEvents:{blur(t){return SX(t.state,e)&&wX(),!1},focus(t){return SX(t.state,e)&&requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&TX(t)}),!1}}}})]}});function EX({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var DX=yU.create({name:`trailingNode`,addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){let e=new uP(this.name),t=this.options.node||this.editor.schema.topNodeType.contentMatch.defaultType?.name||`paragraph`,n=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(t).includes(e.name));return[new sP({key:e,appendTransaction:(n,r,i)=>{let{doc:a,tr:o,schema:s}=i,c=e.getState(i),l=a.content.size,u=s.nodes[t];if(!n.some(e=>e.getMeta(`skipTrailingNode`))&&c)return o.insert(l,u.create())},state:{init:(e,t)=>{let r=t.tr.doc.lastChild;return!EX({node:r,types:n})},apply:(e,t)=>{if(!e.docChanged||e.getMeta(`__uniqueIDTransaction`))return t;let r=e.doc.lastChild;return!EX({node:r,types:n})}}})]}}),OX=yU.create({name:`undoRedo`,addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>tX(e,t),redo:()=>({state:e,dispatch:t})=>nX(e,t)}},addProseMirrorPlugins(){return[$Y(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),kX=yU.create({name:`starterKit`,addExtensions(){let e=[];return this.options.bold!==!1&&e.push(Gq.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(Bq.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(dJ.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Jq.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(Qq.configure(this.options.codeBlock)),this.options.document!==!1&&e.push($q.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(rX.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(iX.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(eJ.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(tJ.configure(this.options.heading)),this.options.undoRedo!==!1&&e.push(OX.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&e.push(nJ.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(sJ.configure(this.options.italic)),this.options.listItem!==!1&&e.push(PJ.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(UJ.configure(this.options?.listKeymap)),this.options.link!==!1&&e.push(kq.configure(this.options?.link)),this.options.orderedList!==!1&&e.push(oY.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(mY.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(_Y.configure(this.options.strike)),this.options.text!==!1&&e.push(vY.configure(this.options.text)),this.options.underline!==!1&&e.push(yY.configure(this.options?.underline)),this.options.trailingNode!==!1&&e.push(DX.configure(this.options?.trailingNode)),e}}),AX=(0,L.createContext)(null);function jX(e){let t=(0,L.use)(AX);if(!t)throw Error(`${e} must be used inside Composer.Root.`);return t}function MX(e){let t=(0,U.c)(9),n=jX(e===void 0?`useComposer`:e),r;t[0]!==n.activePopup||t[1]!==n.disabled||t[2]!==n.meta||t[3]!==n.suggestions?(r={...n.meta,disabled:n.disabled,activePopup:n.activePopup,suggestions:n.suggestions},t[0]=n.activePopup,t[1]=n.disabled,t[2]=n.meta,t[3]=n.suggestions,t[4]=r):r=t[4];let i;return t[5]!==n.actions||t[6]!==n.state||t[7]!==r?(i={state:n.state,actions:n.actions,meta:r},t[5]=n.actions,t[6]=n.state,t[7]=r,t[8]=i):i=t[8],i}function NX(e){let t=(0,U.c)(23),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,attachedImages:a}=jX(`Composer.Attachments`),o=i.imageAttachments,s,c,l,u,d,f;if(t[3]!==a||t[4]!==n||t[5]!==r||t[6]!==i.imageAttachments){f=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[13]===a?e=t[14]:(e=e=>a.has(e.id),t[13]=a,t[14]=e);let i=o.filter(e);if(i.length===0){f=null;break bb0}s=`list`,c=`Attached files`,t[15]===n?l=t[16]:(l=j(`flex flex-wrap gap-2`,n),t[15]=n,t[16]=l),u=r,d=i.map(PX)}t[3]=a,t[4]=n,t[5]=r,t[6]=i.imageAttachments,t[7]=s,t[8]=c,t[9]=l,t[10]=u,t[11]=d,t[12]=f}else s=t[7],c=t[8],l=t[9],u=t[10],d=t[11],f=t[12];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let p;return t[17]!==s||t[18]!==c||t[19]!==l||t[20]!==u||t[21]!==d?(p=(0,R.jsx)(`div`,{role:s,"aria-label":c,className:l,...u,children:d}),t[17]=s,t[18]=c,t[19]=l,t[20]=u,t[21]=d,t[22]=p):p=t[22],p}function PX(e){return(0,R.jsx)(FX,{attachment:e},e.id)}function FX(e){let t=(0,U.c)(18),{attachment:n}=e,{id:r,placeholder:i,media:a}=n,{attachedImages:o,disabled:s,actions:c}=jX(`Composer.Attachments`),l;t[0]!==o||t[1]!==r?(l=o.get(r),t[0]=o,t[1]=r,t[2]=l):l=t[2];let u=l;if(!u)return null;let d;t[3]!==u||t[4]!==a||t[5]!==i?(d=a===`video`?(0,R.jsx)(RX,{placeholder:i,file:u}):a===`audio`?(0,R.jsx)(BX,{placeholder:i,file:u,glyph:`♪`}):(0,R.jsx)(LX,{placeholder:i,file:u}),t[3]=u,t[4]=a,t[5]=i,t[6]=d):d=t[6];let f=`Remove ${i}`,p;t[7]!==c||t[8]!==r?(p=()=>c.removeImageAttachment(r),t[7]=c,t[8]=r,t[9]=p):p=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,R.jsx)(m,{"aria-hidden":!0,className:`size-3`}),t[10]=h):h=t[10];let g;t[11]!==s||t[12]!==f||t[13]!==p?(g=(0,R.jsx)(St,{type:`button`,"aria-label":f,disabled:s,onClick:p,className:`bg-background text-foreground border-border hover:bg-muted absolute -top-1.5 -right-1.5 flex size-5 items-center justify-center rounded-full border disabled:opacity-50`,children:h}),t[11]=s,t[12]=f,t[13]=p,t[14]=g):g=t[14];let _;return t[15]!==d||t[16]!==g?(_=(0,R.jsxs)(`div`,{role:`listitem`,className:`relative`,children:[d,g]}),t[15]=d,t[16]=g,t[17]=_):_=t[17],_}function IX(e){let t=(0,U.c)(3),[n,r]=(0,L.useState)(null),i,a;return t[0]===e?(i=t[1],a=t[2]):(i=()=>{let t=URL.createObjectURL(e);return r(t),()=>URL.revokeObjectURL(t)},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,L.useEffect)(i,a),n}function LX(e){let t=(0,U.c)(5),{placeholder:n,file:r}=e,i=IX(r),[a,o]=(0,L.useState)(null),s;return t[0]!==a||t[1]!==r||t[2]!==i||t[3]!==n?(s=i===null?null:i===a?(0,R.jsx)(BX,{placeholder:n,file:r,glyph:`🖼`}):(0,R.jsx)(`img`,{src:i,alt:n,title:r.name,className:`border-border size-16 rounded-md border object-cover`,onError:()=>o(i)}),t[0]=a,t[1]=r,t[2]=i,t[3]=n,t[4]=s):s=t[4],s}function RX(e){let t=(0,U.c)(11),{placeholder:n,file:r}=e,i=IX(r),[a,o]=(0,L.useState)(null),s=i??void 0,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>o(e.currentTarget.duration),t[0]=c):c=t[0];let l;t[1]===s?l=t[2]:(l=(0,R.jsx)(`video`,{src:s,muted:!0,playsInline:!0,preload:`metadata`,className:`size-full object-cover`,onLoadedMetadata:c}),t[1]=s,t[2]=l);let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,R.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center justify-center text-lg text-white drop-shadow`,children:`▶`}),t[3]=u):u=t[3];let d;t[4]===a?d=t[5]:(d=a!==null&&Number.isFinite(a)?(0,R.jsx)(`span`,{className:`absolute right-0.5 bottom-0.5 rounded bg-black/70 px-1 text-[10px] leading-4 text-white`,children:zX(a)}):null,t[4]=a,t[5]=d);let f;return t[6]!==r.name||t[7]!==n||t[8]!==l||t[9]!==d?(f=(0,R.jsxs)(`div`,{role:`img`,"aria-label":n,title:r.name,className:`border-border bg-muted relative size-16 overflow-hidden rounded-md border`,children:[l,u,d]}),t[6]=r.name,t[7]=n,t[8]=l,t[9]=d,t[10]=f):f=t[10],f}function zX(e){let t=Math.round(e);return`${Math.floor(t/60)}:${String(t%60).padStart(2,`0`)}`}function BX(e){let t=(0,U.c)(12),{placeholder:n,file:r,glyph:i}=e,a;t[0]===i?a=t[1]:(a=(0,R.jsxs)(`span`,{"aria-hidden":!0,children:[i,` `]}),t[0]=i,t[1]=a);let o=r.name||n,s;t[2]!==a||t[3]!==o?(s=(0,R.jsxs)(`span`,{className:`text-foreground truncate`,children:[a,o]}),t[2]=a,t[3]=o,t[4]=s):s=t[4];let c=r.type||`file`,l;t[5]===c?l=t[6]:(l=(0,R.jsx)(`span`,{className:`truncate`,children:c}),t[5]=c,t[6]=l);let u;return t[7]!==r.name||t[8]!==n||t[9]!==s||t[10]!==l?(u=(0,R.jsxs)(`div`,{role:`img`,"aria-label":n,title:r.name,className:`border-border bg-muted text-muted-foreground flex h-16 max-w-48 flex-col justify-center gap-0.5 rounded-md border px-2 text-xs`,children:[s,l]}),t[7]=r.name,t[8]=n,t[9]=s,t[10]=l,t[11]=u):u=t[11],u}function VX(e,t){return e===`hidden`?!1:e===`before-interaction`?!t:e!==`after-interaction`||t}function HX(e,t,n){let r=WX(e),i=t.filter(e=>GX(e)&&VX(e.visibility,n));return r?i.map((e,t)=>{let n=qX(r,e);return n===null?null:{command:e,rank:n,index:t}}).filter(e=>!!e).sort((e,t)=>e.rank-t.rank||e.index-t.index).map(e=>e.command).slice(0,10):i.slice(0,10)}function UX(e,t){let n=e.toLowerCase();return t.find(e=>GX(e)&&(e.value.toLowerCase()===n||KX(e).some(e=>e===n)))}function WX(e){return e.slice(1).toLowerCase()}function GX(e){return e.availability!==`disabled`}function KX(e){return(e.aliases??[]).map(e=>e.toLowerCase())}function qX(e,t){let n=t.value.toLowerCase(),r=KX(t),i=[t.label.toLowerCase(),...(t.searchTerms??[]).map(e=>e.toLowerCase())];return n===e?0:r.some(t=>t===e)?1:n.startsWith(e)?2:r.some(t=>t.startsWith(e))?3:i.some(t=>t.startsWith(e))?4:null}function JX(e){return e.map(RegExp.escape).join(`|`)}function YX(e){return`(?:${JX(e)})[A-Za-z0-9_:-]+`}function XX(e){return`(?:${JX(e)})[^\\s]+`}function ZX(e,t){let n=[];return t.length>0&&n.push(XX(t)),e.length>0&&n.push(YX(e)),n.length>0?new RegExp(n.join(`|`),`g`):null}function QX(e,t){return t.some(t=>e.startsWith(t))}function $X(e){return`${e.trigger}${e.value}`}function eZ({initialDraft:e,text:t=``,slashCommands:n=[],mentionCandidates:r=[],commandTriggers:i=[],remoteImageUrls:a=[],isTaskRunning:o=!1,queueSubmissions:s=!1}={}){let c=e?.text??t,l=r.flatMap(e=>{let t=CZ(`mention`,$X(e),c,{detail:e.detail});return t?[t]:[]}),u=l.flatMap(e=>{let t=r.find(t=>$X(t)===e.label);return t?[{id:e.id,trigger:t.trigger,value:t.value,payload:t.payload,persistsAs:t.persistsAs}]:[]}),d=e?.remoteImages??(e?.remoteImageUrls??a).map((e,t)=>({id:tQ(`remote-image`,e,t),url:e}));return{text:c,cursor:c.length,elements:wZ(e?.elements??[...oZ(c,n,i),...l]),mentionBindings:e?.mentionBindings??u,imageAttachments:[],remoteImages:d,pendingPastes:e?.pendingPastes??[],selectedRemoteImageId:null,isTaskRunning:o,queueSubmissions:s,error:null,reverseSearch:null,shortcutsOpen:!1,history:[],historyCursor:null,killBuffer:``}}function tZ(e){return e.text.length===0&&e.imageAttachments.length===0&&e.remoteImages.length===0&&e.pendingPastes.length===0}function nZ(e,t,n){return aZ(e,t,n)}function rZ(e,t){if(!t||t<1)return null;let n=jZ(e.prompt);return n<=t?null:`Prompt is too long after expanding pasted content (${n} chars; max ${t} chars).`}function iZ(e,t,n){let r=_Z(e.elements,e.text);r=[...r.filter(e=>e.kind!==`slash-command`),...oZ(e.text,t,n)];let i=e.mentionBindings.filter(e=>r.some(t=>t.id===e.id)),a=e.imageAttachments.filter(e=>r.some(t=>t.kind===`image`&&t.label===e.placeholder)),o=e.pendingPastes.filter(e=>r.some(t=>t.kind===`paste`&&t.label===e.placeholder));return{...e,elements:wZ(r),mentionBindings:i,imageAttachments:kZ(a,e.remoteImages.length),pendingPastes:o}}function aZ(e,t,n){let r=e.text.trim(),i=pZ(e.text,r,e.elements),a=dZ(e.text,e.elements,e.pendingPastes),o=a.text,s=o.trim(),c=pZ(o,s,a.elements),l=e.imageAttachments.filter(t=>e.text.includes(t.placeholder)),u=mZ(r,i),d=LZ({text:u.text,elements:u.elements,mentionBindings:e.mentionBindings}),f=LZ({text:s,elements:c,mentionBindings:e.mentionBindings});if(!s&&l.length===0&&e.remoteImages.length===0)return null;let p=QX(o,n)?sZ(s,c,t,n):null,m=p?.prompt===void 0?null:p.args?`${p.prompt}\n\n${LZ({text:p.args,elements:p.argsElements,mentionBindings:e.mentionBindings})}`:p.prompt,h=p?.prompt===void 0?null:p.args?(()=>{let t=mZ(p.args,p.argsElements);return`${p.prompt}\n\n${LZ({text:t.text,elements:t.elements,mentionBindings:e.mentionBindings})}`})():p.prompt,g=m??f,_=p?.args===void 0?p?`command`:`submitted`:`command-with-args`,v=[...e.remoteImages.map(e=>({type:`remote_image`,url:e.url}))];!p&&s&&v.push({type:`text`,text:s,textElements:c});let y=p?.args??s;for(let t of e.mentionBindings){let e=`${t.trigger}${t.value}`;!e||!y.includes(e)||v.push({type:`item`,id:t.id,trigger:t.trigger,value:t.value,payload:t.payload})}for(let e of c)e.kind===`link`&&e.detail&&v.push({type:`link`,text:e.label,href:e.detail}),e.kind===`rich-link`&&e.detail&&v.push({type:`rich_link`,text:e.label,href:e.detail,metadata:e.metadata});return{mode:_,prompt:g,persistedPrompt:d,historyPrompt:h??d,action:p?.args===void 0?p?`Command`:`Plain`:`CommandWithArgs`,command:p?.command,args:p?.args,items:v,elements:i,payloadElements:c,mentionBindings:e.mentionBindings}}function oZ(e,t,n){let r=[];if(n.length===0)return r;let i=e.matchAll(RegExp(`(^|\\s)((?:${JX(n)})([A-Za-z0-9_:-]+))(?=\\s|$)`,`g`));for(let e of i){let n=UX(e[3],t);if(!n)continue;let i=e[2],a=e.index+e[1].length;r.push({id:tQ(`slash-command`,i,a),kind:`slash-command`,label:i,range:{start:a,end:a+i.length},detail:n.detail})}return r}function sZ(e,t,n,r){let i=e.match(RegExp(`^(?:${JX(r)})([A-Za-z0-9_:-]+)(?:\\s+([\\s\\S]+))?$`));if(!i)return null;let a=UX(i[1],n);if(!a)return null;let o=i[2]??``;if(!o.trim())return{command:a.value,prompt:a.expandsTo};if(!a.supportsArgs)return null;let s=a.trigger.length+a.value.length,c=e.slice(s).search(/\S/),l=c===-1?s:s+c,u=o.trim();return{command:a.value,prompt:a.expandsTo,args:u,argsElements:fZ(t,l,l+u.length)}}function cZ(e,t,n){if(n.length===0)return null;let r=e.match(RegExp(`^(?:${JX(n)})([A-Za-z0-9_:-]+)(?:\\s+[\\s\\S]*)?$`));return!r||UX(r[1],t)||uZ(r[1])?null:r[1]}var lZ=new Set([`Applications`,`Library`,`System`,`Users`,`Volumes`,`bin`,`dev`,`etc`,`home`,`mnt`,`opt`,`private`,`sbin`,`tmp`,`usr`,`var`,`workspace`]);function uZ(e){return lZ.has(e)}function dZ(e,t,n){if(n.length===0||t.length===0)return{text:e,elements:t};let r=new Map;for(let e of n){let t=r.get(e.placeholder)??[];t.push(e.content),r.set(e.placeholder,t)}let i=``,a=[],o=0;for(let n of wZ(t)){let t=Math.min(n.range.start,e.length),s=Math.min(n.range.end,e.length);if(t>s)continue;t>o&&(i+=e.slice(o,t));let c=e.slice(t,s),l=r.get(n.label)?.shift();if(l!==void 0)i+=l;else{let e=i.length;i+=c,a.push({...n,range:{start:e,end:i.length}})}o=s}return o<e.length&&(i+=e.slice(o)),{text:i,elements:a}}function fZ(e,t,n){return e.filter(e=>e.range.end>t&&e.range.start<n).map(e=>({...e,range:{start:Math.max(0,e.range.start-t),end:Math.min(n,e.range.end)-t}})).filter(e=>e.range.start<e.range.end)}function pZ(e,t,n){let r=e.indexOf(t);return r<=0?n:n.filter(e=>e.range.end>r).map(e=>({...e,range:{start:Math.max(0,e.range.start-r),end:Math.max(0,e.range.end-r)}}))}function mZ(e,t){let n=wZ(t.filter(e=>e.kind===`image`));for(let t of n.toReversed())e=gZ(e,t.range,``);let r=e=>n.reduce((t,n)=>t+Math.max(0,Math.min(e,n.range.end)-n.range.start),0);return{text:e,elements:wZ(t.filter(e=>e.kind!==`image`)).map(e=>({...e,range:{start:e.range.start-r(e.range.start),end:e.range.end-r(e.range.end)}}))}}function hZ(e,t,n,r){return e<r&&t>n}function gZ(e,t,n){return e.slice(0,t.start)+n+e.slice(t.end)}function _Z(e,t){let n=new Map;return wZ(e).map(e=>{let r=vZ(t,e.label);if(r.length===0)return null;let i=`${e.kind}:${e.label}`,a=n.get(i)??[],o=yZ(r,e,a)??bZ(r,e,a)??xZ(r,e);return n.set(i,[...a,o]),{...e,range:o}}).filter(e=>!!e)}function vZ(e,t){if(!t)return[];let n=[],r=e.indexOf(t);for(;r!==-1;)n.push({start:r,end:r+t.length}),r=e.indexOf(t,r+t.length);return n}function yZ(e,t,n){return e.find(e=>e.start===t.range.start&&e.end===t.range.end&&!SZ(e,n))}function bZ(e,t,n){return xZ(e.filter(e=>!SZ(e,n)),t)}function xZ(e,t){return[...e].sort((e,n)=>Math.abs(e.start-t.range.start)-Math.abs(n.start-t.range.start)||e.start-n.start)[0]}function SZ(e,t){return t.some(t=>e.start===t.start&&e.end===t.end&&hZ(e.start,e.end,t.start,t.end))}function CZ(e,t,n,r={}){let i=n.indexOf(t);return i===-1?null:{id:tQ(e,t,i),kind:e,label:t,range:{start:i,end:i+t.length},detail:r.detail}}function wZ(e){return[...e].sort((e,t)=>e.range.start-t.range.start)}var TZ={image:`Image`,video:`Video`,audio:`Audio`};function EZ(e){let t=e.type.split(`/`)[0];return t===`image`||t===`video`||t===`audio`?t:null}function DZ(e){return e===`video`||e===`audio`?e:`image`}function OZ(e,t){return`[${TZ[e]} #${t}]`}function kZ(e,t){return e.map((e,n)=>({...e,placeholder:OZ(e.media,t+n+1)}))}function AZ(e,t){if(!t)return null;let n=e.remoteImages.findIndex(e=>e.id===t);return n===-1?null:n}function jZ(e){return Array.from(e).length}function MZ(e){let t=mZ(e.text,e.elements);return{text:t.text,elements:qZ(t.elements),mentionBindings:JZ(e.mentionBindings),remoteImages:e.remoteImages.map(e=>({...e})),pendingPastes:YZ(e.pendingPastes)}}function NZ(e,t){return{persistedPrompt:t,remoteImages:e.remoteImages.map(e=>({...e})),pendingPastes:YZ(e.pendingPastes)}}function PZ(e,t){let n=NZ(e,t);return!n.persistedPrompt.trim()&&n.remoteImages.length===0&&n.pendingPastes.length===0?e.history:[n,...e.history].slice(0,8)}function FZ({text:e,slashCommands:t=[],commandTriggers:n=[],mentionCandidates:r=[]}){let i=zZ(e,r),a=WZ(i.text,i.elements,i.protectedRanges,t,r);return MZ(iZ(eZ({initialDraft:{text:i.text,elements:wZ([...i.elements,...a.elements]),mentionBindings:[...i.mentionBindings,...a.mentionBindings]},slashCommands:t}),t,n))}function IZ({source:e,slashCommands:t=[],mentionCandidates:n=[]}){let r=FZ({text:e.persistedPrompt,slashCommands:t,mentionCandidates:n}),i=[...e.pendingPastes.flatMap(e=>{let t=CZ(`paste`,e.placeholder,r.text??``,{detail:`${jZ(e.content)} chars`});return t?[t]:[]})];return{...r,elements:wZ([...r.elements??[],...i]),remoteImages:e.remoteImages.map(e=>({...e})),pendingPastes:YZ(e.pendingPastes)}}function LZ(e){let t=e.text??``,n=wZ(e.elements??[]).map(t=>KZ(t,e)).filter(e=>!!e).sort((e,t)=>t.range.start-e.range.start);for(let e of n)t=gZ(t,e.range,e.text);return t}function RZ(e){return e.startsWith(`composer-text-link://`)?decodeURIComponent(e.replace(/^composer-text-link:\/\//,``)):e}function zZ(e,t){let n=[],r=[],i=[],a=``;for(let o of KA(e)){if(o.kind===`inline-code`||o.kind===`code-block`){let e=a.length;a+=o.source,i.push({start:e,end:a.length});continue}if(o.kind!==`link`&&o.kind!==`skill-link`&&o.kind!==`mention`){a+=o.source;continue}let e=o.label,s=o.href,c=RZ(s),l=BZ(e,t),u=l?$X(l):e,d=a.length;if(a+=u,l){let e=tQ(`mention`,u,d);n.push({id:e,kind:`mention`,label:u,range:{start:d,end:d+u.length},detail:l.detail}),r.push({id:e,trigger:l.trigger,value:l.value,payload:l.payload,persistsAs:l.persistsAs})}else n.push({id:tQ(`link`,u,d),kind:`link`,label:u,range:{start:d,end:d+u.length},detail:c})}return{text:a,elements:n,mentionBindings:r,protectedRanges:i}}function BZ(e,t){return t.find(t=>$X(t)===e)??null}function VZ(e){return[...new Set(e.map(e=>e.trigger).filter(Boolean))].sort((e,t)=>t.length-e.length)}function HZ(e){let t=VZ(e);return t.length===0?null:RegExp(`(?:${JX(t)})[A-Za-z0-9_:-]+`,`g`)}function UZ(e,t){return VZ(t).find(t=>e.startsWith(t))?.length??0}function WZ(e,t,n,r,i){let a=[],o=[],s=[],c=(r,i)=>{let a=r+i.length;return(r===0||/\s/.test(e[r-1]??``))&&!GZ(r,i,t)&&!s.some(e=>r<e.end&&a>e.start)&&!n.some(e=>r<e.end&&a>e.start)},l=[...i].sort((e,t)=>$X(t).length-$X(e).length);for(let t of l){let n=$X(t);if(n)for(let r=e.indexOf(n);r!==-1;r=e.indexOf(n,r+n.length)){let i=r+n.length;if(/[\w-]/.test(e[i]??``)||!c(r,n))continue;let l=tQ(`mention`,n,r);s.push({start:r,end:i}),a.push({id:l,kind:`mention`,label:n,range:{start:r,end:i},detail:t.detail}),o.push({id:l,trigger:t.trigger,value:t.value,payload:t.payload,persistsAs:t.persistsAs})}}let u=HZ(r);for(let t of u?e.matchAll(u):[]){let e=t.index??0,n=t[0];if(!c(e,n))continue;let i=UX(n.slice(UZ(n,r)),r);i&&(s.push({start:e,end:e+n.length}),a.push({id:tQ(`slash-command`,n,e),kind:`slash-command`,label:n,range:{start:e,end:e+n.length},detail:i.detail}))}return{elements:a,mentionBindings:o}}function GZ(e,t,n){let r=e+t.length;return n.some(t=>e<t.range.end&&r>t.range.start)}function KZ(e,t){if(e.kind===`mention`){let n=(t.mentionBindings??[]).find(t=>t.id===e.id||`${t.trigger}${t.value}`===e.label);return n?{range:e.range,text:n.persistsAs??e.label}:null}return(e.kind===`link`||e.kind===`rich-link`)&&e.detail?{range:e.range,text:GA(e.label,e.detail)}:null}function qZ(e){return e.map(e=>{let t={...e,range:{...e.range}};return e.metadata?{...t,metadata:{...e.metadata}}:t})}function JZ(e){return e.map(e=>({...e}))}function YZ(e){return e.map(e=>({...e}))}function XZ(e,t,n,r=1){if(t.length===0)return null;let i=t.toLowerCase(),a=e.map((e,t)=>({index:t,entry:e})).filter(e=>e.entry.persistedPrompt.toLowerCase().includes(i));if(a.length===0)return null;if(n===null)return a[0];let o=a.findIndex(e=>e.index===n);return o===-1?a[0]:a[eQ(o+r,a.length)]}function ZZ(e,t,n){return n===-1?t===0||!e.slice(0,t).includes(`
|
|
3488
3488
|
`):t===e.length||!e.slice(t).includes(`
|
|
3489
|
-
`)}function L$(e,t){let n=V$(e,t);for(;n>0&&J$(W$(e,n));)n=H$(e,n);if(n===0)return 0;let r=Z$(W$(e,n));if(r===`cjk`)return H$(e,n);for(;n>0&&Z$(W$(e,n))===r;)n=H$(e,n);return n}function R$(e,t){let n=V$(e,t);for(;n<e.length&&J$(G$(e,n));)n=U$(e,n);if(n>=e.length)return e.length;let r=Z$(G$(e,n));if(r===`cjk`)return U$(e,n);for(;n<e.length&&Z$(G$(e,n))===r;)n=U$(e,n);return n}function z$(e,t){return(e%t+t)%t}function B$(e,t,n){return`${e}:${n}:${t}`}function V$(e,t){let n=Math.max(0,Math.min(t,e.length));return n>0&&n<e.length&&q$(e.charCodeAt(n))&&--n,n}function H$(e,t){let n=t-1;return n>0&&q$(e.charCodeAt(n))?n-1:Math.max(n,0)}function U$(e,t){let n=t+(K$(e.charCodeAt(t))?2:1);return Math.min(n,e.length)}function W$(e,t){let n=H$(e,t);return e.slice(n,t)}function G$(e,t){return e.slice(t,U$(e,t))}function K$(e){return e>=55296&&e<=56319}function q$(e){return e>=56320&&e<=57343}function J$(e){return/\s/u.test(e)}function Y$(e){return!X$(e)&&/[\p{Letter}\p{Number}_]/u.test(e)}function X$(e){return/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(e)}function Z$(e){return X$(e)?`cjk`:Y$(e)?`word`:`separator`}var Q$=`composer-draft:v1:`;function $$(e){let t=localStorage.getItem(`${Q$}${e}`);if(!t)return null;try{let e=JSON.parse(t);return n1(e)?e:null}catch{return null}}function e1(e,t){let n=`${Q$}${e}`;if(!t||t1(t)){localStorage.removeItem(n);return}try{localStorage.setItem(n,JSON.stringify(t))}catch{}}function t1(e){return!e.persistedPrompt.trim()&&e.remoteImages.length===0&&e.pendingPastes.length===0}function n1(e){return r1(e)&&Object.keys(e).every(e=>[`persistedPrompt`,`remoteImages`,`pendingPastes`].includes(e))&&typeof e.persistedPrompt==`string`&&Array.isArray(e.remoteImages)&&Array.isArray(e.pendingPastes)}function r1(e){return typeof e==`object`&&!!e}var i1=Symbol.for(`composer.registry.trigger`),a1=Symbol.for(`composer.registry.command`),o1=Symbol.for(`composer.registry.mention`);function s1(e){return null}s1.role=i1;function c1(e){return null}c1.role=a1;function l1(e){return null}l1.role=o1;function u1(e){let t=[],n=[],r=new Set,i=new Set,a=!1,o=e=>{for(let s of L.Children.toArray(e)){if(!(0,L.isValidElement)(s)){a=!0;continue}if(s.type===L.Fragment){(0,L.isValidElement)(s)&&o(s.props.children);continue}if(h1(s.type,i1)){(0,L.isValidElement)(s)&&p1(s.props,{slashCommands:t,mentionCandidates:n,commandTriggers:r,mentionTriggers:i});continue}if(h1(s.type,a1)||h1(s.type,o1))throw Error(`Composer.Command and Composer.Mention must be placed inside a <Composer.Trigger>.`);a=!0}};return o(e),{slashCommands:t,mentionCandidates:n,commandTriggers:[...r],mentionTriggers:[...i],hasLayoutChildren:a}}function d1(e){return JSON.stringify([e.slashCommands.map(f1),e.mentionCandidates.map(f1),e.commandTriggers,e.mentionTriggers])}function f1(e){let{icon:t,...n}=e;return n}function p1(e,t){let{trigger:n}=e;for(let r of L.Children.toArray(e.children))if((0,L.isValidElement)(r)){if(r.type===L.Fragment){(0,L.isValidElement)(r)&&p1({trigger:n,children:r.props.children},t);continue}if(h1(r.type,a1)){if(t.mentionTriggers.has(n))throw Error(`Composer.Trigger "${n}" already holds mentions; a trigger carries either commands or mentions, not both.`);t.commandTriggers.add(n),(0,L.isValidElement)(r)&&t.slashCommands.push({...r.props,atomic:!1,trigger:n});continue}if(h1(r.type,o1)){if(t.commandTriggers.has(n))throw Error(`Composer.Trigger "${n}" already holds commands; a trigger carries either commands or mentions, not both.`);t.mentionTriggers.add(n),(0,L.isValidElement)(r)&&t.mentionCandidates.push(m1(r.props,n));continue}throw Error(`<Composer.Trigger trigger="${n}"> accepts only <Composer.Command> and <Composer.Mention> children; wrap them in a fragment rather than a component, which the registry cannot see through.`)}}function m1(e,t){return{id:e.id,trigger:t,value:e.value,label:e.label,detail:e.detail,atomic:!0,icon:e.icon,payload:e.payload,persistsAs:e.persistsAs,visibility:e.visibility}}function h1(e,t){return typeof e==`function`&&`role`in e&&e.role===t}function g1(e,t,n,r){return[...DQ(e.query,t.filter(t=>t.trigger===e.trigger),r),..._1(e.query,n.filter(t=>t.trigger===e.trigger),r)]}function _1(e,t,n){let r=e.slice(1).toLowerCase();return t.filter(e=>EQ(e.visibility,n)&&(e.label.toLowerCase().includes(r)||RQ(e).slice(1).toLowerCase().includes(r))).slice(0,10)}var v1=(0,L.createContext)(null);function y1(e){let t=e===void 0?`useComposerDictation`:e;gQ(t);let n=(0,L.use)(v1);if(!n)throw Error(`${t} needs the dictation prop of Composer.Root.`);return n}function b1(e,t){return typeof e==`function`?n=>e(n,t):e}function x1(e){let t=(0,U.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({render:i,disabled:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{disabled:a}=gQ(`Composer.Dictate`),{state:o,start:s,stop:c}=y1(`Composer.Dictate`),l=o.status===`recording`,u=(o.status===`idle`||o.status===`failed`)&&n!==!0&&!a,d=o.status,f=o.status===`finishing`?o.end:void 0,p=!l&&!u,m=l?c:s,h;t[4]!==i||t[5]!==o?(h=b1(i,o),t[4]=i,t[5]=o,t[6]=h):h=t[6];let g;return t[7]!==r||t[8]!==l||t[9]!==o.status||t[10]!==f||t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,R.jsx)(St,{...r,"data-status":d,"data-end":f,"aria-pressed":l,disabled:p,onClick:m,render:h}),t[7]=r,t[8]=l,t[9]=o.status,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function S1(e){let t=(0,U.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({render:i,disabled:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{state:a,cancel:o}=y1(`Composer.CancelDictation`),s=a.status===`starting`||a.status===`recording`||a.status===`finishing`,c=a.status,l=!s||n===!0,u;t[4]!==i||t[5]!==a?(u=b1(i,a),t[4]=i,t[5]=a,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==r||t[9]!==a.status||t[10]!==l||t[11]!==u?(d=(0,R.jsx)(St,{...r,"data-status":c,disabled:l,onClick:o,render:u}),t[7]=o,t[8]=r,t[9]=a.status,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var C1=class extends Error{code;constructor(e,t){super(`Dictation failed: ${e}`,t),this.name=`DictationError`,this.code=e}},w1=class{#e=`unknown`;subscribe=e=>{let t=new AbortController;return navigator.permissions.query({name:`microphone`}).then(n=>{if(t.signal.aborted)return;let r=()=>{this.#e=n.state,e()};r(),n.addEventListener(`change`,r,{signal:t.signal})},e=>{if(!(e instanceof TypeError))throw e}),()=>{t.abort()}};getSnapshot=()=>this.#e},T1=new Map([[`NotAllowedError`,`permission-denied`],[`NotFoundError`,`no-microphone`],[`NotReadableError`,`microphone-in-use`]]),E1=class e{#e={status:`starting`};#t=new Set;#n;constructor(e){this.#n=e}static start(t){let n=new e(t);return n.#r(),n}subscribe=e=>(this.#t.add(e),()=>{this.#t.delete(e)});getSnapshot=()=>this.#e;stop(){let e=this.#e;if(e.status===`starting`){this.cancel();return}e.status===`recording`&&(this.#a({...e,status:`stopping`}),e.recorder.stop())}cancel(){this.#i({status:`ended`})}async#r(){let e;try{e=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e instanceof DOMException?T1.get(e.name):void 0;if(!t)throw e;this.#i({status:`failed`,error:new C1(t,{cause:e})});return}if(this.#e.status!==`starting`){for(let t of e.getTracks())t.stop();return}let t=new MediaRecorder(e),n=[];t.addEventListener(`dataavailable`,e=>{n.push(e.data)}),t.addEventListener(`stop`,()=>{this.#e.status===`stopping`&&(this.#i({status:`ended`}),this.#n(new Blob(n,{type:t.mimeType})))}),t.addEventListener(`error`,e=>{this.#i({status:`failed`,error:new C1(`interrupted`,{cause:e})})});for(let t of e.getAudioTracks())t.addEventListener(`ended`,()=>{this.#i({status:`failed`,error:new C1(`interrupted`)})});t.start(),this.#a({status:`recording`,stream:e,recorder:t})}#i(e){let t=this.#e;if(!(t.status===`ended`||t.status===`failed`)){if(t.status!==`starting`){t.recorder.state!==`inactive`&&t.recorder.stop();for(let e of t.stream.getTracks())e.stop()}this.#a(e)}}#a(e){this.#e=e;for(let e of this.#t)e()}},D1=()=>()=>void 0,O1={status:`ended`},k1=()=>O1,A1=()=>`unknown`;function j1(e){let t=(0,U.c)(47),{dictation:n,disabled:r,insertTranscript:i,submitDraft:a}=e,o=`MediaRecorder`in globalThis&&`mediaDevices`in navigator,s=n!==void 0,[c]=(0,L.useState)(M1),l=(0,L.useSyncExternalStore)(s&&o?c.subscribe:D1,c.getSnapshot,A1),[u,d]=(0,L.useState)(null),f=(0,L.useSyncExternalStore)(u?u.subscribe:D1,u?u.getSnapshot:k1,k1),[p,m]=(0,L.useState)(0),[h,g]=(0,L.useState)(`insert`),_=(0,L.useRef)(`insert`),v=(0,L.useRef)(null),y;t[0]!==n||t[1]!==i||t[2]!==a?(y={dictation:n,insertTranscript:i,submitDraft:a},t[0]=n,t[1]=i,t[2]=a,t[3]=y):y=t[3];let b=(0,L.useRef)(y),x;t[4]!==n||t[5]!==i||t[6]!==a?(x=()=>{b.current={dictation:n,insertTranscript:i,submitDraft:a}},t[4]=n,t[5]=i,t[6]=a,t[7]=x):x=t[7],(0,L.useEffect)(x);let S,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=async(e,t)=>{let n=new AbortController;v.current=n;try{let{text:e}=await t.transcribe(t.clip,{signal:n.signal});if(!n.signal.aborted){let t=e.trim();t&&b.current.insertTranscript(t),_.current===`send`&&b.current.submitDraft()}return{attempt:t.attempt,failure:null}}catch(e){let r=e;return n.signal.aborted?{attempt:t.attempt,failure:null}:{attempt:t.attempt,failure:new C1(`transcription-failed`,{cause:r})}}},C={attempt:0,failure:null},t[8]=S,t[9]=C):(S=t[8],C=t[9]);let[w,T,ee]=(0,L.useActionState)(S,C),E,te;t[10]!==r||t[11]!==s||t[12]!==u?(E=()=>{(r||!s)&&(u?.cancel(),v.current?.abort())},te=[r,s,u],t[10]=r,t[11]=s,t[12]=u,t[13]=E,t[14]=te):(E=t[13],te=t[14]),(0,L.useEffect)(E,te);let ne,re;if(t[15]===u?(ne=t[16],re=t[17]):(ne=()=>()=>{u?.cancel(),v.current?.abort()},re=[u],t[15]=u,t[16]=ne,t[17]=re),(0,L.useEffect)(ne,re),!n)return null;let ie,D;if(t[18]!==p||t[19]!==h||t[20]!==w||t[21]!==l||t[22]!==f||t[23]!==ee){D=e(),ie=D.status===`starting`||D.status===`recording`||D.status===`finishing`;function e(){if(!o)return{status:`unavailable`,reason:`unsupported`};switch(f.status){case`starting`:return{status:`starting`};case`recording`:return{status:`recording`};case`stopping`:return{status:`finishing`,end:h};case`ended`:case`failed`:}return ee?{status:`finishing`,end:h}:l===`denied`?{status:`unavailable`,reason:`blocked`}:f.status===`failed`?{status:`failed`,error:f.error}:w.failure&&w.attempt===p?{status:`failed`,error:w.failure}:{status:`idle`}}t[18]=p,t[19]=h,t[20]=w,t[21]=l,t[22]=f,t[23]=ee,t[24]=ie,t[25]=D}else ie=t[24],D=t[25];let O;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){_.current=e,g(e)},t[26]=O):O=t[26];let k=O,A;t[27]!==ie||t[28]!==p||t[29]!==r||t[30]!==D?(A=function(){if(r||ie||D.status===`unavailable`)return;let e=p+1;m(e),k(`insert`),d(E1.start(t=>{let n=b.current.dictation;n&&(0,L.startTransition)(()=>{T({clip:t,attempt:e,transcribe:n.transcribe})})}))},t[27]=ie,t[28]=p,t[29]=r,t[30]=D,t[31]=A):A=t[31];let ae=A,oe;t[32]===u?oe=t[33]:(oe=function(){u?.stop()},t[32]=u,t[33]=oe);let se=oe,j;t[34]===u?j=t[35]:(j=function(){u?.cancel(),v.current?.abort()},t[34]=u,t[35]=j);let ce=j,M;t[36]!==u||t[37]!==D?(M=function(){switch(D.status){case`starting`:return u?.cancel(),!1;case`recording`:return k(`send`),u?.stop(),!0;case`finishing`:return k(`send`),!0;default:return!1}},t[36]=u,t[37]=D,t[38]=M):M=t[38];let le=M,N;t[39]!==ce||t[40]!==ae||t[41]!==D||t[42]!==se?(N={state:D,start:ae,stop:se,cancel:ce},t[39]=ce,t[40]=ae,t[41]=D,t[42]=se,t[43]=N):N=t[43];let ue;return t[44]!==le||t[45]!==N?(ue={api:N,endWithSend:le},t[44]=le,t[45]=N,t[46]=ue):ue=t[46],ue}function M1(){return new w1}function N1(e){return[mQ.configure({link:!1}),hY.configure({autolink:!0,linkOnPaste:!1,openOnClick:!1,HTMLAttributes:{"data-token":`link`}}),I1,L1,R1,z1(e)]}var P1=1e3;function F1(e,t){return{default:t,parseHTML:n=>n.getAttribute(e)??t}}var I1=dU.create({name:`composerSlashCommand`,inclusive:!1,addAttributes(){return{value:{default:null},detail:{default:null}}},parseHTML(){return[{tag:`span[data-composer-slash-command]`}]},renderHTML({HTMLAttributes:e}){return[`span`,gV(e,{"data-token":`slash-command`,"data-composer-slash-command":e.value}),0]}}),L1=BU.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:F1(`id`,null),trigger:F1(`trigger`,``),value:F1(`value`,``),label:F1(`label`,``),detail:F1(`detail`,``),persistsAs:F1(`persistsAs`,null),payload:{default:null,renderHTML:e=>e.payload===null||e.payload===void 0?{}:{payload:JSON.stringify(e.payload)},parseHTML:e=>{let t=e.getAttribute(`payload`);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.label||`${e.attrs.trigger??``}${e.attrs.value??``}`;return[`span`,gV(t,{"data-token":`mention`,"data-composer-mention":e.attrs.value,"data-composer-mention-trigger":e.attrs.trigger}),n]},renderText({node:e}){return e.attrs.label||`${e.attrs.trigger??``}${e.attrs.value??``}`}}),R1=BU.create({name:`composerAtom`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{kind:{default:`paste`},label:{default:``},detail:{default:``},content:{default:``},href:{default:``},attachmentId:{default:``,rendered:!1},media:{default:`image`,rendered:!1},metadata:{default:null}}},parseHTML(){return[{tag:`span[data-composer-atom]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.kind??`paste`),r=String(e.attrs.label??``);return[`span`,gV(t,{"data-token":n,"data-composer-atom":n,"data-composer-atom-detail":e.attrs.detail}),r]},renderText({node:e}){return String(e.attrs.label??``)}});function z1(e){return yU.create({name:`composerClipboard`,addProseMirrorPlugins(){return[new sP({props:{handlePaste(t,n){let r=n.clipboardData;if(!r)return!1;let i=Array.from(r.files).find(e=>d$(e)!==null);if(i)return n.preventDefault(),m0(t,e.getRemoteImageCount(),i,e.attachImageFile),!0;let a=Array.from(r.files).find(e=>d$(e)===null);if(a)return n.preventDefault(),h0(t,a.name||`pasted-file`,e.getMentionTrigger()),!0;let o=W0(X0(r.getData(`text/uri-list`))||Z0(r.getData(`DownloadURL`))||r.getData(`text/plain`)||r.getData(`text`)),s=o.trim();if(!o)return!1;let c=s0(t);if(c&&Q0(s)){n.preventDefault();let e=$0(s),r=t.state.schema.marks.link;return r?l0(t,c,e,r):!1}return K0(s)&&!s.includes(`
|
|
3490
|
-
`)?(n.preventDefault(),
|
|
3491
|
-
`)?(n.preventDefault(),
|
|
3492
|
-
`)&&
|
|
3493
|
-
`)?(
|
|
3494
|
-
`)?(
|
|
3495
|
-
`).map(e=>({type:`paragraph`,content:
|
|
3496
|
-
`),
|
|
3497
|
-
`;return}if(e.type===`text`){let r=e.text??``,i=t.text.length;t.text+=r;for(let a of e.marks??[])if(a.type===`link`&&a.attrs?.href&&t.elements.push({id:
|
|
3498
|
-
`,!1):!0}),r.replace(/\n+/g,` `).trim()}function
|
|
3499
|
-
`:e.type.name===`composerMention`||e.type.name===`composerAtom`?
|
|
3500
|
-
`,
|
|
3501
|
-
`,``).length}catch{return 0}}function
|
|
3502
|
-
`)}function G0(e){return Array.from(e).length}function K0(e){return e.startsWith(`file://`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||/^[A-Za-z]:[\\/]/.test(e)}function q0(e){let t=e.trim();if(!t.startsWith(`file://`))return t;try{return decodeURI(new URL(t).pathname)}catch{return t}}function J0(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop();return t?decodeURIComponent(t):e}function Y0(e){return/[\\/]$/.test(e)}function X0(e){return e.split(/\r?\n/).map(e=>e.trim()).find(e=>e&&!e.startsWith(`#`))??``}function Z0(e){let t=X0(e);return t?t.match(/^[\w.+-]+\/[\w.+-]+:[^:\n]+:(.+)$/)?.[1]?.trim()??t:``}function Q0(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function $0(e){return C$(e.trim())}function e2(e,t){return(e%t+t)%t}function t2(e,t,n){return`${e}:${n}:${t}`}function n2(e){let t=(0,U.c)(3),n=e.draftKey??``,r;return t[0]!==e||t[1]!==n?(r=(0,R.jsx)(i2,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function r2(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function i2({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,dictation:u,validateSubmission:d,onSubmit:f,onStateChange:p}){let m=ae(),h=u1(l),g=(0,L.useRef)({signature:d1(h),slashCommands:h.slashCommands,mentionCandidates:h.mentionCandidates,commandTriggers:h.commandTriggers,mentionTriggers:h.mentionTriggers}),_=d1(h);_!==g.current.signature&&(g.current={signature:_,slashCommands:h.slashCommands,mentionCandidates:h.mentionCandidates,commandTriggers:h.commandTriggers,mentionTriggers:h.mentionTriggers});let{slashCommands:v,mentionCandidates:y,commandTriggers:b,mentionTriggers:x}=g.current,S=(0,L.useMemo)(()=>({commandTriggers:b,mentionTriggers:x}),[b,x]),C=(0,L.useRef)(x);C.current=x;let[w]=(0,L.useState)(()=>{if(e)return e;if(t===void 0)return;let n=$$(t);return n?x$({source:n,slashCommands:v,mentionCandidates:y}):void 0}),T=(0,L.useRef)(w?.remoteImages??[]),ee=(0,L.useRef)(V1({state:w,slashCommands:v,mentionCandidates:y,triggers:S})),E=(0,L.useRef)(0),te=(0,L.useRef)(!0);(0,L.useEffect)(()=>(te.current=!0,()=>{te.current=!1}),[]);let[ne,re]=(0,L.useState)(T.current),[ie,D]=(0,L.useState)(null),[O,k]=(0,L.useState)(()=>K1(ee.current,T.current,v,r,i,0)),A=(0,L.useRef)(O),oe=(0,L.useRef)(ne),se=(0,L.useRef)(ie),ce=(0,L.useRef)(null),M=(0,L.useRef)(null),le=(0,L.useRef)(void 0),N=(0,L.useRef)(null),ue=(0,L.useRef)(null),de=(0,L.useRef)(null),fe=(0,L.useRef)(p),pe=(0,L.useRef)(d),me=(0,L.useRef)(f),he=(0,L.useRef)(new Map),ge=(0,L.useRef)(()=>null),_e=(0,L.useRef)(()=>void 0),ve=(0,L.useRef)(()=>void 0),ye=(0,L.useRef)(()=>!1),P=QW({extensions:(0,L.useMemo)(()=>N1({getMentionTrigger:()=>C.current[0]??`@`,getRemoteImageCount:()=>oe.current.length,attachImageFile:e=>ge.current(e)}),[]),content:ee.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 ye.current(t)}},immediatelyRender:!1,onUpdate({editor:e}){_e.current(e),ve.current(e)},onSelectionUpdate({editor:e}){_e.current(e),ve.current(e)}}),be=(0,L.useMemo)(()=>ie?g1(ie,v,y,a):[],[ie,a,y,v]),xe=(0,L.useMemo)(()=>VQ(O,v,b),[b,O,v]);(0,L.useEffect)(()=>{A.current=O},[O]),(0,L.useEffect)(()=>{oe.current=ne},[ne]),(0,L.useEffect)(()=>{se.current=ie},[ie]),(0,L.useEffect)(()=>{O.shortcutsOpen&&(ie||O.reverseSearch!==null||!BQ(O))&&k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:e)},[ie,O]),(0,L.useEffect)(()=>{fe.current=p},[p]),(0,L.useEffect)(()=>{pe.current=d},[d]),(0,L.useEffect)(()=>{me.current=f},[f]),(0,L.useEffect)(()=>{P&&(P.setEditable(!n),P.view.dom.setAttribute(`aria-disabled`,n?`true`:`false`),n&&D(null))},[n,P]),(0,L.useEffect)(()=>{P?.view.dom.setAttribute(`aria-label`,s)},[P,s]),(0,L.useEffect)(()=>{fe.current?.(O,xe),t!==void 0&&(xe?e1(t,v$(O,xe.persistedPrompt)):E.current===0&&e1(t,null))},[O,t,xe]),(0,L.useEffect)(()=>{k(e=>e.isTaskRunning===r&&e.queueSubmissions===i?e:{...e,isTaskRunning:r,queueSubmissions:i})},[r,i]),_e.current=e=>{if(n)return;let t=K1(e.getJSON(),oe.current,v,r,i,L0(e)),a=M.current,o=le.current;M.current=null,le.current=void 0,k(e=>{let n=o===void 0?N.current:o;N.current=n;let r=e.shortcutsOpen&&BQ(t);return{...t,error:e.error,history:e.history,historyCursor:n,killBuffer:e.killBuffer,reverseSearch:e.reverseSearch,shortcutsOpen:r,selectedRemoteImageId:a}})},ve.current=e=>{if(n){D(null);return}let t=i0(e,S);if(!t){D(null);return}if(b.includes(t.trigger)){let e={trigger:t.trigger,query:t.query,selectedIndex:0},n=g1(e,v,y,a);D(t=>n.length===0?null:{...e,selectedIndex:t?.trigger===e.trigger?Math.min(t.selectedIndex,n.length-1):0});return}D(e=>{let n=t.trigger,r={trigger:n,query:t.query,selectedIndex:e?.trigger===n?e.selectedIndex:0},i=g1(r,v,y,a);return{...r,selectedIndex:e?.trigger===n?Math.min(e.selectedIndex,Math.max(i.length-1,0)):0}})};function Se(e){P?.commands.setContent(e),P&&(_e.current(P),ve.current(P))}function Ce(e){if(n||!P)return;let t=i0(P,S),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?P.chain().focus().deleteRange({from:t.from,to:t.to}).insertContent(r).run():P.chain().focus().insertContent(r).run(),D(null)}function we({index:e=se.current?.selectedIndex??0}={}){let t=se.current;if(n||!P||!t)return;let r=g1(t,v,y,a),i=r[e]??r[0];if(!i)return;if(!i.atomic){Ce(i);return}let o=i0(P,S),s=o?.trigger===t.trigger,c=P.chain().focus();s&&o&&c.deleteRange({from:o.from,to:o.to}),c.insertContent([e0(i),{type:`text`,text:` `}]).run(),D(null)}function Te(){if(n||!P)return;P.commands.focus();let e=b[0];e&&D(t=>t?.trigger===e?null:{trigger:e,query:``,selectedIndex:0})}function Ee(e){return BQ(e)&&e.reverseSearch===null&&se.current===null}function De(){n||k(e=>Ee(e)&&!e.shortcutsOpen?{...e,shortcutsOpen:!0,selectedRemoteImageId:null,error:null}:e)}function F(){k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:e)}function Oe(){n||k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:Ee(e)?{...e,shortcutsOpen:!0,selectedRemoteImageId:null,error:null}:e)}function ke(e){n||!P||!e||P.chain().focus().insertContent(e).run()}function Ae(e){if(d$(e)===null)return k(t=>({...t,error:`Only image, video, or audio files can be attached: ${e.name||`unnamed file`}`,shortcutsOpen:!1})),D(null),null;let t=crypto.randomUUID();return he.current.set(t,e),t}function je(e,t){let n=Ae(t);if(n===null)return;let r=Ue(),i=r.remoteImages.length+r.imageAttachments.length+1,a=d$(t)??`image`;e.chain().focus().insertContent([r0(n,p$(a,i),a),{type:`text`,text:` `}]).run()}function Me(e){if(!(n||!P))for(let t of e)je(P,t)}function Ne(e){n||!P||(he.current.delete(e),Se(g0(v0(P.getJSON(),e),oe.current.length)))}function Pe(e){if(n||!P)return;let t=[...oe.current,{id:t2(`remote-image`,e,m.Date.now()),url:e}];oe.current=t,re(t),Se(g0(P.getJSON(),t.length))}function Fe(e){return n||!P?!1:B1(P.view,e,oe.current.length,x[0]??`@`,Ae)}function Ie(e){if(n)return;let t=oe.current[e]??A.current.remoteImages[e];t&&(M.current=t.id,k(e=>({...e,selectedRemoteImageId:t.id,shortcutsOpen:!1})))}function Le(){n||(M.current=null,k(e=>e.selectedRemoteImageId?{...e,selectedRemoteImageId:null,shortcutsOpen:!1}:e))}function Re(e){return A.current.selectedRemoteImageId?e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`Escape`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`?(Le(),D(null),!0):e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey?(Le(),!0):!1:!1}function ze(e){if(n)return e.preventDefault(),!0;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`)return e.preventDefault(),Le(),D(null),P?.commands.selectAll(),!0;let t=Ue(),r=A.current.selectedRemoteImageId;if(!se.current&&e.key===`ArrowUp`){let n=h$({...t,selectedRemoteImageId:r},r);if(n!==null)return e.preventDefault(),Ie(Math.max(0,n-1)),!0;if((P&&R0(P)||t.cursor===0)&&t.remoteImages.length>0)return e.preventDefault(),Ie(t.remoteImages.length-1),!0}if(!se.current&&r&&e.key===`ArrowDown`){e.preventDefault();let n=h$({...t,selectedRemoteImageId:r},r);return n!==null&&n+1<t.remoteImages.length?Ie(n+1):Le(),!0}return!se.current&&r&&(e.key===`Backspace`||e.key===`Delete`)?(e.preventDefault(),Be(r),!0):(Re(e),!1)}function Be(e){if(n||!P)return;let t=Ue(),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;M.current=a?.id??null,oe.current=i,re(i),Se(g0(P.getJSON(),i.length)),k(e=>({...e,remoteImages:i,selectedRemoteImageId:a?.id??null,shortcutsOpen:!1}))}function Ve(e){if(n||!P)return;let t=b0(P.getJSON(),G0(e));P.chain().focus().insertContent(n0({kind:`paste`,label:t,detail:`${G0(e)} chars`,content:e})).run()}function He(e,t=e,r){n||P?.chain().focus().insertContent(n0({kind:`rich-link`,label:t,detail:e,href:e,metadata:r})).run()}function Ue(){return P?{...K1(P.getJSON(),oe.current,v,r,i,L0(P)),error:A.current.error,history:A.current.history,historyCursor:N.current??A.current.historyCursor,killBuffer:A.current.killBuffer,reverseSearch:A.current.reverseSearch,shortcutsOpen:A.current.shortcutsOpen,selectedRemoteImageId:A.current.selectedRemoteImageId}:A.current}function We(e){let t=pe.current?.(e);return t?(k(e=>({...e,error:t,shortcutsOpen:!1})),D(null),!0):!1}function Ge(e){let t=Ue(),n=t.text.slice(0,t.cursor);ke(n&&!/\s$/.test(n)?` ${e}`:e)}function Ke(){I?.endWithSend()||qe()}function qe(){if(n)return;let e=Ue(),r=P?.getJSON()??Z1(),i=e.isTaskRunning||e.queueSubmissions,a=i?null:qQ(e.text,v,b);if(a){k(e=>({...e,error:`Unrecognized command: /${a}`,shortcutsOpen:!1})),D(null);return}let s=VQ(e,v,b),c=s??{mode:`submitted`,prompt:``,persistedPrompt:``,historyPrompt:``,action:`Plain`,command:void 0,args:void 0,items:[],elements:[],payloadElements:[],mentionBindings:[]},l=HQ(c,o);if(l){k(e=>({...e,error:l,shortcutsOpen:!1})),D(null);return}let u=new Map,d=[];for(let t of e.imageAttachments){let e=he.current.get(t.id);if(!e){k(e=>({...e,error:`Attached image is no longer available: ${t.placeholder}`,shortcutsOpen:!1})),D(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(m.Date.now()).toLocaleTimeString(),mode:i?`queued`:c.mode,prompt:c.prompt,persistedPrompt:c.persistedPrompt,action:i?z0(c,b):c.action,command:c.command,args:c.args,items:f};if(We(p))return;for(let e of u.keys())he.current.delete(e);let h=v$(e,c.persistedPrompt),g=me.current?.(p,{editableSource:h});r2(g)&&(E.current+=1,g.then(()=>{t!==void 0&&e1(t,null)}).catch(e=>{for(let[e,t]of u)he.current.set(e,t);t!==void 0&&e1(t,h),te.current&&(Se(r),P?.commands.focus(`end`),k(t=>({...t,error:e instanceof Error?e.message:`Could not send prompt`})))}).finally(()=>{--E.current}));let _=s?y$(e,c.historyPrompt):e.history;N.current=null,oe.current=[],re([]),D(null),Se(Z1()),k(e=>({...e,text:``,cursor:0,elements:[],mentionBindings:[],imageAttachments:[],remoteImages:[],pendingPastes:[],selectedRemoteImageId:null,error:null,shortcutsOpen:!1,history:_,historyCursor:null}))}function Je(){if(n)return;let e=A.current.history,t=A.current.killBuffer;N.current=null,de.current=null,he.current.clear(),oe.current=T.current,re(T.current),D(null),Se(ee.current),P?.commands.focus(`end`),k(n=>({...n,history:e,historyCursor:null,killBuffer:t,reverseSearch:null,selectedRemoteImageId:null,error:null,shortcutsOpen:!1}))}function Ye(e){if(n||!P||A.current.history.length===0)return;let t=A.current,r=N.current??t.historyCursor;if(e>0&&r===0&&ue.current){Ze(ue.current,null),ue.current=null;return}let i=r===null?e<0?0:t.history.length-1:e2(r+e,t.history.length);r===null&&(ue.current=_$(Ue()));let a=t.history[i];Xe(a,i)}function Xe(e,t){Ze(x$({source:e,slashCommands:v,mentionCandidates:y}),t)}function Ze(e,t){let n=e.remoteImages??[];oe.current=n,A.current={...A.current,historyCursor:t,shortcutsOpen:!1},N.current=t,le.current=t,re(n),Se(V1({state:e,slashCommands:v,mentionCandidates:y,triggers:S})),P?.commands.focus(`end`),k(e=>({...e,historyCursor:t,shortcutsOpen:!1}))}function Qe(){n||(D(null),N.current=null,de.current=Ue(),k(e=>({...e,reverseSearch:``,historyCursor:null,shortcutsOpen:!1})))}function $e(e){if(n){e.preventDefault();return}if(e.preventDefault(),e.key===`Escape`){rt(null),de.current=null;return}if(e.key===`Enter`){de.current=null,k(e=>({...e,reverseSearch:null,shortcutsOpen:!1}));return}if(e.key===`Backspace`){et(e=>e.slice(0,-1));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`r`){tt(1);return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){tt(-1);return}e.key.length===1&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&et(t=>`${t}${e.key}`)}function et(e){if(n)return;let t=A.current,r=e(t.reverseSearch??``),i=F$(t.history,r,null);if(!P||!i){rt(r);return}nt(i.entry,i.index,r)}function tt(e){if(n||!P)return;let t=A.current,r=t.reverseSearch??``,i=F$(t.history,r,t.historyCursor,e);i&&nt(i.entry,i.index,r)}function nt(e,t,n){let r=P;if(!r)return;let i=x$({source:e,slashCommands:v,mentionCandidates:y}),a=i.remoteImages??[];oe.current=a,re(a),Se(V1({state:i,slashCommands:v,mentionCandidates:y,triggers:S})),r.commands.focus(`end`),k(e=>({...e,historyCursor:t,reverseSearch:n,selectedRemoteImageId:null,shortcutsOpen:!1}))}function rt(e){if(n)return;let t=de.current;if(!t||!P){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};N.current=null,oe.current=r.remoteImages,re(r.remoteImages),Se(V1({state:r,slashCommands:v,mentionCandidates:y,triggers:S})),P.commands.focus(`end`),k(r)}ye.current=n?e=>(e.preventDefault(),!0):ze,ge.current=Ae;function it(e){if(!(e.target instanceof Element)||!e.target.closest(`[data-slot="composer-editor"]`))return;if(n){e.preventDefault();return}if(!P||ze(e))return;if(A.current.reverseSearch!==null){$e(e);return}if(A.current.shortcutsOpen&&e.key===`Escape`){e.preventDefault(),F();return}if(e.key===`?`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&Ee(Ue())){e.preventDefault(),Oe();return}if(D2(e)){e.preventDefault(),P.chain().focus().setHardBreak().run(),N.current=null,D(null);return}if(se.current){if(B0(e)||V0(e)){e.preventDefault(),ot(B0(e)?-1:1);return}if(e.key===`Tab`){e.preventDefault(),we();return}if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),be.length===0){D(null),Ke();return}we();return}if(e.key===`Escape`){e.preventDefault(),D(null);return}}if(O2(e)){let t=T0(P);t&&(e.preventDefault(),ce.current=t,k(e=>({...e,killBuffer:t.text}))),N.current=null;return}let t=k2(e);if(t!==null){e.preventDefault(),D0(P,t),N.current=null;return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`e`){e.preventDefault(),E0(P),N.current=null;return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){let t=C0(P);t&&(e.preventDefault(),ce.current=t,k(e=>({...e,killBuffer:t.text})));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`u`){let t=w0(P);t&&(e.preventDefault(),ce.current=t,k(e=>({...e,killBuffer:t.text})));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`y`&&A.current.killBuffer){e.preventDefault(),P0(P,ce.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`)&&j2(P)){e.preventDefault(),N.current=null,D(null);return}if((e.key===`Backspace`||e.key===`Delete`)&&F0(P,e.key)){e.preventDefault(),N.current=null;return}if((e.key===`Backspace`||e.key===`Delete`||e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey)&&(N.current=null),e.key===`Enter`&&!e.shiftKey&&!e.altKey){e.preventDefault(),Ke();return}let r=A2(e);if(r!==null&&!se.current){let t=Ue();if(e.key===`ArrowUp`&&(R0(P)||t.cursor===0)&&t.remoteImages.length>0){e.preventDefault(),Ie(t.remoteImages.length-1);return}I$(t.text,t.cursor,r)&&(e.preventDefault(),Ye(r))}}function at(e){if(n){e.preventDefault();return}e.target instanceof Element&&e.target.closest(`[data-slot="composer-editor"]`)&&Le()}function ot(e){n||D(t=>{if(!t)return t;let n=g1(t,v,y,a).length;return n===0?t:{...t,selectedIndex:e2(t.selectedIndex+e,n)}})}let I=j1({dictation:u,disabled:n,insertTranscript:Ge,submitDraft:qe});return(0,R.jsx)(hQ,{value:{state:O,disabled:n,commandTriggers:b,activePopup:ie,suggestions:be,attachedImages:he.current,actions:{acceptSuggestion:we,toggleSlashMenu:Te,insertText:ke,attachImageFiles:Me,removeImageAttachment:Ne,addRemoteImage:Pe,handleDrop:Fe,insertPaste:Ve,insertRichLink:He,openShortcuts:De,closeShortcuts:F,toggleShortcuts:Oe,submit:Ke,reset:Je},meta:{editor:P}},children:(0,R.jsx)(v1,{value:I?.api??null,children:(0,R.jsx)(`section`,{"data-slot":`composer`,className:j(`border-border bg-card relative border font-[inherit]`,c),children:(0,R.jsxs)(`div`,{onKeyDownCapture:it,onMouseDownCapture:at,children:[l,h.hasLayoutChildren?null:(0,R.jsx)(a2,{})]})})})})}function a2(){let e=(0,U.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(d2,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,R.jsxs)(R.Fragment,{children:[t,(0,R.jsxs)(o2,{children:[(0,R.jsx)(c2,{}),(0,R.jsx)(vQ,{}),(0,R.jsx)(l2,{}),(0,R.jsx)(u2,{})]}),(0,R.jsx)(h2,{}),(0,R.jsx)(v2,{})]}),e[1]=n):n=e[1],n}function o2(e){let t=(0,U.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=j(`space-y-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function s2(e){let t=(0,U.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=j(`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,R.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function c2(e){let t=(0,U.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}=gQ(`Composer.RemoteImages`);if(i.remoteImages.length===0)return null;let a;t[3]===n?a=t[4]:(a=j(`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,R.jsxs)(`div`,{className:j(`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,R.jsxs)(`span`,{className:`shrink-0`,children:[`[Image #`,t+1,`]`]}),(0,R.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,R.jsx)(`div`,{className:a,...r,children:o}),t[10]=r,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function l2(e){let t=(0,U.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}=gQ(`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,R.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,R.jsx)(GW,{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,R.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 u2(e){let t=(0,U.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}=gQ(`Composer.Error`);if(!i.error)return null;let a;t[3]===n?a=t[4]:(a=j(`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,R.jsx)(`div`,{role:`alert`,className:a,...r,children:i.error}),t[5]=r,t[6]=i.error,t[7]=a,t[8]=o):o=t[8],o}function d2(e){let t=(0,U.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}=gQ(`Composer.Popup`),{acceptSuggestion:s}=o;if(!i)return null;let c;t[3]===a?c=t[4]:(c=a.some(f2),t[3]=a,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=j(`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,R.jsx)(p2,{selected:t===i.selectedIndex,icon:l?e.icon:null,token:RQ(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,R.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,R.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,R.jsx)(`div`,{className:u,...r,children:p}),t[21]=r,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function f2(e){return e.icon}function p2(e){let t=(0,U.c)(23),{selected:n,icon:r,token:i,takesArgs:a,description:o,onMouseDown:s}=e,c=(0,L.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,L.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=j(`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,R.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,R.jsx)(`span`,{className:`truncate`,children:i}),t[9]=i,t[10]=h);let g;t[11]===a?g=t[12]:(g=a?(0,R.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`args`}):null,t[11]=a,t[12]=g);let _;t[13]===o?_=t[14]:(_=(0,R.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,R.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 m2=[{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 h2(e){let t=(0,U.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}=gQ(`Composer.Shortcuts`),{closeShortcuts:o}=a;if(!i.shortcutsOpen||!BQ(i))return null;let s;t[3]===n?s=t[4]:(s=j(`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,R.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,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[c,(0,R.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,R.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:m2.map(g2)}),t[8]=u):u=t[8];let d;return t[9]!==r||t[10]!==s||t[11]!==l?(d=(0,R.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 g2(e){return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-muted-foreground text-[11px]`,children:e.title}),(0,R.jsx)(`div`,{className:`space-y-1`,children:e.items.map(_2)})]},e.title)}function _2(e){let[t,n]=e;return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:t}),(0,R.jsx)(`span`,{className:`text-muted-foreground text-right`,children:n})]},`${t}-${n}`)}function v2(e){let t=(0,U.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}=gQ(`Composer.Footer`);if(a.reverseSearch!==null){let e;t[3]===n?e=t[4]:(e=j(`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,R.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:`Ctrl R`}),o=(0,R.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,R.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,R.jsx)(`span`,{children:`Ctrl R previous`}),u=(0,R.jsx)(`span`,{children:`Ctrl S next`}),d=(0,R.jsx)(`span`,{children:`Enter accept`}),f=(0,R.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,R.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=j(`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(y2),t[24]=c,t[25]=u);let d;return t[26]!==r||t[27]!==l||t[28]!==u?(d=(0,R.jsx)(`div`,{className:l,...r,children:u}),t[26]=r,t[27]=l,t[28]=u,t[29]=d):d=t[29],d}function y2(e){let[t,n]=e;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,R.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 b2(e){let t=(0,U.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}=gQ(`Composer.AttachFiles`),u=(0,L.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,R.jsx)(E2,{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,R.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,R.jsxs)(R.Fragment,{children:[f,h]}),t[16]=f,t[17]=h,t[18]=g):g=t[18],g}function x2(e){let t=(0,U.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}=gQ(`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,R.jsx)(E2,{action:a,...n}),t[6]=n,t[7]=a,t[8]=o):o=t[8],o}function S2(e){let t=(0,U.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}=gQ(`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,R.jsx)(E2,{action:a,...r}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function C2(e){let t=(0,U.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}=gQ(`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,R.jsx)(E2,{action:s,...a}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function w2(e){let t=(0,U.c)(3),{actions:n}=gQ(`Composer.Submit`),r;return t[0]!==n.submit||t[1]!==e?(r=(0,R.jsx)(E2,{action:n.submit,...e}),t[0]=n.submit,t[1]=e,t[2]=r):r=t[2],r}function T2(e){let t=(0,U.c)(3),{actions:n}=gQ(`Composer.Reset`),r;return t[0]!==n.reset||t[1]!==e?(r=(0,R.jsx)(E2,{action:n.reset,...e}),t[0]=n.reset,t[1]=e,t[2]=r):r=t[2],r}function E2(e){let t=(0,U.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}=gQ(`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,R.jsx)(St,{...a,disabled:s,onClick:c}),t[8]=a,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function D2(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 k2(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 A2(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 j2(e){let{doc:t,selection:n}=e.state;return n.empty||n.from>1||n.to<t.content.size-1?!1:(e.commands.setContent(Z1(),{emitUpdate:!0}),e.commands.focus(`start`),e.commands.setTextSelection(1),!0)}var M2={Root:n2,Trigger:s1,Command:c1,Mention:l1,Content:o2,Toolbar:s2,RemoteImages:c2,Attachments:vQ,Editor:l2,Error:u2,Popup:d2,Shortcuts:h2,Footer:v2,AttachFiles:b2,AddRemoteImage:x2,InsertPaste:S2,InsertRichLink:C2,Dictate:x1,CancelDictation:S1,Submit:w2,Reset:T2};function N2(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 P2(e){let t=(0,U.c)(6),{text:n}=e,r,i;if(t[0]!==n){let e=KA(n);r=L2,i=e.map(F2),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,R.jsx)(`span`,{onCopy:r,children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function F2(e){switch(e.kind){case`text`:return e.value;case`inline-code`:return(0,R.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,R.jsx)(`span`,{"data-persisted-source":e.source,className:`bg-muted my-2 block overflow-x-auto rounded-md px-3 py-2`,children:(0,R.jsx)(`code`,{className:`font-mono text-[0.9em]`,children:e.value})},e.start);case`skill-link`:return(0,R.jsx)(I2,{name:e.name,source:e.source,skillId:e.skillId,title:e.href},e.start);case`standalone-skill`:return(0,R.jsx)(I2,{name:e.name,source:e.source},e.start);case`mention`:return(0,R.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,R.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 I2(e){let t=(0,U.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,R.jsx)(ln,{"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,R.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,R.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 L2(e){let t=N2(e.currentTarget,window.getSelection());t!==null&&(e.clipboardData.setData(`text/plain`,t),e.preventDefault())}function R2(e){if(!e)return{};let t={...e};return delete t.whenNullish,delete t.locale,t}function z2(e,t){return e==null||Number.isNaN(e)?t?.whenNullish??`—`:new Intl.NumberFormat(t?.locale??`en-US`,R2(t)).format(e)}function B2(e,t){return z2(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 V2;(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`})(V2||={});var H2=[9,11,12,V2.space,V2.nonBreakingSpace,V2.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],U2=new Uint8Array(65536);for(let e of H2)U2[e]=1;function W2(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 G2=new Uint8Array(65536);for(let e=0;e<128;e++)G2[e]=+!!W2(e);for(let e=128;e<65536;e++)G2[e]=1;for(let e of H2)G2[e]=0;G2[8232]=0,G2[8233]=0;var K2=G2.slice();for(let e=V2.digit0;e<=V2.digit9;e++)K2[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 q2;(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`})(q2||={});var J2;(function(e){e[e.NoChildren=0]=`NoChildren`,e[e.OneChild=1]=`OneChild`,e[e.StaticChildren=2]=`StaticChildren`,e[e.KeyAfterPropSpread=3]=`KeyAfterPropSpread`})(J2||={});var Y2=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,X2=new Uint8Array(64),Z2=new Uint8Array(128);for(let e=0;e<Y2.length;e++){let t=Y2.charCodeAt(e);X2[e]=t,Z2[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 Q2=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}()})),$2=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=Q2(),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 k||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 te(e,t.ttype,!0):new te(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 te=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TProp=te;function ne(e){return new re(new O([...arguments].slice(1)),i(e))}e.func=ne;var re=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=re;function ie(e,t,n){return new D(e,i(t),!!n)}e.param=ie;var D=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TParam=D;var O=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=O;var k=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=k,e.basicTypes={any:new k(function(e){return!0},`is invalid`),number:new k(function(e){return typeof e==`number`},`is not a number`),object:new k(function(e){return typeof e==`object`&&e},`is not an object`),boolean:new k(function(e){return typeof e==`boolean`},`is not a boolean`),string:new k(function(e){return typeof e==`string`},`is not a string`),symbol:new k(function(e){return typeof e==`symbol`},`is not a symbol`),void:new k(function(e){return e==null},`is not void`),undefined:new k(function(e){return e===void 0},`is not undefined`),null:new k(function(e){return e===null},`is not null`),never:new k(function(e){return!1},`is unexpected`),Date:new k(ae(`[object Date]`),`is not a Date`),RegExp:new k(ae(`[object RegExp]`),`is not a RegExp`)};var A=Object.prototype.toString;function ae(e){return function(t){return typeof t==`object`&&t&&A.call(t)===e}}typeof Buffer<`u`&&(e.basicTypes.Buffer=new k(function(e){return Buffer.isBuffer(e)},`is not a Buffer`));for(var oe=function(t){e.basicTypes[t.name]=new k(function(e){return e instanceof t},`is not a `+t.name)},se=0,j=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];se<j.length;se++){var ce=j[se];oe(ce)}})),e4=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=$2(),r=Q2(),i=$2();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=Q2();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}))()),t4={Transform:e4.union(e4.lit(`jsx`),e4.lit(`typescript`),e4.lit(`flow`),e4.lit(`imports`),e4.lit(`react-hot-loader`),e4.lit(`jest`)),SourceMapOptions:e4.iface([],{compiledFilename:`string`}),Options:e4.iface([],{transforms:e4.array(`Transform`),disableESTransforms:e4.opt(`boolean`),jsxRuntime:e4.opt(e4.union(e4.lit(`classic`),e4.lit(`automatic`),e4.lit(`preserve`))),production:e4.opt(`boolean`),jsxImportSource:e4.opt(`string`),jsxPragma:e4.opt(`string`),jsxFragmentPragma:e4.opt(`string`),keepUnusedImports:e4.opt(`boolean`),preserveDynamicImport:e4.opt(`boolean`),injectCreateRequireForImportRequire:e4.opt(`boolean`),enableLegacyTypeScriptModuleInterop:e4.opt(`boolean`),enableLegacyBabel5ModuleInterop:e4.opt(`boolean`),sourceMapOptions:e4.opt(`SourceMapOptions`),filePath:e4.opt(`string`)})},{Options:n4}=(0,e4.createCheckers)(t4),r4;(function(e){e[e.TSFunctionType=0]=`TSFunctionType`,e[e.TSConstructorType=1]=`TSConstructorType`,e[e.TSAbstractConstructorType=2]=`TSAbstractConstructorType`})(r4||={}),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 i4=`pending-chat-prefill`;function a4(){try{let e=sessionStorage.getItem(i4);return e?JSON.parse(e):null}catch{return sessionStorage.removeItem(i4),null}}function o4(e){sessionStorage.setItem(i4,JSON.stringify(e))}function s4(){sessionStorage.removeItem(i4)}var c4=class{chat;listeners=new Set;_queue=[];_queueEnabled;uploadFile;submissions=new Sp;onResetChat;constructor(e){this.chat=e.chat,this._queueEnabled=e.queueEnabled??!0,this.uploadFile=e.uploadFile,this.onResetChat=e.onResetChat}bind(e){this.chat=e}initialize(e){e&&this.consumePrefill(e)}submit(e){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._queueEnabled){this._queue=[...this._queue,{id:crypto.randomUUID(),...e}],this.notify();return}this.directSubmit(e)}directSubmit(e){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.setMessages([]),this.clearQueue(),this.notify()}setChat(e){this.chat.setMessages(e),this.notify()}stop(){this.chat.stop()}resetChat(e){let t=crypto.randomUUID();e&&o4({prompt:e,targetChatId:t}),this.onResetChat(t)}consumePrefill(e){let t=a4();!t||t.targetChatId!==e||(s4(),this.submit({prompt:t.prompt,persistedPrompt:t.prompt}))}getTriggeringUserMessage(e){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(){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(){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}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});notify(){for(let e of this.listeners)e()}};async function l4(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 u4(e){let t=om({id:e.chatId,messages:e.initialMessages,transport:e.transport,throttle:50,resume:e.resume,onData:e.onData,onFinish:e.onFinish,sendAutomaticallyWhen:d4,onToolCall(n){let{toolCall:r}=n;l4(t,e.registry,r)}});return t}function d4(e){return Yp(e)||Jp(e)}function f4(e){let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(p4,{...e}),t[0]=e,t[1]=n),n}function p4(e){let t=(0,U.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}=cT(n),{hasSubmitted:a}=D4(),o;t[1]===e.className?o=t[2]:(o=j(`@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=j(`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,R.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,R.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 m4(e){let t=(0,U.c)(12),{hasSubmitted:n}=D4(),r;t[0]!==n||t[1]!==e.className?(r=j(n?j(`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=j(a),t[4]=a,t[5]=o);let s;t[6]!==e.children||t[7]!==o?(s=(0,R.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,R.jsx)(nT.div,{layout:!0,className:r,transition:i,children:s}),t[9]=r,t[10]=s,t[11]=c):c=t[11],c}m4.displayName=`AgentHeader.Root`;function h4(e){let t=(0,U.c)(6),{hasSubmitted:n}=D4(),r;t[0]!==n||t[1]!==e.children||t[2]!==e.icon?(r=!n&&(0,R.jsx)(nT.div,{exit:{opacity:0},transition:{duration:.2},children:(0,R.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,R.jsx)(QS,{mode:`sync`,children:r}),t[4]=r,t[5]=i),i}h4.displayName=`AgentHeader.Hero`;function g4(e){let t=(0,U.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,R.jsx)(nT.h2,{layout:`position`,className:`text-muted-foreground text-sm font-medium`,children:e.children}),t[0]=e.children,t[1]=n),n}g4.displayName=`AgentHeader.Title`;function _4(e){let t=(0,U.c)(5),{hasSubmitted:n}=D4(),r;t[0]!==n||t[1]!==e.children?(r=n&&!!e.children&&(0,R.jsx)(nT.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,R.jsx)(QS,{children:r}),t[3]=r,t[4]=i),i}_4.displayName=`AgentHeader.Description`;var v4={Root:m4,Hero:h4,Title:g4,Description:_4},y4=(0,L.createContext)(void 0),b4=(0,L.createContext)(`ready`),x4=(0,L.createContext)(void 0),S4=(0,L.createContext)(null),C4=(0,L.createContext)(void 0);function w4({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=u4({chatId:e,transport:o,registry:i,initialMessages:a,resume:s,onData:c,onFinish:l}),[p,m]=(0,L.useState)(r),h=(0,L.useCallback)(()=>m(e=>!e),[]),g=(0,L.useRef)(u);(0,L.useEffect)(()=>{g.current=u},[u]);let _=(0,L.useCallback)(e=>{g.current(e)},[]),[v]=(0,L.useState)(()=>new c4({chat:f,queueEnabled:d,uploadFile:o.uploadFile.bind(o),onResetChat:_}));v.bind(f);let y=(0,L.useSyncExternalStore)(v.subscribe,()=>v.queue,()=>v.queue);(0,L.useEffect)(()=>{v.initialize(e)},[v,e]),(0,L.useEffect)(()=>{v.processQueue(y)},[v,f.status,y]);let b=(0,L.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,L.useMemo)(()=>({chatId:e,registry:i,debugMode:p,toggleDebugMode:h,...b}),[e,i,p,h,b]),S=(0,L.useMemo)(()=>f,[f.id,f.messages,f.status,f.error]),C=!!n||f.messages.length>0,w=(0,L.useMemo)(()=>({hasSubmitted:C}),[C]);return(0,R.jsx)(S4,{value:v,children:(0,R.jsx)(y4,{value:x,children:(0,R.jsx)(b4,{value:f.status,children:(0,R.jsx)(x4,{value:S,children:(0,R.jsx)(C4,{value:w,children:t})})})})})}function T4(){let e=(0,L.use)(y4);if(e===void 0)throw Error(`useAgent must be used within an AgentProvider`);return e}function E4(){return{status:(0,L.use)(b4)}}function D4(){let e=(0,L.use)(C4);if(e===void 0)throw Error(`useAgentMeta must be used within an AgentProvider`);return e}function O4(){let e=(0,L.use)(x4);if(e===void 0)throw Error(`useAgentMessages must be used within an AgentProvider`);return e}function k4(){let e=(0,L.use)(S4);if(!e)throw Error(`useChatManager must be used within an AgentProvider`);return e}function A4(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 j4(e,t){let n=e.findIndex(e=>e.url===t);return n===-1?null:n+1}function M4(e,t){return t===`streaming`||t===`submitted`?!1:e===`input-streaming`||e===`input-available`}function N4(e,t){return M4(e.state,t)}function P4(e){return Object.entries(e).reduce((e,[t,n])=>(n.static||(e[t]={inputSchema:ye(n.inputSchema,{io:`input`,unrepresentable:`any`}),description:n.description}),e),{})}function F4(e){let t=(0,U.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=j(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,R.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 I4(e){let t=(0,U.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=j(`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,R.jsx)(MT,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}function L4(e){return j(`group hover:bg-muted/30 flex min-h-7 w-full gap-2 rounded-sm py-1 text-left transition-colors`,e)}(0,L.createContext)(null);var R4=(0,L.createContext)(void 0),z4=(0,L.createContext)(void 0);function B4(){let e=(0,L.use)(R4);if(!e)throw Error(`useMessagesContext must be used within <Messages>`);return e}function V4(){let e=(0,L.use)(R4),{status:t}=E4();return e?.status??t}function H4(){let e=(0,L.use)(z4);if(!e)throw Error(`useMessageItem must be used within <Messages.Item>`);return e}function U4(e){let t=(0,U.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,R.jsx)(`sup`,{className:`ml-0.5 inline-block`,children:(0,R.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}function W4(e){let t=(0,U.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({ref:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=j(`border-border bg-background relative min-w-0 gap-0 overflow-visible rounded-md border py-0 text-sm/normal ring-0`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,R.jsx)(Pn,{ref:i,"data-slot":`table-panel`,size:`default`,className:a,...r}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}W4.displayName=`TablePanel.Root`;function G4(e){let t=(0,U.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=j(`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,R.jsx)(Fn,{"data-slot":`table-panel-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function K4(e){let t=(0,U.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=j(`min-w-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`table-panel-heading`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function q4(e){let t=(0,U.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=j(`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,R.jsx)(In,{"data-slot":`table-panel-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function J4(e){let t=(0,U.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=j(`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,R.jsx)(Ln,{"data-slot":`table-panel-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Y4(e){let t=(0,U.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=j(`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,R.jsx)(Rn,{"data-slot":`table-panel-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function X4(e){let t=(0,U.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=j(`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,R.jsx)(zn,{"data-slot":`table-panel-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var Z4=Object.assign(W4,{Header:G4,Heading:K4,Title:q4,Description:J4,Actions:Y4,Content:X4}),Q4=/<\w[\w-]*(?:"(?:\\.|[^"])*"|[^>"])*>/g,$4=/\b([\w-]+)="((?:\\.|[^"])*)"/g;function e3(e){return e.replace(Q4,e=>e.replace($4,(e,t,n)=>`${t}="${n.replace(/\\"/g,`"`)}"`))}function t3(e,t){if(typeof e!=`string`)return e;let n=e3(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
|
-
|
|
3505
|
-
<`),
|
|
3489
|
+
`)}function QZ(e,t){let n=nQ(e,t);for(;n>0&&lQ(aQ(e,n));)n=rQ(e,n);if(n===0)return 0;let r=fQ(aQ(e,n));if(r===`cjk`)return rQ(e,n);for(;n>0&&fQ(aQ(e,n))===r;)n=rQ(e,n);return n}function $Z(e,t){let n=nQ(e,t);for(;n<e.length&&lQ(oQ(e,n));)n=iQ(e,n);if(n>=e.length)return e.length;let r=fQ(oQ(e,n));if(r===`cjk`)return iQ(e,n);for(;n<e.length&&fQ(oQ(e,n))===r;)n=iQ(e,n);return n}function eQ(e,t){return(e%t+t)%t}function tQ(e,t,n){return`${e}:${n}:${t}`}function nQ(e,t){let n=Math.max(0,Math.min(t,e.length));return n>0&&n<e.length&&cQ(e.charCodeAt(n))&&--n,n}function rQ(e,t){let n=t-1;return n>0&&cQ(e.charCodeAt(n))?n-1:Math.max(n,0)}function iQ(e,t){let n=t+(sQ(e.charCodeAt(t))?2:1);return Math.min(n,e.length)}function aQ(e,t){let n=rQ(e,t);return e.slice(n,t)}function oQ(e,t){return e.slice(t,iQ(e,t))}function sQ(e){return e>=55296&&e<=56319}function cQ(e){return e>=56320&&e<=57343}function lQ(e){return/\s/u.test(e)}function uQ(e){return!dQ(e)&&/[\p{Letter}\p{Number}_]/u.test(e)}function dQ(e){return/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u.test(e)}function fQ(e){return dQ(e)?`cjk`:uQ(e)?`word`:`separator`}var pQ=`composer-draft:v1:`;function mQ(e){let t=localStorage.getItem(`${pQ}${e}`);if(!t)return null;try{let e=JSON.parse(t);return _Q(e)?e:null}catch{return null}}function hQ(e,t){let n=`${pQ}${e}`;if(!t||gQ(t)){localStorage.removeItem(n);return}try{localStorage.setItem(n,JSON.stringify(t))}catch{}}function gQ(e){return!e.persistedPrompt.trim()&&e.remoteImages.length===0&&e.pendingPastes.length===0}function _Q(e){return vQ(e)&&Object.keys(e).every(e=>[`persistedPrompt`,`remoteImages`,`pendingPastes`].includes(e))&&typeof e.persistedPrompt==`string`&&Array.isArray(e.remoteImages)&&Array.isArray(e.pendingPastes)}function vQ(e){return typeof e==`object`&&!!e}var yQ=Symbol.for(`composer.registry.trigger`),bQ=Symbol.for(`composer.registry.command`),xQ=Symbol.for(`composer.registry.mention`);function SQ(e){return null}SQ.role=yQ;function CQ(e){return null}CQ.role=bQ;function wQ(e){return null}wQ.role=xQ;function TQ(e){let t=[],n=[],r=new Set,i=new Set,a=!1,o=e=>{for(let s of L.Children.toArray(e)){if(!(0,L.isValidElement)(s)){a=!0;continue}if(s.type===L.Fragment){(0,L.isValidElement)(s)&&o(s.props.children);continue}if(AQ(s.type,yQ)){(0,L.isValidElement)(s)&&OQ(s.props,{slashCommands:t,mentionCandidates:n,commandTriggers:r,mentionTriggers:i});continue}if(AQ(s.type,bQ)||AQ(s.type,xQ))throw Error(`Composer.Command and Composer.Mention must be placed inside a <Composer.Trigger>.`);a=!0}};return o(e),{slashCommands:t,mentionCandidates:n,commandTriggers:[...r],mentionTriggers:[...i],hasLayoutChildren:a}}function EQ(e){return JSON.stringify([e.slashCommands.map(DQ),e.mentionCandidates.map(DQ),e.commandTriggers,e.mentionTriggers])}function DQ(e){let{icon:t,...n}=e;return n}function OQ(e,t){let{trigger:n}=e;for(let r of L.Children.toArray(e.children))if((0,L.isValidElement)(r)){if(r.type===L.Fragment){(0,L.isValidElement)(r)&&OQ({trigger:n,children:r.props.children},t);continue}if(AQ(r.type,bQ)){if(t.mentionTriggers.has(n))throw Error(`Composer.Trigger "${n}" already holds mentions; a trigger carries either commands or mentions, not both.`);t.commandTriggers.add(n),(0,L.isValidElement)(r)&&t.slashCommands.push({...r.props,atomic:!1,trigger:n});continue}if(AQ(r.type,xQ)){if(t.commandTriggers.has(n))throw Error(`Composer.Trigger "${n}" already holds commands; a trigger carries either commands or mentions, not both.`);t.mentionTriggers.add(n),(0,L.isValidElement)(r)&&t.mentionCandidates.push(kQ(r.props,n));continue}throw Error(`<Composer.Trigger trigger="${n}"> accepts only <Composer.Command> and <Composer.Mention> children; wrap them in a fragment rather than a component, which the registry cannot see through.`)}}function kQ(e,t){return{id:e.id,trigger:t,value:e.value,label:e.label,detail:e.detail,atomic:!0,icon:e.icon,payload:e.payload,persistsAs:e.persistsAs,visibility:e.visibility}}function AQ(e,t){return typeof e==`function`&&`role`in e&&e.role===t}function jQ(e,t,n,r){return[...HX(e.query,t.filter(t=>t.trigger===e.trigger),r),...MQ(e.query,n.filter(t=>t.trigger===e.trigger),r)]}function MQ(e,t,n){let r=e.slice(1).toLowerCase();return t.filter(e=>VX(e.visibility,n)&&(e.label.toLowerCase().includes(r)||$X(e).slice(1).toLowerCase().includes(r))).slice(0,10)}var NQ=(0,L.createContext)(null);function PQ(e){let t=e===void 0?`useComposerDictation`:e;jX(t);let n=(0,L.use)(NQ);if(!n)throw Error(`${t} needs the dictation prop of Composer.Root.`);return n}function FQ(e,t){return typeof e==`function`?n=>e(n,t):e}function IQ(e){let t=(0,U.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({render:i,disabled:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{disabled:a}=jX(`Composer.Dictate`),{state:o,start:s,stop:c}=PQ(`Composer.Dictate`),l=o.status===`recording`,u=(o.status===`idle`||o.status===`failed`)&&n!==!0&&!a,d=o.status,f=o.status===`finishing`?o.end:void 0,p=!l&&!u,m=l?c:s,h;t[4]!==i||t[5]!==o?(h=FQ(i,o),t[4]=i,t[5]=o,t[6]=h):h=t[6];let g;return t[7]!==r||t[8]!==l||t[9]!==o.status||t[10]!==f||t[11]!==p||t[12]!==m||t[13]!==h?(g=(0,R.jsx)(St,{...r,"data-status":d,"data-end":f,"aria-pressed":l,disabled:p,onClick:m,render:h}),t[7]=r,t[8]=l,t[9]=o.status,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g):g=t[14],g}function LQ(e){let t=(0,U.c)(13),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({render:i,disabled:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let{state:a,cancel:o}=PQ(`Composer.CancelDictation`),s=a.status===`starting`||a.status===`recording`||a.status===`finishing`,c=a.status,l=!s||n===!0,u;t[4]!==i||t[5]!==a?(u=FQ(i,a),t[4]=i,t[5]=a,t[6]=u):u=t[6];let d;return t[7]!==o||t[8]!==r||t[9]!==a.status||t[10]!==l||t[11]!==u?(d=(0,R.jsx)(St,{...r,"data-status":c,disabled:l,onClick:o,render:u}),t[7]=o,t[8]=r,t[9]=a.status,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}var RQ=class extends Error{code;constructor(e,t){super(`Dictation failed: ${e}`,t),this.name=`DictationError`,this.code=e}},zQ=class{#e=`unknown`;subscribe=e=>{let t=new AbortController;return navigator.permissions.query({name:`microphone`}).then(n=>{if(t.signal.aborted)return;let r=()=>{this.#e=n.state,e()};r(),n.addEventListener(`change`,r,{signal:t.signal})},e=>{if(!(e instanceof TypeError))throw e}),()=>{t.abort()}};getSnapshot=()=>this.#e},BQ=new Map([[`NotAllowedError`,`permission-denied`],[`NotFoundError`,`no-microphone`],[`NotReadableError`,`microphone-in-use`]]),VQ=class e{#e={status:`starting`};#t=new Set;#n;constructor(e){this.#n=e}static start(t){let n=new e(t);return n.#r(),n}subscribe=e=>(this.#t.add(e),()=>{this.#t.delete(e)});getSnapshot=()=>this.#e;stop(){let e=this.#e;if(e.status===`starting`){this.cancel();return}e.status===`recording`&&(this.#a({...e,status:`stopping`}),e.recorder.stop())}cancel(){this.#i({status:`ended`})}async#r(){let e;try{e=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){let t=e instanceof DOMException?BQ.get(e.name):void 0;if(!t)throw e;this.#i({status:`failed`,error:new RQ(t,{cause:e})});return}if(this.#e.status!==`starting`){for(let t of e.getTracks())t.stop();return}let t=new MediaRecorder(e),n=[];t.addEventListener(`dataavailable`,e=>{n.push(e.data)}),t.addEventListener(`stop`,()=>{this.#e.status===`stopping`&&(this.#i({status:`ended`}),this.#n(new Blob(n,{type:t.mimeType})))}),t.addEventListener(`error`,e=>{this.#i({status:`failed`,error:new RQ(`interrupted`,{cause:e})})});for(let t of e.getAudioTracks())t.addEventListener(`ended`,()=>{this.#i({status:`failed`,error:new RQ(`interrupted`)})});t.start(),this.#a({status:`recording`,stream:e,recorder:t})}#i(e){let t=this.#e;if(!(t.status===`ended`||t.status===`failed`)){if(t.status!==`starting`){t.recorder.state!==`inactive`&&t.recorder.stop();for(let e of t.stream.getTracks())e.stop()}this.#a(e)}}#a(e){this.#e=e;for(let e of this.#t)e()}},HQ=()=>()=>void 0,UQ={status:`ended`},WQ=()=>UQ,GQ=()=>`unknown`;function KQ(e){let t=(0,U.c)(47),{dictation:n,disabled:r,insertTranscript:i,submitDraft:a}=e,o=`MediaRecorder`in globalThis&&`mediaDevices`in navigator,s=n!==void 0,[c]=(0,L.useState)(qQ),l=(0,L.useSyncExternalStore)(s&&o?c.subscribe:HQ,c.getSnapshot,GQ),[u,d]=(0,L.useState)(null),f=(0,L.useSyncExternalStore)(u?u.subscribe:HQ,u?u.getSnapshot:WQ,WQ),[p,m]=(0,L.useState)(0),[h,g]=(0,L.useState)(`insert`),_=(0,L.useRef)(`insert`),v=(0,L.useRef)(null),y;t[0]!==n||t[1]!==i||t[2]!==a?(y={dictation:n,insertTranscript:i,submitDraft:a},t[0]=n,t[1]=i,t[2]=a,t[3]=y):y=t[3];let b=(0,L.useRef)(y),x;t[4]!==n||t[5]!==i||t[6]!==a?(x=()=>{b.current={dictation:n,insertTranscript:i,submitDraft:a}},t[4]=n,t[5]=i,t[6]=a,t[7]=x):x=t[7],(0,L.useEffect)(x);let S,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=async(e,t)=>{let n=new AbortController;v.current=n;try{let{text:e}=await t.transcribe(t.clip,{signal:n.signal});if(!n.signal.aborted){let t=e.trim();t&&b.current.insertTranscript(t),_.current===`send`&&b.current.submitDraft()}return{attempt:t.attempt,failure:null}}catch(e){let r=e;return n.signal.aborted?{attempt:t.attempt,failure:null}:{attempt:t.attempt,failure:new RQ(`transcription-failed`,{cause:r})}}},C={attempt:0,failure:null},t[8]=S,t[9]=C):(S=t[8],C=t[9]);let[w,T,ee]=(0,L.useActionState)(S,C),E,te;t[10]!==r||t[11]!==s||t[12]!==u?(E=()=>{(r||!s)&&(u?.cancel(),v.current?.abort())},te=[r,s,u],t[10]=r,t[11]=s,t[12]=u,t[13]=E,t[14]=te):(E=t[13],te=t[14]),(0,L.useEffect)(E,te);let ne,re;if(t[15]===u?(ne=t[16],re=t[17]):(ne=()=>()=>{u?.cancel(),v.current?.abort()},re=[u],t[15]=u,t[16]=ne,t[17]=re),(0,L.useEffect)(ne,re),!n)return null;let ie,D;if(t[18]!==p||t[19]!==h||t[20]!==w||t[21]!==l||t[22]!==f||t[23]!==ee){D=e(),ie=D.status===`starting`||D.status===`recording`||D.status===`finishing`;function e(){if(!o)return{status:`unavailable`,reason:`unsupported`};switch(f.status){case`starting`:return{status:`starting`};case`recording`:return{status:`recording`};case`stopping`:return{status:`finishing`,end:h};case`ended`:case`failed`:}return ee?{status:`finishing`,end:h}:l===`denied`?{status:`unavailable`,reason:`blocked`}:f.status===`failed`?{status:`failed`,error:f.error}:w.failure&&w.attempt===p?{status:`failed`,error:w.failure}:{status:`idle`}}t[18]=p,t[19]=h,t[20]=w,t[21]=l,t[22]=f,t[23]=ee,t[24]=ie,t[25]=D}else ie=t[24],D=t[25];let O;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(O=function(e){_.current=e,g(e)},t[26]=O):O=t[26];let k=O,A;t[27]!==ie||t[28]!==p||t[29]!==r||t[30]!==D?(A=function(){if(r||ie||D.status===`unavailable`)return;let e=p+1;m(e),k(`insert`),d(VQ.start(t=>{let n=b.current.dictation;n&&(0,L.startTransition)(()=>{T({clip:t,attempt:e,transcribe:n.transcribe})})}))},t[27]=ie,t[28]=p,t[29]=r,t[30]=D,t[31]=A):A=t[31];let ae=A,oe;t[32]===u?oe=t[33]:(oe=function(){u?.stop()},t[32]=u,t[33]=oe);let se=oe,j;t[34]===u?j=t[35]:(j=function(){u?.cancel(),v.current?.abort()},t[34]=u,t[35]=j);let ce=j,M;t[36]!==u||t[37]!==D?(M=function(){switch(D.status){case`starting`:return u?.cancel(),!1;case`recording`:return k(`send`),u?.stop(),!0;case`finishing`:return k(`send`),!0;default:return!1}},t[36]=u,t[37]=D,t[38]=M):M=t[38];let le=M,N;t[39]!==ce||t[40]!==ae||t[41]!==D||t[42]!==se?(N={state:D,start:ae,stop:se,cancel:ce},t[39]=ce,t[40]=ae,t[41]=D,t[42]=se,t[43]=N):N=t[43];let ue;return t[44]!==le||t[45]!==N?(ue={api:N,endWithSend:le},t[44]=le,t[45]=N,t[46]=ue):ue=t[46],ue}function qQ(){return new zQ}function JQ(e){return[kX.configure({link:!1}),Aq.configure({autolink:!0,linkOnPaste:!1,openOnClick:!1,HTMLAttributes:{"data-token":`link`}}),ZQ,QQ,$Q,e$(e)]}var YQ=1e3;function XQ(e,t){return{default:t,parseHTML:n=>n.getAttribute(e)??t}}var ZQ=dU.create({name:`composerSlashCommand`,inclusive:!1,addAttributes(){return{value:{default:null},detail:{default:null}}},parseHTML(){return[{tag:`span[data-composer-slash-command]`}]},renderHTML({HTMLAttributes:e}){return[`span`,gV(e,{"data-token":`slash-command`,"data-composer-slash-command":e.value}),0]}}),QQ=BU.create({name:`composerMention`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{id:XQ(`id`,null),trigger:XQ(`trigger`,``),value:XQ(`value`,``),label:XQ(`label`,``),detail:XQ(`detail`,``),persistsAs:XQ(`persistsAs`,null),payload:{default:null,renderHTML:e=>e.payload===null||e.payload===void 0?{}:{payload:JSON.stringify(e.payload)},parseHTML:e=>{let t=e.getAttribute(`payload`);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}}}},parseHTML(){return[{tag:`span[data-composer-mention]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.label||`${e.attrs.trigger??``}${e.attrs.value??``}`;return[`span`,gV(t,{"data-token":`mention`,"data-composer-mention":e.attrs.value,"data-composer-mention-trigger":e.attrs.trigger}),n]},renderText({node:e}){return e.attrs.label||`${e.attrs.trigger??``}${e.attrs.value??``}`}}),$Q=BU.create({name:`composerAtom`,group:`inline`,inline:!0,atom:!0,selectable:!0,addAttributes(){return{kind:{default:`paste`},label:{default:``},detail:{default:``},content:{default:``},href:{default:``},attachmentId:{default:``,rendered:!1},media:{default:`image`,rendered:!1},metadata:{default:null}}},parseHTML(){return[{tag:`span[data-composer-atom]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.kind??`paste`),r=String(e.attrs.label??``);return[`span`,gV(t,{"data-token":n,"data-composer-atom":n,"data-composer-atom-detail":e.attrs.detail}),r]},renderText({node:e}){return String(e.attrs.label??``)}});function e$(e){return yU.create({name:`composerClipboard`,addProseMirrorPlugins(){return[new sP({props:{handlePaste(t,n){let r=n.clipboardData;if(!r)return!1;let i=Array.from(r.files).find(e=>EZ(e)!==null);if(i)return n.preventDefault(),k$(t,e.getRemoteImageCount(),i,e.attachImageFile),!0;let a=Array.from(r.files).find(e=>EZ(e)===null);if(a)return n.preventDefault(),A$(t,a.name||`pasted-file`,e.getMentionTrigger()),!0;let o=i1(l1(r.getData(`text/uri-list`))||u1(r.getData(`DownloadURL`))||r.getData(`text/plain`)||r.getData(`text`)),s=o.trim();if(!o)return!1;let c=S$(t);if(c&&d1(s)){n.preventDefault();let e=f1(s),r=t.state.schema.marks.link;return r?w$(t,c,e,r):!1}return a1(s)&&!s.includes(`
|
|
3490
|
+
`)?(n.preventDefault(),A$(t,s,e.getMentionTrigger()),!0):d1(s)&&!s.includes(`
|
|
3491
|
+
`)?(n.preventDefault(),D$(t,s,f1(s))):c&&o&&!o.includes(`
|
|
3492
|
+
`)&&jZ(o)<=YQ?(n.preventDefault(),O$(t,o,c),!0):jZ(o)>YQ?(n.preventDefault(),x$(t,o),!0):!1},handleDrop(t,n){let r=n.dataTransfer;return r&&t$(t,r,e.getRemoteImageCount(),e.getMentionTrigger(),e.attachImageFile)?(n.preventDefault(),!0):!1}}})]}})}function t$(e,t,n,r,i){let a=Array.from(t.files).find(e=>EZ(e)!==null);if(a)return k$(e,n,a,i),!0;let o=Array.from(t.files).find(e=>EZ(e)===null);if(o)return A$(e,o.name||`dropped-file`,r),!0;let s=i1(l1(t.getData(`text/uri-list`))||u1(t.getData(`DownloadURL`))||t.getData(`text/plain`)).trim();return s?a1(s)&&!s.includes(`
|
|
3493
|
+
`)?(A$(e,s,r),!0):d1(s)&&!s.includes(`
|
|
3494
|
+
`)?(D$(e,s,f1(s)),!0):!1:!1}function n$({state:e,text:t,slashCommands:n,mentionCandidates:r,triggers:i}){return e?r$(eZ({initialDraft:e,slashCommands:n,commandTriggers:i.commandTriggers,mentionCandidates:r}),n,r,i):i$(t??``,n,r,i)}function r$(e,t,n,r){if(e.elements.length===0)return i$(e.text,t,n,r);let i=[],a=0;for(let o of wZ(e.elements)){o.range.start>a&&i.push(...a$(e.text.slice(a,o.range.start),t,n,r.commandTriggers,r.mentionTriggers));let s=e.mentionBindings.find(e=>e.id===o.id||`${e.trigger}${e.value}`===o.label),c=e.pendingPastes.find(e=>e.placeholder===o.label);o.kind===`mention`&&s?i.push(h$(g$(s,o,n))):o.kind===`paste`&&c?i.push(_$({kind:`paste`,label:c.placeholder,detail:o.detail??`${jZ(c.content)} chars`,content:c.content})):o.kind===`rich-link`?i.push(_$({kind:`rich-link`,label:o.label,detail:o.detail??``,href:o.detail??``,metadata:o.metadata})):o.kind===`link`?i.push(p$(o.label,[m$(o.detail??``)])):i.push(...a$(e.text.slice(o.range.start,o.range.end),t,n,r.commandTriggers,r.mentionTriggers)),a=o.range.end}return a<e.text.length&&i.push(...a$(e.text.slice(a),t,n,r.commandTriggers,r.mentionTriggers)),d$(i)}function i$(e,t,n,r){let i=FZ({text:e,slashCommands:t,commandTriggers:r.commandTriggers,mentionCandidates:n});return(i.elements?.length??0)>0?r$(eZ({initialDraft:i,slashCommands:t,commandTriggers:r.commandTriggers,mentionCandidates:n}),t,n,r):{type:`doc`,content:e.split(`
|
|
3495
|
+
`).map(e=>({type:`paragraph`,content:a$(e,t,n,r.commandTriggers,r.mentionTriggers)}))}}function a$(e,t,n,r,i){return KA(e).flatMap(e=>e.kind===`inline-code`||e.kind===`code-block`||e.kind===`link`||e.kind===`skill-link`?[p$(e.source)]:o$(e.source,t,n,r,i))}function o$(e,t,n,r,i){let a=[],o=ZX(r,i);if(!o)return[p$(e)];let s=0;for(let r of e.matchAll(o)){let o=r.index??0,c=r[0];if(o===0||/\s/.test(e[o-1]??``)){if(o>s&&a.push(p$(e.slice(s,o))),QX(c,i)){let e=n.find(e=>$X(e)===c);a.push(e?h$(e):p$(c))}else{let e=UX(c.replace(/^\//,``),t);a.push(e?p$(c,[{type:`composerSlashCommand`,attrs:{value:e.value,detail:e.detail}}]):p$(c))}s=o+c.length}}return s<e.length&&a.push(p$(e.slice(s))),a}function s$(e,t,n,r,i,a){let o={text:``,elements:[],mentionBindings:[],imageAttachments:[],pendingPastes:[]};c$(e,o,n);let s=eZ({text:o.text,slashCommands:n,isTaskRunning:r,queueSubmissions:i});return{...s,cursor:a,elements:r1([...s.elements,...o.elements]),mentionBindings:o.mentionBindings,imageAttachments:o.imageAttachments,remoteImages:t,pendingPastes:o.pendingPastes}}function c$(e,t,n){if(e.type===`doc`){e.content?.forEach((e,r)=>{r>0&&t.text.length>0&&(t.text+=`
|
|
3496
|
+
`),c$(e,t,n)});return}if(e.type===`paragraph`){e.content?.forEach(e=>c$(e,t,n));return}if(e.type===`hardBreak`){t.text+=`
|
|
3497
|
+
`;return}if(e.type===`text`){let r=e.text??``,i=t.text.length;t.text+=r;for(let a of e.marks??[])if(a.type===`link`&&a.attrs?.href&&t.elements.push({id:tQ(`link`,r,i),kind:`link`,label:r,range:{start:i,end:i+r.length},detail:String(a.attrs.href)}),a.type===`composerSlashCommand`){let e=UX(r.replace(/^\//,``),n);if(!e)continue;t.elements.push({id:tQ(`slash-command`,r,i),kind:`slash-command`,label:r,range:{start:i,end:i+r.length},detail:e.detail})}return}if(e.type===`composerMention`){let n=String(e.attrs?.label??``)||`${String(e.attrs?.trigger??``)}${String(e.attrs?.value??``)}`,r=t.text.length,i=String(e.attrs?.id??tQ(`mention`,n,r));t.text+=n,t.elements.push({id:i,kind:`mention`,label:n,range:{start:r,end:r+n.length},detail:String(e.attrs?.detail??``)});let a=e.attrs?.persistsAs;t.mentionBindings.push({id:i,trigger:String(e.attrs?.trigger??``),value:String(e.attrs?.value??``),payload:e.attrs?.payload,persistsAs:typeof a==`string`?a:void 0});return}if(e.type===`composerAtom`){let n=String(e.attrs?.label??``),r=u$(e.attrs?.kind),i=t.text.length,a=String(e.attrs?.attachmentId??``);if(r===`image`&&!a)return;let o=r===`image`?a:tQ(r,n,i);t.text+=n;let s=r===`rich-link`?l$(e.attrs?.metadata):void 0;t.elements.push({id:o,kind:r,label:n,range:{start:i,end:i+n.length},detail:String(e.attrs?.detail||e.attrs?.href||``),...s?{metadata:s}:{}}),r===`image`&&t.imageAttachments.push({id:o,placeholder:n,media:DZ(e.attrs?.media)}),r===`paste`&&t.pendingPastes.push({id:o,placeholder:n,content:String(e.attrs?.content??``)})}}function l$(e){if(!e||typeof e!=`object`)return;let t={};for(let n of[`title`,`description`,`siteName`,`domain`,`imageUrl`,`faviconUrl`]){let r=Object.entries(e).find(([e])=>e===n)?.[1];typeof r==`string`&&r.length>0&&(t[n]=r)}return Object.keys(t).length>0?t:void 0}function u$(e){switch(e){case`slash-command`:case`mention`:case`image`:case`paste`:case`link`:case`rich-link`:return e;default:return`paste`}}function d$(e){return{type:`doc`,content:[{type:`paragraph`,content:e}]}}function f$(){return{type:`doc`,content:[{type:`paragraph`}]}}function p$(e,t){return t&&t.length>0?{type:`text`,text:e,marks:t}:{type:`text`,text:e}}function m$(e){return{type:`link`,attrs:{href:e}}}function h$(e){return{type:`composerMention`,attrs:{id:e.id,trigger:e.trigger,value:e.value,label:$X(e),detail:e.detail,payload:e.payload,persistsAs:e.persistsAs}}}function g$(e,t,n){let r=`${e.trigger}${e.value}`;return n.find(e=>$X(e)===t.label||$X(e)===r)||{id:e.id,trigger:e.trigger,value:e.value,label:e.value,detail:``,atomic:!0,payload:e.payload}}function _$({kind:e,label:t,detail:n=``,content:r=``,href:i=``,metadata:a}){return{type:`composerAtom`,attrs:{kind:e,label:t,detail:n,content:r,href:i,metadata:a??null}}}function v$(e,t,n=`image`){return{type:`composerAtom`,attrs:{kind:`image`,attachmentId:e,label:t,media:n}}}function y$(e,t){let{selection:n}=e.state;if(!n.empty)return null;let r=n.$from,i=r.parent.textBetween(0,r.parentOffset,void 0,``),a=r.parent.textBetween(r.parentOffset,r.parent.content.size,void 0,``),o=[...t.commandTriggers,...t.mentionTriggers];if(o.length===0)return null;let s=b$(i,a,o);if(!s)return null;let c=o.find(e=>s.token.startsWith(e));return!c||s.token.slice(c.length).includes(c)?null:{trigger:c,query:s.token,from:n.from-(i.length-s.start),to:n.from+s.tail.length}}function b$(e,t,n){let r=`(?:${JX(n)})`,i=e.search(RegExp(`(?:^|\\s|\\ufffc)(${r}[^\\s\\ufffc]*)$`));if(i===-1)return null;let a=/[\s\ufffc]/.test(e[i]??``)?i+1:i,o=t.match(/^[^\s\ufffc]*/)?.[0]??``;return{start:a,token:e.slice(a)+o,tail:o}}function x$(e,t){let n=F$(e.state.doc.toJSON(),jZ(t)),r=e.state.schema.nodes.composerAtom?.create({kind:`paste`,label:n,detail:`${jZ(t)} chars`,content:t});r&&e.dispatch(e.state.tr.replaceSelectionWith(r).scrollIntoView())}function S$(e){let t=e.dom.ownerDocument.getSelection();if(t&&t.rangeCount>0&&!t.isCollapsed){let n=t.getRangeAt(0);if(e.dom.contains(n.commonAncestorContainer)){let r=e.posAtDOM(n.startContainer,n.startOffset),i=e.posAtDOM(n.endContainer,n.endOffset);if(r!==i)return{from:Math.min(r,i),to:Math.max(r,i),selectedAtomLabels:C$(n,e.dom),selectedText:t.toString()}}}return e.state.selection.empty?null:{from:e.state.selection.from,to:e.state.selection.to}}function C$(e,t){return Array.from(t.querySelectorAll(`[data-composer-atom]`)).filter(t=>e.intersectsNode(t)).map(e=>e.textContent??``).filter(Boolean)}function w$(e,t,n,r){let i=T$(e.state.doc,t),a=E$(e.state.doc,i.from,i.to)||n,o=e.state.schema.text(a,[r.create({href:n})]),s=e.state.tr.replaceWith(i.from,i.to,o),c=i.from+a.length;return e.dispatch(s.setSelection(q.create(s.doc,c)).scrollIntoView()),!0}function T$(e,t){if(!t.selectedText&&!t.selectedAtomLabels?.length)return t;let n={from:t.from,to:t.to},r=!0;for(;r;)r=!1,e.nodesBetween(0,e.content.size,(e,i)=>{if(e.type.name!==`composerAtom`)return!0;let a=String(e.attrs.label??``),o=t.selectedText?.includes(a)||t.selectedAtomLabels?.includes(a);if(!a||!o)return!1;let s={from:i,to:i+e.nodeSize};if(!(s.from<=n.to+1&&s.to>=n.from-1))return!1;let c=Math.min(n.from,s.from),l=Math.max(n.to,s.to);return(c!==n.from||l!==n.to)&&(n={from:c,to:l},r=!0),!1});return n}function E$(e,t,n){let r=``;return e.nodesBetween(t,n,(e,i)=>{if(e.isText){let a=e.text??``,o=Math.max(t-i,0),s=Math.min(n-i,a.length);return r+=a.slice(o,s),!1}return e.type.name===`composerMention`?(r+=String(e.attrs.label??``),!1):e.type.name===`composerAtom`?(e.attrs.kind===`rich-link`&&(r+=String(e.attrs.label??``)),!1):e.type.name===`hardBreak`?(r+=`
|
|
3498
|
+
`,!1):!0}),r.replace(/\n+/g,` `).trim()}function D$(e,t,n){let r=e.state.schema.marks.link;if(!r)return!1;let{from:i,to:a}=e.state.selection,o=e.state.tr.insertText(t,i,a);return o.addMark(i,i+t.length,r.create({href:n})),e.dispatch(o.scrollIntoView()),!0}function O$(e,t,n){e.dispatch(e.state.tr.replaceWith(n.from,n.to,e.state.schema.text(t)).scrollIntoView())}function k$(e,t,n,r){let i=r(n);if(i===null)return;let a=t+I$(e.state.doc.toJSON(),`image`)+1,o=EZ(n)??`image`,s=e.state.schema.nodeFromJSON(v$(i,OZ(o,a),o));if(!s)return;let c=e.state.tr.replaceSelectionWith(s);c=c.insertText(` `,c.selection.from),e.dispatch(c.scrollIntoView())}function A$(e,t,n){let r=o1(t),i=s1(r),a=`${n}${i}`,o=e.state.schema.nodes.composerMention?.create({id:tQ(`mention`,a,e.state.selection.from),trigger:n,value:i,label:a,detail:c1(r)?`directory`:`file`,payload:{path:r,type:c1(r)?`directory`:`file`}});if(!o)return;let s=e.state.tr.replaceSelectionWith(o);s=s.insertText(` `,s.selection.from),e.dispatch(s.scrollIntoView())}function j$(e,t){let n=0;return M$(e,e=>e.type!==`composerAtom`||e.attrs?.kind!==`image`?e:(n+=1,{...e,attrs:{...e.attrs,label:OZ(DZ(e.attrs?.media),t+n)}}))}function M$(e,t){let n=t(e);return{...n,content:n.content?.map(e=>M$(e,t))}}function N$(e,t){return P$(e,e=>e.type!==`composerAtom`||e.attrs?.kind!==`image`||e.attrs?.attachmentId!==t)}function P$(e,t){return{...e,content:e.content?.filter(t).map(e=>P$(e,t))}}function F$(e,t){let n=`[Pasted Content ${t} chars]`,r=new Set;if(L$(e,e=>{e.type===`composerAtom`&&e.attrs?.kind===`paste`&&r.add(String(e.attrs.label??``))}),!r.has(n))return n;let i=2;for(;r.has(`${n} #${i}`);)i+=1;return`${n} #${i}`}function I$(e,t){let n=0;return L$(e,e=>{e.type===`composerAtom`&&e.attrs?.kind===t&&(n+=1)}),n}function L$(e,t){t(e),e.content?.forEach(e=>L$(e,t))}function R$(e){let{selection:t}=e.state,n=t.from;return q$(e,n,t.empty?t.$from.end():t.to)}function z$(e){let{selection:t}=e.state,n=t.empty?U$(e,t.from):t.from,r=t.to;return q$(e,n,r)}function B$(e){let{selection:t}=e.state;if(!t.empty)return q$(e,t.from,t.to);let n=t.$from.parent.textBetween(0,t.$from.parentOffset,void 0,J$),r=QZ(n,n.length);return q$(e,G$(t.$from.parent,t.$from.start(),r),t.from)}function V$(e){let t=e.state.selection.to,n=W$(e,t),r=e.state.tr.setSelection(q.create(e.state.doc,n)).scrollIntoView();e.view.dispatch(r),e.view.focus()}function H$(e,t){let{selection:n}=e.state,r=t===-1?n.from:n.to,i=e.state.doc.resolve(r),a=i.parent.textBetween(0,i.parent.content.size,void 0,J$),o=i.parent.textBetween(0,i.parentOffset,void 0,J$).length,s=t===-1?QZ(a,o):$Z(a,o),c=G$(i.parent,i.start(),s),l=e.state.tr.setSelection(q.create(e.state.doc,c)).scrollIntoView();e.view.dispatch(l),e.view.focus()}function U$(e,t){let{selection:n}=e.state,r=n.$from.start();return e.state.doc.nodesBetween(r,t,(e,t)=>{e.type.name===`hardBreak`&&(r=t+e.nodeSize)}),r}function W$(e,t){let n=e.state.doc.resolve(t).end();return e.state.doc.nodesBetween(t,n,(e,r)=>e.type.name===`hardBreak`&&r>=t?(n=r,!1):!0),n}function G$(e,t,n){let r=0,i=t;for(let t=0;t<e.childCount;t+=1){let a=e.child(t),o=K$(a);if(o===null){i+=a.nodeSize;continue}let s=r+o.length;if(n<=s)return a.isText?i+n-r:n===s?i+a.nodeSize:i;r=s,i+=a.nodeSize}return i}function K$(e){return e.isText?e.text??``:e.type.name===`hardBreak`?`
|
|
3499
|
+
`:e.type.name===`composerMention`||e.type.name===`composerAtom`?J$(e):null}function q$(e,t,n){if(n<=t)return null;let r=e.state.doc.slice(t,n),i={text:e.state.doc.textBetween(t,n,`
|
|
3500
|
+
`,J$),slice:r.toJSON()};return e.chain().focus().deleteRange({from:t,to:n}).run(),i}function J$(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 Y$(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 X$(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||!Z$(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 Z$(e){return e.isAtom&&(e.type.name===`composerMention`||e.type.name===`composerAtom`)}function Q$(e){try{return e.state.doc.textBetween(0,e.state.selection.from,`
|
|
3501
|
+
`,``).length}catch{return 0}}function $$(e){return e.state.selection.empty&&Q$(e)===0}function e1(e,t){return QX(e.persistedPrompt,t)?`ParseSlash`:e.action}function t1(e){return e.key===`ArrowUp`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`p`}function n1(e){return e.key===`ArrowDown`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`n`}function r1(e){let t=new Map;for(let n of e)t.set(`${n.kind}:${n.range.start}:${n.range.end}:${n.label}`,n);return wZ([...t.values()])}function i1(e){return e.replace(/\r\n?/g,`
|
|
3502
|
+
`)}function a1(e){return e.startsWith(`file://`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||/^[A-Za-z]:[\\/]/.test(e)}function o1(e){let t=e.trim();if(!t.startsWith(`file://`))return t;let n=URL.parse(t);if(!n)return t;try{return decodeURIComponent(n.pathname)}catch{return n.pathname}}function s1(e){return e.replace(/[\\/]+$/,``).split(/[\\/]/).filter(Boolean).pop()??e}function c1(e){return/[\\/]$/.test(e)}function l1(e){return e.split(/\r?\n/).map(e=>e.trim()).find(e=>e&&!e.startsWith(`#`))??``}function u1(e){let t=l1(e);return t?t.match(/^[\w.+-]+\/[\w.+-]+:[^:\n]+:(.+)$/)?.[1]?.trim()??t:``}function d1(e){try{let t=new URL(e);return t.protocol===`http:`||t.protocol===`https:`}catch{return!1}}function f1(e){return RZ(e.trim())}function p1(e){let t=(0,U.c)(3),n=e.draftKey??``,r;return t[0]!==e||t[1]!==n?(r=(0,R.jsx)(h1,{...e},n),t[0]=e,t[1]=n,t[2]=r):r=t[2],r}function m1(e){return typeof e==`object`&&!!e&&`then`in e&&typeof e.then==`function`}function h1({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,dictation:u,validateSubmission:d,onSubmit:f,onStateChange:p}){let m=ae(),h=TQ(l),g=(0,L.useRef)({signature:EQ(h),slashCommands:h.slashCommands,mentionCandidates:h.mentionCandidates,commandTriggers:h.commandTriggers,mentionTriggers:h.mentionTriggers}),_=EQ(h);_!==g.current.signature&&(g.current={signature:_,slashCommands:h.slashCommands,mentionCandidates:h.mentionCandidates,commandTriggers:h.commandTriggers,mentionTriggers:h.mentionTriggers});let{slashCommands:v,mentionCandidates:y,commandTriggers:b,mentionTriggers:x}=g.current,S=(0,L.useMemo)(()=>({commandTriggers:b,mentionTriggers:x}),[b,x]),C=(0,L.useRef)(x);C.current=x;let[w]=(0,L.useState)(()=>{if(e)return e;if(t===void 0)return;let n=mQ(t);return n?IZ({source:n,slashCommands:v,mentionCandidates:y}):void 0}),T=(0,L.useRef)(w?.remoteImages??[]),ee=(0,L.useRef)(n$({state:w,slashCommands:v,mentionCandidates:y,triggers:S})),E=(0,L.useRef)(0),te=(0,L.useRef)(!0);(0,L.useEffect)(()=>(te.current=!0,()=>{te.current=!1}),[]);let[ne,re]=(0,L.useState)(T.current),[ie,D]=(0,L.useState)(null),[O,k]=(0,L.useState)(()=>s$(ee.current,T.current,v,r,i,0)),A=(0,L.useRef)(O),oe=(0,L.useRef)(ne),se=(0,L.useRef)(ie),ce=(0,L.useRef)(null),M=(0,L.useRef)(null),le=(0,L.useRef)(void 0),N=(0,L.useRef)(null),ue=(0,L.useRef)(null),de=(0,L.useRef)(null),fe=(0,L.useEffectEvent)((e,t)=>{p?.(e,t)}),pe=(0,L.useRef)(d),me=(0,L.useRef)(f),he=(0,L.useRef)(new Map),ge=(0,L.useRef)(()=>null),_e=(0,L.useRef)(()=>void 0),ve=(0,L.useRef)(()=>void 0),ye=(0,L.useRef)(()=>!1),P=QW({extensions:(0,L.useMemo)(()=>JQ({getMentionTrigger:()=>C.current[0]??`@`,getRemoteImageCount:()=>oe.current.length,attachImageFile:e=>ge.current(e)}),[]),content:ee.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 ye.current(t)}},immediatelyRender:!1,onUpdate({editor:e}){_e.current(e),ve.current(e)},onSelectionUpdate({editor:e}){_e.current(e),ve.current(e)}}),be=(0,L.useMemo)(()=>ie?jQ(ie,v,y,a):[],[ie,a,y,v]),xe=(0,L.useMemo)(()=>nZ(O,v,b),[b,O,v]);(0,L.useEffect)(()=>{A.current=O},[O]),(0,L.useEffect)(()=>{oe.current=ne},[ne]),(0,L.useEffect)(()=>{se.current=ie},[ie]),(0,L.useEffect)(()=>{O.shortcutsOpen&&(ie||O.reverseSearch!==null||!tZ(O))&&k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:e)},[ie,O]),(0,L.useEffect)(()=>{pe.current=d},[d]),(0,L.useEffect)(()=>{me.current=f},[f]),(0,L.useEffect)(()=>{P&&(P.setEditable(!n),n&&D(null))},[n,P]),(0,L.useEffect)(()=>{fe(O,xe),t!==void 0&&(xe?hQ(t,NZ(O,xe.persistedPrompt)):E.current===0&&hQ(t,null))},[O,t,xe]),(0,L.useEffect)(()=>{k(e=>e.isTaskRunning===r&&e.queueSubmissions===i?e:{...e,isTaskRunning:r,queueSubmissions:i})},[r,i]),_e.current=e=>{if(n)return;let t=s$(e.getJSON(),oe.current,v,r,i,Q$(e)),a=M.current,o=le.current;M.current=null,le.current=void 0,k(e=>{let n=o===void 0?N.current:o;N.current=n;let r=e.shortcutsOpen&&tZ(t);return{...t,error:e.error,history:e.history,historyCursor:n,killBuffer:e.killBuffer,reverseSearch:e.reverseSearch,shortcutsOpen:r,selectedRemoteImageId:a}})},ve.current=e=>{if(n){D(null);return}let t=y$(e,S);if(!t){D(null);return}if(b.includes(t.trigger)){let e={trigger:t.trigger,query:t.query,selectedIndex:0},n=jQ(e,v,y,a);D(t=>n.length===0?null:{...e,selectedIndex:t?.trigger===e.trigger?Math.min(t.selectedIndex,n.length-1):0});return}D(e=>{let n=t.trigger,r={trigger:n,query:t.query,selectedIndex:e?.trigger===n?e.selectedIndex:0},i=jQ(r,v,y,a);return{...r,selectedIndex:e?.trigger===n?Math.min(e.selectedIndex,Math.max(i.length-1,0)):0}})};function Se(e){P?.commands.setContent(e),P&&(_e.current(P),ve.current(P))}function Ce(e){if(n||!P)return;let t=y$(P,S),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?P.chain().focus().deleteRange({from:t.from,to:t.to}).insertContent(r).run():P.chain().focus().insertContent(r).run(),D(null)}function we({index:e=se.current?.selectedIndex??0}={}){let t=se.current;if(n||!P||!t)return;let r=jQ(t,v,y,a),i=r[e]??r[0];if(!i)return;if(!i.atomic){Ce(i);return}let o=y$(P,S),s=o?.trigger===t.trigger,c=P.chain().focus();s&&o&&c.deleteRange({from:o.from,to:o.to}),c.insertContent([h$(i),{type:`text`,text:` `}]).run(),D(null)}function Te(){if(n||!P)return;P.commands.focus();let e=b[0];e&&D(t=>t?.trigger===e?null:{trigger:e,query:``,selectedIndex:0})}function Ee(e){return tZ(e)&&e.reverseSearch===null&&se.current===null}function De(){n||k(e=>Ee(e)&&!e.shortcutsOpen?{...e,shortcutsOpen:!0,selectedRemoteImageId:null,error:null}:e)}function F(){k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:e)}function Oe(){n||k(e=>e.shortcutsOpen?{...e,shortcutsOpen:!1}:Ee(e)?{...e,shortcutsOpen:!0,selectedRemoteImageId:null,error:null}:e)}function ke(e){n||!P||!e||P.chain().focus().insertContent(e).run()}function Ae(e){if(EZ(e)===null)return k(t=>({...t,error:`Only image, video, or audio files can be attached: ${e.name||`unnamed file`}`,shortcutsOpen:!1})),D(null),null;let t=crypto.randomUUID();return he.current.set(t,e),t}function je(e,t){let n=Ae(t);if(n===null)return;let r=Ue(),i=r.remoteImages.length+r.imageAttachments.length+1,a=EZ(t)??`image`;e.chain().focus().insertContent([v$(n,OZ(a,i),a),{type:`text`,text:` `}]).run()}function Me(e){if(!(n||!P))for(let t of e)je(P,t)}function Ne(e){n||!P||(he.current.delete(e),Se(j$(N$(P.getJSON(),e),oe.current.length)))}function Pe(e){if(n||!P)return;let t=[...oe.current,{id:tQ(`remote-image`,e,m.Date.now()),url:e}];oe.current=t,re(t),Se(j$(P.getJSON(),t.length))}function Fe(e){return n||!P?!1:t$(P.view,e,oe.current.length,x[0]??`@`,Ae)}function Ie(e){if(n)return;let t=oe.current[e]??A.current.remoteImages[e];t&&(M.current=t.id,k(e=>({...e,selectedRemoteImageId:t.id,shortcutsOpen:!1})))}function Le(){n||(M.current=null,k(e=>e.selectedRemoteImageId?{...e,selectedRemoteImageId:null,shortcutsOpen:!1}:e))}function Re(e){return A.current.selectedRemoteImageId?e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`Escape`||(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`?(Le(),D(null),!0):e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey?(Le(),!0):!1:!1}function ze(e){if(n)return e.preventDefault(),!0;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`a`)return e.preventDefault(),Le(),D(null),P?.commands.selectAll(),!0;let t=Ue(),r=A.current.selectedRemoteImageId;if(!se.current&&e.key===`ArrowUp`){let n=AZ({...t,selectedRemoteImageId:r},r);if(n!==null)return e.preventDefault(),Ie(Math.max(0,n-1)),!0;if((P&&$$(P)||t.cursor===0)&&t.remoteImages.length>0)return e.preventDefault(),Ie(t.remoteImages.length-1),!0}if(!se.current&&r&&e.key===`ArrowDown`){e.preventDefault();let n=AZ({...t,selectedRemoteImageId:r},r);return n!==null&&n+1<t.remoteImages.length?Ie(n+1):Le(),!0}return!se.current&&r&&(e.key===`Backspace`||e.key===`Delete`)?(e.preventDefault(),Be(r),!0):(Re(e),!1)}function Be(e){if(n||!P)return;let t=Ue(),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;M.current=a?.id??null,oe.current=i,re(i),Se(j$(P.getJSON(),i.length)),k(e=>({...e,remoteImages:i,selectedRemoteImageId:a?.id??null,shortcutsOpen:!1}))}function Ve(e){if(n||!P)return;let t=F$(P.getJSON(),jZ(e));P.chain().focus().insertContent(_$({kind:`paste`,label:t,detail:`${jZ(e)} chars`,content:e})).run()}function He(e,t=e,r){n||P?.chain().focus().insertContent(_$({kind:`rich-link`,label:t,detail:e,href:e,metadata:r})).run()}function Ue(){return P?{...s$(P.getJSON(),oe.current,v,r,i,Q$(P)),error:A.current.error,history:A.current.history,historyCursor:N.current??A.current.historyCursor,killBuffer:A.current.killBuffer,reverseSearch:A.current.reverseSearch,shortcutsOpen:A.current.shortcutsOpen,selectedRemoteImageId:A.current.selectedRemoteImageId}:A.current}function We(e){let t=pe.current?.(e);return t?(k(e=>({...e,error:t,shortcutsOpen:!1})),D(null),!0):!1}function Ge(e){let t=Ue(),n=t.text.slice(0,t.cursor);ke(n&&!/\s$/.test(n)?` ${e}`:e)}function Ke(){I?.endWithSend()||qe()}function qe(){if(n)return;let e=Ue(),r=P?.getJSON()??f$(),i=e.isTaskRunning||e.queueSubmissions,a=i?null:cZ(e.text,v,b);if(a){k(e=>({...e,error:`Unrecognized command: /${a}`,shortcutsOpen:!1})),D(null);return}let s=nZ(e,v,b),c=s??{mode:`submitted`,prompt:``,persistedPrompt:``,historyPrompt:``,action:`Plain`,command:void 0,args:void 0,items:[],elements:[],payloadElements:[],mentionBindings:[]},l=rZ(c,o);if(l){k(e=>({...e,error:l,shortcutsOpen:!1})),D(null);return}let u=new Map,d=[];for(let t of e.imageAttachments){let e=he.current.get(t.id);if(!e){k(e=>({...e,error:`Attached image is no longer available: ${t.placeholder}`,shortcutsOpen:!1})),D(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(m.Date.now()).toLocaleTimeString(),mode:i?`queued`:c.mode,prompt:c.prompt,persistedPrompt:c.persistedPrompt,action:i?e1(c,b):c.action,command:c.command,args:c.args,items:f};if(We(p))return;for(let e of u.keys())he.current.delete(e);let h=NZ(e,c.persistedPrompt),g=me.current?.(p,{editableSource:h});m1(g)&&(E.current+=1,g.then(()=>{t!==void 0&&hQ(t,null)}).catch(e=>{for(let[e,t]of u)he.current.set(e,t);t!==void 0&&hQ(t,h),te.current&&(Se(r),P?.commands.focus(`end`),k(t=>({...t,error:e instanceof Error?e.message:`Could not send prompt`})))}).finally(()=>{--E.current}));let _=s?PZ(e,c.historyPrompt):e.history;N.current=null,oe.current=[],re([]),D(null),Se(f$()),k(e=>({...e,text:``,cursor:0,elements:[],mentionBindings:[],imageAttachments:[],remoteImages:[],pendingPastes:[],selectedRemoteImageId:null,error:null,shortcutsOpen:!1,history:_,historyCursor:null}))}function Je(){if(n)return;let e=A.current.history,t=A.current.killBuffer;N.current=null,de.current=null,he.current.clear(),oe.current=T.current,re(T.current),D(null),Se(ee.current),P?.commands.focus(`end`),k(n=>({...n,history:e,historyCursor:null,killBuffer:t,reverseSearch:null,selectedRemoteImageId:null,error:null,shortcutsOpen:!1}))}function Ye(e){if(n||!P||A.current.history.length===0)return;let t=A.current,r=N.current??t.historyCursor;if(e>0&&r===0&&ue.current){Ze(ue.current,null),ue.current=null;return}let i=r===null?e<0?0:t.history.length-1:eQ(r+e,t.history.length);r===null&&(ue.current=MZ(Ue()));let a=t.history[i];Xe(a,i)}function Xe(e,t){Ze(IZ({source:e,slashCommands:v,mentionCandidates:y}),t)}function Ze(e,t){let n=e.remoteImages??[];oe.current=n,A.current={...A.current,historyCursor:t,shortcutsOpen:!1},N.current=t,le.current=t,re(n),Se(n$({state:e,slashCommands:v,mentionCandidates:y,triggers:S})),P?.commands.focus(`end`),k(e=>({...e,historyCursor:t,shortcutsOpen:!1}))}function Qe(){n||(D(null),N.current=null,de.current=Ue(),k(e=>({...e,reverseSearch:``,historyCursor:null,shortcutsOpen:!1})))}function $e(e){if(n){e.preventDefault();return}if(e.preventDefault(),e.key===`Escape`){rt(null),de.current=null;return}if(e.key===`Enter`){de.current=null,k(e=>({...e,reverseSearch:null,shortcutsOpen:!1}));return}if(e.key===`Backspace`){et(e=>e.slice(0,-1));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`r`){tt(1);return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){tt(-1);return}e.key.length===1&&!e.metaKey&&!e.altKey&&!e.ctrlKey&&et(t=>`${t}${e.key}`)}function et(e){if(n)return;let t=A.current,r=e(t.reverseSearch??``),i=XZ(t.history,r,null);if(!P||!i){rt(r);return}nt(i.entry,i.index,r)}function tt(e){if(n||!P)return;let t=A.current,r=t.reverseSearch??``,i=XZ(t.history,r,t.historyCursor,e);i&&nt(i.entry,i.index,r)}function nt(e,t,n){let r=P;if(!r)return;let i=IZ({source:e,slashCommands:v,mentionCandidates:y}),a=i.remoteImages??[];oe.current=a,re(a),Se(n$({state:i,slashCommands:v,mentionCandidates:y,triggers:S})),r.commands.focus(`end`),k(e=>({...e,historyCursor:t,reverseSearch:n,selectedRemoteImageId:null,shortcutsOpen:!1}))}function rt(e){if(n)return;let t=de.current;if(!t||!P){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};N.current=null,oe.current=r.remoteImages,re(r.remoteImages),Se(n$({state:r,slashCommands:v,mentionCandidates:y,triggers:S})),P.commands.focus(`end`),k(r)}ye.current=n?e=>(e.preventDefault(),!0):ze,ge.current=Ae;function it(e){if(!(e.target instanceof Element)||!e.target.closest(`[data-slot="composer-editor"]`))return;if(n){e.preventDefault();return}if(!P||ze(e))return;if(A.current.reverseSearch!==null){$e(e);return}if(A.current.shortcutsOpen&&e.key===`Escape`){e.preventDefault(),F();return}if(e.key===`?`&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&Ee(Ue())){e.preventDefault(),Oe();return}if(R1(e)){e.preventDefault(),P.chain().focus().setHardBreak().run(),N.current=null,D(null);return}if(se.current){if(t1(e)||n1(e)){e.preventDefault(),ot(t1(e)?-1:1);return}if(e.key===`Tab`){e.preventDefault(),we();return}if(e.key===`Enter`&&!e.shiftKey){if(e.preventDefault(),be.length===0){D(null),Ke();return}we();return}if(e.key===`Escape`){e.preventDefault(),D(null);return}}if(z1(e)){let t=B$(P);t&&(e.preventDefault(),ce.current=t,k(e=>({...e,killBuffer:t.text}))),N.current=null;return}let t=B1(e);if(t!==null){e.preventDefault(),H$(P,t),N.current=null;return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`e`){e.preventDefault(),V$(P),N.current=null;return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`){let t=R$(P);t&&(e.preventDefault(),ce.current=t,k(e=>({...e,killBuffer:t.text})));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`u`){let t=z$(P);t&&(e.preventDefault(),ce.current=t,k(e=>({...e,killBuffer:t.text})));return}if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`y`&&A.current.killBuffer){e.preventDefault(),Y$(P,ce.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`)&&H1(P)){e.preventDefault(),N.current=null,D(null);return}if((e.key===`Backspace`||e.key===`Delete`)&&X$(P,e.key)){e.preventDefault(),N.current=null;return}if((e.key===`Backspace`||e.key===`Delete`||e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey)&&(N.current=null),e.key===`Enter`&&!e.shiftKey&&!e.altKey){e.preventDefault(),Ke();return}let r=V1(e);if(r!==null&&!se.current){let t=Ue();if(e.key===`ArrowUp`&&($$(P)||t.cursor===0)&&t.remoteImages.length>0){e.preventDefault(),Ie(t.remoteImages.length-1);return}ZZ(t.text,t.cursor,r)&&(e.preventDefault(),Ye(r))}}function at(e){if(n){e.preventDefault();return}e.target instanceof Element&&e.target.closest(`[data-slot="composer-editor"]`)&&Le()}function ot(e){n||D(t=>{if(!t)return t;let n=jQ(t,v,y,a).length;return n===0?t:{...t,selectedIndex:eQ(t.selectedIndex+e,n)}})}let I=KQ({dictation:u,disabled:n,insertTranscript:Ge,submitDraft:qe});return(0,R.jsx)(AX,{value:{state:O,disabled:n,commandTriggers:b,activePopup:ie,suggestions:be,attachedImages:he.current,actions:{acceptSuggestion:we,toggleSlashMenu:Te,insertText:ke,attachImageFiles:Me,removeImageAttachment:Ne,addRemoteImage:Pe,handleDrop:Fe,insertPaste:Ve,insertRichLink:He,openShortcuts:De,closeShortcuts:F,toggleShortcuts:Oe,submit:Ke,reset:Je},meta:{editor:P}},children:(0,R.jsx)(NQ,{value:I?.api??null,children:(0,R.jsx)(`section`,{"data-slot":`composer`,className:j(`border-border bg-card relative border font-[inherit]`,c),children:(0,R.jsxs)(`div`,{onKeyDownCapture:it,onMouseDownCapture:at,children:[l,h.hasLayoutChildren?null:(0,R.jsx)(g1,{})]})})})})}function g1(){let e=(0,U.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(S1,{}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,R.jsxs)(R.Fragment,{children:[t,(0,R.jsxs)(_1,{children:[(0,R.jsx)(y1,{}),(0,R.jsx)(NX,{}),(0,R.jsx)(b1,{}),(0,R.jsx)(x1,{})]}),(0,R.jsx)(E1,{}),(0,R.jsx)(k1,{})]}),e[1]=n):n=e[1],n}function _1(e){let t=(0,U.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=j(`space-y-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function v1(e){let t=(0,U.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=j(`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,R.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function y1(e){let t=(0,U.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}=jX(`Composer.RemoteImages`);if(i.remoteImages.length===0)return null;let a;t[3]===n?a=t[4]:(a=j(`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,R.jsxs)(`div`,{className:j(`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,R.jsxs)(`span`,{className:`shrink-0`,children:[`[Image #`,t+1,`]`]}),(0,R.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,R.jsx)(`div`,{className:a,...r,children:o}),t[10]=r,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function b1(e){let t=(0,U.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}=jX(`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,R.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,R.jsx)(GW,{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,R.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 x1(e){let t=(0,U.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}=jX(`Composer.Error`);if(!i.error)return null;let a;t[3]===n?a=t[4]:(a=j(`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,R.jsx)(`div`,{role:`alert`,className:a,...r,children:i.error}),t[5]=r,t[6]=i.error,t[7]=a,t[8]=o):o=t[8],o}function S1(e){let t=(0,U.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}=jX(`Composer.Popup`),{acceptSuggestion:s}=o;if(!i)return null;let c;t[3]===a?c=t[4]:(c=a.some(C1),t[3]=a,t[4]=c);let l=c,u;t[5]===n?u=t[6]:(u=j(`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,R.jsx)(w1,{selected:t===i.selectedIndex,icon:l?e.icon:null,token:$X(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,R.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,R.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,R.jsx)(`div`,{className:u,...r,children:p}),t[21]=r,t[22]=u,t[23]=p,t[24]=m):m=t[24],m}function C1(e){return e.icon}function w1(e){let t=(0,U.c)(23),{selected:n,icon:r,token:i,takesArgs:a,description:o,onMouseDown:s}=e,c=(0,L.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,L.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=j(`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,R.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,R.jsx)(`span`,{className:`truncate`,children:i}),t[9]=i,t[10]=h);let g;t[11]===a?g=t[12]:(g=a?(0,R.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:`args`}):null,t[11]=a,t[12]=g);let _;t[13]===o?_=t[14]:(_=(0,R.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,R.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 T1=[{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 E1(e){let t=(0,U.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}=jX(`Composer.Shortcuts`),{closeShortcuts:o}=a;if(!i.shortcutsOpen||!tZ(i))return null;let s;t[3]===n?s=t[4]:(s=j(`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,R.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,R.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[c,(0,R.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,R.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:T1.map(D1)}),t[8]=u):u=t[8];let d;return t[9]!==r||t[10]!==s||t[11]!==l?(d=(0,R.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 D1(e){return(0,R.jsxs)(`div`,{className:`space-y-2`,children:[(0,R.jsx)(`div`,{className:`text-muted-foreground text-[11px]`,children:e.title}),(0,R.jsx)(`div`,{className:`space-y-1`,children:e.items.map(O1)})]},e.title)}function O1(e){let[t,n]=e;return(0,R.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,R.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:t}),(0,R.jsx)(`span`,{className:`text-muted-foreground text-right`,children:n})]},`${t}-${n}`)}function k1(e){let t=(0,U.c)(29),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}=jX(`Composer.Footer`);if(a.reverseSearch!==null){let e;t[3]===n?e=t[4]:(e=j(`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,R.jsx)(`kbd`,{className:`border-border bg-muted text-foreground rounded border px-1.5 py-0.5 font-[inherit]`,children:`Ctrl R`}),o=(0,R.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,R.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,R.jsx)(`span`,{children:`Ctrl R previous`}),u=(0,R.jsx)(`span`,{children:`Ctrl S next`}),d=(0,R.jsx)(`span`,{children:`Enter accept`}),f=(0,R.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,R.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 o;t[17]!==i||t[18]!==a.isTaskRunning||t[19]!==a.queueSubmissions?(o=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]=a.isTaskRunning,t[19]=a.queueSubmissions,t[20]=o):o=t[20];let s=o,c;t[21]===n?c=t[22]:(c=j(`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[21]=n,t[22]=c);let l;t[23]===s?l=t[24]:(l=s.map(A1),t[23]=s,t[24]=l);let u;return t[25]!==r||t[26]!==c||t[27]!==l?(u=(0,R.jsx)(`div`,{className:c,...r,children:l}),t[25]=r,t[26]=c,t[27]=l,t[28]=u):u=t[28],u}function A1(e){let[t,n]=e;return(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,R.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 j1(e){let t=(0,U.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}=jX(`Composer.AttachFiles`),u=(0,L.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,R.jsx)(L1,{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,R.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,R.jsxs)(R.Fragment,{children:[f,h]}),t[16]=f,t[17]=h,t[18]=g):g=t[18],g}function M1(e){let t=(0,U.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}=jX(`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,R.jsx)(L1,{action:a,...n}),t[6]=n,t[7]=a,t[8]=o):o=t[8],o}function N1(e){let t=(0,U.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}=jX(`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,R.jsx)(L1,{action:a,...r}),t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function P1(e){let t=(0,U.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}=jX(`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,R.jsx)(L1,{action:s,...a}),t[10]=a,t[11]=s,t[12]=c):c=t[12],c}function F1(e){let t=(0,U.c)(3),{actions:n}=jX(`Composer.Submit`),r;return t[0]!==n.submit||t[1]!==e?(r=(0,R.jsx)(L1,{action:n.submit,...e}),t[0]=n.submit,t[1]=e,t[2]=r):r=t[2],r}function I1(e){let t=(0,U.c)(3),{actions:n}=jX(`Composer.Reset`),r;return t[0]!==n.reset||t[1]!==e?(r=(0,R.jsx)(L1,{action:n.reset,...e}),t[0]=n.reset,t[1]=e,t[2]=r):r=t[2],r}function L1(e){let t=(0,U.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}=jX(`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,R.jsx)(St,{...a,disabled:s,onClick:c}),t[8]=a,t[9]=s,t[10]=c,t[11]=l):l=t[11],l}function R1(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 z1(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 B1(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 V1(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 H1(e){let{doc:t,selection:n}=e.state;return n.empty||n.from>1||n.to<t.content.size-1?!1:(e.commands.setContent(f$(),{emitUpdate:!0}),e.commands.focus(`start`),e.commands.setTextSelection(1),!0)}var U1={Root:p1,Trigger:SQ,Command:CQ,Mention:wQ,Content:_1,Toolbar:v1,RemoteImages:y1,Attachments:NX,Editor:b1,Error:x1,Popup:S1,Shortcuts:E1,Footer:k1,AttachFiles:j1,AddRemoteImage:M1,InsertPaste:N1,InsertRichLink:P1,Dictate:IQ,CancelDictation:LQ,Submit:F1,Reset:I1};function W1(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 G1(e){let t=(0,U.c)(6),{text:n}=e,r,i;if(t[0]!==n){let e=KA(n);r=J1,i=e.map(K1),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,R.jsx)(`span`,{onCopy:r,children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function K1(e){switch(e.kind){case`text`:return e.value;case`inline-code`:return(0,R.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,R.jsx)(`span`,{"data-persisted-source":e.source,className:`bg-muted my-2 block overflow-x-auto rounded-md px-3 py-2`,children:(0,R.jsx)(`code`,{className:`font-mono text-[0.9em]`,children:e.value})},e.start);case`skill-link`:return(0,R.jsx)(q1,{name:e.name,source:e.source,skillId:e.skillId,title:e.href},e.start);case`standalone-skill`:return(0,R.jsx)(q1,{name:e.name,source:e.source},e.start);case`mention`:return(0,R.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,R.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 q1(e){let t=(0,U.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,R.jsx)(ln,{"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,R.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,R.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 J1(e){let t=W1(e.currentTarget,window.getSelection());t!==null&&(e.clipboardData.setData(`text/plain`,t),e.preventDefault())}var Y1=typeof global==`object`&&global&&global.Object===Object&&global,X1=typeof self==`object`&&self&&self.Object===Object&&self,Z1=Y1||X1||Function(`return this`)(),Q1=Z1.Symbol,$1=Object.prototype,e0=$1.hasOwnProperty,t0=$1.toString,n0=Q1?Q1.toStringTag:void 0;function r0(e){var t=e0.call(e,n0),n=e[n0];try{e[n0]=void 0;var r=!0}catch{}var i=t0.call(e);return r&&(t?e[n0]=n:delete e[n0]),i}var i0=Object.prototype.toString;function a0(e){return i0.call(e)}var o0=`[object Null]`,s0=`[object Undefined]`,c0=Q1?Q1.toStringTag:void 0;function l0(e){return e==null?e===void 0?s0:o0:c0&&c0 in Object(e)?r0(e):a0(e)}function u0(e){return typeof e==`object`&&!!e}var d0=`[object Symbol]`;function f0(e){return typeof e==`symbol`||u0(e)&&l0(e)==d0}function p0(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}var m0=Array.isArray,h0=1/0,g0=Q1?Q1.prototype:void 0,_0=g0?g0.toString:void 0;function v0(e){if(typeof e==`string`)return e;if(m0(e))return p0(e,v0)+``;if(f0(e))return _0?_0.call(e):``;var t=e+``;return t==`0`&&1/e==-h0?`-0`:t}function y0(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var b0=`[object AsyncFunction]`,x0=`[object Function]`,S0=`[object GeneratorFunction]`,C0=`[object Proxy]`;function w0(e){if(!y0(e))return!1;var t=l0(e);return t==x0||t==S0||t==b0||t==C0}var T0=Z1[`__core-js_shared__`],E0=function(){var e=/[^.]+$/.exec(T0&&T0.keys&&T0.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function D0(e){return!!E0&&E0 in e}var O0=Function.prototype.toString;function k0(e){if(e!=null){try{return O0.call(e)}catch{}try{return e+``}catch{}}return``}var A0=/[\\^$.*+?()[\]{}|]/g,j0=/^\[object .+?Constructor\]$/,M0=Function.prototype,N0=Object.prototype,P0=M0.toString,F0=N0.hasOwnProperty,I0=RegExp(`^`+P0.call(F0).replace(A0,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function L0(e){return!y0(e)||D0(e)?!1:(w0(e)?I0:j0).test(k0(e))}function R0(e,t){return e?.[t]}function z0(e,t){var n=R0(e,t);return L0(n)?n:void 0}function B0(e,t){return e===t||e!==e&&t!==t}var V0=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,H0=/^\w*$/;function U0(e,t){if(m0(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||f0(e)?!0:H0.test(e)||!V0.test(e)||t!=null&&e in Object(t)}var W0=z0(Object,`create`);function G0(){this.__data__=W0?W0(null):{},this.size=0}function K0(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var q0=`__lodash_hash_undefined__`,J0=Object.prototype.hasOwnProperty;function Y0(e){var t=this.__data__;if(W0){var n=t[e];return n===q0?void 0:n}return J0.call(t,e)?t[e]:void 0}var X0=Object.prototype.hasOwnProperty;function Z0(e){var t=this.__data__;return W0?t[e]!==void 0:X0.call(t,e)}var Q0=`__lodash_hash_undefined__`;function $0(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=W0&&t===void 0?Q0:t,this}function e2(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}e2.prototype.clear=G0,e2.prototype.delete=K0,e2.prototype.get=Y0,e2.prototype.has=Z0,e2.prototype.set=$0;function t2(){this.__data__=[],this.size=0}function n2(e,t){for(var n=e.length;n--;)if(B0(e[n][0],t))return n;return-1}var r2=Array.prototype.splice;function i2(e){var t=this.__data__,n=n2(t,e);return n<0?!1:(n==t.length-1?t.pop():r2.call(t,n,1),--this.size,!0)}function a2(e){var t=this.__data__,n=n2(t,e);return n<0?void 0:t[n][1]}function o2(e){return n2(this.__data__,e)>-1}function s2(e,t){var n=this.__data__,r=n2(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function c2(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}c2.prototype.clear=t2,c2.prototype.delete=i2,c2.prototype.get=a2,c2.prototype.has=o2,c2.prototype.set=s2;var l2=z0(Z1,`Map`);function u2(){this.size=0,this.__data__={hash:new e2,map:new(l2||c2),string:new e2}}function d2(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function f2(e,t){var n=e.__data__;return d2(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function p2(e){var t=f2(this,e).delete(e);return this.size-=+!!t,t}function m2(e){return f2(this,e).get(e)}function h2(e){return f2(this,e).has(e)}function g2(e,t){var n=f2(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function _2(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}_2.prototype.clear=u2,_2.prototype.delete=p2,_2.prototype.get=m2,_2.prototype.has=h2,_2.prototype.set=g2;var v2=`Expected a function`;function y2(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(v2);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(y2.Cache||_2),n}y2.Cache=_2;var b2=500;function x2(e){var t=y2(e,function(e){return n.size===b2&&n.clear(),e}),n=t.cache;return t}var S2=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,C2=/\\(\\)?/g,w2=x2(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(S2,function(e,n,r,i){t.push(r?i.replace(C2,`$1`):n||e)}),t});function T2(e){return e==null?``:v0(e)}function E2(e,t){return m0(e)?e:U0(e,t)?[e]:w2(T2(e))}var D2=1/0;function O2(e){if(typeof e==`string`||f0(e))return e;var t=e+``;return t==`0`&&1/e==-D2?`-0`:t}function k2(e,t){t=E2(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[O2(t[n++])];return n&&n==r?e:void 0}function A2(e,t,n){var r=e==null?void 0:k2(e,t);return r===void 0?n:r}function j2(e){if(!e)return{};let t={...e};return delete t.whenNullish,delete t.locale,t}function M2(e,t){return e==null||Number.isNaN(e)?t?.whenNullish??`—`:new Intl.NumberFormat(t?.locale??`en-US`,j2(t)).format(e)}var N2=M2;function P2(e,t){return M2(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 F2;(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`})(F2||={});var I2=[9,11,12,F2.space,F2.nonBreakingSpace,F2.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],L2=new Uint8Array(65536);for(let e of I2)L2[e]=1;function R2(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 z2=new Uint8Array(65536);for(let e=0;e<128;e++)z2[e]=+!!R2(e);for(let e=128;e<65536;e++)z2[e]=1;for(let e of I2)z2[e]=0;z2[8232]=0,z2[8233]=0;var B2=z2.slice();for(let e=F2.digit0;e<=F2.digit9;e++)B2[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 V2;(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`})(V2||={});var H2;(function(e){e[e.NoChildren=0]=`NoChildren`,e[e.OneChild=1]=`OneChild`,e[e.StaticChildren=2]=`StaticChildren`,e[e.KeyAfterPropSpread=3]=`KeyAfterPropSpread`})(H2||={});var U2=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,W2=new Uint8Array(64),G2=new Uint8Array(128);for(let e=0;e<U2.length;e++){let t=U2.charCodeAt(e);W2[e]=t,G2[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 K2=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}()})),q2=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=K2(),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 k||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 te(e,t.ttype,!0):new te(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 te=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TProp=te;function ne(e){return new re(new O([...arguments].slice(1)),i(e))}e.func=ne;var re=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=re;function ie(e,t,n){return new D(e,i(t),!!n)}e.param=ie;var D=function(){function e(e,t,n){this.name=e,this.ttype=t,this.isOpt=n}return e}();e.TParam=D;var O=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=O;var k=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=k,e.basicTypes={any:new k(function(e){return!0},`is invalid`),number:new k(function(e){return typeof e==`number`},`is not a number`),object:new k(function(e){return typeof e==`object`&&e},`is not an object`),boolean:new k(function(e){return typeof e==`boolean`},`is not a boolean`),string:new k(function(e){return typeof e==`string`},`is not a string`),symbol:new k(function(e){return typeof e==`symbol`},`is not a symbol`),void:new k(function(e){return e==null},`is not void`),undefined:new k(function(e){return e===void 0},`is not undefined`),null:new k(function(e){return e===null},`is not null`),never:new k(function(e){return!1},`is unexpected`),Date:new k(ae(`[object Date]`),`is not a Date`),RegExp:new k(ae(`[object RegExp]`),`is not a RegExp`)};var A=Object.prototype.toString;function ae(e){return function(t){return typeof t==`object`&&t&&A.call(t)===e}}typeof Buffer<`u`&&(e.basicTypes.Buffer=new k(function(e){return Buffer.isBuffer(e)},`is not a Buffer`));for(var oe=function(t){e.basicTypes[t.name]=new k(function(e){return e instanceof t},`is not a `+t.name)},se=0,j=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];se<j.length;se++){var ce=j[se];oe(ce)}})),J2=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=q2(),r=K2(),i=q2();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=K2();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}))()),Y2={Transform:J2.union(J2.lit(`jsx`),J2.lit(`typescript`),J2.lit(`flow`),J2.lit(`imports`),J2.lit(`react-hot-loader`),J2.lit(`jest`)),SourceMapOptions:J2.iface([],{compiledFilename:`string`}),Options:J2.iface([],{transforms:J2.array(`Transform`),disableESTransforms:J2.opt(`boolean`),jsxRuntime:J2.opt(J2.union(J2.lit(`classic`),J2.lit(`automatic`),J2.lit(`preserve`))),production:J2.opt(`boolean`),jsxImportSource:J2.opt(`string`),jsxPragma:J2.opt(`string`),jsxFragmentPragma:J2.opt(`string`),keepUnusedImports:J2.opt(`boolean`),preserveDynamicImport:J2.opt(`boolean`),injectCreateRequireForImportRequire:J2.opt(`boolean`),enableLegacyTypeScriptModuleInterop:J2.opt(`boolean`),enableLegacyBabel5ModuleInterop:J2.opt(`boolean`),sourceMapOptions:J2.opt(`SourceMapOptions`),filePath:J2.opt(`string`)})},{Options:X2}=(0,J2.createCheckers)(Y2),Z2;(function(e){e[e.TSFunctionType=0]=`TSFunctionType`,e[e.TSConstructorType=1]=`TSConstructorType`,e[e.TSAbstractConstructorType=2]=`TSAbstractConstructorType`})(Z2||={}),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 Q2=`pending-chat-prefill`;function $2(){try{let e=sessionStorage.getItem(Q2);return e?JSON.parse(e):null}catch{return sessionStorage.removeItem(Q2),null}}function e4(e){sessionStorage.setItem(Q2,JSON.stringify(e))}function t4(){sessionStorage.removeItem(Q2)}var n4=class{chat;listeners=new Set;_queue=[];_queueEnabled;uploadFile;submissions=new Cp;onResetChat;constructor(e){this.chat=e.chat,this._queueEnabled=e.queueEnabled??!0,this.uploadFile=e.uploadFile,this.onResetChat=e.onResetChat}bind(e){this.chat=e}initialize(e){e&&this.consumePrefill(e)}submit(e){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._queueEnabled){this._queue=[...this._queue,{id:crypto.randomUUID(),...e}],this.notify();return}this.directSubmit(e)}directSubmit(e){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.setMessages([]),this.clearQueue(),this.notify()}setChat(e){this.chat.setMessages(e),this.notify()}stop(){this.chat.stop()}resetChat(e){let t=crypto.randomUUID();e&&e4({prompt:e,targetChatId:t}),this.onResetChat(t)}consumePrefill(e){let t=$2();!t||t.targetChatId!==e||(t4(),this.submit({prompt:t.prompt,persistedPrompt:t.prompt}))}getTriggeringUserMessage(e){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(){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(){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}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});notify(){for(let e of this.listeners)e()}};async function r4(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 i4(e){let t=sm({id:e.chatId,messages:e.initialMessages,transport:e.transport,throttle:50,resume:e.resume,onData:e.onData,onFinish:e.onFinish,sendAutomaticallyWhen:a4,onToolCall(n){let{toolCall:r}=n;r4(t,e.registry,r)}});return t}function a4(e){return Xp(e)||Yp(e)}function o4(e){let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(s4,{...e}),t[0]=e,t[1]=n),n}function s4(e){let t=(0,U.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}=lT(n),{hasSubmitted:a}=x4(),o;t[1]===e.className?o=t[2]:(o=j(`@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=j(`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,R.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,R.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 c4(e){let t=(0,U.c)(12),{hasSubmitted:n}=x4(),r;t[0]!==n||t[1]!==e.className?(r=j(n?j(`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=j(a),t[4]=a,t[5]=o);let s;t[6]!==e.children||t[7]!==o?(s=(0,R.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,R.jsx)(rT.div,{layout:!0,className:r,transition:i,children:s}),t[9]=r,t[10]=s,t[11]=c):c=t[11],c}c4.displayName=`AgentHeader.Root`;function l4(e){let t=(0,U.c)(6),{hasSubmitted:n}=x4(),r;t[0]!==n||t[1]!==e.children||t[2]!==e.icon?(r=!n&&(0,R.jsx)(rT.div,{exit:{opacity:0},transition:{duration:.2},children:(0,R.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,R.jsx)($S,{mode:`sync`,children:r}),t[4]=r,t[5]=i),i}l4.displayName=`AgentHeader.Hero`;function u4(e){let t=(0,U.c)(2),n;return t[0]===e.children?n=t[1]:(n=(0,R.jsx)(rT.h2,{layout:`position`,className:`text-muted-foreground text-sm font-medium`,children:e.children}),t[0]=e.children,t[1]=n),n}u4.displayName=`AgentHeader.Title`;function d4(e){let t=(0,U.c)(5),{hasSubmitted:n}=x4(),r;t[0]!==n||t[1]!==e.children?(r=n&&!!e.children&&(0,R.jsx)(rT.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,R.jsx)($S,{children:r}),t[3]=r,t[4]=i),i}d4.displayName=`AgentHeader.Description`;var f4={Root:c4,Hero:l4,Title:u4,Description:d4},p4=(0,L.createContext)(void 0),m4=(0,L.createContext)(`ready`),h4=(0,L.createContext)(void 0),g4=(0,L.createContext)(null),_4=(0,L.createContext)(void 0);function v4({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=i4({chatId:e,transport:o,registry:i,initialMessages:a,resume:s,onData:c,onFinish:l}),[p,m]=(0,L.useState)(r),h=(0,L.useCallback)(()=>m(e=>!e),[]),g=(0,L.useRef)(u);(0,L.useEffect)(()=>{g.current=u},[u]);let _=(0,L.useCallback)(e=>{g.current(e)},[]),[v]=(0,L.useState)(()=>new n4({chat:f,queueEnabled:d,uploadFile:o.uploadFile.bind(o),onResetChat:_}));v.bind(f);let y=(0,L.useSyncExternalStore)(v.subscribe,()=>v.queue,()=>v.queue);(0,L.useEffect)(()=>{v.initialize(e)},[v,e]),(0,L.useEffect)(()=>{v.processQueue(y)},[v,f.status,y]);let b=(0,L.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,L.useMemo)(()=>({chatId:e,registry:i,debugMode:p,toggleDebugMode:h,...b}),[e,i,p,h,b]),S=(0,L.useMemo)(()=>f,[f.id,f.messages,f.status,f.error]),C=!!n||f.messages.length>0,w=(0,L.useMemo)(()=>({hasSubmitted:C}),[C]);return(0,R.jsx)(g4,{value:v,children:(0,R.jsx)(p4,{value:x,children:(0,R.jsx)(m4,{value:f.status,children:(0,R.jsx)(h4,{value:S,children:(0,R.jsx)(_4,{value:w,children:t})})})})})}function y4(){let e=(0,L.use)(p4);if(e===void 0)throw Error(`useAgent must be used within an AgentProvider`);return e}function b4(){return{status:(0,L.use)(m4)}}function x4(){let e=(0,L.use)(_4);if(e===void 0)throw Error(`useAgentMeta must be used within an AgentProvider`);return e}function S4(){let e=(0,L.use)(h4);if(e===void 0)throw Error(`useAgentMessages must be used within an AgentProvider`);return e}function C4(){let e=(0,L.use)(g4);if(!e)throw Error(`useChatManager must be used within an AgentProvider`);return e}function w4(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 T4(e,t){let n=e.findIndex(e=>e.url===t);return n===-1?null:n+1}function E4(e,t){return t===`streaming`||t===`submitted`?!1:e===`input-streaming`||e===`input-available`}function D4(e,t){return E4(e.state,t)}function O4(e){return Object.entries(e).reduce((e,[t,n])=>(n.static||(e[t]={inputSchema:ye(n.inputSchema,{io:`input`,unrepresentable:`any`}),description:n.description}),e),{})}function k4(e){let t=(0,U.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=j(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,R.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 A4(e){let t=(0,U.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=j(`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,R.jsx)(NT,{"aria-hidden":!0,className:r}),t[2]=r,t[3]=i),i}function j4(e){return j(`group hover:bg-muted/30 flex min-h-7 w-full gap-2 rounded-sm py-1 text-left transition-colors`,e)}(0,L.createContext)(null);var M4=(0,L.createContext)(void 0),N4=(0,L.createContext)(void 0);function P4(){let e=(0,L.use)(M4);if(!e)throw Error(`useMessagesContext must be used within <Messages>`);return e}function F4(){let e=(0,L.use)(M4),{status:t}=b4();return e?.status??t}function I4(){let e=(0,L.use)(N4);if(!e)throw Error(`useMessageItem must be used within <Messages.Item>`);return e}function L4(e){let t=(0,U.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,R.jsx)(`sup`,{className:`ml-0.5 inline-block`,children:(0,R.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}function R4(e){let t=(0,U.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({ref:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=j(`border-border bg-background relative min-w-0 gap-0 overflow-visible rounded-md border py-0 text-sm/normal ring-0`,n),t[4]=n,t[5]=a);let o;return t[6]!==r||t[7]!==i||t[8]!==a?(o=(0,R.jsx)(Pn,{ref:i,"data-slot":`table-panel`,size:`default`,className:a,...r}),t[6]=r,t[7]=i,t[8]=a,t[9]=o):o=t[9],o}R4.displayName=`TablePanel.Root`;function z4(e){let t=(0,U.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=j(`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,R.jsx)(Fn,{"data-slot":`table-panel-header`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function B4(e){let t=(0,U.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=j(`min-w-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{"data-slot":`table-panel-heading`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function V4(e){let t=(0,U.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=j(`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,R.jsx)(In,{"data-slot":`table-panel-title`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function H4(e){let t=(0,U.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=j(`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,R.jsx)(Ln,{"data-slot":`table-panel-description`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function U4(e){let t=(0,U.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=j(`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,R.jsx)(Rn,{"data-slot":`table-panel-actions`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function W4(e){let t=(0,U.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=j(`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,R.jsx)(zn,{"data-slot":`table-panel-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var G4=Object.assign(R4,{Header:z4,Heading:B4,Title:V4,Description:H4,Actions:U4,Content:W4}),K4=/<\w[\w-]*(?:"(?:\\.|[^"])*"|[^>"])*>/g,q4=/\b([\w-]+)="((?:\\.|[^"])*)"/g;function J4(e){return e.replace(K4,e=>e.replace(q4,(e,t,n)=>`${t}="${n.replace(/\\"/g,`"`)}"`))}function Y4(e,t){if(typeof e!=`string`)return e;let n=J4(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
|
+
|
|
3505
|
+
<`),X4(n,t)}function X4(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=Z4(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=Q4(e,c+1,s);if(!l){if(n){let n=e.slice(o,c+1),r=X4(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=X4(d,t,!0);n?a+=`<div>`+u+p+f+`</div>`:a=$4(a)+`<div>`+u+p+f+`</div>`,o=l.end}return a}function Z4(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 Q4(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=Z4(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=Z4(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=Z4(e,t);i=n<0?t+1:n+1}else i=t+1}return null}function $4(e){return e.length===0?`
|
|
3506
3506
|
|
|
3507
3507
|
`:e.endsWith(`
|
|
3508
3508
|
|
|
@@ -3510,14 +3510,14 @@ img.ProseMirror-separator {
|
|
|
3510
3510
|
`)?e+`
|
|
3511
3511
|
`:e+`
|
|
3512
3512
|
|
|
3513
|
-
`}var o3=`response-table-panel`,s3=[`title`,`description`],c3=j($e({variant:`ghost`,size:`icon-sm`})),l3=Bt().use(Jt).use(Kt).use(GE),u3=e=>{let t=Xt(e),n=p3(e);if(n.length===0)return t;let r=0,i=t.map(e=>{let t={start:r,end:r+e.length};return r=t.end,t}),a=new Set;for(let e of n){let t=!1;for(let[n,r]of i.entries())r.start<e.end&&r.end>e.start&&(t&&a.add(n),t=!0)}return t.reduce((e,t,n)=>(a.has(n)&&e.length>0?e[e.length-1]+=t:e.push(t),e),[])};function d3(e){return e?.type===`leafDirective`&&`name`in e&&e.name===`table`}function f3(e,t){if(t===void 0)return;let n=e[t-1];return d3(n)?n:void 0}function p3(e){let t=[];return Qt(l3.parse(e),`table`,(e,n,r)=>{if(!r)return;let i=f3(r.children,n)?.position?.start.offset,a=e.position?.end.offset;i!==void 0&&a!==void 0&&t.push({start:i,end:a})}),t}function m3(e,t){return e.attributes?.[t]?.trim()||void 0}function h3(e){let t=l3.parse(e),n=!1;if(Qt(t,`leafDirective`,(e,t,r)=>{let i=t===void 0?void 0:r?.children[t+1];if(e.name!==`table`||i?.type!==`table`)return;n=!0;let a=[m3(e,`title`),m3(e,`description`)].filter(Boolean).join(` `);e.children=a?[{type:`text`,value:a}]:[]}),n)return Ut(It(t,{includeHtml:!1}))}function g3(e){let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(Gt,{...e}),t[0]=e,t[1]=n),n}function _3(e){function t(t){let n=(0,U.c)(6),r;n[0]!==t.content||n[1]!==t.dir?(r=h3(t.content)??t.dir,n[0]=t.content,n[1]=t.dir,n[2]=r):r=n[2];let i=r,a;return n[3]!==i||n[4]!==t?(a=(0,R.jsx)(e,{...t,dir:i}),n[3]=i,n[4]=t,n[5]=a):a=n[5],a}return t.displayName=`DirectionAwareTableBlock`,t}function v3(e,t){let n=t&&m3(t,`title`),r=t&&m3(t,`description`),i={...n?{title:n}:{},...r?{description:r}:{}};return{type:`tablePanel`,data:{hName:o3,...Object.keys(i).length>0?{hProperties:i}:{}},children:[e]}}function y3(){return e=>{Qt(e,`table`,(e,t,n)=>{if(t===void 0||!n)return;let r=f3(n.children,t),i=r?t-1:t,a=r?2:1;return n.children.splice(i,a,v3(e,r)),[Ft,i+1]})}}var b3=[...Object.values(Yt),GE,y3],x3=L.createContext({actions:null,controls:!0});function S3(e,t){if(e===!1)return!1;if(e===!0||e===void 0)return!0;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1}function C3(e){return e===!1?!1:e===!0||e===void 0?{table:!1}:{...e,table:!1}}function w3(e){let t=(0,U.c)(21),{children:n,className:r,title:i,description:a}=e,{actions:o,controls:s}=L.use(x3),c;t[0]===s?c=t[1]:(c=S3(s,`copy`),t[0]=s,t[1]=c);let l=c,u;t[2]===s?u=t[3]:(u=S3(s,`download`),t[2]=s,t[3]=u);let d=u,f=!!(i||a),p=!!(l||d||o);if(!n)return null;let m;t[4]===r?m=t[5]:(m=j(`my-4`,r),t[4]=r,t[5]=m);let h;t[6]!==o||t[7]!==a||t[8]!==p||t[9]!==f||t[10]!==l||t[11]!==d||t[12]!==i?(h=(f||p)&&(0,R.jsxs)(Z4.Header,{className:j(!f&&`justify-end`),children:[f&&(0,R.jsxs)(Z4.Heading,{children:[i&&(0,R.jsx)(Z4.Title,{children:i}),a&&(0,R.jsx)(Z4.Description,{className:j(i&&`mt-1`),children:a})]}),p&&(0,R.jsxs)(Z4.Actions,{"data-copy-exclude":`assistant-snapshot`,children:[l&&(0,R.jsx)(Lt,{className:c3}),d&&(0,R.jsx)(qt,{className:c3}),o]})]}),t[6]=o,t[7]=a,t[8]=p,t[9]=f,t[10]=l,t[11]=d,t[12]=i,t[13]=h):h=t[13];let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=j(`overflow-hidden`,`[&>[data-streamdown=table-wrapper]]:m-0 [&>[data-streamdown=table-wrapper]]:gap-0 [&>[data-streamdown=table-wrapper]]:rounded-none [&>[data-streamdown=table-wrapper]]:border-0 [&>[data-streamdown=table-wrapper]]:bg-transparent [&>[data-streamdown=table-wrapper]]:p-0`,`[&>[data-streamdown=table-wrapper]>div:last-child]:rounded-none [&>[data-streamdown=table-wrapper]>div:last-child]:border-0`,`[&_[data-streamdown=table]]:tabular-nums`,`[&_[data-streamdown=table-header]]:bg-muted/30`,`[&_[data-streamdown=table-header-cell]]:text-muted-foreground [&_[data-streamdown=table-header-cell]]:text-xs [&_[data-streamdown=table-header-cell]]:font-medium`,`[&_[data-streamdown=table-cell]]:py-2`,`[&_[data-streamdown=table-row]]:hover:bg-muted/30`),t[14]=g):g=t[14];let _;t[15]===n?_=t[16]:(_=(0,R.jsx)(Z4.Content,{className:g,children:n}),t[15]=n,t[16]=_);let v;return t[17]!==m||t[18]!==h||t[19]!==_?(v=(0,R.jsxs)(Z4,{"data-streamdown":`table-wrapper`,className:m,children:[h,_]}),t[17]=m,t[18]=h,t[19]=_,t[20]=v):v=t[20],v}function T3(e){let t=(0,U.c)(43),n,r,i,a,o,s,c,l,u,d;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10]):({allowedTags:r,BlockComponent:n,children:i,components:a,controls:o,dir:s,mode:c,remarkPlugins:u,tableActions:d,...l}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d);let f;bb0:{if(!u){f=b3;break bb0}let e;t[11]===u?e=t[12]:(e=[...u,GE,y3],t[11]=u,t[12]=e),f=e}let p=f,m;t[13]===r?m=t[14]:(m={...r,[o3]:s3},t[13]=r,t[14]=m);let h=m,g;t[15]===a?g=t[16]:(g={...a,[o3]:w3},t[15]=a,t[16]=g);let _=g,v;t[17]!==o||t[18]!==d?(v={actions:d,controls:o},t[17]=o,t[18]=d,t[19]=v):v=t[19];let y=v,b;bb1:{if(s!==`auto`||c===`static`){b=n;break bb1}let e=n??g3,r;t[20]===e?r=t[21]:(r=_3(e),t[20]=e,t[21]=r),b=r}let x=b,S;bb2:{if(s!==`auto`||c!==`static`||typeof i!=`string`){S=s;break bb2}let e;t[22]!==i||t[23]!==s?(e=h3(i)??s,t[22]=i,t[23]=s,t[24]=e):e=t[24],S=e}let C=S,w;t[25]===o?w=t[26]:(w=C3(o),t[25]=o,t[26]=w);let T;t[27]!==i||t[28]!==h?(T=t3(i,Object.keys(h)),t[27]=i,t[28]=h,t[29]=T):T=t[29];let ee;t[30]!==c||t[31]!==l||t[32]!==C||t[33]!==w||t[34]!==T||t[35]!==h||t[36]!==x||t[37]!==_||t[38]!==p?(ee=(0,R.jsx)(zt,{allowedTags:h,BlockComponent:x,components:_,controls:w,dir:C,mode:c,parseMarkdownIntoBlocksFn:u3,remarkPlugins:p,...l,children:T}),t[30]=c,t[31]=l,t[32]=C,t[33]=w,t[34]=T,t[35]=h,t[36]=x,t[37]=_,t[38]=p,t[39]=ee):ee=t[39];let E;return t[40]!==ee||t[41]!==y?(E=(0,R.jsx)(x3,{value:y,children:ee}),t[40]=ee,t[41]=y,t[42]=E):E=t[42],E}var E3=class extends L.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?this.props.fallback||(0,R.jsxs)(`div`,{className:`text-destructive p-2 text-sm`,children:[`Failed to render content: `,this.state.error?.message]}):this.props.children}},D3=(0,L.memo)(e=>{let t=(0,U.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=j(`size-full space-y-2 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(E3,{children:(0,R.jsx)(T3,{className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a});D3.displayName=`Response`;function O3(e){let t=(0,U.c)(9),n=e===void 0?2e3:e,r=ae(),[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s,c;t[0]===r?(s=t[1],c=t[2]):(s=()=>()=>{o.current&&r.clearTimeout(o.current)},c=[r],t[0]=r,t[1]=s,t[2]=c),(0,L.useEffect)(s,c);let l;t[3]!==r||t[4]!==n?(l=async e=>{await navigator.clipboard.writeText(e),a(!0),o.current&&r.clearTimeout(o.current),o.current=r.setTimeout(()=>a(!1),n)},t[3]=r,t[4]=n,t[5]=l):l=t[5];let u=l,d;return t[6]!==i||t[7]!==u?(d=[i,u],t[6]=i,t[7]=u,t[8]=d):d=t[8],d}var k3=(0,L.createContext)({code:``}),A3=e=>{let t=(0,U.c)(41),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({code:i,language:a,showLineNumbers:s,wrap:c,className:r,children:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=s!==void 0&&s,u=c!==void 0&&c,d;t[8]===i?d=t[9]:(d={code:i},t[8]=i,t[9]=d);let f;t[10]===r?f=t[11]:(f=j(`bg-background text-foreground relative w-full overflow-hidden rounded-md border`,r),t[10]=r,t[11]=f);let p,m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={className:`font-mono text-xs`},m={margin:0,padding:`0.5rem`,fontSize:`0.75rem`,background:`hsl(var(--background))`,color:`hsl(var(--foreground))`},t[12]=p,t[13]=m):(p=t[12],m=t[13]);let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h={color:`hsl(var(--muted-foreground))`,paddingRight:`1rem`,minWidth:`2.5rem`},t[14]=h):h=t[14];let g;t[15]!==i||t[16]!==a||t[17]!==l||t[18]!==u?(g=(0,R.jsx)(ND,{className:`overflow-hidden dark:hidden`,codeTagProps:p,customStyle:m,language:a,lineNumberStyle:h,showLineNumbers:l,style:FD,wrapLongLines:u,children:i}),t[15]=i,t[16]=a,t[17]=l,t[18]=u,t[19]=g):g=t[19];let _,v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v={className:`font-mono text-xs`},_={margin:0,padding:`0.5rem`,fontSize:`0.75rem`,background:`hsl(var(--background))`,color:`hsl(var(--foreground))`},t[20]=_,t[21]=v):(_=t[20],v=t[21]);let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y={color:`hsl(var(--muted-foreground))`,paddingRight:`1rem`,minWidth:`2.5rem`},t[22]=y):y=t[22];let b;t[23]!==i||t[24]!==a||t[25]!==l||t[26]!==u?(b=(0,R.jsx)(ND,{className:`hidden overflow-hidden dark:block`,codeTagProps:v,customStyle:_,language:a,lineNumberStyle:y,showLineNumbers:l,style:PD,wrapLongLines:u,children:i}),t[23]=i,t[24]=a,t[25]=l,t[26]=u,t[27]=b):b=t[27];let x;t[28]===n?x=t[29]:(x=!!n&&(0,R.jsx)(`div`,{className:`absolute top-1 right-1 flex items-center gap-1`,children:n}),t[28]=n,t[29]=x);let S;t[30]!==b||t[31]!==x||t[32]!==g?(S=(0,R.jsxs)(`div`,{className:`relative`,children:[g,b,x]}),t[30]=b,t[31]=x,t[32]=g,t[33]=S):S=t[33];let C;t[34]!==o||t[35]!==S||t[36]!==f?(C=(0,R.jsx)(`div`,{className:f,...o,children:S}),t[34]=o,t[35]=S,t[36]=f,t[37]=C):C=t[37];let w;return t[38]!==C||t[39]!==d?(w=(0,R.jsx)(k3,{value:d,children:C}),t[38]=C,t[39]=d,t[40]=w):w=t[40],w},j3=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...a})=>{let[o,s]=O3(n),{code:c}=(0,L.use)(k3),l=async()=>{if(typeof window>`u`||!navigator.clipboard.writeText){t?.(Error(`Clipboard API not available`));return}try{await s(c),e?.()}catch(e){t?.(e instanceof Error?e:Error(String(e)))}},u=o?AT:RT;return(0,R.jsx)(tt,{className:j(`shrink-0`,i),onClick:()=>void l(),size:`icon`,variant:`ghost`,...a,children:r??(0,R.jsx)(u,{size:14})})},M3=e=>{let t=(0,U.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=j(`not-prose mb-4 w-full rounded-md border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(dr,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},N3=e=>(0,R.jsxs)(we,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,R.jsx)(IT,{className:`size-4`}),"input-available":(0,R.jsx)(LT,{className:`size-4 animate-pulse`}),"approval-requested":(0,R.jsx)(LT,{className:`size-4 text-yellow-600`}),"approval-responded":(0,R.jsx)(PT,{className:`size-4 text-blue-600`}),"output-available":(0,R.jsx)(PT,{className:`size-4 text-green-600`}),"output-error":(0,R.jsx)(FT,{className:`size-4 text-red-600`}),"output-denied":(0,R.jsx)(FT,{className:`size-4 text-orange-600`})}[e],{"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`}[e]]}),P3=e=>{let t=(0,U.c)(24),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,title:a,type:o,state:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===n?s=t[7]:(s=j(`group flex w-full items-center justify-between gap-4 p-3`,n),t[6]=n,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,R.jsx)(YT,{className:`text-muted-foreground size-4`}),t[8]=c):c=t[8];let l;t[9]!==a||t[10]!==o?(l=a??o.split(`-`).slice(1).join(`-`),t[9]=a,t[10]=o,t[11]=l):l=t[11];let u;t[12]===l?u=t[13]:(u=(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:l}),t[12]=l,t[13]=u);let d;t[14]===i?d=t[15]:(d=N3(i),t[14]=i,t[15]=d);let f;t[16]!==u||t[17]!==d?(f=(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,u,d]}),t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(jT,{className:`text-muted-foreground size-4 transition-transform group-data-[panel-open]:rotate-180`}),t[19]=p):p=t[19];let m;return t[20]!==r||t[21]!==s||t[22]!==f?(m=(0,R.jsxs)(fr,{className:s,...r,children:[f,p]}),t[20]=r,t[21]=s,t[22]=f,t[23]=m):m=t[23],m},F3=e=>{let t=(0,U.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=j(`data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 text-popover-foreground data-closed:animate-out data-open:animate-in outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(pr,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},I3=e=>{let t=(0,U.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,input:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=j(`space-y-2 overflow-hidden p-4`,n),t[4]=n,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,R.jsx)(`h4`,{className:`text-muted-foreground text-xs font-medium tracking-wide uppercase`,children:`Parameters`}),t[6]=o):o=t[6];let s;t[7]===r?s=t[8]:(s=JSON.stringify(r,null,2),t[7]=r,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,R.jsx)(`div`,{className:`bg-muted/50 rounded-md`,children:(0,R.jsx)(A3,{code:s,language:`json`})}),t[9]=s,t[10]=c);let l;return t[11]!==i||t[12]!==a||t[13]!==c?(l=(0,R.jsxs)(`div`,{className:a,...i,children:[o,c]}),t[11]=i,t[12]=a,t[13]=c,t[14]=l):l=t[14],l},L3=e=>{let t=(0,U.c)(24),n,r,i,a;if(t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,output:i,errorText:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a),!(i||r))return null;let o;t[5]===n?o=t[6]:(o=j(`space-y-2 p-4`,n),t[5]=n,t[6]=o);let s=r?`Error`:`Result`,c;t[7]===s?c=t[8]:(c=(0,R.jsx)(`h4`,{className:`text-muted-foreground text-xs font-medium tracking-wide uppercase`,children:s}),t[7]=s,t[8]=c);let l=r?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`,u;t[9]===l?u=t[10]:(u=j(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,l),t[9]=l,t[10]=u);let d;t[11]===r?d=t[12]:(d=r&&(0,R.jsx)(`div`,{children:r}),t[11]=r,t[12]=d);let f;t[13]===i?f=t[14]:(f=R3(i),t[13]=i,t[14]=f);let p;t[15]!==u||t[16]!==d||t[17]!==f?(p=(0,R.jsxs)(`div`,{className:u,children:[d,f]}),t[15]=u,t[16]=d,t[17]=f,t[18]=p):p=t[18];let m;return t[19]!==a||t[20]!==o||t[21]!==c||t[22]!==p?(m=(0,R.jsxs)(`div`,{className:o,...a,children:[c,p]}),t[19]=a,t[20]=o,t[21]=c,t[22]=p,t[23]=m):m=t[23],m};function R3(e){return typeof e==`string`?(0,R.jsx)(A3,{code:e,language:`json`}):(0,L.isValidElement)(e)?(0,R.jsx)(`div`,{children:e}):typeof e==`object`?(0,R.jsx)(A3,{code:JSON.stringify(e,null,2),language:`json`}):typeof e==`number`||typeof e==`bigint`?(0,R.jsx)(`div`,{children:e}):(0,R.jsx)(`div`,{})}function z3(e){let t=(0,U.c)(21),{part:n}=e,r;t[0]===n?r=t[1]:(r=ip(n),t[0]=n,t[1]=r);let i=`Executing ${r}`,a;t[2]!==n.state||t[3]!==n.type||t[4]!==i?(a=(0,R.jsx)(P3,{title:i,state:n.state,type:n.type}),t[2]=n.state,t[3]=n.type,t[4]=i,t[5]=a):a=t[5];let o;t[6]===n.input?o=t[7]:(o=(0,R.jsx)(I3,{input:n.input}),t[6]=n.input,t[7]=o);let s;t[8]===n.output?s=t[9]:(s=typeof n.output==`string`?n.output:JSON.stringify(n.output,null,2),t[8]=n.output,t[9]=s);let c;t[10]===s?c=t[11]:(c=(0,R.jsx)(D3,{className:`break-all`,children:s}),t[10]=s,t[11]=c);let l;t[12]!==n.errorText||t[13]!==c?(l=(0,R.jsx)(L3,{output:c,errorText:n.errorText}),t[12]=n.errorText,t[13]=c,t[14]=l):l=t[14];let u;t[15]!==o||t[16]!==l?(u=(0,R.jsxs)(F3,{children:[o,l]}),t[15]=o,t[16]=l,t[17]=u):u=t[17];let d;return t[18]!==a||t[19]!==u?(d=(0,R.jsxs)(M3,{"data-copy-exclude":`assistant-snapshot`,children:[a,u]}),t[18]=a,t[19]=u,t[20]=d):d=t[20],d}function B3(e){let t=(0,U.c)(19),{part:n}=e,r=`Executing ${n.toolName}`,i;t[0]!==n.state||t[1]!==n.type||t[2]!==r?(i=(0,R.jsx)(P3,{title:r,state:n.state,type:n.type}),t[0]=n.state,t[1]=n.type,t[2]=r,t[3]=i):i=t[3];let a;t[4]===n.input?a=t[5]:(a=(0,R.jsx)(I3,{input:n.input}),t[4]=n.input,t[5]=a);let o;t[6]===n.output?o=t[7]:(o=typeof n.output==`string`?n.output:JSON.stringify(n.output,null,2),t[6]=n.output,t[7]=o);let s;t[8]===o?s=t[9]:(s=(0,R.jsx)(D3,{className:`break-all`,children:o}),t[8]=o,t[9]=s);let c;t[10]!==n.errorText||t[11]!==s?(c=(0,R.jsx)(L3,{output:s,errorText:n.errorText}),t[10]=n.errorText,t[11]=s,t[12]=c):c=t[12];let l;t[13]!==a||t[14]!==c?(l=(0,R.jsxs)(F3,{children:[a,c]}),t[13]=a,t[14]=c,t[15]=l):l=t[15];let u;return t[16]!==i||t[17]!==l?(u=(0,R.jsxs)(M3,{"data-copy-exclude":`assistant-snapshot`,children:[i,l]}),t[16]=i,t[17]=l,t[18]=u):u=t[18],u}var V3=(0,L.createContext)(!1);function H3(e){return e.parts.filter(Qf).map(e=>e.text).join(`
|
|
3514
|
-
`)}function U3(){return(0,L.use)(V3)}function W3(e){return np(e)&&e.toolMetadata?.kind===`subagent`}function G3(e,t){let n=e.type.replace(`tool-`,``);return{toolKey:n,toolEntry:t?.[n]}}function K3(e,t){return e?.static===!1&&!!e?.requiresUserInput&&t===`input-available`}function q3(e){let t=(0,U.c)(4),{children:n}=e,r=L.Children.toArray(n);if(!r.some(Y3)){let e;return t[0]===n?e=t[1]:(e=(0,R.jsx)(`p`,{children:n}),t[0]=n,t[1]=e),e}if(r.length>0&&r.every(J3))return n;let i;return t[2]===n?i=t[3]:(i=(0,R.jsx)(`div`,{children:n}),t[2]=n,t[3]=i),i}function J3(e){return L.isValidElement(e)&&typeof e.type!=`string`}function Y3(e){return L.isValidElement(e)&&typeof e.type!=`string`}var X3={p:({children:e})=>(0,R.jsx)(q3,{children:e})};function Z3(e){let t={...X3},n={};for(let r of e)mT(r),t[r.name]=r.component,n[r.name]=r.allowedAttributes;return{components:t,allowedTags:n}}function Q3(e){let t=(0,U.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({elements:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=n??[],t[3]=n,t[4]=i);let a;t[5]===i?a=t[6]:(a=Z3(i),t[5]=i,t[6]=a);let o=a,s;return t[7]!==r||t[8]!==o?(s=(0,R.jsx)(D3,{...o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function $3(e){let t=(0,U.c)(23),{part:n}=e,{addToolApprovalResponse:r}=O4();if(n.state!==`approval-requested`)return null;let i;t[0]!==n.title||t[1]!==n.type?(i=n.title??n.type.slice(5),t[0]=n.title,t[1]=n.type,t[2]=i):i=t[2];let a=i,o=`${a} approval`,s;t[3]===a?s=t[4]:(s=(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:a}),t[3]=a,t[4]=s);let c;t[5]===n.approval.requestReason?c=t[6]:(c=n.approval.requestReason&&(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:n.approval.requestReason}),t[5]=n.approval.requestReason,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,R.jsxs)(`div`,{className:`space-y-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]!==r||t[11]!==n.approval.id?(u=(0,R.jsx)(tt,{type:`button`,variant:`destructive`,onClick:()=>void r({id:n.approval.id,approved:!1}),children:`Deny`}),t[10]=r,t[11]=n.approval.id,t[12]=u):u=t[12];let d;t[13]!==r||t[14]!==n.approval.id?(d=(0,R.jsx)(tt,{type:`button`,onClick:()=>void r({id:n.approval.id,approved:!0}),children:`Approve`}),t[13]=r,t[14]=n.approval.id,t[15]=d):d=t[15];let f;t[16]!==u||t[17]!==d?(f=(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[u,d]}),t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;return t[19]!==o||t[20]!==l||t[21]!==f?(p=(0,R.jsxs)(`div`,{"aria-label":o,className:`border-border bg-muted/30 space-y-3 rounded-lg border p-3`,"data-copy-exclude":`assistant-snapshot`,role:`group`,children:[l,f]}),t[19]=o,t[20]=l,t[21]=f,t[22]=p):p=t[22],p}function e6(e){let t=(0,U.c)(22),{part:n}=e,{registry:r}=T4();if(n.input===void 0){let e;return t[0]!==n.errorText||t[1]!==n.output||t[2]!==n.state?(e=n.state===`output-error`?(0,R.jsx)(L3,{output:n.output,errorText:n.errorText}):(0,R.jsx)(HT,{className:`size-4 animate-spin`}),t[0]=n.errorText,t[1]=n.output,t[2]=n.state,t[3]=e):e=t[3],e}let i;t[4]===n?i=t[5]:(i=(0,R.jsx)($3,{part:n}),t[4]=n,t[5]=i);let a=i;if(!r)return a;let o=r[n.type.replace(`tool-`,``)];if(o){let e=o.component,i;t[6]!==n||t[7]!==r.progress?(i=r.progress&&(0,R.jsx)(r.progress.component,{part:n}),t[6]=n,t[7]=r.progress,t[8]=i):i=t[8];let s;t[9]!==e||t[10]!==n?(s=(0,R.jsx)(e,{part:n}),t[9]=e,t[10]=n,t[11]=s):s=t[11];let c;return t[12]!==a||t[13]!==i||t[14]!==s?(c=(0,R.jsxs)(`div`,{className:`space-y-2`,children:[i,s,a]}),t[12]=a,t[13]=i,t[14]=s,t[15]=c):c=t[15],c}else{let e;t[16]!==n||t[17]!==r.progress?(e=r.progress&&(0,R.jsx)(r.progress.component,{part:n}),t[16]=n,t[17]=r.progress,t[18]=e):e=t[18];let i;return t[19]!==a||t[20]!==e?(i=(0,R.jsxs)(R.Fragment,{children:[e,a]}),t[19]=a,t[20]=e,t[21]=i):i=t[21],i}}var t6={animation:`slideUp`};function n6(e){let t=(0,U.c)(3),{filename:n,url:r}=e,i=n??`Attached image`,a;return t[0]!==i||t[1]!==r?(a=(0,R.jsx)(`img`,{src:r,alt:i,className:`max-h-64 rounded-md border object-contain`}),t[0]=i,t[1]=r,t[2]=a):a=t[2],a}function r6(e){let t=(0,U.c)(16),{filename:n,mediaType:r,url:i}=e,a=n||`Untitled`,o;t[0]!==r||t[1]!==a||t[2]!==i?(o=i?.startsWith(`data:`)?null:i&&r.startsWith(`video/`)?(0,R.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:i,"aria-label":a,className:`max-h-96 w-full rounded-md bg-black`,children:(0,R.jsx)(`track`,{kind:`captions`})}):i&&r.startsWith(`audio/`)?(0,R.jsx)(`audio`,{controls:!0,preload:`metadata`,src:i,"aria-label":a,className:`w-full`,children:(0,R.jsx)(`track`,{kind:`captions`})}):null,t[0]=r,t[1]=a,t[2]=i,t[3]=o):o=t[3];let s=o,c=s?`mt-2`:void 0,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,R.jsx)(`strong`,{children:`File:`}),t[4]=l):l=t[4];let u;t[5]!==n||t[6]!==i?(u=i?(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(`a`,{href:i,download:n,className:`underline`,children:`Download`})]}):null,t[5]=n,t[6]=i,t[7]=u):u=t[7];let d;t[8]!==r||t[9]!==a||t[10]!==c||t[11]!==u?(d=(0,R.jsxs)(`div`,{className:c,children:[l,` `,a,` (`,r,`)`,u]}),t[8]=r,t[9]=a,t[10]=c,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==s||t[14]!==d?(f=(0,R.jsxs)(kn,{className:`bg-muted/30 block w-full rounded-md p-3 text-sm text-inherit`,children:[s,d]}),t[13]=s,t[14]=d,t[15]=f):f=t[15],f}function i6(e){let t=(0,U.c)(4),{filename:n,mediaType:r,url:i}=e,a;return t[0]!==n||t[1]!==r||t[2]!==i?(a=r.startsWith(`image/`)?(0,R.jsx)(n6,{filename:n,url:i}):(0,R.jsx)(r6,{filename:n,mediaType:r,url:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3],a}function a6(e){let t=(0,U.c)(9),{text:n,elements:r,className:i}=e,{status:a}=E4(),o=U3(),s;t[0]===i?s=t[1]:(s=j(`text-sm`,i),t[0]=i,t[1]=s);let c=!o&&a===`streaming`,l;t[2]!==r||t[3]!==c||t[4]!==n?(l=(0,R.jsx)(Q3,{elements:r,animated:t6,isAnimating:c,children:n}),t[2]=r,t[3]=c,t[4]=n,t[5]=l):l=t[5];let u;return t[6]!==s||t[7]!==l?(u=(0,R.jsx)(`div`,{className:s,children:l}),t[6]=s,t[7]=l,t[8]=u):u=t[8],u}function o6(e){let t=(0,U.c)(8),{part:n}=e,r=s6(),i;t[0]!==n||t[1]!==r?(i=r&&(0,R.jsx)(z3,{part:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=(0,R.jsx)(e6,{part:n}),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,R.jsxs)(R.Fragment,{children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function s6(){let{debugMode:e}=T4(),t=U3();return!!e&&!t}function c6(e){return!!e&&e!==`output-available`}function l6(e){let t=(0,U.c)(5),{label:n,part:r,state:i}=e,a=U3(),o;return t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=!a&&!!n.actions&&!!r&&!c6(i),t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4],o}function u6(e){let t=(0,U.c)(18),{label:n,part:r}=e,i=n.icon,a=n.actions,o;t[0]!==n||t[1]!==r?(o={label:n,part:r,state:r.state},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=l6(o),c;t[3]!==i||t[4]!==n.isError?(c=i&&(0,R.jsx)(i,{className:j(`size-3.5`,n.isError?`text-destructive`:`text-muted-foreground`)}),t[3]=i,t[4]=n.isError,t[5]=c):c=t[5];let l;t[6]===n.name?l=t[7]:(l=(0,R.jsx)(`span`,{className:`font-mono`,children:n.name}),t[6]=n.name,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==a||t[12]!==r||t[13]!==s?(d=s&&a&&(0,R.jsx)(a,{part:r}),t[11]=a,t[12]=r,t[13]=s,t[14]=d):d=t[14];let f;return t[15]!==u||t[16]!==d?(f=(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center justify-between gap-1.5 text-xs`,children:[u,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function d6(e){let t=(0,U.c)(3),{name:n,value:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,R.jsxs)(`span`,{"data-slot":`tool-arg`,children:[n,`: "`,r,`"`]}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function f6(e){let t=(0,U.c)(23),{label:n,state:r,part:i,children:a}=e,o=n.actions,s;t[0]!==n||t[1]!==i||t[2]!==r?(s={label:n,part:i,state:r},t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c=l6(s),l;t[4]===n.args?l=t[5]:(l=n.args?Object.entries(n.args).map(p6):`...`,t[4]=n.args,t[5]=l);let u;t[6]!==a||t[7]!==n.name||t[8]!==l?(u=(0,R.jsxs)(`span`,{className:`text-muted-foreground min-w-0 truncate font-mono text-xs [&>[data-slot=tool-arg]+[data-slot=tool-arg]]:before:mr-1 [&>[data-slot=tool-arg]+[data-slot=tool-arg]]:before:content-[',']`,children:[n.name,`(`,a,l,`)`]}),t[6]=a,t[7]=n.name,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==o||t[11]!==i||t[12]!==c?(d=c&&o&&i&&(0,R.jsx)(`span`,{className:`shrink-0`,children:(0,R.jsx)(o,{part:i})}),t[10]=o,t[11]=i,t[12]=c,t[13]=d):d=t[13];let f;t[14]!==u||t[15]!==d?(f=(0,R.jsxs)(`span`,{className:`flex items-start justify-between gap-2`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16];let p;t[17]!==n.detail||t[18]!==n.isError?(p=n.detail&&(0,R.jsx)(`span`,{className:j(`line-clamp-3 text-start font-mono text-[10px] leading-relaxed whitespace-pre-wrap`,n.isError?`text-destructive/80`:`text-muted-foreground`),children:n.detail}),t[17]=n.detail,t[18]=n.isError,t[19]=p):p=t[19];let m;return t[20]!==f||t[21]!==p?(m=(0,R.jsxs)(`span`,{className:`mb-2 flex flex-col gap-1`,children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m}function p6(e){let[t,n]=e;return(0,R.jsx)(d6,{name:t,value:n},t)}function m6(e){return e.type===`text`&&e.providerMetadata?.openai?.phase===`commentary`}function h6(e){let t=(0,U.c)(9),{segment:n,elements:r,className:i}=e,a;if(t[0]!==i||t[1]!==r||t[2]!==n.parts){let e;t[4]!==i||t[5]!==r?(e=e=>{let{part:t,idx:n}=e;return t.type===`text`?(0,R.jsx)(a6,{text:t.text,elements:r,className:i},`${n}-text`):null},t[4]=i,t[5]=r,t[6]=e):e=t[6],a=n.parts.map(e),t[0]=i,t[1]=r,t[2]=n.parts,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,R.jsx)(R.Fragment,{children:a}),t[7]=a,t[8]=o),o}function g6(e){let t=(0,U.c)(4),{segment:n}=e,{part:r}=n;if(r.type!==`file`)return null;let i;return t[0]!==r.filename||t[1]!==r.mediaType||t[2]!==r.url?(i=(0,R.jsx)(i6,{filename:r.filename,mediaType:r.mediaType,url:r.url}),t[0]=r.filename,t[1]=r.mediaType,t[2]=r.url,t[3]=i):i=t[3],i}function _6(e){let t=(0,U.c)(9),{segment:n}=e,{messages:r}=O4(),i;t[0]===r?i=t[1]:(i=A4(r),t[0]=r,t[1]=i);let a=i,o;if(t[2]!==n.parts||t[3]!==a){let e;t[5]===a?e=t[6]:(e=e=>{let{part:t,idx:n}=e;if(t.type!==`source-url`)return null;let r=j4(a,t.url);return r===null?null:(0,R.jsx)(U4,{source:{url:t.url,title:t.title},index:r},`source-${n}`)},t[5]=a,t[6]=e),o=n.parts.map(e),t[2]=n.parts,t[3]=a,t[4]=o}else o=t[4];let s;return t[7]===o?s=t[8]:(s=(0,R.jsx)(`span`,{children:o}),t[7]=o,t[8]=s),s}function v6(e){let t=(0,U.c)(3),{segment:n}=e,r=V4();if(U3())return null;let{part:i}=n;if(i.type!==`reasoning`)return null;let a=r===`streaming`,o;return t[0]!==i.text||t[1]!==a?(o=(0,R.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,R.jsx)(D3,{animated:t6,isAnimating:a,children:i.text})}),t[0]=i.text,t[1]=a,t[2]=o):o=t[2],o}function y6(e){let t=(0,U.c)(2),{segment:n}=e;if(!s6())return null;let{part:r}=n;if(r.type!==`dynamic-tool`)return null;let i;return t[0]===r?i=t[1]:(i=(0,R.jsx)(B3,{part:r}),t[0]=r,t[1]=i),i}var b6=(0,L.createContext)(null),x6=(0,L.createContext)(null);function S6(){let e=(0,L.use)(b6);if(!e)throw Error(`Segment.Tool* parts must be rendered within Segment.Tool`);return e}function C6(e){let t=(0,U.c)(31),{segment:n,children:r}=e,i=T4(),a=V4(),o,s,c,l,u,d;if(t[0]!==i.registry||t[1]!==n||t[2]!==a){l=Symbol.for(`react.early_return_sentinel`);bb0:{if({toolEntry:u}=G3(n.part,i.registry),{part:d}=n,!ep(d)){l=null;break bb0}s=K3(u,d.state),o=!s&&N4(d,a),c=u?.label?.(d)}t[0]=i.registry,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let f=c,p;t[9]!==o||t[10]!==f||t[11]!==d.type?(p=o?{...f??{name:d.type.replace(`tool-`,``)},isError:!0,detail:`Cancelled by user`}:f,t[9]=o,t[10]=f,t[11]=d.type,t[12]=p):p=t[12];let m=p,h=u?.static===!1&&!!u?.requiresUserInput&&!s,g;t[13]!==o||t[14]!==s||t[15]!==h||t[16]!==m||t[17]!==d?(g={part:d,label:m,aborted:o,activeClientInput:s,defaultOpen:h},t[13]=o,t[14]=s,t[15]=h,t[16]=m,t[17]=d,t[18]=g):g=t[18];let _;t[19]!==o||t[20]!==m||t[21]!==d.state?(_={label:m,state:d.state,aborted:o},t[19]=o,t[20]=m,t[21]=d.state,t[22]=_):_=t[22];let v;t[23]===r?v=t[24]:(v=r??(0,R.jsx)(T6,{}),t[23]=r,t[24]=v);let y;t[25]!==_||t[26]!==v?(y=(0,R.jsx)(x6,{value:_,children:v}),t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;return t[28]!==g||t[29]!==y?(b=(0,R.jsx)(b6,{value:g,children:y}),t[28]=g,t[29]=y,t[30]=b):b=t[30],b}function w6(){let e=(0,U.c)(2),{part:t,activeClientInput:n}=S6();if(n)return null;let r;return e[0]===t?r=e[1]:(r=(0,R.jsx)(o6,{part:t}),e[0]=t,e[1]=r),r}function T6(e){let t=(0,U.c)(9),{children:n}=e,{part:r,label:i,defaultOpen:a}=S6();if(!i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(w6,{})}),t[0]=e):e=t[0],e}let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=(0,R.jsx)(fr,{className:`cursor-pointer`,children:(0,R.jsx)(f6,{label:i,state:r.state,part:r,children:n})}),t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(pr,{className:`mb-2`,children:(0,R.jsx)(w6,{})}),t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==o?(c=(0,R.jsxs)(dr,{defaultOpen:a,className:`flex min-w-0 flex-1 flex-col`,children:[o,s]}),t[6]=a,t[7]=o,t[8]=c):c=t[8],c}var E6={Text:h6,File:g6,Source:_6,Reasoning:v6,DynamicTool:y6,Tool:C6,ToolDisclosure:T6,ToolContent:w6};function D6(e){return ep(e)?`tool`:e.type===`dynamic-tool`?`dynamic-tool`:e.type===`reasoning`&&`text`in e&&e.text?`reasoning`:null}function O6(e,t){return e.kind===`text`||e.kind===`file`||e.kind===`source`?!1:e.kind===`reasoning`||e.kind!==`dynamic-tool`||!!t}function k6(e,t,n){let r=e[t+1];return!!r&&O6(r,n)}function A6(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=D6(r);if(i)t.push({kind:i,part:r,idx:n});else if(r.type===`text`){let e=t[t.length-1];e&&e.kind===`text`?e.parts.push({part:r,idx:n}):t.push({kind:`text`,parts:[{part:r,idx:n}]})}else if(r.type===`file`)t.push({kind:`file`,part:r,idx:n});else if(r.type===`source-url`){let e=t[t.length-1];e&&e.kind===`source`?e.parts.push({part:r,idx:n}):t.push({kind:`source`,parts:[{part:r,idx:n}]})}}return t}function j6(e,t){return e.kind===`text`||e.kind===`source`?e.parts[0]?.idx??t:e.idx}(0,L.memo)(function(e){let t=(0,U.c)(8),{segment:n}=e;if(n.kind===`tool`){let e;return t[0]===n?e=t[1]:(e=(0,R.jsx)(E6.Tool,{segment:n}),t[0]=n,t[1]=e),e}if(n.kind===`reasoning`){let e;return t[2]===n?e=t[3]:(e=(0,R.jsx)(E6.Reasoning,{segment:n}),t[2]=n,t[3]=e),e}if(n.kind===`text`){let e;return t[4]===n?e=t[5]:(e=(0,R.jsx)(E6.Text,{segment:n,className:`text-xs`}),t[4]=n,t[5]=e),e}if(n.kind===`file`){let e;return t[6]===n?e=t[7]:(e=(0,R.jsx)(E6.File,{segment:n}),t[6]=n,t[7]=e),e}return null},M6);function M6(e,t){return e.complete&&t.complete&&e.cacheKey===t.cacheKey}function N6(e){let t=(0,U.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a={scale:.94},t[4]=a):a=t[4];let o;t[5]===n?o=t[6]:(o=j(`group text-muted-foreground hover:text-foreground relative rounded-lg p-2 transition-colors`,n),t[5]=n,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(`span`,{className:`bg-primary/10 absolute inset-0 rounded-lg opacity-0 transition-opacity group-hover:opacity-100`}),t[7]=s):s=t[7];let c;return t[8]!==r||t[9]!==i||t[10]!==o?(c=(0,R.jsxs)(nT.button,{type:`button`,whileTap:a,className:o,...i,children:[r,s]}),t[8]=r,t[9]=i,t[10]=o,t[11]=c):c=t[11],c}function P6(){let{index:e}=H4(),{messages:t}=B4(),n=V4();return!(e===t.length-1&&(n===`submitted`||n===`streaming`||n===`error`))}function F6(e){let t=(0,U.c)(5),{className:n,children:r}=e;if(!P6()||L.Children.toArray(r).length===0)return null;let i;t[0]===n?i=t[1]:(i=j(`mt-1 flex items-center gap-0.5`,n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,R.jsx)(`div`,{"data-copy-exclude":`assistant-snapshot`,className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function I6(e){let t=(0,U.c)(12),{className:n}=e,{message:r}=H4(),[i,a]=O3(),o=i?`Copied`:`Copy message`,s;t[0]===n?s=t[1]:(s=j(`p-1.5`,n),t[0]=n,t[1]=s);let c;t[2]!==a||t[3]!==r?(c=()=>void a(H3(r)),t[2]=a,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,R.jsx)(i?AT:RT,{className:`size-3.5`}),t[5]=i,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,R.jsx)(N6,{"aria-label":o,className:s,onClick:c,icon:l}),t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function L6(e){let t=(0,U.c)(9),{className:n}=e,{message:r}=H4(),{regenerate:i}=O4(),a;t[0]===n?a=t[1]:(a=j(`p-1.5`,n),t[0]=n,t[1]=a);let o;t[2]!==r.id||t[3]!==i?(o=()=>void i({messageId:r.id}),t[2]=r.id,t[3]=i,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(KT,{className:`size-3.5`}),t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==o?(c=(0,R.jsx)(N6,{"aria-label":`Regenerate response`,className:a,onClick:o,icon:s}),t[6]=a,t[7]=o,t[8]=c):c=t[8],c}function R6(e){let t=(0,U.c)(12),{className:n}=e,{message:r}=H4(),[i,a]=O3(),o=i?`Copied`:`Copy debug JSON`,s;t[0]===n?s=t[1]:(s=j(`p-1.5`,n),t[0]=n,t[1]=s);let c;t[2]!==a||t[3]!==r?(c=()=>void a(JSON.stringify(r,null,2)),t[2]=a,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,R.jsx)(i?AT:kT,{className:`size-3.5`}),t[5]=i,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,R.jsx)(N6,{"aria-label":o,className:s,onClick:c,icon:l}),t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function z6(e){let t=(0,U.c)(7),{onTryAgain:n,error:r}=e,i=r instanceof Error?r.message:`An error occurred. Please try again.`,a;t[0]===i?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-destructive text-sm`,children:(0,R.jsx)(D3,{mode:`static`,children:i})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,R.jsx)(tt,{type:`button`,onClick:n,size:`sm`,variant:`outline`,children:`Try Again`}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,R.jsx)(`div`,{className:`mt-3 flex justify-start`,children:(0,R.jsxs)(`div`,{className:`max-w-[80%] space-y-2`,children:[a,o]})}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function B6(e){let t=(0,U.c)(3),{error:n,onRetry:r}=e;if(!n||!r)return null;let i;return t[0]!==n||t[1]!==r?(i=(0,R.jsx)(z6,{onTryAgain:r,error:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function V6(e){let t=(0,U.c)(14),{messages:n,className:r,elements:i,status:a,children:o}=e,s;t[0]!==i||t[1]!==n||t[2]!==a?(s={messages:n,elements:i,status:a},t[0]=i,t[1]=n,t[2]=a,t[3]=s):s=t[3];let c=s,l;t[4]===r?l=t[5]:(l=j(`flex h-full flex-col`,r),t[4]=r,t[5]=l);let u;t[6]===o?u=t[7]:(u=(0,R.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:o}),t[6]=o,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,R.jsx)(`div`,{className:l,children:u}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==d||t[12]!==c?(f=(0,R.jsx)(R4,{value:c,children:d}),t[11]=d,t[12]=c,t[13]=f):f=t[13],f}function H6(e){let t=(0,U.c)(5),{className:n,children:r}=e,i;t[0]===n?i=t[1]:(i=j(`flex flex-col gap-4`,n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,R.jsx)(`div`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function U6(e){let t=(0,U.c)(9),{message:n,index:r,className:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o={message:n,index:r},t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;t[3]!==a||t[4]!==i?(c=(0,R.jsx)(`div`,{className:i,children:a}),t[3]=a,t[4]=i,t[5]=c):c=t[5];let l;return t[6]!==c||t[7]!==s?(l=(0,R.jsx)(z4,{value:s,children:c}),t[6]=c,t[7]=s,t[8]=l):l=t[8],l}function W6(){let e=(0,U.c)(5),{registry:t}=T4(),n=O4().messages,r;if(e[0]!==n||e[1]!==t){bb0:{if(!t){r=null;break bb0}let i=n.findLast(G6);if(!i){r=null;break bb0}let a;e[3]===t?a=e[4]:(a=e=>{if(!ep(e)||e.state!==`input-available`)return[];let n=e.type.replace(`tool-`,``),r=t[n];return!r||r.static!==!1||!r.requiresUserInput?[]:[{part:e,entry:r}]},e[3]=t,e[4]=a),r=i.parts.flatMap(a).at(0)??null}e[0]=n,e[1]=t,e[2]=r}else r=e[2];return r}function G6(e){let{role:t}=e;return t===`assistant`}function K6(e){let t=(0,U.c)(10),{children:n,className:r}=e,i=W6(),a=i?.entry.component,o=i?`hidden`:`visible`,s;t[0]!==n||t[1]!==o?(s=(0,R.jsx)(L.Activity,{mode:o,children:n}),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==i||t[5]!==r?(c=i&&a?(0,R.jsx)(`div`,{className:j(`sticky bottom-0 mt-auto`,r),children:(0,R.jsx)(a,{part:i.part},i.part.toolCallId)}):null,t[3]=a,t[4]=i,t[5]=r,t[6]=c):c=t[6];let l;return t[7]!==s||t[8]!==c?(l=(0,R.jsxs)(R.Fragment,{children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function q6(e,t){if(e===`error`||e===`ready`||!t)return null;if(t.role!==`assistant`)return`Thinking...`;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(Qf(n)&&n.text&&n.providerMetadata?.openai?.phase===`commentary`)return n.text}for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if($f(n)&&n.text)return n.text;if(np(n)){let e=n.input;if(RA(e))for(let t of[`reasoning`,`thoughts`,`thought`,`hint`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return n.toolCallId}if(Qf(n)&&n.text)return``}return`Thinking...`}function J6(e){let t=(0,U.c)(5),{isLast:n}=e,r=n!==void 0&&n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,R.jsx)(`span`,{className:`bg-muted-foreground/50 z-10 mt-1 size-2 shrink-0 rounded-full`}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=!r&&(0,R.jsx)(`span`,{className:`bg-border w-px flex-1`}),t[1]=r,t[2]=a);let o;return t[3]===a?o=t[4]:(o=(0,R.jsxs)(`div`,{className:`absolute top-0 left-0 flex size-3.5 h-full flex-col items-center`,children:[i,a]}),t[3]=a,t[4]=o),o}function Y6(e){let t=(0,U.c)(6),{marker:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=j(`relative z-0 flex gap-3 pl-5`,i),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n||t[4]!==a?(o=(0,R.jsxs)(`div`,{className:a,children:[n,r]}),t[2]=r,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function X6(){let e=(0,U.c)(6),t=V4(),{messages:n}=B4(),r=W6(),i=n[n.length-1],a;e[0]!==t||e[1]!==i?(a=q6(t,i),e[0]=t,e[1]=i,e[2]=a):a=e[2];let o=a;if(!o||r)return null;let s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(J6,{isLast:!0}),e[3]=s):s=e[3];let c;return e[4]===o?c=e[5]:(c=(0,R.jsx)(Y6,{className:`mt-2`,marker:s,children:(0,R.jsx)(`span`,{role:`status`,children:(0,R.jsx)(F4,{as:`span`,className:`text-muted-foreground line-clamp-2 font-mono text-xs`,children:o})})}),e[4]=o,e[5]=c),c}var Z6=[`inputTokens`,`outputTokens`,`reasoningTokens`,`cachedInputTokens`,`totalTokens`],Q6={inputTokens:[[`inputTokens`],[`raw`,`prompt_tokens`]],outputTokens:[[`outputTokens`],[`raw`,`completion_tokens`]],reasoningTokens:[[`reasoningTokens`],[`outputTokenDetails`,`reasoningTokens`],[`raw`,`completion_tokens_details`,`reasoning_tokens`]],cachedInputTokens:[[`inputTokenDetails`,`cacheReadTokens`],[`cachedInputTokens`],[`inputTokenDetails`,`cachedTokens`],[`raw`,`prompt_tokens_details`,`cached_tokens`]],totalTokens:[[`totalTokens`],[`raw`,`total_tokens`]]};function $6(e){if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t)&&t>=0)return t}return null}function e8(e){if(!e||typeof e!=`object`)return null;let t={inputTokens:null,outputTokens:null,reasoningTokens:null,cachedInputTokens:null,totalTokens:null};for(let n of Z6)for(let r of Q6[n]){let i=$6(VK(e,r));if(i!==null){t[n]=i;break}}return Z6.some(e=>t[e]!==null)?t:null}function t8(e){return RA(e)?e8(e.totalUsage??e.usage):null}function n8(e){let t=[`↑ ${B2(e.inputTokens)}`,`↓ ${B2(e.outputTokens)}`];return e.totalTokens!==null&&t.push(`· ${e.totalTokens.toLocaleString()} tokens`),e.cachedInputTokens!==null&&e.cachedInputTokens>0&&t.push(`(${B2(e.cachedInputTokens)} cached)`),t.join(` `)}var r8=`x-upload-filename`,i8=he({path:I().startsWith(`/`),name:I().min(1),mediaType:Xe([`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/heic`,`image/heif`,`video/mp4`,`video/quicktime`,`audio/mpeg`,`audio/mp4`,`audio/wav`]),size:Dt().nonnegative(),url:N()}),a8=class extends Kp{sessionsApi;request;constructor({api:e,fetch:t=(e,t)=>globalThis.fetch(e,t),tools:n={},elements:r=[]}){let i=l8(e),a=r.map(vT);super({api:i,fetch:async(e,n)=>{let r=await t(e,n);if((n?.method??`GET`).toUpperCase()!==`POST`||!r.ok)return r;let i=await r.json();if(!u8(i))throw Error(`Zukhruf returned an invalid accepted-turn response`);let a=l8(String(e)),o=decodeURIComponent(a.slice(a.lastIndexOf(`/`)+1));if(i.sessionId!==o)throw Error(`Zukhruf returned a different session ID`);let s=n?.signal;return s?.addEventListener(`abort`,()=>{t(`${a}/cancel`,{method:`POST`}).catch(()=>void 0)},{once:!0}),t(`${a}/stream`,{headers:{accept:`text/event-stream`},method:`GET`,signal:s})},prepareSendMessagesRequest:({id:e,messages:t,trigger:r})=>{let o=t[t.length-1];if(!o)throw Error(`A message is required`);return{api:o8(i,e),body:{sessionId:e,message:o,trigger:r,...Object.keys(n).length>0?{tools:n}:{},...a.length>0?{elements:a}:{}}}},prepareReconnectToStreamRequest:({headers:e,id:t})=>({api:`${o8(i,t)}/stream`,headers:e})}),this.sessionsApi=i,this.request=t}async uploadFile(e,t){let n=await this.request(`${o8(this.sessionsApi,e)}/uploads`,{method:`POST`,headers:{"content-type":t.type,[r8]:encodeURIComponent(t.name)},body:t});if(!n.ok)throw Error(await s8(n,t));let r=i8.safeParse(await n.json());if(!r.success)throw Error(`Zukhruf returned an invalid upload response`);return r.data}};function o8(e,t){return`${e}/${encodeURIComponent(t)}`}async function s8(e,t){let n=`Uploading ${t.name} failed with HTTP ${e.status}`,r=c8(await e.json().catch(()=>null));return r?`${n}: ${r}`:n}function c8(e){if(typeof e!=`object`||!e)return null;let t=`cause`in e&&typeof e.cause==`object`&&e.cause!==null?e.cause:null;return[t&&`code`in t&&typeof t.code==`string`?t.code:null,t&&`detail`in t&&typeof t.detail==`string`?t.detail:`error`in e&&typeof e.error==`string`?e.error:null].filter(e=>e!==null).join(` — `)||null}function l8(e){return e.replace(/\/$/,``)}function u8(e){return typeof e==`object`&&!!e&&`ok`in e&&e.ok===!0&&`sessionId`in e&&typeof e.sessionId==`string`&&`turnId`in e&&typeof e.turnId==`string`}function d8(e){let t=(0,U.c)(24),{label:n,open:r,onOpenChange:i,children:a,className:o,triggerClassName:s,contentClassName:c,chevronClassName:l}=e,u;t[0]===s?u=t[1]:(u=j(`flex items-center font-mono`,s),t[0]=s,t[1]=u);let d;t[2]===u?d=t[3]:(d=(0,R.jsx)(`button`,{type:`button`,className:u}),t[2]=u,t[3]=d);let f=r&&`rotate-180`,p;t[4]!==l||t[5]!==f?(p=j(`size-4 transition-transform`,l,f),t[4]=l,t[5]=f,t[6]=p):p=t[6];let m;t[7]===p?m=t[8]:(m=(0,R.jsx)(jT,{className:p}),t[7]=p,t[8]=m);let h;t[9]===n?h=t[10]:(h=(0,R.jsx)(`span`,{children:n}),t[9]=n,t[10]=h);let g;t[11]!==d||t[12]!==m||t[13]!==h?(g=(0,R.jsxs)(fr,{render:d,children:[m,h]}),t[11]=d,t[12]=m,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==c?(_=(0,R.jsx)(pr,{className:c,children:a}),t[15]=a,t[16]=c,t[17]=_):_=t[17];let v;return t[18]!==o||t[19]!==i||t[20]!==r||t[21]!==g||t[22]!==_?(v=(0,R.jsxs)(dr,{open:r,onOpenChange:i,className:o,children:[g,_]}),t[18]=o,t[19]=i,t[20]=r,t[21]=g,t[22]=_,t[23]=v):v=t[23],v}function f8(e){let t=(0,U.c)(7),{metadata:n}=e;if(!n)return null;let r,i,a;if(t[0]!==n){a=Symbol.for(`react.early_return_sentinel`);bb0:{let e=t8(n);if(!e){a=null;break bb0}r=`text-muted-foreground mt-2 text-xs tabular-nums opacity-60`,i=n8(e)}t[0]=n,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[4]!==r||t[5]!==i?(o=(0,R.jsx)(`div`,{className:r,children:i}),t[4]=r,t[5]=i,t[6]=o):o=t[6],o}function p8(e,t){return RA(e.metadata)?e.metadata[t]:void 0}function m8(e){let t=p8(e,`reminders`);return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.text==`string`&&t.text.trim().length>0}):[]}function h8(e){let t=p8(e,`uploads`);return Array.isArray(t)?t.flatMap(e=>{let t=i8.safeParse(e);return t.success?[t.data]:[]}):[]}function g8(e){let t=(0,U.c)(7),{text:n}=e,[r,i]=(0,L.useState)(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>i(_8),t[0]=a):a=t[0];let o=!r&&`line-clamp-3`,s;t[1]===o?s=t[2]:(s=j(`hover:text-foreground w-full cursor-pointer text-left whitespace-pre-wrap`,o),t[1]=o,t[2]=s);let c;return t[3]!==r||t[4]!==s||t[5]!==n?(c=(0,R.jsx)(`li`,{children:(0,R.jsx)(`button`,{type:`button`,onClick:a,"aria-pressed":r,className:s,children:n})}),t[3]=r,t[4]=s,t[5]=n,t[6]=c):c=t[6],c}function _8(e){return!e}function v8(e){let t=(0,U.c)(8),{reminders:n}=e,[r,i]=(0,L.useState)(!1);if(n.length===0)return null;let a=`${n.length} reminder${n.length===1?``:`s`} attached`,o;t[0]===n?o=t[1]:(o=n.map(y8),t[0]=n,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,R.jsx)(`ul`,{className:`border-ink-12 text-muted-foreground space-y-1 border-l pl-3 text-xs`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==r||t[6]!==s?(c=(0,R.jsx)(d8,{label:a,open:r,onOpenChange:i,className:`mt-1`,triggerClassName:`text-muted-foreground hover:text-foreground gap-1.5 text-xs`,contentClassName:`mt-1.5`,chevronClassName:`size-3.5`,children:s}),t[4]=a,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function y8(e){return(0,R.jsx)(g8,{text:e.text},e.id)}function b8(e){let t=(0,U.c)(19),{upload:n}=e;if(n.mediaType.startsWith(`video/`)){let e;t[0]!==n.name||t[1]!==n.url?(e=(0,R.jsx)(`video`,{src:n.url,"aria-label":n.name,muted:!0,playsInline:!0,preload:`metadata`,className:`size-full object-cover`}),t[0]=n.name,t[1]=n.url,t[2]=e):e=t[2];let r;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center justify-center text-2xl text-white drop-shadow`,children:`▶`}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==n.name?(i=(0,R.jsxs)(jn,{variant:`image`,className:`size-36 rounded-2xl`,title:n.name,children:[e,r]}),t[4]=e,t[5]=n.name,t[6]=i):i=t[6],i}if(n.mediaType.startsWith(`audio/`)){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,R.jsx)(`span`,{"aria-hidden":!0,className:`text-2xl`,children:`♪`}),t[7]=e):e=t[7];let r;t[8]===n.name?r=t[9]:(r=(0,R.jsx)(`span`,{className:`text-foreground w-full truncate text-center`,children:n.name}),t[8]=n.name,t[9]=r);let i;t[10]===n.mediaType?i=t[11]:(i=(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:n.mediaType}),t[10]=n.mediaType,t[11]=i);let a;return t[12]!==r||t[13]!==i||t[14]!==n.name?(a=(0,R.jsxs)(jn,{variant:`icon`,className:`h-36 w-48 flex-col gap-1 rounded-2xl px-3 text-xs`,title:n.name,"aria-label":n.name,children:[e,r,i]}),t[12]=r,t[13]=i,t[14]=n.name,t[15]=a):a=t[15],a}let r;return t[16]!==n.name||t[17]!==n.url?(r=(0,R.jsx)(jn,{variant:`image`,className:`size-36 rounded-2xl`,children:(0,R.jsx)(`img`,{src:n.url,alt:n.name})}),t[16]=n.name,t[17]=n.url,t[18]=r):r=t[18],r}function x8(e){let t=(0,U.c)(13),{message:n}=e,r,i,a,o,s,c;if(t[0]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=h8(n);if(e.length===0){c=null;break bb0}r=Mn,i=`list`,a=`Attached files`,o=`max-w-full gap-2 py-0`,s=e.map(S8)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==s?(l=(0,R.jsx)(r,{role:i,"aria-label":a,className:o,children:s}),t[7]=r,t[8]=i,t[9]=a,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function S8(e){return(0,R.jsx)(`div`,{role:`listitem`,"data-slot":`attachment`,children:(0,R.jsx)(b8,{upload:e})},e.path)}function C8(e){let t=(0,U.c)(10),{body:n,reminders:r,metadata:i}=e,a;t[0]===n?a=t[1]:(a=(0,R.jsx)(`div`,{className:`flex-1 space-y-3`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,R.jsx)(v8,{reminders:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i!==void 0&&(0,R.jsx)(f8,{metadata:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,R.jsxs)(`div`,{className:`bg-secondary flex max-w-[80%] flex-col gap-3 rounded-lg p-3`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function w8(e){let t=(0,U.c)(28),{message:n}=e;p8(n,`reminders`);let r;t[0]===n?r=t[1]:(r=LA(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=m8(n),t[2]=n,t[3]=i);let a;t[4]!==r||t[5]!==i?(a={message:r,reminders:i},t[4]=r,t[5]=i,t[6]=a):a=t[6];let{message:o,reminders:s}=a,c;if(t[7]!==n){let e=p8(n,`alias`);c=typeof e==`string`&&e.trim().length>0?e:void 0,t[7]=n,t[8]=c}else c=t[8];let l=c;if(l){let e;t[9]===l?e=t[10]:(e=(0,R.jsx)(`div`,{className:`text-sm whitespace-pre-wrap`,children:l}),t[9]=l,t[10]=e);let n;return t[11]!==s||t[12]!==e?(n=(0,R.jsx)(C8,{reminders:s,body:e}),t[11]=s,t[12]=e,t[13]=n):n=t[13],n}let u;t[14]===o?u=t[15]:(u=(0,R.jsx)(x8,{message:o}),t[14]=o,t[15]=u);let d=o.metadata,f;if(t[16]!==o.id||t[17]!==o.parts){let e;t[19]===o.id?e=t[20]:(e=(e,t)=>e.type===`text`?(0,R.jsx)(`div`,{className:`text-sm whitespace-pre-wrap`,children:(0,R.jsx)(P2,{text:e.text})},`${o.id}-${t}-text`):null,t[19]=o.id,t[20]=e),f=o.parts.map(e),t[16]=o.id,t[17]=o.parts,t[18]=f}else f=t[18];let p;t[21]!==o.metadata||t[22]!==s||t[23]!==f?(p=(0,R.jsx)(C8,{reminders:s,metadata:d,body:f}),t[21]=o.metadata,t[22]=s,t[23]=f,t[24]=p):p=t[24];let m;return t[25]!==u||t[26]!==p?(m=(0,R.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col items-end gap-3`,children:[u,p]}),t[25]=u,t[26]=p,t[27]=m):m=t[27],m}var T8=(0,L.memo)(function(e){let t=(0,U.c)(7),{className:n}=e,{message:r}=H4(),i;t[0]===n?i=t[1]:(i=j(`flex justify-end`,n),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,R.jsx)(w8,{message:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,R.jsx)(`div`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o});function E8(e){return e.kind===`tool`?!W3(e.part):e.kind===`dynamic-tool`||e.kind===`reasoning`}function D8(e,t){return e.kind===`tool`?!0:e.kind===`reasoning`||e.kind===`dynamic-tool`?!!t:!1}function O8(e){return e.kind===`text`&&e.parts.some(({part:e})=>e.type===`text`&&!m6(e))}function k8(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];if(!E8(i)){n.push({kind:`segment`,segment:i,segmentIndex:r});continue}let a=[],o=r;for(;r<e.length&&E8(e[r]);){let n=e[r];D8(n,t)&&a.push({segment:n}),r++}r--,a.length>0&&n.push({kind:`group`,items:a,hasLaterText:e.slice(r+1).some(e=>O8(e)),firstIndex:o})}return n}function A8(e){if(e.kind!==`tool`&&e.kind!==`dynamic-tool`)return;let{part:t}=e;return np(t)?t.state:void 0}function j8({groupStatus:e,labelCount:t}){return e===`running`?{title:`text-info`,detail:`text-info/80`,chevron:`text-info`}:e===`aborted`?{title:`text-destructive`,detail:`text-destructive/80`,chevron:`text-destructive`}:e===`error`?t===1?{title:`text-destructive`,detail:`text-destructive/80`,chevron:`text-destructive`}:{title:`text-warning`,detail:`text-warning/80`,chevron:`text-warning`}:{title:`text-muted-foreground`,detail:`text-muted-foreground`,chevron:`text-muted-foreground`}}function M8(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N8(e,t=80){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-3).trimEnd()}...`}function P8(e){if(typeof e==`string`)return N8(e,48);if(typeof e==`number`||typeof e==`boolean`)return String(e);if(Array.isArray(e))return`${e.length} items`}function F8(e){if(!M8(e))return;let t=[`command`,`query`,`path`,`file`,`table`,`metric`,`dimension`,`checks`],n=[...t.filter(t=>t in e).map(t=>[t,e[t]]),...Object.entries(e).filter(([e])=>!t.includes(e))],r={};for(let[e,t]of n){let n=P8(t);if(n&&(r[e]=n,Object.keys(r).length>=2))break}return Object.keys(r).length>0?r:void 0}function I8(e){if(M8(e))for(let t of[`reasoning`,`thoughts`,`thought`,`hint`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim().length>0)return N8(n)}}function L8(e){if(e.kind!==`reasoning`)return;let{part:t}=e;if(t.type===`reasoning`)return N8(t.text,96)}function R8(e,t){if(e.kind===`reasoning`)return{kind:`reasoning`,name:`reasoning`,detail:L8(e)};if(e.kind===`dynamic-tool`&&e.part.type===`dynamic-tool`){let t=e.part;return{kind:`dynamic-tool`,name:t.toolName||`Tool`,args:F8(t.input),detail:I8(t.input)}}if(e.kind===`tool`&&ep(e.part)){let n=e.part,{toolEntry:r,toolKey:i}=G3(n,t),a=r?.label?.(n);return{kind:`tool`,name:a?.name??i,args:a?.args??F8(n.input),detail:a?.detail??I8(n.input),isError:a?.isError}}return{kind:`tool`,name:`Step`}}function z8(e){if(!e)return;let t=Object.entries(e).filter(e=>typeof e[1]==`string`&&e[1].trim().length>0);if(t.length!==0)return t.slice(0,2).map(([e,t])=>`${e}: ${N8(t,36)}`).join(`, `)}function B8(e){let t=z8(e.args);return t?`${e.name}(${t})`:e.name}function V8(e){return e===`output-available`||e===`output-error`||e===`output-denied`}function H8(e){return!!e&&!V8(e)}function U8(e,t){return M4(e,t)}function W8({items:e,labels:t,status:n,hasLaterText:r}){return e.some(({segment:e})=>U8(A8(e),n))?`aborted`:!r&&(n===`streaming`||n===`submitted`)?`running`:t.some(e=>e.isError)||e.some(({segment:e})=>{let t=A8(e);return t===`output-error`||t===`output-denied`})?`error`:e.some(({segment:e})=>H8(A8(e)))||!r&&t.every(e=>e.kind===`reasoning`)&&(n===`streaming`||n===`submitted`)?`running`:`complete`}function G8(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function K8(e){return e.filter(e=>e.kind!==`reasoning`).length}function q8(e,t){let n=K8(e);if(n!==0)return`${t===`running`||t===`aborted`?`running`:`ran`} ${n} ${n===1?`tool`:`tools`}`}function J8(e,t){let n=q8(e,t);if(n)return G8(t===`error`?`${n} with issues`:t===`aborted`?`cancelled after ${n}`:n)}function Y8(e,t,n){let r=e.length===1?e[0]:void 0;if(t===`running`)return n||(r?.kind===`reasoning`?`Reasoning${r.detail?` ${r.detail}`:``}`:e.every(e=>e.kind===`reasoning`)?`Reasoning`:`Working...`);if(r){let e=B8(r);return t===`error`?`Failed ${e}`:t===`aborted`?`Cancelled ${e}`:r.kind===`reasoning`?`Reasoned${r.detail?` ${r.detail}`:``}`:`Called ${e}`}return e.every(e=>e.kind===`reasoning`)?`Reasoned`:J8(e,t)??`Ran tools`}function X8(e,t){if(t!==`running`){if(e.length===1){let t=e[0];return t.kind===`reasoning`?void 0:t.detail}return Array.from(new Set([...e].sort((e,t)=>e.kind===`reasoning`&&t.kind!==`reasoning`?1:e.kind!==`reasoning`&&t.kind===`reasoning`?-1:0).map(e=>e.name))).slice(0,3).join(`, `)||void 0}}function Z8(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].segment;if(r.kind===`dynamic-tool`&&r.part.type===`dynamic-tool`){let e=I8(r.part.input);if(e)return e}if(r.kind===`tool`&&ep(r.part)){let e=I8(r.part.input);if(e)return e}r.kind===`reasoning`&&(t??=L8(r))}return t}function Q8(e,t){return!e||e.role!==`assistant`?!1:k8(A6(e.parts),t).some(e=>e.kind===`group`&&!e.hasLaterText)}function $8(){let e=(0,U.c)(8),{message:t}=H4(),{debugMode:n}=T4(),r;e[0]===t.parts?r=e[1]:(r=A6(t.parts),e[0]=t.parts,e[1]=r);let i=r,a;if(e[2]!==n||e[3]!==t.id||e[4]!==i){let r;e[6]===t.id?r=e[7]:(r=e=>e.kind===`group`?{...e,key:`${t.id}-${e.firstIndex}-group-${e.hasLaterText?`past`:`current`}`}:{...e,key:`${t.id}-${j6(e.segment,e.segmentIndex)}-${e.segment.kind}`},e[6]=t.id,e[7]=r),a=k8(i,n).map(r),e[2]=n,e[3]=t.id,e[4]=i,e[5]=a}else a=e[5];return a}var e5=(0,L.createContext)(null);function t5(){let e=(0,L.use)(e5);if(!e)throw Error(`CompactTrajectory group parts must be rendered within CompactTrajectory.Group`);return e}function n5(e){let t=(0,U.c)(21),{group:n,children:r}=e,{registry:i}=T4(),{message:a}=H4(),o=V4(),[s,c]=(0,L.useState)(!n.hasLaterText),l,u,d;if(t[0]!==n.hasLaterText||t[1]!==n.items||t[2]!==i||t[3]!==o){let e;t[7]===i?e=t[8]:(e=e=>{let{segment:t}=e;return R8(t,i)},t[7]=i,t[8]=e),u=n.items.map(e),l=W8({items:n.items,labels:u,status:o,hasLaterText:n.hasLaterText}),d=j8({groupStatus:l,labelCount:u.length}),t[0]=n.hasLaterText,t[1]=n.items,t[2]=i,t[3]=o,t[4]=l,t[5]=u,t[6]=d}else l=t[4],u=t[5],d=t[6];let f=d,p;t[9]!==n.items||t[10]!==l||t[11]!==u||t[12]!==a.id||t[13]!==f?(p={items:n.items,labels:u,groupStatus:l,tone:f,messageId:a.id},t[9]=n.items,t[10]=l,t[11]=u,t[12]=a.id,t[13]=f,t[14]=p):p=t[14];let m;t[15]!==r||t[16]!==s?(m=(0,R.jsx)(dr,{open:s,onOpenChange:c,className:`my-2 min-w-0`,children:r}),t[15]=r,t[16]=s,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,R.jsx)(e5,{value:p,children:m}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function r5(e){let t=(0,U.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`button`,{type:`button`,className:L4(`items-start`)}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,R.jsx)(fr,{render:r,children:(0,R.jsx)(`span`,{className:`min-w-0 flex-1 text-left text-sm`,children:n})}),t[1]=n,t[2]=i),i}function i5(){let e=(0,U.c)(12),{items:t,labels:n,groupStatus:r,tone:i}=t5(),a;e[0]!==r||e[1]!==t||e[2]!==n?(a=Y8(n,r,Z8(t)),e[0]=r,e[1]=t,e[2]=n,e[3]=a):a=e[3];let o=a,s;e[4]!==r||e[5]!==n?(s=X8(n,r),e[4]=r,e[5]=n,e[6]=s):s=e[6];let c=s,l;return e[7]!==c||e[8]!==r||e[9]!==o||e[10]!==i?(l={title:o,detail:c,tone:i,groupStatus:r},e[7]=c,e[8]=r,e[9]=o,e[10]=i,e[11]=l):l=e[11],l}function a5(e){let t=(0,U.c)(9),{title:n,suffix:r,children:i}=e,{title:a,tone:o,groupStatus:s}=i5(),c=n??a,l=r?`${c} · ${r}`:c,u=s===`running`,d=s===`running`?`text-info`:o.title,f;t[0]===d?f=t[1]:(f=j(`max-w-full min-w-0 truncate`,d),t[0]=d,t[1]=f);let p;t[2]!==u||t[3]!==f||t[4]!==l?(p=(0,R.jsx)(F4,{as:`span`,enabled:u,className:f,children:l}),t[2]=u,t[3]=f,t[4]=l,t[5]=p):p=t[5];let m;return t[6]!==i||t[7]!==p?(m=(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[p,i]}),t[6]=i,t[7]=p,t[8]=m):m=t[8],m}function o5(){let e=(0,U.c)(2),{tone:t}=t5(),n;return e[0]===t.chevron?n=e[1]:(n=(0,R.jsx)(I4,{className:t.chevron}),e[0]=t.chevron,e[1]=n),n}function s5(e){let t=(0,U.c)(5),{detail:n}=e,{title:r,detail:i,tone:a}=i5();if(n===null)return null;let o=n??i;if(!o||o===r)return null;let s;t[0]===a.detail?s=t[1]:(s=j(`block truncate text-xs`,a.detail),t[0]=a.detail,t[1]=s);let c;return t[2]!==o||t[3]!==s?(c=(0,R.jsx)(`span`,{className:s,children:o}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}function c5(e){let t=(0,U.c)(14),{children:n}=e,{items:r,messageId:i,groupStatus:a}=t5(),o=a===`running`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={initial:`instant`,resize:`instant`},t[0]=s):s=t[0];let{scrollRef:c,contentRef:l}=cT(s),u=o?c:void 0,d=o&&`max-h-64 overflow-y-auto`,f;t[1]===d?f=t[2]:(f=j(`mt-2`,d),t[1]=d,t[2]=f);let p=o?l:void 0,m;t[3]!==n||t[4]!==r||t[5]!==i?(m=n??r.map((e,t)=>{let{segment:n}=e,r=`${i}-${j6(n,t)}-${n.kind}`;return n.kind===`tool`?(0,R.jsx)(E6.Tool,{segment:n},r):n.kind===`reasoning`?(0,R.jsx)(E6.Reasoning,{segment:n},r):n.kind===`dynamic-tool`?(0,R.jsx)(E6.DynamicTool,{segment:n},r):null}),t[3]=n,t[4]=r,t[5]=i,t[6]=m):m=t[6];let h;t[7]!==p||t[8]!==m?(h=(0,R.jsx)(`div`,{ref:p,children:m}),t[7]=p,t[8]=m,t[9]=h):h=t[9];let g;return t[10]!==u||t[11]!==f||t[12]!==h?(g=(0,R.jsx)(pr,{ref:u,className:f,children:h}),t[10]=u,t[11]=f,t[12]=h,t[13]=g):g=t[13],g}function l5(e){let t=(0,U.c)(19),{item:n,textClassName:r}=e,i=r===void 0?`my-4`:r,{elements:a}=B4(),{segment:o}=n;if(o.kind===`text`){let e;t[0]===o.parts?e=t[1]:(e=o.parts.filter(u5),t[0]=o.parts,t[1]=e);let n=e;if(n.length===0)return null;let r;t[2]!==o||t[3]!==n?(r={...o,parts:n},t[2]=o,t[3]=n,t[4]=r):r=t[4];let s;return t[5]!==a||t[6]!==r||t[7]!==i?(s=(0,R.jsx)(E6.Text,{segment:r,elements:a,className:i}),t[5]=a,t[6]=r,t[7]=i,t[8]=s):s=t[8],s}if(o.kind===`file`){let e;return t[9]===o?e=t[10]:(e=(0,R.jsx)(E6.File,{segment:o}),t[9]=o,t[10]=e),e}if(o.kind===`source`){let e;return t[11]===o?e=t[12]:(e=(0,R.jsx)(E6.Source,{segment:o}),t[11]=o,t[12]=e),e}if(o.kind===`tool`){let e;return t[13]===o?e=t[14]:(e=(0,R.jsx)(E6.Tool,{segment:o}),t[13]=o,t[14]=e),e}if(o.kind===`reasoning`){let e;return t[15]===o?e=t[16]:(e=(0,R.jsx)(E6.Reasoning,{segment:o}),t[15]=o,t[16]=e),e}if(o.kind===`dynamic-tool`){let e;return t[17]===o?e=t[18]:(e=(0,R.jsx)(E6.DynamicTool,{segment:o}),t[17]=o,t[18]=e),e}return null}function u5(e){let{part:t}=e;return!m6(t)}function d5(){let e=(0,U.c)(1),t=V4(),{messages:n}=B4(),{debugMode:r}=T4(),i=n[n.length-1];if(t!==`ready`&&t!==`error`&&Q8(i,r))return null;let a;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,R.jsx)(X6,{}),e[0]=a):a=e[0],a}var f5={Root:V6,List:H6,Item:U6,UserBubble:T8,AssistantContent:(0,L.memo)(function(e){let t=(0,U.c)(5),{className:n}=e,r=$8(),i;t[0]===r?i=t[1]:(i=r.map(p5),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,R.jsx)(`div`,{className:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}),Actions:F6,CopyAction:I6,RegenerateAction:L6,CopyDebugJsonAction:R6,Thinking:d5,Error:B6};function p5(e){return e.kind===`group`?(0,R.jsxs)(n5,{group:e,children:[(0,R.jsxs)(r5,{children:[(0,R.jsx)(a5,{children:(0,R.jsx)(o5,{})}),(0,R.jsx)(s5,{})]}),(0,R.jsx)(c5,{})]},e.key):(0,R.jsx)(l5,{item:e},e.key)}function m5(e){let t=(0,U.c)(8),{message:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`text-destructive/90 bg-destructive/10 flex items-start gap-2 rounded-md px-3 py-2 text-sm`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,R.jsx)(NT,{className:`text-destructive mt-0.5 size-4 shrink-0`}),t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=(0,R.jsx)(`span`,{children:n}),t[3]=n,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,R.jsxs)(`div`,{className:i,children:[a,o]}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function h5(e){let t=(0,U.c)(15),{part:n}=e,r=T4(),i,a;if(t[0]!==r.registry||t[1]!==n){a=Symbol.for(`react.early_return_sentinel`);bb0:{let{toolEntry:e}=G3(n,r.registry);if(e&&K3(e,n.state)){let t=e.label?.(n);if(!t){a=null;break bb0}let r=t.icon,i=t.args?Object.values(t.args)[0]:void 0;a=(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center text-xs`,children:[r&&(0,R.jsx)(r,{className:`size-3.5`}),(0,R.jsx)(`span`,{className:`ms-2 font-mono`,children:t.name}),i&&(0,R.jsxs)(`span`,{className:`truncate`,children:[`(`,i,`)`]})]});break bb0}i=e?.label?.(n)}t[0]=r.registry,t[1]=n,t[2]=i,t[3]=a}else i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o=i,s;t[4]!==o||t[5]!==n?(s=o&&(0,R.jsx)(u6,{label:o,part:n}),t[4]=o,t[5]=n,t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=o?.isError&&o.detail&&(0,R.jsx)(m5,{message:o.detail}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,R.jsx)(o6,{part:n}),t[9]=n,t[10]=l);let u;return t[11]!==s||t[12]!==c||t[13]!==l?(u=(0,R.jsxs)(R.Fragment,{children:[s,c,l]}),t[11]=s,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function g5(e){let t=(0,U.c)(5),{part:n}=e,[r,i]=(0,L.useState)(!1),a;t[0]===n.text?a=t[1]:(a=(0,R.jsx)(D3,{mode:`static`,children:n.text}),t[0]=n.text,t[1]=a);let o;return t[2]!==r||t[3]!==a?(o=(0,R.jsx)(`div`,{"data-copy-exclude":`assistant-snapshot`,className:`bg-muted/30 prose max-w-auto prose-sm text-muted-foreground border-border mb-4 w-full min-w-full rounded-lg p-3`,children:(0,R.jsx)(d8,{label:`Reasoning`,open:r,onOpenChange:i,className:`text-xs`,triggerClassName:`w-full gap-x-2 text-sm hover:opacity-80`,contentClassName:`mt-2`,children:a})}),t[2]=r,t[3]=a,t[4]=o):o=t[4],o}function _5(e){let t=(0,U.c)(15),{part:n}=e,{elements:r}=B4(),i=s6();if(n.type===`text`){if(n.providerMetadata?.openai?.phase===`commentary`)return null;let e;return t[0]!==r||t[1]!==n.text?(e=(0,R.jsx)(a6,{text:n.text,elements:r}),t[0]=r,t[1]=n.text,t[2]=e):e=t[2],e}if(n.type===`dynamic-tool`){let e;return t[3]!==i||t[4]!==n?(e=i?(0,R.jsx)(B3,{part:n}):null,t[3]=i,t[4]=n,t[5]=e):e=t[5],e}if(ep(n)){let e;return t[6]===n?e=t[7]:(e=(0,R.jsx)(h5,{part:n}),t[6]=n,t[7]=e),e}if(n.type===`reasoning`&&n.text){let e;return t[8]!==i||t[9]!==n?(e=i?(0,R.jsx)(g5,{part:n}):null,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}if(n.type===`file`){let e;return t[11]!==n.filename||t[12]!==n.mediaType||t[13]!==n.url?(e=(0,R.jsx)(i6,{filename:n.filename,mediaType:n.mediaType,url:n.url}),t[11]=n.filename,t[12]=n.mediaType,t[13]=n.url,t[14]=e):e=t[14],e}return null}(0,L.memo)(function(e){let t=(0,U.c)(10),{className:n}=e,{message:r}=H4(),i;t[0]===n?i=t[1]:(i=j(`flex-1 space-y-3`,n),t[0]=n,t[1]=i);let a;if(t[2]!==r.id||t[3]!==r.parts){let e;t[5]===r.id?e=t[6]:(e=(e,t)=>(0,R.jsx)(_5,{part:e},`${r.id}-${t}`),t[5]=r.id,t[6]=e),a=r.parts.map(e),t[2]=r.id,t[3]=r.parts,t[4]=a}else a=t[4];let o;return t[7]!==i||t[8]!==a?(o=(0,R.jsx)(`div`,{className:i,children:a}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o});var v5={braille:{frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],interval:80},pulse:{frames:[`⠁`,`⠉`,`⠋`,`⠛`,`⠟`,`⠿`,`⡿`,`⣿`,`⡿`,`⠿`,`⠟`,`⠛`,`⠋`,`⠉`,`⠁`,`⠀`],interval:80},clock:{frames:[`⠁`,`⠈`,`⠐`,`⠠`,`⢀`,`⡀`,`⠄`,`⠂`],interval:100},limerence:{frames:[`⠁`,`⠃`,`⠇`,`⡇`,`⣇`,`⣇`,`⣆`,`⣄`,`⣀`,`⢀`,`⠀`],interval:100}};function y5(e){let t=(0,U.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`braille`:i,o=ae(),{frames:s,interval:c}=v5[a],[l,u]=(0,L.useState)(0),d,f;t[4]!==o||t[5]!==s.length||t[6]!==c?(d=()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=o.setInterval(()=>{u(e=>(e+1)%s.length)},c);return()=>o.clearInterval(e)},f=[o,s.length,c],t[4]=o,t[5]=s.length,t[6]=c,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,L.useEffect)(d,f);let p;t[9]===n?p=t[10]:(p=j(`inline-block`,n),t[9]=n,t[10]=p);let m=s[l],h;return t[11]!==r||t[12]!==p||t[13]!==m?(h=(0,R.jsx)(`span`,{role:`status`,"aria-label":`Loading`,className:p,...r,children:m}),t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function b5(e){let t=(0,U.c)(11),{Icon:n,isLast:r,isLoading:i,aborted:a,state:o,isError:s}=e,c;t[0]!==n||t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==o?(c=i?(0,R.jsx)(y5,{className:`text-muted-foreground z-10 shrink-0 text-sm`}):a?(0,R.jsx)(OT,{className:`text-destructive z-10 size-3.5 shrink-0`}):(0,R.jsx)(n,{className:j(`z-10 size-3.5 shrink-0`,o===`output-error`||s?`text-destructive`:`text-muted-foreground`)}),t[0]=n,t[1]=a,t[2]=s,t[3]=i,t[4]=o,t[5]=c):c=t[5];let l;t[6]===r?l=t[7]:(l=!r&&(0,R.jsx)(`span`,{className:`bg-border w-px flex-1`}),t[6]=r,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,R.jsxs)(`div`,{className:`absolute top-0 left-0 flex h-full flex-col items-center`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function x5(e){let t=(0,U.c)(15),{isLast:n,label:r,state:i,aborted:a,children:o}=e,s=(0,L.use)(x6),c=r??s?.label,l=i??s?.state,u=a??s?.aborted??!1,d=c?.icon,f=!!l&&!u&&l!==`output-available`&&l!==`output-error`,p;t[0]!==d||t[1]!==u||t[2]!==c?.isError||t[3]!==l||t[4]!==n||t[5]!==f?(p=d?(0,R.jsx)(b5,{Icon:d,isLast:n,isLoading:f,aborted:u,state:l,isError:c?.isError??!1}):(0,R.jsx)(J6,{isLast:n}),t[0]=d,t[1]=u,t[2]=c?.isError,t[3]=l,t[4]=n,t[5]=f,t[6]=p):p=t[6];let m=p,h=n?``:`pb-3.5`,g;t[7]===h?g=t[8]:(g=j(`min-w-0 flex-1`,h),t[7]=h,t[8]=g);let _;t[9]!==o||t[10]!==g?(_=(0,R.jsx)(`div`,{className:g,children:o}),t[9]=o,t[10]=g,t[11]=_):_=t[11];let v;return t[12]!==m||t[13]!==_?(v=(0,R.jsx)(Y6,{marker:m,children:_}),t[12]=m,t[13]=_,t[14]=v):v=t[14],v}function S5(e){let t=(0,U.c)(10),{label:n,state:r,part:i,defaultOpen:a,children:o}=e,s=a!==void 0&&a,c;t[0]!==n||t[1]!==i||t[2]!==r?(c=(0,R.jsx)(fr,{className:`cursor-pointer`,children:(0,R.jsx)(f6,{label:n,state:r,part:i})}),t[0]=n,t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,R.jsx)(pr,{children:o}),t[4]=o,t[5]=l);let u;return t[6]!==s||t[7]!==c||t[8]!==l?(u=(0,R.jsxs)(dr,{defaultOpen:s,className:`flex min-w-0 flex-1 flex-col`,children:[c,l]}),t[6]=s,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}var C5={Item:x5,Disclosure:S5};(0,L.memo)(function(e){let t=(0,U.c)(12),{className:n}=e,{message:r}=H4(),{elements:i}=B4(),{debugMode:a}=T4(),o=s6(),s=U3(),c;t[0]===r.parts?c=t[1]:(c=A6(r.parts),t[0]=r.parts,t[1]=c);let l=c,u;t[2]!==a||t[3]!==i||t[4]!==s||t[5]!==r.id||t[6]!==l||t[7]!==o?(u=l.map((e,t)=>{let n=`${r.id}-${j6(e,t)}-${e.kind}`;if(e.kind===`text`)return(0,R.jsx)(E6.Text,{segment:e,elements:i,className:`my-4`},n);if(e.kind===`file`)return(0,R.jsx)(E6.File,{segment:e},n);if(e.kind===`source`)return(0,R.jsx)(E6.Source,{segment:e},n);if(e.kind===`dynamic-tool`){if(!o)return null;let r=!k6(l,t,!0);return(0,R.jsx)(C5.Item,{isLast:r,children:(0,R.jsx)(E6.DynamicTool,{segment:e})},n)}if(e.kind===`reasoning`){if(s||e.part.type!==`reasoning`)return null;let r=!k6(l,t,a),i={name:`Reasoning`,icon:zT,args:{text:[...e.part.text].slice(0,60).join(``)}};return(0,R.jsx)(C5.Item,{isLast:r,label:i,children:(0,R.jsx)(C5.Disclosure,{label:i,children:(0,R.jsx)(E6.Reasoning,{segment:e})})},n)}if(e.kind===`tool`){let r=!k6(l,t,a);return(0,R.jsx)(E6.Tool,{segment:e,children:(0,R.jsx)(C5.Item,{isLast:r,children:(0,R.jsx)(E6.ToolDisclosure,{})})},n)}return null}),t[2]=a,t[3]=i,t[4]=s,t[5]=r.id,t[6]=l,t[7]=o,t[8]=u):u=t[8];let d;return t[9]!==n||t[10]!==u?(d=(0,R.jsx)(`div`,{className:n,children:u}),t[9]=n,t[10]=u,t[11]=d):d=t[11],d});function w5(e){let t=(0,U.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{hasSubmitted:i}=D4(),a;t[3]===n?a=t[4]:(a=j(`bg-background sticky bottom-0 rounded-t-2xl border-0 **:data-[slot=composer-editor]:!min-h-15`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,R.jsx)(M2.Root,{hasInteracted:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function T5(e){let t=(0,U.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=j(`border-border bg-card focus-within:border-primary/80 focus-within:ring-primary/15 relative rounded-2xl border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function E5(e){let t=(0,U.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=j(`space-y-1 px-3.5 pt-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M2.Content,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function D5(e){let t=(0,U.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=j(`!min-h-15 !rounded-none !border-0 !bg-transparent !shadow-none **:data-[slot=composer-editor]:!p-0 **:data-[slot=composer-placeholder]:!p-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M2.Editor,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function O5(e){let t=(0,U.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=j(`pb-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M2.Attachments,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function k5(e){let t=(0,U.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=j(`p-1.5 pt-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(M2.Toolbar,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function A5(e){let t=(0,U.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,R.jsx)(N6,{icon:(0,R.jsx)(WT,{className:`size-4`})}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,R.jsx)(M2.AttachFiles,{"aria-label":`Attach files`,render:n,...e}),t[1]=e,t[2]=r),r}function j5(){let e=(0,U.c)(6),{actions:t,meta:n}=_Q(`ChatComposer.CommandButton`),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(GT,{className:`size-4`}),e[0]=r):r=e[0];let i=n.activePopup?.trigger===`/`,a;e[1]===t?a=e[2]:(a=e=>{e.stopPropagation(),t.toggleSlashMenu()},e[1]=t,e[2]=a);let o;return e[3]!==i||e[4]!==a?(o=(0,R.jsx)(N6,{"data-command-button":!0,icon:r,"aria-label":`Toggle command menu`,"aria-expanded":i,onClick:a}),e[3]=i,e[4]=a,e[5]=o):o=e[5],o}function M5(e){switch(e){case`permission-denied`:return`Allow microphone access to use dictation`;case`no-microphone`:return`Connect a microphone to use dictation`;case`microphone-in-use`:return`Close other apps using the microphone`;case`interrupted`:return`Recording interrupted`;case`transcription-failed`:return`Unable to transcribe audio`}}function N5(e){switch(e.status){case`unavailable`:return e.reason===`blocked`?`Allow microphone access in your browser settings to use dictation`:`Dictation is not available in this browser`;case`idle`:return`Start dictation`;case`starting`:return`Starting dictation`;case`recording`:return`Stop dictation`;case`finishing`:return`Transcribing…`;case`failed`:return M5(e.error.code)}}function P5(e){switch(e.status){case`recording`:return(0,R.jsx)(qT,{className:`size-4 fill-current`});case`starting`:case`finishing`:return(0,R.jsx)(VT,{className:`size-4 animate-spin`});case`unavailable`:case`idle`:case`failed`:return(0,R.jsx)(UT,{className:`size-4`})}}function F5(){let e=(0,U.c)(20),{status:t}=E4(),{state:n}=y1(`ChatComposer.Dictate`),r;e[0]===n?r=e[1]:(r=N5(n),e[0]=n,e[1]=r);let i=r,a=n.status===`starting`||n.status===`recording`||n.status===`finishing`,o=t===`streaming`||t===`submitted`,s;e[2]===n?s=e[3]:(s=P5(n),e[2]=n,e[3]=s);let c;e[4]!==i||e[5]!==s?(c=(0,R.jsx)(N6,{icon:s,"aria-label":i,title:i}),e[4]=i,e[5]=s,e[6]=c):c=e[6];let l;e[7]!==o||e[8]!==c?(l=(0,R.jsx)(M2.Dictate,{disabled:o,render:c}),e[7]=o,e[8]=c,e[9]=l):l=e[9];let u;e[10]!==a||e[11]!==n.status?(u=a?(0,R.jsx)(M2.CancelDictation,{render:(0,R.jsx)(N6,{icon:(0,R.jsx)(XT,{className:`size-4`}),"aria-label":n.status===`finishing`?`Cancel transcription`:`Cancel dictation`})}):null,e[10]=a,e[11]=n.status,e[12]=u):u=e[12];let d;e[13]!==i||e[14]!==n.status?(d=n.status===`failed`?(0,R.jsx)(`span`,{role:`status`,className:`text-destructive max-w-48 truncate text-xs`,children:i}):null,e[13]=i,e[14]=n.status,e[15]=d):d=e[15];let f;return e[16]!==l||e[17]!==u||e[18]!==d?(f=(0,R.jsxs)(R.Fragment,{children:[l,u,d]}),e[16]=l,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}var I5={Provider:w5,Root:T5,Popup:M2.Popup,Content:E5,Attachments:O5,Editor:D5,Error:M2.Error,Toolbar:k5,CommandButton:j5,AttachFiles:A5,Dictate:F5};function L5(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`border-border flex flex-col border-b px-2 py-1.5`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,R.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function R5(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`flex items-center gap-2 px-2 py-1.5`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,R.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function z5(e){let t=(0,U.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=j(`text-muted-foreground size-3.5 shrink-0`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,R.jsx)(BT,{className:r}),t[2]=r,t[3]=i),i}function B5(e){let t=(0,U.c)(7),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`min-w-0 flex-1 truncate text-sm`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=typeof n==`string`?(0,R.jsx)(P2,{text:n}):n,t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,R.jsx)(`span`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function V5(e){let t=(0,U.c)(6),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`text-muted-foreground hover:text-foreground shrink-0 rounded p-1 transition-colors`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,R.jsx)(JT,{className:`size-3.5`}),t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==i?(o=(0,R.jsx)(`button`,{type:`button`,onClick:n,className:i,"aria-label":`Remove queued message`,children:a}),t[3]=n,t[4]=i,t[5]=o):o=t[5],o}var H5={Root:L5,Item:R5,Icon:z5,Text:B5,Remove:V5},U5={normal:{d:`m5 12 7-7 7 7`,translateY:0},animate:{d:`m5 12 7-7 7 7`,translateY:[0,3,0],transition:{duration:.4}}},W5={normal:{d:`M12 19V5`},animate:{d:[`M12 19V5`,`M12 19V10`,`M12 19V5`],transition:{duration:.4}}},G5=e=>{let t=(0,U.c)(30),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({ref:o,onMouseEnter:r,onMouseLeave:i,className:n,size:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=s===void 0?20:s,l=tT(),u=(0,L.useRef)(!1),d;t[7]===l?d=t[8]:(d=()=>(u.current=!0,{startAnimation:()=>l.start(`animate`),stopAnimation:()=>l.start(`normal`)}),t[7]=l,t[8]=d),(0,L.useImperativeHandle)(o,d);let f;t[9]!==l||t[10]!==r?(f=e=>{u.current?r?.(e):l.start(`animate`)},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p=f,m;t[12]!==l||t[13]!==i?(m=e=>{u.current?i?.(e):l.start(`normal`)},t[12]=l,t[13]=i,t[14]=m):m=t[14];let h=m,g;t[15]===n?g=t[16]:(g=j(n),t[15]=n,t[16]=g);let _,v;t[17]===l?(_=t[18],v=t[19]):(_=(0,R.jsx)(nT.path,{animate:l,d:`m5 12 7-7 7 7`,variants:U5}),v=(0,R.jsx)(nT.path,{animate:l,d:`M12 19V5`,variants:W5}),t[17]=l,t[18]=_,t[19]=v);let y;t[20]!==c||t[21]!==_||t[22]!==v?(y=(0,R.jsxs)(`svg`,{fill:`none`,height:c,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:c,xmlns:`http://www.w3.org/2000/svg`,children:[_,v]}),t[20]=c,t[21]=_,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==p||t[25]!==h||t[26]!==a||t[27]!==g||t[28]!==y?(b=(0,R.jsx)(`div`,{className:g,onMouseEnter:p,onMouseLeave:h,...a,children:y}),t[24]=p,t[25]=h,t[26]=a,t[27]=g,t[28]=y,t[29]=b):b=t[29],b};G5.displayName=`ArrowUpIcon`;var K5={duration:.15,ease:[0,0,.2,1]},q5={duration:.12,ease:[0,0,.2,1]};function J5(e){let t=(0,U.c)(40),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({variant:a,className:n,disabled:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=Yw(),s=a===`stop`,c;t[5]===o?c=t[6]:(c=!o&&{opacity:0,scale:.9},t[5]=o,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l={opacity:1,scale:1},t[7]=l):l=t[7];let u;t[8]===o?u=t[9]:(u=o?void 0:{opacity:0,scale:.9},t[8]=o,t[9]=u);let d;t[10]!==r||t[11]!==o?(d=r||o?void 0:{scale:1.04},t[10]=r,t[11]=o,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==o?(f=r||o?void 0:{scale:.96},t[13]=r,t[14]=o,t[15]=f):f=t[15];let p=s?`Stop streaming`:`Send prompt`,m;t[16]===n?m=t[17]:(m=j(`relative flex size-8 items-center justify-center rounded-full`,`bg-primary text-primary-foreground`,`transition-opacity hover:opacity-90 active:opacity-80`,`disabled:cursor-not-allowed disabled:opacity-35 disabled:hover:opacity-35`,`focus-visible:outline-[1.5px] focus-visible:outline-offset-[2.5px] focus-visible:outline-current`,n),t[16]=n,t[17]=m);let h=s?`stop`:`send`,g;t[18]===o?g=t[19]:(g=!o&&{opacity:0,scale:.7},t[18]=o,t[19]=g);let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_={opacity:1,scale:1},t[20]=_):_=t[20];let v;t[21]===o?v=t[22]:(v=o?void 0:{opacity:0,scale:.7},t[21]=o,t[22]=v);let y;t[23]===s?y=t[24]:(y=(0,R.jsx)(s?Z5:X5,{}),t[23]=s,t[24]=y);let b;t[25]!==v||t[26]!==y||t[27]!==h||t[28]!==g?(b=(0,R.jsx)(QS,{initial:!1,children:(0,R.jsx)(nT.span,{initial:g,animate:_,exit:v,transition:q5,className:`absolute flex items-center justify-center`,children:y},h)}),t[25]=v,t[26]=y,t[27]=h,t[28]=g,t[29]=b):b=t[29];let x;return t[30]!==r||t[31]!==i||t[32]!==c||t[33]!==b||t[34]!==u||t[35]!==d||t[36]!==f||t[37]!==p||t[38]!==m?(x=(0,R.jsx)(nT.button,{initial:c,animate:l,exit:u,transition:K5,whileHover:d,whileTap:f,"aria-label":p,...i,disabled:r,className:m,children:b}),t[30]=r,t[31]=i,t[32]=c,t[33]=b,t[34]=u,t[35]=d,t[36]=f,t[37]=p,t[38]=m,t[39]=x):x=t[39],x}function Y5(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,R.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:n}),t[0]=n,t[1]=r),r}function X5(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(G5,{}),e[0]=t):t=e[0],t}function Z5(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(Y5,{children:(0,R.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`1.5`})}),e[0]=t):t=e[0],t}function Q5(e){let t=(0,U.c)(25),{title:n,detail:r,detailLabel:i,part:a,error:o}=e,s=n===void 0?`Failed to render tool`:n,c=i===void 0?`View details`:i,l=O4(),u;t[0]===o.issues?u=t[1]:(u=o.issues.map($5).join(`
|
|
3515
|
-
`),t[0]=o.issues,t[1]=u);let d=u,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,R.jsx)(NT,{className:`size-5`}),t[2]=f):f=t[2];let p;t[3]===s?p=t[4]:(p=(0,R.jsx)(Fn,{children:(0,R.jsxs)(In,{className:`text-destructive flex items-center gap-2`,children:[f,s]})}),t[3]=s,t[4]=p);let m,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,R.jsx)(NT,{className:`size-4`}),g=(0,R.jsx)(O,{children:`Error`}),t[5]=m,t[6]=g):(m=t[5],g=t[6]);let _;t[7]===d?_=t[8]:(_=(0,R.jsxs)(h,{variant:`destructive`,children:[m,g,(0,R.jsx)(Pe,{children:d})]}),t[7]=d,t[8]=_);let v;t[9]!==r||t[10]!==c?(v=r&&(0,R.jsxs)(`details`,{className:`text-sm`,children:[(0,R.jsx)(`summary`,{className:`text-muted-foreground hover:text-foreground cursor-pointer`,children:c}),(0,R.jsx)(`pre`,{className:`bg-muted mt-2 max-h-48 overflow-auto rounded-md p-3 text-xs`,children:(0,R.jsx)(`code`,{children:r})})]}),t[9]=r,t[10]=c,t[11]=v):v=t[11];let y;t[12]!==_||t[13]!==v?(y=(0,R.jsxs)(zn,{className:`space-y-4`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]!==l||t[16]!==a?(b=()=>{let e=[`The model tried to call the tool "${ip(a)}" with the following inputs:`,JSON.stringify(a.input),`Please fix the inputs.`];l.addToolOutput({toolCallId:a.toolCallId,tool:ip(a),output:e,state:`output-available`})},t[15]=l,t[16]=a,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,R.jsx)(KT,{className:`size-4`}),t[18]=x):x=t[18];let S;t[19]===b?S=t[20]:(S=(0,R.jsx)(Bn,{children:(0,R.jsxs)(tt,{variant:`outline`,onClick:b,className:`gap-2`,children:[x,`Ask AI to fix this`]})}),t[19]=b,t[20]=S);let C;return t[21]!==y||t[22]!==S||t[23]!==p?(C=(0,R.jsxs)(Pn,{className:`border-destructive/50 bg-destructive/5`,children:[p,y,S]}),t[21]=y,t[22]=S,t[23]=p,t[24]=C):C=t[24],C}function $5(e){return`${e.path.join(`.`)}: ${e.message}`}(0,L.createContext)(``),L.Component,L.useState,L.useEffect,L.useMemo,L.useCallback,L.useReducer,L.useId,L.Fragment,L.createElement,(0,L.createContext)(null),(0,L.createContext)(null),(0,L.createContext)(null);function e7({question:e}){let{submit:t}=T4();return typeof e!=`string`||e===``?null:(0,R.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:bg-accent hover:text-accent-foreground my-1 inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-sm transition-colors`,onClick:()=>void t({prompt:e,persistedPrompt:e}),children:[(0,R.jsx)(an,{className:`size-3.5`}),e]})}var t7=yT([{name:`followup`,description:`Suggest a follow-up question the user is likely to ask next. Renders as a clickable chip that sends the question as the next message. Example: <followup question="How do I undo this?" />`,allowedAttributes:[`question`],component:e7}]),n7=F({label:I().describe(`Display text for the option`),value:I().optional().describe(`Machine value; defaults to label`),description:I().optional().describe(`Helper text for the option`)}),r7=C(e=>typeof e==`object`&&e&&`questions`in e&&Array.isArray(e.questions)?{...e,questions:e.questions.map(e=>typeof e==`object`&&e?{...e,type:`choice`}:e)}:e,F({questions:et(F({type:Et(`choice`).describe(`Selection from predefined options`),question:I().describe(`The question text displayed to the user`),header:I().optional().describe(`Short context label`),multiSelect:Qe().default(!1).describe(`Whether multiple options can be selected`),options:et(n7).min(1).describe(`Available choices`)})).min(1).describe(`Questions to present as a wizard`)})),i7=F({label:I(),value:I()}),a7=F({answers:et(F({type:I(),question:I(),freeText:I().optional(),notes:I().optional(),choice:i7.optional(),choices:et(i7).optional(),multiSelect:Qe().optional(),answer:I().optional()}))});function o7(e){if(e.multiSelect){if(e.selectedMulti.length===0&&!e.customText.trim())return`Pick at least one option or add your own answer.`}else{if(!e.selected&&!e.isOther)return`Select an option or add your own answer.`;if(e.isOther&&!e.customText.trim())return`Add your custom answer for the "Other" option.`}return null}function s7(e){return{type:`choice`,multiSelect:e.multiSelect??!1,selected:null,selectedMulti:[],isOther:!1,customText:``,notes:``}}function c7(e){return e.options.filter(e=>(e.value??e.label).toLowerCase()!==`other`&&e.label.toLowerCase()!==`other`).map(e=>({label:e.label,value:e.value??e.label,description:e.description}))}function l7(e,t,n){let r=e=>{let t=n.find(t=>t.value===e);return t?{label:t.label,value:t.value}:{label:e,value:e}},i=t.notes.trim()||void 0,a=t.customText.trim()||void 0;if(t.multiSelect){let n=t.selectedMulti.map(r);return a&&n.push({label:`Other`,value:a}),{type:`choice`,question:e.question,multiSelect:!0,choices:n,freeText:a,notes:i}}return{type:`choice`,question:e.question,multiSelect:!1,choice:t.isOther?{label:`Other`,value:a??``}:r(t.selected??``),freeText:t.isOther?a:void 0,notes:i}}function u7({checked:e,children:t,disabled:n}){return(0,R.jsx)(`div`,{className:j(`border-border/60 relative flex items-start gap-2 rounded-lg border px-3 py-1.5 transition-all duration-150`,!n&&`hover:bg-muted/40`,e&&`border-primary/50 bg-primary/5`,n&&`opacity-60`),children:t})}function d7({htmlFor:e,label:t,description:n}){return(0,R.jsxs)(v,{htmlFor:e,className:`min-w-0 flex-1 cursor-pointer flex-col items-start gap-0`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:t}),n?(0,R.jsx)(`p`,{className:`text-muted-foreground text-xs leading-relaxed text-pretty`,children:n}):null]})}function f7({id:e,value:t,label:n,description:r,checked:i,disabled:a}){return(0,R.jsxs)(u7,{checked:i,disabled:a,children:[(0,R.jsx)(Vr,{id:e,value:t,disabled:a,className:`mt-0.5`}),(0,R.jsx)(d7,{htmlFor:e,label:n,description:r})]})}function p7({id:e,label:t,description:n,checked:r,disabled:i,onCheckedChange:a}){return(0,R.jsxs)(u7,{checked:r,disabled:i,children:[(0,R.jsx)(rr,{id:e,checked:r,disabled:i,onCheckedChange:e=>a(e===!0),className:`mt-0.5`}),(0,R.jsx)(d7,{htmlFor:e,label:t,description:n})]})}function m7({id:e,checked:t,disabled:n,customText:r,onCustomTextChange:i}){let a=(0,L.useRef)(null);return(0,R.jsxs)(u7,{checked:t,disabled:n,children:[(0,R.jsx)(Vr,{ref:a,id:e,value:`other`,disabled:n,className:`mt-0.5`}),(0,R.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Type your answer...`,disabled:n,onFocus:()=>{t||a.current?.click()},className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none disabled:cursor-not-allowed`})]})}function h7({hasCustom:e,disabled:t,customText:n,onCustomTextChange:r,onClear:i}){let a=(0,L.useRef)(null);return(0,R.jsxs)(u7,{checked:e,disabled:t,children:[(0,R.jsx)(rr,{ref:a,checked:e,disabled:t,onCheckedChange:e=>{e||i()},className:`mt-0.5`}),(0,R.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Type your answer...`,disabled:t,onFocus:()=>{e||a.current?.click()},className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none disabled:cursor-not-allowed`})]})}function g7({value:e,onChange:t,disabled:n}){return(0,R.jsx)(`div`,{className:`mt-2.5 border-t border-dashed pt-2.5`,children:(0,R.jsx)(ve,{value:e,onChange:e=>t(e.target.value),placeholder:`Add notes (optional)...`,disabled:n,rows:2,className:`resize-none text-sm`})})}function _7({value:e,onChange:t,options:n,disabled:r,fieldId:i}){if(e.multiSelect){let a=e.customText.trim().length>0,o=(n,r)=>{let i=new Set(e.selectedMulti);r?i.add(n):i.delete(n),t({...e,selectedMulti:[...i]})};return(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[n.map(t=>(0,R.jsx)(p7,{id:`${i}-multi-${t.value}`,label:t.label,description:t.description,checked:e.selectedMulti.includes(t.value),disabled:r,onCheckedChange:e=>o(t.value,e)},t.value)),(0,R.jsx)(h7,{hasCustom:a,disabled:r,customText:e.customText,onCustomTextChange:n=>t({...e,customText:n}),onClear:()=>t({...e,customText:``})})]})}return(0,R.jsxs)(Br,{value:e.isOther?`other`:e.selected??``,onValueChange:n=>t(n===`other`?{...e,selected:null,isOther:!0}:{...e,selected:n,isOther:!1,customText:``}),children:[n.map(t=>(0,R.jsx)(f7,{id:`${i}-single-${t.value}`,value:t.value,label:t.label,description:t.description,checked:!e.isOther&&e.selected===t.value,disabled:r},t.value)),(0,R.jsx)(m7,{id:`${i}-single-other`,checked:e.isOther,disabled:r,customText:e.customText,onCustomTextChange:n=>t({...e,customText:n})})]})}function v7({current:e,total:t}){return t<=1?null:(0,R.jsx)(`div`,{className:`flex items-center gap-1`,children:Array.from({length:t},(t,n)=>(0,R.jsx)(`div`,{className:j(`h-1 w-3 rounded-full transition-colors duration-200`,n<=e?`bg-primary`:`bg-muted`)},n))})}function y7({onBack:e,onNext:t,isFirst:n,isLast:r,canProceed:i,isSubmitting:a,isSubmitted:o,currentStep:s,totalSteps:c}){return o?null:(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-t border-dashed px-3 py-1.5`,children:[(0,R.jsx)(`div`,{className:`w-16`,children:n?null:(0,R.jsx)(`button`,{type:`button`,onClick:e,disabled:a,className:`text-muted-foreground hover:text-foreground text-xs transition-colors disabled:opacity-50`,children:`← Back`})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(v7,{current:s,total:c}),c>1?(0,R.jsxs)(`span`,{className:`text-muted-foreground text-[11px] tabular-nums`,children:[s+1,`/`,c]}):null]}),(0,R.jsx)(`div`,{className:`flex w-16 justify-end`,children:(0,R.jsxs)(tt,{type:`button`,size:`sm`,onClick:t,disabled:!i||a,children:[a?(0,R.jsx)(Hr,{}):null,a?`Sending...`:r?`Submit`:`Next`]})})]})}function b7({question:e}){return(0,R.jsxs)(`div`,{className:`px-3 pt-2.5 pb-2`,children:[(0,R.jsxs)(`div`,{className:`text-muted-foreground mb-2 flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(Ae,{className:`size-3`}),(0,R.jsx)(`span`,{children:e.header??`Clarification`})]}),(0,R.jsx)(Nn,{className:`mb-2`}),(0,R.jsx)(`p`,{className:`text-sm font-medium text-pretty`,children:e.question})]})}function x7({question:e,answer:t,options:n,onChange:r,disabled:i,fieldId:a}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_7,{value:t,onChange:r,options:n,disabled:i,fieldId:a}),(0,R.jsx)(g7,{value:t.notes,onChange:e=>r({...t,notes:e}),disabled:i})]})}function S7({question:e,answer:t,options:n}){let r=t.multiSelect?[...t.selectedMulti.map(e=>n.find(t=>t.value===e)?.label??e),...t.customText.trim()?[`Other: ${t.customText.trim()}`]:[]].join(`, `):t.isOther?`Other: ${t.customText.trim()}`:n.find(e=>e.value===t.selected)?.label??t.selected??``,i=t.notes.trim()||void 0;return(0,R.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm text-pretty`,children:e.question}),(0,R.jsx)(`p`,{className:`mt-1 text-sm font-medium text-pretty`,children:r}),i?(0,R.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs text-pretty italic`,children:[`Note: `,i]}):null]})}function C7(e){return e.type===`free_form`?e.answer??``:e.multiSelect&&e.choices?e.choices.map(({label:e,value:t})=>e===`Other`?`Other: ${t}`:e).join(`, `):e.freeText?`Other: ${e.freeText}`:e.choice?.label??``}function w7({answers:e}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`px-3 pt-2.5 pb-2`,children:(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[(0,R.jsx)(Fe,{className:`size-3`}),(0,R.jsx)(`span`,{children:`Answered`})]})}),(0,R.jsx)(Nn,{}),e.map((e,t)=>(0,R.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm text-pretty`,children:e.question}),(0,R.jsx)(`p`,{className:`mt-1 text-sm font-medium text-pretty`,children:C7(e)}),e.notes?(0,R.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs text-pretty italic`,children:[`Note: `,e.notes]}):null]},t))]})}function T7({questions:e,answers:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`px-3 pt-2.5 pb-2`,children:(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[(0,R.jsx)(Fe,{className:`size-3`}),(0,R.jsx)(`span`,{children:`Answered`})]})}),(0,R.jsx)(Nn,{}),e.map((e,n)=>(0,R.jsx)(S7,{question:e,answer:t[n],options:c7(e)},n))]})}var E7=(0,L.createContext)(void 0);function D7(){let e=(0,L.use)(E7);if(!e)throw Error(`useWizard must be used within <ClarificationWizard.Root>`);return e}function O7({questions:e,onSubmit:t,disabled:n,fieldId:r,children:i}){let[a,o]=(0,L.useState)(0),[s,c]=(0,L.useState)(()=>e.map(s7)),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),h=e[a],g=s[a],_=a===0,v=a===e.length-1,y={questions:e,currentStep:a,currentQuestion:h,currentAnswer:g,options:c7(h),answers:s,updateAnswer:e=>{c(t=>{let n=[...t];return n[a]=e,n}),u(null)},handleBack:()=>{_||(o(e=>e-1),u(null))},handleNext:async()=>{let n=o7(g);if(n){u(n);return}if(!v){o(e=>e+1),u(null);return}for(let t=0;t<e.length;t++){let e=o7(s[t]);if(e){o(t),u(e);return}}f(!0);try{await t(e.map((e,t)=>l7(e,s[t],c7(e)))),m(!0)}catch(e){u(e instanceof Error?e.message:`Failed to send your answers.`)}finally{f(!1)}},error:l,isFirst:_,isLast:v,canProceed:!n&&!p,isSubmitting:d,isSubmitted:p,disabled:n,fieldId:r,totalSteps:e.length};return(0,R.jsx)(E7,{value:y,children:i})}function k7(){let{currentQuestion:e,isSubmitted:t}=D7();return t?null:(0,R.jsx)(b7,{question:e})}function A7(){let{currentQuestion:e,currentAnswer:t,options:n,updateAnswer:r,disabled:i,isSubmitting:a,isSubmitted:o,fieldId:s,currentStep:c}=D7();return o?null:(0,R.jsx)(x7,{question:e,answer:t,options:n,onChange:r,disabled:i||a,fieldId:`${s}-step-${c}`})}function j7(){let{error:e,isSubmitted:t}=D7();return t||!e?null:(0,R.jsx)(`p`,{className:`text-destructive text-xs`,role:`alert`,children:e})}function M7(){let{handleBack:e,handleNext:t,isFirst:n,isLast:r,canProceed:i,isSubmitting:a,isSubmitted:o,currentStep:s,totalSteps:c}=D7();return(0,R.jsx)(y7,{onBack:e,onNext:()=>void t(),isFirst:n,isLast:r,canProceed:i,isSubmitting:a,isSubmitted:o,currentStep:s,totalSteps:c})}function N7({children:e,className:t}){let{isSubmitted:n}=D7();return n?null:(0,R.jsx)(`div`,{className:t,children:e})}function P7(){let{questions:e,answers:t,isSubmitted:n}=D7();return n?(0,R.jsx)(T7,{questions:e,answers:t}):null}var F7={Root:O7,Header:k7,Content:N7,Field:A7,Error:j7,Navigation:M7,Submitted:P7};function I7({part:e}){let t=O4(),[n,r]=(0,L.useState)(!1),i=(0,L.useId)();if(e.state===`output-available`){let t=a7.safeParse(e.output);return t.success?(0,R.jsx)(`div`,{className:j(`border-border/60 bg-muted/20 mb-2 rounded-lg border border-dashed`),children:(0,R.jsx)(w7,{answers:t.data.answers})}):null}if(e.state!==`input-available`)return null;let a=r7.safeParse(e.input);return a.success?(0,R.jsx)(`div`,{className:j(`border-border/60 bg-muted/20 rounded-lg border border-dashed`,`animate-in fade-in-0 duration-200`),children:(0,R.jsxs)(F7.Root,{questions:a.data.questions,onSubmit:async n=>{await t.addToolOutput({toolCallId:e.toolCallId,tool:ip(e),output:{answers:n},state:`output-available`}),r(!0)},disabled:n,fieldId:i,children:[(0,R.jsx)(F7.Submitted,{}),(0,R.jsx)(F7.Header,{}),(0,R.jsxs)(F7.Content,{className:`space-y-2 px-3 pb-2`,children:[(0,R.jsx)(F7.Field,{}),(0,R.jsx)(F7.Error,{})]}),(0,R.jsx)(F7.Navigation,{})]})}):(0,R.jsx)(Q5,{error:a.error,title:`Failed to render clarification`,detail:JSON.stringify(e.input,null,2),detailLabel:`View input`,part:e})}var L7={component:I7,label:e=>{let t=e.state===`input-available`||e.state===`output-available`?r7.safeParse(e.input):void 0,n=t?.success?t.data.questions[0]:void 0;return{name:`AskUserQuestion`,icon:nn,args:n?{question:n.header??n.question}:void 0}},requiresUserInput:!0,static:!1,inputSchema:r7,description:`Tool to collect information from the user via a multi-step wizard. Use when you need to clarify requirements, gather preferences, or resolve ambiguity before proceeding.
|
|
3513
|
+
`}var e3=`response-table-panel`,t3=[`title`,`description`],n3=j($e({variant:`ghost`,size:`icon-sm`})),r3=Bt().use(Jt).use(Kt).use(KE),i3=e=>{let t=Xt(e),n=s3(e);if(n.length===0)return t;let r=0,i=t.map(e=>{let t={start:r,end:r+e.length};return r=t.end,t}),a=new Set;for(let e of n){let t=!1;for(let[n,r]of i.entries())r.start<e.end&&r.end>e.start&&(t&&a.add(n),t=!0)}return t.reduce((e,t,n)=>(a.has(n)&&e.length>0?e[e.length-1]+=t:e.push(t),e),[])};function a3(e){return e?.type===`leafDirective`&&`name`in e&&e.name===`table`}function o3(e,t){if(t===void 0)return;let n=e[t-1];return a3(n)?n:void 0}function s3(e){let t=[];return Qt(r3.parse(e),`table`,(e,n,r)=>{if(!r)return;let i=o3(r.children,n)?.position?.start.offset,a=e.position?.end.offset;i!==void 0&&a!==void 0&&t.push({start:i,end:a})}),t}function c3(e,t){return e.attributes?.[t]?.trim()||void 0}function l3(e){let t=r3.parse(e),n=!1;if(Qt(t,`leafDirective`,(e,t,r)=>{let i=t===void 0?void 0:r?.children[t+1];if(e.name!==`table`||i?.type!==`table`)return;n=!0;let a=[c3(e,`title`),c3(e,`description`)].filter(Boolean).join(` `);e.children=a?[{type:`text`,value:a}]:[]}),n)return Ut(It(t,{includeHtml:!1}))}function u3(e){let t=(0,U.c)(2),n;return t[0]===e?n=t[1]:(n=(0,R.jsx)(Gt,{...e}),t[0]=e,t[1]=n),n}function d3(e){function t(t){let n=(0,U.c)(6),r;n[0]!==t.content||n[1]!==t.dir?(r=l3(t.content)??t.dir,n[0]=t.content,n[1]=t.dir,n[2]=r):r=n[2];let i=r,a;return n[3]!==i||n[4]!==t?(a=(0,R.jsx)(e,{...t,dir:i}),n[3]=i,n[4]=t,n[5]=a):a=n[5],a}return t.displayName=`DirectionAwareTableBlock`,t}function f3(e,t){let n=t&&c3(t,`title`),r=t&&c3(t,`description`),i={...n?{title:n}:{},...r?{description:r}:{}};return{type:`tablePanel`,data:{hName:e3,...Object.keys(i).length>0?{hProperties:i}:{}},children:[e]}}function p3(){return e=>{Qt(e,`table`,(e,t,n)=>{if(t===void 0||!n)return;let r=o3(n.children,t),i=r?t-1:t,a=r?2:1;return n.children.splice(i,a,f3(e,r)),[Ft,i+1]})}}var m3=[...Object.values(Yt),KE,p3],h3=L.createContext({actions:null,controls:!0});function g3(e,t){if(e===!1)return!1;if(e===!0||e===void 0)return!0;let n=e.table;return n===!1?!1:n===!0||n===void 0||n[t]!==!1}function _3(e){return e===!1?!1:e===!0||e===void 0?{table:!1}:{...e,table:!1}}function v3(e){let t=(0,U.c)(21),{children:n,className:r,title:i,description:a}=e,{actions:o,controls:s}=L.use(h3),c;t[0]===s?c=t[1]:(c=g3(s,`copy`),t[0]=s,t[1]=c);let l=c,u;t[2]===s?u=t[3]:(u=g3(s,`download`),t[2]=s,t[3]=u);let d=u,f=!!(i||a),p=!!(l||d||o);if(!n)return null;let m;t[4]===r?m=t[5]:(m=j(`my-4`,r),t[4]=r,t[5]=m);let h;t[6]!==o||t[7]!==a||t[8]!==p||t[9]!==f||t[10]!==l||t[11]!==d||t[12]!==i?(h=(f||p)&&(0,R.jsxs)(G4.Header,{className:j(!f&&`justify-end`),children:[f&&(0,R.jsxs)(G4.Heading,{children:[i&&(0,R.jsx)(G4.Title,{children:i}),a&&(0,R.jsx)(G4.Description,{className:j(i&&`mt-1`),children:a})]}),p&&(0,R.jsxs)(G4.Actions,{"data-copy-exclude":`assistant-snapshot`,children:[l&&(0,R.jsx)(Lt,{className:n3}),d&&(0,R.jsx)(qt,{className:n3}),o]})]}),t[6]=o,t[7]=a,t[8]=p,t[9]=f,t[10]=l,t[11]=d,t[12]=i,t[13]=h):h=t[13];let g;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=j(`overflow-hidden`,`[&>[data-streamdown=table-wrapper]]:m-0 [&>[data-streamdown=table-wrapper]]:gap-0 [&>[data-streamdown=table-wrapper]]:rounded-none [&>[data-streamdown=table-wrapper]]:border-0 [&>[data-streamdown=table-wrapper]]:bg-transparent [&>[data-streamdown=table-wrapper]]:p-0`,`[&>[data-streamdown=table-wrapper]>div:last-child]:rounded-none [&>[data-streamdown=table-wrapper]>div:last-child]:border-0`,`[&_[data-streamdown=table]]:tabular-nums`,`[&_[data-streamdown=table-header]]:bg-muted/30`,`[&_[data-streamdown=table-header-cell]]:text-muted-foreground [&_[data-streamdown=table-header-cell]]:text-xs [&_[data-streamdown=table-header-cell]]:font-medium`,`[&_[data-streamdown=table-cell]]:py-2`,`[&_[data-streamdown=table-row]]:hover:bg-muted/30`),t[14]=g):g=t[14];let _;t[15]===n?_=t[16]:(_=(0,R.jsx)(G4.Content,{className:g,children:n}),t[15]=n,t[16]=_);let v;return t[17]!==m||t[18]!==h||t[19]!==_?(v=(0,R.jsxs)(G4,{"data-streamdown":`table-wrapper`,className:m,children:[h,_]}),t[17]=m,t[18]=h,t[19]=_,t[20]=v):v=t[20],v}function y3(e){let t=(0,U.c)(43),n,r,i,a,o,s,c,l,u,d;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8],u=t[9],d=t[10]):({allowedTags:r,BlockComponent:n,children:i,components:a,controls:o,dir:s,mode:c,remarkPlugins:u,tableActions:d,...l}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=l,t[9]=u,t[10]=d);let f;bb0:{if(!u){f=m3;break bb0}let e;t[11]===u?e=t[12]:(e=[...u,KE,p3],t[11]=u,t[12]=e),f=e}let p=f,m;t[13]===r?m=t[14]:(m={...r,[e3]:t3},t[13]=r,t[14]=m);let h=m,g;t[15]===a?g=t[16]:(g={...a,[e3]:v3},t[15]=a,t[16]=g);let _=g,v;t[17]!==o||t[18]!==d?(v={actions:d,controls:o},t[17]=o,t[18]=d,t[19]=v):v=t[19];let y=v,b;bb1:{if(s!==`auto`||c===`static`){b=n;break bb1}let e=n??u3,r;t[20]===e?r=t[21]:(r=d3(e),t[20]=e,t[21]=r),b=r}let x=b,S;bb2:{if(s!==`auto`||c!==`static`||typeof i!=`string`){S=s;break bb2}let e;t[22]!==i||t[23]!==s?(e=l3(i)??s,t[22]=i,t[23]=s,t[24]=e):e=t[24],S=e}let C=S,w;t[25]===o?w=t[26]:(w=_3(o),t[25]=o,t[26]=w);let T;t[27]!==i||t[28]!==h?(T=Y4(i,Object.keys(h)),t[27]=i,t[28]=h,t[29]=T):T=t[29];let ee;t[30]!==c||t[31]!==l||t[32]!==C||t[33]!==w||t[34]!==T||t[35]!==h||t[36]!==x||t[37]!==_||t[38]!==p?(ee=(0,R.jsx)(zt,{allowedTags:h,BlockComponent:x,components:_,controls:w,dir:C,mode:c,parseMarkdownIntoBlocksFn:i3,remarkPlugins:p,...l,children:T}),t[30]=c,t[31]=l,t[32]=C,t[33]=w,t[34]=T,t[35]=h,t[36]=x,t[37]=_,t[38]=p,t[39]=ee):ee=t[39];let E;return t[40]!==ee||t[41]!==y?(E=(0,R.jsx)(h3,{value:y,children:ee}),t[40]=ee,t[41]=y,t[42]=E):E=t[42],E}var b3=class extends L.Component{state={hasError:!1,error:null};static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?this.props.fallback||(0,R.jsxs)(`div`,{className:`text-destructive p-2 text-sm`,children:[`Failed to render content: `,this.state.error?.message]}):this.props.children}},x3=(0,L.memo)(e=>{let t=(0,U.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=j(`size-full space-y-2 [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(b3,{children:(0,R.jsx)(y3,{className:i,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a});x3.displayName=`Response`;function S3(e){let t=(0,U.c)(9),n=e===void 0?2e3:e,r=ae(),[i,a]=(0,L.useState)(!1),o=(0,L.useRef)(null),s,c;t[0]===r?(s=t[1],c=t[2]):(s=()=>()=>{o.current&&r.clearTimeout(o.current)},c=[r],t[0]=r,t[1]=s,t[2]=c),(0,L.useEffect)(s,c);let l;t[3]!==r||t[4]!==n?(l=async e=>{await navigator.clipboard.writeText(e),a(!0),o.current&&r.clearTimeout(o.current),o.current=r.setTimeout(()=>a(!1),n)},t[3]=r,t[4]=n,t[5]=l):l=t[5];let u=l,d;return t[6]!==i||t[7]!==u?(d=[i,u],t[6]=i,t[7]=u,t[8]=d):d=t[8],d}var C3=(0,L.createContext)({code:``}),w3=e=>{let t=(0,U.c)(41),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({code:i,language:a,showLineNumbers:s,wrap:c,className:r,children:n,...o}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=s!==void 0&&s,u=c!==void 0&&c,d;t[8]===i?d=t[9]:(d={code:i},t[8]=i,t[9]=d);let f;t[10]===r?f=t[11]:(f=j(`bg-background text-foreground relative w-full overflow-hidden rounded-md border`,r),t[10]=r,t[11]=f);let p,m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p={className:`font-mono text-xs`},m={margin:0,padding:`0.5rem`,fontSize:`0.75rem`,background:`hsl(var(--background))`,color:`hsl(var(--foreground))`},t[12]=p,t[13]=m):(p=t[12],m=t[13]);let h;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(h={color:`hsl(var(--muted-foreground))`,paddingRight:`1rem`,minWidth:`2.5rem`},t[14]=h):h=t[14];let g;t[15]!==i||t[16]!==a||t[17]!==l||t[18]!==u?(g=(0,R.jsx)(PD,{className:`overflow-hidden dark:hidden`,codeTagProps:p,customStyle:m,language:a,lineNumberStyle:h,showLineNumbers:l,style:ID,wrapLongLines:u,children:i}),t[15]=i,t[16]=a,t[17]=l,t[18]=u,t[19]=g):g=t[19];let _,v;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(v={className:`font-mono text-xs`},_={margin:0,padding:`0.5rem`,fontSize:`0.75rem`,background:`hsl(var(--background))`,color:`hsl(var(--foreground))`},t[20]=_,t[21]=v):(_=t[20],v=t[21]);let y;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y={color:`hsl(var(--muted-foreground))`,paddingRight:`1rem`,minWidth:`2.5rem`},t[22]=y):y=t[22];let b;t[23]!==i||t[24]!==a||t[25]!==l||t[26]!==u?(b=(0,R.jsx)(PD,{className:`hidden overflow-hidden dark:block`,codeTagProps:v,customStyle:_,language:a,lineNumberStyle:y,showLineNumbers:l,style:FD,wrapLongLines:u,children:i}),t[23]=i,t[24]=a,t[25]=l,t[26]=u,t[27]=b):b=t[27];let x;t[28]===n?x=t[29]:(x=!!n&&(0,R.jsx)(`div`,{className:`absolute top-1 right-1 flex items-center gap-1`,children:n}),t[28]=n,t[29]=x);let S;t[30]!==b||t[31]!==x||t[32]!==g?(S=(0,R.jsxs)(`div`,{className:`relative`,children:[g,b,x]}),t[30]=b,t[31]=x,t[32]=g,t[33]=S):S=t[33];let C;t[34]!==o||t[35]!==S||t[36]!==f?(C=(0,R.jsx)(`div`,{className:f,...o,children:S}),t[34]=o,t[35]=S,t[36]=f,t[37]=C):C=t[37];let w;return t[38]!==C||t[39]!==d?(w=(0,R.jsx)(C3,{value:d,children:C}),t[38]=C,t[39]=d,t[40]=w):w=t[40],w},T3=({onCopy:e,onError:t,timeout:n=2e3,children:r,className:i,...a})=>{let[o,s]=S3(n),{code:c}=(0,L.use)(C3),l=async()=>{if(typeof window>`u`||!navigator.clipboard.writeText){t?.(Error(`Clipboard API not available`));return}try{await s(c),e?.()}catch(e){t?.(e instanceof Error?e:Error(String(e)))}},u=o?jT:zT;return(0,R.jsx)(tt,{className:j(`shrink-0`,i),onClick:()=>void l(),size:`icon`,variant:`ghost`,...a,children:r??(0,R.jsx)(u,{size:14})})},E3=e=>{let t=(0,U.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=j(`not-prose mb-4 w-full rounded-md border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(dr,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},D3=e=>(0,R.jsxs)(we,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,R.jsx)(LT,{className:`size-4`}),"input-available":(0,R.jsx)(RT,{className:`size-4 animate-pulse`}),"approval-requested":(0,R.jsx)(RT,{className:`size-4 text-yellow-600`}),"approval-responded":(0,R.jsx)(FT,{className:`size-4 text-blue-600`}),"output-available":(0,R.jsx)(FT,{className:`size-4 text-green-600`}),"output-error":(0,R.jsx)(IT,{className:`size-4 text-red-600`}),"output-denied":(0,R.jsx)(IT,{className:`size-4 text-orange-600`})}[e],{"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`}[e]]}),O3=e=>{let t=(0,U.c)(24),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:n,title:a,type:o,state:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===n?s=t[7]:(s=j(`group flex w-full items-center justify-between gap-4 p-3`,n),t[6]=n,t[7]=s);let c;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,R.jsx)(XT,{className:`text-muted-foreground size-4`}),t[8]=c):c=t[8];let l;t[9]!==a||t[10]!==o?(l=a??o.split(`-`).slice(1).join(`-`),t[9]=a,t[10]=o,t[11]=l):l=t[11];let u;t[12]===l?u=t[13]:(u=(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:l}),t[12]=l,t[13]=u);let d;t[14]===i?d=t[15]:(d=D3(i),t[14]=i,t[15]=d);let f;t[16]!==u||t[17]!==d?(f=(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,u,d]}),t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,R.jsx)(MT,{className:`text-muted-foreground size-4 transition-transform group-data-[panel-open]:rotate-180`}),t[19]=p):p=t[19];let m;return t[20]!==r||t[21]!==s||t[22]!==f?(m=(0,R.jsxs)(fr,{className:s,...r,children:[f,p]}),t[20]=r,t[21]=s,t[22]=f,t[23]=m):m=t[23],m},k3=e=>{let t=(0,U.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=j(`data-closed:fade-out-0 data-closed:slide-out-to-top-2 data-open:slide-in-from-top-2 text-popover-foreground data-closed:animate-out data-open:animate-in outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(pr,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a},A3=e=>{let t=(0,U.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,input:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=j(`space-y-2 overflow-hidden p-4`,n),t[4]=n,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,R.jsx)(`h4`,{className:`text-muted-foreground text-xs font-medium tracking-wide uppercase`,children:`Parameters`}),t[6]=o):o=t[6];let s;t[7]===r?s=t[8]:(s=JSON.stringify(r,null,2),t[7]=r,t[8]=s);let c;t[9]===s?c=t[10]:(c=(0,R.jsx)(`div`,{className:`bg-muted/50 rounded-md`,children:(0,R.jsx)(w3,{code:s,language:`json`})}),t[9]=s,t[10]=c);let l;return t[11]!==i||t[12]!==a||t[13]!==c?(l=(0,R.jsxs)(`div`,{className:a,...i,children:[o,c]}),t[11]=i,t[12]=a,t[13]=c,t[14]=l):l=t[14],l},j3=e=>{let t=(0,U.c)(24),n,r,i,a;if(t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:n,output:i,errorText:r,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a),!(i||r))return null;let o;t[5]===n?o=t[6]:(o=j(`space-y-2 p-4`,n),t[5]=n,t[6]=o);let s=r?`Error`:`Result`,c;t[7]===s?c=t[8]:(c=(0,R.jsx)(`h4`,{className:`text-muted-foreground text-xs font-medium tracking-wide uppercase`,children:s}),t[7]=s,t[8]=c);let l=r?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`,u;t[9]===l?u=t[10]:(u=j(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,l),t[9]=l,t[10]=u);let d;t[11]===r?d=t[12]:(d=r&&(0,R.jsx)(`div`,{children:r}),t[11]=r,t[12]=d);let f;t[13]===i?f=t[14]:(f=M3(i),t[13]=i,t[14]=f);let p;t[15]!==u||t[16]!==d||t[17]!==f?(p=(0,R.jsxs)(`div`,{className:u,children:[d,f]}),t[15]=u,t[16]=d,t[17]=f,t[18]=p):p=t[18];let m;return t[19]!==a||t[20]!==o||t[21]!==c||t[22]!==p?(m=(0,R.jsxs)(`div`,{className:o,...a,children:[c,p]}),t[19]=a,t[20]=o,t[21]=c,t[22]=p,t[23]=m):m=t[23],m};function M3(e){return typeof e==`string`?(0,R.jsx)(w3,{code:e,language:`json`}):(0,L.isValidElement)(e)?(0,R.jsx)(`div`,{children:e}):typeof e==`object`?(0,R.jsx)(w3,{code:JSON.stringify(e,null,2),language:`json`}):typeof e==`number`||typeof e==`bigint`?(0,R.jsx)(`div`,{children:e}):(0,R.jsx)(`div`,{})}function N3(e){let t=(0,U.c)(21),{part:n}=e,r;t[0]===n?r=t[1]:(r=ap(n),t[0]=n,t[1]=r);let i=`Executing ${r}`,a;t[2]!==n.state||t[3]!==n.type||t[4]!==i?(a=(0,R.jsx)(O3,{title:i,state:n.state,type:n.type}),t[2]=n.state,t[3]=n.type,t[4]=i,t[5]=a):a=t[5];let o;t[6]===n.input?o=t[7]:(o=(0,R.jsx)(A3,{input:n.input}),t[6]=n.input,t[7]=o);let s;t[8]===n.output?s=t[9]:(s=typeof n.output==`string`?n.output:JSON.stringify(n.output,null,2),t[8]=n.output,t[9]=s);let c;t[10]===s?c=t[11]:(c=(0,R.jsx)(x3,{className:`break-all`,children:s}),t[10]=s,t[11]=c);let l;t[12]!==n.errorText||t[13]!==c?(l=(0,R.jsx)(j3,{output:c,errorText:n.errorText}),t[12]=n.errorText,t[13]=c,t[14]=l):l=t[14];let u;t[15]!==o||t[16]!==l?(u=(0,R.jsxs)(k3,{children:[o,l]}),t[15]=o,t[16]=l,t[17]=u):u=t[17];let d;return t[18]!==a||t[19]!==u?(d=(0,R.jsxs)(E3,{"data-copy-exclude":`assistant-snapshot`,children:[a,u]}),t[18]=a,t[19]=u,t[20]=d):d=t[20],d}function P3(e){let t=(0,U.c)(19),{part:n}=e,r=`Executing ${n.toolName}`,i;t[0]!==n.state||t[1]!==n.type||t[2]!==r?(i=(0,R.jsx)(O3,{title:r,state:n.state,type:n.type}),t[0]=n.state,t[1]=n.type,t[2]=r,t[3]=i):i=t[3];let a;t[4]===n.input?a=t[5]:(a=(0,R.jsx)(A3,{input:n.input}),t[4]=n.input,t[5]=a);let o;t[6]===n.output?o=t[7]:(o=typeof n.output==`string`?n.output:JSON.stringify(n.output,null,2),t[6]=n.output,t[7]=o);let s;t[8]===o?s=t[9]:(s=(0,R.jsx)(x3,{className:`break-all`,children:o}),t[8]=o,t[9]=s);let c;t[10]!==n.errorText||t[11]!==s?(c=(0,R.jsx)(j3,{output:s,errorText:n.errorText}),t[10]=n.errorText,t[11]=s,t[12]=c):c=t[12];let l;t[13]!==a||t[14]!==c?(l=(0,R.jsxs)(k3,{children:[a,c]}),t[13]=a,t[14]=c,t[15]=l):l=t[15];let u;return t[16]!==i||t[17]!==l?(u=(0,R.jsxs)(E3,{"data-copy-exclude":`assistant-snapshot`,children:[i,l]}),t[16]=i,t[17]=l,t[18]=u):u=t[18],u}var F3=(0,L.createContext)(!1);function I3(e){return e.parts.filter($f).map(e=>e.text).join(`
|
|
3514
|
+
`)}function L3(){return(0,L.use)(F3)}function R3(e){return rp(e)&&e.toolMetadata?.kind===`subagent`}function z3(e,t){let n=e.type.replace(`tool-`,``);return{toolKey:n,toolEntry:t?.[n]}}function B3(e,t){return e?.static===!1&&!!e?.requiresUserInput&&t===`input-available`}function V3(e){let t=(0,U.c)(4),{children:n}=e,r=L.Children.toArray(n);if(!r.some(U3)){let e;return t[0]===n?e=t[1]:(e=(0,R.jsx)(`p`,{children:n}),t[0]=n,t[1]=e),e}if(r.length>0&&r.every(H3))return n;let i;return t[2]===n?i=t[3]:(i=(0,R.jsx)(`div`,{children:n}),t[2]=n,t[3]=i),i}function H3(e){return L.isValidElement(e)&&typeof e.type!=`string`}function U3(e){return L.isValidElement(e)&&typeof e.type!=`string`}var W3={p:({children:e})=>(0,R.jsx)(V3,{children:e})};function G3(e){let t={...W3},n={};for(let r of e)hT(r),t[r.name]=r.component,n[r.name]=r.allowedAttributes;return{components:t,allowedTags:n}}function K3(e){let t=(0,U.c)(10),n,r;t[0]===e?(n=t[1],r=t[2]):({elements:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=n??[],t[3]=n,t[4]=i);let a;t[5]===i?a=t[6]:(a=G3(i),t[5]=i,t[6]=a);let o=a,s;return t[7]!==r||t[8]!==o?(s=(0,R.jsx)(x3,{...o,...r}),t[7]=r,t[8]=o,t[9]=s):s=t[9],s}function q3(e){let t=(0,U.c)(23),{part:n}=e,{addToolApprovalResponse:r}=S4();if(n.state!==`approval-requested`)return null;let i;t[0]!==n.title||t[1]!==n.type?(i=n.title??n.type.slice(5),t[0]=n.title,t[1]=n.type,t[2]=i):i=t[2];let a=i,o=`${a} approval`,s;t[3]===a?s=t[4]:(s=(0,R.jsx)(`p`,{className:`text-sm font-medium`,children:a}),t[3]=a,t[4]=s);let c;t[5]===n.approval.requestReason?c=t[6]:(c=n.approval.requestReason&&(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:n.approval.requestReason}),t[5]=n.approval.requestReason,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,R.jsxs)(`div`,{className:`space-y-1`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9];let u;t[10]!==r||t[11]!==n.approval.id?(u=(0,R.jsx)(tt,{type:`button`,variant:`destructive`,onClick:()=>void r({id:n.approval.id,approved:!1}),children:`Deny`}),t[10]=r,t[11]=n.approval.id,t[12]=u):u=t[12];let d;t[13]!==r||t[14]!==n.approval.id?(d=(0,R.jsx)(tt,{type:`button`,onClick:()=>void r({id:n.approval.id,approved:!0}),children:`Approve`}),t[13]=r,t[14]=n.approval.id,t[15]=d):d=t[15];let f;t[16]!==u||t[17]!==d?(f=(0,R.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[u,d]}),t[16]=u,t[17]=d,t[18]=f):f=t[18];let p;return t[19]!==o||t[20]!==l||t[21]!==f?(p=(0,R.jsxs)(`div`,{"aria-label":o,className:`border-border bg-muted/30 space-y-3 rounded-lg border p-3`,"data-copy-exclude":`assistant-snapshot`,role:`group`,children:[l,f]}),t[19]=o,t[20]=l,t[21]=f,t[22]=p):p=t[22],p}function J3(e){let t=(0,U.c)(22),{part:n}=e,{registry:r}=y4();if(n.input===void 0){let e;return t[0]!==n.errorText||t[1]!==n.output||t[2]!==n.state?(e=n.state===`output-error`?(0,R.jsx)(j3,{output:n.output,errorText:n.errorText}):(0,R.jsx)(UT,{className:`size-4 animate-spin`}),t[0]=n.errorText,t[1]=n.output,t[2]=n.state,t[3]=e):e=t[3],e}let i;t[4]===n?i=t[5]:(i=(0,R.jsx)(q3,{part:n}),t[4]=n,t[5]=i);let a=i;if(!r)return a;let o=r[n.type.replace(`tool-`,``)];if(o){let e=o.component,i;t[6]!==n||t[7]!==r.progress?(i=r.progress&&(0,R.jsx)(r.progress.component,{part:n}),t[6]=n,t[7]=r.progress,t[8]=i):i=t[8];let s;t[9]!==e||t[10]!==n?(s=(0,R.jsx)(e,{part:n}),t[9]=e,t[10]=n,t[11]=s):s=t[11];let c;return t[12]!==a||t[13]!==i||t[14]!==s?(c=(0,R.jsxs)(`div`,{className:`space-y-2`,children:[i,s,a]}),t[12]=a,t[13]=i,t[14]=s,t[15]=c):c=t[15],c}else{let e;t[16]!==n||t[17]!==r.progress?(e=r.progress&&(0,R.jsx)(r.progress.component,{part:n}),t[16]=n,t[17]=r.progress,t[18]=e):e=t[18];let i;return t[19]!==a||t[20]!==e?(i=(0,R.jsxs)(R.Fragment,{children:[e,a]}),t[19]=a,t[20]=e,t[21]=i):i=t[21],i}}var Y3={animation:`slideUp`};function X3(e){let t=(0,U.c)(3),{filename:n,url:r}=e,i=n??`Attached image`,a;return t[0]!==i||t[1]!==r?(a=(0,R.jsx)(`img`,{src:r,alt:i,className:`max-h-64 rounded-md border object-contain`}),t[0]=i,t[1]=r,t[2]=a):a=t[2],a}function Z3(e){let t=(0,U.c)(16),{filename:n,mediaType:r,url:i}=e,a=n||`Untitled`,o;t[0]!==r||t[1]!==a||t[2]!==i?(o=i?.startsWith(`data:`)?null:i&&r.startsWith(`video/`)?(0,R.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:i,"aria-label":a,className:`max-h-96 w-full rounded-md bg-black`,children:(0,R.jsx)(`track`,{kind:`captions`})}):i&&r.startsWith(`audio/`)?(0,R.jsx)(`audio`,{controls:!0,preload:`metadata`,src:i,"aria-label":a,className:`w-full`,children:(0,R.jsx)(`track`,{kind:`captions`})}):null,t[0]=r,t[1]=a,t[2]=i,t[3]=o):o=t[3];let s=o,c=s?`mt-2`:void 0,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,R.jsx)(`strong`,{children:`File:`}),t[4]=l):l=t[4];let u;t[5]!==n||t[6]!==i?(u=i?(0,R.jsxs)(R.Fragment,{children:[` `,(0,R.jsx)(`a`,{href:i,download:n,className:`underline`,children:`Download`})]}):null,t[5]=n,t[6]=i,t[7]=u):u=t[7];let d;t[8]!==r||t[9]!==a||t[10]!==c||t[11]!==u?(d=(0,R.jsxs)(`div`,{className:c,children:[l,` `,a,` (`,r,`)`,u]}),t[8]=r,t[9]=a,t[10]=c,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==s||t[14]!==d?(f=(0,R.jsxs)(kn,{className:`bg-muted/30 block w-full rounded-md p-3 text-sm text-inherit`,children:[s,d]}),t[13]=s,t[14]=d,t[15]=f):f=t[15],f}function Q3(e){let t=(0,U.c)(4),{filename:n,mediaType:r,url:i}=e,a;return t[0]!==n||t[1]!==r||t[2]!==i?(a=r.split(`/`)[0]===`image`?(0,R.jsx)(X3,{filename:n,url:i}):(0,R.jsx)(Z3,{filename:n,mediaType:r,url:i}),t[0]=n,t[1]=r,t[2]=i,t[3]=a):a=t[3],a}function $3(e){let t=(0,U.c)(9),{text:n,elements:r,className:i}=e,{status:a}=b4(),o=L3(),s;t[0]===i?s=t[1]:(s=j(`text-sm`,i),t[0]=i,t[1]=s);let c=!o&&a===`streaming`,l;t[2]!==r||t[3]!==c||t[4]!==n?(l=(0,R.jsx)(K3,{elements:r,animated:Y3,isAnimating:c,children:n}),t[2]=r,t[3]=c,t[4]=n,t[5]=l):l=t[5];let u;return t[6]!==s||t[7]!==l?(u=(0,R.jsx)(`div`,{className:s,children:l}),t[6]=s,t[7]=l,t[8]=u):u=t[8],u}function e6(e){let t=(0,U.c)(8),{part:n}=e,r=t6(),i;t[0]!==n||t[1]!==r?(i=r&&(0,R.jsx)(N3,{part:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===n?a=t[4]:(a=(0,R.jsx)(J3,{part:n}),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==a?(o=(0,R.jsxs)(R.Fragment,{children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7],o}function t6(){let{debugMode:e}=y4(),t=L3();return!!e&&!t}function n6(e){return!!e&&e!==`output-available`}function r6(e){let t=(0,U.c)(5),{label:n,part:r,state:i}=e,a=L3(),o;return t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=!a&&!!n.actions&&!!r&&!n6(i),t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4],o}function i6(e){let t=(0,U.c)(18),{label:n,part:r}=e,i=n.icon,a=n.actions,o;t[0]!==n||t[1]!==r?(o={label:n,part:r,state:r.state},t[0]=n,t[1]=r,t[2]=o):o=t[2];let s=r6(o),c;t[3]!==i||t[4]!==n.isError?(c=i&&(0,R.jsx)(i,{className:j(`size-3.5`,n.isError?`text-destructive`:`text-muted-foreground`)}),t[3]=i,t[4]=n.isError,t[5]=c):c=t[5];let l;t[6]===n.name?l=t[7]:(l=(0,R.jsx)(`span`,{className:`font-mono`,children:n.name}),t[6]=n.name,t[7]=l);let u;t[8]!==c||t[9]!==l?(u=(0,R.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10];let d;t[11]!==a||t[12]!==r||t[13]!==s?(d=s&&a&&(0,R.jsx)(a,{part:r}),t[11]=a,t[12]=r,t[13]=s,t[14]=d):d=t[14];let f;return t[15]!==u||t[16]!==d?(f=(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center justify-between gap-1.5 text-xs`,children:[u,d]}),t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function a6(e){let t=(0,U.c)(3),{name:n,value:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,R.jsxs)(`span`,{"data-slot":`tool-arg`,children:[n,`: "`,r,`"`]}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function o6(e){let t=(0,U.c)(23),{label:n,state:r,part:i,children:a}=e,o=n.actions,s;t[0]!==n||t[1]!==i||t[2]!==r?(s={label:n,part:i,state:r},t[0]=n,t[1]=i,t[2]=r,t[3]=s):s=t[3];let c=r6(s),l;t[4]===n.args?l=t[5]:(l=n.args?Object.entries(n.args).map(s6):`...`,t[4]=n.args,t[5]=l);let u;t[6]!==a||t[7]!==n.name||t[8]!==l?(u=(0,R.jsxs)(`span`,{className:`text-muted-foreground min-w-0 truncate font-mono text-xs [&>[data-slot=tool-arg]+[data-slot=tool-arg]]:before:mr-1 [&>[data-slot=tool-arg]+[data-slot=tool-arg]]:before:content-[',']`,children:[n.name,`(`,a,l,`)`]}),t[6]=a,t[7]=n.name,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==o||t[11]!==i||t[12]!==c?(d=c&&o&&i&&(0,R.jsx)(`span`,{className:`shrink-0`,children:(0,R.jsx)(o,{part:i})}),t[10]=o,t[11]=i,t[12]=c,t[13]=d):d=t[13];let f;t[14]!==u||t[15]!==d?(f=(0,R.jsxs)(`span`,{className:`flex items-start justify-between gap-2`,children:[u,d]}),t[14]=u,t[15]=d,t[16]=f):f=t[16];let p;t[17]!==n.detail||t[18]!==n.isError?(p=n.detail&&(0,R.jsx)(`span`,{className:j(`line-clamp-3 text-start font-mono text-[10px] leading-relaxed whitespace-pre-wrap`,n.isError?`text-destructive/80`:`text-muted-foreground`),children:n.detail}),t[17]=n.detail,t[18]=n.isError,t[19]=p):p=t[19];let m;return t[20]!==f||t[21]!==p?(m=(0,R.jsxs)(`span`,{className:`mb-2 flex flex-col gap-1`,children:[f,p]}),t[20]=f,t[21]=p,t[22]=m):m=t[22],m}function s6(e){let[t,n]=e;return(0,R.jsx)(a6,{name:t,value:n},t)}function c6(e){return e.type===`text`&&e.providerMetadata?.openai?.phase===`commentary`}function l6(e){let t=(0,U.c)(9),{segment:n,elements:r,className:i}=e,a;if(t[0]!==i||t[1]!==r||t[2]!==n.parts){let e;t[4]!==i||t[5]!==r?(e=e=>{let{part:t,idx:n}=e;return t.type===`text`?(0,R.jsx)($3,{text:t.text,elements:r,className:i},`${n}-text`):null},t[4]=i,t[5]=r,t[6]=e):e=t[6],a=n.parts.map(e),t[0]=i,t[1]=r,t[2]=n.parts,t[3]=a}else a=t[3];let o;return t[7]===a?o=t[8]:(o=(0,R.jsx)(R.Fragment,{children:a}),t[7]=a,t[8]=o),o}function u6(e){let t=(0,U.c)(4),{segment:n}=e,{part:r}=n;if(r.type!==`file`)return null;let i;return t[0]!==r.filename||t[1]!==r.mediaType||t[2]!==r.url?(i=(0,R.jsx)(Q3,{filename:r.filename,mediaType:r.mediaType,url:r.url}),t[0]=r.filename,t[1]=r.mediaType,t[2]=r.url,t[3]=i):i=t[3],i}function d6(e){let t=(0,U.c)(9),{segment:n}=e,{messages:r}=S4(),i;t[0]===r?i=t[1]:(i=w4(r),t[0]=r,t[1]=i);let a=i,o;if(t[2]!==n.parts||t[3]!==a){let e;t[5]===a?e=t[6]:(e=e=>{let{part:t,idx:n}=e;if(t.type!==`source-url`)return null;let r=T4(a,t.url);return r===null?null:(0,R.jsx)(L4,{source:{url:t.url,title:t.title},index:r},`source-${n}`)},t[5]=a,t[6]=e),o=n.parts.map(e),t[2]=n.parts,t[3]=a,t[4]=o}else o=t[4];let s;return t[7]===o?s=t[8]:(s=(0,R.jsx)(`span`,{children:o}),t[7]=o,t[8]=s),s}function f6(e){let t=(0,U.c)(3),{segment:n}=e,r=F4();if(L3())return null;let{part:i}=n;if(i.type!==`reasoning`)return null;let a=r===`streaming`,o;return t[0]!==i.text||t[1]!==a?(o=(0,R.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,R.jsx)(x3,{animated:Y3,isAnimating:a,children:i.text})}),t[0]=i.text,t[1]=a,t[2]=o):o=t[2],o}function p6(e){let t=(0,U.c)(2),{segment:n}=e;if(!t6())return null;let{part:r}=n;if(r.type!==`dynamic-tool`)return null;let i;return t[0]===r?i=t[1]:(i=(0,R.jsx)(P3,{part:r}),t[0]=r,t[1]=i),i}var m6=(0,L.createContext)(null),h6=(0,L.createContext)(null);function g6(){let e=(0,L.use)(m6);if(!e)throw Error(`Segment.Tool* parts must be rendered within Segment.Tool`);return e}function _6(e){let t=(0,U.c)(31),{segment:n,children:r}=e,i=y4(),a=F4(),o,s,c,l,u,d;if(t[0]!==i.registry||t[1]!==n||t[2]!==a){l=Symbol.for(`react.early_return_sentinel`);bb0:{if({toolEntry:u}=z3(n.part,i.registry),{part:d}=n,!tp(d)){l=null;break bb0}s=B3(u,d.state),o=!s&&D4(d,a),c=u?.label?.(d)}t[0]=i.registry,t[1]=n,t[2]=a,t[3]=o,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else o=t[3],s=t[4],c=t[5],l=t[6],u=t[7],d=t[8];if(l!==Symbol.for(`react.early_return_sentinel`))return l;let f=c,p;t[9]!==o||t[10]!==f||t[11]!==d.type?(p=o?{...f??{name:d.type.replace(`tool-`,``)},isError:!0,detail:`Cancelled by user`}:f,t[9]=o,t[10]=f,t[11]=d.type,t[12]=p):p=t[12];let m=p,h=u?.static===!1&&!!u?.requiresUserInput&&!s,g;t[13]!==o||t[14]!==s||t[15]!==h||t[16]!==m||t[17]!==d?(g={part:d,label:m,aborted:o,activeClientInput:s,defaultOpen:h},t[13]=o,t[14]=s,t[15]=h,t[16]=m,t[17]=d,t[18]=g):g=t[18];let _;t[19]!==o||t[20]!==m||t[21]!==d.state?(_={label:m,state:d.state,aborted:o},t[19]=o,t[20]=m,t[21]=d.state,t[22]=_):_=t[22];let v;t[23]===r?v=t[24]:(v=r??(0,R.jsx)(y6,{}),t[23]=r,t[24]=v);let y;t[25]!==_||t[26]!==v?(y=(0,R.jsx)(h6,{value:_,children:v}),t[25]=_,t[26]=v,t[27]=y):y=t[27];let b;return t[28]!==g||t[29]!==y?(b=(0,R.jsx)(m6,{value:g,children:y}),t[28]=g,t[29]=y,t[30]=b):b=t[30],b}function v6(){let e=(0,U.c)(2),{part:t,activeClientInput:n}=g6();if(n)return null;let r;return e[0]===t?r=e[1]:(r=(0,R.jsx)(e6,{part:t}),e[0]=t,e[1]=r),r}function y6(e){let t=(0,U.c)(9),{children:n}=e,{part:r,label:i,defaultOpen:a}=g6();if(!i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,R.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,R.jsx)(v6,{})}),t[0]=e):e=t[0],e}let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=(0,R.jsx)(fr,{className:`cursor-pointer`,children:(0,R.jsx)(o6,{label:i,state:r.state,part:r,children:n})}),t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(pr,{className:`mb-2`,children:(0,R.jsx)(v6,{})}),t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==o?(c=(0,R.jsxs)(dr,{defaultOpen:a,className:`flex min-w-0 flex-1 flex-col`,children:[o,s]}),t[6]=a,t[7]=o,t[8]=c):c=t[8],c}var b6={Text:l6,File:u6,Source:d6,Reasoning:f6,DynamicTool:p6,Tool:_6,ToolDisclosure:y6,ToolContent:v6};function x6(e){return tp(e)?`tool`:e.type===`dynamic-tool`?`dynamic-tool`:e.type===`reasoning`&&`text`in e&&e.text?`reasoning`:null}function S6(e,t){return e.kind===`text`||e.kind===`file`||e.kind===`source`?!1:e.kind===`reasoning`||e.kind!==`dynamic-tool`||!!t}function C6(e,t,n){let r=e[t+1];return!!r&&S6(r,n)}function w6(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n],i=x6(r);if(i)t.push({kind:i,part:r,idx:n});else if(r.type===`text`){let e=t[t.length-1];e&&e.kind===`text`?e.parts.push({part:r,idx:n}):t.push({kind:`text`,parts:[{part:r,idx:n}]})}else if(r.type===`file`)t.push({kind:`file`,part:r,idx:n});else if(r.type===`source-url`){let e=t[t.length-1];e&&e.kind===`source`?e.parts.push({part:r,idx:n}):t.push({kind:`source`,parts:[{part:r,idx:n}]})}}return t}function T6(e,t){return e.kind===`text`||e.kind===`source`?e.parts[0]?.idx??t:e.idx}(0,L.memo)(function(e){let t=(0,U.c)(8),{segment:n}=e;if(n.kind===`tool`){let e;return t[0]===n?e=t[1]:(e=(0,R.jsx)(b6.Tool,{segment:n}),t[0]=n,t[1]=e),e}if(n.kind===`reasoning`){let e;return t[2]===n?e=t[3]:(e=(0,R.jsx)(b6.Reasoning,{segment:n}),t[2]=n,t[3]=e),e}if(n.kind===`text`){let e;return t[4]===n?e=t[5]:(e=(0,R.jsx)(b6.Text,{segment:n,className:`text-xs`}),t[4]=n,t[5]=e),e}if(n.kind===`file`){let e;return t[6]===n?e=t[7]:(e=(0,R.jsx)(b6.File,{segment:n}),t[6]=n,t[7]=e),e}return null},E6);function E6(e,t){return e.complete&&t.complete&&e.cacheKey===t.cacheKey}function D6(e){let t=(0,U.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({icon:r,className:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(a={scale:.94},t[4]=a):a=t[4];let o;t[5]===n?o=t[6]:(o=j(`group text-muted-foreground hover:text-foreground relative rounded-lg p-2 transition-colors`,n),t[5]=n,t[6]=o);let s;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(`span`,{className:`bg-primary/10 absolute inset-0 rounded-lg opacity-0 transition-opacity group-hover:opacity-100`}),t[7]=s):s=t[7];let c;return t[8]!==r||t[9]!==i||t[10]!==o?(c=(0,R.jsxs)(rT.button,{type:`button`,whileTap:a,className:o,...i,children:[r,s]}),t[8]=r,t[9]=i,t[10]=o,t[11]=c):c=t[11],c}function O6(){let{index:e}=I4(),{messages:t}=P4(),n=F4();return!(e===t.length-1&&(n===`submitted`||n===`streaming`||n===`error`))}function k6(e){let t=(0,U.c)(5),{className:n,children:r}=e;if(!O6()||L.Children.toArray(r).length===0)return null;let i;t[0]===n?i=t[1]:(i=j(`mt-1 flex items-center gap-0.5`,n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,R.jsx)(`div`,{"data-copy-exclude":`assistant-snapshot`,className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function A6(e){let t=(0,U.c)(12),{className:n}=e,{message:r}=I4(),[i,a]=S3(),o=i?`Copied`:`Copy message`,s;t[0]===n?s=t[1]:(s=j(`p-1.5`,n),t[0]=n,t[1]=s);let c;t[2]!==a||t[3]!==r?(c=()=>void a(I3(r)),t[2]=a,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,R.jsx)(i?jT:zT,{className:`size-3.5`}),t[5]=i,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,R.jsx)(D6,{"aria-label":o,className:s,onClick:c,icon:l}),t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function j6(e){let t=(0,U.c)(9),{className:n}=e,{message:r}=I4(),{regenerate:i}=S4(),a;t[0]===n?a=t[1]:(a=j(`p-1.5`,n),t[0]=n,t[1]=a);let o;t[2]!==r.id||t[3]!==i?(o=()=>void i({messageId:r.id}),t[2]=r.id,t[3]=i,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(qT,{className:`size-3.5`}),t[5]=s):s=t[5];let c;return t[6]!==a||t[7]!==o?(c=(0,R.jsx)(D6,{"aria-label":`Regenerate response`,className:a,onClick:o,icon:s}),t[6]=a,t[7]=o,t[8]=c):c=t[8],c}function M6(e){let t=(0,U.c)(12),{className:n}=e,{message:r}=I4(),[i,a]=S3(),o=i?`Copied`:`Copy debug JSON`,s;t[0]===n?s=t[1]:(s=j(`p-1.5`,n),t[0]=n,t[1]=s);let c;t[2]!==a||t[3]!==r?(c=()=>void a(JSON.stringify(r,null,2)),t[2]=a,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,R.jsx)(i?jT:AT,{className:`size-3.5`}),t[5]=i,t[6]=l);let u;return t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,R.jsx)(D6,{"aria-label":o,className:s,onClick:c,icon:l}),t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function N6(e){let t=(0,U.c)(7),{onTryAgain:n,error:r}=e,i=r instanceof Error?r.message:`An error occurred. Please try again.`,a;t[0]===i?a=t[1]:(a=(0,R.jsx)(`div`,{className:`text-destructive text-sm`,children:(0,R.jsx)(x3,{mode:`static`,children:i})}),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,R.jsx)(tt,{type:`button`,onClick:n,size:`sm`,variant:`outline`,children:`Try Again`}),t[2]=n,t[3]=o);let s;return t[4]!==a||t[5]!==o?(s=(0,R.jsx)(`div`,{className:`mt-3 flex justify-start`,children:(0,R.jsxs)(`div`,{className:`max-w-[80%] space-y-2`,children:[a,o]})}),t[4]=a,t[5]=o,t[6]=s):s=t[6],s}function P6(e){let t=(0,U.c)(3),{error:n,onRetry:r}=e;if(!n||!r)return null;let i;return t[0]!==n||t[1]!==r?(i=(0,R.jsx)(N6,{onTryAgain:r,error:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function F6(e){let t=(0,U.c)(14),{messages:n,className:r,elements:i,status:a,children:o}=e,s;t[0]!==i||t[1]!==n||t[2]!==a?(s={messages:n,elements:i,status:a},t[0]=i,t[1]=n,t[2]=a,t[3]=s):s=t[3];let c=s,l;t[4]===r?l=t[5]:(l=j(`flex h-full flex-col`,r),t[4]=r,t[5]=l);let u;t[6]===o?u=t[7]:(u=(0,R.jsx)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:o}),t[6]=o,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,R.jsx)(`div`,{className:l,children:u}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let f;return t[11]!==d||t[12]!==c?(f=(0,R.jsx)(M4,{value:c,children:d}),t[11]=d,t[12]=c,t[13]=f):f=t[13],f}function I6(e){let t=(0,U.c)(5),{className:n,children:r}=e,i;t[0]===n?i=t[1]:(i=j(`flex flex-col gap-4`,n),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,R.jsx)(`div`,{className:i,children:r}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function L6(e){let t=(0,U.c)(9),{message:n,index:r,className:i,children:a}=e,o;t[0]!==r||t[1]!==n?(o={message:n,index:r},t[0]=r,t[1]=n,t[2]=o):o=t[2];let s=o,c;t[3]!==a||t[4]!==i?(c=(0,R.jsx)(`div`,{className:i,children:a}),t[3]=a,t[4]=i,t[5]=c):c=t[5];let l;return t[6]!==c||t[7]!==s?(l=(0,R.jsx)(N4,{value:s,children:c}),t[6]=c,t[7]=s,t[8]=l):l=t[8],l}function R6(){let e=(0,U.c)(5),{registry:t}=y4(),n=S4().messages,r;if(e[0]!==n||e[1]!==t){bb0:{if(!t){r=null;break bb0}let i=n.findLast(z6);if(!i){r=null;break bb0}let a;e[3]===t?a=e[4]:(a=e=>{if(!tp(e)||e.state!==`input-available`)return[];let n=e.type.replace(`tool-`,``),r=t[n];return!r||r.static!==!1||!r.requiresUserInput?[]:[{part:e,entry:r}]},e[3]=t,e[4]=a),r=i.parts.flatMap(a).at(0)??null}e[0]=n,e[1]=t,e[2]=r}else r=e[2];return r}function z6(e){let{role:t}=e;return t===`assistant`}function B6(e){let t=(0,U.c)(10),{children:n,className:r}=e,i=R6(),a=i?.entry.component,o=i?`hidden`:`visible`,s;t[0]!==n||t[1]!==o?(s=(0,R.jsx)(L.Activity,{mode:o,children:n}),t[0]=n,t[1]=o,t[2]=s):s=t[2];let c;t[3]!==a||t[4]!==i||t[5]!==r?(c=i&&a?(0,R.jsx)(`div`,{className:j(`sticky bottom-0 mt-auto`,r),children:(0,R.jsx)(a,{part:i.part},i.part.toolCallId)}):null,t[3]=a,t[4]=i,t[5]=r,t[6]=c):c=t[6];let l;return t[7]!==s||t[8]!==c?(l=(0,R.jsxs)(R.Fragment,{children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function V6(e,t){if(e===`error`||e===`ready`||!t)return null;if(t.role!==`assistant`)return`Thinking...`;for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if($f(n)&&c6(n)&&n.text)return n.text}for(let e=t.parts.length-1;e>=0;e--){let n=t.parts[e];if(ep(n)&&n.text)return n.text;if(rp(n)){let e=n.input;if(ed(e))for(let t of[`reasoning`,`thoughts`,`thought`,`hint`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return n.toolCallId}if($f(n)&&n.text)return``}return`Thinking...`}function H6(e){let t=(0,U.c)(5),{isLast:n}=e,r=n!==void 0&&n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,R.jsx)(`span`,{className:`bg-muted-foreground/50 z-10 mt-1 size-2 shrink-0 rounded-full`}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=!r&&(0,R.jsx)(`span`,{className:`bg-border w-px flex-1`}),t[1]=r,t[2]=a);let o;return t[3]===a?o=t[4]:(o=(0,R.jsxs)(`div`,{className:`absolute top-0 left-0 flex size-3.5 h-full flex-col items-center`,children:[i,a]}),t[3]=a,t[4]=o),o}function U6(e){let t=(0,U.c)(6),{marker:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=j(`relative z-0 flex gap-3 pl-5`,i),t[0]=i,t[1]=a);let o;return t[2]!==r||t[3]!==n||t[4]!==a?(o=(0,R.jsxs)(`div`,{className:a,children:[n,r]}),t[2]=r,t[3]=n,t[4]=a,t[5]=o):o=t[5],o}function W6(){let e=(0,U.c)(6),t=F4(),{messages:n}=P4(),r=R6(),i=n[n.length-1],a;e[0]!==t||e[1]!==i?(a=V6(t,i),e[0]=t,e[1]=i,e[2]=a):a=e[2];let o=a;if(!o||r)return null;let s;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,R.jsx)(H6,{isLast:!0}),e[3]=s):s=e[3];let c;return e[4]===o?c=e[5]:(c=(0,R.jsx)(U6,{className:`mt-2`,marker:s,children:(0,R.jsx)(`span`,{role:`status`,children:(0,R.jsx)(k4,{as:`span`,className:`text-muted-foreground line-clamp-2 font-mono text-xs`,children:o})})}),e[4]=o,e[5]=c),c}var G6=[`inputTokens`,`outputTokens`,`reasoningTokens`,`cachedInputTokens`,`totalTokens`],K6={inputTokens:[[`inputTokens`],[`raw`,`prompt_tokens`]],outputTokens:[[`outputTokens`],[`raw`,`completion_tokens`]],reasoningTokens:[[`reasoningTokens`],[`outputTokenDetails`,`reasoningTokens`],[`raw`,`completion_tokens_details`,`reasoning_tokens`]],cachedInputTokens:[[`inputTokenDetails`,`cacheReadTokens`],[`cachedInputTokens`],[`inputTokenDetails`,`cachedTokens`],[`raw`,`prompt_tokens_details`,`cached_tokens`]],totalTokens:[[`totalTokens`],[`raw`,`total_tokens`]]};function q6(e){if(typeof e==`number`&&Number.isFinite(e)&&e>=0)return e;if(typeof e==`string`&&e.trim().length>0){let t=Number(e);if(Number.isFinite(t)&&t>=0)return t}return null}function J6(e){if(!e||typeof e!=`object`)return null;let t={inputTokens:null,outputTokens:null,reasoningTokens:null,cachedInputTokens:null,totalTokens:null};for(let n of G6)for(let r of K6[n]){let i=q6(A2(e,r));if(i!==null){t[n]=i;break}}return G6.some(e=>t[e]!==null)?t:null}function Y6(e){return ed(e)?J6(e.totalUsage??e.usage):null}function X6(e){let t=[`↑ ${P2(e.inputTokens)}`,`↓ ${P2(e.outputTokens)}`];return e.totalTokens!==null&&t.push(`· ${N2(e.totalTokens)} tokens`),e.cachedInputTokens!==null&&e.cachedInputTokens>0&&t.push(`(${P2(e.cachedInputTokens)} cached)`),t.join(` `)}var Z6=`x-upload-filename`,Q6=he({path:I().startsWith(`/`),name:I().min(1),mediaType:Xe([`image/png`,`image/jpeg`,`image/webp`,`image/gif`,`image/heic`,`image/heif`,`video/mp4`,`video/quicktime`,`audio/mpeg`,`audio/mp4`,`audio/wav`]),size:Dt().nonnegative(),url:N()}),$6=class extends qp{sessionsApi;request;constructor({api:e,fetch:t=(e,t)=>globalThis.fetch(e,t),tools:n={},elements:r=[]}){let i=r8(e),a=r.map(yT);super({api:i,fetch:async(e,n)=>{let r=await t(e,n);if((n?.method??`GET`).toUpperCase()!==`POST`||!r.ok)return r;let i=await r.json();if(!i8(i))throw Error(`Zukhruf returned an invalid accepted-turn response`);let a=r8(String(e)),o=decodeURIComponent(a.slice(a.lastIndexOf(`/`)+1));if(i.sessionId!==o)throw Error(`Zukhruf returned a different session ID`);let s=n?.signal;return s?.addEventListener(`abort`,()=>{t(`${a}/cancel`,{method:`POST`}).catch(()=>void 0)},{once:!0}),t(`${a}/stream`,{headers:{accept:`text/event-stream`},method:`GET`,signal:s})},prepareSendMessagesRequest:({id:e,messages:t,trigger:r})=>{let o=t[t.length-1];if(!o)throw Error(`A message is required`);return{api:e8(i,e),body:{sessionId:e,message:o,trigger:r,...Object.keys(n).length>0?{tools:n}:{},...a.length>0?{elements:a}:{}}}},prepareReconnectToStreamRequest:({headers:e,id:t})=>({api:`${e8(i,t)}/stream`,headers:e})}),this.sessionsApi=i,this.request=t}async uploadFile(e,t){let n=await this.request(`${e8(this.sessionsApi,e)}/uploads`,{method:`POST`,headers:{"content-type":t.type,[Z6]:encodeURIComponent(t.name)},body:t});if(!n.ok)throw Error(await t8(n,t));let r=Q6.safeParse(await n.json());if(!r.success)throw Error(`Zukhruf returned an invalid upload response`);return r.data}};function e8(e,t){return`${e}/${encodeURIComponent(t)}`}async function t8(e,t){let n=`Uploading ${t.name} failed with HTTP ${e.status}`,r=n8(await e.json().catch(()=>null));return r?`${n}: ${r}`:n}function n8(e){if(typeof e!=`object`||!e)return null;let t=`cause`in e&&typeof e.cause==`object`&&e.cause!==null?e.cause:null;return[t&&`code`in t&&typeof t.code==`string`?t.code:null,t&&`detail`in t&&typeof t.detail==`string`?t.detail:`error`in e&&typeof e.error==`string`?e.error:null].filter(e=>e!==null).join(` — `)||null}function r8(e){return e.replace(/\/$/,``)}function i8(e){return typeof e==`object`&&!!e&&`ok`in e&&e.ok===!0&&`sessionId`in e&&typeof e.sessionId==`string`&&`turnId`in e&&typeof e.turnId==`string`}function a8(e){let t=(0,U.c)(24),{label:n,open:r,onOpenChange:i,children:a,className:o,triggerClassName:s,contentClassName:c,chevronClassName:l}=e,u;t[0]===s?u=t[1]:(u=j(`flex items-center font-mono`,s),t[0]=s,t[1]=u);let d;t[2]===u?d=t[3]:(d=(0,R.jsx)(`button`,{type:`button`,className:u}),t[2]=u,t[3]=d);let f=r&&`rotate-180`,p;t[4]!==l||t[5]!==f?(p=j(`size-4 transition-transform`,l,f),t[4]=l,t[5]=f,t[6]=p):p=t[6];let m;t[7]===p?m=t[8]:(m=(0,R.jsx)(MT,{className:p}),t[7]=p,t[8]=m);let h;t[9]===n?h=t[10]:(h=(0,R.jsx)(`span`,{children:n}),t[9]=n,t[10]=h);let g;t[11]!==d||t[12]!==m||t[13]!==h?(g=(0,R.jsxs)(fr,{render:d,children:[m,h]}),t[11]=d,t[12]=m,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==a||t[16]!==c?(_=(0,R.jsx)(pr,{className:c,children:a}),t[15]=a,t[16]=c,t[17]=_):_=t[17];let v;return t[18]!==o||t[19]!==i||t[20]!==r||t[21]!==g||t[22]!==_?(v=(0,R.jsxs)(dr,{open:r,onOpenChange:i,className:o,children:[g,_]}),t[18]=o,t[19]=i,t[20]=r,t[21]=g,t[22]=_,t[23]=v):v=t[23],v}function o8(e){let t=(0,U.c)(7),{metadata:n}=e;if(!n)return null;let r,i,a;if(t[0]!==n){a=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Y6(n);if(!e){a=null;break bb0}r=`text-muted-foreground mt-2 text-xs tabular-nums opacity-60`,i=X6(e)}t[0]=n,t[1]=r,t[2]=i,t[3]=a}else r=t[1],i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o;return t[4]!==r||t[5]!==i?(o=(0,R.jsx)(`div`,{className:r,children:i}),t[4]=r,t[5]=i,t[6]=o):o=t[6],o}function s8(e,t){return ed(e.metadata)?e.metadata[t]:void 0}function c8(e){let t=s8(e,`reminders`);return Array.isArray(t)?t.filter(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&t.id.length>0&&typeof t.text==`string`&&t.text.trim().length>0}):[]}function l8(e){let t=s8(e,`uploads`);return Array.isArray(t)?t.flatMap(e=>{let t=Q6.safeParse(e);return t.success?[t.data]:[]}):[]}function u8(e){let t=(0,U.c)(7),{text:n}=e,[r,i]=(0,L.useState)(!1),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>i(d8),t[0]=a):a=t[0];let o=!r&&`line-clamp-3`,s;t[1]===o?s=t[2]:(s=j(`hover:text-foreground w-full cursor-pointer text-left whitespace-pre-wrap`,o),t[1]=o,t[2]=s);let c;return t[3]!==r||t[4]!==s||t[5]!==n?(c=(0,R.jsx)(`li`,{children:(0,R.jsx)(`button`,{type:`button`,onClick:a,"aria-pressed":r,className:s,children:n})}),t[3]=r,t[4]=s,t[5]=n,t[6]=c):c=t[6],c}function d8(e){return!e}function f8(e){let t=(0,U.c)(8),{reminders:n}=e,[r,i]=(0,L.useState)(!1);if(n.length===0)return null;let a=`${n.length} reminder${n.length===1?``:`s`} attached`,o;t[0]===n?o=t[1]:(o=n.map(p8),t[0]=n,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,R.jsx)(`ul`,{className:`border-ink-12 text-muted-foreground space-y-1 border-l pl-3 text-xs`,children:o}),t[2]=o,t[3]=s);let c;return t[4]!==a||t[5]!==r||t[6]!==s?(c=(0,R.jsx)(a8,{label:a,open:r,onOpenChange:i,className:`mt-1`,triggerClassName:`text-muted-foreground hover:text-foreground gap-1.5 text-xs`,contentClassName:`mt-1.5`,chevronClassName:`size-3.5`,children:s}),t[4]=a,t[5]=r,t[6]=s,t[7]=c):c=t[7],c}function p8(e){return(0,R.jsx)(u8,{text:e.text},e.id)}function m8(e){let t=(0,U.c)(19),{upload:n}=e;if(n.mediaType.startsWith(`video/`)){let e;t[0]!==n.name||t[1]!==n.url?(e=(0,R.jsx)(`video`,{src:n.url,"aria-label":n.name,muted:!0,playsInline:!0,preload:`metadata`,className:`size-full object-cover`}),t[0]=n.name,t[1]=n.url,t[2]=e):e=t[2];let r;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-0 flex items-center justify-center text-2xl text-white drop-shadow`,children:`▶`}),t[3]=r):r=t[3];let i;return t[4]!==e||t[5]!==n.name?(i=(0,R.jsxs)(jn,{variant:`image`,className:`size-36 rounded-2xl`,title:n.name,children:[e,r]}),t[4]=e,t[5]=n.name,t[6]=i):i=t[6],i}if(n.mediaType.startsWith(`audio/`)){let e;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,R.jsx)(`span`,{"aria-hidden":!0,className:`text-2xl`,children:`♪`}),t[7]=e):e=t[7];let r;t[8]===n.name?r=t[9]:(r=(0,R.jsx)(`span`,{className:`text-foreground w-full truncate text-center`,children:n.name}),t[8]=n.name,t[9]=r);let i;t[10]===n.mediaType?i=t[11]:(i=(0,R.jsx)(`span`,{className:`text-muted-foreground`,children:n.mediaType}),t[10]=n.mediaType,t[11]=i);let a;return t[12]!==r||t[13]!==i||t[14]!==n.name?(a=(0,R.jsxs)(jn,{variant:`icon`,className:`h-36 w-48 flex-col gap-1 rounded-2xl px-3 text-xs`,title:n.name,"aria-label":n.name,children:[e,r,i]}),t[12]=r,t[13]=i,t[14]=n.name,t[15]=a):a=t[15],a}let r;return t[16]!==n.name||t[17]!==n.url?(r=(0,R.jsx)(jn,{variant:`image`,className:`size-36 rounded-2xl`,children:(0,R.jsx)(`img`,{src:n.url,alt:n.name})}),t[16]=n.name,t[17]=n.url,t[18]=r):r=t[18],r}function h8(e){let t=(0,U.c)(13),{message:n}=e,r,i,a,o,s,c;if(t[0]!==n){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=l8(n);if(e.length===0){c=null;break bb0}r=Mn,i=`list`,a=`Attached files`,o=`max-w-full gap-2 py-0`,s=e.map(g8)}t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c}else r=t[1],i=t[2],a=t[3],o=t[4],s=t[5],c=t[6];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let l;return t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==s?(l=(0,R.jsx)(r,{role:i,"aria-label":a,className:o,children:s}),t[7]=r,t[8]=i,t[9]=a,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}function g8(e){return(0,R.jsx)(`div`,{role:`listitem`,"data-slot":`attachment`,children:(0,R.jsx)(m8,{upload:e})},e.path)}function _8(e){let t=(0,U.c)(10),{body:n,reminders:r,metadata:i}=e,a;t[0]===n?a=t[1]:(a=(0,R.jsx)(`div`,{className:`flex-1 space-y-3`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,R.jsx)(f8,{reminders:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i!==void 0&&(0,R.jsx)(o8,{metadata:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,R.jsxs)(`div`,{className:`bg-secondary flex max-w-[80%] flex-col gap-3 rounded-lg p-3`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function v8(e){let t=(0,U.c)(28),{message:n}=e;s8(n,`reminders`);let r;t[0]===n?r=t[1]:(r=RA(n),t[0]=n,t[1]=r);let i;t[2]===n?i=t[3]:(i=c8(n),t[2]=n,t[3]=i);let a;t[4]!==r||t[5]!==i?(a={message:r,reminders:i},t[4]=r,t[5]=i,t[6]=a):a=t[6];let{message:o,reminders:s}=a,c;if(t[7]!==n){let e=s8(n,`alias`);c=typeof e==`string`&&e.trim().length>0?e:void 0,t[7]=n,t[8]=c}else c=t[8];let l=c;if(l){let e;t[9]===l?e=t[10]:(e=(0,R.jsx)(`div`,{className:`text-sm whitespace-pre-wrap`,children:l}),t[9]=l,t[10]=e);let n;return t[11]!==s||t[12]!==e?(n=(0,R.jsx)(_8,{reminders:s,body:e}),t[11]=s,t[12]=e,t[13]=n):n=t[13],n}let u;t[14]===o?u=t[15]:(u=(0,R.jsx)(h8,{message:o}),t[14]=o,t[15]=u);let d=o.metadata,f;if(t[16]!==o.id||t[17]!==o.parts){let e;t[19]===o.id?e=t[20]:(e=(e,t)=>e.type===`text`?(0,R.jsx)(`div`,{className:`text-sm whitespace-pre-wrap`,children:(0,R.jsx)(G1,{text:e.text})},`${o.id}-${t}-text`):null,t[19]=o.id,t[20]=e),f=o.parts.map(e),t[16]=o.id,t[17]=o.parts,t[18]=f}else f=t[18];let p;t[21]!==o.metadata||t[22]!==s||t[23]!==f?(p=(0,R.jsx)(_8,{reminders:s,metadata:d,body:f}),t[21]=o.metadata,t[22]=s,t[23]=f,t[24]=p):p=t[24];let m;return t[25]!==u||t[26]!==p?(m=(0,R.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col items-end gap-3`,children:[u,p]}),t[25]=u,t[26]=p,t[27]=m):m=t[27],m}var y8=(0,L.memo)(function(e){let t=(0,U.c)(7),{className:n}=e,{message:r}=I4(),i;t[0]===n?i=t[1]:(i=j(`flex justify-end`,n),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,R.jsx)(v8,{message:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,R.jsx)(`div`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o});function b8(e){return e.kind===`tool`?!R3(e.part):e.kind===`dynamic-tool`||e.kind===`reasoning`}function x8(e,t){return e.kind===`tool`?!0:e.kind===`reasoning`||e.kind===`dynamic-tool`?!!t:!1}function S8(e){return e.kind===`text`&&e.parts.some(({part:e})=>e.type===`text`&&!c6(e))}function C8(e,t){let n=[];for(let r=0;r<e.length;r++){let i=e[r];if(!b8(i)){n.push({kind:`segment`,segment:i,segmentIndex:r});continue}let a=[],o=r;for(;r<e.length&&b8(e[r]);){let n=e[r];x8(n,t)&&a.push({segment:n}),r++}r--,a.length>0&&n.push({kind:`group`,items:a,hasLaterText:e.slice(r+1).some(e=>S8(e)),firstIndex:o})}return n}function w8(e){if(e.kind!==`tool`&&e.kind!==`dynamic-tool`)return;let{part:t}=e;return rp(t)?t.state:void 0}function T8({groupStatus:e,labelCount:t}){return e===`running`?{title:`text-info`,detail:`text-info/80`,chevron:`text-info`}:e===`aborted`?{title:`text-destructive`,detail:`text-destructive/80`,chevron:`text-destructive`}:e===`error`?t===1?{title:`text-destructive`,detail:`text-destructive/80`,chevron:`text-destructive`}:{title:`text-warning`,detail:`text-warning/80`,chevron:`text-warning`}:{title:`text-muted-foreground`,detail:`text-muted-foreground`,chevron:`text-muted-foreground`}}function E8(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function D8(e,t=80){let n=e.replace(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-3).trimEnd()}...`}function O8(e){if(typeof e==`string`)return D8(e,48);if(typeof e==`number`||typeof e==`boolean`)return String(e);if(Array.isArray(e))return`${e.length} items`}function k8(e){if(!E8(e))return;let t=[`command`,`query`,`path`,`file`,`table`,`metric`,`dimension`,`checks`],n=[...t.filter(t=>t in e).map(t=>[t,e[t]]),...Object.entries(e).filter(([e])=>!t.includes(e))],r={};for(let[e,t]of n){let n=O8(t);if(n&&(r[e]=n,Object.keys(r).length>=2))break}return Object.keys(r).length>0?r:void 0}function A8(e){if(E8(e))for(let t of[`reasoning`,`thoughts`,`thought`,`hint`,`detail`]){let n=e[t];if(typeof n==`string`&&n.trim().length>0)return D8(n)}}function j8(e){if(e.kind!==`reasoning`)return;let{part:t}=e;if(t.type===`reasoning`)return D8(t.text,96)}function M8(e,t){if(e.kind===`reasoning`)return{kind:`reasoning`,name:`reasoning`,detail:j8(e)};if(e.kind===`dynamic-tool`&&e.part.type===`dynamic-tool`){let t=e.part;return{kind:`dynamic-tool`,name:t.toolName||`Tool`,args:k8(t.input),detail:A8(t.input)}}if(e.kind===`tool`&&tp(e.part)){let n=e.part,{toolEntry:r,toolKey:i}=z3(n,t),a=r?.label?.(n);return{kind:`tool`,name:a?.name??i,args:a?.args??k8(n.input),detail:a?.detail??A8(n.input),isError:a?.isError}}return{kind:`tool`,name:`Step`}}function N8(e){if(!e)return;let t=Object.entries(e).filter(e=>typeof e[1]==`string`&&e[1].trim().length>0);if(t.length!==0)return t.slice(0,2).map(([e,t])=>`${e}: ${D8(t,36)}`).join(`, `)}function P8(e){let t=N8(e.args);return t?`${e.name}(${t})`:e.name}function F8(e){return e===`output-available`||e===`output-error`||e===`output-denied`}function I8(e){return!!e&&!F8(e)}function L8(e,t){return E4(e,t)}function R8({items:e,labels:t,status:n,hasLaterText:r}){return e.some(({segment:e})=>L8(w8(e),n))?`aborted`:!r&&(n===`streaming`||n===`submitted`)?`running`:t.some(e=>e.isError)||e.some(({segment:e})=>{let t=w8(e);return t===`output-error`||t===`output-denied`})?`error`:e.some(({segment:e})=>I8(w8(e)))||!r&&t.every(e=>e.kind===`reasoning`)&&(n===`streaming`||n===`submitted`)?`running`:`complete`}function z8(e){return e&&`${e[0].toUpperCase()}${e.slice(1)}`}function B8(e){return e.filter(e=>e.kind!==`reasoning`).length}function V8(e,t){let n=B8(e);if(n!==0)return`${t===`running`||t===`aborted`?`running`:`ran`} ${n} ${n===1?`tool`:`tools`}`}function H8(e,t){let n=V8(e,t);if(n)return z8(t===`error`?`${n} with issues`:t===`aborted`?`cancelled after ${n}`:n)}function U8(e,t,n){let r=e.length===1?e[0]:void 0;if(t===`running`)return n||(r?.kind===`reasoning`?`Reasoning${r.detail?` ${r.detail}`:``}`:e.every(e=>e.kind===`reasoning`)?`Reasoning`:`Working...`);if(r){let e=P8(r);return t===`error`?`Failed ${e}`:t===`aborted`?`Cancelled ${e}`:r.kind===`reasoning`?`Reasoned${r.detail?` ${r.detail}`:``}`:`Called ${e}`}return e.every(e=>e.kind===`reasoning`)?`Reasoned`:H8(e,t)??`Ran tools`}function W8(e,t){if(t!==`running`){if(e.length===1){let t=e[0];return t.kind===`reasoning`?void 0:t.detail}return Array.from(new Set([...e].sort((e,t)=>e.kind===`reasoning`&&t.kind!==`reasoning`?1:e.kind!==`reasoning`&&t.kind===`reasoning`?-1:0).map(e=>e.name))).slice(0,3).join(`, `)||void 0}}function G8(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].segment;if(r.kind===`dynamic-tool`&&r.part.type===`dynamic-tool`){let e=A8(r.part.input);if(e)return e}if(r.kind===`tool`&&tp(r.part)){let e=A8(r.part.input);if(e)return e}r.kind===`reasoning`&&(t??=j8(r))}return t}function K8(e,t){return!e||e.role!==`assistant`?!1:C8(w6(e.parts),t).some(e=>e.kind===`group`&&!e.hasLaterText)}function q8(){let e=(0,U.c)(8),{message:t}=I4(),{debugMode:n}=y4(),r;e[0]===t.parts?r=e[1]:(r=w6(t.parts),e[0]=t.parts,e[1]=r);let i=r,a;if(e[2]!==n||e[3]!==t.id||e[4]!==i){let r;e[6]===t.id?r=e[7]:(r=e=>e.kind===`group`?{...e,key:`${t.id}-${e.firstIndex}-group-${e.hasLaterText?`past`:`current`}`}:{...e,key:`${t.id}-${T6(e.segment,e.segmentIndex)}-${e.segment.kind}`},e[6]=t.id,e[7]=r),a=C8(i,n).map(r),e[2]=n,e[3]=t.id,e[4]=i,e[5]=a}else a=e[5];return a}var J8=(0,L.createContext)(null);function Y8(){let e=(0,L.use)(J8);if(!e)throw Error(`CompactTrajectory group parts must be rendered within CompactTrajectory.Group`);return e}function X8(e){let t=(0,U.c)(21),{group:n,children:r}=e,{registry:i}=y4(),{message:a}=I4(),o=F4(),[s,c]=(0,L.useState)(!n.hasLaterText),l,u,d;if(t[0]!==n.hasLaterText||t[1]!==n.items||t[2]!==i||t[3]!==o){let e;t[7]===i?e=t[8]:(e=e=>{let{segment:t}=e;return M8(t,i)},t[7]=i,t[8]=e),u=n.items.map(e),l=R8({items:n.items,labels:u,status:o,hasLaterText:n.hasLaterText}),d=T8({groupStatus:l,labelCount:u.length}),t[0]=n.hasLaterText,t[1]=n.items,t[2]=i,t[3]=o,t[4]=l,t[5]=u,t[6]=d}else l=t[4],u=t[5],d=t[6];let f=d,p;t[9]!==n.items||t[10]!==l||t[11]!==u||t[12]!==a.id||t[13]!==f?(p={items:n.items,labels:u,groupStatus:l,tone:f,messageId:a.id},t[9]=n.items,t[10]=l,t[11]=u,t[12]=a.id,t[13]=f,t[14]=p):p=t[14];let m;t[15]!==r||t[16]!==s?(m=(0,R.jsx)(dr,{open:s,onOpenChange:c,className:`my-2 min-w-0`,children:r}),t[15]=r,t[16]=s,t[17]=m):m=t[17];let h;return t[18]!==p||t[19]!==m?(h=(0,R.jsx)(J8,{value:p,children:m}),t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function Z8(e){let t=(0,U.c)(3),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(`button`,{type:`button`,className:j4(`items-start`)}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,R.jsx)(fr,{render:r,children:(0,R.jsx)(`span`,{className:`min-w-0 flex-1 text-left text-sm`,children:n})}),t[1]=n,t[2]=i),i}function Q8(){let e=(0,U.c)(12),{items:t,labels:n,groupStatus:r,tone:i}=Y8(),a;e[0]!==r||e[1]!==t||e[2]!==n?(a=U8(n,r,G8(t)),e[0]=r,e[1]=t,e[2]=n,e[3]=a):a=e[3];let o=a,s;e[4]!==r||e[5]!==n?(s=W8(n,r),e[4]=r,e[5]=n,e[6]=s):s=e[6];let c=s,l;return e[7]!==c||e[8]!==r||e[9]!==o||e[10]!==i?(l={title:o,detail:c,tone:i,groupStatus:r},e[7]=c,e[8]=r,e[9]=o,e[10]=i,e[11]=l):l=e[11],l}function $8(e){let t=(0,U.c)(9),{title:n,suffix:r,children:i}=e,{title:a,tone:o,groupStatus:s}=Q8(),c=n??a,l=r?`${c} · ${r}`:c,u=s===`running`,d=s===`running`?`text-info`:o.title,f;t[0]===d?f=t[1]:(f=j(`max-w-full min-w-0 truncate`,d),t[0]=d,t[1]=f);let p;t[2]!==u||t[3]!==f||t[4]!==l?(p=(0,R.jsx)(k4,{as:`span`,enabled:u,className:f,children:l}),t[2]=u,t[3]=f,t[4]=l,t[5]=p):p=t[5];let m;return t[6]!==i||t[7]!==p?(m=(0,R.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[p,i]}),t[6]=i,t[7]=p,t[8]=m):m=t[8],m}function e5(){let e=(0,U.c)(2),{tone:t}=Y8(),n;return e[0]===t.chevron?n=e[1]:(n=(0,R.jsx)(A4,{className:t.chevron}),e[0]=t.chevron,e[1]=n),n}function t5(e){let t=(0,U.c)(5),{detail:n}=e,{title:r,detail:i,tone:a}=Q8();if(n===null)return null;let o=n??i;if(!o||o===r)return null;let s;t[0]===a.detail?s=t[1]:(s=j(`block truncate text-xs`,a.detail),t[0]=a.detail,t[1]=s);let c;return t[2]!==o||t[3]!==s?(c=(0,R.jsx)(`span`,{className:s,children:o}),t[2]=o,t[3]=s,t[4]=c):c=t[4],c}function n5(e){let t=(0,U.c)(14),{children:n}=e,{items:r,messageId:i,groupStatus:a}=Y8(),o=a===`running`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={initial:`instant`,resize:`instant`},t[0]=s):s=t[0];let{scrollRef:c,contentRef:l}=lT(s),u=o?c:void 0,d=o&&`max-h-64 overflow-y-auto`,f;t[1]===d?f=t[2]:(f=j(`mt-2`,d),t[1]=d,t[2]=f);let p=o?l:void 0,m;t[3]!==n||t[4]!==r||t[5]!==i?(m=n??r.map((e,t)=>{let{segment:n}=e,r=`${i}-${T6(n,t)}-${n.kind}`;return n.kind===`tool`?(0,R.jsx)(b6.Tool,{segment:n},r):n.kind===`reasoning`?(0,R.jsx)(b6.Reasoning,{segment:n},r):n.kind===`dynamic-tool`?(0,R.jsx)(b6.DynamicTool,{segment:n},r):null}),t[3]=n,t[4]=r,t[5]=i,t[6]=m):m=t[6];let h;t[7]!==p||t[8]!==m?(h=(0,R.jsx)(`div`,{ref:p,children:m}),t[7]=p,t[8]=m,t[9]=h):h=t[9];let g;return t[10]!==u||t[11]!==f||t[12]!==h?(g=(0,R.jsx)(pr,{ref:u,className:f,children:h}),t[10]=u,t[11]=f,t[12]=h,t[13]=g):g=t[13],g}function r5(e){let t=(0,U.c)(19),{item:n,textClassName:r}=e,i=r===void 0?`my-4`:r,{elements:a}=P4(),{segment:o}=n;if(o.kind===`text`){let e;t[0]===o.parts?e=t[1]:(e=o.parts.filter(i5),t[0]=o.parts,t[1]=e);let n=e;if(n.length===0)return null;let r;t[2]!==o||t[3]!==n?(r={...o,parts:n},t[2]=o,t[3]=n,t[4]=r):r=t[4];let s;return t[5]!==a||t[6]!==r||t[7]!==i?(s=(0,R.jsx)(b6.Text,{segment:r,elements:a,className:i}),t[5]=a,t[6]=r,t[7]=i,t[8]=s):s=t[8],s}if(o.kind===`file`){let e;return t[9]===o?e=t[10]:(e=(0,R.jsx)(b6.File,{segment:o}),t[9]=o,t[10]=e),e}if(o.kind===`source`){let e;return t[11]===o?e=t[12]:(e=(0,R.jsx)(b6.Source,{segment:o}),t[11]=o,t[12]=e),e}if(o.kind===`tool`){let e;return t[13]===o?e=t[14]:(e=(0,R.jsx)(b6.Tool,{segment:o}),t[13]=o,t[14]=e),e}if(o.kind===`reasoning`){let e;return t[15]===o?e=t[16]:(e=(0,R.jsx)(b6.Reasoning,{segment:o}),t[15]=o,t[16]=e),e}if(o.kind===`dynamic-tool`){let e;return t[17]===o?e=t[18]:(e=(0,R.jsx)(b6.DynamicTool,{segment:o}),t[17]=o,t[18]=e),e}return null}function i5(e){let{part:t}=e;return!c6(t)}function a5(){let e=(0,U.c)(1),t=F4(),{messages:n}=P4(),{debugMode:r}=y4(),i=n[n.length-1];if(t!==`ready`&&t!==`error`&&K8(i,r))return null;let a;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,R.jsx)(W6,{}),e[0]=a):a=e[0],a}var o5={Root:F6,List:I6,Item:L6,UserBubble:y8,AssistantContent:(0,L.memo)(function(e){let t=(0,U.c)(5),{className:n}=e,r=q8(),i;t[0]===r?i=t[1]:(i=r.map(s5),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,R.jsx)(`div`,{className:n,children:i}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}),Actions:k6,CopyAction:A6,RegenerateAction:j6,CopyDebugJsonAction:M6,Thinking:a5,Error:P6};function s5(e){return e.kind===`group`?(0,R.jsxs)(X8,{group:e,children:[(0,R.jsxs)(Z8,{children:[(0,R.jsx)($8,{children:(0,R.jsx)(e5,{})}),(0,R.jsx)(t5,{})]}),(0,R.jsx)(n5,{})]},e.key):(0,R.jsx)(r5,{item:e},e.key)}function c5(e){let t=(0,U.c)(8),{message:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`text-destructive/90 bg-destructive/10 flex items-start gap-2 rounded-md px-3 py-2 text-sm`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,R.jsx)(PT,{className:`text-destructive mt-0.5 size-4 shrink-0`}),t[2]=a):a=t[2];let o;t[3]===n?o=t[4]:(o=(0,R.jsx)(`span`,{children:n}),t[3]=n,t[4]=o);let s;return t[5]!==i||t[6]!==o?(s=(0,R.jsxs)(`div`,{className:i,children:[a,o]}),t[5]=i,t[6]=o,t[7]=s):s=t[7],s}function l5(e){let t=(0,U.c)(15),{part:n}=e,r=y4(),i,a;if(t[0]!==r.registry||t[1]!==n){a=Symbol.for(`react.early_return_sentinel`);bb0:{let{toolEntry:e}=z3(n,r.registry);if(e&&B3(e,n.state)){let t=e.label?.(n);if(!t){a=null;break bb0}let r=t.icon,i=t.args?Object.values(t.args)[0]:void 0;a=(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center text-xs`,children:[r&&(0,R.jsx)(r,{className:`size-3.5`}),(0,R.jsx)(`span`,{className:`ms-2 font-mono`,children:t.name}),i&&(0,R.jsxs)(`span`,{className:`truncate`,children:[`(`,i,`)`]})]});break bb0}i=e?.label?.(n)}t[0]=r.registry,t[1]=n,t[2]=i,t[3]=a}else i=t[2],a=t[3];if(a!==Symbol.for(`react.early_return_sentinel`))return a;let o=i,s;t[4]!==o||t[5]!==n?(s=o&&(0,R.jsx)(i6,{label:o,part:n}),t[4]=o,t[5]=n,t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=o?.isError&&o.detail&&(0,R.jsx)(c5,{message:o.detail}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,R.jsx)(e6,{part:n}),t[9]=n,t[10]=l);let u;return t[11]!==s||t[12]!==c||t[13]!==l?(u=(0,R.jsxs)(R.Fragment,{children:[s,c,l]}),t[11]=s,t[12]=c,t[13]=l,t[14]=u):u=t[14],u}function u5(e){let t=(0,U.c)(5),{part:n}=e,[r,i]=(0,L.useState)(!1),a;t[0]===n.text?a=t[1]:(a=(0,R.jsx)(x3,{mode:`static`,children:n.text}),t[0]=n.text,t[1]=a);let o;return t[2]!==r||t[3]!==a?(o=(0,R.jsx)(`div`,{"data-copy-exclude":`assistant-snapshot`,className:`bg-muted/30 prose max-w-auto prose-sm text-muted-foreground border-border mb-4 w-full min-w-full rounded-lg p-3`,children:(0,R.jsx)(a8,{label:`Reasoning`,open:r,onOpenChange:i,className:`text-xs`,triggerClassName:`w-full gap-x-2 text-sm hover:opacity-80`,contentClassName:`mt-2`,children:a})}),t[2]=r,t[3]=a,t[4]=o):o=t[4],o}function d5(e){let t=(0,U.c)(15),{part:n}=e,{elements:r}=P4(),i=t6();if(n.type===`text`){if(c6(n))return null;let e;return t[0]!==r||t[1]!==n.text?(e=(0,R.jsx)($3,{text:n.text,elements:r}),t[0]=r,t[1]=n.text,t[2]=e):e=t[2],e}if(n.type===`dynamic-tool`){let e;return t[3]!==i||t[4]!==n?(e=i?(0,R.jsx)(P3,{part:n}):null,t[3]=i,t[4]=n,t[5]=e):e=t[5],e}if(tp(n)){let e;return t[6]===n?e=t[7]:(e=(0,R.jsx)(l5,{part:n}),t[6]=n,t[7]=e),e}if(n.type===`reasoning`&&n.text){let e;return t[8]!==i||t[9]!==n?(e=i?(0,R.jsx)(u5,{part:n}):null,t[8]=i,t[9]=n,t[10]=e):e=t[10],e}if(n.type===`file`){let e;return t[11]!==n.filename||t[12]!==n.mediaType||t[13]!==n.url?(e=(0,R.jsx)(Q3,{filename:n.filename,mediaType:n.mediaType,url:n.url}),t[11]=n.filename,t[12]=n.mediaType,t[13]=n.url,t[14]=e):e=t[14],e}return null}(0,L.memo)(function(e){let t=(0,U.c)(10),{className:n}=e,{message:r}=I4(),i;t[0]===n?i=t[1]:(i=j(`flex-1 space-y-3`,n),t[0]=n,t[1]=i);let a;if(t[2]!==r.id||t[3]!==r.parts){let e;t[5]===r.id?e=t[6]:(e=(e,t)=>(0,R.jsx)(d5,{part:e},`${r.id}-${t}`),t[5]=r.id,t[6]=e),a=r.parts.map(e),t[2]=r.id,t[3]=r.parts,t[4]=a}else a=t[4];let o;return t[7]!==i||t[8]!==a?(o=(0,R.jsx)(`div`,{className:i,children:a}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o});var f5={braille:{frames:[`⠋`,`⠙`,`⠹`,`⠸`,`⠼`,`⠴`,`⠦`,`⠧`,`⠇`,`⠏`],interval:80},pulse:{frames:[`⠁`,`⠉`,`⠋`,`⠛`,`⠟`,`⠿`,`⡿`,`⣿`,`⡿`,`⠿`,`⠟`,`⠛`,`⠋`,`⠉`,`⠁`,`⠀`],interval:80},clock:{frames:[`⠁`,`⠈`,`⠐`,`⠠`,`⢀`,`⡀`,`⠄`,`⠂`],interval:100},limerence:{frames:[`⠁`,`⠃`,`⠇`,`⡇`,`⣇`,`⣇`,`⣆`,`⣄`,`⣀`,`⢀`,`⠀`],interval:100}};function p5(e){let t=(0,U.c)(15),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?`braille`:i,o=ae(),{frames:s,interval:c}=f5[a],[l,u]=(0,L.useState)(0),d,f;t[4]!==o||t[5]!==s.length||t[6]!==c?(d=()=>{if(window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;let e=o.setInterval(()=>{u(e=>(e+1)%s.length)},c);return()=>o.clearInterval(e)},f=[o,s.length,c],t[4]=o,t[5]=s.length,t[6]=c,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,L.useEffect)(d,f);let p;t[9]===n?p=t[10]:(p=j(`inline-block`,n),t[9]=n,t[10]=p);let m=s[l],h;return t[11]!==r||t[12]!==p||t[13]!==m?(h=(0,R.jsx)(`span`,{role:`status`,"aria-label":`Loading`,className:p,...r,children:m}),t[11]=r,t[12]=p,t[13]=m,t[14]=h):h=t[14],h}function m5(e){let t=(0,U.c)(11),{Icon:n,isLast:r,isLoading:i,aborted:a,state:o,isError:s}=e,c;t[0]!==n||t[1]!==a||t[2]!==s||t[3]!==i||t[4]!==o?(c=i?(0,R.jsx)(p5,{className:`text-muted-foreground z-10 shrink-0 text-sm`}):a?(0,R.jsx)(kT,{className:`text-destructive z-10 size-3.5 shrink-0`}):(0,R.jsx)(n,{className:j(`z-10 size-3.5 shrink-0`,o===`output-error`||s?`text-destructive`:`text-muted-foreground`)}),t[0]=n,t[1]=a,t[2]=s,t[3]=i,t[4]=o,t[5]=c):c=t[5];let l;t[6]===r?l=t[7]:(l=!r&&(0,R.jsx)(`span`,{className:`bg-border w-px flex-1`}),t[6]=r,t[7]=l);let u;return t[8]!==c||t[9]!==l?(u=(0,R.jsxs)(`div`,{className:`absolute top-0 left-0 flex h-full flex-col items-center`,children:[c,l]}),t[8]=c,t[9]=l,t[10]=u):u=t[10],u}function h5(e){let t=(0,U.c)(15),{isLast:n,label:r,state:i,aborted:a,children:o}=e,s=(0,L.use)(h6),c=r??s?.label,l=i??s?.state,u=a??s?.aborted??!1,d=c?.icon,f=!!l&&!u&&l!==`output-available`&&l!==`output-error`,p;t[0]!==d||t[1]!==u||t[2]!==c?.isError||t[3]!==l||t[4]!==n||t[5]!==f?(p=d?(0,R.jsx)(m5,{Icon:d,isLast:n,isLoading:f,aborted:u,state:l,isError:c?.isError??!1}):(0,R.jsx)(H6,{isLast:n}),t[0]=d,t[1]=u,t[2]=c?.isError,t[3]=l,t[4]=n,t[5]=f,t[6]=p):p=t[6];let m=p,h=n?``:`pb-3.5`,g;t[7]===h?g=t[8]:(g=j(`min-w-0 flex-1`,h),t[7]=h,t[8]=g);let _;t[9]!==o||t[10]!==g?(_=(0,R.jsx)(`div`,{className:g,children:o}),t[9]=o,t[10]=g,t[11]=_):_=t[11];let v;return t[12]!==m||t[13]!==_?(v=(0,R.jsx)(U6,{marker:m,children:_}),t[12]=m,t[13]=_,t[14]=v):v=t[14],v}function g5(e){let t=(0,U.c)(10),{label:n,state:r,part:i,defaultOpen:a,children:o}=e,s=a!==void 0&&a,c;t[0]!==n||t[1]!==i||t[2]!==r?(c=(0,R.jsx)(fr,{className:`cursor-pointer`,children:(0,R.jsx)(o6,{label:n,state:r,part:i})}),t[0]=n,t[1]=i,t[2]=r,t[3]=c):c=t[3];let l;t[4]===o?l=t[5]:(l=(0,R.jsx)(pr,{children:o}),t[4]=o,t[5]=l);let u;return t[6]!==s||t[7]!==c||t[8]!==l?(u=(0,R.jsxs)(dr,{defaultOpen:s,className:`flex min-w-0 flex-1 flex-col`,children:[c,l]}),t[6]=s,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}var _5={Item:h5,Disclosure:g5};(0,L.memo)(function(e){let t=(0,U.c)(12),{className:n}=e,{message:r}=I4(),{elements:i}=P4(),{debugMode:a}=y4(),o=t6(),s=L3(),c;t[0]===r.parts?c=t[1]:(c=w6(r.parts),t[0]=r.parts,t[1]=c);let l=c,u;t[2]!==a||t[3]!==i||t[4]!==s||t[5]!==r.id||t[6]!==l||t[7]!==o?(u=l.map((e,t)=>{let n=`${r.id}-${T6(e,t)}-${e.kind}`;if(e.kind===`text`)return(0,R.jsx)(b6.Text,{segment:e,elements:i,className:`my-4`},n);if(e.kind===`file`)return(0,R.jsx)(b6.File,{segment:e},n);if(e.kind===`source`)return(0,R.jsx)(b6.Source,{segment:e},n);if(e.kind===`dynamic-tool`){if(!o)return null;let r=!C6(l,t,!0);return(0,R.jsx)(_5.Item,{isLast:r,children:(0,R.jsx)(b6.DynamicTool,{segment:e})},n)}if(e.kind===`reasoning`){if(s||e.part.type!==`reasoning`)return null;let r=!C6(l,t,a),i={name:`Reasoning`,icon:BT,args:{text:[...e.part.text].slice(0,60).join(``)}};return(0,R.jsx)(_5.Item,{isLast:r,label:i,children:(0,R.jsx)(_5.Disclosure,{label:i,children:(0,R.jsx)(b6.Reasoning,{segment:e})})},n)}if(e.kind===`tool`){let r=!C6(l,t,a);return(0,R.jsx)(b6.Tool,{segment:e,children:(0,R.jsx)(_5.Item,{isLast:r,children:(0,R.jsx)(b6.ToolDisclosure,{})})},n)}return null}),t[2]=a,t[3]=i,t[4]=s,t[5]=r.id,t[6]=l,t[7]=o,t[8]=u):u=t[8];let d;return t[9]!==n||t[10]!==u?(d=(0,R.jsx)(`div`,{className:n,children:u}),t[9]=n,t[10]=u,t[11]=d):d=t[11],d});function v5(e){let t=(0,U.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{hasSubmitted:i}=x4(),a;t[3]===n?a=t[4]:(a=j(`bg-background sticky bottom-0 rounded-t-2xl border-0 **:data-[slot=composer-editor]:!min-h-15`,n),t[3]=n,t[4]=a);let o;return t[5]!==i||t[6]!==r||t[7]!==a?(o=(0,R.jsx)(U1.Root,{hasInteracted:i,className:a,...r}),t[5]=i,t[6]=r,t[7]=a,t[8]=o):o=t[8],o}function y5(e){let t=(0,U.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=j(`border-border bg-card focus-within:border-primary/80 focus-within:ring-primary/15 relative rounded-2xl border`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function b5(e){let t=(0,U.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=j(`space-y-1 px-3.5 pt-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(U1.Content,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function x5(e){let t=(0,U.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=j(`!min-h-15 !rounded-none !border-0 !bg-transparent !shadow-none **:data-[slot=composer-editor]:!p-0 **:data-[slot=composer-placeholder]:!p-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(U1.Editor,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function S5(e){let t=(0,U.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=j(`pb-1.5`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(U1.Attachments,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function C5(e){let t=(0,U.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=j(`p-1.5 pt-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,R.jsx)(U1.Toolbar,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function w5(e){let t=(0,U.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,R.jsx)(D6,{icon:(0,R.jsx)(GT,{className:`size-4`})}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,R.jsx)(U1.AttachFiles,{"aria-label":`Attach files`,render:n,...e}),t[1]=e,t[2]=r),r}function T5(){let e=(0,U.c)(6),{actions:t,meta:n}=MX(`ChatComposer.CommandButton`),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,R.jsx)(KT,{className:`size-4`}),e[0]=r):r=e[0];let i=n.activePopup?.trigger===`/`,a;e[1]===t?a=e[2]:(a=e=>{e.stopPropagation(),t.toggleSlashMenu()},e[1]=t,e[2]=a);let o;return e[3]!==i||e[4]!==a?(o=(0,R.jsx)(D6,{"data-command-button":!0,icon:r,"aria-label":`Toggle command menu`,"aria-expanded":i,onClick:a}),e[3]=i,e[4]=a,e[5]=o):o=e[5],o}function E5(e){switch(e){case`permission-denied`:return`Allow microphone access to use dictation`;case`no-microphone`:return`Connect a microphone to use dictation`;case`microphone-in-use`:return`Close other apps using the microphone`;case`interrupted`:return`Recording interrupted`;case`transcription-failed`:return`Unable to transcribe audio`}}function D5(e){switch(e.status){case`unavailable`:return e.reason===`blocked`?`Allow microphone access in your browser settings to use dictation`:`Dictation is not available in this browser`;case`idle`:return`Start dictation`;case`starting`:return`Starting dictation`;case`recording`:return`Stop dictation`;case`finishing`:return`Transcribing…`;case`failed`:return E5(e.error.code)}}function O5(e){switch(e.status){case`recording`:return(0,R.jsx)(JT,{className:`size-4 fill-current`});case`starting`:case`finishing`:return(0,R.jsx)(HT,{className:`size-4 animate-spin`});case`unavailable`:case`idle`:case`failed`:return(0,R.jsx)(WT,{className:`size-4`})}}function k5(){let e=(0,U.c)(20),{status:t}=b4(),{state:n}=PQ(`ChatComposer.Dictate`),r;e[0]===n?r=e[1]:(r=D5(n),e[0]=n,e[1]=r);let i=r,a=n.status===`starting`||n.status===`recording`||n.status===`finishing`,o=t===`streaming`||t===`submitted`,s;e[2]===n?s=e[3]:(s=O5(n),e[2]=n,e[3]=s);let c;e[4]!==i||e[5]!==s?(c=(0,R.jsx)(D6,{icon:s,"aria-label":i,title:i}),e[4]=i,e[5]=s,e[6]=c):c=e[6];let l;e[7]!==o||e[8]!==c?(l=(0,R.jsx)(U1.Dictate,{disabled:o,render:c}),e[7]=o,e[8]=c,e[9]=l):l=e[9];let u;e[10]!==a||e[11]!==n.status?(u=a?(0,R.jsx)(U1.CancelDictation,{render:(0,R.jsx)(D6,{icon:(0,R.jsx)(ZT,{className:`size-4`}),"aria-label":n.status===`finishing`?`Cancel transcription`:`Cancel dictation`})}):null,e[10]=a,e[11]=n.status,e[12]=u):u=e[12];let d;e[13]!==i||e[14]!==n.status?(d=n.status===`failed`?(0,R.jsx)(`span`,{role:`status`,className:`text-destructive max-w-48 truncate text-xs`,children:i}):null,e[13]=i,e[14]=n.status,e[15]=d):d=e[15];let f;return e[16]!==l||e[17]!==u||e[18]!==d?(f=(0,R.jsxs)(R.Fragment,{children:[l,u,d]}),e[16]=l,e[17]=u,e[18]=d,e[19]=f):f=e[19],f}var A5={Provider:v5,Root:y5,Popup:U1.Popup,Content:b5,Attachments:S5,Editor:x5,Error:U1.Error,Toolbar:C5,CommandButton:T5,AttachFiles:w5,Dictate:k5};function j5(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`border-border flex flex-col border-b px-2 py-1.5`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,R.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function M5(e){let t=(0,U.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`flex items-center gap-2 px-2 py-1.5`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,R.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function N5(e){let t=(0,U.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=j(`text-muted-foreground size-3.5 shrink-0`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,R.jsx)(VT,{className:r}),t[2]=r,t[3]=i),i}function P5(e){let t=(0,U.c)(7),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`min-w-0 flex-1 truncate text-sm`,r),t[0]=r,t[1]=i);let a;t[2]===n?a=t[3]:(a=typeof n==`string`?(0,R.jsx)(G1,{text:n}):n,t[2]=n,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,R.jsx)(`span`,{className:i,children:a}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function F5(e){let t=(0,U.c)(6),{onClick:n,className:r}=e,i;t[0]===r?i=t[1]:(i=j(`text-muted-foreground hover:text-foreground shrink-0 rounded p-1 transition-colors`,r),t[0]=r,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,R.jsx)(YT,{className:`size-3.5`}),t[2]=a):a=t[2];let o;return t[3]!==n||t[4]!==i?(o=(0,R.jsx)(`button`,{type:`button`,onClick:n,className:i,"aria-label":`Remove queued message`,children:a}),t[3]=n,t[4]=i,t[5]=o):o=t[5],o}var I5={Root:j5,Item:M5,Icon:N5,Text:P5,Remove:F5},L5={normal:{d:`m5 12 7-7 7 7`,translateY:0},animate:{d:`m5 12 7-7 7 7`,translateY:[0,3,0],transition:{duration:.4}}},R5={normal:{d:`M12 19V5`},animate:{d:[`M12 19V5`,`M12 19V10`,`M12 19V5`],transition:{duration:.4}}},z5=e=>{let t=(0,U.c)(30),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({ref:o,onMouseEnter:r,onMouseLeave:i,className:n,size:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=s===void 0?20:s,l=nT(),u=(0,L.useRef)(!1),d;t[7]===l?d=t[8]:(d=()=>(u.current=!0,{startAnimation:()=>l.start(`animate`),stopAnimation:()=>l.start(`normal`)}),t[7]=l,t[8]=d),(0,L.useImperativeHandle)(o,d);let f;t[9]!==l||t[10]!==r?(f=e=>{u.current?r?.(e):l.start(`animate`)},t[9]=l,t[10]=r,t[11]=f):f=t[11];let p=f,m;t[12]!==l||t[13]!==i?(m=e=>{u.current?i?.(e):l.start(`normal`)},t[12]=l,t[13]=i,t[14]=m):m=t[14];let h=m,g;t[15]===n?g=t[16]:(g=j(n),t[15]=n,t[16]=g);let _,v;t[17]===l?(_=t[18],v=t[19]):(_=(0,R.jsx)(rT.path,{animate:l,d:`m5 12 7-7 7 7`,variants:L5}),v=(0,R.jsx)(rT.path,{animate:l,d:`M12 19V5`,variants:R5}),t[17]=l,t[18]=_,t[19]=v);let y;t[20]!==c||t[21]!==_||t[22]!==v?(y=(0,R.jsxs)(`svg`,{fill:`none`,height:c,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,viewBox:`0 0 24 24`,width:c,xmlns:`http://www.w3.org/2000/svg`,children:[_,v]}),t[20]=c,t[21]=_,t[22]=v,t[23]=y):y=t[23];let b;return t[24]!==p||t[25]!==h||t[26]!==a||t[27]!==g||t[28]!==y?(b=(0,R.jsx)(`div`,{className:g,onMouseEnter:p,onMouseLeave:h,...a,children:y}),t[24]=p,t[25]=h,t[26]=a,t[27]=g,t[28]=y,t[29]=b):b=t[29],b};z5.displayName=`ArrowUpIcon`;var B5={duration:.15,ease:[0,0,.2,1]},V5={duration:.12,ease:[0,0,.2,1]};function H5(e){let t=(0,U.c)(40),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({variant:a,className:n,disabled:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=Xw(),s=a===`stop`,c;t[5]===o?c=t[6]:(c=!o&&{opacity:0,scale:.9},t[5]=o,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l={opacity:1,scale:1},t[7]=l):l=t[7];let u;t[8]===o?u=t[9]:(u=o?void 0:{opacity:0,scale:.9},t[8]=o,t[9]=u);let d;t[10]!==r||t[11]!==o?(d=r||o?void 0:{scale:1.04},t[10]=r,t[11]=o,t[12]=d):d=t[12];let f;t[13]!==r||t[14]!==o?(f=r||o?void 0:{scale:.96},t[13]=r,t[14]=o,t[15]=f):f=t[15];let p=s?`Stop streaming`:`Send prompt`,m;t[16]===n?m=t[17]:(m=j(`relative flex size-8 items-center justify-center rounded-full`,`bg-primary text-primary-foreground`,`transition-opacity hover:opacity-90 active:opacity-80`,`disabled:cursor-not-allowed disabled:opacity-35 disabled:hover:opacity-35`,`focus-visible:outline-[1.5px] focus-visible:outline-offset-[2.5px] focus-visible:outline-current`,n),t[16]=n,t[17]=m);let h=s?`stop`:`send`,g;t[18]===o?g=t[19]:(g=!o&&{opacity:0,scale:.7},t[18]=o,t[19]=g);let _;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(_={opacity:1,scale:1},t[20]=_):_=t[20];let v;t[21]===o?v=t[22]:(v=o?void 0:{opacity:0,scale:.7},t[21]=o,t[22]=v);let y;t[23]===s?y=t[24]:(y=(0,R.jsx)(s?G5:W5,{}),t[23]=s,t[24]=y);let b;t[25]!==v||t[26]!==y||t[27]!==h||t[28]!==g?(b=(0,R.jsx)($S,{initial:!1,children:(0,R.jsx)(rT.span,{initial:g,animate:_,exit:v,transition:V5,className:`absolute flex items-center justify-center`,children:y},h)}),t[25]=v,t[26]=y,t[27]=h,t[28]=g,t[29]=b):b=t[29];let x;return t[30]!==r||t[31]!==i||t[32]!==c||t[33]!==b||t[34]!==u||t[35]!==d||t[36]!==f||t[37]!==p||t[38]!==m?(x=(0,R.jsx)(rT.button,{initial:c,animate:l,exit:u,transition:B5,whileHover:d,whileTap:f,"aria-label":p,...i,disabled:r,className:m,children:b}),t[30]=r,t[31]=i,t[32]=c,t[33]=b,t[34]=u,t[35]=d,t[36]=f,t[37]=p,t[38]=m,t[39]=x):x=t[39],x}function U5(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,R.jsx)(`svg`,{width:`20`,height:`20`,viewBox:`0 0 20 20`,fill:`currentColor`,"aria-hidden":`true`,children:n}),t[0]=n,t[1]=r),r}function W5(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(z5,{}),e[0]=t):t=e[0],t}function G5(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,R.jsx)(U5,{children:(0,R.jsx)(`rect`,{x:`5`,y:`5`,width:`10`,height:`10`,rx:`1.5`})}),e[0]=t):t=e[0],t}function K5(e){let t=(0,U.c)(25),{title:n,detail:r,detailLabel:i,part:a,error:o}=e,s=n===void 0?`Failed to render tool`:n,c=i===void 0?`View details`:i,l=S4(),u;t[0]===o.issues?u=t[1]:(u=o.issues.map(q5).join(`
|
|
3515
|
+
`),t[0]=o.issues,t[1]=u);let d=u,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,R.jsx)(PT,{className:`size-5`}),t[2]=f):f=t[2];let p;t[3]===s?p=t[4]:(p=(0,R.jsx)(Fn,{children:(0,R.jsxs)(In,{className:`text-destructive flex items-center gap-2`,children:[f,s]})}),t[3]=s,t[4]=p);let m,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,R.jsx)(PT,{className:`size-4`}),g=(0,R.jsx)(O,{children:`Error`}),t[5]=m,t[6]=g):(m=t[5],g=t[6]);let _;t[7]===d?_=t[8]:(_=(0,R.jsxs)(h,{variant:`destructive`,children:[m,g,(0,R.jsx)(Pe,{children:d})]}),t[7]=d,t[8]=_);let v;t[9]!==r||t[10]!==c?(v=r&&(0,R.jsxs)(`details`,{className:`text-sm`,children:[(0,R.jsx)(`summary`,{className:`text-muted-foreground hover:text-foreground cursor-pointer`,children:c}),(0,R.jsx)(`pre`,{className:`bg-muted mt-2 max-h-48 overflow-auto rounded-md p-3 text-xs`,children:(0,R.jsx)(`code`,{children:r})})]}),t[9]=r,t[10]=c,t[11]=v):v=t[11];let y;t[12]!==_||t[13]!==v?(y=(0,R.jsxs)(zn,{className:`space-y-4`,children:[_,v]}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b;t[15]!==l||t[16]!==a?(b=()=>{let e=[`The model tried to call the tool "${ap(a)}" with the following inputs:`,JSON.stringify(a.input),`Please fix the inputs.`];l.addToolOutput({toolCallId:a.toolCallId,tool:ap(a),output:e,state:`output-available`})},t[15]=l,t[16]=a,t[17]=b):b=t[17];let x;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,R.jsx)(qT,{className:`size-4`}),t[18]=x):x=t[18];let S;t[19]===b?S=t[20]:(S=(0,R.jsx)(Bn,{children:(0,R.jsxs)(tt,{variant:`outline`,onClick:b,className:`gap-2`,children:[x,`Ask AI to fix this`]})}),t[19]=b,t[20]=S);let C;return t[21]!==y||t[22]!==S||t[23]!==p?(C=(0,R.jsxs)(Pn,{className:`border-destructive/50 bg-destructive/5`,children:[p,y,S]}),t[21]=y,t[22]=S,t[23]=p,t[24]=C):C=t[24],C}function q5(e){return`${e.path.join(`.`)}: ${e.message}`}(0,L.createContext)(``),L.Component,L.useState,L.useEffect,L.useMemo,L.useCallback,L.useReducer,L.useId,L.Fragment,L.createElement,(0,L.createContext)(null),(0,L.createContext)(null),(0,L.createContext)(null);function J5({question:e}){let{submit:t}=y4();return typeof e!=`string`||e===``?null:(0,R.jsxs)(`button`,{type:`button`,className:`text-muted-foreground hover:bg-accent hover:text-accent-foreground my-1 inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-sm transition-colors`,onClick:()=>void t({prompt:e,persistedPrompt:e}),children:[(0,R.jsx)(an,{className:`size-3.5`}),e]})}var Y5=bT([{name:`followup`,description:`Suggest a follow-up question the user is likely to ask next. Renders as a clickable chip that sends the question as the next message. Example: <followup question="How do I undo this?" />`,allowedAttributes:[`question`],component:J5}]),X5=F({label:I().describe(`Display text for the option`),value:I().optional().describe(`Machine value; defaults to label`),description:I().optional().describe(`Helper text for the option`)}),Z5=C(e=>typeof e==`object`&&e&&`questions`in e&&Array.isArray(e.questions)?{...e,questions:e.questions.map(e=>typeof e==`object`&&e?{...e,type:`choice`}:e)}:e,F({questions:et(F({type:Et(`choice`).describe(`Selection from predefined options`),question:I().describe(`The question text displayed to the user`),header:I().optional().describe(`Short context label`),multiSelect:Qe().default(!1).describe(`Whether multiple options can be selected`),options:et(X5).min(1).describe(`Available choices`)})).min(1).describe(`Questions to present as a wizard`)})),Q5=F({label:I(),value:I()}),$5=F({answers:et(F({type:I(),question:I(),freeText:I().optional(),notes:I().optional(),choice:Q5.optional(),choices:et(Q5).optional(),multiSelect:Qe().optional(),answer:I().optional()}))});function e7(e){if(e.multiSelect){if(e.selectedMulti.length===0&&!e.customText.trim())return`Pick at least one option or add your own answer.`}else{if(!e.selected&&!e.isOther)return`Select an option or add your own answer.`;if(e.isOther&&!e.customText.trim())return`Add your custom answer for the "Other" option.`}return null}function t7(e){return{type:`choice`,multiSelect:e.multiSelect??!1,selected:null,selectedMulti:[],isOther:!1,customText:``,notes:``}}function n7(e){return e.options.filter(e=>(e.value??e.label).toLowerCase()!==`other`&&e.label.toLowerCase()!==`other`).map(e=>({label:e.label,value:e.value??e.label,description:e.description}))}function r7(e,t,n){let r=e=>{let t=n.find(t=>t.value===e);return t?{label:t.label,value:t.value}:{label:e,value:e}},i=t.notes.trim()||void 0,a=t.customText.trim()||void 0;if(t.multiSelect){let n=t.selectedMulti.map(r);return a&&n.push({label:`Other`,value:a}),{type:`choice`,question:e.question,multiSelect:!0,choices:n,freeText:a,notes:i}}return{type:`choice`,question:e.question,multiSelect:!1,choice:t.isOther?{label:`Other`,value:a??``}:r(t.selected??``),freeText:t.isOther?a:void 0,notes:i}}function i7({checked:e,children:t,disabled:n}){return(0,R.jsx)(`div`,{className:j(`border-border/60 relative flex items-start gap-2 rounded-lg border px-3 py-1.5 transition-all duration-150`,!n&&`hover:bg-muted/40`,e&&`border-primary/50 bg-primary/5`,n&&`opacity-60`),children:t})}function a7({htmlFor:e,label:t,description:n}){return(0,R.jsxs)(v,{htmlFor:e,className:`min-w-0 flex-1 cursor-pointer flex-col items-start gap-0`,children:[(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:t}),n?(0,R.jsx)(`p`,{className:`text-muted-foreground text-xs leading-relaxed text-pretty`,children:n}):null]})}function o7({id:e,value:t,label:n,description:r,checked:i,disabled:a}){return(0,R.jsxs)(i7,{checked:i,disabled:a,children:[(0,R.jsx)(Vr,{id:e,value:t,disabled:a,className:`mt-0.5`}),(0,R.jsx)(a7,{htmlFor:e,label:n,description:r})]})}function s7({id:e,label:t,description:n,checked:r,disabled:i,onCheckedChange:a}){return(0,R.jsxs)(i7,{checked:r,disabled:i,children:[(0,R.jsx)(rr,{id:e,checked:r,disabled:i,onCheckedChange:e=>a(e===!0),className:`mt-0.5`}),(0,R.jsx)(a7,{htmlFor:e,label:t,description:n})]})}function c7({id:e,checked:t,disabled:n,customText:r,onCustomTextChange:i}){let a=(0,L.useRef)(null);return(0,R.jsxs)(i7,{checked:t,disabled:n,children:[(0,R.jsx)(Vr,{ref:a,id:e,value:`other`,disabled:n,className:`mt-0.5`}),(0,R.jsx)(`input`,{value:r,onChange:e=>i(e.target.value),placeholder:`Type your answer...`,disabled:n,onFocus:()=>{t||a.current?.click()},className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none disabled:cursor-not-allowed`})]})}function l7({hasCustom:e,disabled:t,customText:n,onCustomTextChange:r,onClear:i}){let a=(0,L.useRef)(null);return(0,R.jsxs)(i7,{checked:e,disabled:t,children:[(0,R.jsx)(rr,{ref:a,checked:e,disabled:t,onCheckedChange:e=>{e||i()},className:`mt-0.5`}),(0,R.jsx)(`input`,{value:n,onChange:e=>r(e.target.value),placeholder:`Type your answer...`,disabled:t,onFocus:()=>{e||a.current?.click()},className:`placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none disabled:cursor-not-allowed`})]})}function u7({value:e,onChange:t,disabled:n}){return(0,R.jsx)(`div`,{className:`mt-2.5 border-t border-dashed pt-2.5`,children:(0,R.jsx)(ve,{value:e,onChange:e=>t(e.target.value),placeholder:`Add notes (optional)...`,disabled:n,rows:2,className:`resize-none text-sm`})})}function d7({value:e,onChange:t,options:n,disabled:r,fieldId:i}){if(e.multiSelect){let a=e.customText.trim().length>0,o=(n,r)=>{let i=new Set(e.selectedMulti);r?i.add(n):i.delete(n),t({...e,selectedMulti:[...i]})};return(0,R.jsxs)(`div`,{className:`space-y-1.5`,children:[n.map(t=>(0,R.jsx)(s7,{id:`${i}-multi-${t.value}`,label:t.label,description:t.description,checked:e.selectedMulti.includes(t.value),disabled:r,onCheckedChange:e=>o(t.value,e)},t.value)),(0,R.jsx)(l7,{hasCustom:a,disabled:r,customText:e.customText,onCustomTextChange:n=>t({...e,customText:n}),onClear:()=>t({...e,customText:``})})]})}return(0,R.jsxs)(Br,{value:e.isOther?`other`:e.selected??``,onValueChange:n=>t(n===`other`?{...e,selected:null,isOther:!0}:{...e,selected:n,isOther:!1,customText:``}),children:[n.map(t=>(0,R.jsx)(o7,{id:`${i}-single-${t.value}`,value:t.value,label:t.label,description:t.description,checked:!e.isOther&&e.selected===t.value,disabled:r},t.value)),(0,R.jsx)(c7,{id:`${i}-single-other`,checked:e.isOther,disabled:r,customText:e.customText,onCustomTextChange:n=>t({...e,customText:n})})]})}function f7({current:e,total:t}){return t<=1?null:(0,R.jsx)(`div`,{className:`flex items-center gap-1`,children:Array.from({length:t},(t,n)=>(0,R.jsx)(`div`,{className:j(`h-1 w-3 rounded-full transition-colors duration-200`,n<=e?`bg-primary`:`bg-muted`)},n))})}function p7({onBack:e,onNext:t,isFirst:n,isLast:r,canProceed:i,isSubmitting:a,isSubmitted:o,currentStep:s,totalSteps:c}){return o?null:(0,R.jsxs)(`div`,{className:`flex items-center justify-between border-t border-dashed px-3 py-1.5`,children:[(0,R.jsx)(`div`,{className:`w-16`,children:n?null:(0,R.jsx)(`button`,{type:`button`,onClick:e,disabled:a,className:`text-muted-foreground hover:text-foreground text-xs transition-colors disabled:opacity-50`,children:`← Back`})}),(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(f7,{current:s,total:c}),c>1?(0,R.jsxs)(`span`,{className:`text-muted-foreground text-[11px] tabular-nums`,children:[s+1,`/`,c]}):null]}),(0,R.jsx)(`div`,{className:`flex w-16 justify-end`,children:(0,R.jsxs)(tt,{type:`button`,size:`sm`,onClick:t,disabled:!i||a,children:[a?(0,R.jsx)(Hr,{}):null,a?`Sending...`:r?`Submit`:`Next`]})})]})}function m7({question:e}){return(0,R.jsxs)(`div`,{className:`px-3 pt-2.5 pb-2`,children:[(0,R.jsxs)(`div`,{className:`text-muted-foreground mb-2 flex items-center gap-2 text-[11px]`,children:[(0,R.jsx)(Ae,{className:`size-3`}),(0,R.jsx)(`span`,{children:e.header??`Clarification`})]}),(0,R.jsx)(Nn,{className:`mb-2`}),(0,R.jsx)(`p`,{className:`text-sm font-medium text-pretty`,children:e.question})]})}function h7({question:e,answer:t,options:n,onChange:r,disabled:i,fieldId:a}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(d7,{value:t,onChange:r,options:n,disabled:i,fieldId:a}),(0,R.jsx)(u7,{value:t.notes,onChange:e=>r({...t,notes:e}),disabled:i})]})}function g7({question:e,answer:t,options:n}){let r=t.multiSelect?[...t.selectedMulti.map(e=>n.find(t=>t.value===e)?.label??e),...t.customText.trim()?[`Other: ${t.customText.trim()}`]:[]].join(`, `):t.isOther?`Other: ${t.customText.trim()}`:n.find(e=>e.value===t.selected)?.label??t.selected??``,i=t.notes.trim()||void 0;return(0,R.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm text-pretty`,children:e.question}),(0,R.jsx)(`p`,{className:`mt-1 text-sm font-medium text-pretty`,children:r}),i?(0,R.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs text-pretty italic`,children:[`Note: `,i]}):null]})}function _7(e){return e.type===`free_form`?e.answer??``:e.multiSelect&&e.choices?e.choices.map(({label:e,value:t})=>e===`Other`?`Other: ${t}`:e).join(`, `):e.freeText?`Other: ${e.freeText}`:e.choice?.label??``}function v7({answers:e}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`px-3 pt-2.5 pb-2`,children:(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[(0,R.jsx)(Fe,{className:`size-3`}),(0,R.jsx)(`span`,{children:`Answered`})]})}),(0,R.jsx)(Nn,{}),e.map((e,t)=>(0,R.jsxs)(`div`,{className:`px-3 py-2.5`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm text-pretty`,children:e.question}),(0,R.jsx)(`p`,{className:`mt-1 text-sm font-medium text-pretty`,children:_7(e)}),e.notes?(0,R.jsxs)(`p`,{className:`text-muted-foreground mt-1 text-xs text-pretty italic`,children:[`Note: `,e.notes]}):null]},t))]})}function y7({questions:e,answers:t}){return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`div`,{className:`px-3 pt-2.5 pb-2`,children:(0,R.jsxs)(`div`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[(0,R.jsx)(Fe,{className:`size-3`}),(0,R.jsx)(`span`,{children:`Answered`})]})}),(0,R.jsx)(Nn,{}),e.map((e,n)=>(0,R.jsx)(g7,{question:e,answer:t[n],options:n7(e)},n))]})}var b7=(0,L.createContext)(void 0);function x7(){let e=(0,L.use)(b7);if(!e)throw Error(`useWizard must be used within <ClarificationWizard.Root>`);return e}function S7({questions:e,onSubmit:t,disabled:n,fieldId:r,children:i}){let[a,o]=(0,L.useState)(0),[s,c]=(0,L.useState)(()=>e.map(t7)),[l,u]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),[p,m]=(0,L.useState)(!1),h=e[a],g=s[a],_=a===0,v=a===e.length-1,y={questions:e,currentStep:a,currentQuestion:h,currentAnswer:g,options:n7(h),answers:s,updateAnswer:e=>{c(t=>{let n=[...t];return n[a]=e,n}),u(null)},handleBack:()=>{_||(o(e=>e-1),u(null))},handleNext:async()=>{let n=e7(g);if(n){u(n);return}if(!v){o(e=>e+1),u(null);return}for(let t=0;t<e.length;t++){let e=e7(s[t]);if(e){o(t),u(e);return}}f(!0);try{await t(e.map((e,t)=>r7(e,s[t],n7(e)))),m(!0)}catch(e){u(e instanceof Error?e.message:`Failed to send your answers.`)}finally{f(!1)}},error:l,isFirst:_,isLast:v,canProceed:!n&&!p,isSubmitting:d,isSubmitted:p,disabled:n,fieldId:r,totalSteps:e.length};return(0,R.jsx)(b7,{value:y,children:i})}function C7(){let{currentQuestion:e,isSubmitted:t}=x7();return t?null:(0,R.jsx)(m7,{question:e})}function w7(){let{currentQuestion:e,currentAnswer:t,options:n,updateAnswer:r,disabled:i,isSubmitting:a,isSubmitted:o,fieldId:s,currentStep:c}=x7();return o?null:(0,R.jsx)(h7,{question:e,answer:t,options:n,onChange:r,disabled:i||a,fieldId:`${s}-step-${c}`})}function T7(){let{error:e,isSubmitted:t}=x7();return t||!e?null:(0,R.jsx)(`p`,{className:`text-destructive text-xs`,role:`alert`,children:e})}function E7(){let{handleBack:e,handleNext:t,isFirst:n,isLast:r,canProceed:i,isSubmitting:a,isSubmitted:o,currentStep:s,totalSteps:c}=x7();return(0,R.jsx)(p7,{onBack:e,onNext:()=>void t(),isFirst:n,isLast:r,canProceed:i,isSubmitting:a,isSubmitted:o,currentStep:s,totalSteps:c})}function D7({children:e,className:t}){let{isSubmitted:n}=x7();return n?null:(0,R.jsx)(`div`,{className:t,children:e})}function O7(){let{questions:e,answers:t,isSubmitted:n}=x7();return n?(0,R.jsx)(y7,{questions:e,answers:t}):null}var k7={Root:S7,Header:C7,Content:D7,Field:w7,Error:T7,Navigation:E7,Submitted:O7};function A7({part:e}){let t=S4(),[n,r]=(0,L.useState)(!1),i=(0,L.useId)();if(e.state===`output-available`){let t=$5.safeParse(e.output);return t.success?(0,R.jsx)(`div`,{className:j(`border-border/60 bg-muted/20 mb-2 rounded-lg border border-dashed`),children:(0,R.jsx)(v7,{answers:t.data.answers})}):null}if(e.state!==`input-available`)return null;let a=Z5.safeParse(e.input);return a.success?(0,R.jsx)(`div`,{className:j(`border-border/60 bg-muted/20 rounded-lg border border-dashed`,`animate-in fade-in-0 duration-200`),children:(0,R.jsxs)(k7.Root,{questions:a.data.questions,onSubmit:async n=>{await t.addToolOutput({toolCallId:e.toolCallId,tool:ap(e),output:{answers:n},state:`output-available`}),r(!0)},disabled:n,fieldId:i,children:[(0,R.jsx)(k7.Submitted,{}),(0,R.jsx)(k7.Header,{}),(0,R.jsxs)(k7.Content,{className:`space-y-2 px-3 pb-2`,children:[(0,R.jsx)(k7.Field,{}),(0,R.jsx)(k7.Error,{})]}),(0,R.jsx)(k7.Navigation,{})]})}):(0,R.jsx)(K5,{error:a.error,title:`Failed to render clarification`,detail:JSON.stringify(e.input,null,2),detailLabel:`View input`,part:e})}var j7={component:A7,label:e=>{let t=e.state===`input-available`||e.state===`output-available`?Z5.safeParse(e.input):void 0,n=t?.success?t.data.questions[0]:void 0;return{name:`AskUserQuestion`,icon:nn,args:n?{question:n.header??n.question}:void 0}},requiresUserInput:!0,static:!1,inputSchema:Z5,description:`Tool to collect information from the user via a multi-step wizard. Use when you need to clarify requirements, gather preferences, or resolve ambiguity before proceeding.
|
|
3516
3516
|
|
|
3517
3517
|
Each question MUST have a "type" field set to "choice" for selection from predefined options (single or multiple).
|
|
3518
3518
|
|
|
3519
3519
|
IMPORTANT: NEVER include an "Other" option in your options array — the UI always renders one automatically with an inline text input.
|
|
3520
3520
|
|
|
3521
3521
|
Example:
|
|
3522
|
-
{"questions":[{"type":"choice","question":"Which timeframe?","header":"Timeframe","multiSelect":false,"options":[{"label":"Last 30 days"},{"label":"Last quarter"}]}]}`};function
|
|
3523
|
-
`)||void 0}}function Y7(e){return!R7(e)||e.type!==`content`||!Array.isArray(e.value)?[]:e.value.flatMap(e=>{if(!R7(e)||e.type!==`file`)return[];let t=typeof e.mediaType==`string`?e.mediaType:`file`;return[`${typeof e.filename==`string`?e.filename:`Attachment`} · ${t}`]})}var X7={css:`css`,csv:`csv`,html:`html`,js:`javascript`,json:`json`,jsx:`jsx`,md:`markdown`,py:`python`,sh:`bash`,sql:`sql`,ts:`typescript`,tsx:`tsx`,txt:`text`,xml:`xml`,yaml:`yaml`,yml:`yaml`};function Z7(e){return X7[e.split(`.`).pop()?.toLowerCase()??``]??`text`}function Q7(e){let t=B7(e,`offset`),n=B7(e,`limit`);if(t===void 0&&n===void 0)return;let r=t??1;return n===void 0?`${r}+`:`${r}-${r+n-1}`}function $7({part:e}){let t=z7(e.input,`path`)??``,n=J7(e.output),r=Y7(e.output),i=R7(e.output)&&e.output.type===`error-text`?J7(e.output):void 0,a=U7(e)??i,o=H7(e),s=Q7(e.input);return(0,R.jsx)(K7,{children:a?(0,R.jsx)(W7,{error:!0,children:a}):o?(0,R.jsxs)(W7,{pending:!0,children:[`Reading `,t||`file`,`...`]}):n===void 0?r.length>0?(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-[10px] font-semibold tracking-[0.08em] uppercase`,children:`File content`}),r.map(e=>(0,R.jsx)(`p`,{className:`text-foreground/80 text-xs`,children:e},e))]}):(0,R.jsx)(W7,{children:`File content is unavailable.`}):n?(0,R.jsx)(G7,{code:n,detail:s?`lines ${s}`:void 0,language:Z7(t),title:`File contents`}):(0,R.jsx)(W7,{children:`The file is empty.`})})}function e9({part:e}){let t=z7(e.input,`path`)??``,n=z7(e.input,`content`)??``,r=B7(e.output,`exitCode`),i=z7(e.output,`stderr`)??``,a=z7(e.output,`stdout`)??``,o=V7(e.output,`success`),s=U7(e);return(0,R.jsxs)(K7,{children:[H7(e)?(0,R.jsxs)(W7,{pending:!0,children:[`Writing `,t||`file`,`...`]}):s||o===!1||(r??0)!==0?(0,R.jsx)(W7,{error:!0,children:s||i||a||`Failed to write ${t||`file`}.`}):(0,R.jsx)(W7,{children:`File written.`}),n?(0,R.jsx)(G7,{code:n,language:Z7(t),title:`Written content`}):(0,R.jsx)(W7,{children:`The file content is empty.`})]})}function t9(e){let t=z7(e.input,`command`),n=z7(e.input,`reasoning`),r=B7(e.output,`exitCode`);return{name:`Bash`,args:t?{cmd:t.slice(0,80)}:void 0,detail:n,isError:e.state===`output-error`||e.state===`output-denied`||r!==void 0&&r!==0}}function n9(e,t){let n=z7(e.input,`path`),r=t===`ReadFile`?Q7(e.input):void 0,i=B7(e.output,`exitCode`);return{name:t,args:n||r?{...n?{path:n}:{},...r?{lines:r}:{}}:void 0,isError:e.state===`output-error`||e.state===`output-denied`||V7(e.output,`success`)===!1||i!==void 0&&i!==0||R7(e.output)&&e.output.type===`error-text`}}var r9={ask_user_question:L7,bash:{component:q7,label:t9,static:!0},readFile:{component:$7,label:e=>n9(e,`ReadFile`),static:!0},writeFile:{component:e9,label:e=>n9(e,`WriteFile`),static:!0}},i9=xt(`status`,[F({id:I(),status:Et(`restored`),sourceMessages:wt(),replacementMessages:wt()}),F({id:I(),status:Et(`started`),tokenScope:Et(`request`).optional(),triggerIndex:wt(),targetTokens:wt(),messageCount:wt()}),F({id:I(),status:Et(`completed`),tokenScope:Et(`request`).optional(),tokens:F({before:wt(),after:wt()})}),F({id:I(),status:Et(`failed`),phase:Xe([`restore`,`evaluate`,`compact`,`persist`]),reason:Xe([`no-safe-boundary`,`protected-history`,`incomplete-summary`,`empty-summary`,`summary-too-large`,`request-overhead`,`error`])})]);function a9({message:e,running:t}){let n=e.parts.flatMap(e=>{if(e.type!==`data-compaction`)return[];let t=i9.safeParse(e.data);return t.success?[t.data]:[]}),r=Map.groupBy(n,e=>e.id);return Array.from(r,([e,n])=>(0,R.jsx)(o9,{events:n,running:t},e))}function o9({events:e,running:t}){let n=e.find(e=>e.status===`started`),r=e.find(e=>e.status===`completed`),i=e.find(e=>e.status===`failed`),a=e.find(e=>e.status===`restored`),o=n!==void 0&&!r&&!i;return(0,R.jsxs)(dr,{className:`my-3`,children:[(0,R.jsx)(fr,{className:`group w-full text-left`,children:(0,R.jsxs)(Pr,{children:[(0,R.jsx)(Ir,{children:o&&t?(0,R.jsx)(Hr,{"aria-label":`Compacting context`}):i?(0,R.jsx)(D,{className:`text-destructive size-4`}):r?(0,R.jsx)(Fe,{className:`size-4`}):(0,R.jsx)(sn,{className:`size-4`})}),(0,R.jsxs)(Lr,{children:[(0,R.jsx)(Rr,{children:i?`Compaction failed`:r?`Context compacted`:o?t?`Compacting context…`:`Compaction interrupted`:`Using saved summary`}),r&&(0,R.jsxs)(zr,{children:[r.tokens.before.toLocaleString(),` →`,` `,r.tokens.after.toLocaleString(),` estimated`,` `,r.tokenScope===`request`?`input`:`message`,` `,`tokens`]})]}),(0,R.jsx)(Ae,{className:`size-3.5 transition-transform group-data-[panel-open]:rotate-90`})]})}),(0,R.jsxs)(pr,{children:[(0,R.jsx)(Nn,{}),(0,R.jsxs)(`div`,{className:`space-y-3 px-3 py-3 text-sm`,children:[(0,R.jsxs)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-x-4 gap-y-2`,children:[n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Messages before compaction`}),(0,R.jsx)(`dd`,{children:n.messageCount.toLocaleString()}),(0,R.jsxs)(`dt`,{children:[`Estimated`,` `,n.tokenScope===`request`?`input`:`message`,` `,`target`]}),(0,R.jsxs)(`dd`,{children:[n.targetTokens.toLocaleString(),` tokens`]}),(0,R.jsx)(`dt`,{children:`Matched trigger`}),(0,R.jsxs)(`dd`,{children:[`#`,n.triggerIndex+1]})]}),r&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Checkpoint`}),(0,R.jsx)(`dd`,{children:`Saved`})]}),a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Using saved summary`}),(0,R.jsxs)(`dd`,{children:[a.sourceMessages,` → `,a.replacementMessages,` `,`messages`]})]})]}),i&&(0,R.jsx)(h,{variant:`destructive`,children:(0,R.jsxs)(Pe,{children:[i.phase,`: `,i.reason]})})]})]})]})}var s9=F({messages:et(it())});async function c9(e){let{params:t,request:n}=e,r=t.sessionId??new URL(n.url).searchParams.get(`chatId`);if(!r)return dt(`/chat?chatId=${encodeURIComponent(crypto.randomUUID())}`);let i=await vt(n.signal),a=i.history.find(e=>e.chatId===r),o=i.discovery?.capabilities.chat.href;if(!o||!t.sessionId&&!a&&!i.historyError)return{...i,chatId:r,conversation:a,initialMessages:void 0,sessionExists:!1,sessionError:!1};try{let e=await fetch(`${o}/${encodeURIComponent(r)}`,{signal:n.signal});if(e.status===404&&!t.sessionId)return{...i,chatId:r,conversation:a,initialMessages:void 0,sessionExists:!1,sessionError:!1};if(!e.ok)throw Error(`Session request failed: ${e.status}`);let s=s9.safeParse(await e.json());if(!s.success)throw Error(`Session response did not include messages`);return{...i,chatId:r,conversation:a,initialMessages:await bp({messages:s.data.messages}),sessionExists:!0,sessionError:!1}}catch{return{...i,chatId:r,conversation:a,initialMessages:void 0,sessionExists:!1,sessionError:!0}}}function l9({currentParams:e,currentUrl:t,nextParams:n,nextUrl:r}){return e.sessionId!==n.sessionId||t.searchParams.get(`chatId`)!==r.searchParams.get(`chatId`)}function u9(){let{chatId:e}=Se();return(0,R.jsx)(d9,{chatId:e},e)}function d9({chatId:e}){let{discovery:t,initialMessages:n,sessionError:r,sessionExists:i}=Se(),a=t?.capabilities.chat.href;return a?r?(0,R.jsx)(_9,{children:`Unable to load this conversation.`}):(0,R.jsx)(f9,{api:a,chatId:e,initialMessages:n,sessionExists:i,supportsUploads:t.capabilities.uploads!==void 0,accept:t.capabilities.uploads?.mediaTypes?.join(`,`)}):(0,R.jsx)(_9,{children:`Development runtime unavailable.`})}function f9({api:e,chatId:t,initialMessages:n,sessionExists:r,supportsUploads:i,accept:a}){let o=Me(),{revalidate:s}=se(),c=Se(),[l]=(0,L.useState)(()=>new a8({api:e,tools:P4(r9),elements:t7}));return(0,R.jsx)(w4,{chatId:t,initialMessages:n,onFinish:()=>void s(),onResetChat:e=>{o(`/chat?chatId=${encodeURIComponent(e)}`)},resume:r,registry:r9,transport:l,children:(0,R.jsxs)(f4,{className:`**:data-[slot='content']:max-w-3xl`,children:[(0,R.jsx)(v4.Root,{className:`px-6`,children:(0,R.jsx)(v4.Hero,{children:`How can I help?`})}),(0,R.jsx)(p9,{}),(0,R.jsx)(nt,{treeId:t,snapshot:c.conversation?.children}),(0,R.jsx)(m9,{supportsUploads:i,accept:a})]})})}function p9(){let{error:e,messages:t,regenerate:n,status:r}=O4();return t.length===0&&!e?null:(0,R.jsxs)(f5.Root,{className:`mb-8 min-h-0 flex-1 px-6`,messages:t,elements:t7,status:r,children:[(0,R.jsx)(f5.List,{children:t.map((e,n)=>(0,R.jsx)(f5.Item,{message:e,index:n,children:e.role===`user`?(0,R.jsx)(f5.UserBubble,{}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(a9,{message:e,running:n===t.length-1&&(r===`submitted`||r===`streaming`)}),(0,R.jsx)(f5.AssistantContent,{})]})},e.id))}),(0,R.jsx)(f5.Error,{error:e,onRetry:()=>void n()}),(0,R.jsx)(f5.Thinking,{})]})}function m9({supportsUploads:e,accept:t}){let{submit:n}=T4(),{hasSubmitted:r}=D4(),{status:i}=E4(),a=i===`submitted`||i===`streaming`;return(0,R.jsx)(`div`,{className:j(`w-full px-6 pb-6`,r&&`bg-background sticky bottom-0 mt-auto pt-2`),children:(0,R.jsx)(K6,{className:`bg-background`,children:(0,R.jsx)(I5.Provider,{isTaskRunning:a,onSubmit:(t,r)=>{let i=t.items.flatMap(e=>e.type===`image`||e.type===`video`||e.type===`audio`?[e.file]:[]);return!e&&i.length>0?Promise.reject(Error(`This runtime does not support file uploads`)):n({prompt:t.prompt,persistedPrompt:t.persistedPrompt,editableSource:r.editableSource,files:i})},children:(0,R.jsxs)(I5.Root,{children:[(0,R.jsx)(h9,{}),(0,R.jsx)(I5.Popup,{}),(0,R.jsxs)(I5.Content,{children:[(0,R.jsx)(I5.Attachments,{}),(0,R.jsx)(I5.Editor,{placeholder:`Message Zukhruf…`}),(0,R.jsx)(I5.Error,{})]}),(0,R.jsxs)(I5.Toolbar,{children:[e&&(0,R.jsx)(I5.AttachFiles,{accept:t}),(0,R.jsx)(g9,{})]})]})})})})}function h9(){let e=k4(),t=(0,L.useSyncExternalStore)(e.subscribe,()=>e.queue);return t.length===0?null:(0,R.jsx)(H5.Root,{children:t.map(t=>(0,R.jsxs)(H5.Item,{children:[(0,R.jsx)(H5.Icon,{}),(0,R.jsx)(H5.Text,{children:t.persistedPrompt}),(0,R.jsx)(H5.Remove,{onClick:()=>e.removeFromQueue(t.id)})]},t.id))})}function g9(){let{state:e}=_Q(`ChatSubmitButton`),{stop:t}=T4(),{status:n}=E4(),r=e.text.trim().length>0;return(n===`submitted`||n===`streaming`)&&!r?(0,R.jsx)(J5,{className:`ml-auto`,type:`button`,variant:`stop`,onClick:t}):(0,R.jsx)(M2.Submit,{render:(0,R.jsx)(J5,{className:`ml-auto`,type:`button`,variant:`send`,disabled:!r})})}function _9({children:e}){return(0,R.jsx)(`p`,{className:`text-muted-foreground p-8 text-sm`,children:e})}export{u9 as Component,c9 as loader,l9 as shouldRevalidate};
|
|
3522
|
+
{"questions":[{"type":"choice","question":"Which timeframe?","header":"Timeframe","multiSelect":false,"options":[{"label":"Last 30 days"},{"label":"Last quarter"}]}]}`};function M7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N7(e,t){if(!M7(e))return;let n=e[t];return typeof n==`string`?n:void 0}function P7(e,t){if(!M7(e))return;let n=e[t];return typeof n==`number`?n:void 0}function F7(e,t){if(!M7(e))return;let n=e[t];return typeof n==`boolean`?n:void 0}function I7(e){return e.state!==`output-available`&&e.state!==`output-error`&&e.state!==`output-denied`}function L7(e){if(e.state===`output-error`)return e.errorText;if(e.state===`output-denied`)return`Execution denied.`}function R7({children:e,pending:t=!1,error:n=!1}){return(0,R.jsx)(`p`,{"aria-live":t?`polite`:void 0,className:j(`text-xs leading-relaxed`,t&&`animate-pulse`,n?`text-destructive`:`text-muted-foreground`),children:e})}function z7({title:e,code:t,language:n,detail:r,error:i=!1}){return(0,R.jsxs)(`section`,{className:`space-y-1.5`,children:[(0,R.jsxs)(`header`,{className:`flex items-baseline justify-between gap-3 px-0.5`,children:[(0,R.jsx)(`h4`,{className:j(`text-[10px] font-semibold tracking-[0.08em] uppercase`,i?`text-destructive`:`text-muted-foreground`),children:e}),r&&(0,R.jsx)(`span`,{className:`text-muted-foreground font-mono text-[10px]`,children:r})]}),(0,R.jsx)(`div`,{className:`max-h-64 overflow-auto rounded-md`,children:(0,R.jsx)(w3,{className:j(`border-border/60 rounded-md shadow-none`,i&&`border-destructive/30`),code:t,language:n,wrap:!0,children:(0,R.jsx)(T3,{"aria-label":`Copy ${e.toLowerCase()}`,className:`text-muted-foreground bg-background/90 hover:bg-muted h-6 rounded-md px-2 font-mono text-[10px]`,size:`xs`,variant:`ghost`,children:`Copy`})})})]})}function B7({children:e}){return(0,R.jsx)(`div`,{className:`border-border/60 mb-2 space-y-3 border-l pl-3`,children:e})}function V7({part:e}){let t=N7(e.input,`command`)??``,n=N7(e.output,`stdout`)??``,r=N7(e.output,`stderr`)??``,i=P7(e.output,`exitCode`),a=L7(e),o=I7(e);return(0,R.jsxs)(B7,{children:[a?(0,R.jsx)(R7,{error:!0,children:a}):o?(0,R.jsx)(R7,{pending:!0,children:`Running command...`}):(0,R.jsx)(R7,{error:i!==void 0&&i!==0,children:i===void 0?`Command finished.`:`Command exited with code ${i}.`}),t&&(0,R.jsx)(z7,{code:t,language:`bash`,title:`Command`}),n&&(0,R.jsx)(z7,{code:n,language:`text`,title:`Standard output`}),r&&(0,R.jsx)(z7,{code:r,error:!0,language:`text`,title:`Standard error`}),!o&&!a&&!n&&!r&&(0,R.jsx)(R7,{children:`The command produced no output.`})]})}function H7(e){if(typeof e==`string`)return e;if(M7(e)){if((e.type===`text`||e.type===`error-text`)&&typeof e.value==`string`)return e.value;if(!(e.type!==`content`||!Array.isArray(e.value)))return e.value.filter(e=>M7(e)&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(`
|
|
3523
|
+
`)||void 0}}function U7(e){return!M7(e)||e.type!==`content`||!Array.isArray(e.value)?[]:e.value.flatMap(e=>{if(!M7(e)||e.type!==`file`)return[];let t=typeof e.mediaType==`string`?e.mediaType:`file`;return[`${typeof e.filename==`string`?e.filename:`Attachment`} · ${t}`]})}var W7={css:`css`,csv:`csv`,html:`html`,js:`javascript`,json:`json`,jsx:`jsx`,md:`markdown`,py:`python`,sh:`bash`,sql:`sql`,ts:`typescript`,tsx:`tsx`,txt:`text`,xml:`xml`,yaml:`yaml`,yml:`yaml`};function G7(e){return W7[e.split(`.`).pop()?.toLowerCase()??``]??`text`}function K7(e){let t=P7(e,`offset`),n=P7(e,`limit`);if(t===void 0&&n===void 0)return;let r=t??1;return n===void 0?`${r}+`:`${r}-${r+n-1}`}function q7({part:e}){let t=N7(e.input,`path`)??``,n=H7(e.output),r=U7(e.output),i=M7(e.output)&&e.output.type===`error-text`?H7(e.output):void 0,a=L7(e)??i,o=I7(e),s=K7(e.input);return(0,R.jsx)(B7,{children:a?(0,R.jsx)(R7,{error:!0,children:a}):o?(0,R.jsxs)(R7,{pending:!0,children:[`Reading `,t||`file`,`...`]}):n===void 0?r.length>0?(0,R.jsxs)(`div`,{className:`space-y-1`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-[10px] font-semibold tracking-[0.08em] uppercase`,children:`File content`}),r.map(e=>(0,R.jsx)(`p`,{className:`text-foreground/80 text-xs`,children:e},e))]}):(0,R.jsx)(R7,{children:`File content is unavailable.`}):n?(0,R.jsx)(z7,{code:n,detail:s?`lines ${s}`:void 0,language:G7(t),title:`File contents`}):(0,R.jsx)(R7,{children:`The file is empty.`})})}function J7({part:e}){let t=N7(e.input,`path`)??``,n=N7(e.input,`content`)??``,r=P7(e.output,`exitCode`),i=N7(e.output,`stderr`)??``,a=N7(e.output,`stdout`)??``,o=F7(e.output,`success`),s=L7(e);return(0,R.jsxs)(B7,{children:[I7(e)?(0,R.jsxs)(R7,{pending:!0,children:[`Writing `,t||`file`,`...`]}):s||o===!1||(r??0)!==0?(0,R.jsx)(R7,{error:!0,children:s||i||a||`Failed to write ${t||`file`}.`}):(0,R.jsx)(R7,{children:`File written.`}),n?(0,R.jsx)(z7,{code:n,language:G7(t),title:`Written content`}):(0,R.jsx)(R7,{children:`The file content is empty.`})]})}function Y7(e){let t=N7(e.input,`command`),n=N7(e.input,`reasoning`),r=P7(e.output,`exitCode`);return{name:`Bash`,args:t?{cmd:t.slice(0,80)}:void 0,detail:n,isError:e.state===`output-error`||e.state===`output-denied`||r!==void 0&&r!==0}}function X7(e,t){let n=N7(e.input,`path`),r=t===`ReadFile`?K7(e.input):void 0,i=P7(e.output,`exitCode`);return{name:t,args:n||r?{...n?{path:n}:{},...r?{lines:r}:{}}:void 0,isError:e.state===`output-error`||e.state===`output-denied`||F7(e.output,`success`)===!1||i!==void 0&&i!==0||M7(e.output)&&e.output.type===`error-text`}}var Z7={ask_user_question:j7,bash:{component:V7,label:Y7,static:!0},readFile:{component:q7,label:e=>X7(e,`ReadFile`),static:!0},writeFile:{component:J7,label:e=>X7(e,`WriteFile`),static:!0}},Q7=xt(`status`,[F({id:I(),status:Et(`restored`),sourceMessages:wt(),replacementMessages:wt()}),F({id:I(),status:Et(`started`),tokenScope:Et(`request`).optional(),triggerIndex:wt(),targetTokens:wt(),messageCount:wt()}),F({id:I(),status:Et(`completed`),tokenScope:Et(`request`).optional(),tokens:F({before:wt(),after:wt()})}),F({id:I(),status:Et(`failed`),phase:Xe([`restore`,`evaluate`,`compact`,`persist`]),reason:Xe([`no-safe-boundary`,`protected-history`,`incomplete-summary`,`empty-summary`,`summary-too-large`,`request-overhead`,`error`])})]);function $7({message:e,running:t}){let n=e.parts.flatMap(e=>{if(e.type!==`data-compaction`)return[];let t=Q7.safeParse(e.data);return t.success?[t.data]:[]}),r=Map.groupBy(n,e=>e.id);return Array.from(r,([e,n])=>(0,R.jsx)(e9,{events:n,running:t},e))}function e9({events:e,running:t}){let n=e.find(e=>e.status===`started`),r=e.find(e=>e.status===`completed`),i=e.find(e=>e.status===`failed`),a=e.find(e=>e.status===`restored`),o=n!==void 0&&!r&&!i;return(0,R.jsxs)(dr,{className:`my-3`,children:[(0,R.jsx)(fr,{className:`group w-full text-left`,children:(0,R.jsxs)(Pr,{children:[(0,R.jsx)(Ir,{children:o&&t?(0,R.jsx)(Hr,{"aria-label":`Compacting context`}):i?(0,R.jsx)(D,{className:`text-destructive size-4`}):r?(0,R.jsx)(Fe,{className:`size-4`}):(0,R.jsx)(sn,{className:`size-4`})}),(0,R.jsxs)(Lr,{children:[(0,R.jsx)(Rr,{children:i?`Compaction failed`:r?`Context compacted`:o?t?`Compacting context…`:`Compaction interrupted`:`Using saved summary`}),r&&(0,R.jsxs)(zr,{children:[r.tokens.before.toLocaleString(),` →`,` `,r.tokens.after.toLocaleString(),` estimated`,` `,r.tokenScope===`request`?`input`:`message`,` `,`tokens`]})]}),(0,R.jsx)(Ae,{className:`size-3.5 transition-transform group-data-[panel-open]:rotate-90`})]})}),(0,R.jsxs)(pr,{children:[(0,R.jsx)(Nn,{}),(0,R.jsxs)(`div`,{className:`space-y-3 px-3 py-3 text-sm`,children:[(0,R.jsxs)(`dl`,{className:`grid grid-cols-[1fr_auto] gap-x-4 gap-y-2`,children:[n&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Messages before compaction`}),(0,R.jsx)(`dd`,{children:n.messageCount.toLocaleString()}),(0,R.jsxs)(`dt`,{children:[`Estimated`,` `,n.tokenScope===`request`?`input`:`message`,` `,`target`]}),(0,R.jsxs)(`dd`,{children:[n.targetTokens.toLocaleString(),` tokens`]}),(0,R.jsx)(`dt`,{children:`Matched trigger`}),(0,R.jsxs)(`dd`,{children:[`#`,n.triggerIndex+1]})]}),r&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Checkpoint`}),(0,R.jsx)(`dd`,{children:`Saved`})]}),a&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`dt`,{children:`Using saved summary`}),(0,R.jsxs)(`dd`,{children:[a.sourceMessages,` → `,a.replacementMessages,` `,`messages`]})]})]}),i&&(0,R.jsx)(h,{variant:`destructive`,children:(0,R.jsxs)(Pe,{children:[i.phase,`: `,i.reason]})})]})]})]})}var t9=F({messages:et(it())});async function n9(e){let{params:t,request:n}=e,r=t.sessionId??new URL(n.url).searchParams.get(`chatId`);if(!r)return dt(`/chat?chatId=${encodeURIComponent(crypto.randomUUID())}`);let i=await vt(n.signal),a=i.history.find(e=>e.chatId===r),o=i.discovery?.capabilities.chat.href;if(!o||!t.sessionId&&!a&&!i.historyError)return{...i,chatId:r,conversation:a,initialMessages:void 0,sessionExists:!1,sessionError:!1};try{let e=await fetch(`${o}/${encodeURIComponent(r)}`,{signal:n.signal});if(e.status===404&&!t.sessionId)return{...i,chatId:r,conversation:a,initialMessages:void 0,sessionExists:!1,sessionError:!1};if(!e.ok)throw Error(`Session request failed: ${e.status}`);let s=t9.safeParse(await e.json());if(!s.success)throw Error(`Session response did not include messages`);return{...i,chatId:r,conversation:a,initialMessages:await xp({messages:s.data.messages}),sessionExists:!0,sessionError:!1}}catch{return{...i,chatId:r,conversation:a,initialMessages:void 0,sessionExists:!1,sessionError:!0}}}function r9({currentParams:e,currentUrl:t,nextParams:n,nextUrl:r}){return e.sessionId!==n.sessionId||t.searchParams.get(`chatId`)!==r.searchParams.get(`chatId`)}function i9(){let{chatId:e}=Se();return(0,R.jsx)(a9,{chatId:e},e)}function a9({chatId:e}){let{discovery:t,initialMessages:n,sessionError:r,sessionExists:i}=Se(),a=t?.capabilities.chat.href;return a?r?(0,R.jsx)(d9,{children:`Unable to load this conversation.`}):(0,R.jsx)(o9,{api:a,chatId:e,initialMessages:n,sessionExists:i,supportsUploads:t.capabilities.uploads!==void 0,accept:t.capabilities.uploads?.mediaTypes?.join(`,`)}):(0,R.jsx)(d9,{children:`Development runtime unavailable.`})}function o9({api:e,chatId:t,initialMessages:n,sessionExists:r,supportsUploads:i,accept:a}){let o=Me(),{revalidate:s}=se(),c=Se(),[l]=(0,L.useState)(()=>new $6({api:e,tools:O4(Z7),elements:Y5}));return(0,R.jsx)(v4,{chatId:t,initialMessages:n,onFinish:()=>void s(),onResetChat:e=>{o(`/chat?chatId=${encodeURIComponent(e)}`)},resume:r,registry:Z7,transport:l,children:(0,R.jsxs)(o4,{className:`**:data-[slot='content']:max-w-3xl`,children:[(0,R.jsx)(f4.Root,{className:`px-6`,children:(0,R.jsx)(f4.Hero,{children:`How can I help?`})}),(0,R.jsx)(s9,{}),(0,R.jsx)(nt,{treeId:t,snapshot:c.conversation?.children}),(0,R.jsx)(c9,{supportsUploads:i,accept:a})]})})}function s9(){let{error:e,messages:t,regenerate:n,status:r}=S4();return t.length===0&&!e?null:(0,R.jsxs)(o5.Root,{className:`mb-8 min-h-0 flex-1 px-6`,messages:t,elements:Y5,status:r,children:[(0,R.jsx)(o5.List,{children:t.map((e,n)=>(0,R.jsx)(o5.Item,{message:e,index:n,children:e.role===`user`?(0,R.jsx)(o5.UserBubble,{}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)($7,{message:e,running:n===t.length-1&&(r===`submitted`||r===`streaming`)}),(0,R.jsx)(o5.AssistantContent,{})]})},e.id))}),(0,R.jsx)(o5.Error,{error:e,onRetry:()=>void n()}),(0,R.jsx)(o5.Thinking,{})]})}function c9({supportsUploads:e,accept:t}){let{submit:n}=y4(),{hasSubmitted:r}=x4(),{status:i}=b4(),a=i===`submitted`||i===`streaming`;return(0,R.jsx)(`div`,{className:j(`w-full px-6 pb-6`,r&&`bg-background sticky bottom-0 mt-auto pt-2`),children:(0,R.jsx)(B6,{className:`bg-background`,children:(0,R.jsx)(A5.Provider,{isTaskRunning:a,onSubmit:(t,r)=>{let i=t.items.flatMap(e=>e.type===`image`||e.type===`video`||e.type===`audio`?[e.file]:[]);return!e&&i.length>0?Promise.reject(Error(`This runtime does not support file uploads`)):n({prompt:t.prompt,persistedPrompt:t.persistedPrompt,editableSource:r.editableSource,files:i})},children:(0,R.jsxs)(A5.Root,{children:[(0,R.jsx)(l9,{}),(0,R.jsx)(A5.Popup,{}),(0,R.jsxs)(A5.Content,{children:[(0,R.jsx)(A5.Attachments,{}),(0,R.jsx)(A5.Editor,{placeholder:`Message Zukhruf…`}),(0,R.jsx)(A5.Error,{})]}),(0,R.jsxs)(A5.Toolbar,{children:[e&&(0,R.jsx)(A5.AttachFiles,{accept:t}),(0,R.jsx)(u9,{})]})]})})})})}function l9(){let e=C4(),t=(0,L.useSyncExternalStore)(e.subscribe,()=>e.queue);return t.length===0?null:(0,R.jsx)(I5.Root,{children:t.map(t=>(0,R.jsxs)(I5.Item,{children:[(0,R.jsx)(I5.Icon,{}),(0,R.jsx)(I5.Text,{children:t.persistedPrompt}),(0,R.jsx)(I5.Remove,{onClick:()=>e.removeFromQueue(t.id)})]},t.id))})}function u9(){let{state:e}=MX(`ChatSubmitButton`),{stop:t}=y4(),{status:n}=b4(),r=e.text.trim().length>0;return(n===`submitted`||n===`streaming`)&&!r?(0,R.jsx)(H5,{className:`ml-auto`,type:`button`,variant:`stop`,onClick:t}):(0,R.jsx)(U1.Submit,{render:(0,R.jsx)(H5,{className:`ml-auto`,type:`button`,variant:`send`,disabled:!r})})}function d9({children:e}){return(0,R.jsx)(`p`,{className:`text-muted-foreground p-8 text-sm`,children:e})}export{i9 as Component,n9 as loader,r9 as shouldRevalidate};
|