@chocolatey-software/docs 2.5.0 → 2.5.2

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.
@@ -23049,7 +23049,7 @@
23049
23049
  return t2;
23050
23050
  })([{ url: "".concat(e11, "-1.algolianet.com"), accept: "readWrite", protocol: "https" }, { url: "".concat(e11, "-2.algolianet.com"), accept: "readWrite", protocol: "https" }, { url: "".concat(e11, "-3.algolianet.com"), accept: "readWrite", protocol: "https" }]));
23051
23051
  }
23052
- var vD = "4.5.4";
23052
+ var vD = "4.6.0";
23053
23053
  function mD(e11, t2, n2) {
23054
23054
  var r2 = It.useMemo(function() {
23055
23055
  var r3 = (function(e12, t3) {
@@ -24011,6 +24011,6 @@ jquery/dist/jquery.js:
24011
24011
  *)
24012
24012
 
24013
24013
  @docsearch/js/dist/esm/index.js:
24014
- (*! @docsearch/js 4.5.4 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com *)
24014
+ (*! @docsearch/js 4.6.0 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com *)
24015
24015
  (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
24016
24016
  */
@@ -115,7 +115,7 @@ Error message: `).concat(fd(u)),cause:u}]))[Dd]=!0,n.value=r,n}return iu(e,Zr),$
115
115
  ]))`;continue}if(i[m]==="$"){o+=`($|(?=[\r
116
116
  ]))`;continue}}a&&i[m]==="."?o+=l?"".concat(i[m],`\r
117
117
  `):"[".concat(i[m],`\r
118
- ]`):(o+=i[m],i[m]==="\\"?c=!0:l&&i[m]==="]"?l=!1:l||i[m]!=="["||(l=!0))}try{new RegExp(o)}catch(v){return console.warn("Could not convert regex pattern at ".concat(t.currentPath.join("/")," to a flag-independent form! Falling back to the flag-ignorant source")),e.source}return o}function Wp(e,t){var n,r,u,a,i,o,c={type:"object",additionalProperties:(n=_t(e.valueType._def,pe(pe({},t),{},{currentPath:[].concat(Qe(t.currentPath),["additionalProperties"])})))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===ve.ZodString&&((u=e.keyType._def.checks)!=null&&u.length)){var l=Hp(e.keyType._def,t);l.type;var p=Nr(l,mv);return pe(pe({},c),{},{propertyNames:p})}if(((a=e.keyType)==null?void 0:a._def.typeName)===ve.ZodEnum)return pe(pe({},c),{},{propertyNames:{enum:e.keyType._def.values}});if(((i=e.keyType)==null?void 0:i._def.typeName)===ve.ZodBranded&&e.keyType._def.type._def.typeName===ve.ZodString&&((o=e.keyType._def.type._def.checks)!=null&&o.length)){var m=Zp(e.keyType._def,t);m.type;var v=Nr(m,gv);return pe(pe({},c),{},{propertyNames:v})}return c}var vc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function pb(e){try{return e.isOptional()}catch(t){return!0}}var hb=function(e,t,n){switch(t){case ve.ZodString:return Hp(e,n);case ve.ZodNumber:return(function(r){var u={type:"number"};if(!r.checks)return u;var a,i=Su(r.checks);try{for(i.s();!(a=i.n()).done;){var o=a.value;switch(o.kind){case"int":u.type="integer";break;case"min":o.inclusive?u.minimum=o.value:u.exclusiveMinimum=o.value;break;case"max":o.inclusive?u.maximum=o.value:u.exclusiveMaximum=o.value;break;case"multipleOf":u.multipleOf=o.value}}}catch(c){i.e(c)}finally{i.f()}return u})(e);case ve.ZodObject:return(function(r,u){var a={type:"object",properties:{}},i=[],o=r.shape();for(var c in o){var l=o[c];if(l!==void 0&&l._def!==void 0){var p=pb(l),m=_t(l._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["properties",c]),propertyPath:[].concat(Qe(u.currentPath),["properties",c])}));m!==void 0&&(a.properties[c]=m,p||i.push(c))}}i.length&&(a.required=i);var v=(function(y,F){if(y.catchall._def.typeName!=="ZodNever")return _t(y.catchall._def,pe(pe({},F),{},{currentPath:[].concat(Qe(F.currentPath),["additionalProperties"])}));switch(y.unknownKeys){case"passthrough":return F.allowedAdditionalProperties;case"strict":return F.rejectedAdditionalProperties;case"strip":return F.removeAdditionalStrategy==="strict"?F.allowedAdditionalProperties:F.rejectedAdditionalProperties}})(r,u);return v!==void 0&&(a.additionalProperties=v),a})(e,n);case ve.ZodBigInt:return(function(r){var u={type:"integer",format:"int64"};if(!r.checks)return u;var a,i=Su(r.checks);try{for(i.s();!(a=i.n()).done;){var o=a.value;switch(o.kind){case"min":o.inclusive?u.minimum=o.value:u.exclusiveMinimum=o.value;break;case"max":o.inclusive?u.maximum=o.value:u.exclusiveMaximum=o.value;break;case"multipleOf":u.multipleOf=o.value}}}catch(c){i.e(c)}finally{i.f()}return u})(e);case ve.ZodBoolean:return{type:"boolean"};case ve.ZodDate:return qp(e,n);case ve.ZodUndefined:return{not:{}};case ve.ZodNull:return{type:"null"};case ve.ZodArray:return(function(r,u){var a,i,o,c={type:"array"};return(a=r.type)!=null&&a._def&&((o=(i=r.type)==null?void 0:i._def)==null?void 0:o.typeName)!==ve.ZodAny&&(c.items=_t(r.type._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items"])}))),r.minLength&&(c.minItems=r.minLength.value),r.maxLength&&(c.maxItems=r.maxLength.value),r.exactLength&&(c.minItems=r.exactLength.value,c.maxItems=r.exactLength.value),c})(e,n);case ve.ZodUnion:case ve.ZodDiscriminatedUnion:return(function(r,u){var a=r.options instanceof Map?Array.from(r.options.values()):r.options;if(a.every(function(l){return l._def.typeName in vc&&(!l._def.checks||!l._def.checks.length)})){var i=a.reduce(function(l,p){var m=vc[p._def.typeName];return m&&!l.includes(m)?[].concat(Qe(l),[m]):l},[]);return{type:i.length>1?i:i[0]}}if(a.every(function(l){return l._def.typeName==="ZodLiteral"&&!l.description})){var o=a.reduce(function(l,p){var m=we(p._def.value);switch(m){case"string":case"number":case"boolean":return[].concat(Qe(l),[m]);case"bigint":return[].concat(Qe(l),["integer"]);case"object":if(p._def.value===null)return[].concat(Qe(l),["null"]);default:return l}},[]);if(o.length===a.length){var c=o.filter(function(l,p,m){return m.indexOf(l)===p});return{type:c.length>1?c:c[0],enum:a.reduce(function(l,p){return l.includes(p._def.value)?l:[].concat(Qe(l),[p._def.value])},[])}}}else if(a.every(function(l){return l._def.typeName==="ZodEnum"}))return{type:"string",enum:a.reduce(function(l,p){return[].concat(Qe(l),Qe(p._def.values.filter(function(m){return!l.includes(m)})))},[])};return(function(l,p){var m=(l.options instanceof Map?Array.from(l.options.values()):l.options).map(function(v,y){return _t(v._def,pe(pe({},p),{},{currentPath:[].concat(Qe(p.currentPath),["anyOf","".concat(y)])}))}).filter(function(v){return!!v&&(!p.strictUnions||we(v)=="object"&&Object.keys(v).length>0)});return m.length?{anyOf:m}:void 0})(r,u)})(e,n);case ve.ZodIntersection:return(function(r,u){var a=[_t(r.left._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf","0"])})),_t(r.right._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf","1"])}))].filter(function(o){return!!o}),i=[];return a.forEach(function(o){if("type"in(l=o)&&l.type==="string"||!("allOf"in l)){var c=o;"additionalProperties"in o&&o.additionalProperties===!1&&(o.additionalProperties,c=Nr(o,yv)),i.push(c)}else i.push.apply(i,Qe(o.allOf));var l}),i.length?{allOf:i}:void 0})(e,n);case ve.ZodTuple:return(function(r,u){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map(function(a,i){return _t(a._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","".concat(i)])}))}).reduce(function(a,i){return i===void 0?a:[].concat(Qe(a),[i])},[]),additionalItems:_t(r.rest._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["additionalItems"])}))}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map(function(a,i){return _t(a._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","".concat(i)])}))}).reduce(function(a,i){return i===void 0?a:[].concat(Qe(a),[i])},[])}})(e,n);case ve.ZodRecord:return Wp(e,n);case ve.ZodLiteral:return(function(r){var u=we(r.value);return u!=="bigint"&&u!=="number"&&u!=="boolean"&&u!=="string"?{type:Array.isArray(r.value)?"array":"object"}:{type:u==="bigint"?"integer":u,const:r.value}})(e);case ve.ZodEnum:return(function(r){return{type:"string",enum:Array.from(r.values)}})(e);case ve.ZodNativeEnum:return(function(r){var u=r.values,a=Object.keys(r.values).filter(function(o){return typeof u[u[o]]!="number"}).map(function(o){return u[o]}),i=Array.from(new Set(a.map(function(o){return we(o)})));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:a}})(e);case ve.ZodNullable:return(function(r,u){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return{type:[vc[r.innerType._def.typeName],"null"]};var a=_t(r.innerType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["anyOf","0"])}));return a&&{anyOf:[a,{type:"null"}]}})(e,n);case ve.ZodOptional:return(function(r,u){var a;if(u.currentPath.toString()===((a=u.propertyPath)==null?void 0:a.toString()))return _t(r.innerType._def,u);var i=_t(r.innerType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["anyOf","1"])}));return i?{anyOf:[{not:{}},i]}:{}})(e,n);case ve.ZodMap:return(function(r,u){return u.mapStrategy==="record"?Wp(r,u):{type:"array",maxItems:125,items:{type:"array",items:[_t(r.keyType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","items","0"])}))||{},_t(r.valueType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","items","1"])}))||{}],minItems:2,maxItems:2}}})(e,n);case ve.ZodSet:return(function(r,u){var a={type:"array",uniqueItems:!0,items:_t(r.valueType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items"])}))};return r.minSize&&(a.minItems=r.minSize.value),r.maxSize&&(a.maxItems=r.maxSize.value),a})(e,n);case ve.ZodLazy:return function(){return e.getter()._def};case ve.ZodPromise:return(function(r,u){return _t(r.type._def,u)})(e,n);case ve.ZodNaN:case ve.ZodNever:return{not:{}};case ve.ZodEffects:return(function(r,u){return u.effectStrategy==="input"?_t(r.schema._def,u):{}})(e,n);case ve.ZodAny:case ve.ZodUnknown:return{};case ve.ZodDefault:return(function(r,u){return pe(pe({},_t(r.innerType._def,u)),{},{default:r.defaultValue()})})(e,n);case ve.ZodBranded:return Zp(e,n);case ve.ZodReadonly:case ve.ZodCatch:return(function(r,u){return _t(r.innerType._def,u)})(e,n);case ve.ZodPipeline:return(function(r,u){if(u.pipeStrategy==="input")return _t(r.in._def,u);if(u.pipeStrategy==="output")return _t(r.out._def,u);var a=_t(r.in._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf","0"])}));return{allOf:[a,_t(r.out._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf",a?"1":"0"])}))].filter(function(i){return i!==void 0})}})(e,n);case ve.ZodFunction:case ve.ZodVoid:case ve.ZodSymbol:default:return}};function _t(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0&&arguments[2],u=t.seen.get(e);if(t.override){var a=(n=t.override)==null?void 0:n.call(t,e,t,u,r);if(a!==XD)return a}if(u&&!r){var i=vb(u,t);if(i!==void 0)return i}var o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);var c=hb(e,e.typeName,t),l=typeof c=="function"?_t(c(),t):c;if(l&&mb(e,t,l),t.postProcess){var p=t.postProcess(l,e,t);return o.jsonSchema=l,p}return o.jsonSchema=l,l}var vb=function(e,t){switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:YD(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(function(n,r){return t.currentPath[r]===n})?(console.warn("Recursive reference detected at ".concat(t.currentPath.join("/"),"! Defaulting to any")),{}):t.$refStrategy==="seen"?{}:void 0}},mb=function(e,t,n){return e.description&&(n.description=e.description),n},gb=function(e,t){var n,r=(function(l){var p=(function(v){return typeof v=="string"?pe(pe({},$p),{},{name:v}):pe(pe({},$p),v)})(l),m=p.name!==void 0?[].concat(Qe(p.basePath),[p.definitionPath,p.name]):p.basePath;return pe(pe({},p),{},{currentPath:m,propertyPath:void 0,seen:new Map(Object.entries(p.definitions).map(function(v){var y=Ro(v,2),F=y[0],D=y[1];return[D._def,{def:D._def,path:[].concat(Qe(p.basePath),[p.definitionPath,F]),jsonSchema:void 0}]}))})})(t),u=we(t)=="object"&&t.definitions?Object.entries(t.definitions).reduce(function(l,p){var m,v=Ro(p,2),y=v[0],F=v[1];return pe(pe({},l),{},Zn({},y,(m=_t(F._def,pe(pe({},r),{},{currentPath:[].concat(Qe(r.basePath),[r.definitionPath,y])}),!0))!=null?m:{}))},{}):void 0,a=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,i=(n=_t(e._def,a===void 0?r:pe(pe({},r),{},{currentPath:[].concat(Qe(r.basePath),[r.definitionPath,a])}),!1))!=null?n:{},o=we(t)=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(i.title=o);var c=a===void 0?u?pe(pe({},i),{},Zn({},r.definitionPath,u)):i:Zn({$ref:[].concat(Qe(r.$refStrategy==="relative"?[]:r.basePath),[r.definitionPath,a]).join("/")},r.definitionPath,pe(pe({},u),{},Zn({},a,i)));return c.$schema="http://json-schema.org/draft-07/schema#",c};function Vp(e,t){return(function(n){return"_zod"in n})(e)?(function(n){return gc(function(){return(function(u,a){if(u instanceof ep){var i,o=new dp(a),c={},l=ye(u._idmap.entries());try{for(l.s();!(i=l.n()).done;){var p=dt(i.value,2),m=(p[0],p[1]);o.process(m)}}catch(T){l.e(T)}finally{l.f()}var v,y={},F={registry:u,uri:a==null?void 0:a.uri,defs:c},D=ye(u._idmap.entries());try{for(D.s();!(v=D.n()).done;){var _=dt(v.value,2),O=_[0],w=_[1];y[O]=o.emit(w,C(C({},a),{},{external:F}))}}catch(T){D.e(T)}finally{D.f()}if(Object.keys(c).length>0){var x=o.target==="draft-2020-12"?"$defs":"definitions";y.__shared=lt({},x,c)}return{schemas:y}}var S=new dp(a);return S.process(u),S.emit(u,a)})(n,{target:"draft-7",io:"output",reused:"inline"})},{validate:(r=vt(Oe().m(function u(a){var i;return Oe().w(function(o){for(;;)switch(o.n){case 0:return o.n=1,pp(n,a);case 1:return i=o.v,o.a(2,i.success?{success:!0,value:i.data}:{success:!1,error:i.error})}},u)})),function(u){return r.apply(this,arguments)})});var r})(e):(function(n){return gc(function(){return gb(n,{$refStrategy:"none"})},{validate:(r=vt(Oe().m(function u(a){var i;return Oe().w(function(o){for(;;)switch(o.n){case 0:return o.n=1,n.safeParseAsync(a);case 1:return i=o.v,o.a(2,i.success?{success:!0,value:i.data}:{success:!1,error:i.error})}},u)})),function(u){return r.apply(this,arguments)})});var r})(e)}var mc=Symbol.for("vercel.ai.schema");function gc(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).validate;return Zn((function(n,r,u,a){var i={configurable:!0,enumerable:!0};return i[n]=a,Object.defineProperty(r,u,i)})("get",Zn(Zn(Zn({},mc,!0),"_type",void 0),go,!0),"jsonSchema",function(){return typeof e=="function"&&(e=e()),e}),"validate",t)}var Kp,yb=Object.defineProperty,Gp="AI_NoObjectGeneratedError",Jp="vercel.ai.error.".concat(Gp),Db=Symbol.for(Jp),Qp=(function(){function e(t){var n,r=t.message,u=r===void 0?"No object generated.":r,a=t.cause,i=t.text,o=t.response,c=t.usage,l=t.finishReason;return Mn(this,e),(n=au(this,e,[{name:Gp,message:u,cause:a}]))[Kp]=!0,n.text=i,n.response=o,n.usage=c,n.finishReason=l,n}return iu(e,Zr),$n(e,null,[{key:"isInstance",value:function(t){return Zr.hasMarker(t,Jp)}}])})();Kp=Db;var Yp="5.0.93",Xp=Pn([ze(),to(Uint8Array),to(ArrayBuffer),Sp(function(e){var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null&&n},{message:"Must be a Buffer"})]),Xa=new ED({type:"lazy",getter:function(){return Pn([oD(),ze(),rD(),An(),Us(ze(),Xa),Wu(Xa)])}}),Kt=Us(ze(),Us(ze(),Xa)),eh=sn({type:Ye("text"),text:ze(),providerOptions:Kt.optional()}),bb=sn({type:Ye("image"),image:Pn([Xp,to(URL)]),mediaType:ze().optional(),providerOptions:Kt.optional()}),th=sn({type:Ye("file"),data:Pn([Xp,to(URL)]),filename:ze().optional(),mediaType:ze(),providerOptions:Kt.optional()}),Ab=sn({type:Ye("reasoning"),text:ze(),providerOptions:Kt.optional()}),Eb=sn({type:Ye("tool-call"),toolCallId:ze(),toolName:ze(),input:rr(),providerOptions:Kt.optional(),providerExecuted:An().optional()}),Fb=new fD(C({type:"union",options:[sn({type:Ye("text"),value:ze()}),sn({type:Ye("json"),value:Xa}),sn({type:Ye("error-text"),value:ze()}),sn({type:Ye("error-json"),value:Xa}),sn({type:Ye("content"),value:Wu(Pn([sn({type:Ye("text"),text:ze()}),sn({type:Ye("media"),data:ze(),mediaType:ze()})]))})],discriminator:"type"},xe(void 0))),nh=sn({type:Ye("tool-result"),toolCallId:ze(),toolName:ze(),output:Fb,providerOptions:Kt.optional()}),_b=sn({role:Ye("system"),content:ze(),providerOptions:Kt.optional()}),Cb=sn({role:Ye("user"),content:Pn([ze(),Wu(Pn([eh,bb,th]))]),providerOptions:Kt.optional()}),kb=sn({role:Ye("assistant"),content:Pn([ze(),Wu(Pn([eh,th,Ab,Eb,nh]))]),providerOptions:Kt.optional()});Pn([_b,Cb,kb,sn({role:Ye("tool"),content:Wu(nh),providerOptions:Kt.optional()})]),Ya({prefix:"aitxt",size:24}),TransformStream;var wb=(function(){var e;return function(){return e==null&&(e=Vp(Pn([Lt({type:Ye("text-start"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("text-delta"),id:ze(),delta:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("text-end"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("error"),errorText:ze()}),Lt({type:Ye("tool-input-start"),toolCallId:ze(),toolName:ze(),providerExecuted:An().optional(),dynamic:An().optional()}),Lt({type:Ye("tool-input-delta"),toolCallId:ze(),inputTextDelta:ze()}),Lt({type:Ye("tool-input-available"),toolCallId:ze(),toolName:ze(),input:rr(),providerExecuted:An().optional(),providerMetadata:Kt.optional(),dynamic:An().optional()}),Lt({type:Ye("tool-input-error"),toolCallId:ze(),toolName:ze(),input:rr(),providerExecuted:An().optional(),providerMetadata:Kt.optional(),dynamic:An().optional(),errorText:ze()}),Lt({type:Ye("tool-output-available"),toolCallId:ze(),output:rr(),providerExecuted:An().optional(),dynamic:An().optional(),preliminary:An().optional()}),Lt({type:Ye("tool-output-error"),toolCallId:ze(),errorText:ze(),providerExecuted:An().optional(),dynamic:An().optional()}),Lt({type:Ye("reasoning-start"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("reasoning-delta"),id:ze(),delta:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("reasoning-end"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("source-url"),sourceId:ze(),url:ze(),title:ze().optional(),providerMetadata:Kt.optional()}),Lt({type:Ye("source-document"),sourceId:ze(),mediaType:ze(),title:ze(),filename:ze().optional(),providerMetadata:Kt.optional()}),Lt({type:Ye("file"),url:ze(),mediaType:ze(),providerMetadata:Kt.optional()}),Lt({type:Sp(function(t){return typeof t=="string"&&t.startsWith("data-")},{message:'Type must start with "data-"'}),id:ze().optional(),data:rr(),transient:An().optional()}),Lt({type:Ye("start-step")}),Lt({type:Ye("finish-step")}),Lt({type:Ye("start"),messageId:ze().optional(),messageMetadata:rr().optional()}),Lt({type:Ye("finish"),finishReason:Ap(["stop","length","content-filter","tool-calls","error","other","unknown"]).optional(),messageMetadata:rr().optional()}),Lt({type:Ye("abort")}),Lt({type:Ye("message-metadata"),messageMetadata:rr()})]))),e}})();function rh(e,t){if(e!==void 0||t!==void 0){if(e===void 0)return t;if(t===void 0)return e;var n=pe({},e);for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var u=t[r];if(u===void 0)continue;var a=r in e?e[r]:void 0,i=!(u===null||we(u)!="object"||Array.isArray(u)||u instanceof Date||u instanceof RegExp),o=!(a==null||we(a)!="object"||Array.isArray(a)||a instanceof Date||a instanceof RegExp);n[r]=i&&o?rh(a,u):u}return n}}function Sb(e){var t=["ROOT"],n=-1,r=null;function u(y,F,D){switch(y){case'"':n=F,t.pop(),t.push(D),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=F,r=F,t.pop(),t.push(D),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(D),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=F,t.pop(),t.push(D),t.push("INSIDE_NUMBER");break;case"{":n=F,t.pop(),t.push(D),t.push("INSIDE_OBJECT_START");break;case"[":n=F,t.pop(),t.push(D),t.push("INSIDE_ARRAY_START")}}function a(y,F){switch(y){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=F,t.pop()}}function i(y,F){switch(y){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=F,t.pop()}}for(var o=0;o<e.length;o++){var c=e[o];switch(t[t.length-1]){case"ROOT":u(c,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=o,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":u(c,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":a(c,o);break;case"INSIDE_STRING":switch(c){case'"':t.pop(),n=o;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":c==="]"?(n=o,t.pop()):(n=o,u(c,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=o,t.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":u(c,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),n=o;break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,o),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,o);break;case"}":t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,o);break;case"]":t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,o);break;default:t.pop()}break;case"INSIDE_LITERAL":var l=e.substring(r,o+1);"false".startsWith(l)||"true".startsWith(l)||"null".startsWith(l)?n=o:(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(c,o):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,o))}}for(var p=e.slice(0,n+1),m=t.length-1;m>=0;m--)switch(t[m]){case"INSIDE_STRING":p+='"';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":p+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":p+="]";break;case"INSIDE_LITERAL":var v=e.substring(r,e.length);"true".startsWith(v)?p+="true".slice(v.length):"false".startsWith(v)?p+="false".slice(v.length):"null".startsWith(v)&&(p+="null".slice(v.length))}return p}function uh(e){return yc.apply(this,arguments)}function yc(){return yc=vt(Oe().m(function e(t){var n,r;return Oe().w(function(u){for(;;)switch(u.n){case 0:if(t!==void 0){u.n=1;break}return u.a(2,{value:void 0,state:"undefined-input"});case 1:return u.n=2,yo({text:t});case 2:if(!(n=u.v).success){u.n=3;break}r={value:n.value,state:"successful-parse"},u.n=5;break;case 3:return u.n=4,yo({text:Sb(t)});case 4:n=u.v,r=n.success?{value:n.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"};case 5:return u.a(2,r)}},e)})),yc.apply(this,arguments)}function Do(e){return e.type.startsWith("tool-")}function Dc(e){return Do(e)||(function(t){return t.type==="dynamic-tool"})(e)}function ah(e){return e.type.split("-").slice(1).join("-")}function xb(e){var t=e.lastMessage,n=e.messageId;return{message:(t==null?void 0:t.role)==="assistant"?t:{id:n,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Tb(e){var t=e.stream,n=e.messageMetadataSchema,r=e.dataPartSchemas,u=e.runUpdateMessageJob,a=e.onError,i=e.onToolCall,o=e.onData;return t.pipeThrough(new TransformStream({transform:function(c,l){return vt(Oe().m(function p(){return Oe().w(function(m){for(;;)switch(m.n){case 0:return m.n=1,u((function(){var v=vt(Oe().m(function y(F){var D,_,O,w,x,S,T,I,B,d,H,R,Z,q,G,L,ne,Q,$,Y,re,me,se,K,V,ue,oe,ce,ee;return Oe().w(function(he){for(;;)switch(he.n){case 0:R=function(){return R=vt(Oe().m(function Ce(Re){var ge;return Oe().w(function(Te){for(;;)switch(Te.n){case 0:if(Re==null){Te.n=2;break}if(ge=D.message.metadata!=null?rh(D.message.metadata,Re):Re,n==null){Te.n=1;break}return Te.n=1,Mp({value:ge,schema:n});case 1:D.message.metadata=ge;case 2:return Te.a(2)}},Ce)})),R.apply(this,arguments)},H=function(Ce){return R.apply(this,arguments)},d=function(Ce){var Re,ge,Te=D.message.parts.find(function(Ge){return Ge.type==="dynamic-tool"&&Ge.toolCallId===Ce.toolCallId}),He=Ce,nt=Te;Te!=null?(Te.state=Ce.state,nt.toolName=Ce.toolName,nt.input=He.input,nt.output=He.output,nt.errorText=He.errorText,nt.rawInput=(Re=He.rawInput)!=null?Re:nt.rawInput,nt.preliminary=He.preliminary,nt.providerExecuted=(ge=He.providerExecuted)!=null?ge:Te.providerExecuted,He.providerMetadata!=null&&Te.state==="input-available"&&(Te.callProviderMetadata=He.providerMetadata)):D.message.parts.push(pe({type:"dynamic-tool",toolName:Ce.toolName,toolCallId:Ce.toolCallId,state:Ce.state,input:He.input,output:He.output,errorText:He.errorText,preliminary:He.preliminary,providerExecuted:He.providerExecuted},He.providerMetadata!=null?{callProviderMetadata:He.providerMetadata}:{}))},B=function(Ce){var Re,ge=D.message.parts.find(function(nt){return Do(nt)&&nt.toolCallId===Ce.toolCallId}),Te=Ce,He=ge;ge!=null?(ge.state=Ce.state,He.input=Te.input,He.output=Te.output,He.errorText=Te.errorText,He.rawInput=Te.rawInput,He.preliminary=Te.preliminary,He.providerExecuted=(Re=Te.providerExecuted)!=null?Re:ge.providerExecuted,Te.providerMetadata!=null&&ge.state==="input-available"&&(ge.callProviderMetadata=Te.providerMetadata)):D.message.parts.push(pe({type:"tool-".concat(Ce.toolName),toolCallId:Ce.toolCallId,state:Ce.state,input:Te.input,output:Te.output,rawInput:Te.rawInput,errorText:Te.errorText,providerExecuted:Te.providerExecuted,preliminary:Te.preliminary},Te.providerMetadata!=null?{callProviderMetadata:Te.providerMetadata}:{}))},I=function(Ce){var Re=D.message.parts.filter(function(ge){return ge.type==="dynamic-tool"}).find(function(ge){return ge.toolCallId===Ce});if(Re==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return Re},T=function(Ce){var Re=D.message.parts.filter(Do).find(function(ge){return ge.toolCallId===Ce});if(Re==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return Re},D=F.state,_=F.write,ee=c.type,he.n=ee==="text-start"?1:ee==="text-delta"?2:ee==="text-end"?3:ee==="reasoning-start"?4:ee==="reasoning-delta"?5:ee==="reasoning-end"?6:ee==="file"?7:ee==="source-url"?8:ee==="source-document"?9:ee==="tool-input-start"?10:ee==="tool-input-delta"?11:ee==="tool-input-available"?13:ee==="tool-input-error"?15:ee==="tool-output-available"?16:ee==="tool-output-error"?17:ee==="start-step"?18:ee==="finish-step"?19:ee==="start"?20:ee==="finish"?22:ee==="message-metadata"?24:ee==="error"?26:27;break;case 1:return Z={type:"text",text:"",providerMetadata:c.providerMetadata,state:"streaming"},D.activeTextParts[c.id]=Z,D.message.parts.push(Z),_(),he.a(3,30);case 2:return(q=D.activeTextParts[c.id]).text+=c.delta,q.providerMetadata=(O=c.providerMetadata)!=null?O:q.providerMetadata,_(),he.a(3,30);case 3:return(G=D.activeTextParts[c.id]).state="done",G.providerMetadata=(w=c.providerMetadata)!=null?w:G.providerMetadata,delete D.activeTextParts[c.id],_(),he.a(3,30);case 4:return L={type:"reasoning",text:"",providerMetadata:c.providerMetadata,state:"streaming"},D.activeReasoningParts[c.id]=L,D.message.parts.push(L),_(),he.a(3,30);case 5:return(ne=D.activeReasoningParts[c.id]).text+=c.delta,ne.providerMetadata=(x=c.providerMetadata)!=null?x:ne.providerMetadata,_(),he.a(3,30);case 6:return(Q=D.activeReasoningParts[c.id]).providerMetadata=(S=c.providerMetadata)!=null?S:Q.providerMetadata,Q.state="done",delete D.activeReasoningParts[c.id],_(),he.a(3,30);case 7:return D.message.parts.push({type:"file",mediaType:c.mediaType,url:c.url}),_(),he.a(3,30);case 8:return D.message.parts.push({type:"source-url",sourceId:c.sourceId,url:c.url,title:c.title,providerMetadata:c.providerMetadata}),_(),he.a(3,30);case 9:return D.message.parts.push({type:"source-document",sourceId:c.sourceId,mediaType:c.mediaType,title:c.title,filename:c.filename,providerMetadata:c.providerMetadata}),_(),he.a(3,30);case 10:return $=D.message.parts.filter(Do),D.partialToolCalls[c.toolCallId]={text:"",toolName:c.toolName,index:$.length,dynamic:c.dynamic},c.dynamic?d({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-streaming",input:void 0,providerExecuted:c.providerExecuted}):B({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-streaming",input:void 0,providerExecuted:c.providerExecuted}),_(),he.a(3,30);case 11:return(Y=D.partialToolCalls[c.toolCallId]).text+=c.inputTextDelta,he.n=12,uh(Y.text);case 12:return re=he.v,me=re.value,Y.dynamic?d({toolCallId:c.toolCallId,toolName:Y.toolName,state:"input-streaming",input:me}):B({toolCallId:c.toolCallId,toolName:Y.toolName,state:"input-streaming",input:me}),_(),he.a(3,30);case 13:if(c.dynamic?d({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-available",input:c.input,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}):B({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-available",input:c.input,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}),_(),!(i&&!c.providerExecuted)){he.n=14;break}return he.n=14,i({toolCall:c});case 14:return he.a(3,30);case 15:return c.dynamic?d({toolCallId:c.toolCallId,toolName:c.toolName,state:"output-error",input:c.input,errorText:c.errorText,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}):B({toolCallId:c.toolCallId,toolName:c.toolName,state:"output-error",input:void 0,rawInput:c.input,errorText:c.errorText,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}),_(),he.a(3,30);case 16:return c.dynamic?(se=I(c.toolCallId),d({toolCallId:c.toolCallId,toolName:se.toolName,state:"output-available",input:se.input,output:c.output,preliminary:c.preliminary})):(K=T(c.toolCallId),B({toolCallId:c.toolCallId,toolName:ah(K),state:"output-available",input:K.input,output:c.output,providerExecuted:c.providerExecuted,preliminary:c.preliminary})),_(),he.a(3,30);case 17:return c.dynamic?(V=I(c.toolCallId),d({toolCallId:c.toolCallId,toolName:V.toolName,state:"output-error",input:V.input,errorText:c.errorText,providerExecuted:c.providerExecuted})):(ue=T(c.toolCallId),B({toolCallId:c.toolCallId,toolName:ah(ue),state:"output-error",input:ue.input,rawInput:ue.rawInput,errorText:c.errorText,providerExecuted:c.providerExecuted})),_(),he.a(3,30);case 18:return D.message.parts.push({type:"step-start"}),he.a(3,30);case 19:return D.activeTextParts={},D.activeReasoningParts={},he.a(3,30);case 20:return c.messageId!=null&&(D.message.id=c.messageId),he.n=21,H(c.messageMetadata);case 21:return c.messageId==null&&c.messageMetadata==null||_(),he.a(3,30);case 22:return c.finishReason!=null&&(D.finishReason=c.finishReason),he.n=23,H(c.messageMetadata);case 23:return c.messageMetadata!=null&&_(),he.a(3,30);case 24:return he.n=25,H(c.messageMetadata);case 25:return c.messageMetadata!=null&&_(),he.a(3,30);case 26:return a==null||a(new Error(c.errorText)),he.a(3,30);case 27:if(!(function(Ce){return Ce.type.startsWith("data-")})(c)){he.n=30;break}if((r==null?void 0:r[c.type])==null){he.n=28;break}return he.n=28,Mp({value:c.data,schema:r[c.type]});case 28:if(!(oe=c).transient){he.n=29;break}return o==null||o(oe),he.a(3,30);case 29:ce=oe.id!=null?D.message.parts.find(function(Ce){return oe.type===Ce.type&&oe.id===Ce.id}):void 0,ce!=null?ce.data=oe.data:D.message.parts.push(oe),o==null||o(oe),_();case 30:l.enqueue(c);case 31:return he.a(2)}},y)}));return function(y){return v.apply(this,arguments)}})());case 1:return m.a(2)}},p)}))()}}))}Ya({prefix:"aitxt",size:24}),Ya({prefix:"aiobj",size:24});var Ob=(function(){return $n(function n(){Mn(this,n),this.queue=[],this.isProcessing=!1},[{key:"processQueue",value:(t=vt(Oe().m(function n(){return Oe().w(function(r){for(;;)switch(r.n){case 0:if(this.isProcessing){r.n=5;break}this.isProcessing=!0;case 1:if(!(this.queue.length>0)){r.n=4;break}return r.n=2,this.queue[0]();case 2:this.queue.shift();case 3:r.n=1;break;case 4:this.isProcessing=!1;case 5:return r.a(2)}},n,this)})),function(){return t.apply(this,arguments)})},{key:"run",value:(e=vt(Oe().m(function n(r){var u=this;return Oe().w(function(a){for(;;)if(a.n===0)return a.a(2,new Promise(function(i,o){u.queue.push(vt(Oe().m(function c(){var l;return Oe().w(function(p){for(;;)switch(p.p=p.n){case 0:return p.p=0,p.n=1,r();case 1:i(),p.n=3;break;case 2:p.p=2,l=p.v,o(l);case 3:return p.a(2)}},c,null,[[0,2]])}))),u.processQueue()}))},n)})),function(n){return e.apply(this,arguments)})}]);var e,t})();Ya({prefix:"aiobj",size:24}),(function(e,t){for(var n in t)yb(e,n,{get:t[n],enumerable:!0})})({},{object:function(){return Bb},text:function(){return Ib}});var ih,oh,Ib=function(){return{type:"text",responseFormat:{type:"text"},parsePartial:(t=vt(Oe().m(function n(r){var u;return Oe().w(function(a){for(;;)if(a.n===0)return u=r.text,a.a(2,{partial:u})},n)})),function(n){return t.apply(this,arguments)}),parseOutput:(e=vt(Oe().m(function n(r){var u;return Oe().w(function(a){for(;;)if(a.n===0)return u=r.text,a.a(2,u)},n)})),function(n){return e.apply(this,arguments)})};var e,t},Bb=function(e){var t=(function(n){return n==null?gc({properties:{},additionalProperties:!1}):we(r=n)=="object"&&r!==null&&mc in r&&r[mc]===!0&&"jsonSchema"in r&&"validate"in r?n:typeof n=="function"?n():Vp(n);var r})(e.schema);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},parsePartial:function(n){return vt(Oe().m(function r(){var u,a,i,o;return Oe().w(function(c){for(;;)switch(c.n){case 0:return u=n.text,c.n=1,uh(u);case 1:a=c.v,o=a.state,c.n=o==="failed-parse"||o==="undefined-input"?2:o==="repaired-parse"||o==="successful-parse"?3:4;break;case 2:case 5:return c.a(2);case 3:return c.a(2,{partial:a.value});case 4:throw i=a.state,new Error("Unsupported parse state: ".concat(i))}},r)}))()},parseOutput:function(n,r){return vt(Oe().m(function u(){var a,i,o;return Oe().w(function(c){for(;;)switch(c.n){case 0:return a=n.text,c.n=1,yo({text:a});case 1:if((i=c.v).success){c.n=2;break}throw new Qp({message:"No object generated: could not parse the response.",cause:i.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});case 2:return c.n=3,cc({value:i.value,schema:t});case 3:if((o=c.v).success){c.n=4;break}throw new Qp({message:"No object generated: response did not match schema.",cause:o.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});case 4:return c.a(2,o.value)}},u)}))()}}},Pb=(function(){return $n(function n(r){var u=r.api,a=u===void 0?"/api/chat":u,i=r.credentials,o=r.headers,c=r.body,l=r.fetch,p=r.prepareSendMessagesRequest,m=r.prepareReconnectToStreamRequest;Mn(this,n),this.api=a,this.credentials=i,this.headers=o,this.body=c,this.fetch=l,this.prepareSendMessagesRequest=p,this.prepareReconnectToStreamRequest=m},[{key:"sendMessages",value:(t=vt(Oe().m(function n(r){var u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S,T,I,B;return Oe().w(function(d){for(;;)switch(d.n){case 0:return u=r.abortSignal,a=Nr(r,Dv),d.n=1,Qu(this.body);case 1:return m=d.v,d.n=2,Qu(this.headers);case 2:return v=d.v,d.n=3,Qu(this.credentials);case 3:return y=d.v,F=pe(pe({},bu(v)),bu(a.headers)),d.n=4,(i=this.prepareSendMessagesRequest)==null?void 0:i.call(this,{api:this.api,id:a.chatId,messages:a.messages,body:pe(pe({},m),a.body),headers:F,credentials:y,requestMetadata:a.metadata,trigger:a.trigger,messageId:a.messageId});case 4:return D=d.v,_=(o=D==null?void 0:D.api)!=null?o:this.api,O=(D==null?void 0:D.headers)!==void 0?bu(D.headers):F,w=(D==null?void 0:D.body)!==void 0?D.body:pe(pe(pe({},m),a.body),{},{id:a.chatId,messages:a.messages,trigger:a.trigger,messageId:a.messageId}),x=(c=D==null?void 0:D.credentials)!=null?c:y,S=(l=this.fetch)!=null?l:globalThis.fetch,d.n=5,S(_,{method:"POST",headers:zp(pe({"Content-Type":"application/json"},O),"ai-sdk/".concat(Yp),Rp()),body:JSON.stringify(w),credentials:x,signal:u});case 5:if((T=d.v).ok){d.n=9;break}return I=Error,d.n=6,T.text();case 6:if((p=d.v)==null){d.n=7;break}B=p,d.n=8;break;case 7:B="Failed to fetch the chat response.";case 8:throw new I(B);case 9:if(T.body){d.n=10;break}throw new Error("The response body is empty.");case 10:return d.a(2,this.processResponseStream(T.body))}},n,this)})),function(n){return t.apply(this,arguments)})},{key:"reconnectToStream",value:(e=vt(Oe().m(function n(r){var u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S;return Oe().w(function(T){for(;;)switch(T.n){case 0:return T.n=1,Qu(this.body);case 1:return l=T.v,T.n=2,Qu(this.headers);case 2:return p=T.v,T.n=3,Qu(this.credentials);case 3:return m=T.v,v=pe(pe({},bu(p)),bu(r.headers)),T.n=4,(u=this.prepareReconnectToStreamRequest)==null?void 0:u.call(this,{api:this.api,id:r.chatId,body:pe(pe({},l),r.body),headers:v,credentials:m,requestMetadata:r.metadata});case 4:return y=T.v,F=(a=y==null?void 0:y.api)!=null?a:"".concat(this.api,"/").concat(r.chatId,"/stream"),D=(y==null?void 0:y.headers)!==void 0?bu(y.headers):v,_=(i=y==null?void 0:y.credentials)!=null?i:m,O=(o=this.fetch)!=null?o:globalThis.fetch,T.n=5,O(F,{method:"GET",headers:zp(D,"ai-sdk/".concat(Yp),Rp()),credentials:_});case 5:if((w=T.v).status!==204){T.n=6;break}return T.a(2,null);case 6:if(w.ok){T.n=10;break}return x=Error,T.n=7,w.text();case 7:if((c=T.v)==null){T.n=8;break}S=c,T.n=9;break;case 8:S="Failed to fetch the chat response.";case 9:throw new x(S);case 10:if(w.body){T.n=11;break}throw new Error("The response body is empty.");case 11:return T.a(2,this.processResponseStream(w.body))}},n,this)})),function(n){return e.apply(this,arguments)})}]);var e,t})(),bc=(function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Mn(this,e),au(this,e,[t])}return iu(e,Pb),$n(e,[{key:"processResponseStream",value:function(t){return(function(n){var r=n.schema;return n.stream.pipeThrough(new TextDecoderStream).pipeThrough(new R0).pipeThrough(new TransformStream({transform:function(u,a){return vt(Oe().m(function i(){var o,c;return Oe().w(function(l){for(;;)switch(l.n){case 0:if(o=u.data,o==="[DONE]"){l.n=2;break}return c=a,l.n=1,yo({text:o,schema:r});case 1:c.enqueue.call(c,l.v);case 2:return l.a(2)}},i)}))()}}))})({stream:t,schema:wb}).pipeThrough(new TransformStream({transform:function(n,r){return vt(Oe().m(function u(){return Oe().w(function(a){for(;;)switch(a.n){case 0:if(n.success){a.n=1;break}throw n.error;case 1:r.enqueue(n.value);case 2:return a.a(2)}},u)}))()}}))}}])})(),jb=(function(){return $n(function t(n){var r=this,u=n.generateId,a=u===void 0?KD:u,i=n.id,o=i===void 0?a():i,c=n.transport,l=c===void 0?new bc:c,p=n.messageMetadataSchema,m=n.dataPartSchemas,v=n.state,y=n.onError,F=n.onToolCall,D=n.onFinish,_=n.onData,O=n.sendAutomaticallyWhen;Mn(this,t),this.activeResponse=void 0,this.jobExecutor=new Ob,this.sendMessage=(function(){var w=vt(Oe().m(function x(S,T){var I,B,d,H,R,Z,q;return Oe().w(function(G){for(;;)switch(G.n){case 0:if(S!=null){G.n=2;break}return G.n=1,r.makeRequest(pe({trigger:"submit-message",messageId:(I=r.lastMessage)==null?void 0:I.id},T));case 1:return G.a(2,void G.v);case 2:if(!("text"in S)&&!("files"in S)){G.n=6;break}if(!Array.isArray(S.files)){G.n=3;break}q=S.files,G.n=5;break;case 3:return G.n=4,(function(){var L=vt(Oe().m(function ne(Q){return Oe().w(function($){for(;;)switch($.n){case 0:if(Q!=null){$.n=1;break}return $.a(2,[]);case 1:if(globalThis.FileList&&Q instanceof globalThis.FileList){$.n=2;break}throw new Error("FileList is not supported in the current environment");case 2:return $.a(2,Promise.all(Array.from(Q).map((function(){var Y=vt(Oe().m(function re(me){var se,K,V,ue,oe;return Oe().w(function(ce){for(;;)switch(ce.n){case 0:return se=me.name,K=me.type,V=K,ue=se,ce.n=1,new Promise(function(ee,he){var Ce=new FileReader;Ce.onload=function(Re){var ge;ee((ge=Re.target)==null?void 0:ge.result)},Ce.onerror=function(Re){return he(Re)},Ce.readAsDataURL(me)});case 1:return oe=ce.v,ce.a(2,{type:"file",mediaType:V,filename:ue,url:oe})}},re)}));return function(re){return Y.apply(this,arguments)}})())))}},ne)}));return function(ne){return L.apply(this,arguments)}})()(S.files);case 4:q=G.v;case 5:R={parts:[].concat(Qe(q),Qe("text"in S&&S.text!=null?[{type:"text",text:S.text}]:[]))},G.n=7;break;case 6:R=S;case 7:if(S.messageId==null){G.n=10;break}if(Z=r.state.messages.findIndex(function(L){return L.id===S.messageId}),Z!==-1){G.n=8;break}throw new Error("message with id ".concat(S.messageId," not found"));case 8:if(r.state.messages[Z].role==="user"){G.n=9;break}throw new Error("message with id ".concat(S.messageId," is not a user message"));case 9:r.state.messages=r.state.messages.slice(0,Z+1),r.state.replaceMessage(Z,pe(pe({},R),{},{id:S.messageId,role:(B=R.role)!=null?B:"user",metadata:S.metadata})),G.n=11;break;case 10:r.state.pushMessage(pe(pe({},R),{},{id:(d=R.id)!=null?d:r.generateId(),role:(H=R.role)!=null?H:"user",metadata:S.metadata}));case 11:return G.n=12,r.makeRequest(pe({trigger:"submit-message",messageId:S.messageId},T));case 12:return G.a(2)}},x)}));return function(x,S){return w.apply(this,arguments)}})(),this.regenerate=vt(Oe().m(function w(){var x,S,T,I,B=arguments;return Oe().w(function(d){for(;;)switch(d.n){case 0:if(S=(x=B.length>0&&B[0]!==void 0?B[0]:{}).messageId,T=Nr(x,bv),I=S==null?r.state.messages.length-1:r.state.messages.findIndex(function(H){return H.id===S}),I!==-1){d.n=1;break}throw new Error("message ".concat(S," not found"));case 1:return r.state.messages=r.state.messages.slice(0,r.messages[I].role==="assistant"?I:I+1),d.n=2,r.makeRequest(pe({trigger:"regenerate-message",messageId:S},T));case 2:return d.a(2)}},w)})),this.resumeStream=vt(Oe().m(function w(){var x,S=arguments;return Oe().w(function(T){for(;;)switch(T.n){case 0:return x=S.length>0&&S[0]!==void 0?S[0]:{},T.n=1,r.makeRequest(pe({trigger:"resume-stream"},x));case 1:return T.a(2)}},w)})),this.clearError=function(){r.status==="error"&&(r.state.error=void 0,r.setStatus({status:"ready"}))},this.addToolOutput=(function(){var w=vt(Oe().m(function x(S){var T,I,B,d,H;return Oe().w(function(R){for(;;)if(R.n===0)return T=S.state,I=T===void 0?"output-available":T,S.tool,B=S.toolCallId,d=S.output,H=S.errorText,R.a(2,r.jobExecutor.run(vt(Oe().m(function Z(){var q,G,L,ne;return Oe().w(function(Q){for(;;)switch(Q.n){case 0:L=r.state.messages,ne=L[L.length-1],r.state.replaceMessage(L.length-1,pe(pe({},ne),{},{parts:ne.parts.map(function($){return Dc($)&&$.toolCallId===B?pe(pe({},$),{},{state:I,output:d,errorText:H}):$})})),r.activeResponse&&(r.activeResponse.state.message.parts=r.activeResponse.state.message.parts.map(function($){return Dc($)&&$.toolCallId===B?pe(pe({},$),{},{state:I,output:d,errorText:H}):$})),r.status!=="streaming"&&r.status!=="submitted"&&((q=r.sendAutomaticallyWhen)!=null&&q.call(r,{messages:r.state.messages}))&&r.makeRequest({trigger:"submit-message",messageId:(G=r.lastMessage)==null?void 0:G.id});case 1:return Q.a(2)}},Z)}))))},x)}));return function(x){return w.apply(this,arguments)}})(),this.addToolResult=this.addToolOutput,this.stop=vt(Oe().m(function w(){var x;return Oe().w(function(S){for(;;)switch(S.n){case 0:r.status!=="streaming"&&r.status!=="submitted"||(x=r.activeResponse)!=null&&x.abortController&&r.activeResponse.abortController.abort();case 1:return S.a(2)}},w)})),this.id=o,this.transport=l,this.generateId=a,this.messageMetadataSchema=p,this.dataPartSchemas=m,this.state=v,this.onError=y,this.onToolCall=F,this.onFinish=D,this.onData=_,this.sendAutomaticallyWhen=O},[{key:"status",get:function(){return this.state.status}},{key:"setStatus",value:function(t){var n=t.status,r=t.error;this.status!==n&&(this.state.status=n,this.state.error=r)}},{key:"error",get:function(){return this.state.error}},{key:"messages",get:function(){return this.state.messages},set:function(t){this.state.messages=t}},{key:"lastMessage",get:function(){return this.state.messages[this.state.messages.length-1]}},{key:"makeRequest",value:(e=vt(Oe().m(function t(n){var r,u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S,T=this;return Oe().w(function(I){for(;;)switch(I.p=I.n){case 0:if(r=n.trigger,u=n.metadata,a=n.headers,i=n.body,o=n.messageId,this.setStatus({status:"submitted",error:void 0}),v=this.lastMessage,y=!1,F=!1,D=!1,I.p=1,(_={state:xb({lastMessage:this.state.snapshot(v),messageId:this.generateId()}),abortController:new AbortController}).abortController.signal.addEventListener("abort",function(){y=!0}),this.activeResponse=_,r!=="resume-stream"){I.n=4;break}return I.n=2,this.transport.reconnectToStream({chatId:this.id,metadata:u,headers:a,body:i});case 2:if((w=I.v)!=null){I.n=3;break}return I.a(2,void this.setStatus({status:"ready"}));case 3:O=w,I.n=6;break;case 4:return I.n=5,this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:_.abortController.signal,metadata:u,headers:a,body:i,trigger:r,messageId:o});case 5:O=I.v;case 6:return x=function(B){return T.jobExecutor.run(function(){return B({state:_.state,write:function(){var d;T.setStatus({status:"streaming"}),_.state.message.id===((d=T.lastMessage)==null?void 0:d.id)?T.state.replaceMessage(T.state.messages.length-1,_.state.message):T.state.pushMessage(_.state.message)}})})},I.n=7,(function(){var B=vt(Oe().m(function d(H){var R,Z,q,G;return Oe().w(function(L){for(;;)switch(L.p=L.n){case 0:R=H.stream,Z=H.onError,q=R.getReader(),L.p=1;case 2:return L.n=3,q.read();case 3:if(!L.v.done){L.n=4;break}return L.a(3,5);case 4:L.n=2;break;case 5:L.n=7;break;case 6:L.p=6,G=L.v,Z==null||Z(G);case 7:return L.p=7,q.releaseLock(),L.f(7);case 8:return L.a(2)}},d,null,[[1,6,7,8]])}));return function(d){return B.apply(this,arguments)}})()({stream:Tb({stream:O,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:x,onError:function(B){throw B}}),onError:function(B){throw B}});case 7:this.setStatus({status:"ready"}),I.n=10;break;case 8:if(I.p=8,S=I.v,!y&&S.name!=="AbortError"){I.n=9;break}return I.a(2,(y=!0,this.setStatus({status:"ready"}),null));case 9:D=!0,S instanceof TypeError&&(S.message.toLowerCase().includes("fetch")||S.message.toLowerCase().includes("network"))&&(F=!0),this.onError&&S instanceof Error&&this.onError(S),this.setStatus({status:"error",error:S});case 10:I.p=10;try{(l=this.onFinish)==null||l.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:y,isDisconnect:F,isError:D,finishReason:(c=this.activeResponse)==null?void 0:c.state.finishReason})}catch(B){console.error(B)}return this.activeResponse=void 0,I.f(10);case 11:if(!((p=this.sendAutomaticallyWhen)!=null&&p.call(this,{messages:this.state.messages}))||D){I.n=12;break}return I.n=12,this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id,metadata:u,headers:a,body:i});case 12:return I.a(2)}},t,this,[[1,8,10,11]])})),function(t){return e.apply(this,arguments)})}]);var e})();function Nb(e){var t=e.messages,n=t[t.length-1];if(!n||n.role!=="assistant")return!1;var r=n.parts.reduce(function(a,i,o){return i.type==="step-start"?o:a},-1),u=n.parts.slice(r+1).filter(Dc).filter(function(a){return!a.providerExecuted});return u.length>0&&u.every(function(a){return a.state==="output-available"||a.state==="output-error"})}var jn,bo,Ao,ei,ti,ni,Yu,Ac,Ec,Xu,Rb=(function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e})((oh||(oh=1,ih=function(e,t){if(typeof e!="function")throw new TypeError("Expected the first argument to be a `function`, got `".concat(Qt(e),"`."));var n,r=0;return function(){for(var u=this,a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];clearTimeout(n);var c=Date.now(),l=t-(c-r);l<=0?(r=c,e.apply(this,i)):n=setTimeout(function(){r=Date.now(),e.apply(u,i)},l)}}),ih)),sh=function(e,t,n){if(!t.has(e))throw TypeError("Cannot "+n)},It=function(e,t,n){return sh(e,t,"read from private field"),n?n.call(e):t.get(e)},ir=function(e,t,n){if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Gr=function(e,t,n,r){return sh(e,t,"write to private field"),t.set(e,n),n},zb=(function(){return $n(function e(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];Mn(this,e),ir(this,jn,void 0),ir(this,bo,"ready"),ir(this,Ao,void 0),ir(this,ei,new Set),ir(this,ti,new Set),ir(this,ni,new Set),this.pushMessage=function(r){Gr(t,jn,It(t,jn).concat(r)),It(t,Yu).call(t)},this.popMessage=function(){Gr(t,jn,It(t,jn).slice(0,-1)),It(t,Yu).call(t)},this.replaceMessage=function(r,u){Gr(t,jn,[].concat(Qe(It(t,jn).slice(0,r)),[t.snapshot(u)],Qe(It(t,jn).slice(r+1)))),It(t,Yu).call(t)},this.snapshot=function(r){return structuredClone(r)},this["~registerMessagesCallback"]=function(r,u){var a,i,o=u?(a=r,(i=u)!=null?Rb(a,i):a):r;return It(t,ei).add(o),function(){It(t,ei).delete(o)}},this["~registerStatusCallback"]=function(r){return It(t,ti).add(r),function(){It(t,ti).delete(r)}},this["~registerErrorCallback"]=function(r){return It(t,ni).add(r),function(){It(t,ni).delete(r)}},ir(this,Yu,function(){It(t,ei).forEach(function(r){return r()})}),ir(this,Ac,function(){It(t,ti).forEach(function(r){return r()})}),ir(this,Ec,function(){It(t,ni).forEach(function(r){return r()})}),Gr(this,jn,n)},[{key:"status",get:function(){return It(this,bo)},set:function(e){Gr(this,bo,e),It(this,Ac).call(this)}},{key:"error",get:function(){return It(this,Ao)},set:function(e){Gr(this,Ao,e),It(this,Ec).call(this)}},{key:"messages",get:function(){return It(this,jn)},set:function(e){Gr(this,jn,Qe(e)),It(this,Yu).call(this)}}])})();jn=new WeakMap,bo=new WeakMap,Ao=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,Yu=new WeakMap,Ac=new WeakMap,Ec=new WeakMap;var ch=(function(){function e(t){var n,r=t.messages,u=Nr(t,Av);Mn(this,e);var a=new zb(r);return n=au(this,e,[pe(pe({},u),{},{state:a})]),ir(wu(n),Xu,void 0),n["~registerMessagesCallback"]=function(i,o){return It(wu(n),Xu)["~registerMessagesCallback"](i,o)},n["~registerStatusCallback"]=function(i){return It(wu(n),Xu)["~registerStatusCallback"](i)},n["~registerErrorCallback"]=function(i){return It(wu(n),Xu)["~registerErrorCallback"](i)},Gr(wu(n),Xu,a),n}return iu(e,jb),$n(e)})();Xu=new WeakMap;var lh="askai_token",Lb=function(e){if(!e)return!0;try{var t=(function(r){var u=dt(r.split("."),1)[0];return JSON.parse(atob(u))})(e),n=t.exp;return Date.now()/1e3>n-30}catch(r){return!0}},Eo=null,fh=(function(){var e=Xe(Ae().m(function t(n){var r,u,a,i,o,c;return Ae().w(function(l){for(;;)switch(l.n){case 0:if(r=n.assistantId,u=n.abortSignal,a=n.useStagingEnv,i=a!==void 0&&a,o=sessionStorage.getItem(lh),Lb(o)){l.n=1;break}return l.a(2,o);case 1:return c=i?Ds:ys,Eo||(Eo=fetch("".concat(c,"/token"),{method:"POST",headers:{"x-algolia-assistant-id":r,"content-type":"application/json"},signal:u}).then(function(p){return p.json()}).then(function(p){var m=p.token,v=p.success,y=p.message;if(!v&&y)throw new Error(y);return sessionStorage.setItem(lh,m),m}).finally(function(){return Eo=null})),l.a(2,Eo)}},t)}));return function(t){return e.apply(this,arguments)}})(),Mb=(function(){var e=Xe(Ae().m(function t(n){var r,u,a,i,o,c,l,p,m,v;return Ae().w(function(y){for(;;)switch(y.n){case 0:return r=n.assistantId,u=n.thumbs,a=n.messageId,i=n.appId,o=n.abortSignal,c=n.useStagingEnv,l=c!==void 0&&c,(p=new Headers).set("x-algolia-assistant-id",r),p.set("content-type","application/json"),y.n=1,fh({assistantId:r,abortSignal:o,useStagingEnv:l});case 1:return m=y.v,p.set("authorization","TOKEN ".concat(m)),v=l?Ds:ys,y.a(2,fetch("".concat(v,"/feedback"),{method:"POST",body:JSON.stringify({appId:i,messageId:a,thumbs:u}),headers:p}))}},t)}));return function(t){return e.apply(this,arguments)}})(),$b=["assistantId","apiKey","appId","indexName","useStagingEnv"];function Zb(e){var t,n="algolia-client-js-".concat(e.key);function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function u(){return JSON.parse(r().getItem(n)||"{}")}function a(i){r().setItem(n,JSON.stringify(i))}return{get:function(i,o){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){var l,p,m;return l=e.timeToLive?1e3*e.timeToLive:null,p=u(),a(m=Object.fromEntries(Object.entries(p).filter(function(v){return dt(v,2)[1].timestamp!==void 0}))),l&&a(Object.fromEntries(Object.entries(m).filter(function(v){var y=dt(v,2)[1],F=new Date().getTime();return!(y.timestamp+l<F)}))),u()[JSON.stringify(i)]}).then(function(l){return Promise.all([l?l.value:o(),l!==void 0])}).then(function(l){var p=dt(l,2),m=p[0],v=p[1];return Promise.all([m,v||c.miss(m)])}).then(function(l){return dt(l,1)[0]})},set:function(i,o){return Promise.resolve().then(function(){var c=u();return c[JSON.stringify(i)]={timestamp:new Date().getTime(),value:o},r().setItem(n,JSON.stringify(c)),o})},delete:function(i){return Promise.resolve().then(function(){var o=u();delete o[JSON.stringify(i)],r().setItem(n,JSON.stringify(o))})},clear:function(){return Promise.resolve().then(function(){r().removeItem(n)})}}}function ri(e){var t=be(e.caches),n=t.shift();return n===void 0?{get:function(r,u){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return u().then(function(i){return Promise.all([i,a.miss(i)])}).then(function(i){return dt(i,1)[0]})},set:function(r,u){return Promise.resolve(u)},delete:function(r){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(r,u){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return n.get(r,u,a).catch(function(){return ri({caches:t}).get(r,u,a)})},set:function(r,u){return n.set(r,u).catch(function(){return ri({caches:t}).set(r,u)})},delete:function(r){return n.delete(r).catch(function(){return ri({caches:t}).delete(r)})},clear:function(){return n.clear().catch(function(){return ri({caches:t}).clear()})}}}function Fc(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{serializable:!0},t={};return{get:function(n,r){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(n);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var i=r();return i.then(function(o){return u.miss(o)}).then(function(){return i})},set:function(n,r){return t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete:function(n){return delete t[JSON.stringify(n)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function qb(e){var t=e.algoliaAgents,n=e.client,r=e.version,u=(function(a){var i={value:"Algolia for JavaScript (".concat(a,")"),add:function(o){var c="; ".concat(o.segment).concat(o.version!==void 0?" (".concat(o.version,")"):"");return i.value.indexOf(c)===-1&&(i.value="".concat(i.value).concat(c)),i}};return i})(r).add({segment:n,version:r});return t.forEach(function(a){return u.add(a)}),u}var dh=12e4;function ph(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"up",n=Date.now();return C(C({},e),{},{status:t,lastUpdate:n,isUp:function(){return t==="up"||Date.now()-n>dh},isTimedOut:function(){return t==="timed out"&&Date.now()-n<=dh}})}var hh=(function(){function e(t,n){var r;return Be(this,e),lt(r=$e(this,e,[t]),"name","AlgoliaError"),n&&(r.name=n),r}return Me(e,Lr(Error)),Pe(e)})(),vh=(function(){function e(t,n,r){var u;return Be(this,e),lt(u=$e(this,e,[t,r]),"stackTrace",void 0),u.stackTrace=n,u}return Me(e,hh),Pe(e)})(),Hb=(function(){function e(t){return Be(this,e),$e(this,e,["Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError"])}return Me(e,vh),Pe(e)})(),_c=(function(){function e(t,n,r){var u,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"ApiError";return Be(this,e),lt(u=$e(this,e,[t,r,a]),"status",void 0),u.status=n,u}return Me(e,vh),Pe(e)})(),Ub=(function(){function e(t,n){var r;return Be(this,e),lt(r=$e(this,e,[t,"DeserializationError"]),"response",void 0),r.response=n,r}return Me(e,hh),Pe(e)})(),Wb=(function(){function e(t,n,r,u){var a;return Be(this,e),lt(a=$e(this,e,[t,n,u,"DetailedApiError"]),"error",void 0),a.error=r,a}return Me(e,_c),Pe(e)})();function Vb(e,t,n){var r,u=(r=n,Object.keys(r).filter(function(i){return r[i]!==void 0}).sort().map(function(i){return"".concat(i,"=").concat(encodeURIComponent(Object.prototype.toString.call(r[i])==="[object Array]"?r[i].join(","):r[i]).replace(/\+/g,"%20"))}).join("&")),a="".concat(e.protocol,"://").concat(e.url).concat(e.port?":".concat(e.port):"","/").concat(t.charAt(0)==="/"?t.substring(1):t);return u.length&&(a+="?".concat(u)),a}function Kb(e,t){if(e.method!=="GET"&&(e.data!==void 0||t.data!==void 0)){var n=Array.isArray(e.data)?e.data:C(C({},e.data),t.data);return JSON.stringify(n)}}function Gb(e,t,n){var r=C(C(C({Accept:"application/json"},e),t),n),u={};return Object.keys(r).forEach(function(a){var i=r[a];u[a.toLowerCase()]=i}),u}function Jb(e){try{return JSON.parse(e.content)}catch(t){throw new Ub(t.message,e)}}function Qb(e,t){var n=e.content,r=e.status;try{var u=JSON.parse(n);return"error"in u?new Wb(u.message,r,u.error,t):new _c(u.message,r,t)}catch(a){}return new _c(n,r,t)}function Yb(e){var t=e.isTimedOut,n=e.status;return t||(function(r){return!r.isTimedOut&&~~r.status===0})({isTimedOut:t,status:n})||~~(n/100)!=2&&~~(n/100)!=4}function Xb(e){return~~(e.status/100)==2}function eA(e){return e.map(function(t){return mh(t)})}function mh(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return C(C({},e),{},{request:C(C({},e.request),{},{headers:C(C({},e.request.headers),t)})})}var tA=["appId","apiKey","authMode","algoliaAgents"],nA=["params"],gh="5.43.0";function rA(e){return[{url:"".concat(e,"-dsn.algolia.net"),accept:"read",protocol:"https"},{url:"".concat(e,".algolia.net"),accept:"write",protocol:"https"}].concat((function(t){for(var n=t,r=t.length-1;r>0;r--){var u=Math.floor(Math.random()*(r+1)),a=t[r];n[r]=t[u],n[u]=a}return n})([{url:"".concat(e,"-1.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-2.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-3.algolianet.com"),accept:"readWrite",protocol:"https"}]))}var Cc="4.5.4";function uA(e,t,n){var r=b.useMemo(function(){var u=(function(a,i){if(!a||typeof a!="string")throw new Error("`appId` is missing.");if(!i||typeof i!="string")throw new Error("`apiKey` is missing.");return(function(o){var c=o.appId,l=o.apiKey,p=o.authMode,m=o.algoliaAgents,v=an(o,tA),y=(function(D,_){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"WithinHeaders",w={"x-algolia-api-key":_,"x-algolia-application-id":D};return{headers:function(){return O==="WithinHeaders"?w:{}},queryParameters:function(){return O==="WithinQueryParameters"?w:{}}}})(c,l,p),F=(function(D){var _=D.hosts,O=D.hostsCache,w=D.baseHeaders,x=D.logger,S=D.baseQueryParameters,T=D.algoliaAgent,I=D.timeouts,B=D.requester,d=D.requestsCache,H=D.responsesCache;function R(L){return Z.apply(this,arguments)}function Z(){return(Z=Xe(Ae().m(function L(ne){var Q,$,Y,re,me;return Ae().w(function(se){for(;;)switch(se.n){case 0:return se.n=1,Promise.all(ne.map(function(K){return O.get(K,function(){return Promise.resolve(ph(K))})}));case 1:return Q=se.v,$=Q.filter(function(K){return K.isUp()}),Y=Q.filter(function(K){return K.isTimedOut()}),re=[].concat(be($),be(Y)),me=re.length>0?re:ne,se.a(2,{hosts:me,getTimeout:function(K,V){return(Y.length===0&&K===0?1:Y.length+3+K)*V}})}},L)}))).apply(this,arguments)}function q(L,ne){return G.apply(this,arguments)}function G(){return G=Xe(Ae().m(function L(ne,Q){var $,Y,re,me,se,K,V,ue,oe,ce,ee,he,Ce,Re=arguments;return Ae().w(function(ge){for(;;)switch(ge.n){case 0:if($=!(Re.length>2&&Re[2]!==void 0)||Re[2],Y=[],re=Kb(ne,Q),me=Gb(w,ne.headers,Q.headers),se=ne.method==="GET"?C(C({},ne.data),Q.data):{},K=C(C(C({},S),ne.queryParameters),se),T.value&&(K["x-algolia-agent"]=T.value),Q&&Q.queryParameters)for(V=0,ue=Object.keys(Q.queryParameters);V<ue.length;V++)oe=ue[V],Q.queryParameters[oe]&&Object.prototype.toString.call(Q.queryParameters[oe])!=="[object Object]"?K[oe]=Q.queryParameters[oe].toString():K[oe]=Q.queryParameters[oe];return ce=0,ee=(function(){var Te=Xe(Ae().m(function He(nt,Ge){var yt,Dt,mn,Xt,un,Gn;return Ae().w(function(Mt){for(;;)switch(Mt.n){case 0:if((yt=nt.pop())!==void 0){Mt.n=1;break}throw new Hb(eA(Y));case 1:return Dt=C(C({},I),Q.timeouts),mn={data:re,headers:me,method:ne.method,url:Vb(yt,ne.path,K),connectTimeout:Ge(ce,Dt.connect),responseTimeout:Ge(ce,$?Dt.read:Dt.write)},Xt=function(Gt){var Jt={request:mn,response:Gt,host:yt,triesLeft:nt.length};return Y.push(Jt),Jt},Mt.n=2,B.send(mn);case 2:if(!Yb(un=Mt.v)){Mt.n=4;break}return Gn=Xt(un),un.isTimedOut&&ce++,x.info("Retryable failure",mh(Gn)),Mt.n=3,O.set(yt,ph(yt,un.isTimedOut?"timed out":"down"));case 3:return Mt.a(2,ee(nt,Ge));case 4:if(!Xb(un)){Mt.n=5;break}return Mt.a(2,Jb(un));case 5:throw Xt(un),Qb(un,Y);case 6:return Mt.a(2)}},He)}));return function(He,nt){return Te.apply(this,arguments)}})(),he=_.filter(function(Te){return Te.accept==="readWrite"||($?Te.accept==="read":Te.accept==="write")}),ge.n=1,R(he);case 1:return Ce=ge.v,ge.a(2,ee(be(Ce.hosts).reverse(),Ce.getTimeout))}},L)})),G.apply(this,arguments)}return{hostsCache:O,requester:B,timeouts:I,logger:x,algoliaAgent:T,baseHeaders:w,baseQueryParameters:S,hosts:_,request:function(L){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Q=L.useReadTransporter||L.method==="GET";if(!Q)return q(L,ne,Q);var $=function(){return q(L,ne)};if((ne.cacheable||L.cacheable)!==!0)return $();var Y={request:L,requestOptions:ne,transporter:{queryParameters:S,headers:w}};return H.get(Y,function(){return d.get(Y,function(){return d.set(Y,$()).then(function(re){return Promise.all([d.delete(Y),re])},function(re){return Promise.all([d.delete(Y),Promise.reject(re)])}).then(function(re){var me=dt(re,2);return me[0],me[1]})})},{miss:function(re){return H.set(Y,re)}})},requestsCache:d,responsesCache:H}})(C(C({hosts:rA(c)},v),{},{algoliaAgent:qb({algoliaAgents:m,client:"Lite",version:gh}),baseHeaders:C(C({"content-type":"text/plain"},y.headers()),v.baseHeaders),baseQueryParameters:C(C({},y.queryParameters()),v.baseQueryParameters)}));return{transporter:F,appId:c,apiKey:l,clearCache:function(){return Promise.all([F.requestsCache.clear(),F.responsesCache.clear()]).then(function(){})},get _ua(){return F.algoliaAgent.value},addAlgoliaAgent:function(D,_){F.algoliaAgent.add({segment:D,version:_})},setClientApiKey:function(D){var _=D.apiKey;p&&p!=="WithinHeaders"?F.baseQueryParameters["x-algolia-api-key"]=_:F.baseHeaders["x-algolia-api-key"]=_},searchForHits:function(D,_){return this.search(D,_)},searchForFacets:function(D,_){return this.search(D,_)},customPost:function(D,_){var O=D.path,w=D.parameters,x=D.body;if(!O)throw new Error("Parameter `path` is required when calling `customPost`.");var S={method:"POST",path:"/{path}".replace("{path}",O),queryParameters:w||{},headers:{},data:x||{}};return F.request(S,_)},getRecommendations:function(D,_){if(D&&Array.isArray(D)&&(D={requests:D}),!D)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!D.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");var O={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:D,useReadTransporter:!0,cacheable:!0};return F.request(O,_)},search:function(D,_){if(D&&Array.isArray(D)){var O={requests:D.map(function(x){var S=x.params,T=an(x,nA);return T.type==="facet"?C(C(C({},T),S),{},{type:"facet"}):C(C(C({},T),S),{},{facet:void 0,maxFacetHits:void 0,facetQuery:void 0})})};D=O}if(!D)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!D.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");var w={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:D,useReadTransporter:!0,cacheable:!0};return F.request(w,_)}}})(C({appId:a,apiKey:i,timeouts:{connect:1e3,read:2e3,write:3e4},logger:{debug:function(o,c){return Promise.resolve()},info:function(o,c){return Promise.resolve()},error:function(o,c){return Promise.resolve()}},requester:{send:function(o){return new Promise(function(c){var l=new XMLHttpRequest;l.open(o.method,o.url,!0),Object.keys(o.headers).forEach(function(y){return l.setRequestHeader(y,o.headers[y])});var p,m=function(y,F){return setTimeout(function(){l.abort(),c({status:0,content:F,isTimedOut:!0})},y)},v=m(o.connectTimeout,"Connection timeout");l.onreadystatechange=function(){l.readyState>l.OPENED&&p===void 0&&(clearTimeout(v),p=m(o.responseTimeout,"Socket timeout"))},l.onerror=function(){l.status===0&&(clearTimeout(v),clearTimeout(p),c({content:l.responseText||"Network request failed",status:l.status,isTimedOut:!1}))},l.onload=function(){clearTimeout(v),clearTimeout(p),c({content:l.responseText,status:l.status,isTimedOut:!1})},l.send(o.data)})}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:Fc(),requestsCache:Fc({serializable:!1}),hostsCache:ri({caches:[Zb({key:"".concat(gh,"-").concat(a)}),Fc()]})},void 0))})(e,t);return u.addAlgoliaAgent("docsearch",Cc),/docsearch.js \(.*\)/.test(u.transporter.algoliaAgent.value)===!1&&u.addAlgoliaAgent("docsearch-react",Cc),n(u)},[e,t,n]);return r}var aA=["appId","apiKey","askAi","maxResultsPerGroup","theme","onClose","transformItems","hitComponent","resultsFooterComponent","navigator","initialScrollY","transformSearchClient","disableUserPersonalization","initialQuery","translations","getMissingResultsUrl","insights","onAskAiToggle","interceptAskAiEvent","isAskAiActive","recentSearchesLimit","recentSearchesWithFavoritesLimit","indices","indexName","searchParameters","isHybridModeSupported"],iA=["footer","searchBox"],oA=(function(){var e=Xe(Ae().m(function t(n){var r,u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S,T;return Ae().w(function(I){for(;;)switch(I.p=I.n){case 0:return r=n.query,u=n.state,a=n.setContext,i=n.setStatus,o=n.searchClient,c=n.indexes,l=n.snippetLength,p=n.insights,m=n.appId,v=n.apiKey,y=n.maxResultsPerGroup,F=n.transformItems,D=F===void 0?ss:F,_=n.saveRecentSearch,O=n.onClose,w=p,I.p=1,I.n=2,o.search({requests:c.map(function(B){var d,H,R,Z,q,G,L,ne=typeof B=="string"?B:B.name,Q=typeof B=="string"?{}:B.searchParameters;return C({query:r,indexName:ne,attributesToRetrieve:(d=Q==null?void 0:Q.attributesToRetrieve)!==null&&d!==void 0?d:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"],attributesToSnippet:(H=Q==null?void 0:Q.attributesToSnippet)!==null&&H!==void 0?H:["hierarchy.lvl1:".concat(l.current),"hierarchy.lvl2:".concat(l.current),"hierarchy.lvl3:".concat(l.current),"hierarchy.lvl4:".concat(l.current),"hierarchy.lvl5:".concat(l.current),"hierarchy.lvl6:".concat(l.current),"content:".concat(l.current)],snippetEllipsisText:(R=Q==null?void 0:Q.snippetEllipsisText)!==null&&R!==void 0?R:"\u2026",highlightPreTag:(Z=Q==null?void 0:Q.highlightPreTag)!==null&&Z!==void 0?Z:"<mark>",highlightPostTag:(q=Q==null?void 0:Q.highlightPostTag)!==null&&q!==void 0?q:"</mark>",hitsPerPage:(G=Q==null?void 0:Q.hitsPerPage)!==null&&G!==void 0?G:20,clickAnalytics:(L=Q==null?void 0:Q.clickAnalytics)!==null&&L!==void 0?L:w},Q!=null?Q:{})})});case 2:return x=I.v,S=x.results,I.a(2,S.flatMap(function(B){var d,H=B,R=H.hits,Z=H.nbHits,q=Ql(D(R),function(ne){return Xl(ne)},y);if(u.context.searchSuggestions.length<Object.keys(q).length&&a({searchSuggestions:C(C({},(d=u.context.searchSuggestions)!==null&&d!==void 0?d:[]),Object.keys(q))}),Z){var G=u.context.nbHits;a({nbHits:(G!=null?G:0)+Z})}var L={};return w&&(L={__autocomplete_indexName:H.index,__autocomplete_queryID:H.queryID,__autocomplete_algoliaCredentials:{appId:m,apiKey:v}}),Object.values(q).map(function(ne,Q){return{sourceId:"hits_".concat(H.index,"_").concat(Q),onSelect:function($){var Y=$.item,re=$.event;_(Y),_i(re)||O()},getItemUrl:function($){return $.item.url},getItems:function(){return Object.values(Ql(ne,function($){return $.hierarchy.lvl1},y)).map(function($){return $.map(function(Y){var re=null,me=$.find(function(se){return se.type==="lvl1"&&se.hierarchy.lvl1===Y.hierarchy.lvl1});return Y.type!=="lvl1"&&me&&(re=me),C(C({},Y),{},{__docsearch_parent:re},L)})}).flat()}}})}));case 3:throw I.p=3,(T=I.v).name==="RetryError"&&i("error"),T;case 4:return I.a(2)}},t,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}})();function sA(e){var t,n,r,u,a=e.appId,i=e.apiKey,o=e.askAi,c=e.maxResultsPerGroup,l=e.theme,p=e.onClose,m=p===void 0?_v:p,v=e.transformItems,y=v===void 0?ss:v,F=e.hitComponent,D=F===void 0?pm:F,_=e.resultsFooterComponent,O=_===void 0?function(){return null}:_,w=e.navigator,x=e.initialScrollY,S=x===void 0?0:x,T=e.transformSearchClient,I=T===void 0?ss:T,B=e.disableUserPersonalization,d=B!==void 0&&B,H=e.initialQuery,R=H===void 0?"":H,Z=e.translations,q=Z===void 0?{}:Z,G=e.getMissingResultsUrl,L=e.insights,ne=L!==void 0&&L,Q=e.onAskAiToggle,$=e.interceptAskAiEvent,Y=e.isAskAiActive,re=Y!==void 0&&Y,me=e.recentSearchesLimit,se=me===void 0?7:me,K=e.recentSearchesWithFavoritesLimit,V=K===void 0?4:K,ue=e.indices,oe=ue===void 0?[]:ue,ce=e.indexName,ee=e.searchParameters,he=e.isHybridModeSupported,Ce=he!==void 0&&he,Re=an(e,aA),ge=q.footer,Te=q.searchBox,He=an(q,iA),nt=dt(b.useState({query:"",collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:"idle"}),2),Ge=nt[0],yt=nt[1],Dt=!!o,mn=(q==null||(t=q.searchBox)===null||t===void 0?void 0:t.placeholderText)||Re.placeholder||"Search docs";Dt&&(mn=(q==null||(r=q.searchBox)===null||r===void 0?void 0:r.placeholderText)||"Search docs or ask AI a question"),re&&(mn=(q==null||(u=q.searchBox)===null||u===void 0?void 0:u.placeholderTextAskAi)||"Ask another question...");var Xt=b.useRef(null),un=b.useRef(null),Gn=b.useRef(null),Mt=b.useRef(null),Gt=b.useRef(null),Jt=b.useRef(15),en=b.useRef(typeof window!="undefined"?window.getSelection().toString().slice(0,512):"").current,ke=b.useRef(R||en).current,Ut=uA(a,i,I),Bt=Qt(o)==="object"?o:null,sr=typeof o=="string"?o:(Bt==null?void 0:Bt.assistantId)||null,cr=Bt==null?void 0:Bt.searchParameters,Jr=(Bt==null?void 0:Bt.useStagingEnv)||!1,Qr=dt(b.useState("initial"),2),Fn=Qr[0],$t=Qr[1],Jn=(function(le){var Ie=le.assistantId,Ve=le.searchClient,Ct=le.suggestedQuestionsEnabled,At=Ct!==void 0&&Ct,ln=dt(su([]),2),yn=ln[0],Dn=ln[1];return qn(function(){var Ir=(function(){var eu=Xe(Ae().m(function qt(){var Ht,Br,Nt;return Ae().w(function(fn){for(;;)switch(fn.n){case 0:return fn.n=1,Ve.search({requests:[{indexName:"algolia_ask_ai_suggested_questions",filters:"state:published AND assistantId:".concat(Ie),hitsPerPage:3}]});case 1:Ht=fn.v,Br=Ht.results,Nt=Br[0],Dn(Nt.hits);case 2:return fn.a(2)}},qt)}));return function(){return eu.apply(this,arguments)}})();At&&Ie&&Ie!==""&&Ir()},[At,Ie,Ve]),yn})({assistantId:sr,searchClient:Ut,suggestedQuestionsEnabled:Bt==null?void 0:Bt.suggestedQuestions}),Nn=(n=Bt==null?void 0:Bt.agentStudio)!==null&&n!==void 0&&n,lr=[];if(ce&&ce!==""&&lr.push({name:ce,searchParameters:ee}),oe.length>0&&oe.forEach(function(le){lr.push(typeof le=="string"?{name:le}:le)}),lr.length<1)throw new Error("Must supply either `indexName` or `indices` for DocSearch to work");var xn=lr[0].name,fr=b.useRef(sd({key:"__DOCSEARCH_ASKAI_CONVERSATIONS__".concat((Bt==null?void 0:Bt.indexName)||xn),limit:10})).current,Qn=b.useRef(od({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(xn),limit:10})).current,kr=b.useRef(od({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(xn),limit:Qn.getAll().length===0?se:V})).current,rt=dt(b.useState(!1),2),gn=rt[0],ui=rt[1],dr=(function(le){var Ie=le.assistantId,Ve=le.apiKey,Ct=le.appId,At=le.indexName,ln=le.useStagingEnv,yn=ln!==void 0&&ln,Dn=an(le,$b),Ir=Iu(new AbortController),eu=On(function(){return Dn.agentStudio?(function(kt){var ut=kt.appId,wt=kt.apiKey,Wt=kt.assistantId,Et=kt.searchParameters;return new bc({api:"https://".concat(ut,".algolia.net/agent-studio/1/agents/").concat(Wt,"/completions?stream=true&compatibilityMode=ai-sdk-5"),headers:{"x-algolia-application-id":ut,"x-algolia-api-key":wt},body:Et?{algolia:{searchParameters:Et}}:{}})})({apiKey:Ve,appId:Ct,assistantId:Ie!=null?Ie:"",searchParameters:Dn.searchParameters}):(function(kt){var ut,wt=kt.assistantId,Wt=kt.apiKey,Et=kt.indexName,at=kt.searchParameters,Tn=kt.appId,Rn=kt.abortController,tu=kt.useStagingEnv;return new bc({api:tu?Ds:ys,headers:(ut=Xe(Ae().m(function li(){var Xn;return Ae().w(function(hr){for(;;)switch(hr.n){case 0:if(wt){hr.n=1;break}throw new Error("Ask AI assistant ID is required");case 1:return hr.n=2,fh({assistantId:wt,abortSignal:Rn.signal,useStagingEnv:tu});case 2:return Xn=hr.v,hr.a(2,C(C({},Xn?{authorization:"TOKEN ".concat(Xn)}:{}),{},{"X-Algolia-API-Key":Wt,"X-Algolia-Application-Id":Tn,"X-Algolia-Index-Name":Et,"X-Algolia-Assistant-Id":wt||"","X-AI-SDK-Version":"v5"}))}},li)})),function(){return ut.apply(this,arguments)}),body:at?{searchParameters:at}:{}})})({assistantId:Ie!=null?Ie:"",apiKey:Ve,appId:Ct,indexName:At,searchParameters:Dn.searchParameters,abortController:Ir.current,useStagingEnv:yn})},[Ve,Ct,Ie,At,yn,Dn]),qt=(function(){var kt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ut=kt.experimental_throttle,wt=kt.resume,Wt=wt!==void 0&&wt,Et=Nr(kt,Ev),at=Iu("chat"in Et?Et.chat:new ch(Et));("chat"in Et&&Et.chat!==at.current||"id"in Et&&at.current.id!==Et.id)&&(at.current="chat"in Et?Et.chat:new ch(Et));var Tn="id"in Et?Et.id:null,Rn=pa(function(vr){return at.current["~registerMessagesCallback"](vr,ut)},[ut,Tn]),tu=ha(Rn,function(){return at.current.messages}),li=ha(at.current["~registerStatusCallback"],function(){return at.current.status}),Xn=ha(at.current["~registerErrorCallback"],function(){return at.current.error}),hr=pa(function(vr){typeof vr=="function"&&(vr=vr(at.current.messages)),at.current.messages=vr},[at]);return qn(function(){Wt&&at.current.resumeStream()},[Wt,at]),{id:at.current.id,messages:tu,setMessages:hr,sendMessage:at.current.sendMessage,regenerate:at.current.regenerate,clearError:at.current.clearError,stop:at.current.stop,error:Xn,resumeStream:at.current.resumeStream,status:li,addToolResult:at.current.addToolOutput,addToolOutput:at.current.addToolOutput}})({sendAutomaticallyWhen:Nb,transport:eu}),Ht=qt.messages,Br=qt.sendMessage,Nt=qt.status,fn=qt.setMessages,nn=qt.error,_u=qt.stop,pr=Iu(sd({key:"__DOCSEARCH_ASKAI_CONVERSATIONS__".concat(At),limit:10})).current,ci=pa((function(){var kt=Xe(Ae().m(function ut(wt,Wt){var Et;return Ae().w(function(at){for(;;)switch(at.n){case 0:if(Ie){at.n=1;break}return at.a(2);case 1:return at.n=2,Mb({assistantId:Ie,thumbs:Wt,messageId:wt,appId:Ct,abortSignal:Ir.current.signal,useStagingEnv:yn});case 2:if(!(at.v.status>=300)){at.n=3;break}throw new Error("Failed, try again later.");case 3:(Et=pr.addFeedback)===null||Et===void 0||Et.call(pr,wt,Wt===1?"like":"dislike");case 4:return at.a(2)}},ut)}));return function(ut,wt){return kt.apply(this,arguments)}})(),[Ie,Ct,pr,yn]),So=(function(){var kt=Xe(Ae().m(function ut(){return Ae().w(function(wt){for(;;)switch(wt.n){case 0:return Ir.current.abort(),wt.n=1,_u();case 1:return wt.a(2)}},ut)}));return function(){return kt.apply(this,arguments)}})(),ta=On(function(){for(var kt=[],ut=0;ut<Ht.length;ut++)if(Ht[ut].role==="user"){var wt,Wt=Ht[ut],Et=((wt=Ht[ut+1])===null||wt===void 0?void 0:wt.role)==="assistant"?Ht[ut+1]:null;kt.push({id:Wt.id,userMessage:Wt,assistantMessage:Et}),Et&&ut++}return kt},[Ht]),xo=Nt==="streaming"||Nt==="submitted",Sc=On(function(){if(nn)return Dn.agentStudio?(function(kt){var ut=kt.message;try{var wt=JSON.parse(kt.message);if(wt.name==="ValidationError"){var Wt=wt;if(Wt.detail&&Wt.detail.length>0){var Et=Wt.detail[0],at=Et.msg,Tn=Et.loc.at(-1);ut="".concat(at,": ").concat(Tn)}}else ut=wt.message}catch(Rn){}return new Error(ut)})(nn):nn},[nn,Dn.agentStudio]);return{messages:Ht,sendMessage:Br,status:Nt,setMessages:fn,askAiError:Sc,stopAskAiStreaming:So,isStreaming:xo,exchanges:ta,conversations:pr,sendFeedback:ci}})({assistantId:sr,apiKey:(Bt==null?void 0:Bt.apiKey)||i,appId:(Bt==null?void 0:Bt.appId)||a,indexName:(Bt==null?void 0:Bt.indexName)||xn,searchParameters:cr,useStagingEnv:Jr,agentStudio:Nn}),tn=dr.messages,Zt=dr.status,wr=dr.setMessages,Fo=dr.sendMessage,_o=dr.stopAskAiStreaming,Au=dr.askAiError,Sr=dr.sendFeedback,xr=b.useRef(Zt);b.useEffect(function(){if(!d){if(xr.current==="streaming"&&Zt==="ready"){gn&&tn.at(-1)&&(tn.at(-1).metadata={stopped:!0});var le,Ie=ye(tn[0].parts);try{for(Ie.s();!(le=Ie.n()).done;){var Ve=le.value;Ve.type==="text"&&fr.add(Xm(Ve.text,tn))}}catch(Ct){Ie.e(Ct)}finally{Ie.f()}}xr.current=Zt}},[Zt,tn,fr,d,gn]);var ai=b.useMemo(function(){return Zt==="error"&&Is(Au)},[Zt,Au]),Eu=b.useCallback(function(le){var Ie=le.hierarchy,Ve=["lvl6","lvl5","lvl4","lvl3","lvl2","lvl1","lvl0"].find(function(Ct){return Ie[Ct]});return C(C({},le),{},{type:Ve||"lvl0",content:null})},[]),ii=b.useCallback(function(le){if(!d){var Ie=le.type==="content"?le.__docsearch_parent||Eu(le):le;Ie&&Qn.getAll().findIndex(function(Ve){return Ve.objectID===Ie.objectID})===-1&&kr.add(Ie)}},[Qn,kr,d,Eu]),kc=b.useCallback(function(le){if(Ge.context.algoliaInsightsPlugin&&le.__autocomplete_id){var Ie=le,Ve={eventName:"Item Selected",index:Ie.__autocomplete_indexName,items:[Ie],positions:[le.__autocomplete_id],queryID:Ie.__autocomplete_queryID};Ge.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch(Ve)}},[Ge.context.algoliaInsightsPlugin]),Yn=b.useRef(void 0),Yr=b.useCallback(function(le,Ie){var Ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(le){var Ct={query:Ie,suggestedQuestionId:Ve==null?void 0:Ve.objectID};if($!=null&&$(Ct))return void(Yn.current&&Yn.current.setQuery(""))}if(le&&Fn==="new-conversation"&&$t("initial"),Q(le,{query:Ie,suggestedQuestionId:Ve==null?void 0:Ve.objectID}),!Ce){ui(!1);var At={};if(Ve&&(At.body={suggestedQuestionId:Ve.objectID}),Fo({role:"user",parts:[{type:"text",text:Ie}]},At),Mt.current){var ln=Mt.current;typeof ln.scrollTo=="function"?ln.scrollTo({top:0,behavior:"smooth"}):ln.scrollTop=0}Yn.current&&Yn.current.setQuery("")}},[Q,$,Fo,Fn,$t,Ce]),wc=b.useCallback((function(){var le=Xe(Ae().m(function Ie(Ve,Ct){return Ae().w(function(At){for(;;)switch(At.n){case 0:if(sr&&a){At.n=1;break}return At.a(2);case 1:return At.n=2,Sr(Ve,Ct);case 2:return At.a(2)}},Ie)}));return function(Ie,Ve){return le.apply(this,arguments)}})(),[sr,a,Sr]);Yn.current||(Yn.current=lm({id:"docsearch",defaultActiveItemId:0,openOnFocus:!0,initialState:{query:ke,context:{searchSuggestions:[]}},insights:!!ne,navigator:w,onStateChange:function(le){yt(le.state)},getSources:function(le){var Ie=le.query,Ve=le.state,Ct=le.setContext,At=le.setStatus;if(!Ie){var ln=(function(qt){var Ht=qt.recentSearches,Br=qt.favoriteSearches,Nt=qt.saveRecentSearch,fn=qt.onClose;return qt.disableUserPersonalization?[]:[{sourceId:"recentSearches",onSelect:function(nn){var _u=nn.item,pr=nn.event;Nt(_u),_i(pr)||fn()},getItemUrl:function(nn){return nn.item.url},getItems:function(){return Ht.getAll()}},{sourceId:"favoriteSearches",onSelect:function(nn){var _u=nn.item,pr=nn.event;Nt(_u),_i(pr)||fn()},getItemUrl:function(nn){return nn.item.url},getItems:function(){return Br.getAll()}}]})({recentSearches:kr,favoriteSearches:Qn,saveRecentSearch:ii,onClose:m,disableUserPersonalization:d,canHandleAskAi:Dt}),yn=Dt?[{sourceId:"recentConversations",getItems:function(){return d?[]:fr.getAll()},onSelect:function(qt){var Ht=qt.item;Ht.messages&&(wr(Ht.messages),Q(!0))}}]:[];return[].concat(be(ln),yn)}var Dn={context:Ve.context},Ir=oA({query:Ie,state:Dn,setContext:Ct,setStatus:At,searchClient:Ut,indexes:lr,snippetLength:Jt,insights:!!ne,appId:a,apiKey:i,maxResultsPerGroup:c,transformItems:y,saveRecentSearch:ii,onClose:m}),eu=Dt?[{sourceId:"askAI",getItems:function(){return[{type:"askAI",query:Ie,url_without_anchor:"",objectID:"ask-ai-button",content:null,url:"",anchor:null,hierarchy:{lvl0:"Ask AI",lvl1:Ie,lvl2:null,lvl3:null,lvl4:null,lvl5:null,lvl6:null},_highlightResult:{},_snippetResult:{},__docsearch_parent:null}]},onSelect:function(qt){var Ht=qt.item;Ht.type==="askAI"&&Ht.query&&Yr(!0,Ht.query)}}]:[];return Ir.then(function(qt){return[].concat(eu,be(qt))})}}));var Co,Tr,Or=Yn.current,Xr=Or.getEnvironmentProps,ko=Or.getRootProps,ea=Or.refresh;(function(le){var Ie=le.getEnvironmentProps,Ve=le.panelElement,Ct=le.formElement,At=le.inputElement;b.useEffect(function(){if(Ve&&Ct&&At){var ln=Ie({panelElement:Ve,formElement:Ct,inputElement:At}),yn=ln.onTouchStart,Dn=ln.onTouchMove;return window.addEventListener("touchstart",yn),window.addEventListener("touchmove",Dn),function(){window.removeEventListener("touchstart",yn),window.removeEventListener("touchmove",Dn)}}},[Ie,Ve,Ct,At])})({getEnvironmentProps:Xr,panelElement:Mt.current,formElement:Gn.current,inputElement:Gt.current}),Co={container:Xt.current},Tr=Co.container,b.useEffect(function(){if(Tr){var le=Tr.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), input:not([disabled])"),Ie=le[0],Ve=le[le.length-1];return Tr.addEventListener("keydown",Ct),function(){Tr.removeEventListener("keydown",Ct)}}function Ct(At){At.key==="Tab"&&(At.shiftKey?document.activeElement===Ie&&(At.preventDefault(),Ve.focus()):document.activeElement===Ve&&(At.preventDefault(),Ie.focus()))}},[Tr]),Jl({theme:l}),b.useEffect(function(){return document.body.classList.add("DocSearch--active"),function(){var le,Ie;document.body.classList.remove("DocSearch--active"),(le=(Ie=window).scrollTo)===null||le===void 0||le.call(Ie,0,S)}},[]),b.useEffect(function(){typeof window!="undefined"&&window.localStorage&&(function(){if(typeof window=="undefined"||!window.localStorage)return 0;var le=0;for(var Ie in window.localStorage)window.localStorage.hasOwnProperty(Ie)&&(le+=window.localStorage[Ie].length+Ie.length);return le})()>4194304&&ad()},[]),b.useLayoutEffect(function(){var le=window.innerWidth-document.body.clientWidth;return document.body.style.marginInlineEnd="".concat(le,"px"),function(){document.body.style.marginInlineEnd="0px"}},[]),b.useEffect(function(){window.matchMedia("(max-width: 768px)").matches&&(Jt.current=5)},[]),b.useEffect(function(){var le;Mt.current&&!re&&(typeof(le=Mt.current).scrollTo=="function"?le.scrollTo({top:0,behavior:"smooth"}):le.scrollTop=0)},[Ge.query,re]),b.useEffect(function(){ke.length>0&&(ea(),Gt.current&&Gt.current.focus())},[ke,ea]),b.useEffect(function(){function le(){if(un.current){var Ie=.01*window.innerHeight;un.current.style.setProperty("--docsearch-vh","".concat(Ie,"px"))}}return le(),window.addEventListener("resize",le),function(){window.removeEventListener("resize",le)}},[]),b.useEffect(function(){re||(Or.refresh(),wr([]))},[re,Or,wr]),b.useEffect(function(){$t("initial")},[re,$t]);var oi=(function(){var le=Xe(Ae().m(function Ie(){return Ae().w(function(Ve){for(;;)switch(Ve.n){case 0:return ui(!0),Ve.n=1,_o();case 1:return Ve.a(2)}},Ie)}));return function(){return le.apply(this,arguments)}})(),Fu=function(){wr([]),$t("new-conversation")},si=!0,wo=Ge.collections.some(function(le){return le.items.length>0});return Ge.status!=="idle"||wo!==!1||Ge.query.length!==0||re||(si=!1),b.createElement("div",Tt({ref:Xt},ko({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container",Ge.status==="stalled"&&"DocSearch-Container--Stalled",Ge.status==="error"&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(le){le.target===le.currentTarget&&m()}}),b.createElement("div",{className:"DocSearch-Modal",ref:un},b.createElement("header",{className:"DocSearch-SearchBar",ref:Gn},b.createElement(x0,Tt({},Or,{state:Ge,placeholder:mn||"Search docs",autoFocus:ke.length===0,inputRef:Gt,isFromSelection:!!ke&&ke===en,translations:Te,isAskAiActive:re,askAiStatus:Zt,askAiError:Au,askAiState:Fn,setAskAiState:$t,isThreadDepthError:ai&&Fn!=="new-conversation",onClose:m,onAskAiToggle:Q,onAskAgain:function(le){Yr(!0,le)},onStopAskAiStreaming:oi,onNewConversation:Fu,onViewConversationHistory:function(){$t("conversation-history")}}))),si&&b.createElement("div",{className:"DocSearch-Dropdown",ref:Mt},b.createElement(_0,Tt({},Or,{indexName:xn,state:Ge,hitComponent:D,resultsFooterComponent:O,disableUserPersonalization:d,recentSearches:kr,favoriteSearches:Qn,conversations:fr,inputRef:Gt,translations:He,getMissingResultsUrl:G,isAskAiActive:re,canHandleAskAi:Dt,messages:tn,askAiError:Au,status:Zt,hasCollections:wo,askAiState:Fn,selectAskAiQuestion:Yr,suggestedQuestions:Jn,selectSuggestedQuestion:function(le){Yr(!0,le.question,le)},agentStudio:Nn,onAskAiToggle:Q,onNewConversation:Fu,onItemClick:function(le,Ie){if(le.type==="askAI"&&le.query){if(le.anchor==="stored"&&"messages"in le){wr(le.messages);var Ve={query:le.query,messageId:le.messages[0].id};if($!=null&&$(Ve))return Yn.current&&Yn.current.setQuery(""),void Ie.preventDefault();Q(!0,Ve)}else Yr(!0,le.query);return $t("initial"),void Ie.preventDefault()}kc(le),ii(le),_i(Ie)||m()},onFeedback:wc}))),b.createElement("footer",{className:"DocSearch-Footer"},b.createElement(dm,{translations:ge,isAskAiActive:re}))))}var cA=b.forwardRef(function(e,t){return b.createElement(Hl,Tt({},e,{ref:t}),b.createElement(lA,e))});function lA(e){var t,n,r,u=(function(){var y=b.useContext(us);if(y===void 0)throw new Error("`useDocSearch` must be used within the `DocSearch` provider");return y})(),a=u.searchButtonRef,i=u.keyboardShortcuts,o=u.isModalActive,c=u.isAskAiActive,l=u.initialQuery,p=u.onAskAiToggle,m=u.openModal,v=u.closeModal;return b.createElement(b.Fragment,null,b.createElement(wv,{keyboardShortcuts:i,ref:a,translations:(t=e.translations)===null||t===void 0?void 0:t.button,onClick:m}),o&&Il(b.createElement(sA,Tt({},e,{initialScrollY:window.scrollY,initialQuery:l,translations:e==null||(n=e.translations)===null||n===void 0?void 0:n.modal,isAskAiActive:c,onAskAiToggle:p,onClose:v})),(r=e.portalContainer)!==null&&r!==void 0?r:document.body))}var yh=function(e,t,n,r){var u;t[0]=0;for(var a=1;a<t.length;a++){var i=t[a++],o=t[a]?(t[0]|=i?1:2,n[t[a++]]):t[++a];i===3?r[0]=o:i===4?r[1]=Object.assign(r[1]||{},o):i===5?(r[1]=r[1]||{})[t[++a]]=o:i===6?r[1][t[++a]]+=o+"":i?(u=e.apply(o,yh(e,o,n,["",null])),r.push(u),o[0]?t[0]|=2:(t[a-2]=0,t[a]=u)):r.push(o)}return r},Dh=new Map,fA=["container","environment","transformSearchClient","hitComponent","resultsFooterComponent"],dA=function(e){var t=Dh.get(this);return t||(t=new Map,Dh.set(this,t)),(t=yh(this,t.get(e)||(t.set(e,t=(function(n){for(var r,u,a=1,i="",o="",c=[0],l=function(v){a===1&&(v||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,v,i):a===3&&(v||i)?(c.push(3,v,i),a=2):a===2&&i==="..."&&v?c.push(4,v,0):a===2&&i&&!v?c.push(5,0,!0,i):a>=5&&((i||!v&&a===5)&&(c.push(a,0,i,u),a=6),v&&(c.push(a,v,0,u),a=6)),i=""},p=0;p<n.length;p++){p&&(a===1&&l(),l(p));for(var m=0;m<n[p].length;m++)r=n[p][m],a===1?r==="<"?(l(),c=[c],a=3):i+=r:a===4?i==="--"&&r===">"?(a=1,i=""):i=r+i[0]:o?r===o?o="":i+=r:r==='"'||r==="'"?o=r:r===">"?(l(),a=1):a&&(r==="="?(a=5,u=i,i=""):r==="/"&&(a<5||n[p][m+1]===">")?(l(),a===3&&(c=c[0]),a=c,(c=c[0]).push(2,0,a),a=0):r===" "||r===" "||r===`
118
+ ]`):(o+=i[m],i[m]==="\\"?c=!0:l&&i[m]==="]"?l=!1:l||i[m]!=="["||(l=!0))}try{new RegExp(o)}catch(v){return console.warn("Could not convert regex pattern at ".concat(t.currentPath.join("/")," to a flag-independent form! Falling back to the flag-ignorant source")),e.source}return o}function Wp(e,t){var n,r,u,a,i,o,c={type:"object",additionalProperties:(n=_t(e.valueType._def,pe(pe({},t),{},{currentPath:[].concat(Qe(t.currentPath),["additionalProperties"])})))!=null?n:t.allowedAdditionalProperties};if(((r=e.keyType)==null?void 0:r._def.typeName)===ve.ZodString&&((u=e.keyType._def.checks)!=null&&u.length)){var l=Hp(e.keyType._def,t);l.type;var p=Nr(l,mv);return pe(pe({},c),{},{propertyNames:p})}if(((a=e.keyType)==null?void 0:a._def.typeName)===ve.ZodEnum)return pe(pe({},c),{},{propertyNames:{enum:e.keyType._def.values}});if(((i=e.keyType)==null?void 0:i._def.typeName)===ve.ZodBranded&&e.keyType._def.type._def.typeName===ve.ZodString&&((o=e.keyType._def.type._def.checks)!=null&&o.length)){var m=Zp(e.keyType._def,t);m.type;var v=Nr(m,gv);return pe(pe({},c),{},{propertyNames:v})}return c}var vc={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function pb(e){try{return e.isOptional()}catch(t){return!0}}var hb=function(e,t,n){switch(t){case ve.ZodString:return Hp(e,n);case ve.ZodNumber:return(function(r){var u={type:"number"};if(!r.checks)return u;var a,i=Su(r.checks);try{for(i.s();!(a=i.n()).done;){var o=a.value;switch(o.kind){case"int":u.type="integer";break;case"min":o.inclusive?u.minimum=o.value:u.exclusiveMinimum=o.value;break;case"max":o.inclusive?u.maximum=o.value:u.exclusiveMaximum=o.value;break;case"multipleOf":u.multipleOf=o.value}}}catch(c){i.e(c)}finally{i.f()}return u})(e);case ve.ZodObject:return(function(r,u){var a={type:"object",properties:{}},i=[],o=r.shape();for(var c in o){var l=o[c];if(l!==void 0&&l._def!==void 0){var p=pb(l),m=_t(l._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["properties",c]),propertyPath:[].concat(Qe(u.currentPath),["properties",c])}));m!==void 0&&(a.properties[c]=m,p||i.push(c))}}i.length&&(a.required=i);var v=(function(y,F){if(y.catchall._def.typeName!=="ZodNever")return _t(y.catchall._def,pe(pe({},F),{},{currentPath:[].concat(Qe(F.currentPath),["additionalProperties"])}));switch(y.unknownKeys){case"passthrough":return F.allowedAdditionalProperties;case"strict":return F.rejectedAdditionalProperties;case"strip":return F.removeAdditionalStrategy==="strict"?F.allowedAdditionalProperties:F.rejectedAdditionalProperties}})(r,u);return v!==void 0&&(a.additionalProperties=v),a})(e,n);case ve.ZodBigInt:return(function(r){var u={type:"integer",format:"int64"};if(!r.checks)return u;var a,i=Su(r.checks);try{for(i.s();!(a=i.n()).done;){var o=a.value;switch(o.kind){case"min":o.inclusive?u.minimum=o.value:u.exclusiveMinimum=o.value;break;case"max":o.inclusive?u.maximum=o.value:u.exclusiveMaximum=o.value;break;case"multipleOf":u.multipleOf=o.value}}}catch(c){i.e(c)}finally{i.f()}return u})(e);case ve.ZodBoolean:return{type:"boolean"};case ve.ZodDate:return qp(e,n);case ve.ZodUndefined:return{not:{}};case ve.ZodNull:return{type:"null"};case ve.ZodArray:return(function(r,u){var a,i,o,c={type:"array"};return(a=r.type)!=null&&a._def&&((o=(i=r.type)==null?void 0:i._def)==null?void 0:o.typeName)!==ve.ZodAny&&(c.items=_t(r.type._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items"])}))),r.minLength&&(c.minItems=r.minLength.value),r.maxLength&&(c.maxItems=r.maxLength.value),r.exactLength&&(c.minItems=r.exactLength.value,c.maxItems=r.exactLength.value),c})(e,n);case ve.ZodUnion:case ve.ZodDiscriminatedUnion:return(function(r,u){var a=r.options instanceof Map?Array.from(r.options.values()):r.options;if(a.every(function(l){return l._def.typeName in vc&&(!l._def.checks||!l._def.checks.length)})){var i=a.reduce(function(l,p){var m=vc[p._def.typeName];return m&&!l.includes(m)?[].concat(Qe(l),[m]):l},[]);return{type:i.length>1?i:i[0]}}if(a.every(function(l){return l._def.typeName==="ZodLiteral"&&!l.description})){var o=a.reduce(function(l,p){var m=we(p._def.value);switch(m){case"string":case"number":case"boolean":return[].concat(Qe(l),[m]);case"bigint":return[].concat(Qe(l),["integer"]);case"object":if(p._def.value===null)return[].concat(Qe(l),["null"]);default:return l}},[]);if(o.length===a.length){var c=o.filter(function(l,p,m){return m.indexOf(l)===p});return{type:c.length>1?c:c[0],enum:a.reduce(function(l,p){return l.includes(p._def.value)?l:[].concat(Qe(l),[p._def.value])},[])}}}else if(a.every(function(l){return l._def.typeName==="ZodEnum"}))return{type:"string",enum:a.reduce(function(l,p){return[].concat(Qe(l),Qe(p._def.values.filter(function(m){return!l.includes(m)})))},[])};return(function(l,p){var m=(l.options instanceof Map?Array.from(l.options.values()):l.options).map(function(v,y){return _t(v._def,pe(pe({},p),{},{currentPath:[].concat(Qe(p.currentPath),["anyOf","".concat(y)])}))}).filter(function(v){return!!v&&(!p.strictUnions||we(v)=="object"&&Object.keys(v).length>0)});return m.length?{anyOf:m}:void 0})(r,u)})(e,n);case ve.ZodIntersection:return(function(r,u){var a=[_t(r.left._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf","0"])})),_t(r.right._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf","1"])}))].filter(function(o){return!!o}),i=[];return a.forEach(function(o){if("type"in(l=o)&&l.type==="string"||!("allOf"in l)){var c=o;"additionalProperties"in o&&o.additionalProperties===!1&&(o.additionalProperties,c=Nr(o,yv)),i.push(c)}else i.push.apply(i,Qe(o.allOf));var l}),i.length?{allOf:i}:void 0})(e,n);case ve.ZodTuple:return(function(r,u){return r.rest?{type:"array",minItems:r.items.length,items:r.items.map(function(a,i){return _t(a._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","".concat(i)])}))}).reduce(function(a,i){return i===void 0?a:[].concat(Qe(a),[i])},[]),additionalItems:_t(r.rest._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["additionalItems"])}))}:{type:"array",minItems:r.items.length,maxItems:r.items.length,items:r.items.map(function(a,i){return _t(a._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","".concat(i)])}))}).reduce(function(a,i){return i===void 0?a:[].concat(Qe(a),[i])},[])}})(e,n);case ve.ZodRecord:return Wp(e,n);case ve.ZodLiteral:return(function(r){var u=we(r.value);return u!=="bigint"&&u!=="number"&&u!=="boolean"&&u!=="string"?{type:Array.isArray(r.value)?"array":"object"}:{type:u==="bigint"?"integer":u,const:r.value}})(e);case ve.ZodEnum:return(function(r){return{type:"string",enum:Array.from(r.values)}})(e);case ve.ZodNativeEnum:return(function(r){var u=r.values,a=Object.keys(r.values).filter(function(o){return typeof u[u[o]]!="number"}).map(function(o){return u[o]}),i=Array.from(new Set(a.map(function(o){return we(o)})));return{type:i.length===1?i[0]==="string"?"string":"number":["string","number"],enum:a}})(e);case ve.ZodNullable:return(function(r,u){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(r.innerType._def.typeName)&&(!r.innerType._def.checks||!r.innerType._def.checks.length))return{type:[vc[r.innerType._def.typeName],"null"]};var a=_t(r.innerType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["anyOf","0"])}));return a&&{anyOf:[a,{type:"null"}]}})(e,n);case ve.ZodOptional:return(function(r,u){var a;if(u.currentPath.toString()===((a=u.propertyPath)==null?void 0:a.toString()))return _t(r.innerType._def,u);var i=_t(r.innerType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["anyOf","1"])}));return i?{anyOf:[{not:{}},i]}:{}})(e,n);case ve.ZodMap:return(function(r,u){return u.mapStrategy==="record"?Wp(r,u):{type:"array",maxItems:125,items:{type:"array",items:[_t(r.keyType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","items","0"])}))||{},_t(r.valueType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items","items","1"])}))||{}],minItems:2,maxItems:2}}})(e,n);case ve.ZodSet:return(function(r,u){var a={type:"array",uniqueItems:!0,items:_t(r.valueType._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["items"])}))};return r.minSize&&(a.minItems=r.minSize.value),r.maxSize&&(a.maxItems=r.maxSize.value),a})(e,n);case ve.ZodLazy:return function(){return e.getter()._def};case ve.ZodPromise:return(function(r,u){return _t(r.type._def,u)})(e,n);case ve.ZodNaN:case ve.ZodNever:return{not:{}};case ve.ZodEffects:return(function(r,u){return u.effectStrategy==="input"?_t(r.schema._def,u):{}})(e,n);case ve.ZodAny:case ve.ZodUnknown:return{};case ve.ZodDefault:return(function(r,u){return pe(pe({},_t(r.innerType._def,u)),{},{default:r.defaultValue()})})(e,n);case ve.ZodBranded:return Zp(e,n);case ve.ZodReadonly:case ve.ZodCatch:return(function(r,u){return _t(r.innerType._def,u)})(e,n);case ve.ZodPipeline:return(function(r,u){if(u.pipeStrategy==="input")return _t(r.in._def,u);if(u.pipeStrategy==="output")return _t(r.out._def,u);var a=_t(r.in._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf","0"])}));return{allOf:[a,_t(r.out._def,pe(pe({},u),{},{currentPath:[].concat(Qe(u.currentPath),["allOf",a?"1":"0"])}))].filter(function(i){return i!==void 0})}})(e,n);case ve.ZodFunction:case ve.ZodVoid:case ve.ZodSymbol:default:return}};function _t(e,t){var n,r=arguments.length>2&&arguments[2]!==void 0&&arguments[2],u=t.seen.get(e);if(t.override){var a=(n=t.override)==null?void 0:n.call(t,e,t,u,r);if(a!==XD)return a}if(u&&!r){var i=vb(u,t);if(i!==void 0)return i}var o={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,o);var c=hb(e,e.typeName,t),l=typeof c=="function"?_t(c(),t):c;if(l&&mb(e,t,l),t.postProcess){var p=t.postProcess(l,e,t);return o.jsonSchema=l,p}return o.jsonSchema=l,l}var vb=function(e,t){switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:YD(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every(function(n,r){return t.currentPath[r]===n})?(console.warn("Recursive reference detected at ".concat(t.currentPath.join("/"),"! Defaulting to any")),{}):t.$refStrategy==="seen"?{}:void 0}},mb=function(e,t,n){return e.description&&(n.description=e.description),n},gb=function(e,t){var n,r=(function(l){var p=(function(v){return typeof v=="string"?pe(pe({},$p),{},{name:v}):pe(pe({},$p),v)})(l),m=p.name!==void 0?[].concat(Qe(p.basePath),[p.definitionPath,p.name]):p.basePath;return pe(pe({},p),{},{currentPath:m,propertyPath:void 0,seen:new Map(Object.entries(p.definitions).map(function(v){var y=Ro(v,2),F=y[0],D=y[1];return[D._def,{def:D._def,path:[].concat(Qe(p.basePath),[p.definitionPath,F]),jsonSchema:void 0}]}))})})(t),u=we(t)=="object"&&t.definitions?Object.entries(t.definitions).reduce(function(l,p){var m,v=Ro(p,2),y=v[0],F=v[1];return pe(pe({},l),{},Zn({},y,(m=_t(F._def,pe(pe({},r),{},{currentPath:[].concat(Qe(r.basePath),[r.definitionPath,y])}),!0))!=null?m:{}))},{}):void 0,a=typeof t=="string"?t:(t==null?void 0:t.nameStrategy)==="title"||t==null?void 0:t.name,i=(n=_t(e._def,a===void 0?r:pe(pe({},r),{},{currentPath:[].concat(Qe(r.basePath),[r.definitionPath,a])}),!1))!=null?n:{},o=we(t)=="object"&&t.name!==void 0&&t.nameStrategy==="title"?t.name:void 0;o!==void 0&&(i.title=o);var c=a===void 0?u?pe(pe({},i),{},Zn({},r.definitionPath,u)):i:Zn({$ref:[].concat(Qe(r.$refStrategy==="relative"?[]:r.basePath),[r.definitionPath,a]).join("/")},r.definitionPath,pe(pe({},u),{},Zn({},a,i)));return c.$schema="http://json-schema.org/draft-07/schema#",c};function Vp(e,t){return(function(n){return"_zod"in n})(e)?(function(n){return gc(function(){return(function(u,a){if(u instanceof ep){var i,o=new dp(a),c={},l=ye(u._idmap.entries());try{for(l.s();!(i=l.n()).done;){var p=dt(i.value,2),m=(p[0],p[1]);o.process(m)}}catch(T){l.e(T)}finally{l.f()}var v,y={},F={registry:u,uri:a==null?void 0:a.uri,defs:c},D=ye(u._idmap.entries());try{for(D.s();!(v=D.n()).done;){var _=dt(v.value,2),O=_[0],w=_[1];y[O]=o.emit(w,C(C({},a),{},{external:F}))}}catch(T){D.e(T)}finally{D.f()}if(Object.keys(c).length>0){var x=o.target==="draft-2020-12"?"$defs":"definitions";y.__shared=lt({},x,c)}return{schemas:y}}var S=new dp(a);return S.process(u),S.emit(u,a)})(n,{target:"draft-7",io:"output",reused:"inline"})},{validate:(r=vt(Oe().m(function u(a){var i;return Oe().w(function(o){for(;;)switch(o.n){case 0:return o.n=1,pp(n,a);case 1:return i=o.v,o.a(2,i.success?{success:!0,value:i.data}:{success:!1,error:i.error})}},u)})),function(u){return r.apply(this,arguments)})});var r})(e):(function(n){return gc(function(){return gb(n,{$refStrategy:"none"})},{validate:(r=vt(Oe().m(function u(a){var i;return Oe().w(function(o){for(;;)switch(o.n){case 0:return o.n=1,n.safeParseAsync(a);case 1:return i=o.v,o.a(2,i.success?{success:!0,value:i.data}:{success:!1,error:i.error})}},u)})),function(u){return r.apply(this,arguments)})});var r})(e)}var mc=Symbol.for("vercel.ai.schema");function gc(e){var t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{}).validate;return Zn((function(n,r,u,a){var i={configurable:!0,enumerable:!0};return i[n]=a,Object.defineProperty(r,u,i)})("get",Zn(Zn(Zn({},mc,!0),"_type",void 0),go,!0),"jsonSchema",function(){return typeof e=="function"&&(e=e()),e}),"validate",t)}var Kp,yb=Object.defineProperty,Gp="AI_NoObjectGeneratedError",Jp="vercel.ai.error.".concat(Gp),Db=Symbol.for(Jp),Qp=(function(){function e(t){var n,r=t.message,u=r===void 0?"No object generated.":r,a=t.cause,i=t.text,o=t.response,c=t.usage,l=t.finishReason;return Mn(this,e),(n=au(this,e,[{name:Gp,message:u,cause:a}]))[Kp]=!0,n.text=i,n.response=o,n.usage=c,n.finishReason=l,n}return iu(e,Zr),$n(e,null,[{key:"isInstance",value:function(t){return Zr.hasMarker(t,Jp)}}])})();Kp=Db;var Yp="5.0.93",Xp=Pn([ze(),to(Uint8Array),to(ArrayBuffer),Sp(function(e){var t,n;return(n=(t=globalThis.Buffer)==null?void 0:t.isBuffer(e))!=null&&n},{message:"Must be a Buffer"})]),Xa=new ED({type:"lazy",getter:function(){return Pn([oD(),ze(),rD(),An(),Us(ze(),Xa),Wu(Xa)])}}),Kt=Us(ze(),Us(ze(),Xa)),eh=sn({type:Ye("text"),text:ze(),providerOptions:Kt.optional()}),bb=sn({type:Ye("image"),image:Pn([Xp,to(URL)]),mediaType:ze().optional(),providerOptions:Kt.optional()}),th=sn({type:Ye("file"),data:Pn([Xp,to(URL)]),filename:ze().optional(),mediaType:ze(),providerOptions:Kt.optional()}),Ab=sn({type:Ye("reasoning"),text:ze(),providerOptions:Kt.optional()}),Eb=sn({type:Ye("tool-call"),toolCallId:ze(),toolName:ze(),input:rr(),providerOptions:Kt.optional(),providerExecuted:An().optional()}),Fb=new fD(C({type:"union",options:[sn({type:Ye("text"),value:ze()}),sn({type:Ye("json"),value:Xa}),sn({type:Ye("error-text"),value:ze()}),sn({type:Ye("error-json"),value:Xa}),sn({type:Ye("content"),value:Wu(Pn([sn({type:Ye("text"),text:ze()}),sn({type:Ye("media"),data:ze(),mediaType:ze()})]))})],discriminator:"type"},xe(void 0))),nh=sn({type:Ye("tool-result"),toolCallId:ze(),toolName:ze(),output:Fb,providerOptions:Kt.optional()}),_b=sn({role:Ye("system"),content:ze(),providerOptions:Kt.optional()}),Cb=sn({role:Ye("user"),content:Pn([ze(),Wu(Pn([eh,bb,th]))]),providerOptions:Kt.optional()}),kb=sn({role:Ye("assistant"),content:Pn([ze(),Wu(Pn([eh,th,Ab,Eb,nh]))]),providerOptions:Kt.optional()});Pn([_b,Cb,kb,sn({role:Ye("tool"),content:Wu(nh),providerOptions:Kt.optional()})]),Ya({prefix:"aitxt",size:24}),TransformStream;var wb=(function(){var e;return function(){return e==null&&(e=Vp(Pn([Lt({type:Ye("text-start"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("text-delta"),id:ze(),delta:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("text-end"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("error"),errorText:ze()}),Lt({type:Ye("tool-input-start"),toolCallId:ze(),toolName:ze(),providerExecuted:An().optional(),dynamic:An().optional()}),Lt({type:Ye("tool-input-delta"),toolCallId:ze(),inputTextDelta:ze()}),Lt({type:Ye("tool-input-available"),toolCallId:ze(),toolName:ze(),input:rr(),providerExecuted:An().optional(),providerMetadata:Kt.optional(),dynamic:An().optional()}),Lt({type:Ye("tool-input-error"),toolCallId:ze(),toolName:ze(),input:rr(),providerExecuted:An().optional(),providerMetadata:Kt.optional(),dynamic:An().optional(),errorText:ze()}),Lt({type:Ye("tool-output-available"),toolCallId:ze(),output:rr(),providerExecuted:An().optional(),dynamic:An().optional(),preliminary:An().optional()}),Lt({type:Ye("tool-output-error"),toolCallId:ze(),errorText:ze(),providerExecuted:An().optional(),dynamic:An().optional()}),Lt({type:Ye("reasoning-start"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("reasoning-delta"),id:ze(),delta:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("reasoning-end"),id:ze(),providerMetadata:Kt.optional()}),Lt({type:Ye("source-url"),sourceId:ze(),url:ze(),title:ze().optional(),providerMetadata:Kt.optional()}),Lt({type:Ye("source-document"),sourceId:ze(),mediaType:ze(),title:ze(),filename:ze().optional(),providerMetadata:Kt.optional()}),Lt({type:Ye("file"),url:ze(),mediaType:ze(),providerMetadata:Kt.optional()}),Lt({type:Sp(function(t){return typeof t=="string"&&t.startsWith("data-")},{message:'Type must start with "data-"'}),id:ze().optional(),data:rr(),transient:An().optional()}),Lt({type:Ye("start-step")}),Lt({type:Ye("finish-step")}),Lt({type:Ye("start"),messageId:ze().optional(),messageMetadata:rr().optional()}),Lt({type:Ye("finish"),finishReason:Ap(["stop","length","content-filter","tool-calls","error","other","unknown"]).optional(),messageMetadata:rr().optional()}),Lt({type:Ye("abort")}),Lt({type:Ye("message-metadata"),messageMetadata:rr()})]))),e}})();function rh(e,t){if(e!==void 0||t!==void 0){if(e===void 0)return t;if(t===void 0)return e;var n=pe({},e);for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var u=t[r];if(u===void 0)continue;var a=r in e?e[r]:void 0,i=!(u===null||we(u)!="object"||Array.isArray(u)||u instanceof Date||u instanceof RegExp),o=!(a==null||we(a)!="object"||Array.isArray(a)||a instanceof Date||a instanceof RegExp);n[r]=i&&o?rh(a,u):u}return n}}function Sb(e){var t=["ROOT"],n=-1,r=null;function u(y,F,D){switch(y){case'"':n=F,t.pop(),t.push(D),t.push("INSIDE_STRING");break;case"f":case"t":case"n":n=F,r=F,t.pop(),t.push(D),t.push("INSIDE_LITERAL");break;case"-":t.pop(),t.push(D),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=F,t.pop(),t.push(D),t.push("INSIDE_NUMBER");break;case"{":n=F,t.pop(),t.push(D),t.push("INSIDE_OBJECT_START");break;case"[":n=F,t.pop(),t.push(D),t.push("INSIDE_ARRAY_START")}}function a(y,F){switch(y){case",":t.pop(),t.push("INSIDE_OBJECT_AFTER_COMMA");break;case"}":n=F,t.pop()}}function i(y,F){switch(y){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=F,t.pop()}}for(var o=0;o<e.length;o++){var c=e[o];switch(t[t.length-1]){case"ROOT":u(c,o,"FINISH");break;case"INSIDE_OBJECT_START":switch(c){case'"':t.pop(),t.push("INSIDE_OBJECT_KEY");break;case"}":n=o,t.pop()}break;case"INSIDE_OBJECT_AFTER_COMMA":c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_KEY"));break;case"INSIDE_OBJECT_KEY":c==='"'&&(t.pop(),t.push("INSIDE_OBJECT_AFTER_KEY"));break;case"INSIDE_OBJECT_AFTER_KEY":c===":"&&(t.pop(),t.push("INSIDE_OBJECT_BEFORE_VALUE"));break;case"INSIDE_OBJECT_BEFORE_VALUE":u(c,o,"INSIDE_OBJECT_AFTER_VALUE");break;case"INSIDE_OBJECT_AFTER_VALUE":a(c,o);break;case"INSIDE_STRING":switch(c){case'"':t.pop(),n=o;break;case"\\":t.push("INSIDE_STRING_ESCAPE");break;default:n=o}break;case"INSIDE_ARRAY_START":c==="]"?(n=o,t.pop()):(n=o,u(c,o,"INSIDE_ARRAY_AFTER_VALUE"));break;case"INSIDE_ARRAY_AFTER_VALUE":switch(c){case",":t.pop(),t.push("INSIDE_ARRAY_AFTER_COMMA");break;case"]":n=o,t.pop();break;default:n=o}break;case"INSIDE_ARRAY_AFTER_COMMA":u(c,o,"INSIDE_ARRAY_AFTER_VALUE");break;case"INSIDE_STRING_ESCAPE":t.pop(),n=o;break;case"INSIDE_NUMBER":switch(c){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":n=o;break;case"e":case"E":case"-":case".":break;case",":t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,o),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,o);break;case"}":t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"&&a(c,o);break;case"]":t.pop(),t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,o);break;default:t.pop()}break;case"INSIDE_LITERAL":var l=e.substring(r,o+1);"false".startsWith(l)||"true".startsWith(l)||"null".startsWith(l)?n=o:(t.pop(),t[t.length-1]==="INSIDE_OBJECT_AFTER_VALUE"?a(c,o):t[t.length-1]==="INSIDE_ARRAY_AFTER_VALUE"&&i(c,o))}}for(var p=e.slice(0,n+1),m=t.length-1;m>=0;m--)switch(t[m]){case"INSIDE_STRING":p+='"';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":p+="}";break;case"INSIDE_ARRAY_START":case"INSIDE_ARRAY_AFTER_COMMA":case"INSIDE_ARRAY_AFTER_VALUE":p+="]";break;case"INSIDE_LITERAL":var v=e.substring(r,e.length);"true".startsWith(v)?p+="true".slice(v.length):"false".startsWith(v)?p+="false".slice(v.length):"null".startsWith(v)&&(p+="null".slice(v.length))}return p}function uh(e){return yc.apply(this,arguments)}function yc(){return yc=vt(Oe().m(function e(t){var n,r;return Oe().w(function(u){for(;;)switch(u.n){case 0:if(t!==void 0){u.n=1;break}return u.a(2,{value:void 0,state:"undefined-input"});case 1:return u.n=2,yo({text:t});case 2:if(!(n=u.v).success){u.n=3;break}r={value:n.value,state:"successful-parse"},u.n=5;break;case 3:return u.n=4,yo({text:Sb(t)});case 4:n=u.v,r=n.success?{value:n.value,state:"repaired-parse"}:{value:void 0,state:"failed-parse"};case 5:return u.a(2,r)}},e)})),yc.apply(this,arguments)}function Do(e){return e.type.startsWith("tool-")}function Dc(e){return Do(e)||(function(t){return t.type==="dynamic-tool"})(e)}function ah(e){return e.type.split("-").slice(1).join("-")}function xb(e){var t=e.lastMessage,n=e.messageId;return{message:(t==null?void 0:t.role)==="assistant"?t:{id:n,metadata:void 0,role:"assistant",parts:[]},activeTextParts:{},activeReasoningParts:{},partialToolCalls:{}}}function Tb(e){var t=e.stream,n=e.messageMetadataSchema,r=e.dataPartSchemas,u=e.runUpdateMessageJob,a=e.onError,i=e.onToolCall,o=e.onData;return t.pipeThrough(new TransformStream({transform:function(c,l){return vt(Oe().m(function p(){return Oe().w(function(m){for(;;)switch(m.n){case 0:return m.n=1,u((function(){var v=vt(Oe().m(function y(F){var D,_,O,w,x,S,T,I,B,d,H,R,Z,q,G,L,ne,Q,$,Y,re,me,se,K,V,ue,oe,ce,ee;return Oe().w(function(he){for(;;)switch(he.n){case 0:R=function(){return R=vt(Oe().m(function Ce(Re){var ge;return Oe().w(function(Te){for(;;)switch(Te.n){case 0:if(Re==null){Te.n=2;break}if(ge=D.message.metadata!=null?rh(D.message.metadata,Re):Re,n==null){Te.n=1;break}return Te.n=1,Mp({value:ge,schema:n});case 1:D.message.metadata=ge;case 2:return Te.a(2)}},Ce)})),R.apply(this,arguments)},H=function(Ce){return R.apply(this,arguments)},d=function(Ce){var Re,ge,Te=D.message.parts.find(function(Ge){return Ge.type==="dynamic-tool"&&Ge.toolCallId===Ce.toolCallId}),He=Ce,nt=Te;Te!=null?(Te.state=Ce.state,nt.toolName=Ce.toolName,nt.input=He.input,nt.output=He.output,nt.errorText=He.errorText,nt.rawInput=(Re=He.rawInput)!=null?Re:nt.rawInput,nt.preliminary=He.preliminary,nt.providerExecuted=(ge=He.providerExecuted)!=null?ge:Te.providerExecuted,He.providerMetadata!=null&&Te.state==="input-available"&&(Te.callProviderMetadata=He.providerMetadata)):D.message.parts.push(pe({type:"dynamic-tool",toolName:Ce.toolName,toolCallId:Ce.toolCallId,state:Ce.state,input:He.input,output:He.output,errorText:He.errorText,preliminary:He.preliminary,providerExecuted:He.providerExecuted},He.providerMetadata!=null?{callProviderMetadata:He.providerMetadata}:{}))},B=function(Ce){var Re,ge=D.message.parts.find(function(nt){return Do(nt)&&nt.toolCallId===Ce.toolCallId}),Te=Ce,He=ge;ge!=null?(ge.state=Ce.state,He.input=Te.input,He.output=Te.output,He.errorText=Te.errorText,He.rawInput=Te.rawInput,He.preliminary=Te.preliminary,He.providerExecuted=(Re=Te.providerExecuted)!=null?Re:ge.providerExecuted,Te.providerMetadata!=null&&ge.state==="input-available"&&(ge.callProviderMetadata=Te.providerMetadata)):D.message.parts.push(pe({type:"tool-".concat(Ce.toolName),toolCallId:Ce.toolCallId,state:Ce.state,input:Te.input,output:Te.output,rawInput:Te.rawInput,errorText:Te.errorText,providerExecuted:Te.providerExecuted,preliminary:Te.preliminary},Te.providerMetadata!=null?{callProviderMetadata:Te.providerMetadata}:{}))},I=function(Ce){var Re=D.message.parts.filter(function(ge){return ge.type==="dynamic-tool"}).find(function(ge){return ge.toolCallId===Ce});if(Re==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return Re},T=function(Ce){var Re=D.message.parts.filter(Do).find(function(ge){return ge.toolCallId===Ce});if(Re==null)throw new Error("tool-output-error must be preceded by a tool-input-available");return Re},D=F.state,_=F.write,ee=c.type,he.n=ee==="text-start"?1:ee==="text-delta"?2:ee==="text-end"?3:ee==="reasoning-start"?4:ee==="reasoning-delta"?5:ee==="reasoning-end"?6:ee==="file"?7:ee==="source-url"?8:ee==="source-document"?9:ee==="tool-input-start"?10:ee==="tool-input-delta"?11:ee==="tool-input-available"?13:ee==="tool-input-error"?15:ee==="tool-output-available"?16:ee==="tool-output-error"?17:ee==="start-step"?18:ee==="finish-step"?19:ee==="start"?20:ee==="finish"?22:ee==="message-metadata"?24:ee==="error"?26:27;break;case 1:return Z={type:"text",text:"",providerMetadata:c.providerMetadata,state:"streaming"},D.activeTextParts[c.id]=Z,D.message.parts.push(Z),_(),he.a(3,30);case 2:return(q=D.activeTextParts[c.id]).text+=c.delta,q.providerMetadata=(O=c.providerMetadata)!=null?O:q.providerMetadata,_(),he.a(3,30);case 3:return(G=D.activeTextParts[c.id]).state="done",G.providerMetadata=(w=c.providerMetadata)!=null?w:G.providerMetadata,delete D.activeTextParts[c.id],_(),he.a(3,30);case 4:return L={type:"reasoning",text:"",providerMetadata:c.providerMetadata,state:"streaming"},D.activeReasoningParts[c.id]=L,D.message.parts.push(L),_(),he.a(3,30);case 5:return(ne=D.activeReasoningParts[c.id]).text+=c.delta,ne.providerMetadata=(x=c.providerMetadata)!=null?x:ne.providerMetadata,_(),he.a(3,30);case 6:return(Q=D.activeReasoningParts[c.id]).providerMetadata=(S=c.providerMetadata)!=null?S:Q.providerMetadata,Q.state="done",delete D.activeReasoningParts[c.id],_(),he.a(3,30);case 7:return D.message.parts.push({type:"file",mediaType:c.mediaType,url:c.url}),_(),he.a(3,30);case 8:return D.message.parts.push({type:"source-url",sourceId:c.sourceId,url:c.url,title:c.title,providerMetadata:c.providerMetadata}),_(),he.a(3,30);case 9:return D.message.parts.push({type:"source-document",sourceId:c.sourceId,mediaType:c.mediaType,title:c.title,filename:c.filename,providerMetadata:c.providerMetadata}),_(),he.a(3,30);case 10:return $=D.message.parts.filter(Do),D.partialToolCalls[c.toolCallId]={text:"",toolName:c.toolName,index:$.length,dynamic:c.dynamic},c.dynamic?d({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-streaming",input:void 0,providerExecuted:c.providerExecuted}):B({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-streaming",input:void 0,providerExecuted:c.providerExecuted}),_(),he.a(3,30);case 11:return(Y=D.partialToolCalls[c.toolCallId]).text+=c.inputTextDelta,he.n=12,uh(Y.text);case 12:return re=he.v,me=re.value,Y.dynamic?d({toolCallId:c.toolCallId,toolName:Y.toolName,state:"input-streaming",input:me}):B({toolCallId:c.toolCallId,toolName:Y.toolName,state:"input-streaming",input:me}),_(),he.a(3,30);case 13:if(c.dynamic?d({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-available",input:c.input,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}):B({toolCallId:c.toolCallId,toolName:c.toolName,state:"input-available",input:c.input,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}),_(),!(i&&!c.providerExecuted)){he.n=14;break}return he.n=14,i({toolCall:c});case 14:return he.a(3,30);case 15:return c.dynamic?d({toolCallId:c.toolCallId,toolName:c.toolName,state:"output-error",input:c.input,errorText:c.errorText,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}):B({toolCallId:c.toolCallId,toolName:c.toolName,state:"output-error",input:void 0,rawInput:c.input,errorText:c.errorText,providerExecuted:c.providerExecuted,providerMetadata:c.providerMetadata}),_(),he.a(3,30);case 16:return c.dynamic?(se=I(c.toolCallId),d({toolCallId:c.toolCallId,toolName:se.toolName,state:"output-available",input:se.input,output:c.output,preliminary:c.preliminary})):(K=T(c.toolCallId),B({toolCallId:c.toolCallId,toolName:ah(K),state:"output-available",input:K.input,output:c.output,providerExecuted:c.providerExecuted,preliminary:c.preliminary})),_(),he.a(3,30);case 17:return c.dynamic?(V=I(c.toolCallId),d({toolCallId:c.toolCallId,toolName:V.toolName,state:"output-error",input:V.input,errorText:c.errorText,providerExecuted:c.providerExecuted})):(ue=T(c.toolCallId),B({toolCallId:c.toolCallId,toolName:ah(ue),state:"output-error",input:ue.input,rawInput:ue.rawInput,errorText:c.errorText,providerExecuted:c.providerExecuted})),_(),he.a(3,30);case 18:return D.message.parts.push({type:"step-start"}),he.a(3,30);case 19:return D.activeTextParts={},D.activeReasoningParts={},he.a(3,30);case 20:return c.messageId!=null&&(D.message.id=c.messageId),he.n=21,H(c.messageMetadata);case 21:return c.messageId==null&&c.messageMetadata==null||_(),he.a(3,30);case 22:return c.finishReason!=null&&(D.finishReason=c.finishReason),he.n=23,H(c.messageMetadata);case 23:return c.messageMetadata!=null&&_(),he.a(3,30);case 24:return he.n=25,H(c.messageMetadata);case 25:return c.messageMetadata!=null&&_(),he.a(3,30);case 26:return a==null||a(new Error(c.errorText)),he.a(3,30);case 27:if(!(function(Ce){return Ce.type.startsWith("data-")})(c)){he.n=30;break}if((r==null?void 0:r[c.type])==null){he.n=28;break}return he.n=28,Mp({value:c.data,schema:r[c.type]});case 28:if(!(oe=c).transient){he.n=29;break}return o==null||o(oe),he.a(3,30);case 29:ce=oe.id!=null?D.message.parts.find(function(Ce){return oe.type===Ce.type&&oe.id===Ce.id}):void 0,ce!=null?ce.data=oe.data:D.message.parts.push(oe),o==null||o(oe),_();case 30:l.enqueue(c);case 31:return he.a(2)}},y)}));return function(y){return v.apply(this,arguments)}})());case 1:return m.a(2)}},p)}))()}}))}Ya({prefix:"aitxt",size:24}),Ya({prefix:"aiobj",size:24});var Ob=(function(){return $n(function n(){Mn(this,n),this.queue=[],this.isProcessing=!1},[{key:"processQueue",value:(t=vt(Oe().m(function n(){return Oe().w(function(r){for(;;)switch(r.n){case 0:if(this.isProcessing){r.n=5;break}this.isProcessing=!0;case 1:if(!(this.queue.length>0)){r.n=4;break}return r.n=2,this.queue[0]();case 2:this.queue.shift();case 3:r.n=1;break;case 4:this.isProcessing=!1;case 5:return r.a(2)}},n,this)})),function(){return t.apply(this,arguments)})},{key:"run",value:(e=vt(Oe().m(function n(r){var u=this;return Oe().w(function(a){for(;;)if(a.n===0)return a.a(2,new Promise(function(i,o){u.queue.push(vt(Oe().m(function c(){var l;return Oe().w(function(p){for(;;)switch(p.p=p.n){case 0:return p.p=0,p.n=1,r();case 1:i(),p.n=3;break;case 2:p.p=2,l=p.v,o(l);case 3:return p.a(2)}},c,null,[[0,2]])}))),u.processQueue()}))},n)})),function(n){return e.apply(this,arguments)})}]);var e,t})();Ya({prefix:"aiobj",size:24}),(function(e,t){for(var n in t)yb(e,n,{get:t[n],enumerable:!0})})({},{object:function(){return Bb},text:function(){return Ib}});var ih,oh,Ib=function(){return{type:"text",responseFormat:{type:"text"},parsePartial:(t=vt(Oe().m(function n(r){var u;return Oe().w(function(a){for(;;)if(a.n===0)return u=r.text,a.a(2,{partial:u})},n)})),function(n){return t.apply(this,arguments)}),parseOutput:(e=vt(Oe().m(function n(r){var u;return Oe().w(function(a){for(;;)if(a.n===0)return u=r.text,a.a(2,u)},n)})),function(n){return e.apply(this,arguments)})};var e,t},Bb=function(e){var t=(function(n){return n==null?gc({properties:{},additionalProperties:!1}):we(r=n)=="object"&&r!==null&&mc in r&&r[mc]===!0&&"jsonSchema"in r&&"validate"in r?n:typeof n=="function"?n():Vp(n);var r})(e.schema);return{type:"object",responseFormat:{type:"json",schema:t.jsonSchema},parsePartial:function(n){return vt(Oe().m(function r(){var u,a,i,o;return Oe().w(function(c){for(;;)switch(c.n){case 0:return u=n.text,c.n=1,uh(u);case 1:a=c.v,o=a.state,c.n=o==="failed-parse"||o==="undefined-input"?2:o==="repaired-parse"||o==="successful-parse"?3:4;break;case 2:case 5:return c.a(2);case 3:return c.a(2,{partial:a.value});case 4:throw i=a.state,new Error("Unsupported parse state: ".concat(i))}},r)}))()},parseOutput:function(n,r){return vt(Oe().m(function u(){var a,i,o;return Oe().w(function(c){for(;;)switch(c.n){case 0:return a=n.text,c.n=1,yo({text:a});case 1:if((i=c.v).success){c.n=2;break}throw new Qp({message:"No object generated: could not parse the response.",cause:i.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});case 2:return c.n=3,cc({value:i.value,schema:t});case 3:if((o=c.v).success){c.n=4;break}throw new Qp({message:"No object generated: response did not match schema.",cause:o.error,text:a,response:r.response,usage:r.usage,finishReason:r.finishReason});case 4:return c.a(2,o.value)}},u)}))()}}},Pb=(function(){return $n(function n(r){var u=r.api,a=u===void 0?"/api/chat":u,i=r.credentials,o=r.headers,c=r.body,l=r.fetch,p=r.prepareSendMessagesRequest,m=r.prepareReconnectToStreamRequest;Mn(this,n),this.api=a,this.credentials=i,this.headers=o,this.body=c,this.fetch=l,this.prepareSendMessagesRequest=p,this.prepareReconnectToStreamRequest=m},[{key:"sendMessages",value:(t=vt(Oe().m(function n(r){var u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S,T,I,B;return Oe().w(function(d){for(;;)switch(d.n){case 0:return u=r.abortSignal,a=Nr(r,Dv),d.n=1,Qu(this.body);case 1:return m=d.v,d.n=2,Qu(this.headers);case 2:return v=d.v,d.n=3,Qu(this.credentials);case 3:return y=d.v,F=pe(pe({},bu(v)),bu(a.headers)),d.n=4,(i=this.prepareSendMessagesRequest)==null?void 0:i.call(this,{api:this.api,id:a.chatId,messages:a.messages,body:pe(pe({},m),a.body),headers:F,credentials:y,requestMetadata:a.metadata,trigger:a.trigger,messageId:a.messageId});case 4:return D=d.v,_=(o=D==null?void 0:D.api)!=null?o:this.api,O=(D==null?void 0:D.headers)!==void 0?bu(D.headers):F,w=(D==null?void 0:D.body)!==void 0?D.body:pe(pe(pe({},m),a.body),{},{id:a.chatId,messages:a.messages,trigger:a.trigger,messageId:a.messageId}),x=(c=D==null?void 0:D.credentials)!=null?c:y,S=(l=this.fetch)!=null?l:globalThis.fetch,d.n=5,S(_,{method:"POST",headers:zp(pe({"Content-Type":"application/json"},O),"ai-sdk/".concat(Yp),Rp()),body:JSON.stringify(w),credentials:x,signal:u});case 5:if((T=d.v).ok){d.n=9;break}return I=Error,d.n=6,T.text();case 6:if((p=d.v)==null){d.n=7;break}B=p,d.n=8;break;case 7:B="Failed to fetch the chat response.";case 8:throw new I(B);case 9:if(T.body){d.n=10;break}throw new Error("The response body is empty.");case 10:return d.a(2,this.processResponseStream(T.body))}},n,this)})),function(n){return t.apply(this,arguments)})},{key:"reconnectToStream",value:(e=vt(Oe().m(function n(r){var u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S;return Oe().w(function(T){for(;;)switch(T.n){case 0:return T.n=1,Qu(this.body);case 1:return l=T.v,T.n=2,Qu(this.headers);case 2:return p=T.v,T.n=3,Qu(this.credentials);case 3:return m=T.v,v=pe(pe({},bu(p)),bu(r.headers)),T.n=4,(u=this.prepareReconnectToStreamRequest)==null?void 0:u.call(this,{api:this.api,id:r.chatId,body:pe(pe({},l),r.body),headers:v,credentials:m,requestMetadata:r.metadata});case 4:return y=T.v,F=(a=y==null?void 0:y.api)!=null?a:"".concat(this.api,"/").concat(r.chatId,"/stream"),D=(y==null?void 0:y.headers)!==void 0?bu(y.headers):v,_=(i=y==null?void 0:y.credentials)!=null?i:m,O=(o=this.fetch)!=null?o:globalThis.fetch,T.n=5,O(F,{method:"GET",headers:zp(D,"ai-sdk/".concat(Yp),Rp()),credentials:_});case 5:if((w=T.v).status!==204){T.n=6;break}return T.a(2,null);case 6:if(w.ok){T.n=10;break}return x=Error,T.n=7,w.text();case 7:if((c=T.v)==null){T.n=8;break}S=c,T.n=9;break;case 8:S="Failed to fetch the chat response.";case 9:throw new x(S);case 10:if(w.body){T.n=11;break}throw new Error("The response body is empty.");case 11:return T.a(2,this.processResponseStream(w.body))}},n,this)})),function(n){return e.apply(this,arguments)})}]);var e,t})(),bc=(function(){function e(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return Mn(this,e),au(this,e,[t])}return iu(e,Pb),$n(e,[{key:"processResponseStream",value:function(t){return(function(n){var r=n.schema;return n.stream.pipeThrough(new TextDecoderStream).pipeThrough(new R0).pipeThrough(new TransformStream({transform:function(u,a){return vt(Oe().m(function i(){var o,c;return Oe().w(function(l){for(;;)switch(l.n){case 0:if(o=u.data,o==="[DONE]"){l.n=2;break}return c=a,l.n=1,yo({text:o,schema:r});case 1:c.enqueue.call(c,l.v);case 2:return l.a(2)}},i)}))()}}))})({stream:t,schema:wb}).pipeThrough(new TransformStream({transform:function(n,r){return vt(Oe().m(function u(){return Oe().w(function(a){for(;;)switch(a.n){case 0:if(n.success){a.n=1;break}throw n.error;case 1:r.enqueue(n.value);case 2:return a.a(2)}},u)}))()}}))}}])})(),jb=(function(){return $n(function t(n){var r=this,u=n.generateId,a=u===void 0?KD:u,i=n.id,o=i===void 0?a():i,c=n.transport,l=c===void 0?new bc:c,p=n.messageMetadataSchema,m=n.dataPartSchemas,v=n.state,y=n.onError,F=n.onToolCall,D=n.onFinish,_=n.onData,O=n.sendAutomaticallyWhen;Mn(this,t),this.activeResponse=void 0,this.jobExecutor=new Ob,this.sendMessage=(function(){var w=vt(Oe().m(function x(S,T){var I,B,d,H,R,Z,q;return Oe().w(function(G){for(;;)switch(G.n){case 0:if(S!=null){G.n=2;break}return G.n=1,r.makeRequest(pe({trigger:"submit-message",messageId:(I=r.lastMessage)==null?void 0:I.id},T));case 1:return G.a(2,void G.v);case 2:if(!("text"in S)&&!("files"in S)){G.n=6;break}if(!Array.isArray(S.files)){G.n=3;break}q=S.files,G.n=5;break;case 3:return G.n=4,(function(){var L=vt(Oe().m(function ne(Q){return Oe().w(function($){for(;;)switch($.n){case 0:if(Q!=null){$.n=1;break}return $.a(2,[]);case 1:if(globalThis.FileList&&Q instanceof globalThis.FileList){$.n=2;break}throw new Error("FileList is not supported in the current environment");case 2:return $.a(2,Promise.all(Array.from(Q).map((function(){var Y=vt(Oe().m(function re(me){var se,K,V,ue,oe;return Oe().w(function(ce){for(;;)switch(ce.n){case 0:return se=me.name,K=me.type,V=K,ue=se,ce.n=1,new Promise(function(ee,he){var Ce=new FileReader;Ce.onload=function(Re){var ge;ee((ge=Re.target)==null?void 0:ge.result)},Ce.onerror=function(Re){return he(Re)},Ce.readAsDataURL(me)});case 1:return oe=ce.v,ce.a(2,{type:"file",mediaType:V,filename:ue,url:oe})}},re)}));return function(re){return Y.apply(this,arguments)}})())))}},ne)}));return function(ne){return L.apply(this,arguments)}})()(S.files);case 4:q=G.v;case 5:R={parts:[].concat(Qe(q),Qe("text"in S&&S.text!=null?[{type:"text",text:S.text}]:[]))},G.n=7;break;case 6:R=S;case 7:if(S.messageId==null){G.n=10;break}if(Z=r.state.messages.findIndex(function(L){return L.id===S.messageId}),Z!==-1){G.n=8;break}throw new Error("message with id ".concat(S.messageId," not found"));case 8:if(r.state.messages[Z].role==="user"){G.n=9;break}throw new Error("message with id ".concat(S.messageId," is not a user message"));case 9:r.state.messages=r.state.messages.slice(0,Z+1),r.state.replaceMessage(Z,pe(pe({},R),{},{id:S.messageId,role:(B=R.role)!=null?B:"user",metadata:S.metadata})),G.n=11;break;case 10:r.state.pushMessage(pe(pe({},R),{},{id:(d=R.id)!=null?d:r.generateId(),role:(H=R.role)!=null?H:"user",metadata:S.metadata}));case 11:return G.n=12,r.makeRequest(pe({trigger:"submit-message",messageId:S.messageId},T));case 12:return G.a(2)}},x)}));return function(x,S){return w.apply(this,arguments)}})(),this.regenerate=vt(Oe().m(function w(){var x,S,T,I,B=arguments;return Oe().w(function(d){for(;;)switch(d.n){case 0:if(S=(x=B.length>0&&B[0]!==void 0?B[0]:{}).messageId,T=Nr(x,bv),I=S==null?r.state.messages.length-1:r.state.messages.findIndex(function(H){return H.id===S}),I!==-1){d.n=1;break}throw new Error("message ".concat(S," not found"));case 1:return r.state.messages=r.state.messages.slice(0,r.messages[I].role==="assistant"?I:I+1),d.n=2,r.makeRequest(pe({trigger:"regenerate-message",messageId:S},T));case 2:return d.a(2)}},w)})),this.resumeStream=vt(Oe().m(function w(){var x,S=arguments;return Oe().w(function(T){for(;;)switch(T.n){case 0:return x=S.length>0&&S[0]!==void 0?S[0]:{},T.n=1,r.makeRequest(pe({trigger:"resume-stream"},x));case 1:return T.a(2)}},w)})),this.clearError=function(){r.status==="error"&&(r.state.error=void 0,r.setStatus({status:"ready"}))},this.addToolOutput=(function(){var w=vt(Oe().m(function x(S){var T,I,B,d,H;return Oe().w(function(R){for(;;)if(R.n===0)return T=S.state,I=T===void 0?"output-available":T,S.tool,B=S.toolCallId,d=S.output,H=S.errorText,R.a(2,r.jobExecutor.run(vt(Oe().m(function Z(){var q,G,L,ne;return Oe().w(function(Q){for(;;)switch(Q.n){case 0:L=r.state.messages,ne=L[L.length-1],r.state.replaceMessage(L.length-1,pe(pe({},ne),{},{parts:ne.parts.map(function($){return Dc($)&&$.toolCallId===B?pe(pe({},$),{},{state:I,output:d,errorText:H}):$})})),r.activeResponse&&(r.activeResponse.state.message.parts=r.activeResponse.state.message.parts.map(function($){return Dc($)&&$.toolCallId===B?pe(pe({},$),{},{state:I,output:d,errorText:H}):$})),r.status!=="streaming"&&r.status!=="submitted"&&((q=r.sendAutomaticallyWhen)!=null&&q.call(r,{messages:r.state.messages}))&&r.makeRequest({trigger:"submit-message",messageId:(G=r.lastMessage)==null?void 0:G.id});case 1:return Q.a(2)}},Z)}))))},x)}));return function(x){return w.apply(this,arguments)}})(),this.addToolResult=this.addToolOutput,this.stop=vt(Oe().m(function w(){var x;return Oe().w(function(S){for(;;)switch(S.n){case 0:r.status!=="streaming"&&r.status!=="submitted"||(x=r.activeResponse)!=null&&x.abortController&&r.activeResponse.abortController.abort();case 1:return S.a(2)}},w)})),this.id=o,this.transport=l,this.generateId=a,this.messageMetadataSchema=p,this.dataPartSchemas=m,this.state=v,this.onError=y,this.onToolCall=F,this.onFinish=D,this.onData=_,this.sendAutomaticallyWhen=O},[{key:"status",get:function(){return this.state.status}},{key:"setStatus",value:function(t){var n=t.status,r=t.error;this.status!==n&&(this.state.status=n,this.state.error=r)}},{key:"error",get:function(){return this.state.error}},{key:"messages",get:function(){return this.state.messages},set:function(t){this.state.messages=t}},{key:"lastMessage",get:function(){return this.state.messages[this.state.messages.length-1]}},{key:"makeRequest",value:(e=vt(Oe().m(function t(n){var r,u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S,T=this;return Oe().w(function(I){for(;;)switch(I.p=I.n){case 0:if(r=n.trigger,u=n.metadata,a=n.headers,i=n.body,o=n.messageId,this.setStatus({status:"submitted",error:void 0}),v=this.lastMessage,y=!1,F=!1,D=!1,I.p=1,(_={state:xb({lastMessage:this.state.snapshot(v),messageId:this.generateId()}),abortController:new AbortController}).abortController.signal.addEventListener("abort",function(){y=!0}),this.activeResponse=_,r!=="resume-stream"){I.n=4;break}return I.n=2,this.transport.reconnectToStream({chatId:this.id,metadata:u,headers:a,body:i});case 2:if((w=I.v)!=null){I.n=3;break}return I.a(2,void this.setStatus({status:"ready"}));case 3:O=w,I.n=6;break;case 4:return I.n=5,this.transport.sendMessages({chatId:this.id,messages:this.state.messages,abortSignal:_.abortController.signal,metadata:u,headers:a,body:i,trigger:r,messageId:o});case 5:O=I.v;case 6:return x=function(B){return T.jobExecutor.run(function(){return B({state:_.state,write:function(){var d;T.setStatus({status:"streaming"}),_.state.message.id===((d=T.lastMessage)==null?void 0:d.id)?T.state.replaceMessage(T.state.messages.length-1,_.state.message):T.state.pushMessage(_.state.message)}})})},I.n=7,(function(){var B=vt(Oe().m(function d(H){var R,Z,q,G;return Oe().w(function(L){for(;;)switch(L.p=L.n){case 0:R=H.stream,Z=H.onError,q=R.getReader(),L.p=1;case 2:return L.n=3,q.read();case 3:if(!L.v.done){L.n=4;break}return L.a(3,5);case 4:L.n=2;break;case 5:L.n=7;break;case 6:L.p=6,G=L.v,Z==null||Z(G);case 7:return L.p=7,q.releaseLock(),L.f(7);case 8:return L.a(2)}},d,null,[[1,6,7,8]])}));return function(d){return B.apply(this,arguments)}})()({stream:Tb({stream:O,onToolCall:this.onToolCall,onData:this.onData,messageMetadataSchema:this.messageMetadataSchema,dataPartSchemas:this.dataPartSchemas,runUpdateMessageJob:x,onError:function(B){throw B}}),onError:function(B){throw B}});case 7:this.setStatus({status:"ready"}),I.n=10;break;case 8:if(I.p=8,S=I.v,!y&&S.name!=="AbortError"){I.n=9;break}return I.a(2,(y=!0,this.setStatus({status:"ready"}),null));case 9:D=!0,S instanceof TypeError&&(S.message.toLowerCase().includes("fetch")||S.message.toLowerCase().includes("network"))&&(F=!0),this.onError&&S instanceof Error&&this.onError(S),this.setStatus({status:"error",error:S});case 10:I.p=10;try{(l=this.onFinish)==null||l.call(this,{message:this.activeResponse.state.message,messages:this.state.messages,isAbort:y,isDisconnect:F,isError:D,finishReason:(c=this.activeResponse)==null?void 0:c.state.finishReason})}catch(B){console.error(B)}return this.activeResponse=void 0,I.f(10);case 11:if(!((p=this.sendAutomaticallyWhen)!=null&&p.call(this,{messages:this.state.messages}))||D){I.n=12;break}return I.n=12,this.makeRequest({trigger:"submit-message",messageId:(m=this.lastMessage)==null?void 0:m.id,metadata:u,headers:a,body:i});case 12:return I.a(2)}},t,this,[[1,8,10,11]])})),function(t){return e.apply(this,arguments)})}]);var e})();function Nb(e){var t=e.messages,n=t[t.length-1];if(!n||n.role!=="assistant")return!1;var r=n.parts.reduce(function(a,i,o){return i.type==="step-start"?o:a},-1),u=n.parts.slice(r+1).filter(Dc).filter(function(a){return!a.providerExecuted});return u.length>0&&u.every(function(a){return a.state==="output-available"||a.state==="output-error"})}var jn,bo,Ao,ei,ti,ni,Yu,Ac,Ec,Xu,Rb=(function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e})((oh||(oh=1,ih=function(e,t){if(typeof e!="function")throw new TypeError("Expected the first argument to be a `function`, got `".concat(Qt(e),"`."));var n,r=0;return function(){for(var u=this,a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];clearTimeout(n);var c=Date.now(),l=t-(c-r);l<=0?(r=c,e.apply(this,i)):n=setTimeout(function(){r=Date.now(),e.apply(u,i)},l)}}),ih)),sh=function(e,t,n){if(!t.has(e))throw TypeError("Cannot "+n)},It=function(e,t,n){return sh(e,t,"read from private field"),n?n.call(e):t.get(e)},ir=function(e,t,n){if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Gr=function(e,t,n,r){return sh(e,t,"write to private field"),t.set(e,n),n},zb=(function(){return $n(function e(){var t=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];Mn(this,e),ir(this,jn,void 0),ir(this,bo,"ready"),ir(this,Ao,void 0),ir(this,ei,new Set),ir(this,ti,new Set),ir(this,ni,new Set),this.pushMessage=function(r){Gr(t,jn,It(t,jn).concat(r)),It(t,Yu).call(t)},this.popMessage=function(){Gr(t,jn,It(t,jn).slice(0,-1)),It(t,Yu).call(t)},this.replaceMessage=function(r,u){Gr(t,jn,[].concat(Qe(It(t,jn).slice(0,r)),[t.snapshot(u)],Qe(It(t,jn).slice(r+1)))),It(t,Yu).call(t)},this.snapshot=function(r){return structuredClone(r)},this["~registerMessagesCallback"]=function(r,u){var a,i,o=u?(a=r,(i=u)!=null?Rb(a,i):a):r;return It(t,ei).add(o),function(){It(t,ei).delete(o)}},this["~registerStatusCallback"]=function(r){return It(t,ti).add(r),function(){It(t,ti).delete(r)}},this["~registerErrorCallback"]=function(r){return It(t,ni).add(r),function(){It(t,ni).delete(r)}},ir(this,Yu,function(){It(t,ei).forEach(function(r){return r()})}),ir(this,Ac,function(){It(t,ti).forEach(function(r){return r()})}),ir(this,Ec,function(){It(t,ni).forEach(function(r){return r()})}),Gr(this,jn,n)},[{key:"status",get:function(){return It(this,bo)},set:function(e){Gr(this,bo,e),It(this,Ac).call(this)}},{key:"error",get:function(){return It(this,Ao)},set:function(e){Gr(this,Ao,e),It(this,Ec).call(this)}},{key:"messages",get:function(){return It(this,jn)},set:function(e){Gr(this,jn,Qe(e)),It(this,Yu).call(this)}}])})();jn=new WeakMap,bo=new WeakMap,Ao=new WeakMap,ei=new WeakMap,ti=new WeakMap,ni=new WeakMap,Yu=new WeakMap,Ac=new WeakMap,Ec=new WeakMap;var ch=(function(){function e(t){var n,r=t.messages,u=Nr(t,Av);Mn(this,e);var a=new zb(r);return n=au(this,e,[pe(pe({},u),{},{state:a})]),ir(wu(n),Xu,void 0),n["~registerMessagesCallback"]=function(i,o){return It(wu(n),Xu)["~registerMessagesCallback"](i,o)},n["~registerStatusCallback"]=function(i){return It(wu(n),Xu)["~registerStatusCallback"](i)},n["~registerErrorCallback"]=function(i){return It(wu(n),Xu)["~registerErrorCallback"](i)},Gr(wu(n),Xu,a),n}return iu(e,jb),$n(e)})();Xu=new WeakMap;var lh="askai_token",Lb=function(e){if(!e)return!0;try{var t=(function(r){var u=dt(r.split("."),1)[0];return JSON.parse(atob(u))})(e),n=t.exp;return Date.now()/1e3>n-30}catch(r){return!0}},Eo=null,fh=(function(){var e=Xe(Ae().m(function t(n){var r,u,a,i,o,c;return Ae().w(function(l){for(;;)switch(l.n){case 0:if(r=n.assistantId,u=n.abortSignal,a=n.useStagingEnv,i=a!==void 0&&a,o=sessionStorage.getItem(lh),Lb(o)){l.n=1;break}return l.a(2,o);case 1:return c=i?Ds:ys,Eo||(Eo=fetch("".concat(c,"/token"),{method:"POST",headers:{"x-algolia-assistant-id":r,"content-type":"application/json"},signal:u}).then(function(p){return p.json()}).then(function(p){var m=p.token,v=p.success,y=p.message;if(!v&&y)throw new Error(y);return sessionStorage.setItem(lh,m),m}).finally(function(){return Eo=null})),l.a(2,Eo)}},t)}));return function(t){return e.apply(this,arguments)}})(),Mb=(function(){var e=Xe(Ae().m(function t(n){var r,u,a,i,o,c,l,p,m,v;return Ae().w(function(y){for(;;)switch(y.n){case 0:return r=n.assistantId,u=n.thumbs,a=n.messageId,i=n.appId,o=n.abortSignal,c=n.useStagingEnv,l=c!==void 0&&c,(p=new Headers).set("x-algolia-assistant-id",r),p.set("content-type","application/json"),y.n=1,fh({assistantId:r,abortSignal:o,useStagingEnv:l});case 1:return m=y.v,p.set("authorization","TOKEN ".concat(m)),v=l?Ds:ys,y.a(2,fetch("".concat(v,"/feedback"),{method:"POST",body:JSON.stringify({appId:i,messageId:a,thumbs:u}),headers:p}))}},t)}));return function(t){return e.apply(this,arguments)}})(),$b=["assistantId","apiKey","appId","indexName","useStagingEnv"];function Zb(e){var t,n="algolia-client-js-".concat(e.key);function r(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function u(){return JSON.parse(r().getItem(n)||"{}")}function a(i){r().setItem(n,JSON.stringify(i))}return{get:function(i,o){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return Promise.resolve().then(function(){var l,p,m;return l=e.timeToLive?1e3*e.timeToLive:null,p=u(),a(m=Object.fromEntries(Object.entries(p).filter(function(v){return dt(v,2)[1].timestamp!==void 0}))),l&&a(Object.fromEntries(Object.entries(m).filter(function(v){var y=dt(v,2)[1],F=new Date().getTime();return!(y.timestamp+l<F)}))),u()[JSON.stringify(i)]}).then(function(l){return Promise.all([l?l.value:o(),l!==void 0])}).then(function(l){var p=dt(l,2),m=p[0],v=p[1];return Promise.all([m,v||c.miss(m)])}).then(function(l){return dt(l,1)[0]})},set:function(i,o){return Promise.resolve().then(function(){var c=u();return c[JSON.stringify(i)]={timestamp:new Date().getTime(),value:o},r().setItem(n,JSON.stringify(c)),o})},delete:function(i){return Promise.resolve().then(function(){var o=u();delete o[JSON.stringify(i)],r().setItem(n,JSON.stringify(o))})},clear:function(){return Promise.resolve().then(function(){r().removeItem(n)})}}}function ri(e){var t=be(e.caches),n=t.shift();return n===void 0?{get:function(r,u){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return u().then(function(i){return Promise.all([i,a.miss(i)])}).then(function(i){return dt(i,1)[0]})},set:function(r,u){return Promise.resolve(u)},delete:function(r){return Promise.resolve()},clear:function(){return Promise.resolve()}}:{get:function(r,u){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}};return n.get(r,u,a).catch(function(){return ri({caches:t}).get(r,u,a)})},set:function(r,u){return n.set(r,u).catch(function(){return ri({caches:t}).set(r,u)})},delete:function(r){return n.delete(r).catch(function(){return ri({caches:t}).delete(r)})},clear:function(){return n.clear().catch(function(){return ri({caches:t}).clear()})}}}function Fc(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{serializable:!0},t={};return{get:function(n,r){var u=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{miss:function(){return Promise.resolve()}},a=JSON.stringify(n);if(a in t)return Promise.resolve(e.serializable?JSON.parse(t[a]):t[a]);var i=r();return i.then(function(o){return u.miss(o)}).then(function(){return i})},set:function(n,r){return t[JSON.stringify(n)]=e.serializable?JSON.stringify(r):r,Promise.resolve(r)},delete:function(n){return delete t[JSON.stringify(n)],Promise.resolve()},clear:function(){return t={},Promise.resolve()}}}function qb(e){var t=e.algoliaAgents,n=e.client,r=e.version,u=(function(a){var i={value:"Algolia for JavaScript (".concat(a,")"),add:function(o){var c="; ".concat(o.segment).concat(o.version!==void 0?" (".concat(o.version,")"):"");return i.value.indexOf(c)===-1&&(i.value="".concat(i.value).concat(c)),i}};return i})(r).add({segment:n,version:r});return t.forEach(function(a){return u.add(a)}),u}var dh=12e4;function ph(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"up",n=Date.now();return C(C({},e),{},{status:t,lastUpdate:n,isUp:function(){return t==="up"||Date.now()-n>dh},isTimedOut:function(){return t==="timed out"&&Date.now()-n<=dh}})}var hh=(function(){function e(t,n){var r;return Be(this,e),lt(r=$e(this,e,[t]),"name","AlgoliaError"),n&&(r.name=n),r}return Me(e,Lr(Error)),Pe(e)})(),vh=(function(){function e(t,n,r){var u;return Be(this,e),lt(u=$e(this,e,[t,r]),"stackTrace",void 0),u.stackTrace=n,u}return Me(e,hh),Pe(e)})(),Hb=(function(){function e(t){return Be(this,e),$e(this,e,["Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError"])}return Me(e,vh),Pe(e)})(),_c=(function(){function e(t,n,r){var u,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"ApiError";return Be(this,e),lt(u=$e(this,e,[t,r,a]),"status",void 0),u.status=n,u}return Me(e,vh),Pe(e)})(),Ub=(function(){function e(t,n){var r;return Be(this,e),lt(r=$e(this,e,[t,"DeserializationError"]),"response",void 0),r.response=n,r}return Me(e,hh),Pe(e)})(),Wb=(function(){function e(t,n,r,u){var a;return Be(this,e),lt(a=$e(this,e,[t,n,u,"DetailedApiError"]),"error",void 0),a.error=r,a}return Me(e,_c),Pe(e)})();function Vb(e,t,n){var r,u=(r=n,Object.keys(r).filter(function(i){return r[i]!==void 0}).sort().map(function(i){return"".concat(i,"=").concat(encodeURIComponent(Object.prototype.toString.call(r[i])==="[object Array]"?r[i].join(","):r[i]).replace(/\+/g,"%20"))}).join("&")),a="".concat(e.protocol,"://").concat(e.url).concat(e.port?":".concat(e.port):"","/").concat(t.charAt(0)==="/"?t.substring(1):t);return u.length&&(a+="?".concat(u)),a}function Kb(e,t){if(e.method!=="GET"&&(e.data!==void 0||t.data!==void 0)){var n=Array.isArray(e.data)?e.data:C(C({},e.data),t.data);return JSON.stringify(n)}}function Gb(e,t,n){var r=C(C(C({Accept:"application/json"},e),t),n),u={};return Object.keys(r).forEach(function(a){var i=r[a];u[a.toLowerCase()]=i}),u}function Jb(e){try{return JSON.parse(e.content)}catch(t){throw new Ub(t.message,e)}}function Qb(e,t){var n=e.content,r=e.status;try{var u=JSON.parse(n);return"error"in u?new Wb(u.message,r,u.error,t):new _c(u.message,r,t)}catch(a){}return new _c(n,r,t)}function Yb(e){var t=e.isTimedOut,n=e.status;return t||(function(r){return!r.isTimedOut&&~~r.status===0})({isTimedOut:t,status:n})||~~(n/100)!=2&&~~(n/100)!=4}function Xb(e){return~~(e.status/100)==2}function eA(e){return e.map(function(t){return mh(t)})}function mh(e){var t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return C(C({},e),{},{request:C(C({},e.request),{},{headers:C(C({},e.request.headers),t)})})}var tA=["appId","apiKey","authMode","algoliaAgents"],nA=["params"],gh="5.43.0";function rA(e){return[{url:"".concat(e,"-dsn.algolia.net"),accept:"read",protocol:"https"},{url:"".concat(e,".algolia.net"),accept:"write",protocol:"https"}].concat((function(t){for(var n=t,r=t.length-1;r>0;r--){var u=Math.floor(Math.random()*(r+1)),a=t[r];n[r]=t[u],n[u]=a}return n})([{url:"".concat(e,"-1.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-2.algolianet.com"),accept:"readWrite",protocol:"https"},{url:"".concat(e,"-3.algolianet.com"),accept:"readWrite",protocol:"https"}]))}var Cc="4.6.0";function uA(e,t,n){var r=b.useMemo(function(){var u=(function(a,i){if(!a||typeof a!="string")throw new Error("`appId` is missing.");if(!i||typeof i!="string")throw new Error("`apiKey` is missing.");return(function(o){var c=o.appId,l=o.apiKey,p=o.authMode,m=o.algoliaAgents,v=an(o,tA),y=(function(D,_){var O=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"WithinHeaders",w={"x-algolia-api-key":_,"x-algolia-application-id":D};return{headers:function(){return O==="WithinHeaders"?w:{}},queryParameters:function(){return O==="WithinQueryParameters"?w:{}}}})(c,l,p),F=(function(D){var _=D.hosts,O=D.hostsCache,w=D.baseHeaders,x=D.logger,S=D.baseQueryParameters,T=D.algoliaAgent,I=D.timeouts,B=D.requester,d=D.requestsCache,H=D.responsesCache;function R(L){return Z.apply(this,arguments)}function Z(){return(Z=Xe(Ae().m(function L(ne){var Q,$,Y,re,me;return Ae().w(function(se){for(;;)switch(se.n){case 0:return se.n=1,Promise.all(ne.map(function(K){return O.get(K,function(){return Promise.resolve(ph(K))})}));case 1:return Q=se.v,$=Q.filter(function(K){return K.isUp()}),Y=Q.filter(function(K){return K.isTimedOut()}),re=[].concat(be($),be(Y)),me=re.length>0?re:ne,se.a(2,{hosts:me,getTimeout:function(K,V){return(Y.length===0&&K===0?1:Y.length+3+K)*V}})}},L)}))).apply(this,arguments)}function q(L,ne){return G.apply(this,arguments)}function G(){return G=Xe(Ae().m(function L(ne,Q){var $,Y,re,me,se,K,V,ue,oe,ce,ee,he,Ce,Re=arguments;return Ae().w(function(ge){for(;;)switch(ge.n){case 0:if($=!(Re.length>2&&Re[2]!==void 0)||Re[2],Y=[],re=Kb(ne,Q),me=Gb(w,ne.headers,Q.headers),se=ne.method==="GET"?C(C({},ne.data),Q.data):{},K=C(C(C({},S),ne.queryParameters),se),T.value&&(K["x-algolia-agent"]=T.value),Q&&Q.queryParameters)for(V=0,ue=Object.keys(Q.queryParameters);V<ue.length;V++)oe=ue[V],Q.queryParameters[oe]&&Object.prototype.toString.call(Q.queryParameters[oe])!=="[object Object]"?K[oe]=Q.queryParameters[oe].toString():K[oe]=Q.queryParameters[oe];return ce=0,ee=(function(){var Te=Xe(Ae().m(function He(nt,Ge){var yt,Dt,mn,Xt,un,Gn;return Ae().w(function(Mt){for(;;)switch(Mt.n){case 0:if((yt=nt.pop())!==void 0){Mt.n=1;break}throw new Hb(eA(Y));case 1:return Dt=C(C({},I),Q.timeouts),mn={data:re,headers:me,method:ne.method,url:Vb(yt,ne.path,K),connectTimeout:Ge(ce,Dt.connect),responseTimeout:Ge(ce,$?Dt.read:Dt.write)},Xt=function(Gt){var Jt={request:mn,response:Gt,host:yt,triesLeft:nt.length};return Y.push(Jt),Jt},Mt.n=2,B.send(mn);case 2:if(!Yb(un=Mt.v)){Mt.n=4;break}return Gn=Xt(un),un.isTimedOut&&ce++,x.info("Retryable failure",mh(Gn)),Mt.n=3,O.set(yt,ph(yt,un.isTimedOut?"timed out":"down"));case 3:return Mt.a(2,ee(nt,Ge));case 4:if(!Xb(un)){Mt.n=5;break}return Mt.a(2,Jb(un));case 5:throw Xt(un),Qb(un,Y);case 6:return Mt.a(2)}},He)}));return function(He,nt){return Te.apply(this,arguments)}})(),he=_.filter(function(Te){return Te.accept==="readWrite"||($?Te.accept==="read":Te.accept==="write")}),ge.n=1,R(he);case 1:return Ce=ge.v,ge.a(2,ee(be(Ce.hosts).reverse(),Ce.getTimeout))}},L)})),G.apply(this,arguments)}return{hostsCache:O,requester:B,timeouts:I,logger:x,algoliaAgent:T,baseHeaders:w,baseQueryParameters:S,hosts:_,request:function(L){var ne=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},Q=L.useReadTransporter||L.method==="GET";if(!Q)return q(L,ne,Q);var $=function(){return q(L,ne)};if((ne.cacheable||L.cacheable)!==!0)return $();var Y={request:L,requestOptions:ne,transporter:{queryParameters:S,headers:w}};return H.get(Y,function(){return d.get(Y,function(){return d.set(Y,$()).then(function(re){return Promise.all([d.delete(Y),re])},function(re){return Promise.all([d.delete(Y),Promise.reject(re)])}).then(function(re){var me=dt(re,2);return me[0],me[1]})})},{miss:function(re){return H.set(Y,re)}})},requestsCache:d,responsesCache:H}})(C(C({hosts:rA(c)},v),{},{algoliaAgent:qb({algoliaAgents:m,client:"Lite",version:gh}),baseHeaders:C(C({"content-type":"text/plain"},y.headers()),v.baseHeaders),baseQueryParameters:C(C({},y.queryParameters()),v.baseQueryParameters)}));return{transporter:F,appId:c,apiKey:l,clearCache:function(){return Promise.all([F.requestsCache.clear(),F.responsesCache.clear()]).then(function(){})},get _ua(){return F.algoliaAgent.value},addAlgoliaAgent:function(D,_){F.algoliaAgent.add({segment:D,version:_})},setClientApiKey:function(D){var _=D.apiKey;p&&p!=="WithinHeaders"?F.baseQueryParameters["x-algolia-api-key"]=_:F.baseHeaders["x-algolia-api-key"]=_},searchForHits:function(D,_){return this.search(D,_)},searchForFacets:function(D,_){return this.search(D,_)},customPost:function(D,_){var O=D.path,w=D.parameters,x=D.body;if(!O)throw new Error("Parameter `path` is required when calling `customPost`.");var S={method:"POST",path:"/{path}".replace("{path}",O),queryParameters:w||{},headers:{},data:x||{}};return F.request(S,_)},getRecommendations:function(D,_){if(D&&Array.isArray(D)&&(D={requests:D}),!D)throw new Error("Parameter `getRecommendationsParams` is required when calling `getRecommendations`.");if(!D.requests)throw new Error("Parameter `getRecommendationsParams.requests` is required when calling `getRecommendations`.");var O={method:"POST",path:"/1/indexes/*/recommendations",queryParameters:{},headers:{},data:D,useReadTransporter:!0,cacheable:!0};return F.request(O,_)},search:function(D,_){if(D&&Array.isArray(D)){var O={requests:D.map(function(x){var S=x.params,T=an(x,nA);return T.type==="facet"?C(C(C({},T),S),{},{type:"facet"}):C(C(C({},T),S),{},{facet:void 0,maxFacetHits:void 0,facetQuery:void 0})})};D=O}if(!D)throw new Error("Parameter `searchMethodParams` is required when calling `search`.");if(!D.requests)throw new Error("Parameter `searchMethodParams.requests` is required when calling `search`.");var w={method:"POST",path:"/1/indexes/*/queries",queryParameters:{},headers:{},data:D,useReadTransporter:!0,cacheable:!0};return F.request(w,_)}}})(C({appId:a,apiKey:i,timeouts:{connect:1e3,read:2e3,write:3e4},logger:{debug:function(o,c){return Promise.resolve()},info:function(o,c){return Promise.resolve()},error:function(o,c){return Promise.resolve()}},requester:{send:function(o){return new Promise(function(c){var l=new XMLHttpRequest;l.open(o.method,o.url,!0),Object.keys(o.headers).forEach(function(y){return l.setRequestHeader(y,o.headers[y])});var p,m=function(y,F){return setTimeout(function(){l.abort(),c({status:0,content:F,isTimedOut:!0})},y)},v=m(o.connectTimeout,"Connection timeout");l.onreadystatechange=function(){l.readyState>l.OPENED&&p===void 0&&(clearTimeout(v),p=m(o.responseTimeout,"Socket timeout"))},l.onerror=function(){l.status===0&&(clearTimeout(v),clearTimeout(p),c({content:l.responseText||"Network request failed",status:l.status,isTimedOut:!1}))},l.onload=function(){clearTimeout(v),clearTimeout(p),c({content:l.responseText,status:l.status,isTimedOut:!1})},l.send(o.data)})}},algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:Fc(),requestsCache:Fc({serializable:!1}),hostsCache:ri({caches:[Zb({key:"".concat(gh,"-").concat(a)}),Fc()]})},void 0))})(e,t);return u.addAlgoliaAgent("docsearch",Cc),/docsearch.js \(.*\)/.test(u.transporter.algoliaAgent.value)===!1&&u.addAlgoliaAgent("docsearch-react",Cc),n(u)},[e,t,n]);return r}var aA=["appId","apiKey","askAi","maxResultsPerGroup","theme","onClose","transformItems","hitComponent","resultsFooterComponent","navigator","initialScrollY","transformSearchClient","disableUserPersonalization","initialQuery","translations","getMissingResultsUrl","insights","onAskAiToggle","interceptAskAiEvent","isAskAiActive","recentSearchesLimit","recentSearchesWithFavoritesLimit","indices","indexName","searchParameters","isHybridModeSupported"],iA=["footer","searchBox"],oA=(function(){var e=Xe(Ae().m(function t(n){var r,u,a,i,o,c,l,p,m,v,y,F,D,_,O,w,x,S,T;return Ae().w(function(I){for(;;)switch(I.p=I.n){case 0:return r=n.query,u=n.state,a=n.setContext,i=n.setStatus,o=n.searchClient,c=n.indexes,l=n.snippetLength,p=n.insights,m=n.appId,v=n.apiKey,y=n.maxResultsPerGroup,F=n.transformItems,D=F===void 0?ss:F,_=n.saveRecentSearch,O=n.onClose,w=p,I.p=1,I.n=2,o.search({requests:c.map(function(B){var d,H,R,Z,q,G,L,ne=typeof B=="string"?B:B.name,Q=typeof B=="string"?{}:B.searchParameters;return C({query:r,indexName:ne,attributesToRetrieve:(d=Q==null?void 0:Q.attributesToRetrieve)!==null&&d!==void 0?d:["hierarchy.lvl0","hierarchy.lvl1","hierarchy.lvl2","hierarchy.lvl3","hierarchy.lvl4","hierarchy.lvl5","hierarchy.lvl6","content","type","url"],attributesToSnippet:(H=Q==null?void 0:Q.attributesToSnippet)!==null&&H!==void 0?H:["hierarchy.lvl1:".concat(l.current),"hierarchy.lvl2:".concat(l.current),"hierarchy.lvl3:".concat(l.current),"hierarchy.lvl4:".concat(l.current),"hierarchy.lvl5:".concat(l.current),"hierarchy.lvl6:".concat(l.current),"content:".concat(l.current)],snippetEllipsisText:(R=Q==null?void 0:Q.snippetEllipsisText)!==null&&R!==void 0?R:"\u2026",highlightPreTag:(Z=Q==null?void 0:Q.highlightPreTag)!==null&&Z!==void 0?Z:"<mark>",highlightPostTag:(q=Q==null?void 0:Q.highlightPostTag)!==null&&q!==void 0?q:"</mark>",hitsPerPage:(G=Q==null?void 0:Q.hitsPerPage)!==null&&G!==void 0?G:20,clickAnalytics:(L=Q==null?void 0:Q.clickAnalytics)!==null&&L!==void 0?L:w},Q!=null?Q:{})})});case 2:return x=I.v,S=x.results,I.a(2,S.flatMap(function(B){var d,H=B,R=H.hits,Z=H.nbHits,q=Ql(D(R),function(ne){return Xl(ne)},y);if(u.context.searchSuggestions.length<Object.keys(q).length&&a({searchSuggestions:C(C({},(d=u.context.searchSuggestions)!==null&&d!==void 0?d:[]),Object.keys(q))}),Z){var G=u.context.nbHits;a({nbHits:(G!=null?G:0)+Z})}var L={};return w&&(L={__autocomplete_indexName:H.index,__autocomplete_queryID:H.queryID,__autocomplete_algoliaCredentials:{appId:m,apiKey:v}}),Object.values(q).map(function(ne,Q){return{sourceId:"hits_".concat(H.index,"_").concat(Q),onSelect:function($){var Y=$.item,re=$.event;_(Y),_i(re)||O()},getItemUrl:function($){return $.item.url},getItems:function(){return Object.values(Ql(ne,function($){return $.hierarchy.lvl1},y)).map(function($){return $.map(function(Y){var re=null,me=$.find(function(se){return se.type==="lvl1"&&se.hierarchy.lvl1===Y.hierarchy.lvl1});return Y.type!=="lvl1"&&me&&(re=me),C(C({},Y),{},{__docsearch_parent:re},L)})}).flat()}}})}));case 3:throw I.p=3,(T=I.v).name==="RetryError"&&i("error"),T;case 4:return I.a(2)}},t,null,[[1,3]])}));return function(t){return e.apply(this,arguments)}})();function sA(e){var t,n,r,u,a=e.appId,i=e.apiKey,o=e.askAi,c=e.maxResultsPerGroup,l=e.theme,p=e.onClose,m=p===void 0?_v:p,v=e.transformItems,y=v===void 0?ss:v,F=e.hitComponent,D=F===void 0?pm:F,_=e.resultsFooterComponent,O=_===void 0?function(){return null}:_,w=e.navigator,x=e.initialScrollY,S=x===void 0?0:x,T=e.transformSearchClient,I=T===void 0?ss:T,B=e.disableUserPersonalization,d=B!==void 0&&B,H=e.initialQuery,R=H===void 0?"":H,Z=e.translations,q=Z===void 0?{}:Z,G=e.getMissingResultsUrl,L=e.insights,ne=L!==void 0&&L,Q=e.onAskAiToggle,$=e.interceptAskAiEvent,Y=e.isAskAiActive,re=Y!==void 0&&Y,me=e.recentSearchesLimit,se=me===void 0?7:me,K=e.recentSearchesWithFavoritesLimit,V=K===void 0?4:K,ue=e.indices,oe=ue===void 0?[]:ue,ce=e.indexName,ee=e.searchParameters,he=e.isHybridModeSupported,Ce=he!==void 0&&he,Re=an(e,aA),ge=q.footer,Te=q.searchBox,He=an(q,iA),nt=dt(b.useState({query:"",collections:[],completion:null,context:{},isOpen:!1,activeItemId:null,status:"idle"}),2),Ge=nt[0],yt=nt[1],Dt=!!o,mn=(q==null||(t=q.searchBox)===null||t===void 0?void 0:t.placeholderText)||Re.placeholder||"Search docs";Dt&&(mn=(q==null||(r=q.searchBox)===null||r===void 0?void 0:r.placeholderText)||"Search docs or ask AI a question"),re&&(mn=(q==null||(u=q.searchBox)===null||u===void 0?void 0:u.placeholderTextAskAi)||"Ask another question...");var Xt=b.useRef(null),un=b.useRef(null),Gn=b.useRef(null),Mt=b.useRef(null),Gt=b.useRef(null),Jt=b.useRef(15),en=b.useRef(typeof window!="undefined"?window.getSelection().toString().slice(0,512):"").current,ke=b.useRef(R||en).current,Ut=uA(a,i,I),Bt=Qt(o)==="object"?o:null,sr=typeof o=="string"?o:(Bt==null?void 0:Bt.assistantId)||null,cr=Bt==null?void 0:Bt.searchParameters,Jr=(Bt==null?void 0:Bt.useStagingEnv)||!1,Qr=dt(b.useState("initial"),2),Fn=Qr[0],$t=Qr[1],Jn=(function(le){var Ie=le.assistantId,Ve=le.searchClient,Ct=le.suggestedQuestionsEnabled,At=Ct!==void 0&&Ct,ln=dt(su([]),2),yn=ln[0],Dn=ln[1];return qn(function(){var Ir=(function(){var eu=Xe(Ae().m(function qt(){var Ht,Br,Nt;return Ae().w(function(fn){for(;;)switch(fn.n){case 0:return fn.n=1,Ve.search({requests:[{indexName:"algolia_ask_ai_suggested_questions",filters:"state:published AND assistantId:".concat(Ie),hitsPerPage:3}]});case 1:Ht=fn.v,Br=Ht.results,Nt=Br[0],Dn(Nt.hits);case 2:return fn.a(2)}},qt)}));return function(){return eu.apply(this,arguments)}})();At&&Ie&&Ie!==""&&Ir()},[At,Ie,Ve]),yn})({assistantId:sr,searchClient:Ut,suggestedQuestionsEnabled:Bt==null?void 0:Bt.suggestedQuestions}),Nn=(n=Bt==null?void 0:Bt.agentStudio)!==null&&n!==void 0&&n,lr=[];if(ce&&ce!==""&&lr.push({name:ce,searchParameters:ee}),oe.length>0&&oe.forEach(function(le){lr.push(typeof le=="string"?{name:le}:le)}),lr.length<1)throw new Error("Must supply either `indexName` or `indices` for DocSearch to work");var xn=lr[0].name,fr=b.useRef(sd({key:"__DOCSEARCH_ASKAI_CONVERSATIONS__".concat((Bt==null?void 0:Bt.indexName)||xn),limit:10})).current,Qn=b.useRef(od({key:"__DOCSEARCH_FAVORITE_SEARCHES__".concat(xn),limit:10})).current,kr=b.useRef(od({key:"__DOCSEARCH_RECENT_SEARCHES__".concat(xn),limit:Qn.getAll().length===0?se:V})).current,rt=dt(b.useState(!1),2),gn=rt[0],ui=rt[1],dr=(function(le){var Ie=le.assistantId,Ve=le.apiKey,Ct=le.appId,At=le.indexName,ln=le.useStagingEnv,yn=ln!==void 0&&ln,Dn=an(le,$b),Ir=Iu(new AbortController),eu=On(function(){return Dn.agentStudio?(function(kt){var ut=kt.appId,wt=kt.apiKey,Wt=kt.assistantId,Et=kt.searchParameters;return new bc({api:"https://".concat(ut,".algolia.net/agent-studio/1/agents/").concat(Wt,"/completions?stream=true&compatibilityMode=ai-sdk-5"),headers:{"x-algolia-application-id":ut,"x-algolia-api-key":wt},body:Et?{algolia:{searchParameters:Et}}:{}})})({apiKey:Ve,appId:Ct,assistantId:Ie!=null?Ie:"",searchParameters:Dn.searchParameters}):(function(kt){var ut,wt=kt.assistantId,Wt=kt.apiKey,Et=kt.indexName,at=kt.searchParameters,Tn=kt.appId,Rn=kt.abortController,tu=kt.useStagingEnv;return new bc({api:tu?Ds:ys,headers:(ut=Xe(Ae().m(function li(){var Xn;return Ae().w(function(hr){for(;;)switch(hr.n){case 0:if(wt){hr.n=1;break}throw new Error("Ask AI assistant ID is required");case 1:return hr.n=2,fh({assistantId:wt,abortSignal:Rn.signal,useStagingEnv:tu});case 2:return Xn=hr.v,hr.a(2,C(C({},Xn?{authorization:"TOKEN ".concat(Xn)}:{}),{},{"X-Algolia-API-Key":Wt,"X-Algolia-Application-Id":Tn,"X-Algolia-Index-Name":Et,"X-Algolia-Assistant-Id":wt||"","X-AI-SDK-Version":"v5"}))}},li)})),function(){return ut.apply(this,arguments)}),body:at?{searchParameters:at}:{}})})({assistantId:Ie!=null?Ie:"",apiKey:Ve,appId:Ct,indexName:At,searchParameters:Dn.searchParameters,abortController:Ir.current,useStagingEnv:yn})},[Ve,Ct,Ie,At,yn,Dn]),qt=(function(){var kt=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ut=kt.experimental_throttle,wt=kt.resume,Wt=wt!==void 0&&wt,Et=Nr(kt,Ev),at=Iu("chat"in Et?Et.chat:new ch(Et));("chat"in Et&&Et.chat!==at.current||"id"in Et&&at.current.id!==Et.id)&&(at.current="chat"in Et?Et.chat:new ch(Et));var Tn="id"in Et?Et.id:null,Rn=pa(function(vr){return at.current["~registerMessagesCallback"](vr,ut)},[ut,Tn]),tu=ha(Rn,function(){return at.current.messages}),li=ha(at.current["~registerStatusCallback"],function(){return at.current.status}),Xn=ha(at.current["~registerErrorCallback"],function(){return at.current.error}),hr=pa(function(vr){typeof vr=="function"&&(vr=vr(at.current.messages)),at.current.messages=vr},[at]);return qn(function(){Wt&&at.current.resumeStream()},[Wt,at]),{id:at.current.id,messages:tu,setMessages:hr,sendMessage:at.current.sendMessage,regenerate:at.current.regenerate,clearError:at.current.clearError,stop:at.current.stop,error:Xn,resumeStream:at.current.resumeStream,status:li,addToolResult:at.current.addToolOutput,addToolOutput:at.current.addToolOutput}})({sendAutomaticallyWhen:Nb,transport:eu}),Ht=qt.messages,Br=qt.sendMessage,Nt=qt.status,fn=qt.setMessages,nn=qt.error,_u=qt.stop,pr=Iu(sd({key:"__DOCSEARCH_ASKAI_CONVERSATIONS__".concat(At),limit:10})).current,ci=pa((function(){var kt=Xe(Ae().m(function ut(wt,Wt){var Et;return Ae().w(function(at){for(;;)switch(at.n){case 0:if(Ie){at.n=1;break}return at.a(2);case 1:return at.n=2,Mb({assistantId:Ie,thumbs:Wt,messageId:wt,appId:Ct,abortSignal:Ir.current.signal,useStagingEnv:yn});case 2:if(!(at.v.status>=300)){at.n=3;break}throw new Error("Failed, try again later.");case 3:(Et=pr.addFeedback)===null||Et===void 0||Et.call(pr,wt,Wt===1?"like":"dislike");case 4:return at.a(2)}},ut)}));return function(ut,wt){return kt.apply(this,arguments)}})(),[Ie,Ct,pr,yn]),So=(function(){var kt=Xe(Ae().m(function ut(){return Ae().w(function(wt){for(;;)switch(wt.n){case 0:return Ir.current.abort(),wt.n=1,_u();case 1:return wt.a(2)}},ut)}));return function(){return kt.apply(this,arguments)}})(),ta=On(function(){for(var kt=[],ut=0;ut<Ht.length;ut++)if(Ht[ut].role==="user"){var wt,Wt=Ht[ut],Et=((wt=Ht[ut+1])===null||wt===void 0?void 0:wt.role)==="assistant"?Ht[ut+1]:null;kt.push({id:Wt.id,userMessage:Wt,assistantMessage:Et}),Et&&ut++}return kt},[Ht]),xo=Nt==="streaming"||Nt==="submitted",Sc=On(function(){if(nn)return Dn.agentStudio?(function(kt){var ut=kt.message;try{var wt=JSON.parse(kt.message);if(wt.name==="ValidationError"){var Wt=wt;if(Wt.detail&&Wt.detail.length>0){var Et=Wt.detail[0],at=Et.msg,Tn=Et.loc.at(-1);ut="".concat(at,": ").concat(Tn)}}else ut=wt.message}catch(Rn){}return new Error(ut)})(nn):nn},[nn,Dn.agentStudio]);return{messages:Ht,sendMessage:Br,status:Nt,setMessages:fn,askAiError:Sc,stopAskAiStreaming:So,isStreaming:xo,exchanges:ta,conversations:pr,sendFeedback:ci}})({assistantId:sr,apiKey:(Bt==null?void 0:Bt.apiKey)||i,appId:(Bt==null?void 0:Bt.appId)||a,indexName:(Bt==null?void 0:Bt.indexName)||xn,searchParameters:cr,useStagingEnv:Jr,agentStudio:Nn}),tn=dr.messages,Zt=dr.status,wr=dr.setMessages,Fo=dr.sendMessage,_o=dr.stopAskAiStreaming,Au=dr.askAiError,Sr=dr.sendFeedback,xr=b.useRef(Zt);b.useEffect(function(){if(!d){if(xr.current==="streaming"&&Zt==="ready"){gn&&tn.at(-1)&&(tn.at(-1).metadata={stopped:!0});var le,Ie=ye(tn[0].parts);try{for(Ie.s();!(le=Ie.n()).done;){var Ve=le.value;Ve.type==="text"&&fr.add(Xm(Ve.text,tn))}}catch(Ct){Ie.e(Ct)}finally{Ie.f()}}xr.current=Zt}},[Zt,tn,fr,d,gn]);var ai=b.useMemo(function(){return Zt==="error"&&Is(Au)},[Zt,Au]),Eu=b.useCallback(function(le){var Ie=le.hierarchy,Ve=["lvl6","lvl5","lvl4","lvl3","lvl2","lvl1","lvl0"].find(function(Ct){return Ie[Ct]});return C(C({},le),{},{type:Ve||"lvl0",content:null})},[]),ii=b.useCallback(function(le){if(!d){var Ie=le.type==="content"?le.__docsearch_parent||Eu(le):le;Ie&&Qn.getAll().findIndex(function(Ve){return Ve.objectID===Ie.objectID})===-1&&kr.add(Ie)}},[Qn,kr,d,Eu]),kc=b.useCallback(function(le){if(Ge.context.algoliaInsightsPlugin&&le.__autocomplete_id){var Ie=le,Ve={eventName:"Item Selected",index:Ie.__autocomplete_indexName,items:[Ie],positions:[le.__autocomplete_id],queryID:Ie.__autocomplete_queryID};Ge.context.algoliaInsightsPlugin.insights.clickedObjectIDsAfterSearch(Ve)}},[Ge.context.algoliaInsightsPlugin]),Yn=b.useRef(void 0),Yr=b.useCallback(function(le,Ie){var Ve=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(le){var Ct={query:Ie,suggestedQuestionId:Ve==null?void 0:Ve.objectID};if($!=null&&$(Ct))return void(Yn.current&&Yn.current.setQuery(""))}if(le&&Fn==="new-conversation"&&$t("initial"),Q(le,{query:Ie,suggestedQuestionId:Ve==null?void 0:Ve.objectID}),!Ce){ui(!1);var At={};if(Ve&&(At.body={suggestedQuestionId:Ve.objectID}),Fo({role:"user",parts:[{type:"text",text:Ie}]},At),Mt.current){var ln=Mt.current;typeof ln.scrollTo=="function"?ln.scrollTo({top:0,behavior:"smooth"}):ln.scrollTop=0}Yn.current&&Yn.current.setQuery("")}},[Q,$,Fo,Fn,$t,Ce]),wc=b.useCallback((function(){var le=Xe(Ae().m(function Ie(Ve,Ct){return Ae().w(function(At){for(;;)switch(At.n){case 0:if(sr&&a){At.n=1;break}return At.a(2);case 1:return At.n=2,Sr(Ve,Ct);case 2:return At.a(2)}},Ie)}));return function(Ie,Ve){return le.apply(this,arguments)}})(),[sr,a,Sr]);Yn.current||(Yn.current=lm({id:"docsearch",defaultActiveItemId:0,openOnFocus:!0,initialState:{query:ke,context:{searchSuggestions:[]}},insights:!!ne,navigator:w,onStateChange:function(le){yt(le.state)},getSources:function(le){var Ie=le.query,Ve=le.state,Ct=le.setContext,At=le.setStatus;if(!Ie){var ln=(function(qt){var Ht=qt.recentSearches,Br=qt.favoriteSearches,Nt=qt.saveRecentSearch,fn=qt.onClose;return qt.disableUserPersonalization?[]:[{sourceId:"recentSearches",onSelect:function(nn){var _u=nn.item,pr=nn.event;Nt(_u),_i(pr)||fn()},getItemUrl:function(nn){return nn.item.url},getItems:function(){return Ht.getAll()}},{sourceId:"favoriteSearches",onSelect:function(nn){var _u=nn.item,pr=nn.event;Nt(_u),_i(pr)||fn()},getItemUrl:function(nn){return nn.item.url},getItems:function(){return Br.getAll()}}]})({recentSearches:kr,favoriteSearches:Qn,saveRecentSearch:ii,onClose:m,disableUserPersonalization:d,canHandleAskAi:Dt}),yn=Dt?[{sourceId:"recentConversations",getItems:function(){return d?[]:fr.getAll()},onSelect:function(qt){var Ht=qt.item;Ht.messages&&(wr(Ht.messages),Q(!0))}}]:[];return[].concat(be(ln),yn)}var Dn={context:Ve.context},Ir=oA({query:Ie,state:Dn,setContext:Ct,setStatus:At,searchClient:Ut,indexes:lr,snippetLength:Jt,insights:!!ne,appId:a,apiKey:i,maxResultsPerGroup:c,transformItems:y,saveRecentSearch:ii,onClose:m}),eu=Dt?[{sourceId:"askAI",getItems:function(){return[{type:"askAI",query:Ie,url_without_anchor:"",objectID:"ask-ai-button",content:null,url:"",anchor:null,hierarchy:{lvl0:"Ask AI",lvl1:Ie,lvl2:null,lvl3:null,lvl4:null,lvl5:null,lvl6:null},_highlightResult:{},_snippetResult:{},__docsearch_parent:null}]},onSelect:function(qt){var Ht=qt.item;Ht.type==="askAI"&&Ht.query&&Yr(!0,Ht.query)}}]:[];return Ir.then(function(qt){return[].concat(eu,be(qt))})}}));var Co,Tr,Or=Yn.current,Xr=Or.getEnvironmentProps,ko=Or.getRootProps,ea=Or.refresh;(function(le){var Ie=le.getEnvironmentProps,Ve=le.panelElement,Ct=le.formElement,At=le.inputElement;b.useEffect(function(){if(Ve&&Ct&&At){var ln=Ie({panelElement:Ve,formElement:Ct,inputElement:At}),yn=ln.onTouchStart,Dn=ln.onTouchMove;return window.addEventListener("touchstart",yn),window.addEventListener("touchmove",Dn),function(){window.removeEventListener("touchstart",yn),window.removeEventListener("touchmove",Dn)}}},[Ie,Ve,Ct,At])})({getEnvironmentProps:Xr,panelElement:Mt.current,formElement:Gn.current,inputElement:Gt.current}),Co={container:Xt.current},Tr=Co.container,b.useEffect(function(){if(Tr){var le=Tr.querySelectorAll("a[href]:not([disabled]), button:not([disabled]), input:not([disabled])"),Ie=le[0],Ve=le[le.length-1];return Tr.addEventListener("keydown",Ct),function(){Tr.removeEventListener("keydown",Ct)}}function Ct(At){At.key==="Tab"&&(At.shiftKey?document.activeElement===Ie&&(At.preventDefault(),Ve.focus()):document.activeElement===Ve&&(At.preventDefault(),Ie.focus()))}},[Tr]),Jl({theme:l}),b.useEffect(function(){return document.body.classList.add("DocSearch--active"),function(){var le,Ie;document.body.classList.remove("DocSearch--active"),(le=(Ie=window).scrollTo)===null||le===void 0||le.call(Ie,0,S)}},[]),b.useEffect(function(){typeof window!="undefined"&&window.localStorage&&(function(){if(typeof window=="undefined"||!window.localStorage)return 0;var le=0;for(var Ie in window.localStorage)window.localStorage.hasOwnProperty(Ie)&&(le+=window.localStorage[Ie].length+Ie.length);return le})()>4194304&&ad()},[]),b.useLayoutEffect(function(){var le=window.innerWidth-document.body.clientWidth;return document.body.style.marginInlineEnd="".concat(le,"px"),function(){document.body.style.marginInlineEnd="0px"}},[]),b.useEffect(function(){window.matchMedia("(max-width: 768px)").matches&&(Jt.current=5)},[]),b.useEffect(function(){var le;Mt.current&&!re&&(typeof(le=Mt.current).scrollTo=="function"?le.scrollTo({top:0,behavior:"smooth"}):le.scrollTop=0)},[Ge.query,re]),b.useEffect(function(){ke.length>0&&(ea(),Gt.current&&Gt.current.focus())},[ke,ea]),b.useEffect(function(){function le(){if(un.current){var Ie=.01*window.innerHeight;un.current.style.setProperty("--docsearch-vh","".concat(Ie,"px"))}}return le(),window.addEventListener("resize",le),function(){window.removeEventListener("resize",le)}},[]),b.useEffect(function(){re||(Or.refresh(),wr([]))},[re,Or,wr]),b.useEffect(function(){$t("initial")},[re,$t]);var oi=(function(){var le=Xe(Ae().m(function Ie(){return Ae().w(function(Ve){for(;;)switch(Ve.n){case 0:return ui(!0),Ve.n=1,_o();case 1:return Ve.a(2)}},Ie)}));return function(){return le.apply(this,arguments)}})(),Fu=function(){wr([]),$t("new-conversation")},si=!0,wo=Ge.collections.some(function(le){return le.items.length>0});return Ge.status!=="idle"||wo!==!1||Ge.query.length!==0||re||(si=!1),b.createElement("div",Tt({ref:Xt},ko({"aria-expanded":!0}),{className:["DocSearch","DocSearch-Container",Ge.status==="stalled"&&"DocSearch-Container--Stalled",Ge.status==="error"&&"DocSearch-Container--Errored"].filter(Boolean).join(" "),role:"button",tabIndex:0,onMouseDown:function(le){le.target===le.currentTarget&&m()}}),b.createElement("div",{className:"DocSearch-Modal",ref:un},b.createElement("header",{className:"DocSearch-SearchBar",ref:Gn},b.createElement(x0,Tt({},Or,{state:Ge,placeholder:mn||"Search docs",autoFocus:ke.length===0,inputRef:Gt,isFromSelection:!!ke&&ke===en,translations:Te,isAskAiActive:re,askAiStatus:Zt,askAiError:Au,askAiState:Fn,setAskAiState:$t,isThreadDepthError:ai&&Fn!=="new-conversation",onClose:m,onAskAiToggle:Q,onAskAgain:function(le){Yr(!0,le)},onStopAskAiStreaming:oi,onNewConversation:Fu,onViewConversationHistory:function(){$t("conversation-history")}}))),si&&b.createElement("div",{className:"DocSearch-Dropdown",ref:Mt},b.createElement(_0,Tt({},Or,{indexName:xn,state:Ge,hitComponent:D,resultsFooterComponent:O,disableUserPersonalization:d,recentSearches:kr,favoriteSearches:Qn,conversations:fr,inputRef:Gt,translations:He,getMissingResultsUrl:G,isAskAiActive:re,canHandleAskAi:Dt,messages:tn,askAiError:Au,status:Zt,hasCollections:wo,askAiState:Fn,selectAskAiQuestion:Yr,suggestedQuestions:Jn,selectSuggestedQuestion:function(le){Yr(!0,le.question,le)},agentStudio:Nn,onAskAiToggle:Q,onNewConversation:Fu,onItemClick:function(le,Ie){if(le.type==="askAI"&&le.query){if(le.anchor==="stored"&&"messages"in le){wr(le.messages);var Ve={query:le.query,messageId:le.messages[0].id};if($!=null&&$(Ve))return Yn.current&&Yn.current.setQuery(""),void Ie.preventDefault();Q(!0,Ve)}else Yr(!0,le.query);return $t("initial"),void Ie.preventDefault()}kc(le),ii(le),_i(Ie)||m()},onFeedback:wc}))),b.createElement("footer",{className:"DocSearch-Footer"},b.createElement(dm,{translations:ge,isAskAiActive:re}))))}var cA=b.forwardRef(function(e,t){return b.createElement(Hl,Tt({},e,{ref:t}),b.createElement(lA,e))});function lA(e){var t,n,r,u=(function(){var y=b.useContext(us);if(y===void 0)throw new Error("`useDocSearch` must be used within the `DocSearch` provider");return y})(),a=u.searchButtonRef,i=u.keyboardShortcuts,o=u.isModalActive,c=u.isAskAiActive,l=u.initialQuery,p=u.onAskAiToggle,m=u.openModal,v=u.closeModal;return b.createElement(b.Fragment,null,b.createElement(wv,{keyboardShortcuts:i,ref:a,translations:(t=e.translations)===null||t===void 0?void 0:t.button,onClick:m}),o&&Il(b.createElement(sA,Tt({},e,{initialScrollY:window.scrollY,initialQuery:l,translations:e==null||(n=e.translations)===null||n===void 0?void 0:n.modal,isAskAiActive:c,onAskAiToggle:p,onClose:v})),(r=e.portalContainer)!==null&&r!==void 0?r:document.body))}var yh=function(e,t,n,r){var u;t[0]=0;for(var a=1;a<t.length;a++){var i=t[a++],o=t[a]?(t[0]|=i?1:2,n[t[a++]]):t[++a];i===3?r[0]=o:i===4?r[1]=Object.assign(r[1]||{},o):i===5?(r[1]=r[1]||{})[t[++a]]=o:i===6?r[1][t[++a]]+=o+"":i?(u=e.apply(o,yh(e,o,n,["",null])),r.push(u),o[0]?t[0]|=2:(t[a-2]=0,t[a]=u)):r.push(o)}return r},Dh=new Map,fA=["container","environment","transformSearchClient","hitComponent","resultsFooterComponent"],dA=function(e){var t=Dh.get(this);return t||(t=new Map,Dh.set(this,t)),(t=yh(this,t.get(e)||(t.set(e,t=(function(n){for(var r,u,a=1,i="",o="",c=[0],l=function(v){a===1&&(v||(i=i.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,v,i):a===3&&(v||i)?(c.push(3,v,i),a=2):a===2&&i==="..."&&v?c.push(4,v,0):a===2&&i&&!v?c.push(5,0,!0,i):a>=5&&((i||!v&&a===5)&&(c.push(a,0,i,u),a=6),v&&(c.push(a,v,0,u),a=6)),i=""},p=0;p<n.length;p++){p&&(a===1&&l(),l(p));for(var m=0;m<n[p].length;m++)r=n[p][m],a===1?r==="<"?(l(),c=[c],a=3):i+=r:a===4?i==="--"&&r===">"?(a=1,i=""):i=r+i[0]:o?r===o?o="":i+=r:r==='"'||r==="'"?o=r:r===">"?(l(),a=1):a&&(r==="="?(a=5,u=i,i=""):r==="/"&&(a<5||n[p][m+1]===">")?(l(),a===3&&(c=c[0]),a=c,(c=c[0]).push(2,0,a),a=0):r===" "||r===" "||r===`
119
119
  `||r==="\r"?(l(),a=2):i+=r),a===3&&i==="!--"&&(a=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}.bind(kn);function bh(e){if(e)return function(t){var n=e(t,{html:dA});return va(n)?n:typeof n=="function"?n(t):typeof n=="string"?kn("span",null,n):n}}function pA(e){var t=e.container,n=e.environment,r=e.transformSearchClient,u=e.hitComponent,a=e.resultsFooterComponent,i=Nr(e,fA),o=(function(m,v){if(typeof m!="string")return m;if(!v)throw new Error("Cannot resolve a selector without a browser environment.");var y=v.document.querySelector(m);if(!y)throw new Error('Container selector did not match any element: "'.concat(m,'"'));return y})(t,n||(typeof window!="undefined"?window:void 0)),c={current:null},l=!1,p=pe(pe({},i),{},{ref:c,hitComponent:bh(u),resultsFooterComponent:bh(a),transformSearchClient:function(m){return m!=null&&m.addAlgoliaAgent&&m.addAlgoliaAgent("docsearch.js",Cc),typeof r=="function"?r(m):m}});return Pl(kn(cA,p),o),l=!0,{open:function(){var m;(m=c.current)===null||m===void 0||m.open()},close:function(){var m;(m=c.current)===null||m===void 0||m.close()},openAskAi:function(m){var v;(v=c.current)===null||v===void 0||v.openAskAi(m)},get isReady(){return l},get isOpen(){var m,v;return(m=(v=c.current)===null||v===void 0?void 0:v.isOpen)!==null&&m!==void 0&&m},destroy:function(){Ll(o),l=!1}}}pA({appId:"S4T2OSB07R",apiKey:"ea6ae2e0546ad6007f7f464a296b67de",indexName:"chocolatey",container:"#docsearchResults"}),(()=>{let e=document.querySelectorAll('.task-list-item [type="checkbox"]');e&&e.forEach(t=>{t.classList.add("form-check-input"),t.outerHTML=`<div class="form-check">${t.outerHTML}<label class="form-check-label"></label></div>`})})();var hA=mi(Mh());window.addEventListener("DOMContentLoaded",()=>{if(document.querySelector(".anchorjs-container")){for(let t of document.querySelectorAll("li")){let n=t.firstChild,r=t.classList.contains("task-list-item"),u;switch(r?u=n.nextElementSibling:u=n,u.nodeName){case"STRONG":case"CODE":u.classList.add("d-anchor");break;default:break}}let e=new hA.default;e.options.placement="left",e.add(".anchorjs-container h2:not(.d-anchor-none), .anchorjs-container h3:not(.d-anchor-none), .anchorjs-container h4:not(.d-anchor-none), .anchorjs-container h5:not(.d-anchor-none), .anchorjs-container h6:not(.d-anchor-none), .anchorjs-container li .d-anchor")}});var or=mi($h());(0,or.default)(".nav-scrollspy .nav-link").each((e,t)=>{let n=(0,or.default)(t).attr("href"),r=u=>{if(u==="#"){(0,or.default)(t).parent().remove();return}~u.indexOf(".")&&(u=u.replace(/\./g,"\\.")),(0,or.default)(u).length&&((0,or.default)(window).scrollTop()>(0,or.default)(u).offset().top-30&&(0,or.default)(u).is(":visible")?((0,or.default)(`a[href="${u}"].nav-link`).addClass("active active-page"),(0,or.default)(`a[href="${u}"].nav-link`).parent().prev().find("a.active").removeClass("active active-page")):(0,or.default)(`a[href="${u}"].nav-link`).removeClass("active active-page"))};r(n),window.addEventListener("scroll",()=>{r(n)})}),window.addEventListener("DOMContentLoaded",()=>{let e="data-choco-tab-multi",t=document.querySelectorAll(`[${e}]`),n=new Set;if(t&&t.length>0){for(let r of t){let u=r.getAttribute(e).replace(/\s/g,""),a=null;if(u){try{a=JSON.parse(u!=null?u:"")}catch(i){return}for(let i in a)Object.prototype.hasOwnProperty.call(a,i)&&n.add(i);r.addEventListener("click",()=>{let i=r.getAttribute(e).replace(/\s/g,"");for(let c of t){let l=c.getAttribute(e).replace(/\s/g,"");l!=null&&l.includes(i!=null?i:"")&&window.bootstrap.Tab.getOrCreateInstance(c).show()}let o=~location.hostname.indexOf("chocolatey.org")?"domain=chocolatey.org;":"";for(let c in a)if(Object.prototype.hasOwnProperty.call(a,c)){let l=a[c];document.cookie=`${c}=${l}; ${gi()}path=/; ${o}`}})}}for(let r of n){let u=Po(r);if(u)for(let a of t){let i=a.getAttribute(e).replace(/\s/g,"");i!=null&&i.includes(r)&&(i!=null&&i.includes(u))&&window.bootstrap.Tab.getOrCreateInstance(a).show()}}}}),(()=>{let e=document.querySelectorAll("table");e&&e.forEach(t=>{t.classList.add("table","table-bordered","table-striped"),t.outerHTML=`<div class="table-responsive">${t.outerHTML}</div>`})})(),document.querySelectorAll(".dropdown-theme").forEach(t=>{t.querySelectorAll(".dropdown-toggle").forEach(n=>{n.addEventListener("hide.bs.dropdown",()=>{document.querySelectorAll("main").forEach(r=>{r.classList.remove("z-0")})}),n.addEventListener("show.bs.dropdown",()=>{document.querySelectorAll("main").forEach(r=>{r.classList.add("z-0")})})})});var vA=()=>{document.querySelectorAll(".copy-command").forEach(e=>{let t=e.querySelector("code").getAttribute("class").split(" "),n=e.querySelector("button");n&&(n.classList.add("btn-copy"),n.setAttribute("data-clipboard-target",`.${t[0]}`))})},mA=e=>e.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),Ah=(e,t,n,r)=>{let u;if(n==="never")u=gi();else if(n==="expired")u="expires=Thu, 01 Jan 1970 00:00:00 UTC";else{let i=new Date;i.setTime(i.getTime()+n*24*60*60*1e3),u=`expires=${i.toUTCString()}`}let a=r||"";document.cookie=`${e}=${encodeURIComponent(t)};${u};path=/;${a};`};document.addEventListener("DOMContentLoaded",()=>{let e=document.querySelectorAll(".dynamic-code-block-container"),t=document.querySelectorAll(".dynamic-code-block-input"),n=document.querySelectorAll(".dynamic-code-block-validation"),r=(a,i,o,c)=>{let l=document.querySelectorAll(`.${i}`),p=c||a.value;if(a.value||c)for(let m of l)m.textContent=p,Ah(i,p,"never"),c&&c!==o&&(a.value=c);else for(let m of l)m.textContent=o,Ah(i,o,"never")},u=()=>{n.forEach(a=>{let i=a.getAttribute("data-input-names").split(","),o=!0;for(let c of i){let l=document.querySelector(`.dynamic-code-block-input[name="${c}"]`);l.value?l.classList.remove("is-invalid"):(o=!1,l.classList.add("is-invalid"))}o?(a.classList.remove("show"),setTimeout(()=>{a.classList.add("d-none")},150)):(a.classList.remove("d-none"),a.classList.add("show"))})};t.forEach(a=>{let i=a.name,o=a.getAttribute("data-default-value"),c=Po(i),l=new RegExp(`\\b${i}\\b`,"g");for(let p of e){let v=mA(c||o);p.innerHTML=p.innerHTML.replaceAll(l,`<span class="${i}">${v}</span>`)}r(a,i,o,c),u(),a.addEventListener("keyup",()=>{r(a,i,o),u()})}),vA()})})();})();
120
120
  /**
121
121
  * Prism: Lightweight, robust, elegant syntax highlighting
@@ -148,6 +148,6 @@ jquery/dist/jquery.js:
148
148
  *)
149
149
 
150
150
  @docsearch/js/dist/esm/index.js:
151
- (*! @docsearch/js 4.5.4 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com *)
151
+ (*! @docsearch/js 4.6.0 | MIT License | © Algolia, Inc. and contributors | https://docsearch.algolia.com *)
152
152
  (*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
153
153
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chocolatey-software/docs",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Chocolatey Software theme assets for use on docs.chocolatey.org.",
5
5
  "author": "Chocolatey Software (https://chocolatey.org/)",
6
6
  "homepage": "https://github.com/chocolatey/choco-theme/blob/main/packages/docs#readme",
@@ -14,7 +14,7 @@
14
14
  "dependencies": {
15
15
  "@docsearch/css": "^4.4.0",
16
16
  "@docsearch/js": "^4.4.0",
17
- "@fortawesome/fontawesome-free": "^7.0.0",
17
+ "@fortawesome/fontawesome-free": "^7.2.0",
18
18
  "anchor-js": "^5.0.0",
19
19
  "bootstrap": "^5.3.7",
20
20
  "clipboard": "^2.0.11",