investing 0.1.12 → 0.1.13

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.
@@ -1,15 +0,0 @@
1
- import{relations as e,eq as t,and as n,desc as r,asc as i,sql as a,gte as o,lte as s}from"drizzle-orm";import c from"xgboost_node";import l from"yahoo-finance2";import u from"dotenv";import d from"axios";import p from"node-fetch";import"predictos";const h=/* @__PURE__ */Symbol.for("drizzle:entityKind");function f(e,t){if(!e||"object"!=typeof e)return!1;if(e instanceof t)return!0;if(!Object.prototype.hasOwnProperty.call(t,h))throw new Error(`Class "${t.name??"<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`);let n=Object.getPrototypeOf(e).constructor;if(n)for(;n;){if(h in n&&n[h]===t[h])return!0;n=Object.getPrototypeOf(n)}return!1}class m{static[h]="ConsoleLogWriter";write(e){console.log(e)}}class g{static[h]="DefaultLogger";writer;constructor(e){this.writer=e?.writer??new m}logQuery(e,t){const n=t.map(e=>{try{return JSON.stringify(e)}catch{return String(e)}}),r=n.length?` -- params: [${n.join(", ")}]`:"";this.writer.write(`Query: ${e}${r}`)}}class y{static[h]="NoopLogger";logQuery(){}}const I=/* @__PURE__ */Symbol.for("drizzle:Name"),C=/* @__PURE__ */Symbol.for("drizzle:Schema"),A=/* @__PURE__ */Symbol.for("drizzle:Columns"),S=/* @__PURE__ */Symbol.for("drizzle:ExtraConfigColumns"),b=/* @__PURE__ */Symbol.for("drizzle:OriginalName"),T=/* @__PURE__ */Symbol.for("drizzle:BaseName"),v=/* @__PURE__ */Symbol.for("drizzle:IsAlias"),_=/* @__PURE__ */Symbol.for("drizzle:ExtraConfigBuilder"),w=/* @__PURE__ */Symbol.for("drizzle:IsDrizzleTable");class E{static[h]="Table";static Symbol={Name:I,Schema:C,OriginalName:b,Columns:A,ExtraConfigColumns:S,BaseName:T,IsAlias:v,ExtraConfigBuilder:_};[I];[b];[C];[A];[S];[T];[v]=!1;[w]=!0;[_]=void 0;constructor(e,t,n){this[I]=this[b]=e,this[C]=t,this[T]=n}}function P(e){return e[I]}function R(e){return`${e[C]??"public"}.${e[I]}`}class L{constructor(e,t){this.table=e,this.config=t,this.name=t.name,this.keyAsName=t.keyAsName,this.notNull=t.notNull,this.default=t.default,this.defaultFn=t.defaultFn,this.onUpdateFn=t.onUpdateFn,this.hasDefault=t.hasDefault,this.primary=t.primaryKey,this.isUnique=t.isUnique,this.uniqueName=t.uniqueName,this.uniqueType=t.uniqueType,this.dataType=t.dataType,this.columnType=t.columnType,this.generated=t.generated,this.generatedIdentity=t.generatedIdentity}static[h]="Column";name;keyAsName;primary;notNull;default;defaultFn;onUpdateFn;hasDefault;isUnique;uniqueName;uniqueType;dataType;columnType;enumValues=void 0;generated=void 0;generatedIdentity=void 0;config;mapFromDriverValue(e){return e}mapToDriverValue(e){return e}shouldDisableInsert(){return void 0!==this.config.generated&&"byDefault"!==this.config.generated.type}}class N{static[h]="ColumnBuilder";config;constructor(e,t,n){this.config={name:e,keyAsName:""===e,notNull:!1,default:void 0,hasDefault:!1,primaryKey:!1,isUnique:!1,uniqueName:void 0,uniqueType:void 0,dataType:t,columnType:n,generated:void 0}}$type(){return this}notNull(){return this.config.notNull=!0,this}default(e){return this.config.default=e,this.config.hasDefault=!0,this}$defaultFn(e){return this.config.defaultFn=e,this.config.hasDefault=!0,this}$default=this.$defaultFn;$onUpdateFn(e){return this.config.onUpdateFn=e,this.config.hasDefault=!0,this}$onUpdate=this.$onUpdateFn;primaryKey(){return this.config.primaryKey=!0,this.config.notNull=!0,this}setName(e){""===this.config.name&&(this.config.name=e)}}const O=/* @__PURE__ */Symbol.for("drizzle:isPgEnum");class B{static[h]="Subquery";constructor(e,t,n,r=!1,i=[]){this._={brand:"Subquery",sql:e,selectedFields:t,alias:n,isWith:r,usedTables:i}}}class M extends B{static[h]="WithSubquery"}const D={startActiveSpan:(e,t)=>t()},F=/* @__PURE__ */Symbol.for("drizzle:ViewBaseConfig");function k(e){return null!=e&&"function"==typeof e.getSQL}class G{static[h]="StringChunk";value;constructor(e){this.value=Array.isArray(e)?e:[e]}getSQL(){return new H([this])}}class H{constructor(e){this.queryChunks=e;for(const t of e)if(f(t,E)){const e=t[E.Symbol.Schema];this.usedTables.push(void 0===e?t[E.Symbol.Name]:e+"."+t[E.Symbol.Name])}}static[h]="SQL";decoder=U;shouldInlineParams=!1;usedTables=[];append(e){return this.queryChunks.push(...e.queryChunks),this}toQuery(e){return D.startActiveSpan("drizzle.buildSQL",t=>{const n=this.buildQueryFromSourceParams(this.queryChunks,e);return t?.setAttributes({"drizzle.query.text":n.sql,"drizzle.query.params":JSON.stringify(n.params)}),n})}buildQueryFromSourceParams(e,t){const n=Object.assign({},t,{inlineParams:t.inlineParams||this.shouldInlineParams,paramStartIndex:t.paramStartIndex||{value:0}}),{casing:r,escapeName:i,escapeParam:a,prepareTyping:o,inlineParams:s,paramStartIndex:c}=n;return function(e){const t={sql:"",params:[]};for(const n of e)t.sql+=n.sql,t.params.push(...n.params),n.typings?.length&&(t.typings||(t.typings=[]),t.typings.push(...n.typings));return t}(e.map(e=>{if(f(e,G))return{sql:e.value.join(""),params:[]};if(f(e,x))return{sql:i(e.value),params:[]};if(void 0===e)return{sql:"",params:[]};if(Array.isArray(e)){const t=[new G("(")];for(const[n,r]of e.entries())t.push(r),n<e.length-1&&t.push(new G(", "));return t.push(new G(")")),this.buildQueryFromSourceParams(t,n)}if(f(e,H))return this.buildQueryFromSourceParams(e.queryChunks,{...n,inlineParams:s||e.shouldInlineParams});if(f(e,E)){const t=e[E.Symbol.Schema],n=e[E.Symbol.Name];return{sql:void 0===t||e[v]?i(n):i(t)+"."+i(n),params:[]}}if(f(e,L)){const n=r.getColumnCasing(e);if("indexes"===t.invokeSource)return{sql:i(n),params:[]};const a=e.table[E.Symbol.Schema];return{sql:e.table[v]||void 0===a?i(e.table[E.Symbol.Name])+"."+i(n):i(a)+"."+i(e.table[E.Symbol.Name])+"."+i(n),params:[]}}if(f(e,q)){const t=e[F].schema,n=e[F].name;return{sql:void 0===t||e[F].isAlias?i(n):i(t)+"."+i(n),params:[]}}if(f(e,$)){if(f(e.value,X))return{sql:a(c.value++,e),params:[e],typings:["none"]};const t=null===e.value?null:e.encoder.mapToDriverValue(e.value);if(f(t,H))return this.buildQueryFromSourceParams([t],n);if(s)return{sql:this.mapInlineParam(t,n),params:[]};let r=["none"];return o&&(r=[o(e.encoder)]),{sql:a(c.value++,t),params:[t],typings:r}}return f(e,X)?{sql:a(c.value++,e),params:[e],typings:["none"]}:f(e,H.Aliased)&&void 0!==e.fieldAlias?{sql:i(e.fieldAlias),params:[]}:f(e,B)?e._.isWith?{sql:i(e._.alias),params:[]}:this.buildQueryFromSourceParams([new G("("),e._.sql,new G(") "),new x(e._.alias)],n):(l=e)&&"function"==typeof l&&O in l&&!0===l[O]?e.schema?{sql:i(e.schema)+"."+i(e.enumName),params:[]}:{sql:i(e.enumName),params:[]}:k(e)?e.shouldOmitSQLParens?.()?this.buildQueryFromSourceParams([e.getSQL()],n):this.buildQueryFromSourceParams([new G("("),e.getSQL(),new G(")")],n):s?{sql:this.mapInlineParam(e,n),params:[]}:{sql:a(c.value++,e),params:[e],typings:["none"]};var l}))}mapInlineParam(e,{escapeString:t}){if(null===e)return"null";if("number"==typeof e||"boolean"==typeof e)return e.toString();if("string"==typeof e)return t(e);if("object"==typeof e){const n=e.toString();return t("[object Object]"===n?JSON.stringify(e):n)}throw new Error("Unexpected param value: "+e)}getSQL(){return this}as(e){return void 0===e?this:new H.Aliased(this,e)}mapWith(e){return this.decoder="function"==typeof e?{mapFromDriverValue:e}:e,this}inlineParams(){return this.shouldInlineParams=!0,this}if(e){return e?this:void 0}}class x{constructor(e){this.value=e}static[h]="Name";brand;getSQL(){return new H([this])}}const U={mapFromDriverValue:e=>e},V={mapToDriverValue:e=>e};class ${constructor(e,t=V){this.value=e,this.encoder=t}static[h]="Param";brand;getSQL(){return new H([this])}}function j(e,...t){const n=[];(t.length>0||e.length>0&&""!==e[0])&&n.push(new G(e[0]));for(const[r,i]of t.entries())n.push(i,new G(e[r+1]));return new H(n)}var W;(W=j||(j={})).empty=function(){return new H([])},W.fromList=function(e){return new H(e)},W.raw=function(e){return new H([new G(e)])},W.join=function(e,t){const n=[];for(const[r,i]of e.entries())r>0&&void 0!==t&&n.push(t),n.push(i);return new H(n)},W.identifier=function(e){return new x(e)},W.placeholder=function(e){return new X(e)},W.param=function(e,t){return new $(e,t)},(e=>{class t{constructor(e,t){this.sql=e,this.fieldAlias=t}static[h]="SQL.Aliased";isSelectionField=!1;getSQL(){return this.sql}clone(){return new t(this.sql,this.fieldAlias)}}e.Aliased=t})(H||(H={}));class X{constructor(e){this.name=e}static[h]="Placeholder";getSQL(){return new H([this])}}function K(e,t){return e.map(e=>{if(f(e,X)){if(!(e.name in t))throw new Error(`No value for placeholder "${e.name}" was provided`);return t[e.name]}if(f(e,$)&&f(e.value,X)){if(!(e.value.name in t))throw new Error(`No value for placeholder "${e.value.name}" was provided`);return e.encoder.mapToDriverValue(t[e.value.name])}return e})}const Y=/* @__PURE__ */Symbol.for("drizzle:IsDrizzleView");class q{static[h]="View";[F];[Y]=!0;constructor({name:e,schema:t,selectedFields:n,query:r}){this[F]={name:e,originalName:e,schema:t,selectedFields:n,query:r,isExisting:!r,isAlias:!1}}getSQL(){return new H([this])}}function Q(e,t,n){const r={},i=e.reduce((e,{path:i,field:a},o)=>{let s;s=f(a,L)?a:f(a,H)?a.decoder:f(a,B)?a._.sql.decoder:a.sql.decoder;let c=e;for(const[l,u]of i.entries())if(l<i.length-1)u in c||(c[u]={}),c=c[u];else{const e=t[o],l=c[u]=null===e?null:s.mapFromDriverValue(e);if(n&&f(a,L)&&2===i.length){const e=i[0];e in r?"string"==typeof r[e]&&r[e]!==P(a.table)&&(r[e]=!1):r[e]=null===l&&P(a.table)}}return e},{});if(n&&Object.keys(r).length>0)for(const[a,o]of Object.entries(r))"string"!=typeof o||n[o]||(i[a]=null);return i}function J(e,t){return Object.entries(e).reduce((e,[n,r])=>{if("string"!=typeof n)return e;const i=t?[...t,n]:[n];return f(r,L)||f(r,H)||f(r,H.Aliased)||f(r,B)?e.push({path:i,field:r}):f(r,E)?e.push(...J(r[E.Symbol.Columns],i)):e.push(...J(r,i)),e},[])}function z(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const[i,a]of n.entries())if(a!==r[i])return!1;return!0}function Z(e,t){const n=Object.entries(t).filter(([,e])=>void 0!==e).map(([t,n])=>f(n,H)||f(n,L)?[t,n]:[t,new $(n,e[E.Symbol.Columns][t])]);if(0===n.length)throw new Error("No values to set");return Object.fromEntries(n)}function ee(e){return f(e,B)?e._.alias:f(e,q)?e[F].name:f(e,H)?void 0:e[E.Symbol.IsAlias]?e[E.Symbol.Name]:e[E.Symbol.BaseName]}function te(e,t){return{name:"string"==typeof e&&e.length>0?e:"",config:"object"==typeof e?e:t}}L.prototype.getSQL=function(){return new H([this])},E.prototype.getSQL=function(){return new H([this])},B.prototype.getSQL=function(){return new H([this])};const ne="undefined"==typeof TextDecoder?null:new TextDecoder,re=/* @__PURE__ */Symbol.for("drizzle:PgInlineForeignKeys"),ie=/* @__PURE__ */Symbol.for("drizzle:EnableRLS");class ae extends E{static[h]="PgTable";static Symbol=Object.assign({},E.Symbol,{InlineForeignKeys:re,EnableRLS:ie});[re]=[];[ie]=!1;[E.Symbol.ExtraConfigBuilder]=void 0;[E.Symbol.ExtraConfigColumns]={}}class oe{static[h]="PgPrimaryKeyBuilder";columns;name;constructor(e,t){this.columns=e,this.name=t}build(e){return new se(e,this.columns,this.name)}}class se{constructor(e,t,n){this.table=e,this.columns=t,this.name=n}static[h]="PgPrimaryKey";columns;name;getName(){return this.name??`${this.table[ae.Symbol.Name]}_${this.columns.map(e=>e.name).join("_")}_pk`}}function ce(e,t){return!function(e){return"object"==typeof e&&null!==e&&"mapToDriverValue"in e&&"function"==typeof e.mapToDriverValue}(t)||k(e)||f(e,$)||f(e,X)||f(e,L)||f(e,E)||f(e,q)?e:new $(e,t)}const le=(e,t)=>j`${e} = ${ce(t,e)}`,ue=(e,t)=>j`${e} <> ${ce(t,e)}`;function de(...e){const t=e.filter(e=>void 0!==e);if(0!==t.length)return 1===t.length?new H(t):new H([new G("("),j.join(t,new G(" and ")),new G(")")])}function pe(...e){const t=e.filter(e=>void 0!==e);if(0!==t.length)return 1===t.length?new H(t):new H([new G("("),j.join(t,new G(" or ")),new G(")")])}function he(e){return j`not ${e}`}const fe=(e,t)=>j`${e} > ${ce(t,e)}`,me=(e,t)=>j`${e} >= ${ce(t,e)}`,ge=(e,t)=>j`${e} < ${ce(t,e)}`,ye=(e,t)=>j`${e} <= ${ce(t,e)}`;function Ie(e,t){return Array.isArray(t)?0===t.length?j`false`:j`${e} in ${t.map(t=>ce(t,e))}`:j`${e} in ${ce(t,e)}`}function Ce(e,t){return Array.isArray(t)?0===t.length?j`true`:j`${e} not in ${t.map(t=>ce(t,e))}`:j`${e} not in ${ce(t,e)}`}function Ae(e){return j`${e} is null`}function Se(e){return j`${e} is not null`}function be(e){return j`exists ${e}`}function Te(e){return j`not exists ${e}`}function ve(e,t,n){return j`${e} between ${ce(t,e)} and ${ce(n,e)}`}function _e(e,t,n){return j`${e} not between ${ce(t,e)} and ${ce(n,e)}`}function we(e,t){return j`${e} like ${t}`}function Ee(e,t){return j`${e} not like ${t}`}function Pe(e,t){return j`${e} ilike ${t}`}function Re(e,t){return j`${e} not ilike ${t}`}function Le(e){return j`${e} asc`}function Ne(e){return j`${e} desc`}class Oe{constructor(e,t,n){this.sourceTable=e,this.referencedTable=t,this.relationName=n,this.referencedTableName=t[E.Symbol.Name]}static[h]="Relation";referencedTableName;fieldName}class Be{constructor(e,t){this.table=e,this.config=t}static[h]="Relations"}class Me extends Oe{constructor(e,t,n,r){super(e,t,n?.relationName),this.config=n,this.isNullable=r}static[h]="One";withFieldName(e){const t=new Me(this.sourceTable,this.referencedTable,this.config,this.isNullable);return t.fieldName=e,t}}class De extends Oe{constructor(e,t,n){super(e,t,n?.relationName),this.config=n}static[h]="Many";withFieldName(e){const t=new De(this.sourceTable,this.referencedTable,this.config);return t.fieldName=e,t}}function Fe(e,t){1===Object.keys(e).length&&"default"in e&&!f(e.default,E)&&(e=e.default);const n={},r={},i={};for(const[a,o]of Object.entries(e))if(f(o,E)){const e=R(o),t=r[e];n[e]=a,i[a]={tsName:a,dbName:o[E.Symbol.Name],schema:o[E.Symbol.Schema],columns:o[E.Symbol.Columns],relations:t?.relations??{},primaryKey:t?.primaryKey??[]};for(const n of Object.values(o[E.Symbol.Columns]))n.primary&&i[a].primaryKey.push(n);const s=o[E.Symbol.ExtraConfigBuilder]?.(o[E.Symbol.ExtraConfigColumns]);if(s)for(const n of Object.values(s))f(n,oe)&&i[a].primaryKey.push(...n.columns)}else if(f(o,Be)){const e=R(o.table),a=n[e],s=o.config(t(o.table));let c;for(const[t,n]of Object.entries(s))if(a){i[a].relations[t]=n}else e in r||(r[e]={relations:{},primaryKey:c}),r[e].relations[t]=n}return{tables:i,tableNamesMap:n}}function ke(e){return function(t,n){return new Me(e,t,n,n?.fields.reduce((e,t)=>e&&t.notNull,!0)??!1)}}function Ge(e){return function(t,n){return new De(e,t,n)}}function He(e,t,n){if(f(n,Me)&&n.config)return{fields:n.config.fields,references:n.config.references};const r=t[R(n.referencedTable)];if(!r)throw new Error(`Table "${n.referencedTable[E.Symbol.Name]}" not found in schema`);const i=e[r];if(!i)throw new Error(`Table "${r}" not found in schema`);const a=n.sourceTable,o=t[R(a)];if(!o)throw new Error(`Table "${a[E.Symbol.Name]}" not found in schema`);const s=[];for(const c of Object.values(i.relations))(n.relationName&&n!==c&&c.relationName===n.relationName||!n.relationName&&c.referencedTable===n.sourceTable)&&s.push(c);if(s.length>1)throw n.relationName?new Error(`There are multiple relations with name "${n.relationName}" in table "${r}"`):new Error(`There are multiple relations between "${r}" and "${n.sourceTable[E.Symbol.Name]}". Please specify relation name`);if(s[0]&&f(s[0],Me)&&s[0].config)return{fields:s[0].config.references,references:s[0].config.fields};throw new Error(`There is not enough information to infer relation "${o}.${n.fieldName}"`)}function xe(e){return{one:ke(e),many:Ge(e)}}function Ue(e,t,n,r,i=e=>e){const a={};for(const[o,s]of r.entries())if(s.isJson){const r=t.relations[s.tsKey],c=n[o],l="string"==typeof c?JSON.parse(c):c;a[s.tsKey]=f(r,Me)?l&&Ue(e,e[s.relationTableTsKey],l,s.selection,i):l.map(t=>Ue(e,e[s.relationTableTsKey],t,s.selection,i))}else{const e=i(n[o]),t=s.field;let r;r=f(t,L)?t:f(t,H)?t.decoder:t.sql.decoder,a[s.tsKey]=null===e?null:r.mapFromDriverValue(e)}return a}class Ve{constructor(e){this.table=e}static[h]="ColumnAliasProxyHandler";get(e,t){return"table"===t?this.table:e[t]}}class $e{constructor(e,t){this.alias=e,this.replaceOriginalName=t}static[h]="TableAliasProxyHandler";get(e,t){if(t===E.Symbol.IsAlias)return!0;if(t===E.Symbol.Name)return this.alias;if(this.replaceOriginalName&&t===E.Symbol.OriginalName)return this.alias;if(t===F)return{...e[F],name:this.alias,isAlias:!0};if(t===E.Symbol.Columns){const t=e[E.Symbol.Columns];if(!t)return t;const n={};return Object.keys(t).map(r=>{n[r]=new Proxy(t[r],new Ve(new Proxy(e,this)))}),n}const n=e[t];return f(n,L)?new Proxy(n,new Ve(new Proxy(e,this))):n}}function je(e,t){return new Proxy(e,new $e(t,!1))}function We(e,t){return new Proxy(e,new Ve(new Proxy(e.table,new $e(t,!1))))}function Xe(e,t){return new H.Aliased(Ke(e.sql,t),e.fieldAlias)}function Ke(e,t){return j.join(e.queryChunks.map(e=>f(e,L)?We(e,t):f(e,H)?Ke(e,t):f(e,H.Aliased)?Xe(e,t):e))}class Ye{static[h]="SelectionProxyHandler";config;constructor(e){this.config={...e}}get(e,t){if("_"===t)return{...e._,selectedFields:new Proxy(e._.selectedFields,this)};if(t===F)return{...e[F],selectedFields:new Proxy(e[F].selectedFields,this)};if("symbol"==typeof t)return e[t];const n=(f(e,B)?e._.selectedFields:f(e,q)?e[F].selectedFields:e)[t];if(f(n,H.Aliased)){if("sql"===this.config.sqlAliasedBehavior&&!n.isSelectionField)return n.sql;const e=n.clone();return e.isSelectionField=!0,e}if(f(n,H)){if("sql"===this.config.sqlBehavior)return n;throw new Error(`You tried to reference "${t}" field from a subquery, which is a raw SQL field, but it doesn't have an alias declared. Please add an alias to the field using ".as('alias')" method.`)}return f(n,L)?this.config.alias?new Proxy(n,new Ve(new Proxy(n.table,new $e(this.config.alias,this.config.replaceOriginalName??!1)))):n:"object"!=typeof n||null===n?n:new Proxy(n,new Ye(this.config))}}class qe{static[h]="QueryPromise";[Symbol.toStringTag]="QueryPromise";catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}then(e,t){return this.execute().then(e,t)}}class Qe{static[h]="SQLiteForeignKeyBuilder";reference;_onUpdate;_onDelete;constructor(e,t){this.reference=()=>{const{name:t,columns:n,foreignColumns:r}=e();return{name:t,columns:n,foreignTable:r[0].table,foreignColumns:r}},t&&(this._onUpdate=t.onUpdate,this._onDelete=t.onDelete)}onUpdate(e){return this._onUpdate=e,this}onDelete(e){return this._onDelete=e,this}build(e){return new Je(e,this)}}class Je{constructor(e,t){this.table=e,this.reference=t.reference,this.onUpdate=t._onUpdate,this.onDelete=t._onDelete}static[h]="SQLiteForeignKey";reference;onUpdate;onDelete;getName(){const{name:e,columns:t,foreignColumns:n}=this.reference(),r=t.map(e=>e.name),i=n.map(e=>e.name),a=[this.table[I],...r,n[0].table[I],...i];return e??`${a.join("_")}_fk`}}class ze extends N{static[h]="SQLiteColumnBuilder";foreignKeyConfigs=[];references(e,t={}){return this.foreignKeyConfigs.push({ref:e,actions:t}),this}unique(e){return this.config.isUnique=!0,this.config.uniqueName=e,this}generatedAlwaysAs(e,t){return this.config.generated={as:e,type:"always",mode:t?.mode??"virtual"},this}buildForeignKeys(e,t){return this.foreignKeyConfigs.map(({ref:n,actions:r})=>((n,r)=>{const i=new Qe(()=>{const t=n();return{columns:[e],foreignColumns:[t]}});return r.onUpdate&&i.onUpdate(r.onUpdate),r.onDelete&&i.onDelete(r.onDelete),i.build(t)})(n,r))}}class Ze extends L{constructor(e,t){t.uniqueName||(t.uniqueName=function(e,t){return`${e[I]}_${t.join("_")}_unique`}(e,[t.name])),super(e,t),this.table=e}static[h]="SQLiteColumn"}class et extends ze{static[h]="SQLiteBigIntBuilder";constructor(e){super(e,"bigint","SQLiteBigInt")}build(e){return new tt(e,this.config)}}class tt extends Ze{static[h]="SQLiteBigInt";getSQLType(){return"blob"}mapFromDriverValue(e){if("undefined"!=typeof Buffer&&Buffer.from){const t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return BigInt(t.toString("utf8"))}return BigInt(ne.decode(e))}mapToDriverValue(e){return Buffer.from(e.toString())}}class nt extends ze{static[h]="SQLiteBlobJsonBuilder";constructor(e){super(e,"json","SQLiteBlobJson")}build(e){return new rt(e,this.config)}}class rt extends Ze{static[h]="SQLiteBlobJson";getSQLType(){return"blob"}mapFromDriverValue(e){if("undefined"!=typeof Buffer&&Buffer.from){const t=Buffer.isBuffer(e)?e:e instanceof ArrayBuffer?Buffer.from(e):e.buffer?Buffer.from(e.buffer,e.byteOffset,e.byteLength):Buffer.from(e);return JSON.parse(t.toString("utf8"))}return JSON.parse(ne.decode(e))}mapToDriverValue(e){return Buffer.from(JSON.stringify(e))}}class it extends ze{static[h]="SQLiteBlobBufferBuilder";constructor(e){super(e,"buffer","SQLiteBlobBuffer")}build(e){return new at(e,this.config)}}class at extends Ze{static[h]="SQLiteBlobBuffer";mapFromDriverValue(e){return Buffer.isBuffer(e)?e:Buffer.from(e)}getSQLType(){return"blob"}}function ot(e,t){const{name:n,config:r}=te(e,t);return"json"===r?.mode?new nt(n):"bigint"===r?.mode?new et(n):new it(n)}class st extends ze{static[h]="SQLiteCustomColumnBuilder";constructor(e,t,n){super(e,"custom","SQLiteCustomColumn"),this.config.fieldConfig=t,this.config.customTypeParams=n}build(e){return new ct(e,this.config)}}class ct extends Ze{static[h]="SQLiteCustomColumn";sqlName;mapTo;mapFrom;constructor(e,t){super(e,t),this.sqlName=t.customTypeParams.dataType(t.fieldConfig),this.mapTo=t.customTypeParams.toDriver,this.mapFrom=t.customTypeParams.fromDriver}getSQLType(){return this.sqlName}mapFromDriverValue(e){return"function"==typeof this.mapFrom?this.mapFrom(e):e}mapToDriverValue(e){return"function"==typeof this.mapTo?this.mapTo(e):e}}function lt(e){return(t,n)=>{const{name:r,config:i}=te(t,n);return new st(r,i,e)}}class ut extends ze{static[h]="SQLiteBaseIntegerBuilder";constructor(e,t,n){super(e,t,n),this.config.autoIncrement=!1}primaryKey(e){return e?.autoIncrement&&(this.config.autoIncrement=!0),this.config.hasDefault=!0,super.primaryKey()}}class dt extends Ze{static[h]="SQLiteBaseInteger";autoIncrement=this.config.autoIncrement;getSQLType(){return"integer"}}class pt extends ut{static[h]="SQLiteIntegerBuilder";constructor(e){super(e,"number","SQLiteInteger")}build(e){return new ht(e,this.config)}}class ht extends dt{static[h]="SQLiteInteger"}class ft extends ut{static[h]="SQLiteTimestampBuilder";constructor(e,t){super(e,"date","SQLiteTimestamp"),this.config.mode=t}defaultNow(){return this.default(j`(cast((julianday('now') - 2440587.5)*86400000 as integer))`)}build(e){return new mt(e,this.config)}}class mt extends dt{static[h]="SQLiteTimestamp";mode=this.config.mode;mapFromDriverValue(e){return"timestamp"===this.config.mode?new Date(1e3*e):new Date(e)}mapToDriverValue(e){const t=e.getTime();return"timestamp"===this.config.mode?Math.floor(t/1e3):t}}class gt extends ut{static[h]="SQLiteBooleanBuilder";constructor(e,t){super(e,"boolean","SQLiteBoolean"),this.config.mode=t}build(e){return new yt(e,this.config)}}class yt extends dt{static[h]="SQLiteBoolean";mode=this.config.mode;mapFromDriverValue(e){return 1===Number(e)}mapToDriverValue(e){return e?1:0}}function It(e,t){const{name:n,config:r}=te(e,t);return"timestamp"===r?.mode||"timestamp_ms"===r?.mode?new ft(n,r.mode):"boolean"===r?.mode?new gt(n,r.mode):new pt(n)}class Ct extends ze{static[h]="SQLiteNumericBuilder";constructor(e){super(e,"string","SQLiteNumeric")}build(e){return new At(e,this.config)}}class At extends Ze{static[h]="SQLiteNumeric";mapFromDriverValue(e){return"string"==typeof e?e:String(e)}getSQLType(){return"numeric"}}class St extends ze{static[h]="SQLiteNumericNumberBuilder";constructor(e){super(e,"number","SQLiteNumericNumber")}build(e){return new bt(e,this.config)}}class bt extends Ze{static[h]="SQLiteNumericNumber";mapFromDriverValue(e){return"number"==typeof e?e:Number(e)}mapToDriverValue=String;getSQLType(){return"numeric"}}class Tt extends ze{static[h]="SQLiteNumericBigIntBuilder";constructor(e){super(e,"bigint","SQLiteNumericBigInt")}build(e){return new vt(e,this.config)}}class vt extends Ze{static[h]="SQLiteNumericBigInt";mapFromDriverValue=BigInt;mapToDriverValue=String;getSQLType(){return"numeric"}}function _t(e,t){const{name:n,config:r}=te(e,t),i=r?.mode;return"number"===i?new St(n):"bigint"===i?new Tt(n):new Ct(n)}class wt extends ze{static[h]="SQLiteRealBuilder";constructor(e){super(e,"number","SQLiteReal")}build(e){return new Et(e,this.config)}}class Et extends Ze{static[h]="SQLiteReal";getSQLType(){return"real"}}function Pt(e){return new wt(e??"")}class Rt extends ze{static[h]="SQLiteTextBuilder";constructor(e,t){super(e,"string","SQLiteText"),this.config.enumValues=t.enum,this.config.length=t.length}build(e){return new Lt(e,this.config)}}class Lt extends Ze{static[h]="SQLiteText";enumValues=this.config.enumValues;length=this.config.length;constructor(e,t){super(e,t)}getSQLType(){return"text"+(this.config.length?`(${this.config.length})`:"")}}class Nt extends ze{static[h]="SQLiteTextJsonBuilder";constructor(e){super(e,"json","SQLiteTextJson")}build(e){return new Ot(e,this.config)}}class Ot extends Ze{static[h]="SQLiteTextJson";getSQLType(){return"text"}mapFromDriverValue(e){return JSON.parse(e)}mapToDriverValue(e){return JSON.stringify(e)}}function Bt(e,t={}){const{name:n,config:r}=te(e,t);return"json"===r.mode?new Nt(n):new Rt(n,r)}const Mt=/* @__PURE__ */Symbol.for("drizzle:SQLiteInlineForeignKeys");class Dt extends E{static[h]="SQLiteTable";static Symbol=Object.assign({},E.Symbol,{InlineForeignKeys:Mt});[E.Symbol.Columns];[Mt]=[];[E.Symbol.ExtraConfigBuilder]=void 0}function Ft(e,t,n,r,i=e){const a=new Dt(e,r,i),o="function"==typeof t?t({blob:ot,customType:lt,integer:It,numeric:_t,real:Pt,text:Bt}):t,s=Object.fromEntries(Object.entries(o).map(([e,t])=>{const n=t;n.setName(e);const r=n.build(a);return a[Mt].push(...n.buildForeignKeys(r,a)),[e,r]})),c=Object.assign(a,s);return c[E.Symbol.Columns]=s,c[E.Symbol.ExtraConfigColumns]=s,c}const kt=(e,t,n)=>Ft(e,t);function Gt(e){return f(e,Dt)?[`${e[E.Symbol.BaseName]}`]:f(e,B)?e._.usedTables??[]:f(e,H)?e.usedTables??[]:[]}class Ht extends qe{constructor(e,t,n,r){super(),this.table=e,this.session=t,this.dialect=n,this.config={table:e,withList:r}}static[h]="SQLiteDelete";config;where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.table[E.Symbol.Columns],new Ye({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.orderBy=n}else{const t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.table[Dt.Symbol.Columns]){return this.config.returning=J(e),this}getSQL(){return this.dialect.buildDeleteQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"delete",tables:Gt(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(e){return this._prepare().execute(e)}$dynamic(){return this}}function xt(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).map(e=>e.toLowerCase()).join("_")}function Ut(e){return(e.replace(/['\u2019]/g,"").match(/[\da-z]+|[A-Z]+(?![a-z])|[A-Z][\da-z]+/g)??[]).reduce((e,t,n)=>e+(0===n?t.toLowerCase():`${t[0].toUpperCase()}${t.slice(1)}`),"")}function Vt(e){return e}class $t{static[h]="CasingCache";cache={};cachedTables={};convert;constructor(e){this.convert="snake_case"===e?xt:"camelCase"===e?Ut:Vt}getColumnCasing(e){if(!e.keyAsName)return e.name;const t=`${e.table[E.Symbol.Schema]??"public"}.${e.table[E.Symbol.OriginalName]}.${e.name}`;return this.cache[t]||this.cacheTable(e.table),this.cache[t]}cacheTable(e){const t=`${e[E.Symbol.Schema]??"public"}.${e[E.Symbol.OriginalName]}`;if(!this.cachedTables[t]){for(const n of Object.values(e[E.Symbol.Columns])){const e=`${t}.${n.name}`;this.cache[e]=this.convert(n.name)}this.cachedTables[t]=!0}}clearCache(){this.cache={},this.cachedTables={}}}class jt extends Error{static[h]="DrizzleError";constructor({message:e,cause:t}){super(e),this.name="DrizzleError",this.cause=t}}class Wt extends Error{constructor(e,t,n){super(`Failed query: ${e}\nparams: ${t}`),this.query=e,this.params=t,this.cause=n,Error.captureStackTrace(this,Wt),n&&(this.cause=n)}}class Xt extends jt{static[h]="TransactionRollbackError";constructor(){super({message:"Rollback"})}}class Kt extends q{static[h]="SQLiteViewBase"}class Yt{static[h]="SQLiteDialect";casing;constructor(e){this.casing=new $t(e?.casing)}escapeName(e){return`"${e.replace(/"/g,'""')}"`}escapeParam(e){return"?"}escapeString(e){return`'${e.replace(/'/g,"''")}'`}buildWithCTE(e){if(!e?.length)return;const t=[j`with `];for(const[n,r]of e.entries())t.push(j`${j.identifier(r._.alias)} as (${r._.sql})`),n<e.length-1&&t.push(j`, `);return t.push(j` `),j.join(t)}buildDeleteQuery({table:e,where:t,returning:n,withList:r,limit:i,orderBy:a}){return j`${this.buildWithCTE(r)}delete from ${e}${t?j` where ${t}`:void 0}${n?j` returning ${this.buildSelection(n,{isSingleTable:!0})}`:void 0}${this.buildOrderBy(a)}${this.buildLimit(i)}`}buildUpdateSet(e,t){const n=e[E.Symbol.Columns],r=Object.keys(n).filter(e=>void 0!==t[e]||void 0!==n[e]?.onUpdateFn),i=r.length;return j.join(r.flatMap((e,r)=>{const a=n[e],o=a.onUpdateFn?.(),s=t[e]??(f(o,H)?o:j.param(o,a)),c=j`${j.identifier(this.casing.getColumnCasing(a))} = ${s}`;return r<i-1?[c,j.raw(", ")]:[c]}))}buildUpdateQuery({table:e,set:t,where:n,returning:r,withList:i,joins:a,from:o,limit:s,orderBy:c}){const l=this.buildWithCTE(i),u=this.buildUpdateSet(e,t),d=o&&j.join([j.raw(" from "),this.buildFromTable(o)]);return j`${l}update ${e} set ${u}${d}${this.buildJoins(a)}${n?j` where ${n}`:void 0}${r?j` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0}${this.buildOrderBy(c)}${this.buildLimit(s)}`}buildSelection(e,{isSingleTable:t=!1}={}){const n=e.length,r=e.flatMap(({field:e},r)=>{const i=[];if(f(e,H.Aliased)&&e.isSelectionField)i.push(j.identifier(e.fieldAlias));else if(f(e,H.Aliased)||f(e,H)){const n=f(e,H.Aliased)?e.sql:e;t?i.push(new H(n.queryChunks.map(e=>f(e,L)?j.identifier(this.casing.getColumnCasing(e)):e))):i.push(n),f(e,H.Aliased)&&i.push(j` as ${j.identifier(e.fieldAlias)}`)}else if(f(e,L)){const n=e.table[E.Symbol.Name];"SQLiteNumericBigInt"===e.columnType?t?i.push(j`cast(${j.identifier(this.casing.getColumnCasing(e))} as text)`):i.push(j`cast(${j.identifier(n)}.${j.identifier(this.casing.getColumnCasing(e))} as text)`):t?i.push(j.identifier(this.casing.getColumnCasing(e))):i.push(j`${j.identifier(n)}.${j.identifier(this.casing.getColumnCasing(e))}`)}else if(f(e,B)){const t=Object.entries(e._.selectedFields);if(1===t.length){const n=t[0][1],r=f(n,H)?n.decoder:f(n,L)?{mapFromDriverValue:e=>n.mapFromDriverValue(e)}:n.sql.decoder;r&&(e._.sql.decoder=r)}i.push(e)}return r<n-1&&i.push(j`, `),i});return j.join(r)}buildJoins(e){if(!e||0===e.length)return;const t=[];if(e)for(const[n,r]of e.entries()){0===n&&t.push(j` `);const i=r.table,a=r.on?j` on ${r.on}`:void 0;if(f(i,Dt)){const e=i[Dt.Symbol.Name],n=i[Dt.Symbol.Schema],o=i[Dt.Symbol.OriginalName],s=e===o?void 0:r.alias;t.push(j`${j.raw(r.joinType)} join ${n?j`${j.identifier(n)}.`:void 0}${j.identifier(o)}${s&&j` ${j.identifier(s)}`}${a}`)}else t.push(j`${j.raw(r.joinType)} join ${i}${a}`);n<e.length-1&&t.push(j` `)}return j.join(t)}buildLimit(e){return"object"==typeof e||"number"==typeof e&&e>=0?j` limit ${e}`:void 0}buildOrderBy(e){const t=[];if(e)for(const[n,r]of e.entries())t.push(r),n<e.length-1&&t.push(j`, `);return t.length>0?j` order by ${j.join(t)}`:void 0}buildFromTable(e){return f(e,E)&&e[E.Symbol.IsAlias]?j`${j`${j.identifier(e[E.Symbol.Schema]??"")}.`.if(e[E.Symbol.Schema])}${j.identifier(e[E.Symbol.OriginalName])} ${j.identifier(e[E.Symbol.Name])}`:e}buildSelectQuery({withList:e,fields:t,fieldsFlat:n,where:r,having:i,table:a,joins:o,orderBy:s,groupBy:c,limit:l,offset:u,distinct:d,setOperators:p}){const h=n??J(t);for(const w of h)if(f(w.field,L)&&P(w.field.table)!==(f(a,B)?a._.alias:f(a,Kt)?a[F].name:f(a,H)?void 0:P(a))&&!(e=>o?.some(({alias:t})=>t===(e[E.Symbol.IsAlias]?P(e):e[E.Symbol.BaseName])))(w.field.table)){const e=P(w.field.table);throw new Error(`Your "${w.path.join("->")}" field references a column "${e}"."${w.field.name}", but the table "${e}" is not part of the query! Did you forget to join it?`)}const m=!o||0===o.length,g=this.buildWithCTE(e),y=d?j` distinct`:void 0,I=this.buildSelection(h,{isSingleTable:m}),C=this.buildFromTable(a),A=this.buildJoins(o),S=r?j` where ${r}`:void 0,b=i?j` having ${i}`:void 0,T=[];if(c)for(const[f,w]of c.entries())T.push(w),f<c.length-1&&T.push(j`, `);const v=T.length>0?j` group by ${j.join(T)}`:void 0,_=j`${g}select${y} ${I} from ${C}${A}${S}${v}${b}${this.buildOrderBy(s)}${this.buildLimit(l)}${u?j` offset ${u}`:void 0}`;return p.length>0?this.buildSetOperations(_,p):_}buildSetOperations(e,t){const[n,...r]=t;if(!n)throw new Error("Cannot pass undefined values to any set operator");return 0===r.length?this.buildSetOperationQuery({leftSelect:e,setOperator:n}):this.buildSetOperations(this.buildSetOperationQuery({leftSelect:e,setOperator:n}),r)}buildSetOperationQuery({leftSelect:e,setOperator:{type:t,isAll:n,rightSelect:r,limit:i,orderBy:a,offset:o}}){const s=j`${e.getSQL()} `,c=j`${r.getSQL()}`;let l;if(a&&a.length>0){const e=[];for(const t of a)if(f(t,Ze))e.push(j.identifier(t.name));else if(f(t,H)){for(let e=0;e<t.queryChunks.length;e++){const n=t.queryChunks[e];f(n,Ze)&&(t.queryChunks[e]=j.identifier(this.casing.getColumnCasing(n)))}e.push(j`${t}`)}else e.push(j`${t}`);l=j` order by ${j.join(e,j`, `)}`}const u="object"==typeof i||"number"==typeof i&&i>=0?j` limit ${i}`:void 0,d=j.raw(`${t} ${n?"all ":""}`);return j`${s}${d}${c}${l}${u}${o?j` offset ${o}`:void 0}`}buildInsertQuery({table:e,values:t,onConflict:n,returning:r,withList:i,select:a}){const o=[],s=e[E.Symbol.Columns],c=Object.entries(s).filter(([e,t])=>!t.shouldDisableInsert()),l=c.map(([,e])=>j.identifier(this.casing.getColumnCasing(e)));if(a){const e=t;f(e,H)?o.push(e):o.push(e.getSQL())}else{const e=t;o.push(j.raw("values "));for(const[t,n]of e.entries()){const r=[];for(const[e,t]of c){const i=n[e];if(void 0===i||f(i,$)&&void 0===i.value){let e;if(null!==t.default&&void 0!==t.default)e=f(t.default,H)?t.default:j.param(t.default,t);else if(void 0!==t.defaultFn){const n=t.defaultFn();e=f(n,H)?n:j.param(n,t)}else if(t.default||void 0===t.onUpdateFn)e=j`null`;else{const n=t.onUpdateFn();e=f(n,H)?n:j.param(n,t)}r.push(e)}else r.push(i)}o.push(r),t<e.length-1&&o.push(j`, `)}}const u=this.buildWithCTE(i),d=j.join(o),p=r?j` returning ${this.buildSelection(r,{isSingleTable:!0})}`:void 0,h=n?.length?j.join(n):void 0;return j`${u}insert into ${e} ${l} ${d}${h}${p}`}sqlToQuery(e,t){return e.toQuery({casing:this.casing,escapeName:this.escapeName,escapeParam:this.escapeParam,escapeString:this.escapeString,invokeSource:t})}buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:n,table:r,tableConfig:i,queryConfig:a,tableAlias:o,nestedQueryRelation:s,joinOn:c}){let l,u,d,p=[],h=[];const m=[];if(!0===a){p=Object.entries(i.columns).map(([e,t])=>({dbKey:t.name,tsKey:e,field:We(t,o),relationTableTsKey:void 0,isJson:!1,selection:[]}))}else{const r=Object.fromEntries(Object.entries(i.columns).map(([e,t])=>[e,We(t,o)]));if(a.where){const e="function"==typeof a.where?a.where(r,{and:de,between:ve,eq:le,exists:be,gt:fe,gte:me,ilike:Pe,inArray:Ie,isNull:Ae,isNotNull:Se,like:we,lt:ge,lte:ye,ne:ue,not:he,notBetween:_e,notExists:Te,notLike:Ee,notIlike:Re,notInArray:Ce,or:pe,sql:j}):a.where;d=e&&Ke(e,o)}const s=[];let c=[];if(a.columns){let e=!1;for(const[t,n]of Object.entries(a.columns))void 0!==n&&t in i.columns&&(e||!0!==n||(e=!0),c.push(t));c.length>0&&(c=e?c.filter(e=>!0===a.columns?.[e]):Object.keys(i.columns).filter(e=>!c.includes(e)))}else c=Object.keys(i.columns);for(const e of c){const t=i.columns[e];s.push({tsKey:e,value:t})}let m,g=[];if(a.with&&(g=Object.entries(a.with).filter(e=>!!e[1]).map(([e,t])=>({tsKey:e,queryConfig:t,relation:i.relations[e]}))),a.extras){m="function"==typeof a.extras?a.extras(r,{sql:j}):a.extras;for(const[e,t]of Object.entries(m))s.push({tsKey:e,value:Xe(t,o)})}for(const{tsKey:e,value:t}of s)p.push({dbKey:f(t,H.Aliased)?t.fieldAlias:i.columns[e].name,tsKey:e,field:f(t,L)?We(t,o):t,relationTableTsKey:void 0,isJson:!1,selection:[]});let y="function"==typeof a.orderBy?a.orderBy(r,{sql:j,asc:Le,desc:Ne}):a.orderBy??[];Array.isArray(y)||(y=[y]),h=y.map(e=>f(e,L)?We(e,o):Ke(e,o)),l=a.limit,u=a.offset;for(const{tsKey:i,queryConfig:a,relation:l}of g){const r=He(t,n,l),s=n[R(l.referencedTable)],c=`${o}_${i}`,u=de(...r.fields.map((e,t)=>le(We(r.references[t],c),We(e,o)))),d=this.buildRelationalQuery({fullSchema:e,schema:t,tableNamesMap:n,table:e[s],tableConfig:t[s],queryConfig:f(l,Me)?!0===a?{limit:1}:{...a,limit:1}:a,tableAlias:c,joinOn:u,nestedQueryRelation:l}),h=j`(${d.sql})`.as(i);p.push({dbKey:i,tsKey:i,field:h,relationTableTsKey:s,isJson:!0,selection:d.selection})}}if(0===p.length)throw new jt({message:`No fields selected for table "${i.tsName}" ("${o}"). You need to have at least one item in "columns", "with" or "extras". If you need to select all columns, omit the "columns" key or set it to undefined.`});let g;if(d=de(c,d),s){let e=j`json_array(${j.join(p.map(({field:e})=>f(e,Ze)?j.identifier(this.casing.getColumnCasing(e)):f(e,H.Aliased)?e.sql:e),j`, `)})`;f(s,De)&&(e=j`coalesce(json_group_array(${e}), json_array())`);const t=[{dbKey:"data",tsKey:"data",field:e.as("data"),isJson:!0,relationTableTsKey:i.tsName,selection:p}];void 0!==l||void 0!==u||h.length>0?(g=this.buildSelectQuery({table:je(r,o),fields:{},fieldsFlat:[{path:[],field:j.raw("*")}],where:d,limit:l,offset:u,orderBy:h,setOperators:[]}),d=void 0,l=void 0,u=void 0,h=void 0):g=je(r,o),g=this.buildSelectQuery({table:f(g,Dt)?g:new B(g,{},o),fields:{},fieldsFlat:t.map(({field:e})=>({path:[],field:f(e,L)?We(e,o):e})),joins:m,where:d,limit:l,offset:u,orderBy:h,setOperators:[]})}else g=this.buildSelectQuery({table:je(r,o),fields:{},fieldsFlat:p.map(({field:e})=>({path:[],field:f(e,L)?We(e,o):e})),joins:m,where:d,limit:l,offset:u,orderBy:h,setOperators:[]});return{tableTsKey:i.tsName,sql:g,selection:p}}}class qt extends Yt{static[h]="SQLiteSyncDialect";migrate(e,t,n){const r=void 0===n||"string"==typeof n?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",i=j`
2
- CREATE TABLE IF NOT EXISTS ${j.identifier(r)} (
3
- id SERIAL PRIMARY KEY,
4
- hash text NOT NULL,
5
- created_at numeric
6
- )
7
- `;t.run(i);const a=t.values(j`SELECT id, hash, created_at FROM ${j.identifier(r)} ORDER BY created_at DESC LIMIT 1`)[0]??void 0;t.run(j`BEGIN`);try{for(const n of e)if(!a||Number(a[2])<n.folderMillis){for(const e of n.sql)t.run(j.raw(e));t.run(j`INSERT INTO ${j.identifier(r)} ("hash", "created_at") VALUES(${n.hash}, ${n.folderMillis})`)}t.run(j`COMMIT`)}catch(o){throw t.run(j`ROLLBACK`),o}}}class Qt extends Yt{static[h]="SQLiteAsyncDialect";async migrate(e,t,n){const r=void 0===n||"string"==typeof n?"__drizzle_migrations":n.migrationsTable??"__drizzle_migrations",i=j`
8
- CREATE TABLE IF NOT EXISTS ${j.identifier(r)} (
9
- id SERIAL PRIMARY KEY,
10
- hash text NOT NULL,
11
- created_at numeric
12
- )
13
- `;await t.run(i);const a=(await t.values(j`SELECT id, hash, created_at FROM ${j.identifier(r)} ORDER BY created_at DESC LIMIT 1`))[0]??void 0;await t.transaction(async t=>{for(const n of e)if(!a||Number(a[2])<n.folderMillis){for(const e of n.sql)await t.run(j.raw(e));await t.run(j`INSERT INTO ${j.identifier(r)} ("hash", "created_at") VALUES(${n.hash}, ${n.folderMillis})`)}})}}class Jt{static[h]="TypedQueryBuilder";getSelectedFields(){return this._.selectedFields}}class zt{static[h]="SQLiteSelectBuilder";fields;session;dialect;withList;distinct;constructor(e){this.fields=e.fields,this.session=e.session,this.dialect=e.dialect,this.withList=e.withList,this.distinct=e.distinct}from(e){const t=!!this.fields;let n;return n=this.fields?this.fields:f(e,B)?Object.fromEntries(Object.keys(e._.selectedFields).map(t=>[t,e[t]])):f(e,Kt)?e[F].selectedFields:f(e,H)?{}:e[E.Symbol.Columns],new en({table:e,fields:n,isPartialSelect:t,session:this.session,dialect:this.dialect,withList:this.withList,distinct:this.distinct})}}class Zt extends Jt{static[h]="SQLiteSelectQueryBuilder";_;config;joinsNotNullableMap;tableName;isPartialSelect;session;dialect;cacheConfig=void 0;usedTables=/* @__PURE__ */new Set;constructor({table:e,fields:t,isPartialSelect:n,session:r,dialect:i,withList:a,distinct:o}){super(),this.config={withList:a,table:e,fields:{...t},distinct:o,setOperators:[]},this.isPartialSelect=n,this.session=r,this.dialect=i,this._={selectedFields:t,config:this.config},this.tableName=ee(e),this.joinsNotNullableMap="string"==typeof this.tableName?{[this.tableName]:!0}:{};for(const s of Gt(e))this.usedTables.add(s)}getUsedTables(){return[...this.usedTables]}createJoin(e){return(t,n)=>{const r=this.tableName,i=ee(t);for(const e of Gt(t))this.usedTables.add(e);if("string"==typeof i&&this.config.joins?.some(e=>e.alias===i))throw new Error(`Alias "${i}" is already used in this query`);if(!this.isPartialSelect&&(1===Object.keys(this.joinsNotNullableMap).length&&"string"==typeof r&&(this.config.fields={[r]:this.config.fields}),"string"==typeof i&&!f(t,H))){const e=f(t,B)?t._.selectedFields:f(t,q)?t[F].selectedFields:t[E.Symbol.Columns];this.config.fields[i]=e}if("function"==typeof n&&(n=n(new Proxy(this.config.fields,new Ye({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.joins||(this.config.joins=[]),this.config.joins.push({on:n,table:t,joinType:e,alias:i}),"string"==typeof i)switch(e){case"left":this.joinsNotNullableMap[i]=!1;break;case"right":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[i]=!0;break;case"cross":case"inner":this.joinsNotNullableMap[i]=!0;break;case"full":this.joinsNotNullableMap=Object.fromEntries(Object.entries(this.joinsNotNullableMap).map(([e])=>[e,!1])),this.joinsNotNullableMap[i]=!1}return this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");crossJoin=this.createJoin("cross");createSetOperator(e,t){return n=>{const r="function"==typeof n?n(nn()):n;if(!z(this.getSelectedFields(),r.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return this.config.setOperators.push({type:e,isAll:t,rightSelect:r}),this}}union=this.createSetOperator("union",!1);unionAll=this.createSetOperator("union",!0);intersect=this.createSetOperator("intersect",!1);except=this.createSetOperator("except",!1);addSetOperators(e){return this.config.setOperators.push(...e),this}where(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new Ye({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.where=e,this}having(e){return"function"==typeof e&&(e=e(new Proxy(this.config.fields,new Ye({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))),this.config.having=e,this}groupBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.fields,new Ye({sqlAliasedBehavior:"alias",sqlBehavior:"sql"})));this.config.groupBy=Array.isArray(t)?t:[t]}else this.config.groupBy=e;return this}orderBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.fields,new Ye({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=n:this.config.orderBy=n}else{const t=e;this.config.setOperators.length>0?this.config.setOperators.at(-1).orderBy=t:this.config.orderBy=t}return this}limit(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).limit=e:this.config.limit=e,this}offset(e){return this.config.setOperators.length>0?this.config.setOperators.at(-1).offset=e:this.config.offset=e,this}getSQL(){return this.dialect.buildSelectQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}as(e){const t=[];if(t.push(...Gt(this.config.table)),this.config.joins)for(const n of this.config.joins)t.push(...Gt(n.table));return new Proxy(new B(this.getSQL(),this.config.fields,e,!1,[...new Set(t)]),new Ye({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}getSelectedFields(){return new Proxy(this.config.fields,new Ye({alias:this.tableName,sqlAliasedBehavior:"alias",sqlBehavior:"error"}))}$dynamic(){return this}}class en extends Zt{static[h]="SQLiteSelect";_prepare(e=!0){if(!this.session)throw new Error("Cannot execute a query on a query builder. Please use a database instance instead.");const t=J(this.config.fields),n=this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),t,"all",!0,void 0,{type:"select",tables:[...this.usedTables]},this.cacheConfig);return n.joinsNotNullableMap=this.joinsNotNullableMap,n}$withCache(e){return this.cacheConfig=void 0===e?{config:{},enable:!0,autoInvalidate:!0}:!1===e?{enable:!1}:{enable:!0,autoInvalidate:!0,...e},this}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.all()}}function tn(e,t){return(n,r,...i)=>{const a=[r,...i].map(n=>({type:e,isAll:t,rightSelect:n}));for(const e of a)if(!z(n.getSelectedFields(),e.rightSelect.getSelectedFields()))throw new Error("Set operator error (union / intersect / except): selected fields are not the same or are in a different order");return n.addSetOperators(a)}}!function(e,t){for(const n of t)for(const t of Object.getOwnPropertyNames(n.prototype))"constructor"!==t&&Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(n.prototype,t)||/* @__PURE__ */Object.create(null))}(en,[qe]);const nn=()=>({union:rn,unionAll:an,intersect:on,except:sn}),rn=tn("union",!1),an=tn("union",!0),on=tn("intersect",!1),sn=tn("except",!1);class cn{static[h]="SQLiteQueryBuilder";dialect;dialectConfig;constructor(e){this.dialect=f(e,Yt)?e:void 0,this.dialectConfig=f(e,Yt)?void 0:e}$with=(e,t)=>{const n=this;return{as:r=>("function"==typeof r&&(r=r(n)),new Proxy(new M(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new Ye({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};with(...e){const t=this;return{select:function(n){return new zt({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e})},selectDistinct:function(n){return new zt({fields:n??void 0,session:void 0,dialect:t.getDialect(),withList:e,distinct:!0})}}}select(e){return new zt({fields:e??void 0,session:void 0,dialect:this.getDialect()})}selectDistinct(e){return new zt({fields:e??void 0,session:void 0,dialect:this.getDialect(),distinct:!0})}getDialect(){return this.dialect||(this.dialect=new qt(this.dialectConfig)),this.dialect}}class ln{constructor(e,t,n,r){this.table=e,this.session=t,this.dialect=n,this.withList=r}static[h]="SQLiteInsertBuilder";values(e){if(0===(e=Array.isArray(e)?e:[e]).length)throw new Error("values() must be called with at least one value");const t=e.map(e=>{const t={},n=this.table[E.Symbol.Columns];for(const r of Object.keys(e)){const i=e[r];t[r]=f(i,H)?i:new $(i,n[r])}return t});return new un(this.table,t,this.session,this.dialect,this.withList)}select(e){const t="function"==typeof e?e(new cn):e;if(!f(t,H)&&!z(this.table[A],t._.selectedFields))throw new Error("Insert select error: selected fields are not the same or are in a different order compared to the table definition");return new un(this.table,t,this.session,this.dialect,this.withList,!0)}}class un extends qe{constructor(e,t,n,r,i,a){super(),this.session=n,this.dialect=r,this.config={table:e,values:t,withList:i,select:a}}static[h]="SQLiteInsert";config;returning(e=this.config.table[Dt.Symbol.Columns]){return this.config.returning=J(e),this}onConflictDoNothing(e={}){if(this.config.onConflict||(this.config.onConflict=[]),void 0===e.target)this.config.onConflict.push(j` on conflict do nothing`);else{const t=Array.isArray(e.target)?j`${e.target}`:j`${[e.target]}`,n=e.where?j` where ${e.where}`:j``;this.config.onConflict.push(j` on conflict ${t} do nothing${n}`)}return this}onConflictDoUpdate(e){if(e.where&&(e.targetWhere||e.setWhere))throw new Error('You cannot use both "where" and "targetWhere"/"setWhere" at the same time - "where" is deprecated, use "targetWhere" or "setWhere" instead.');this.config.onConflict||(this.config.onConflict=[]);const t=e.where?j` where ${e.where}`:void 0,n=e.targetWhere?j` where ${e.targetWhere}`:void 0,r=e.setWhere?j` where ${e.setWhere}`:void 0,i=Array.isArray(e.target)?j`${e.target}`:j`${[e.target]}`,a=this.dialect.buildUpdateSet(this.config.table,Z(this.config.table,e.set));return this.config.onConflict.push(j` on conflict ${i}${n} do update set ${a}${t}${r}`),this}getSQL(){return this.dialect.buildInsertQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:Gt(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class dn{constructor(e,t,n,r){this.table=e,this.session=t,this.dialect=n,this.withList=r}static[h]="SQLiteUpdateBuilder";set(e){return new pn(this.table,Z(this.table,e),this.session,this.dialect,this.withList)}}class pn extends qe{constructor(e,t,n,r,i){super(),this.session=n,this.dialect=r,this.config={set:t,table:e,withList:i,joins:[]}}static[h]="SQLiteUpdate";config;from(e){return this.config.from=e,this}createJoin(e){return(t,n)=>{const r=ee(t);if("string"==typeof r&&this.config.joins.some(e=>e.alias===r))throw new Error(`Alias "${r}" is already used in this query`);if("function"==typeof n){const e=this.config.from?f(t,Dt)?t[E.Symbol.Columns]:f(t,B)?t._.selectedFields:f(t,Kt)?t[F].selectedFields:void 0:void 0;n=n(new Proxy(this.config.table[E.Symbol.Columns],new Ye({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})),e&&new Proxy(e,new Ye({sqlAliasedBehavior:"sql",sqlBehavior:"sql"})))}return this.config.joins.push({on:n,table:t,joinType:e,alias:r}),this}}leftJoin=this.createJoin("left");rightJoin=this.createJoin("right");innerJoin=this.createJoin("inner");fullJoin=this.createJoin("full");where(e){return this.config.where=e,this}orderBy(...e){if("function"==typeof e[0]){const t=e[0](new Proxy(this.config.table[E.Symbol.Columns],new Ye({sqlAliasedBehavior:"alias",sqlBehavior:"sql"}))),n=Array.isArray(t)?t:[t];this.config.orderBy=n}else{const t=e;this.config.orderBy=t}return this}limit(e){return this.config.limit=e,this}returning(e=this.config.table[Dt.Symbol.Columns]){return this.config.returning=J(e),this}getSQL(){return this.dialect.buildUpdateQuery(this.config)}toSQL(){const{typings:e,...t}=this.dialect.sqlToQuery(this.getSQL());return t}_prepare(e=!0){return this.session[e?"prepareOneTimeQuery":"prepareQuery"](this.dialect.sqlToQuery(this.getSQL()),this.config.returning,this.config.returning?"all":"run",!0,void 0,{type:"insert",tables:Gt(this.config.table)})}prepare(){return this._prepare(!1)}run=e=>this._prepare().run(e);all=e=>this._prepare().all(e);get=e=>this._prepare().get(e);values=e=>this._prepare().values(e);async execute(){return this.config.returning?this.all():this.run()}$dynamic(){return this}}class hn extends H{constructor(e){super(hn.buildEmbeddedCount(e.source,e.filters).queryChunks),this.params=e,this.session=e.session,this.sql=hn.buildCount(e.source,e.filters)}sql;static[h]="SQLiteCountBuilderAsync";[Symbol.toStringTag]="SQLiteCountBuilderAsync";session;static buildEmbeddedCount(e,t){return j`(select count(*) from ${e}${j.raw(" where ").if(t)}${t})`}static buildCount(e,t){return j`select count(*) from ${e}${j.raw(" where ").if(t)}${t}`}then(e,t){return Promise.resolve(this.session.count(this.sql)).then(e,t)}catch(e){return this.then(void 0,e)}finally(e){return this.then(t=>(e?.(),t),t=>{throw e?.(),t})}}class fn{constructor(e,t,n,r,i,a,o,s){this.mode=e,this.fullSchema=t,this.schema=n,this.tableNamesMap=r,this.table=i,this.tableConfig=a,this.dialect=o,this.session=s}static[h]="SQLiteAsyncRelationalQueryBuilder";findMany(e){return"sync"===this.mode?new gn(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many"):new mn(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e||{},"many")}findFirst(e){return"sync"===this.mode?new gn(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first"):new mn(this.fullSchema,this.schema,this.tableNamesMap,this.table,this.tableConfig,this.dialect,this.session,e?{...e,limit:1}:{limit:1},"first")}}class mn extends qe{constructor(e,t,n,r,i,a,o,s,c){super(),this.fullSchema=e,this.schema=t,this.tableNamesMap=n,this.table=r,this.tableConfig=i,this.dialect=a,this.session=o,this.config=s,this.mode=c}static[h]="SQLiteAsyncRelationalQuery";mode;getSQL(){return this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName}).sql}_prepare(e=!1){const{query:t,builtQuery:n}=this._toSQL();return this.session[e?"prepareOneTimeQuery":"prepareQuery"](n,void 0,"first"===this.mode?"get":"all",!0,(e,n)=>{const r=e.map(e=>Ue(this.schema,this.tableConfig,e,t.selection,n));return"first"===this.mode?r[0]:r})}prepare(){return this._prepare(!1)}_toSQL(){const e=this.dialect.buildRelationalQuery({fullSchema:this.fullSchema,schema:this.schema,tableNamesMap:this.tableNamesMap,table:this.table,tableConfig:this.tableConfig,queryConfig:this.config,tableAlias:this.tableConfig.tsName});return{query:e,builtQuery:this.dialect.sqlToQuery(e.sql)}}toSQL(){return this._toSQL().builtQuery}executeRaw(){return"first"===this.mode?this._prepare(!1).get():this._prepare(!1).all()}async execute(){return this.executeRaw()}}class gn extends mn{static[h]="SQLiteSyncRelationalQuery";sync(){return this.executeRaw()}}class yn extends qe{constructor(e,t,n,r,i){super(),this.execute=e,this.getSQL=t,this.dialect=r,this.mapBatchResult=i,this.config={action:n}}static[h]="SQLiteRaw";config;getQuery(){return{...this.dialect.sqlToQuery(this.getSQL()),method:this.config.action}}mapResult(e,t){return t?this.mapBatchResult(e):e}_prepare(){return this}isResponseInArrayMode(){return!1}}class In{constructor(e,t,n,r){this.resultKind=e,this.dialect=t,this.session=n,this._=r?{schema:r.schema,fullSchema:r.fullSchema,tableNamesMap:r.tableNamesMap}:{schema:void 0,fullSchema:{},tableNamesMap:{}},this.query={};const i=this.query;if(this._.schema)for(const[a,o]of Object.entries(this._.schema))i[a]=new fn(e,r.fullSchema,this._.schema,this._.tableNamesMap,r.fullSchema[a],o,t,n);this.$cache={invalidate:async e=>{}}}static[h]="BaseSQLiteDatabase";query;$with=(e,t)=>{const n=this;return{as:r=>("function"==typeof r&&(r=r(new cn(n.dialect))),new Proxy(new M(r.getSQL(),t??("getSelectedFields"in r?r.getSelectedFields()??{}:{}),e,!0),new Ye({alias:e,sqlAliasedBehavior:"alias",sqlBehavior:"error"})))}};$count(e,t){return new hn({source:e,filters:t,session:this.session})}with(...e){const t=this;return{select:function(n){return new zt({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e})},selectDistinct:function(n){return new zt({fields:n??void 0,session:t.session,dialect:t.dialect,withList:e,distinct:!0})},update:function(n){return new dn(n,t.session,t.dialect,e)},insert:function(n){return new ln(n,t.session,t.dialect,e)},delete:function(n){return new Ht(n,t.session,t.dialect,e)}}}select(e){return new zt({fields:e??void 0,session:this.session,dialect:this.dialect})}selectDistinct(e){return new zt({fields:e??void 0,session:this.session,dialect:this.dialect,distinct:!0})}update(e){return new dn(e,this.session,this.dialect)}$cache;insert(e){return new ln(e,this.session,this.dialect)}delete(e){return new Ht(e,this.session,this.dialect)}run(e){const t="string"==typeof e?j.raw(e):e.getSQL();return"async"===this.resultKind?new yn(async()=>this.session.run(t),()=>t,"run",this.dialect,this.session.extractRawRunValueFromBatchResult.bind(this.session)):this.session.run(t)}all(e){const t="string"==typeof e?j.raw(e):e.getSQL();return"async"===this.resultKind?new yn(async()=>this.session.all(t),()=>t,"all",this.dialect,this.session.extractRawAllValueFromBatchResult.bind(this.session)):this.session.all(t)}get(e){const t="string"==typeof e?j.raw(e):e.getSQL();return"async"===this.resultKind?new yn(async()=>this.session.get(t),()=>t,"get",this.dialect,this.session.extractRawGetValueFromBatchResult.bind(this.session)):this.session.get(t)}values(e){const t="string"==typeof e?j.raw(e):e.getSQL();return"async"===this.resultKind?new yn(async()=>this.session.values(t),()=>t,"values",this.dialect,this.session.extractRawValuesValueFromBatchResult.bind(this.session)):this.session.values(t)}transaction(e,t){return this.session.transaction(e,t)}}class Cn{static[h]="Cache"}class An extends Cn{strategy(){return"all"}static[h]="NoopCache";async get(e){}async put(e,t,n,r){}async onMutate(e){}}async function Sn(e,t){const n=`${e}-${JSON.stringify(t)}`,r=(new TextEncoder).encode(n),i=await crypto.subtle.digest("SHA-256",r);return[...new Uint8Array(i)].map(e=>e.toString(16).padStart(2,"0")).join("")}class bn extends qe{constructor(e){super(),this.resultCb=e}static[h]="ExecuteResultSync";async execute(){return this.resultCb()}sync(){return this.resultCb()}}class Tn{constructor(e,t,n,r,i,a){this.mode=e,this.executeMethod=t,this.query=n,this.cache=r,this.queryMetadata=i,this.cacheConfig=a,r&&"all"===r.strategy()&&void 0===a&&(this.cacheConfig={enable:!0,autoInvalidate:!0}),this.cacheConfig?.enable||(this.cacheConfig=void 0)}static[h]="PreparedQuery";joinsNotNullableMap;async queryWithCache(e,t,n){if(void 0===this.cache||f(this.cache,An)||void 0===this.queryMetadata)try{return await n()}catch(r){throw new Wt(e,t,r)}if(this.cacheConfig&&!this.cacheConfig.enable)try{return await n()}catch(r){throw new Wt(e,t,r)}if(("insert"===this.queryMetadata.type||"update"===this.queryMetadata.type||"delete"===this.queryMetadata.type)&&this.queryMetadata.tables.length>0)try{const[e]=await Promise.all([n(),this.cache.onMutate({tables:this.queryMetadata.tables})]);return e}catch(r){throw new Wt(e,t,r)}if(!this.cacheConfig)try{return await n()}catch(r){throw new Wt(e,t,r)}if("select"===this.queryMetadata.type){const i=await this.cache.get(this.cacheConfig.tag??await Sn(e,t),this.queryMetadata.tables,void 0!==this.cacheConfig.tag,this.cacheConfig.autoInvalidate);if(void 0===i){let i;try{i=await n()}catch(r){throw new Wt(e,t,r)}return await this.cache.put(this.cacheConfig.tag??await Sn(e,t),i,this.cacheConfig.autoInvalidate?this.queryMetadata.tables:[],void 0!==this.cacheConfig.tag,this.cacheConfig.config),i}return i}try{return await n()}catch(r){throw new Wt(e,t,r)}}getQuery(){return this.query}mapRunResult(e,t){return e}mapAllResult(e,t){throw new Error("Not implemented")}mapGetResult(e,t){throw new Error("Not implemented")}execute(e){return"async"===this.mode?this[this.executeMethod](e):new bn(()=>this[this.executeMethod](e))}mapResult(e,t){switch(this.executeMethod){case"run":return this.mapRunResult(e,t);case"all":return this.mapAllResult(e,t);case"get":return this.mapGetResult(e,t)}}}class vn{constructor(e){this.dialect=e}static[h]="SQLiteSession";prepareOneTimeQuery(e,t,n,r,i,a,o){return this.prepareQuery(e,t,n,r,i,a,o)}run(e){const t=this.dialect.sqlToQuery(e);try{return this.prepareOneTimeQuery(t,void 0,"run",!1).run()}catch(n){throw new jt({cause:n,message:`Failed to run the query '${t.sql}'`})}}extractRawRunValueFromBatchResult(e){return e}all(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).all()}extractRawAllValueFromBatchResult(e){throw new Error("Not implemented")}get(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).get()}extractRawGetValueFromBatchResult(e){throw new Error("Not implemented")}values(e){return this.prepareOneTimeQuery(this.dialect.sqlToQuery(e),void 0,"run",!1).values()}async count(e){return(await this.values(e))[0][0]}extractRawValuesValueFromBatchResult(e){throw new Error("Not implemented")}}class _n extends In{constructor(e,t,n,r,i=0){super(e,t,n,r),this.schema=r,this.nestedIndex=i}static[h]="SQLiteTransaction";rollback(){throw new Xt}}class wn extends vn{constructor(e,t,n,r={}){super(t),this.client=e,this.schema=n,this.options=r,this.logger=r.logger??new y,this.cache=r.cache??new An}static[h]="SQLiteD1Session";logger;cache;prepareQuery(e,t,n,r,i,a,o){const s=this.client.prepare(e.sql);return new Rn(s,e,this.logger,this.cache,a,o,t,n,r,i)}async batch(e){const t=[],n=[];for(const r of e){const e=r._prepare(),i=e.getQuery();if(t.push(e),i.params.length>0)n.push(e.stmt.bind(...i.params));else{const t=e.getQuery();n.push(this.client.prepare(t.sql).bind(...t.params))}}return(await this.client.batch(n)).map((e,n)=>t[n].mapResult(e,!0))}extractRawAllValueFromBatchResult(e){return e.results}extractRawGetValueFromBatchResult(e){return e.results[0]}extractRawValuesValueFromBatchResult(e){return Pn(e.results)}async transaction(e,t){const n=new En("async",this.dialect,this,this.schema);await this.run(j.raw("begin"+(t?.behavior?" "+t.behavior:"")));try{const t=await e(n);return await this.run(j`commit`),t}catch(r){throw await this.run(j`rollback`),r}}}class En extends _n{static[h]="D1Transaction";async transaction(e){const t=`sp${this.nestedIndex}`,n=new En("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(j.raw(`savepoint ${t}`));try{const r=await e(n);return await this.session.run(j.raw(`release savepoint ${t}`)),r}catch(r){throw await this.session.run(j.raw(`rollback to savepoint ${t}`)),r}}}function Pn(e){const t=[];for(const n of e){const e=Object.keys(n).map(e=>n[e]);t.push(e)}return t}class Rn extends Tn{constructor(e,t,n,r,i,a,o,s,c,l){super("async",s,t,r,i,a),this.logger=n,this._isResponseInArrayMode=c,this.customResultMapper=l,this.fields=o,this.stmt=e}static[h]="D1PreparedQuery";customResultMapper;fields;stmt;async run(e){const t=K(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>this.stmt.bind(...t).run())}async all(e){const{fields:t,query:n,logger:r,stmt:i,customResultMapper:a}=this;if(!t&&!a){const t=K(n.params,e??{});return r.logQuery(n.sql,t),await this.queryWithCache(n.sql,t,async()=>i.bind(...t).all().then(({results:e})=>this.mapAllResult(e)))}const o=await this.values(e);return this.mapAllResult(o)}mapAllResult(e,t){return t&&(e=Pn(e.results)),this.fields||this.customResultMapper?this.customResultMapper?this.customResultMapper(e):e.map(e=>Q(this.fields,e,this.joinsNotNullableMap)):e}async get(e){const{fields:t,joinsNotNullableMap:n,query:r,logger:i,stmt:a,customResultMapper:o}=this;if(!t&&!o){const t=K(r.params,e??{});return i.logQuery(r.sql,t),await this.queryWithCache(r.sql,t,async()=>a.bind(...t).all().then(({results:e})=>e[0]))}const s=await this.values(e);if(s[0])return o?o(s):Q(t,s[0],n)}mapGetResult(e,t){return t&&(e=Pn(e.results)[0]),this.fields||this.customResultMapper?this.customResultMapper?this.customResultMapper([e]):Q(this.fields,e,this.joinsNotNullableMap):e}async values(e){const t=K(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>this.stmt.bind(...t).raw())}isResponseInArrayMode(){return this._isResponseInArrayMode}}class Ln extends In{static[h]="D1Database";async batch(e){return this.session.batch(e)}}class Nn extends vn{constructor(e,t,n,r,i={}){super(t),this.client=e,this.schema=n,this.batchCLient=r,this.logger=i.logger??new y,this.cache=i.cache??new An}static[h]="SQLiteRemoteSession";logger;cache;prepareQuery(e,t,n,r,i,a,o){return new Bn(this.client,e,this.logger,this.cache,a,o,t,n,r,i)}async batch(e){const t=[],n=[];for(const r of e){const e=r._prepare(),i=e.getQuery();t.push(e),n.push({sql:i.sql,params:i.params,method:i.method})}return(await this.batchCLient(n)).map((e,n)=>t[n].mapResult(e,!0))}async transaction(e,t){const n=new On("async",this.dialect,this,this.schema);await this.run(j.raw("begin"+(t?.behavior?" "+t.behavior:"")));try{const t=await e(n);return await this.run(j`commit`),t}catch(r){throw await this.run(j`rollback`),r}}extractRawAllValueFromBatchResult(e){return e.rows}extractRawGetValueFromBatchResult(e){return e.rows[0]}extractRawValuesValueFromBatchResult(e){return e.rows}}class On extends _n{static[h]="SQLiteProxyTransaction";async transaction(e){const t=`sp${this.nestedIndex}`,n=new On("async",this.dialect,this.session,this.schema,this.nestedIndex+1);await this.session.run(j.raw(`savepoint ${t}`));try{const r=await e(n);return await this.session.run(j.raw(`release savepoint ${t}`)),r}catch(r){throw await this.session.run(j.raw(`rollback to savepoint ${t}`)),r}}}class Bn extends Tn{constructor(e,t,n,r,i,a,o,s,c,l){super("async",s,t,r,i,a),this.client=e,this.logger=n,this.fields=o,this._isResponseInArrayMode=c,this.customResultMapper=l,this.customResultMapper=l,this.method=s}static[h]="SQLiteProxyPreparedQuery";method;getQuery(){return{...this.query,method:this.method}}async run(e){const t=K(this.query.params,e??{});return this.logger.logQuery(this.query.sql,t),await this.queryWithCache(this.query.sql,t,async()=>await this.client(this.query.sql,t,"run"))}mapAllResult(e,t){return t&&(e=e.rows),this.fields||this.customResultMapper?this.customResultMapper?this.customResultMapper(e):e.map(e=>Q(this.fields,e,this.joinsNotNullableMap)):e}async all(e){const{query:t,logger:n,client:r}=this,i=K(t.params,e??{});n.logQuery(t.sql,i);const{rows:a}=await this.queryWithCache(t.sql,i,async()=>await r(t.sql,i,"all"));return this.mapAllResult(a)}async get(e){const{query:t,logger:n,client:r}=this,i=K(t.params,e??{});n.logQuery(t.sql,i);const a=await this.queryWithCache(t.sql,i,async()=>await r(t.sql,i,"get"));return this.mapGetResult(a.rows)}mapGetResult(e,t){t&&(e=e.rows);const n=e;return this.fields||this.customResultMapper?n?this.customResultMapper?this.customResultMapper([e]):Q(this.fields,n,this.joinsNotNullableMap):void 0:n}async values(e){const t=K(this.query.params,e??{});this.logger.logQuery(this.query.sql,t);return(await this.queryWithCache(this.query.sql,t,async()=>await this.client(this.query.sql,t,"values"))).rows}isResponseInArrayMode(){return this._isResponseInArrayMode}}class Mn extends In{static[h]="SqliteRemoteDatabase";async batch(e){return this.session.batch(e)}}const Dn=kt("users",{id:Bt("id").primaryKey(),name:Bt("name").notNull(),email:Bt("email").notNull().unique(),emailVerified:It("email_verified",{mode:"boolean"}).default(!1),image:Bt("image"),apiKey:Bt("api_key").unique(),usageCount:It("usage_count").default(0),alpacaKeyId:Bt("alpaca_key_id"),alpacaSecretKey:Bt("alpaca_secret_key"),alpacaPaper:It("alpaca_paper",{mode:"boolean"}).default(!0),surveyResponse:Bt("survey_response"),kycStatus:Bt("kyc_status").default("not_started"),kycSessionId:Bt("kyc_session_id"),kycVerifiedAt:It("kyc_verified_at",{mode:"timestamp"}),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Fn=kt("sessions",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),expiresAt:It("expires_at",{mode:"timestamp"}).notNull(),token:Bt("token").notNull().unique(),ipAddress:Bt("ip_address"),userAgent:Bt("user_agent"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),kn=kt("accounts",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),accountId:Bt("account_id").notNull(),providerId:Bt("provider_id").notNull(),accessToken:Bt("access_token"),refreshToken:Bt("refresh_token"),idToken:Bt("id_token"),expiresAt:It("expires_at",{mode:"timestamp"}),accessTokenExpiresAt:It("access_token_expires_at",{mode:"timestamp"}),scope:Bt("scope"),password:Bt("password"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Gn=kt("verifications",{id:Bt("id").primaryKey(),identifier:Bt("identifier").notNull(),value:Bt("value").notNull(),expiresAt:It("expires_at",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}),updatedAt:It("updated_at",{mode:"timestamp"})}),Hn=kt("wallet_addresses",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),address:Bt("address").notNull().unique(),chainId:It("chain_id").notNull(),isPrimary:It("is_primary",{mode:"boolean"}).default(!1),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),xn=kt("user_settings",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}).unique(),groqApiKey:Bt("groq_api_key"),openaiApiKey:Bt("openai_api_key"),anthropicApiKey:Bt("anthropic_api_key"),xaiApiKey:Bt("xai_api_key"),googleApiKey:Bt("google_api_key"),togetheraiApiKey:Bt("togetherai_api_key"),perplexityApiKey:Bt("perplexity_api_key"),cloudflareApiKey:Bt("cloudflare_api_key"),alpacaApiKey:Bt("alpaca_api_key"),alpacaApiSecret:Bt("alpaca_api_secret"),alpacaBaseUrl:Bt("alpaca_base_url"),webullUsername:Bt("webull_username"),webullPassword:Bt("webull_password"),robinhoodUsername:Bt("robinhood_username"),robinhoodPassword:Bt("robinhood_password"),ibkrUsername:Bt("ibkr_username"),ibkrPassword:Bt("ibkr_password"),alphaVantageApiKey:Bt("alpha_vantage_api_key"),finnhubApiKey:Bt("finnhub_api_key"),polygonApiKey:Bt("polygon_api_key"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Un=kt("strategies",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),name:Bt("name").notNull(),type:Bt("type").notNull(),status:Bt("status").notNull().default("paused"),riskLevel:Bt("risk_level").notNull().default("medium"),todayPnL:Pt("today_pnl").default(0),last7DaysPnL:Pt("last_7days_pnl").default(0),last30DaysPnL:Pt("last_30days_pnl").default(0),winRate:Pt("win_rate").default(0),activeMarkets:It("active_markets").default(0),tradesToday:It("trades_today").default(0),config:Bt("config"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Vn=kt("watchlists",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),name:Bt("name").notNull(),description:Bt("description"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),$n=kt("watchlist",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),watchlistId:Bt("watchlist_id").references(()=>Vn.id,{onDelete:"cascade"}),symbol:Bt("symbol").notNull(),name:Bt("name"),addedAt:It("added_at",{mode:"timestamp"}).notNull()}),jn=kt("signals",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),asset:Bt("asset").notNull(),type:Bt("type").notNull(),combinedScore:Pt("combined_score").notNull(),scoreLabel:Bt("score_label").notNull(),fundamentalsScore:Pt("fundamentals_score"),vixScore:Pt("vix_score"),technicalScore:Pt("technical_score"),sentimentScore:Pt("sentiment_score"),strategy:Bt("strategy"),timeframe:Bt("timeframe"),suggestedAction:Bt("suggested_action"),suggestedSize:Bt("suggested_size"),metadata:Bt("metadata"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Wn=kt("positions",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),asset:Bt("asset").notNull(),type:Bt("type").notNull(),entryPrice:Pt("entry_price").notNull(),currentPrice:Pt("current_price").notNull(),size:Pt("size").notNull(),unrealizedPnL:Pt("unrealized_pnl").default(0),unrealizedPnLPercent:Pt("unrealized_pnl_percent").default(0),strategy:Bt("strategy"),openedBy:Bt("opened_by"),openedAt:It("opened_at",{mode:"timestamp"}).notNull(),closedAt:It("closed_at",{mode:"timestamp"}),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Xn=kt("trades",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),asset:Bt("asset").notNull(),type:Bt("type").notNull(),action:Bt("action").notNull(),price:Pt("price").notNull(),size:Pt("size").notNull(),pnl:Pt("pnl"),strategy:Bt("strategy"),copiedFrom:Bt("copied_from"),timestamp:It("timestamp",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),Kn=kt("portfolios",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}).unique(),totalEquity:Pt("total_equity").default(1e5),cash:Pt("cash").default(1e5),stocks:Pt("stocks").default(0),predictionMarkets:Pt("prediction_markets").default(0),margin:Pt("margin").default(0),dailyPnL:Pt("daily_pnl").default(0),dailyPnLPercent:Pt("daily_pnl_percent").default(0),winRate:Pt("win_rate").default(0),openPositions:It("open_positions").default(0),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Yn=kt("polymarket_leaders",{trader:Bt("trader").primaryKey(),rank:It("rank"),userName:Bt("user_name"),xUsername:Bt("x_username"),verifiedBadge:It("verified_badge",{mode:"boolean"}),profileImage:Bt("profile_image"),vol:Pt("vol"),pnl:Pt("pnl"),overallGain:Pt("overall_gain"),winRate:Pt("win_rate"),activePositions:It("active_positions"),totalPositions:It("total_positions"),currentValue:Pt("current_value"),winAmount:Pt("win_amount"),lossAmount:Pt("loss_amount"),updatedAt:It("updated_at",{mode:"timestamp"})}),qn=kt("polymarket_positions",{id:Bt("id").primaryKey(),traderId:Bt("trader_id").notNull(),marketId:Bt("market_id"),marketTitle:Bt("market_title"),cashPnl:Pt("cash_pnl"),realizedPnl:Pt("realized_pnl"),tags:Bt("tags"),createdAt:It("created_at",{mode:"timestamp"})}),Qn=kt("polymarket_categories",{tag:Bt("tag").primaryKey(),pnl:Pt("pnl"),updatedAt:It("updated_at",{mode:"timestamp"})}),Jn=kt("polymarket_markets",{id:Bt("id").primaryKey(),conditionId:Bt("condition_id"),question:Bt("question").notNull(),slug:Bt("slug").notNull(),eventSlug:Bt("event_slug"),description:Bt("description"),image:Bt("image"),volume24hr:Pt("volume_24hr"),volumeTotal:Pt("volume_total"),active:It("active",{mode:"boolean"}).default(!0),closed:It("closed",{mode:"boolean"}).default(!1),outcomes:Bt("outcomes").notNull(),outcomePrices:Bt("outcome_prices").notNull(),clobTokenIds:Bt("clob_token_ids"),tags:Bt("tags"),category:Bt("category"),subcategory:Bt("subcategory"),endDate:Bt("end_date"),groupItemTitle:Bt("group_item_title"),enableOrderBook:It("enable_order_book",{mode:"boolean"}),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),zn=kt("polymarket_market_positions",{id:Bt("id").primaryKey(),marketId:Bt("market_id").notNull(),outcome:Bt("outcome").notNull(),price:Pt("price").notNull(),size:Pt("size").notNull(),side:Bt("side").notNull(),totalValue:Pt("total_value").notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),Zn=kt("polymarket_debates",{id:Bt("id").primaryKey(),marketId:Bt("market_id").notNull().unique(),question:Bt("question").notNull(),yesArguments:Bt("yes_arguments").notNull(),noArguments:Bt("no_arguments").notNull(),yesSummary:Bt("yes_summary").notNull(),noSummary:Bt("no_summary").notNull(),keyFactors:Bt("key_factors").notNull(),uncertainties:Bt("uncertainties").notNull(),currentYesPrice:Pt("current_yes_price"),currentNoPrice:Pt("current_no_price"),llmProvider:Bt("llm_provider"),model:Bt("model"),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),er=kt("polymarket_price_history",{id:Bt("id").primaryKey(),tokenId:Bt("token_id").notNull(),timestamp:It("timestamp").notNull(),price:Pt("price").notNull(),interval:Bt("interval").notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),tr=kt("polymarket_holders",{id:Bt("id").primaryKey(),marketId:Bt("market_id").notNull(),address:Bt("address").notNull(),userName:Bt("user_name"),profileImage:Bt("profile_image"),rank:It("rank").notNull(),outcome:Bt("outcome"),balance:Pt("balance").notNull(),value:Pt("value").notNull(),overallGain:Pt("overall_gain"),winRate:Pt("win_rate"),totalProfit:Pt("total_profit"),totalLoss:Pt("total_loss"),totalPositions:It("total_positions"),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),nr=kt("polymarket_trade_history",{id:Bt("id").primaryKey(),traderId:Bt("trader_id").notNull(),transactionHash:Bt("transaction_hash").notNull(),conditionId:Bt("condition_id").notNull(),marketTitle:Bt("market_title"),marketSlug:Bt("market_slug"),eventSlug:Bt("event_slug"),type:Bt("type").notNull(),side:Bt("side"),outcome:Bt("outcome"),outcomeIndex:It("outcome_index"),size:Pt("size").notNull(),usdcSize:Pt("usdc_size").notNull(),price:Pt("price"),traderName:Bt("trader_name"),traderBio:Bt("trader_bio"),traderProfileImage:Bt("trader_profile_image"),timestamp:It("timestamp",{mode:"timestamp"}).notNull(),syncedAt:It("synced_at",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),rr=kt("polymarket_trade_sync_status",{traderId:Bt("trader_id").primaryKey(),lastSyncedTimestamp:It("last_synced_timestamp",{mode:"timestamp"}),totalTradesSynced:It("total_trades_synced").default(0),syncStatus:Bt("sync_status").notNull().default("pending"),errorMessage:Bt("error_message"),lastSyncAttempt:It("last_sync_attempt",{mode:"timestamp"}),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),ir=kt("nvstly_leaders",{id:Bt("id").primaryKey(),name:Bt("name").notNull(),rank:It("rank"),rep:Pt("rep"),trades:It("trades"),winRate:Pt("win_rate"),totalGain:Pt("total_gain"),avgReturn:Pt("avg_return"),broker:Bt("broker"),updatedAt:It("updated_at",{mode:"timestamp"})}),ar=kt("nvstly_trades",{id:Bt("id").primaryKey(),traderId:Bt("trader_id").notNull(),symbol:Bt("symbol").notNull(),type:Bt("type").notNull(),price:Pt("price"),previousPrice:Pt("previous_price"),gain:Pt("gain"),time:It("time",{mode:"timestamp"}),createdAt:It("created_at",{mode:"timestamp"})}),or=kt("zulu_traders",{providerId:It("provider_id").primaryKey(),name:Bt("name"),strategyDesc:Bt("strategy_desc"),countryCode:Bt("country_code"),countryName:Bt("country_name"),brokerName:Bt("broker_name"),balance:Pt("balance"),equity:Pt("equity"),followers:It("followers"),liveFollowers:It("live_followers"),roiAnnualized:Pt("roi_annualized"),roiProfit:Pt("roi_profit"),zuluRank:It("zulu_rank"),bestTrade:Pt("best_trade"),worstTrade:Pt("worst_trade"),profitableTrades:It("profitable_trades"),losingTrades:It("losing_trades"),avgDrawdown:Pt("avg_drawdown"),maxDrawdown:Pt("max_drawdown"),maxDrawdownPercent:Pt("max_drawdown_percent"),leverage:Pt("leverage"),isEa:It("is_ea"),currencies:Bt("currencies"),weeks:It("weeks"),demo:It("demo"),avgTradeSeconds:It("avg_trade_seconds"),avgPnlPerTrade:Pt("avg_pnl_per_trade"),winRate:Pt("win_rate"),totalTrades:It("total_trades"),pageVisits:It("page_visits"),includedInWatchlist:It("included_in_watchlist"),registrationDate:It("registration_date",{mode:"timestamp"}),lastOpenTradeDate:It("last_open_trade_date",{mode:"timestamp"}),updatedAt:It("updated_at",{mode:"timestamp"})}),sr=kt("zulu_currency_stats",{id:Bt("id").primaryKey(),providerId:It("provider_id").notNull(),currencyName:Bt("currency_name"),totalCount:It("total_count"),winCount:It("win_count"),winPercent:Pt("win_percent"),totalBuyCount:It("total_buy_count"),totalSellCount:It("total_sell_count"),pips:Pt("pips"),createdAt:It("created_at",{mode:"timestamp"})}),cr=kt("agent_api_logs",{id:Bt("id").primaryKey(),userId:Bt("user_id").references(()=>Dn.id,{onDelete:"set null"}),symbol:Bt("symbol").notNull(),requestPayload:Bt("request_payload"),responseSignal:Bt("response_signal"),responseAnalysis:Bt("response_analysis"),llmProvider:Bt("llm_provider"),model:Bt("model_used"),timestamp:It("timestamp",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),lr=kt("organizations",{id:Bt("id").primaryKey(),name:Bt("name").notNull(),description:Bt("description"),image:Bt("image"),ownerId:Bt("owner_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),ur=kt("organization_members",{id:Bt("id").primaryKey(),organizationId:Bt("organization_id").notNull().references(()=>lr.id,{onDelete:"cascade"}),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),role:Bt("role").notNull().default("member"),joinedAt:It("joined_at",{mode:"timestamp"}).notNull()}),dr=kt("teams",{id:Bt("id").primaryKey(),organizationId:Bt("organization_id").notNull().references(()=>lr.id,{onDelete:"cascade"}),name:Bt("name").notNull(),description:Bt("description"),upgradeMembers:It("upgrade_members",{mode:"boolean"}).default(!1),maxMembers:It("max_members").default(8),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),pr=kt("team_members",{id:Bt("id").primaryKey(),teamId:Bt("team_id").notNull().references(()=>dr.id,{onDelete:"cascade"}),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),role:Bt("role").notNull().default("member"),joinedAt:It("joined_at",{mode:"timestamp"}).notNull()}),hr=kt("user_follows",{id:Bt("id").primaryKey(),followerId:Bt("follower_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),followingId:Bt("following_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),fr=kt("user_invitations",{id:Bt("id").primaryKey(),inviterId:Bt("inviter_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),email:Bt("email").notNull(),status:Bt("status").notNull().default("pending"),organizationId:Bt("organization_id").references(()=>lr.id,{onDelete:"cascade"}),teamId:Bt("team_id").references(()=>dr.id,{onDelete:"cascade"}),expiresAt:It("expires_at",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),mr=kt("shared_items",{id:Bt("id").primaryKey(),sharedById:Bt("shared_by_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),sharedWithEmail:Bt("shared_with_email").notNull(),sharedWithUserId:Bt("shared_with_user_id").references(()=>Dn.id,{onDelete:"set null"}),itemType:Bt("item_type").notNull(),itemId:Bt("item_id").notNull(),symbol:Bt("symbol"),title:Bt("title"),message:Bt("message"),metadata:Bt("metadata"),viewedAt:It("viewed_at",{mode:"timestamp"}),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),gr=kt("notifications",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),type:Bt("type").notNull(),title:Bt("title").notNull(),message:Bt("message").notNull(),actionUrl:Bt("action_url"),fromUserId:Bt("from_user_id").references(()=>Dn.id,{onDelete:"cascade"}),relatedItemType:Bt("related_item_type"),relatedItemId:Bt("related_item_id"),read:It("read",{mode:"boolean"}).default(!1),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),yr=kt("comments",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),itemType:Bt("item_type").notNull(),itemId:Bt("item_id").notNull(),parentCommentId:Bt("parent_comment_id").references(()=>yr.id,{onDelete:"cascade"}),content:Bt("content").notNull(),editedAt:It("edited_at",{mode:"timestamp"}),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Ir=kt("likes",{id:Bt("id").primaryKey(),userId:Bt("user_id").notNull().references(()=>Dn.id,{onDelete:"cascade"}),itemType:Bt("item_type").notNull(),itemId:Bt("item_id").notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),Cr=kt("stock_quote_cache",{symbol:Bt("symbol").primaryKey(),price:Pt("price").notNull(),change:Pt("change"),changePercent:Pt("change_percent"),open:Pt("open"),high:Pt("high"),low:Pt("low"),previousClose:Pt("previous_close"),volume:Pt("volume")}),Ar=kt("stock_fundamentals",{symbol:Bt("symbol").primaryKey(),peRatio:Pt("pe_ratio"),eps:Pt("eps"),dividendYield:Pt("dividend_yield"),beta:Pt("beta"),fiftyTwoWeekHigh:Pt("fifty_two_week_high"),fiftyTwoWeekLow:Pt("fifty_two_week_low"),fiftyDayAverage:Pt("fifty_day_average"),twoHundredDayAverage:Pt("two_hundred_day_average"),sharesOutstanding:Pt("shares_outstanding"),bookValue:Pt("book_value"),priceToBook:Pt("price_to_book"),trailingPE:Pt("trailing_pe"),forwardPE:Pt("forward_pe"),lastFetched:It("last_fetched",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Sr=kt("stock_historical_quotes",{id:Bt("id").primaryKey(),symbol:Bt("symbol").notNull(),date:Bt("date").notNull(),open:Pt("open").notNull(),high:Pt("high").notNull(),low:Pt("low").notNull(),close:Pt("close").notNull(),volume:Pt("volume"),adjustedClose:Pt("adjusted_close"),createdAt:It("created_at",{mode:"timestamp"}).notNull()}),br=kt("dukascopy_index_cache",{symbol:Bt("symbol").primaryKey(),name:Bt("name").notNull(),country:Bt("country").notNull(),countryCode:Bt("country_code").notNull(),price:Pt("price").notNull(),dailyChange:Pt("daily_change").notNull(),dailyChangePercent:Pt("daily_change_percent").notNull(),volume:Pt("volume").default(0),monthlyChangePercent:Pt("monthly_change_percent").default(0),yearlyChangePercent:Pt("yearly_change_percent").default(0),chartData:Bt("chart_data").notNull(),lastFetched:It("last_fetched",{mode:"timestamp"}).notNull(),createdAt:It("created_at",{mode:"timestamp"}).notNull(),updatedAt:It("updated_at",{mode:"timestamp"}).notNull()}),Tr=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,accounts:kn,agentApiLogs:cr,comments:yr,dukascopyIndexCache:br,likes:Ir,notifications:gr,nvstlyLeaders:ir,nvstlyTrades:ar,organizationMembers:ur,organizations:lr,polymarketCategories:Qn,polymarketDebates:Zn,polymarketHolders:tr,polymarketLeaders:Yn,polymarketMarketPositions:zn,polymarketMarkets:Jn,polymarketPositions:qn,polymarketPriceHistory:er,polymarketTradeHistory:nr,polymarketTradeSyncStatus:rr,portfolios:Kn,positions:Wn,sessions:Fn,sharedItems:mr,signals:jn,stockFundamentals:Ar,stockHistoricalQuotes:Sr,stockQuoteCache:Cr,strategies:Un,teamMembers:pr,teams:dr,trades:Xn,userFollows:hr,userInvitations:fr,userSettings:xn,users:Dn,verifications:Gn,walletAddresses:Hn,watchlist:$n,watchlists:Vn,zuluCurrencyStats:sr,zuluTraders:or},Symbol.toStringTag,{value:"Module"})),vr=e(Dn,({many:e})=>({organizationMemberships:e(ur),teamMemberships:e(pr)})),_r=e(ur,({one:e})=>({organization:e(lr,{fields:[ur.organizationId],references:[lr.id]}),user:e(Dn,{fields:[ur.userId],references:[Dn.id]})})),wr=e(lr,({many:e})=>({members:e(ur),teams:e(dr)})),Er=e(dr,({one:e,many:t})=>({organization:e(lr,{fields:[dr.organizationId],references:[lr.id]}),members:t(pr)})),Pr=e(pr,({one:e})=>({team:e(dr,{fields:[pr.teamId],references:[dr.id]}),user:e(Dn,{fields:[pr.userId],references:[Dn.id]})})),Rr=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,organizationMembersRelations:_r,organizationsRelations:wr,teamMembersRelations:Pr,teamsRelations:Er,usersRelations:vr},Symbol.toStringTag,{value:"Module"})),Lr="37dbe79c-2687-4127-ad02-2372e15ac077";function Nr(){const e="undefined"!=typeof process?process.env:void 0;if(!e)return null;const t=e.CLOUDFLARE_ACCOUNT_ID,n=e.CLOUDFLARE_D1_TOKEN||e.CLOUDFLARE_API_TOKEN;return t&&n?{accountId:t,databaseId:e.CLOUDFLARE_DATABASE_ID||Lr,token:n}:null}function Or(e){return async(t,n,r)=>{const i=await async function(e,t,n){const r=`https://api.cloudflare.com/client/v4/accounts/${e.accountId}/d1/database/${e.databaseId}/query`,i=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${e.token}`,"Content-Type":"application/json"},body:JSON.stringify({sql:t,params:n})}),a=await i.json();if(!i.ok||!a.success){const e=a.errors?.map(e=>`${e.code}: ${e.message}`).join("; ")||`${i.status} ${i.statusText}`;throw new Error(`Cloudflare D1 HTTP query failed — ${e}`)}return a.result?.[0]?.results??[]}(e,t,n);if("run"===r)return{rows:[]};const a=i.map(e=>Object.values(e));return"get"===r?{rows:a[0]??[]}:{rows:a}}}const Br={...Tr,...Rr};let Mr=null;function Dr(){if(Mr)return Mr;const e=globalThis.__CLOUDFLARE_ENV__;if(e?.DB)return Mr=function(e,t={}){const n=new Qt({casing:t.casing});let r,i;if(!0===t.logger?r=new g:!1!==t.logger&&(r=t.logger),t.schema){const e=Fe(t.schema,xe);i={fullSchema:t.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}const a=new wn(e,n,i,{logger:r,cache:t.cache}),o=new Ln("async",n,a,i);return o.$client=e,o.$cache=t.cache,o.$cache&&(o.$cache.invalidate=t.cache?.onMutate),o}(e.DB,{schema:Br}),Mr;const t=Nr();if(!t)throw new Error("No Cloudflare D1 connection available. On Workers this needs the `DB` binding from wrangler.jsonc; elsewhere set CLOUDFLARE_ACCOUNT_ID and CLOUDFLARE_D1_TOKEN (and optionally CLOUDFLARE_DATABASE_ID) to reach D1 over its REST API.");return Mr=function(e,t,n){const r=new Qt({casing:n?.casing});let i,a,o,s,c={};if(t&&("function"==typeof t?(o=t,c={}):(o=void 0,c=t),!0===c.logger?i=new g:!1!==c.logger&&(i=c.logger,a=c.cache)),c.schema){const e=Fe(c.schema,xe);s={fullSchema:c.schema,schema:e.tables,tableNamesMap:e.tableNamesMap}}const l=new Nn(e,r,s,o,{logger:i,cache:a}),u=new Mn("async",r,l,s);return u.$cache=a,u.$cache&&(u.$cache.invalidate=a?.onMutate),u}(Or(t),{schema:Br}),Mr}const Fr=new Proxy({},{get(e,t){const n=Dr(),r=n[t];return"function"==typeof r?r.bind(n):r},has:(e,t)=>t in Dr()});function kr(e,t){const n=e.map((e,n)=>Math.pow(e-t[n],2)).reduce((e,t)=>e+t,0)/e.length;return Math.sqrt(n)}function Gr(e,t){const n=t.reduce((e,t)=>e+t,0)/t.length,r=t.map(e=>Math.pow(e-n,2)).reduce((e,t)=>e+t,0),i=t.map((t,n)=>Math.pow(t-e[n],2)).reduce((e,t)=>e+t,0);return Math.round(100*(1-i/r))/100}async function Hr(e,t,n){const{xgbParams:r={verbosity:0,max_depth:7,eta:.07,objective:"reg:squarederror",nthread:4,subsample:.85,colsample_bytree:.8,colsample_bylevel:.8,min_child_weight:5,gamma:.2,alpha:.1,lambda:1.5,early_stopping_rounds:50,seed:42,nrounds:2e3,tree_method:"hist",grow_policy:"depthwise",...n.xgbParams},testSize:i=.1,featuresToUse:a}=n;let o=e.map(e=>({...a.reduce((t,n)=>(t[n]=e[n],t),{})})).filter(e=>Object.values(e).length>0).map(e=>Object.values(e));o=o.map(e=>e.map(Number));const s=e.map(e=>e[t]),{trainFeatures:l,testFeatures:u,trainTarget:d,testTarget:p}=xr(o,s,i),h=Object.values(l).map(e=>Object.values(e)).map(e=>e.map(Number)),f=Object.values(u).map(e=>Object.values(e)).map(e=>e.map(Number)),m=[];for(let c=0;c<d.length;c++)isNaN(d[c])||m.push(c);const g=m.map(e=>h[e]),y=m.map(e=>d[e]);await c.train(g,y,r);return Gr(await c.predict(f),p)}function xr(e,t,n=.2){const r=e.length,i=r-Math.floor(r*n),a=Array.from({length:r},(e,t)=>t);for(let c=a.length-1;c>0;c--){const e=Math.floor(Math.random()*(c+1));[a[c],a[e]]=[a[e],a[c]]}const o=a.slice(0,i),s=a.slice(i);return{trainFeatures:o.map(t=>e[t]),testFeatures:s.map(t=>e[t]),trainTarget:o.map(e=>t[e]),testTarget:s.map(e=>t[e])}}function Ur(e,t){const{featuresToUse:n}=t;const r=e.map(e=>({...n.reduce((t,n)=>(t[n]=e[n],t),{})})).map(e=>Object.values(e)).map(e=>e.map(Number)).filter(e=>e.length>1&&!!e[0]);return c.predict(r).then(t=>(e.forEach((e,n)=>{e.predicted=t[n]}),e))}async function Vr(e){await c.saveModel(e)}async function $r(e){await c.loadModel(e)}function jr(e,t,n=7){return e.map((r,i)=>{if(i<n-1)return{...r,[`${t}_rolling_mean_${n}d`]:r[t],[`${t}_rolling_std_${n}d`]:r[t]};const a=e.slice(i-n+1,i+1).map(e=>e[t]).filter(e=>null!=e&&!isNaN(e));if(0===a.length)return{...r,[`${t}_rolling_mean_${n}d`]:null,[`${t}_rolling_std_${n}d`]:null};const o=a.reduce((e,t)=>e+t,0)/a.length,s=a.reduce((e,t)=>e+Math.pow(t-o,2),0)/a.length,c=Math.sqrt(s);return{...r,[`${t}_rolling_mean_${n}d`]:Math.floor(o),[`${t}_rolling_std_${n}d`]:Math.floor(c)}})}class Wr{provider;model;temperature;apiKey;baseUrl;constructor(e,t){this.provider=e.llmProvider,this.model=t,this.temperature=e.temperature??.3,e.baseUrl?this.baseUrl=e.baseUrl:"groq"===this.provider.toLowerCase()&&(this.baseUrl="https://api.groq.com/openai/v1/chat/completions"),e.apiKeys?this.apiKey=e.apiKeys[this.provider]||"":this.apiKey=process.env[`${this.provider.toUpperCase()}_API_KEY`]||""}async invoke(e){const t="string"==typeof e?[{role:"user",content:e}]:e;switch(this.provider.toLowerCase()){case"openai":return this.invokeOpenAI(t);case"groq":return this.invokeGroq(t);case"anthropic":return this.invokeAnthropic(t);default:throw new Error(`Unsupported LLM provider: ${this.provider}`)}}async invokeOpenAI(e){const t=this.baseUrl||"https://api.openai.com/v1/chat/completions",n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.model,messages:e,temperature:this.temperature})});if(!n.ok)throw new Error(`OpenAI API error: ${n.statusText}`);const r=await n.json();return{content:r.choices[0].message.content,toolCalls:r.choices[0].message.tool_calls?.map(e=>({name:e.function.name,arguments:JSON.parse(e.function.arguments)}))}}async invokeGroq(e){const t=this.baseUrl||"https://api.groq.com/openai/v1/chat/completions",n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.model,messages:e,temperature:this.temperature})});if(!n.ok){const e=await n.text();throw new Error(`Groq API error: ${n.statusText} - ${e}`)}const r=await n.json();return{content:r.choices[0].message.content,toolCalls:r.choices[0].message.tool_calls?.map(e=>({name:e.function.name,arguments:JSON.parse(e.function.arguments)}))}}async invokeAnthropic(e){const t=this.baseUrl||"https://api.anthropic.com/v1/messages",n=e.find(e=>"system"===e.role),r=e.filter(e=>"system"!==e.role),i=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json","x-api-key":this.apiKey,"anthropic-version":"2023-06-01"},body:JSON.stringify({model:this.model,max_tokens:4096,temperature:this.temperature,system:n?.content,messages:r.map(e=>({role:"assistant"===e.role?"assistant":"user",content:e.content}))})});if(!i.ok)throw new Error(`Anthropic API error: ${i.statusText}`);return{content:(await i.json()).content[0].text}}async invokeWithTools(e,t){switch(this.provider.toLowerCase()){case"openai":case"groq":return this.invokeWithToolsOpenAI(e,t);default:return this.invoke(e)}}async invokeWithToolsOpenAI(e,t){const n="groq"===this.provider.toLowerCase()?this.baseUrl||"https://api.groq.com/openai/v1/chat/completions":this.baseUrl||"https://api.openai.com/v1/chat/completions",r=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({model:this.model,messages:e,temperature:this.temperature,tools:t,tool_choice:"auto"})});if(!r.ok){const e=await r.text();throw new Error(`${this.provider} API error: ${r.statusText} - ${e}`)}const i=await r.json();return{content:i.choices[0].message.content,toolCalls:i.choices[0].message.tool_calls?.map(e=>({name:e.function.name,arguments:JSON.parse(e.function.arguments)}))}}}function Xr(e,t){return new Wr(e,t)}class Kr{name;memories=[];config;constructor(e,t){this.name=e,this.config=t}async addMemory(e){this.memories.push({...e,timestamp:/* @__PURE__ */new Date}),this.memories.length>100&&(this.memories=this.memories.slice(-100))}async getMemories(e,t=2){if(0===this.memories.length)return[];const n=this.memories.map(t=>({memory:t,score:this.calculateSimilarity(e,t.situation)}));return n.sort((e,t)=>t.score-e.score),n.slice(0,t).map(e=>e.memory)}calculateSimilarity(e,t){const n=this.tokenize(e),r=this.tokenize(t),i=n.filter(e=>r.includes(e)),a=/* @__PURE__ */new Set([...n,...r]);return i.length/a.size}tokenize(e){return e.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(e=>e.length>3)}clear(){this.memories=[]}getAllMemories(){return[...this.memories]}getMemoryCount(){return this.memories.length}}const Yr=new l;function qr(e){if(null==e)return null;const t="number"==typeof e?e:Number(e);return Number.isFinite(t)?t:null}function Qr(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n)continue;const e=n.date instanceof Date?n.date:new Date(n.date);if(Number.isNaN(e.getTime()))continue;const r=qr(n.close),i=qr(n.open),a=qr(n.high),o=qr(n.low),s=qr(n.adjclose??n.adjClose),c=r??i??s??a??o;null!==c&&t.push({date:e,open:i??c,high:a??Math.max(i??c,r??c),low:o??Math.min(i??c,r??c),close:r??c,adjClose:s??r??c,volume:qr(n.volume)??0})}return t}class Jr{constructor(){}async getQuote(e,t){try{return{success:!0,data:await Yr.quoteCombine(e,t)}}catch(n){return console.error(`Yahoo Finance quote error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch quote"}}}async getQuotes(e){try{return{success:!0,data:await Promise.all(e.map(e=>Yr.quoteCombine(e)))}}catch(t){return console.error("Yahoo Finance quotes error:",t),{success:!1,error:t.message||"Failed to fetch quotes"}}}async getHistorical(e,t){try{const n=t?.period1??new Date(Date.now()-31536e6),r=t?.period2??/* @__PURE__ */new Date,i=t?.interval||"1d",a=await Yr.chart(e,{period1:n,period2:r,interval:i},{validateResult:!1});return{success:!0,data:Qr(a?.quotes)}}catch(n){return console.error(`Yahoo Finance historical error for ${e}:`,n?.message||n),{success:!1,error:n.message||"Failed to fetch historical data"}}}async getChart(e,t){try{return{success:!0,data:await Yr.chart(e,{period1:t?.period1||new Date(Date.now()-2592e6),period2:t?.period2||/* @__PURE__ */new Date,interval:t?.interval||"1d"})}}catch(n){return console.error(`Yahoo Finance chart error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch chart data"}}}async getQuoteSummary(e,t){try{const n=t||["assetProfile","summaryDetail","financialData","defaultKeyStatistics","calendarEvents","recommendationTrend","earnings","earningsTrend"];return{success:!0,data:await Yr.quoteSummary(e,{modules:n})}}catch(n){return console.error(`Yahoo Finance quoteSummary error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch quote summary"}}}async search(e,t){try{return{success:!0,data:await Yr.search(e,{quotesCount:t?.quotesCount||10,newsCount:t?.newsCount||5})}}catch(n){return console.error(`Yahoo Finance search error for "${e}":`,n),{success:!1,error:n.message||"Failed to search"}}}async getOptions(e,t){try{return{success:!0,data:await Yr.options(e,t?{date:t}:void 0)}}catch(n){return console.error(`Yahoo Finance options error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch options data"}}}async getRecommendations(e){try{return{success:!0,data:await Yr.recommendationsBySymbol(e)}}catch(t){return console.error(`Yahoo Finance recommendations error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch recommendations"}}}async getTrending(e="US"){try{return{success:!0,data:await Yr.trendingSymbols(e)}}catch(t){return console.error(`Yahoo Finance trending error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch trending symbols"}}}async getInsights(e){try{return{success:!0,data:await Yr.insights(e)}}catch(t){return console.error(`Yahoo Finance insights error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch insights"}}}async getFundamentalsTimeSeries(e,t){try{return{success:!0,data:await Yr.fundamentalsTimeSeries(e,t)}}catch(n){return console.error(`Yahoo Finance fundamentalsTimeSeries error for ${e}:`,n),{success:!1,error:n.message||"Failed to fetch fundamentals time series"}}}async screener(e){try{return{success:!0,data:await Yr.screener(e)}}catch(t){return console.error("Yahoo Finance screener error:",t),{success:!1,error:t.message||"Failed to run screener"}}}async getCompanyProfile(e){try{const t=await Yr.quoteSummary(e,{modules:["assetProfile","summaryProfile"]});return{success:!0,data:{assetProfile:t.assetProfile,summaryProfile:t.summaryProfile}}}catch(t){return console.error(`Yahoo Finance company profile error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch company profile"}}}async getFinancialStatements(e){try{const t=await Yr.quoteSummary(e,{modules:["incomeStatementHistory","incomeStatementHistoryQuarterly","balanceSheetHistory","balanceSheetHistoryQuarterly","cashflowStatementHistory","cashflowStatementHistoryQuarterly"]});return{success:!0,data:{incomeStatement:t.incomeStatementHistory,incomeStatementQuarterly:t.incomeStatementHistoryQuarterly,balanceSheet:t.balanceSheetHistory,balanceSheetQuarterly:t.balanceSheetHistoryQuarterly,cashFlow:t.cashflowStatementHistory,cashFlowQuarterly:t.cashflowStatementHistoryQuarterly}}}catch(t){return console.error(`Yahoo Finance financial statements error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch financial statements"}}}async getKeyStatistics(e){try{const t=await Yr.quoteSummary(e,{modules:["defaultKeyStatistics","summaryDetail"]});return{success:!0,data:{keyStatistics:t.defaultKeyStatistics,summaryDetail:t.summaryDetail}}}catch(t){return console.error(`Yahoo Finance key statistics error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch key statistics"}}}async getEarnings(e){try{const t=await Yr.quoteSummary(e,{modules:["earnings","earningsHistory","earningsTrend","calendarEvents"]});return{success:!0,data:{earnings:t.earnings,earningsHistory:t.earningsHistory,earningsTrend:t.earningsTrend,calendarEvents:t.calendarEvents}}}catch(t){return console.error(`Yahoo Finance earnings error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch earnings data"}}}async getOwnership(e){try{const t=await Yr.quoteSummary(e,{modules:["institutionOwnership","fundOwnership","insiderHolders","insiderTransactions","majorHoldersBreakdown"]});return{success:!0,data:{institutionOwnership:t.institutionOwnership,fundOwnership:t.fundOwnership,insiderHolders:t.insiderHolders,insiderTransactions:t.insiderTransactions,majorHoldersBreakdown:t.majorHoldersBreakdown}}}catch(t){return console.error(`Yahoo Finance ownership error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch ownership data"}}}async getSECFilings(e){try{return{success:!0,data:(await Yr.quoteSummary(e,{modules:["secFilings"]})).secFilings}}catch(t){return console.error(`Yahoo Finance SEC filings error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch SEC filings"}}}async getComprehensiveData(e){try{const[t,n,r,i]=await Promise.all([this.getQuote(e),this.getQuoteSummary(e),this.getHistorical(e,{period1:new Date(Date.now()-31536e6)}),this.getRecommendations(e)]);return{success:!0,data:{quote:t.data,summary:n.data,historical:r.data,recommendations:i.data}}}catch(t){return console.error(`Yahoo Finance comprehensive data error for ${e}:`,t),{success:!1,error:t.message||"Failed to fetch comprehensive data"}}}}const zr=new Jr,Zr=zr;async function ei(e,t,n){try{const r=await Zr.getHistorical(e,{period1:t,period2:n,interval:"1d"});if(!r.success||!r.data)throw new Error(`Failed to fetch stock data for ${e}`);const i=Array.isArray(r.data)?r.data:r.data.quotes;if(!i||!Array.isArray(i))throw new Error(`Invalid data format returned for ${e}`);return i.map(e=>({date:e.date,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}))}catch(r){throw console.error("Error fetching stock data:",r),r}}async function ti(e,t){const n={},r=e.map(e=>e.close),i=e.map(e=>e.high),a=e.map(e=>e.low),o=e.map(e=>e.volume);for(const s of t)switch(s.toLowerCase()){case"close_50_sma":case"sma50":n.sma50=ii(r,50);break;case"close_200_sma":case"sma200":n.sma200=ii(r,200);break;case"close_10_ema":case"ema10":n.ema10=ai(r,10);break;case"rsi":n.rsi=oi(r,14);break;case"macd":const e=si(r);n.macd=e.macd,n.macdSignal=e.signal,n.macdHistogram=e.histogram;break;case"boll":case"bollinger":const t=ci(r,20,2);n.bollingerUpper=t.upper,n.bollingerMiddle=t.middle,n.bollingerLower=t.lower;break;case"atr":n.atr=li(i,a,r,14);break;case"vwma":n.vwma=ui(r,o,20)}return n}async function ni(e){try{const t=await fetch(`/api/stocks/quote/${e}`);if(!t.ok)throw new Error("Failed to fetch fundamentals");const n=await t.json();return{marketCap:n.marketCap,peRatio:n.peRatio,dividendYield:n.dividendYield,eps:n.eps,revenue:n.revenue,profitMargin:n.profitMargin}}catch(t){throw console.error("Error fetching fundamentals:",t),t}}async function ri(e,t=10){try{return[]}catch(n){return console.error("Error fetching news:",n),[]}}function ii(e,t){const n=[];for(let r=0;r<e.length;r++)if(r<t-1)n.push(NaN);else{const i=e.slice(r-t+1,r+1).reduce((e,t)=>e+t,0);n.push(i/t)}return n}function ai(e,t){const n=[],r=2/(t+1);let i=e.slice(0,t).reduce((e,t)=>e+t,0)/t;n.push(...Array(t-1).fill(NaN)),n.push(i);for(let a=t;a<e.length;a++)i=(e[a]-i)*r+i,n.push(i);return n}function oi(e,t=14){const n=[],r=[],i=[];for(let a=1;a<e.length;a++){const t=e[a]-e[a-1];r.push(t>0?t:0),i.push(t<0?Math.abs(t):0)}for(let a=0;a<r.length;a++)if(a<t-1)n.push(NaN);else{const e=r.slice(a-t+1,a+1).reduce((e,t)=>e+t,0)/t,o=i.slice(a-t+1,a+1).reduce((e,t)=>e+t,0)/t,s=100-100/(1+(0===o?100:e/o));n.push(s)}return n.unshift(NaN),n}function si(e){const t=ai(e,12),n=ai(e,26),r=t.map((e,t)=>e-n[t]),i=ai(r.filter(e=>!isNaN(e)),9),a=[...Array(r.length-i.length).fill(NaN),...i],o=r.map((e,t)=>e-a[t]);return{macd:r,signal:a,histogram:o}}function ci(e,t=20,n=2){const r=ii(e,t),i=[],a=[];for(let o=0;o<e.length;o++)if(o<t-1)i.push(NaN),a.push(NaN);else{const s=e.slice(o-t+1,o+1),c=r[o],l=s.reduce((e,t)=>e+Math.pow(t-c,2),0)/t,u=Math.sqrt(l);i.push(c+n*u),a.push(c-n*u)}return{upper:i,middle:r,lower:a}}function li(e,t,n,r=14){const i=[],a=[];for(let o=1;o<e.length;o++){const r=e[o]-t[o],i=Math.abs(e[o]-n[o-1]),s=Math.abs(t[o]-n[o-1]);a.push(Math.max(r,i,s))}i.push(NaN);for(let o=0;o<a.length;o++)if(o<r-1)i.push(NaN);else{const e=a.slice(o-r+1,o+1).reduce((e,t)=>e+t,0)/r;i.push(e)}return i}function ui(e,t,n=20){const r=[];for(let i=0;i<e.length;i++)if(i<n-1)r.push(NaN);else{const a=e.slice(i-n+1,i+1),o=t.slice(i-n+1,i+1),s=a.reduce((e,t,n)=>e+t*o[n],0),c=o.reduce((e,t)=>e+t,0);r.push(s/c)}return r}class di{llm;constructor(e){this.llm=e}async analyze(e){const{companyOfInterest:t,tradeDate:n}=e,r=`You are a trading assistant tasked with analyzing financial markets. Your role is to select the **most relevant indicators** for a given market condition or trading strategy from the following list. The goal is to choose up to **8 indicators** that provide complementary insights without redundancy.\n\nMoving Averages:\n- close_50_sma: 50 SMA: A medium-term trend indicator. Identify trend direction and support/resistance.\n- close_200_sma: 200 SMA: A long-term trend benchmark. Confirm overall market trend and golden/death cross.\n- close_10_ema: 10 EMA: A responsive short-term average. Capture quick momentum shifts.\n\nMACD Related:\n- macd: MACD: Momentum via EMA differences. Look for crossovers and divergence.\n- macds: MACD Signal: EMA smoothing of MACD line. Use crossovers to trigger trades.\n- macdh: MACD Histogram: Gap between MACD and signal. Visualize momentum strength.\n\nMomentum Indicators:\n- rsi: RSI: Measures overbought/oversold conditions using 70/30 thresholds.\n\nVolatility Indicators:\n- boll: Bollinger Middle: 20 SMA basis for Bollinger Bands.\n- boll_ub: Bollinger Upper: 2 std devs above middle, signals overbought.\n- boll_lb: Bollinger Lower: 2 std devs below middle, signals oversold.\n- atr: ATR: Measures volatility for stop-loss and position sizing.\n\nVolume-Based Indicators:\n- vwma: VWMA: Volume-weighted moving average confirms trends.\n\nSelect indicators that provide diverse information and explain why they're suitable. Write a detailed report of trends observed.\nMake sure to append a Markdown table at the end of the report to organize key points.\n\nFor your reference, the current date is ${n}. The company we want to analyze is ${t}.`;try{const i=new Date(n),a=new Date(i);a.setMonth(a.getMonth()-6);const o=await ei(t,a,i),s=["close_50_sma","close_200_sma","close_10_ema","rsi","macd","boll","atr","vwma"],c=await ti(o,s),l=o.slice(-20),u=[{role:"system",content:r},{role:"user",content:`\nRecent Price Action for ${t}:\n${l.map(e=>`${e.date}: Close=$${e.close.toFixed(2)}, Volume=${e.volume}`).join("\n")}\n\nTechnical Indicators (Latest Values):\n- 50 SMA: ${c.sma50?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- 200 SMA: ${c.sma200?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- 10 EMA: ${c.ema10?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- RSI: ${c.rsi?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- MACD: ${c.macd?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- Bollinger Upper: ${c.bollingerUpper?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- Bollinger Middle: ${c.bollingerMiddle?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- Bollinger Lower: ${c.bollingerLower?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- ATR: ${c.atr?.slice(-1)[0]?.toFixed(2)||"N/A"}\n- VWMA: ${c.vwma?.slice(-1)[0]?.toFixed(2)||"N/A"}\n\nPlease analyze these indicators and provide a comprehensive market analysis report.`}],d=await this.llm.invoke(u);return{marketReport:d.content,messages:[...e.messages,{role:"assistant",content:d.content}],sender:"MarketAnalyst"}}catch(i){return console.error("Market Analyst error:",i),{marketReport:`Error analyzing market data for ${t}: ${i}`,sender:"MarketAnalyst"}}}}class pi{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async analyze(e){const{investmentDebateState:t,marketReport:n,sentimentReport:r,newsReport:i,fundamentalsReport:a}=e,o=`${n}\n\n${r}\n\n${i}\n\n${a}`,s=await this.memory.getMemories(o,2);let c="";c=s.length>0?s.map(e=>e.recommendation).join("\n\n"):"No past memories found.";const l=`You are a Bull Analyst advocating for investing in the stock. Your task is to build a strong, evidence-based case emphasizing growth potential, competitive advantages, and positive market indicators. Leverage the provided research and data to address concerns and counter bearish arguments effectively.\n\nKey points to focus on:\n- Growth Potential: Highlight the company's market opportunities, revenue projections, and scalability.\n- Competitive Advantages: Emphasize factors like unique products, strong branding, or dominant market positioning.\n- Positive Indicators: Use financial health, industry trends, and recent positive news as evidence.\n- Bear Counterpoints: Critically analyze the bear argument with specific data and sound reasoning, addressing concerns thoroughly and showing why the bull perspective holds stronger merit.\n- Engagement: Present your argument in a conversational style, engaging directly with the bear analyst's points and debating effectively rather than just listing data.\n\nResources available:\nMarket research report: ${n}\nSocial media sentiment report: ${r}\nLatest world affairs news: ${i}\nCompany fundamentals report: ${a}\nConversation history of the debate: ${t.history}\nLast bear argument: ${t.currentResponse}\nReflections from similar situations and lessons learned: ${c}\n\nUse this information to deliver a compelling bull argument, refute the bear's concerns, and engage in a dynamic debate that demonstrates the strengths of the bull position. You must also address reflections and learn from lessons and mistakes you made in the past.`,u=`Bull Analyst: ${(await this.llm.invoke(l)).content}`;return{investmentDebateState:{history:t.history+"\n"+u,bullHistory:t.bullHistory+"\n"+u,bearHistory:t.bearHistory,currentResponse:u,judgeDecision:t.judgeDecision,count:t.count+1}}}}class hi{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async analyze(e){const{investmentDebateState:t,marketReport:n,sentimentReport:r,newsReport:i,fundamentalsReport:a}=e,o=`${n}\n\n${r}\n\n${i}\n\n${a}`,s=await this.memory.getMemories(o,2);let c="";c=s.length>0?s.map(e=>e.recommendation).join("\n\n"):"No past memories found.";const l=`You are a Bear Analyst advocating for caution or avoiding investment in the stock. Your task is to build a strong, evidence-based case emphasizing risks, challenges, and negative market indicators. Use the provided research and data to highlight concerns and counter bullish arguments effectively.\n\nKey points to focus on:\n- Risk Factors: Identify market risks, competitive threats, regulatory challenges, or economic headwinds.\n- Valuation Concerns: Point out if the stock is overvalued based on fundamentals or technical indicators.\n- Negative Indicators: Use weak financial metrics, declining trends, or negative news as evidence.\n- Bull Counterpoints: Critically analyze the bull argument with specific data and reasoning, showing why the bear perspective is more prudent.\n- Engagement: Present your argument conversationally, directly engaging with the bull analyst's points.\n\nResources available:\nMarket research report: ${n}\nSocial media sentiment report: ${r}\nLatest world affairs news: ${i}\nCompany fundamentals report: ${a}\nConversation history of the debate: ${t.history}\nLast bull argument: ${t.currentResponse}\nReflections from similar situations and lessons learned: ${c}\n\nUse this information to deliver a compelling bear argument, highlight risks, and engage in a dynamic debate. Learn from past mistakes reflected in the memories provided.`,u=`Bear Analyst: ${(await this.llm.invoke(l)).content}`;return{investmentDebateState:{history:t.history+"\n"+u,bullHistory:t.bullHistory,bearHistory:t.bearHistory+"\n"+u,currentResponse:u,judgeDecision:t.judgeDecision,count:t.count+1}}}}class fi{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async makeDecision(e){const{investmentDebateState:t,companyOfInterest:n}=e,r=`You are an Investment Judge tasked with evaluating the debate between a Bull Analyst and a Bear Analyst regarding ${n}.\n\nReview the complete debate history:\n${t.history}\n\nBased on the arguments presented by both sides:\n1. Evaluate the strength of each argument\n2. Consider the evidence provided\n3. Assess the risks and opportunities\n4. Make a final decision: Should we INVEST or NOT INVEST?\n\nProvide your reasoning and conclude with a clear decision: "FINAL DECISION: INVEST" or "FINAL DECISION: NOT INVEST"`,i=await this.llm.invoke(r),a=i.content.includes("INVEST")&&!i.content.includes("NOT INVEST")?"INVEST":"NOT INVEST";return{investmentDebateState:{...t,judgeDecision:i.content},investmentPlan:"INVEST"===a?"Proceed with investment based on bull arguments":"Avoid investment due to bear concerns"}}}class mi{llm;memory;constructor(e,t){this.llm=e,this.memory=t}async makeDecision(e){const{companyOfInterest:t,investmentPlan:n,marketReport:r,sentimentReport:i,newsReport:a,fundamentalsReport:o}=e,s=`${r}\n\n${i}\n\n${a}\n\n${o}`,c=await this.memory.getMemories(s,2);let l="";l=c.length>0?c.map(e=>e.recommendation).join("\n\n"):"No past memories found.";const u=[{role:"system",content:`You are a trading agent analyzing market data to make investment decisions. Based on your analysis, provide a specific recommendation to buy, sell, or hold. End with a firm decision and always conclude your response with 'FINAL TRANSACTION PROPOSAL: **BUY/HOLD/SELL**' to confirm your recommendation.\n\nDo not forget to utilize lessons from past decisions to learn from your mistakes. Here is some reflections from similar situations you traded in and the lessons learned:\n\n${l}`},{role:"user",content:`Based on a comprehensive analysis by a team of analysts, here is an investment plan tailored for ${t}. This plan incorporates insights from current technical market trends, macroeconomic indicators, and social media sentiment. Use this plan as a foundation for evaluating your next trading decision.\n\nProposed Investment Plan: ${n}\n\nLeverage these insights to make an informed and strategic decision.`}],d=await this.llm.invoke(u);return{traderInvestmentPlan:d.content,messages:[...e.messages,{role:"assistant",content:d.content}],sender:"Trader"}}}const gi={bodySerializer:e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t)},yi=({allowReserved:e,explode:t,name:n,style:r,value:i})=>{if(!t){const t=(e?i:i.map(e=>encodeURIComponent(e))).join((e=>{switch(e){case"form":default:return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20"}})(r));switch(r){case"label":return`.${t}`;case"matrix":return`;${n}=${t}`;case"simple":return t;default:return`${n}=${t}`}}const a=(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}})(r),o=i.map(t=>"label"===r||"simple"===r?e?t:encodeURIComponent(t):Ii({allowReserved:e,name:n,value:t})).join(a);return"label"===r||"matrix"===r?a+o:o},Ii=({allowReserved:e,name:t,value:n})=>{if(null==n)return"";if("object"==typeof n)throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},Ci=({allowReserved:e,explode:t,name:n,style:r,value:i,valueOnly:a})=>{if(i instanceof Date)return a?i.toISOString():`${n}=${i.toISOString()}`;if("deepObject"!==r&&!t){let t=[];Object.entries(i).forEach(([n,r])=>{t=[...t,n,e?r:encodeURIComponent(r)]});const a=t.join(",");switch(r){case"form":return`${n}=${a}`;case"label":return`.${a}`;case"matrix":return`;${n}=${a}`;default:return a}}const o=(e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}})(r),s=Object.entries(i).map(([t,i])=>Ii({allowReserved:e,name:"deepObject"===r?`${n}[${t}]`:t,value:i})).join(o);return"label"===r||"matrix"===r?o+s:s},Ai=/\{[^{}]+\}/g,Si=({baseUrl:e,path:t,query:n,querySerializer:r,url:i})=>{let a=(e??"")+(i.startsWith("/")?i:`/${i}`);t&&(a=(({path:e,url:t})=>{let n=t;const r=t.match(Ai);if(r)for(const i of r){let t=!1,r=i.substring(1,i.length-1),a="simple";r.endsWith("*")&&(t=!0,r=r.substring(0,r.length-1)),r.startsWith(".")?(r=r.substring(1),a="label"):r.startsWith(";")&&(r=r.substring(1),a="matrix");const o=e[r];if(null==o)continue;if(Array.isArray(o)){n=n.replace(i,yi({explode:t,name:r,style:a,value:o}));continue}if("object"==typeof o){n=n.replace(i,Ci({explode:t,name:r,style:a,value:o,valueOnly:!0}));continue}if("matrix"===a){n=n.replace(i,`;${Ii({name:r,value:o})}`);continue}const s=encodeURIComponent("label"===a?`.${o}`:o);n=n.replace(i,s)}return n})({path:t,url:a}));let o=n?r(n):"";return o.startsWith("?")&&(o=o.substring(1)),o&&(a+=`?${o}`),a};function bi(e){const t=void 0!==e.body;if(t&&e.bodySerializer){if("serializedBody"in e){return void 0!==e.serializedBody&&""!==e.serializedBody?e.serializedBody:null}return""!==e.body?e.body:null}if(t)return e.body}const Ti=async(e,t)=>{const n="function"==typeof t?await t(e):t;if(n)return"bearer"===e.scheme?`Bearer ${n}`:"basic"===e.scheme?`Basic ${btoa(n)}`:n},vi=({parameters:e={},...t}={})=>n=>{const r=[];if(n&&"object"==typeof n)for(const i in n){const a=n[i];if(null==a)continue;const o=e[i]||t;if(Array.isArray(a)){const e=yi({allowReserved:o.allowReserved,explode:!0,name:i,style:"form",value:a,...o.array});e&&r.push(e)}else if("object"==typeof a){const e=Ci({allowReserved:o.allowReserved,explode:!0,name:i,style:"deepObject",value:a,...o.object});e&&r.push(e)}else{const e=Ii({allowReserved:o.allowReserved,name:i,value:a});e&&r.push(e)}}return r.join("&")},_i=(e,t)=>!!t&&!!(e.headers.has(t)||e.query?.[t]||e.headers.get("Cookie")?.includes(`${t}=`)),wi=e=>Si({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:"function"==typeof e.querySerializer?e.querySerializer:vi(e.querySerializer),url:e.url}),Ei=(e,t)=>{const n={...e,...t};return n.baseUrl?.endsWith("/")&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=Ri(e.headers,t.headers),n},Pi=e=>{const t=[];return e.forEach((e,n)=>{t.push([n,e])}),t},Ri=(...e)=>{const t=new Headers;for(const n of e){if(!n)continue;const e=n instanceof Headers?Pi(n):Object.entries(n);for(const[n,r]of e)if(null===r)t.delete(n);else if(Array.isArray(r))for(const e of r)t.append(n,e);else void 0!==r&&t.set(n,"object"==typeof r?JSON.stringify(r):r)}return t};class Li{fns=[];clear(){this.fns=[]}eject(e){const t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){const t=this.getInterceptorIndex(e);return Boolean(this.fns[t])}getInterceptorIndex(e){return"number"==typeof e?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){const n=this.getInterceptorIndex(e);return!!this.fns[n]&&(this.fns[n]=t,e)}use(e){return this.fns.push(e),this.fns.length-1}}const Ni=vi({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),Oi={"Content-Type":"application/json"},Bi=(e={})=>({...gi,headers:Oi,parseAs:"auto",querySerializer:Ni,...e}),Mi=((e={})=>{let t=Ei(Bi(),e);const n=()=>({...t}),r={error:new Li,request:new Li,response:new Li},i=async e=>{const n={...t,...e,fetch:e.fetch??t.fetch??globalThis.fetch,headers:Ri(t.headers,e.headers),serializedBody:void 0};n.security&&await(async({security:e,...t})=>{for(const n of e){if(_i(t,n.name))continue;const e=await Ti(n,t.auth);if(!e)continue;const r=n.name??"Authorization";switch(n.in){case"query":t.query||(t.query={}),t.query[r]=e;break;case"cookie":t.headers.append("Cookie",`${r}=${e}`);break;default:t.headers.set(r,e)}}})({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),void 0!==n.body&&n.bodySerializer&&(n.serializedBody=n.bodySerializer(n.body)),void 0!==n.body&&""!==n.serializedBody||n.headers.delete("Content-Type");return{opts:n,url:wi(n)}},a=async e=>{const{opts:t,url:n}=await i(e),a={redirect:"follow",...t,body:bi(t)};let o=new Request(n,a);for(const i of r.request.fns)i&&(o=await i(o,t));const s=t.fetch;let c;try{c=await s(o)}catch(f){let e=f;for(const n of r.error.fns)n&&(e=await n(f,void 0,o,t));if(e=e||{},t.throwOnError)throw e;return"data"===t.responseStyle?void 0:{error:e,request:o,response:void 0}}for(const i of r.response.fns)i&&(c=await i(c,o,t));const l={request:o,response:c};if(c.ok){const e=("auto"===t.parseAs?(e=>{if(!e)return"stream";const t=e.split(";")[0]?.trim();return t?t.startsWith("application/json")||t.endsWith("+json")?"json":"multipart/form-data"===t?"formData":["application/","audio/","image/","video/"].some(e=>t.startsWith(e))?"blob":t.startsWith("text/")?"text":void 0:void 0})(c.headers.get("Content-Type")):t.parseAs)??"json";if(204===c.status||"0"===c.headers.get("Content-Length")){let n;switch(e){case"arrayBuffer":case"blob":case"text":n=await c[e]();break;case"formData":n=new FormData;break;case"stream":n=c.body;break;default:n={}}return"data"===t.responseStyle?n:{data:n,...l}}let n;switch(e){case"arrayBuffer":case"blob":case"formData":case"json":case"text":n=await c[e]();break;case"stream":return"data"===t.responseStyle?c.body:{data:c.body,...l}}return"json"===e&&(t.responseValidator&&await t.responseValidator(n),t.responseTransformer&&(n=await t.responseTransformer(n))),"data"===t.responseStyle?n:{data:n,...l}}const u=await c.text();let d;try{d=JSON.parse(u)}catch{}const p=d??u;let h=p;for(const i of r.error.fns)i&&(h=await i(p,c,o,t));if(h=h||{},t.throwOnError)throw h;return"data"===t.responseStyle?void 0:{error:h,...l}},o=e=>t=>a({...t,method:e}),s=e=>async t=>{const{opts:n,url:a}=await i(t);return(({onRequest:e,onSseError:t,onSseEvent:n,responseTransformer:r,responseValidator:i,sseDefaultRetryDelay:a,sseMaxRetryAttempts:o,sseMaxRetryDelay:s,sseSleepFn:c,url:l,...u})=>{let d;const p=c??(e=>new Promise(t=>setTimeout(t,e)));return{stream:async function*(){let c=a??3e3,h=0;const f=u.signal??(new AbortController).signal;for(;!f.aborted;){h++;const a=u.headers instanceof Headers?u.headers:new Headers(u.headers);void 0!==d&&a.set("Last-Event-ID",d);try{const t={redirect:"follow",...u,body:u.serializedBody,headers:a,signal:f};let o=new Request(l,t);e&&(o=await e(l,t));const s=u.fetch??globalThis.fetch,p=await s(o);if(!p.ok)throw new Error(`SSE failed: ${p.status} ${p.statusText}`);if(!p.body)throw new Error("No body in SSE response");const h=p.body.pipeThrough(new TextDecoderStream).getReader();let m="";const g=()=>{try{h.cancel()}catch{}};f.addEventListener("abort",g);try{for(;;){const{done:e,value:t}=await h.read();if(e)break;m+=t;const a=m.split("\n\n");m=a.pop()??"";for(const o of a){const e=o.split("\n"),t=[];let a,s;for(const n of e)if(n.startsWith("data:"))t.push(n.replace(/^data:\s*/,""));else if(n.startsWith("event:"))a=n.replace(/^event:\s*/,"");else if(n.startsWith("id:"))d=n.replace(/^id:\s*/,"");else if(n.startsWith("retry:")){const e=Number.parseInt(n.replace(/^retry:\s*/,""),10);Number.isNaN(e)||(c=e)}let l=!1;if(t.length){const e=t.join("\n");try{s=JSON.parse(e),l=!0}catch{s=e}}l&&(i&&await i(s),r&&(s=await r(s))),n?.({data:s,event:a,id:d,retry:c}),t.length&&(yield s)}}}finally{f.removeEventListener("abort",g),h.releaseLock()}break}catch(m){if(t?.(m),void 0!==o&&h>=o)break;const e=Math.min(c*2**(h-1),s??3e4);await p(e)}}}()}})({...n,body:n.body,headers:n.headers,method:e,onRequest:async(e,t)=>{let i=new Request(e,t);for(const a of r.request.fns)a&&(i=await a(i,n));return i},url:a})};return{buildUrl:wi,connect:o("CONNECT"),delete:o("DELETE"),get:o("GET"),getConfig:n,head:o("HEAD"),interceptors:r,options:o("OPTIONS"),patch:o("PATCH"),post:o("POST"),put:o("PUT"),request:a,setConfig:e=>(t=Ei(t,e),n()),sse:{connect:s("CONNECT"),delete:s("DELETE"),get:s("GET"),head:s("HEAD"),options:s("OPTIONS"),patch:s("PATCH"),post:s("POST"),put:s("PUT"),trace:s("TRACE")},trace:o("TRACE")}})((Di=Bi(),{...Di,baseUrl:"https://app.qwksearch.com/api"}));var Di;class Fi{llm;constructor(e){this.llm=e}async analyze(e){const{companyOfInterest:t,tradeDate:n}=e;try{const i=`${t} stock news analysis ${n}`;console.log(`NewsAnalyst searching for: ${i}`);const a=await(r={query:{q:i,cat:"news",recency:"month"}},(r.client??Mi).get({url:"/search",...r}));if(!a.data?.results||0===a.data.results.length)return{newsReport:`No significant news found for ${t} around ${n}.`,sender:"NewsAnalyst"};const o=a.data.results.slice(0,5).map((e,t)=>`\nArticle ${t+1}:\nTitle: ${e.title}\nSource: ${e.domain}\nSnippet: ${e.snippet}\nURL: ${e.url}\n`).join("\n"),s=`You are a financial news analyst. Your job is to synthesize news headlines and snippets into a concise, relevant report for a trading strategy.\n \nFocus on:\n1. Significant events (earnings, mergers, regulatory changes).\n2. Market sentiment (positive/negative coverage).\n3. Potential impact on stock price.\n\nProvide a summary first, then a bulleted list of key takeaways.\nThe current date is ${n}. The company is ${t}.`,c=[{role:"system",content:s},{role:"user",content:`Here are the latest news search results:\n${o}\n\nPlease analyze these and write your report.`}],l=await this.llm.invoke(c);return{newsReport:l.content,messages:[...e.messages,{role:"assistant",content:l.content}],sender:"NewsAnalyst"}}catch(i){return console.error("News Analyst error:",i),{newsReport:`Error analyzing news for ${t}: ${i}`,sender:"NewsAnalyst"}}var r}}const ki={llmProvider:"groq",deepThinkLLM:"llama3-70b-8192",quickThinkLLM:"llama3-8b-8192",temperature:.3,projectDir:"./data",apiKeys:{groq:process.env.GROQ_API_KEY||""}};class Gi{config;deepThinkingLLM;quickThinkingLLM;selectedAnalysts;debug;bullMemory;bearMemory;traderMemory;investJudgeMemory;riskManagerMemory;marketAnalyst;bullResearcher;bearResearcher;investmentJudge;trader;newsAnalyst;currentState=null;ticker=null;logStatesDict={};constructor(e=["market","social","news","fundamentals"],t=!1,n){this.selectedAnalysts=e,this.debug=t,this.config={...ki,...n},this.deepThinkingLLM=Xr(this.config,this.config.deepThinkLLM),this.quickThinkingLLM=Xr(this.config,this.config.quickThinkLLM),this.bullMemory=new Kr("bull_memory",this.config),this.bearMemory=new Kr("bear_memory",this.config),this.traderMemory=new Kr("trader_memory",this.config),this.investJudgeMemory=new Kr("invest_judge_memory",this.config),this.riskManagerMemory=new Kr("risk_manager_memory",this.config),this.marketAnalyst=new di(this.deepThinkingLLM),this.bullResearcher=new pi(this.deepThinkingLLM,this.bullMemory),this.bearResearcher=new hi(this.deepThinkingLLM,this.bearMemory),this.investmentJudge=new fi(this.quickThinkingLLM,this.investJudgeMemory),this.trader=new mi(this.quickThinkingLLM,this.traderMemory),this.newsAnalyst=new Fi(this.deepThinkingLLM)}async propagate(e,t){this.ticker=e;const n=this.createInitialState(e,t);this.debug&&console.log(`\n=== Starting Analysis for ${e} on ${t} ===\n`);let r=n;if(this.selectedAnalysts.includes("market")){this.debug&&console.log("Running Market Analyst...");const e=await this.marketAnalyst.analyze(r);r={...r,...e}}if(r.sentimentReport||(r.sentimentReport="No social media analysis performed."),this.selectedAnalysts.includes("news")){this.debug&&console.log("Running News Analyst...");const e=await this.newsAnalyst.analyze(r);r={...r,...e}}else r.newsReport||(r.newsReport="No news analysis performed.");r.fundamentalsReport||(r.fundamentalsReport="No fundamentals analysis performed."),this.debug&&console.log("\n=== Investment Debate ==="),r.investmentDebateState={bullHistory:"",bearHistory:"",history:"",currentResponse:"",judgeDecision:"",count:0};for(let c=0;c<3;c++){this.debug&&console.log(`\nDebate Round ${c+1}`);const e=await this.bullResearcher.analyze(r);r={...r,...e};const t=await this.bearResearcher.analyze(r);r={...r,...t}}this.debug&&console.log("\nInvestment Judge making decision...");const i=await this.investmentJudge.makeDecision(r);r={...r,...i},this.debug&&console.log("\nTrader making final decision...");const a=await this.trader.makeDecision(r);r={...r,...a};const o=this.extractDecision(r.traderInvestmentPlan||"");r.finalTradeDecision=o,this.currentState=r,this.logState(t,r);const s=this.processSignal(o);return this.debug&&console.log(`\n=== Final Decision: ${s.action} (Confidence: ${s.confidence}) ===\n`),{state:r,signal:s}}createInitialState(e,t){return{companyOfInterest:e,tradeDate:t,messages:[],sender:"",marketReport:"",sentimentReport:"",newsReport:"",fundamentalsReport:"",investmentDebateState:{bullHistory:"",bearHistory:"",history:"",currentResponse:"",judgeDecision:"",count:0},investmentPlan:"",traderInvestmentPlan:"",riskDebateState:{riskyHistory:"",safeHistory:"",neutralHistory:"",history:"",latestSpeaker:"",currentRiskyResponse:"",currentSafeResponse:"",currentNeutralResponse:"",judgeDecision:"",count:0},finalTradeDecision:""}}extractDecision(e){const t=e.toUpperCase();return t.includes("BUY")&&!t.includes("NOT BUY")?"BUY":t.includes("SELL")&&!t.includes("NOT SELL")?"SELL":"HOLD"}processSignal(e){return{action:e,confidence:.75,reasoning:"Based on multi-agent analysis and debate",timestamp:/* @__PURE__ */new Date}}logState(e,t){this.logStatesDict[e]={companyOfInterest:t.companyOfInterest,tradeDate:t.tradeDate,marketReport:t.marketReport,sentimentReport:t.sentimentReport,newsReport:t.newsReport,fundamentalsReport:t.fundamentalsReport,investmentDebateState:{bullHistory:t.investmentDebateState.bullHistory,bearHistory:t.investmentDebateState.bearHistory,history:t.investmentDebateState.history,currentResponse:t.investmentDebateState.currentResponse,judgeDecision:t.investmentDebateState.judgeDecision},traderInvestmentDecision:t.traderInvestmentPlan,finalTradeDecision:t.finalTradeDecision}}async reflectAndRemember(e){if(!this.currentState)return;const t=`${this.currentState.marketReport}\n${this.currentState.newsReport}`,n=this.currentState.finalTradeDecision,r=`Decision: ${n}, Outcome: ${e>0?"Positive":"Negative"} (${e.toFixed(2)}%)`,i={situation:t,decision:n,outcome:e,recommendation:r,timestamp:/* @__PURE__ */new Date};await this.bullMemory.addMemory(i),await this.bearMemory.addMemory(i),await this.traderMemory.addMemory(i),await this.investJudgeMemory.addMemory(i)}getLogStates(){return this.logStatesDict}getCurrentState(){return this.currentState}}var Hi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function xi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ui(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if("function"==typeof t){var n=function e(){var n=!1;try{n=this instanceof e}catch{}return n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}var Vi,$i,ji={exports:{}};const Wi={},Xi=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,default:Wi},Symbol.toStringTag,{value:"Module"})),Ki=/* @__PURE__ */Ui(Xi);var Yi,qi,Qi,Ji;function zi(){if(qi)return Yi;qi=1;var e=function(){if($i)return Vi;$i=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===t.call(e)},a=function(n){if(!n||"[object Object]"!==t.call(n))return!1;var r,i=e.call(n,"constructor"),a=n.constructor&&n.constructor.prototype&&e.call(n.constructor.prototype,"isPrototypeOf");if(n.constructor&&!i&&!a)return!1;for(r in n);return void 0===r||e.call(n,r)},o=function(e,t){n&&"__proto__"===t.name?n(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},s=function(t,n){if("__proto__"===n){if(!e.call(t,n))return;if(r)return r(t,n).value}return t[n]};return Vi=function e(){var t,n,r,c,l,u,d=arguments[0],p=1,h=arguments.length,f=!1;for("boolean"==typeof d&&(f=d,d=arguments[1]||{},p=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});p<h;++p)if(null!=(t=arguments[p]))for(n in t)r=s(d,n),d!==(c=s(t,n))&&(f&&c&&(a(c)||(l=i(c)))?(l?(l=!1,u=r&&i(r)?r:[]):u=r&&a(r)?r:{},o(d,{name:n,newValue:e(f,u,c)})):void 0!==c&&o(d,{name:n,newValue:c}));return d},Vi}(),t=Ki,n=Ki;return Yi=function(){var r,i,a=Array.prototype.slice.call(arguments),o={};return a.length?1===a.length?a[0]:(i=a.map(function(n){var i="function"==typeof n?n():String(n||"");if(!i)return"";var a=t.parse(i,!0);return!r&&a&&(r=a),e(o,a.query),a.pathname}).filter(function(e){return!!e}),delete r.search,r.query=o,r.pathname=n.join.apply(n,i).replace(new RegExp("\\"+n.sep,"g"),"/"),t.format(r)):""},Yi}var Zi,ea,ta,na,ra,ia,aa,oa,sa,ca,la,ua,da,pa,ha,fa,ma,ga={exports:{}},ya=ga.exports;function Ia(){return Zi||(Zi=1,e=ga,t=ga.exports,function(){var n,r="Expected a function",i="__lodash_hash_undefined__",a="__lodash_placeholder__",o=32,s=128,c=256,l=1/0,u=9007199254740991,d=NaN,p=4294967295,h=[["ary",s],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",o],["partialRight",64],["rearg",c]],f="[object Arguments]",m="[object Array]",g="[object Boolean]",y="[object Date]",I="[object Error]",C="[object Function]",A="[object GeneratorFunction]",S="[object Map]",b="[object Number]",T="[object Object]",v="[object Promise]",_="[object RegExp]",w="[object Set]",E="[object String]",P="[object Symbol]",R="[object WeakMap]",L="[object ArrayBuffer]",N="[object DataView]",O="[object Float32Array]",B="[object Float64Array]",M="[object Int8Array]",D="[object Int16Array]",F="[object Int32Array]",k="[object Uint8Array]",G="[object Uint8ClampedArray]",H="[object Uint16Array]",x="[object Uint32Array]",U=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,j=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,X=RegExp(j.source),K=RegExp(W.source),Y=/<%-([\s\S]+?)%>/g,q=/<%([\s\S]+?)%>/g,Q=/<%=([\s\S]+?)%>/g,J=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,z=/^\w*$/,Z=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ee=/[\\^$.*+?()[\]{}|]/g,te=RegExp(ee.source),ne=/^\s+/,re=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,oe=/,? & /,se=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ce=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,ue=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,de=/\w*$/,pe=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,fe=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,ye=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ie=/($^)/,Ce=/['\n\r\u2028\u2029\\]/g,Ae="\\ud800-\\udfff",Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="\\u2700-\\u27bf",Te="a-z\\xdf-\\xf6\\xf8-\\xff",ve="A-Z\\xc0-\\xd6\\xd8-\\xde",_e="\\ufe0e\\ufe0f",we="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ee="['’]",Pe="["+Ae+"]",Re="["+we+"]",Le="["+Se+"]",Ne="\\d+",Oe="["+be+"]",Be="["+Te+"]",Me="[^"+Ae+we+Ne+be+Te+ve+"]",De="\\ud83c[\\udffb-\\udfff]",Fe="[^"+Ae+"]",ke="(?:\\ud83c[\\udde6-\\uddff]){2}",Ge="[\\ud800-\\udbff][\\udc00-\\udfff]",He="["+ve+"]",xe="\\u200d",Ue="(?:"+Be+"|"+Me+")",Ve="(?:"+He+"|"+Me+")",$e="(?:['’](?:d|ll|m|re|s|t|ve))?",je="(?:['’](?:D|LL|M|RE|S|T|VE))?",We="(?:"+Le+"|"+De+")?",Xe="["+_e+"]?",Ke=Xe+We+"(?:"+xe+"(?:"+[Fe,ke,Ge].join("|")+")"+Xe+We+")*",Ye="(?:"+[Oe,ke,Ge].join("|")+")"+Ke,qe="(?:"+[Fe+Le+"?",Le,ke,Ge,Pe].join("|")+")",Qe=RegExp(Ee,"g"),Je=RegExp(Le,"g"),ze=RegExp(De+"(?="+De+")|"+qe+Ke,"g"),Ze=RegExp([He+"?"+Be+"+"+$e+"(?="+[Re,He,"$"].join("|")+")",Ve+"+"+je+"(?="+[Re,He+Ue,"$"].join("|")+")",He+"?"+Ue+"+"+$e,He+"+"+je,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Ne,Ye].join("|"),"g"),et=RegExp("["+xe+Ae+Se+_e+"]"),tt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,nt=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],rt=-1,it={};it[O]=it[B]=it[M]=it[D]=it[F]=it[k]=it[G]=it[H]=it[x]=!0,it[f]=it[m]=it[L]=it[g]=it[N]=it[y]=it[I]=it[C]=it[S]=it[b]=it[T]=it[_]=it[w]=it[E]=it[R]=!1;var at={};at[f]=at[m]=at[L]=at[N]=at[g]=at[y]=at[O]=at[B]=at[M]=at[D]=at[F]=at[S]=at[b]=at[T]=at[_]=at[w]=at[E]=at[P]=at[k]=at[G]=at[H]=at[x]=!0,at[I]=at[C]=at[R]=!1;var ot={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},st=parseFloat,ct=parseInt,lt="object"==typeof Hi&&Hi&&Hi.Object===Object&&Hi,ut="object"==typeof self&&self&&self.Object===Object&&self,dt=lt||ut||Function("return this")(),pt=t&&!t.nodeType&&t,ht=pt&&e&&!e.nodeType&&e,ft=ht&&ht.exports===pt,mt=ft&&lt.process,gt=function(){try{var e=ht&&ht.require&&ht.require("util").types;return e||mt&&mt.binding&&mt.binding("util")}catch(t){}}(),yt=gt&&gt.isArrayBuffer,It=gt&&gt.isDate,Ct=gt&&gt.isMap,At=gt&&gt.isRegExp,St=gt&&gt.isSet,bt=gt&&gt.isTypedArray;function Tt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,a=null==e?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function _t(e,t){for(var n=-1,r=null==e?0:e.length;++n<r&&!1!==t(e[n],n,e););return e}function wt(e,t){for(var n=null==e?0:e.length;n--&&!1!==t(e[n],n,e););return e}function Et(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(!t(e[n],n,e))return!1;return!0}function Pt(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function Rt(e,t){return!(null==e||!e.length)&&Ht(e,t,0)>-1}function Lt(e,t,n){for(var r=-1,i=null==e?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}function Nt(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}function Ot(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function Bt(e,t,n,r){var i=-1,a=null==e?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}function Mt(e,t,n,r){var i=null==e?0:e.length;for(r&&i&&(n=e[--i]);i--;)n=t(n,e[i],i,e);return n}function Dt(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}var Ft=$t("length");function kt(e,t,n){var r;return n(e,function(e,n,i){if(t(e,n,i))return r=n,!1}),r}function Gt(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function Ht(e,t,n){return t==t?function(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}(e,t,n):Gt(e,Ut,n)}function xt(e,t,n,r){for(var i=n-1,a=e.length;++i<a;)if(r(e[i],t))return i;return-1}function Ut(e){return e!=e}function Vt(e,t){var n=null==e?0:e.length;return n?Xt(e,t)/n:d}function $t(e){return function(t){return null==t?n:t[e]}}function jt(e){return function(t){return null==e?n:e[t]}}function Wt(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}function Xt(e,t){for(var r,i=-1,a=e.length;++i<a;){var o=t(e[i]);o!==n&&(r=r===n?o:r+o)}return r}function Kt(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function Yt(e){return e?e.slice(0,dn(e)+1).replace(ne,""):e}function qt(e){return function(t){return e(t)}}function Qt(e,t){return Nt(t,function(t){return e[t]})}function Jt(e,t){return e.has(t)}function zt(e,t){for(var n=-1,r=e.length;++n<r&&Ht(t,e[n],0)>-1;);return n}function Zt(e,t){for(var n=e.length;n--&&Ht(t,e[n],0)>-1;);return n}var en=jt({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),tn=jt({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function nn(e){return"\\"+ot[e]}function rn(e){return et.test(e)}function an(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function on(e,t){return function(n){return e(t(n))}}function sn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n<r;){var s=e[n];s!==t&&s!==a||(e[n]=a,o[i++]=n)}return o}function cn(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}function ln(e){return rn(e)?function(e){for(var t=ze.lastIndex=0;ze.test(e);)++t;return t}(e):Ft(e)}function un(e){return rn(e)?function(e){return e.match(ze)||[]}(e):function(e){return e.split("")}(e)}function dn(e){for(var t=e.length;t--&&re.test(e.charAt(t)););return t}var pn=jt({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),hn=function e(t){var re,Ae=(t=null==t?dt:hn.defaults(dt.Object(),t,hn.pick(dt,nt))).Array,Se=t.Date,be=t.Error,Te=t.Function,ve=t.Math,_e=t.Object,we=t.RegExp,Ee=t.String,Pe=t.TypeError,Re=Ae.prototype,Le=Te.prototype,Ne=_e.prototype,Oe=t["__core-js_shared__"],Be=Le.toString,Me=Ne.hasOwnProperty,De=0,Fe=(re=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||""))?"Symbol(src)_1."+re:"",ke=Ne.toString,Ge=Be.call(_e),He=dt._,xe=we("^"+Be.call(Me).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ue=ft?t.Buffer:n,Ve=t.Symbol,$e=t.Uint8Array,je=Ue?Ue.allocUnsafe:n,We=on(_e.getPrototypeOf,_e),Xe=_e.create,Ke=Ne.propertyIsEnumerable,Ye=Re.splice,qe=Ve?Ve.isConcatSpreadable:n,ze=Ve?Ve.iterator:n,et=Ve?Ve.toStringTag:n,ot=function(){try{var e=la(_e,"defineProperty");return e({},"",{}),e}catch(t){}}(),lt=t.clearTimeout!==dt.clearTimeout&&t.clearTimeout,ut=Se&&Se.now!==dt.Date.now&&Se.now,pt=t.setTimeout!==dt.setTimeout&&t.setTimeout,ht=ve.ceil,mt=ve.floor,gt=_e.getOwnPropertySymbols,Ft=Ue?Ue.isBuffer:n,jt=t.isFinite,fn=Re.join,mn=on(_e.keys,_e),gn=ve.max,yn=ve.min,In=Se.now,Cn=t.parseInt,An=ve.random,Sn=Re.reverse,bn=la(t,"DataView"),Tn=la(t,"Map"),vn=la(t,"Promise"),_n=la(t,"Set"),wn=la(t,"WeakMap"),En=la(_e,"create"),Pn=wn&&new wn,Rn={},Ln=Ga(bn),Nn=Ga(Tn),On=Ga(vn),Bn=Ga(_n),Mn=Ga(wn),Dn=Ve?Ve.prototype:n,Fn=Dn?Dn.valueOf:n,kn=Dn?Dn.toString:n;function Gn(e){if(ns(e)&&!Wo(e)&&!(e instanceof Vn)){if(e instanceof Un)return e;if(Me.call(e,"__wrapped__"))return Ha(e)}return new Un(e)}var Hn=/* @__PURE__ */function(){function e(){}return function(t){if(!ts(t))return{};if(Xe)return Xe(t);e.prototype=t;var r=new e;return e.prototype=n,r}}();function xn(){}function Un(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=n}function Vn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function jn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Wn(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Xn(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new Wn;++t<n;)this.add(e[t])}function Kn(e){var t=this.__data__=new jn(e);this.size=t.size}function Yn(e,t){var n=Wo(e),r=!n&&jo(e),i=!n&&!r&&qo(e),a=!n&&!r&&!i&&us(e),o=n||r||i||a,s=o?Kt(e.length,Ee):[],c=s.length;for(var l in e)!t&&!Me.call(e,l)||o&&("length"==l||i&&("offset"==l||"parent"==l)||a&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||ga(l,c))||s.push(l);return s}function qn(e){var t=e.length;return t?e[Xr(0,t-1)]:n}function Qn(e,t){return Oa(Ei(e),ar(t,0,e.length))}function Jn(e){return Oa(Ei(e))}function zn(e,t,r){(r!==n&&!Uo(e[t],r)||r===n&&!(t in e))&&rr(e,t,r)}function Zn(e,t,r){var i=e[t];Me.call(e,t)&&Uo(i,r)&&(r!==n||t in e)||rr(e,t,r)}function er(e,t){for(var n=e.length;n--;)if(Uo(e[n][0],t))return n;return-1}function tr(e,t,n,r){return ur(e,function(e,i,a){t(r,e,n(e),a)}),r}function nr(e,t){return e&&Pi(t,Os(t),e)}function rr(e,t,n){"__proto__"==t&&ot?ot(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ir(e,t){for(var r=-1,i=t.length,a=Ae(i),o=null==e;++r<i;)a[r]=o?n:Es(e,t[r]);return a}function ar(e,t,r){return e==e&&(r!==n&&(e=e<=r?e:r),t!==n&&(e=e>=t?e:t)),e}function or(e,t,r,i,a,o){var s,c=1&t,l=2&t,u=4&t;if(r&&(s=a?r(e,i,a,o):r(e)),s!==n)return s;if(!ts(e))return e;var d=Wo(e);if(d){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Me.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return Ei(e,s)}else{var p=pa(e),h=p==C||p==A;if(qo(e))return Si(e,c);if(p==T||p==f||h&&!a){if(s=l||h?{}:fa(e),!c)return l?function(e,t){return Pi(e,da(e),t)}(e,function(e,t){return e&&Pi(t,Bs(t),e)}(s,e)):function(e,t){return Pi(e,ua(e),t)}(e,nr(s,e))}else{if(!at[p])return a?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case L:return bi(e);case g:case y:return new i(+e);case N:return function(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case O:case B:case M:case D:case F:case k:case G:case H:case x:return Ti(e,n);case S:return new i;case b:case E:return new i(e);case _:return function(e){var t=new e.constructor(e.source,de.exec(e));return t.lastIndex=e.lastIndex,t}(e);case w:return new i;case P:return r=e,Fn?_e(Fn.call(r)):{}}}(e,p,c)}}o||(o=new Kn);var m=o.get(e);if(m)return m;o.set(e,s),ss(e)?e.forEach(function(n){s.add(or(n,t,r,n,e,o))}):rs(e)&&e.forEach(function(n,i){s.set(i,or(n,t,r,i,e,o))});var I=d?n:(u?l?na:ta:l?Bs:Os)(e);return _t(I||e,function(n,i){I&&(n=e[i=n]),Zn(s,i,or(n,t,r,i,e,o))}),s}function sr(e,t,r){var i=r.length;if(null==e)return!i;for(e=_e(e);i--;){var a=r[i],o=t[a],s=e[a];if(s===n&&!(a in e)||!o(s))return!1}return!0}function cr(e,t,i){if("function"!=typeof e)throw new Pe(r);return Pa(function(){e.apply(n,i)},t)}function lr(e,t,n,r){var i=-1,a=Rt,o=!0,s=e.length,c=[],l=t.length;if(!s)return c;n&&(t=Nt(t,qt(n))),r?(a=Lt,o=!1):t.length>=200&&(a=Jt,o=!1,t=new Xn(t));e:for(;++i<s;){var u=e[i],d=null==n?u:n(u);if(u=r||0!==u?u:0,o&&d==d){for(var p=l;p--;)if(t[p]===d)continue e;c.push(u)}else a(t,d,r)||c.push(u)}return c}Gn.templateSettings={escape:Y,evaluate:q,interpolate:Q,variable:"",imports:{_:Gn}},Gn.prototype=xn.prototype,Gn.prototype.constructor=Gn,Un.prototype=Hn(xn.prototype),Un.prototype.constructor=Un,Vn.prototype=Hn(xn.prototype),Vn.prototype.constructor=Vn,$n.prototype.clear=function(){this.__data__=En?En(null):{},this.size=0},$n.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},$n.prototype.get=function(e){var t=this.__data__;if(En){var r=t[e];return r===i?n:r}return Me.call(t,e)?t[e]:n},$n.prototype.has=function(e){var t=this.__data__;return En?t[e]!==n:Me.call(t,e)},$n.prototype.set=function(e,t){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=En&&t===n?i:t,this},jn.prototype.clear=function(){this.__data__=[],this.size=0},jn.prototype.delete=function(e){var t=this.__data__,n=er(t,e);return!(n<0||(n==t.length-1?t.pop():Ye.call(t,n,1),--this.size,0))},jn.prototype.get=function(e){var t=this.__data__,r=er(t,e);return r<0?n:t[r][1]},jn.prototype.has=function(e){return er(this.__data__,e)>-1},jn.prototype.set=function(e,t){var n=this.__data__,r=er(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Wn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Tn||jn),string:new $n}},Wn.prototype.delete=function(e){var t=sa(this,e).delete(e);return this.size-=t?1:0,t},Wn.prototype.get=function(e){return sa(this,e).get(e)},Wn.prototype.has=function(e){return sa(this,e).has(e)},Wn.prototype.set=function(e,t){var n=sa(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Xn.prototype.add=Xn.prototype.push=function(e){return this.__data__.set(e,i),this},Xn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.clear=function(){this.__data__=new jn,this.size=0},Kn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Kn.prototype.get=function(e){return this.__data__.get(e)},Kn.prototype.has=function(e){return this.__data__.has(e)},Kn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof jn){var r=n.__data__;if(!Tn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Wn(r)}return n.set(e,t),this.size=n.size,this};var ur=Ni(Ir),dr=Ni(Cr,!0);function pr(e,t){var n=!0;return ur(e,function(e,r,i){return n=!!t(e,r,i)}),n}function hr(e,t,r){for(var i=-1,a=e.length;++i<a;){var o=e[i],s=t(o);if(null!=s&&(c===n?s==s&&!ls(s):r(s,c)))var c=s,l=o}return l}function fr(e,t){var n=[];return ur(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}function mr(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=ma),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?mr(s,t-1,n,r,i):Ot(i,s):r||(i[i.length]=s)}return i}var gr=Oi(),yr=Oi(!0);function Ir(e,t){return e&&gr(e,t,Os)}function Cr(e,t){return e&&yr(e,t,Os)}function Ar(e,t){return Pt(t,function(t){return zo(e[t])})}function Sr(e,t){for(var r=0,i=(t=yi(t,e)).length;null!=e&&r<i;)e=e[ka(t[r++])];return r&&r==i?e:n}function br(e,t,n){var r=t(e);return Wo(e)?r:Ot(r,n(e))}function Tr(e){return null==e?e===n?"[object Undefined]":"[object Null]":et&&et in _e(e)?function(e){var t=Me.call(e,et),r=e[et];try{e[et]=n;var i=!0}catch(o){}var a=ke.call(e);return i&&(t?e[et]=r:delete e[et]),a}(e):function(e){return ke.call(e)}(e)}function vr(e,t){return e>t}function _r(e,t){return null!=e&&Me.call(e,t)}function wr(e,t){return null!=e&&t in _e(e)}function Er(e,t,r){for(var i=r?Lt:Rt,a=e[0].length,o=e.length,s=o,c=Ae(o),l=1/0,u=[];s--;){var d=e[s];s&&t&&(d=Nt(d,qt(t))),l=yn(d.length,l),c[s]=!r&&(t||a>=120&&d.length>=120)?new Xn(s&&d):n}d=e[0];var p=-1,h=c[0];e:for(;++p<a&&u.length<l;){var f=d[p],m=t?t(f):f;if(f=r||0!==f?f:0,!(h?Jt(h,m):i(u,m,r))){for(s=o;--s;){var g=c[s];if(!(g?Jt(g,m):i(e[s],m,r)))continue e}h&&h.push(m),u.push(f)}}return u}function Pr(e,t,r){var i=null==(e=_a(e,t=yi(t,e)))?e:e[ka(Qa(t))];return null==i?n:Tt(i,e,r)}function Rr(e){return ns(e)&&Tr(e)==f}function Lr(e,t,r,i,a){return e===t||(null==e||null==t||!ns(e)&&!ns(t)?e!=e&&t!=t:function(e,t,r,i,a,o){var s=Wo(e),c=Wo(t),l=s?m:pa(e),u=c?m:pa(t),d=(l=l==f?T:l)==T,p=(u=u==f?T:u)==T,h=l==u;if(h&&qo(e)){if(!qo(t))return!1;s=!0,d=!1}if(h&&!d)return o||(o=new Kn),s||us(e)?Zi(e,t,r,i,a,o):function(e,t,n,r,i,a,o){switch(n){case N:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case L:return!(e.byteLength!=t.byteLength||!a(new $e(e),new $e(t)));case g:case y:case b:return Uo(+e,+t);case I:return e.name==t.name&&e.message==t.message;case _:case E:return e==t+"";case S:var s=an;case w:var c=1&r;if(s||(s=cn),e.size!=t.size&&!c)return!1;var l=o.get(e);if(l)return l==t;r|=2,o.set(e,t);var u=Zi(s(e),s(t),r,i,a,o);return o.delete(e),u;case P:if(Fn)return Fn.call(e)==Fn.call(t)}return!1}(e,t,l,r,i,a,o);if(!(1&r)){var C=d&&Me.call(e,"__wrapped__"),A=p&&Me.call(t,"__wrapped__");if(C||A){var v=C?e.value():e,R=A?t.value():t;return o||(o=new Kn),a(v,R,r,i,o)}}return!!h&&(o||(o=new Kn),function(e,t,r,i,a,o){var s=1&r,c=ta(e),l=c.length,u=ta(t),d=u.length;if(l!=d&&!s)return!1;for(var p=l;p--;){var h=c[p];if(!(s?h in t:Me.call(t,h)))return!1}var f=o.get(e),m=o.get(t);if(f&&m)return f==t&&m==e;var g=!0;o.set(e,t),o.set(t,e);for(var y=s;++p<l;){var I=e[h=c[p]],C=t[h];if(i)var A=s?i(C,I,h,t,e,o):i(I,C,h,e,t,o);if(!(A===n?I===C||a(I,C,r,i,o):A)){g=!1;break}y||(y="constructor"==h)}if(g&&!y){var S=e.constructor,b=t.constructor;S==b||!("constructor"in e)||!("constructor"in t)||"function"==typeof S&&S instanceof S&&"function"==typeof b&&b instanceof b||(g=!1)}return o.delete(e),o.delete(t),g}(e,t,r,i,a,o))}(e,t,r,i,Lr,a))}function Nr(e,t,r,i){var a=r.length,o=a,s=!i;if(null==e)return!o;for(e=_e(e);a--;){var c=r[a];if(s&&c[2]?c[1]!==e[c[0]]:!(c[0]in e))return!1}for(;++a<o;){var l=(c=r[a])[0],u=e[l],d=c[1];if(s&&c[2]){if(u===n&&!(l in e))return!1}else{var p=new Kn;if(i)var h=i(u,d,l,e,t,p);if(!(h===n?Lr(d,u,3,i,p):h))return!1}}return!0}function Or(e){return!(!ts(e)||(t=e,Fe&&Fe in t))&&(zo(e)?xe:fe).test(Ga(e));var t}function Br(e){return"function"==typeof e?e:null==e?ic:"object"==typeof e?Wo(e)?Hr(e[0],e[1]):Gr(e):hc(e)}function Mr(e){if(!Sa(e))return mn(e);var t=[];for(var n in _e(e))Me.call(e,n)&&"constructor"!=n&&t.push(n);return t}function Dr(e){if(!ts(e))return function(e){var t=[];if(null!=e)for(var n in _e(e))t.push(n);return t}(e);var t=Sa(e),n=[];for(var r in e)("constructor"!=r||!t&&Me.call(e,r))&&n.push(r);return n}function Fr(e,t){return e<t}function kr(e,t){var n=-1,r=Ko(e)?Ae(e.length):[];return ur(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function Gr(e){var t=ca(e);return 1==t.length&&t[0][2]?Ta(t[0][0],t[0][1]):function(n){return n===e||Nr(n,e,t)}}function Hr(e,t){return Ia(e)&&ba(t)?Ta(ka(e),t):function(r){var i=Es(r,e);return i===n&&i===t?Ps(r,e):Lr(t,i,3)}}function xr(e,t,r,i,a){e!==t&&gr(t,function(o,s){if(a||(a=new Kn),ts(o))!function(e,t,r,i,a,o,s){var c=wa(e,r),l=wa(t,r),u=s.get(l);if(u)zn(e,r,u);else{var d=o?o(c,l,r+"",e,t,s):n,p=d===n;if(p){var h=Wo(l),f=!h&&qo(l),m=!h&&!f&&us(l);d=l,h||f||m?Wo(c)?d=c:Yo(c)?d=Ei(c):f?(p=!1,d=Si(l,!0)):m?(p=!1,d=Ti(l,!0)):d=[]:as(l)||jo(l)?(d=c,jo(c)?d=Is(c):ts(c)&&!zo(c)||(d=fa(l))):p=!1}p&&(s.set(l,d),a(d,l,i,o,s),s.delete(l)),zn(e,r,d)}}(e,t,s,r,xr,i,a);else{var c=i?i(wa(e,s),o,s+"",e,t,a):n;c===n&&(c=o),zn(e,s,c)}},Bs)}function Ur(e,t){var r=e.length;if(r)return ga(t+=t<0?r:0,r)?e[t]:n}function Vr(e,t,n){t=t.length?Nt(t,function(e){return Wo(e)?function(t){return Sr(t,1===e.length?e[0]:e)}:e}):[ic];var r=-1;return t=Nt(t,qt(oa())),function(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}(kr(e,function(e,n,i){return{criteria:Nt(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return function(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=vi(i[r],a[r]);if(c)return r>=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)})}function $r(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=Sr(e,o);n(s,o)&&Jr(a,yi(o,e),s)}return a}function jr(e,t,n,r){var i=r?xt:Ht,a=-1,o=t.length,s=e;for(e===t&&(t=Ei(t)),n&&(s=Nt(e,qt(n)));++a<o;)for(var c=0,l=t[a],u=n?n(l):l;(c=i(s,u,c,r))>-1;)s!==e&&Ye.call(s,c,1),Ye.call(e,c,1);return e}function Wr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==a){var a=i;ga(i)?Ye.call(e,i,1):li(e,i)}}return e}function Xr(e,t){return e+mt(An()*(t-e+1))}function Kr(e,t){var n="";if(!e||t<1||t>u)return n;do{t%2&&(n+=e),(t=mt(t/2))&&(e+=e)}while(t);return n}function Yr(e,t){return Ra(va(e,t,ic),e+"")}function qr(e){return qn(Us(e))}function Qr(e,t){var n=Us(e);return Oa(n,ar(t,0,n.length))}function Jr(e,t,r,i){if(!ts(e))return e;for(var a=-1,o=(t=yi(t,e)).length,s=o-1,c=e;null!=c&&++a<o;){var l=ka(t[a]),u=r;if("__proto__"===l||"constructor"===l||"prototype"===l)return e;if(a!=s){var d=c[l];(u=i?i(d,l,c):n)===n&&(u=ts(d)?d:ga(t[a+1])?[]:{})}Zn(c,l,u),c=c[l]}return e}var zr=Pn?function(e,t){return Pn.set(e,t),e}:ic,Zr=ot?function(e,t){return ot(e,"toString",{configurable:!0,enumerable:!1,value:tc(t),writable:!0})}:ic;function ei(e){return Oa(Us(e))}function ti(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),(n=n>i?i:n)<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Ae(i);++r<i;)a[r]=e[r+t];return a}function ni(e,t){var n;return ur(e,function(e,r,i){return!(n=t(e,r,i))}),!!n}function ri(e,t,n){var r=0,i=null==e?r:e.length;if("number"==typeof t&&t==t&&i<=2147483647){for(;r<i;){var a=r+i>>>1,o=e[a];null!==o&&!ls(o)&&(n?o<=t:o<t)?r=a+1:i=a}return i}return ii(e,t,ic,n)}function ii(e,t,r,i){var a=0,o=null==e?0:e.length;if(0===o)return 0;for(var s=(t=r(t))!=t,c=null===t,l=ls(t),u=t===n;a<o;){var d=mt((a+o)/2),p=r(e[d]),h=p!==n,f=null===p,m=p==p,g=ls(p);if(s)var y=i||m;else y=u?m&&(i||h):c?m&&h&&(i||!f):l?m&&h&&!f&&(i||!g):!f&&!g&&(i?p<=t:p<t);y?a=d+1:o=d}return yn(o,4294967294)}function ai(e,t){for(var n=-1,r=e.length,i=0,a=[];++n<r;){var o=e[n],s=t?t(o):o;if(!n||!Uo(s,c)){var c=s;a[i++]=0===o?0:o}}return a}function oi(e){return"number"==typeof e?e:ls(e)?d:+e}function si(e){if("string"==typeof e)return e;if(Wo(e))return Nt(e,si)+"";if(ls(e))return kn?kn.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function ci(e,t,n){var r=-1,i=Rt,a=e.length,o=!0,s=[],c=s;if(n)o=!1,i=Lt;else if(a>=200){var l=t?null:Ki(e);if(l)return cn(l);o=!1,i=Jt,c=new Xn}else c=t?[]:s;e:for(;++r<a;){var u=e[r],d=t?t(u):u;if(u=n||0!==u?u:0,o&&d==d){for(var p=c.length;p--;)if(c[p]===d)continue e;t&&c.push(d),s.push(u)}else i(c,d,n)||(c!==s&&c.push(d),s.push(u))}return s}function li(e,t){var n=-1,r=(t=yi(t,e)).length;if(!r)return!0;for(;++n<r;){var i=ka(t[n]);if("__proto__"===i&&!Me.call(e,"__proto__"))return!1;if(("constructor"===i||"prototype"===i)&&n<r-1)return!1}var a=_a(e,t);return null==a||delete a[ka(Qa(t))]}function ui(e,t,n,r){return Jr(e,t,n(Sr(e,t)),r)}function di(e,t,n,r){for(var i=e.length,a=r?i:-1;(r?a--:++a<i)&&t(e[a],a,e););return n?ti(e,r?0:a,r?a+1:i):ti(e,r?a+1:0,r?i:a)}function pi(e,t){var n=e;return n instanceof Vn&&(n=n.value()),Bt(t,function(e,t){return t.func.apply(t.thisArg,Ot([e],t.args))},n)}function hi(e,t,n){var r=e.length;if(r<2)return r?ci(e[0]):[];for(var i=-1,a=Ae(r);++i<r;)for(var o=e[i],s=-1;++s<r;)s!=i&&(a[i]=lr(a[i]||o,e[s],t,n));return ci(mr(a,1),t,n)}function fi(e,t,r){for(var i=-1,a=e.length,o=t.length,s={};++i<a;){var c=i<o?t[i]:n;r(s,e[i],c)}return s}function mi(e){return Yo(e)?e:[]}function gi(e){return"function"==typeof e?e:ic}function yi(e,t){return Wo(e)?e:Ia(e,t)?[e]:Fa(Cs(e))}var Ii=Yr;function Ci(e,t,r){var i=e.length;return r=r===n?i:r,!t&&r>=i?e:ti(e,t,r)}var Ai=lt||function(e){return dt.clearTimeout(e)};function Si(e,t){if(t)return e.slice();var n=e.length,r=je?je(n):new e.constructor(n);return e.copy(r),r}function bi(e){var t=new e.constructor(e.byteLength);return new $e(t).set(new $e(e)),t}function Ti(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function vi(e,t){if(e!==t){var r=e!==n,i=null===e,a=e==e,o=ls(e),s=t!==n,c=null===t,l=t==t,u=ls(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e<t||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}function _i(e,t,n,r){for(var i=-1,a=e.length,o=n.length,s=-1,c=t.length,l=gn(a-o,0),u=Ae(c+l),d=!r;++s<c;)u[s]=t[s];for(;++i<o;)(d||i<a)&&(u[n[i]]=e[i]);for(;l--;)u[s++]=e[i++];return u}function wi(e,t,n,r){for(var i=-1,a=e.length,o=-1,s=n.length,c=-1,l=t.length,u=gn(a-s,0),d=Ae(u+l),p=!r;++i<u;)d[i]=e[i];for(var h=i;++c<l;)d[h+c]=t[c];for(;++o<s;)(p||i<a)&&(d[h+n[o]]=e[i++]);return d}function Ei(e,t){var n=-1,r=e.length;for(t||(t=Ae(r));++n<r;)t[n]=e[n];return t}function Pi(e,t,r,i){var a=!r;r||(r={});for(var o=-1,s=t.length;++o<s;){var c=t[o],l=i?i(r[c],e[c],c,r,e):n;l===n&&(l=e[c]),a?rr(r,c,l):Zn(r,c,l)}return r}function Ri(e,t){return function(n,r){var i=Wo(n)?vt:tr,a=t?t():{};return i(n,e,oa(r,2),a)}}function Li(e){return Yr(function(t,r){var i=-1,a=r.length,o=a>1?r[a-1]:n,s=a>2?r[2]:n;for(o=e.length>3&&"function"==typeof o?(a--,o):n,s&&ya(r[0],r[1],s)&&(o=a<3?n:o,a=1),t=_e(t);++i<a;){var c=r[i];c&&e(t,c,i,o)}return t})}function Ni(e,t){return function(n,r){if(null==n)return n;if(!Ko(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=_e(n);(t?a--:++a<i)&&!1!==r(o[a],a,o););return n}}function Oi(e){return function(t,n,r){for(var i=-1,a=_e(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}function Bi(e){return function(t){var r=rn(t=Cs(t))?un(t):n,i=r?r[0]:t.charAt(0),a=r?Ci(r,1).join(""):t.slice(1);return i[e]()+a}}function Mi(e){return function(t){return Bt(zs(js(t).replace(Qe,"")),e,"")}}function Di(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Hn(e.prototype),r=e.apply(n,t);return ts(r)?r:n}}function Fi(e){return function(t,r,i){var a=_e(t);if(!Ko(t)){var o=oa(r,3);t=Os(t),r=function(e){return o(a[e],e,a)}}var s=e(t,r,i);return s>-1?a[o?t[s]:s]:n}}function ki(e){return ea(function(t){var i=t.length,a=i,o=Un.prototype.thru;for(e&&t.reverse();a--;){var s=t[a];if("function"!=typeof s)throw new Pe(r);if(o&&!c&&"wrapper"==ia(s))var c=new Un([],!0)}for(a=c?a:i;++a<i;){var l=ia(s=t[a]),u="wrapper"==l?ra(s):n;c=u&&Ca(u[0])&&424==u[1]&&!u[4].length&&1==u[9]?c[ia(u[0])].apply(c,u[3]):1==s.length&&Ca(s)?c[l]():c.thru(s)}return function(){var e=arguments,n=e[0];if(c&&1==e.length&&Wo(n))return c.plant(n).value();for(var r=0,a=i?t[r].apply(this,e):n;++r<i;)a=t[r].call(this,a);return a}})}function Gi(e,t,r,i,a,o,c,l,u,d){var p=t&s,h=1&t,f=2&t,m=24&t,g=512&t,y=f?n:Di(e);return function s(){for(var I=arguments.length,C=Ae(I),A=I;A--;)C[A]=arguments[A];if(m)var S=aa(s),b=function(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}(C,S);if(i&&(C=_i(C,i,a,m)),o&&(C=wi(C,o,c,m)),I-=b,m&&I<d){var T=sn(C,S);return Wi(e,t,Gi,s.placeholder,r,C,T,l,u,d-I)}var v=h?r:this,_=f?v[e]:e;return I=C.length,l?C=function(e,t){for(var r=e.length,i=yn(t.length,r),a=Ei(e);i--;){var o=t[i];e[i]=ga(o,r)?a[o]:n}return e}(C,l):g&&I>1&&C.reverse(),p&&u<I&&(C.length=u),this&&this!==dt&&this instanceof s&&(_=y||Di(_)),_.apply(v,C)}}function Hi(e,t){return function(n,r){return function(e,t,n,r){return Ir(e,function(e,i,a){t(r,n(e),i,a)}),r}(n,e,t(r),{})}}function xi(e,t){return function(r,i){var a;if(r===n&&i===n)return t;if(r!==n&&(a=r),i!==n){if(a===n)return i;"string"==typeof r||"string"==typeof i?(r=si(r),i=si(i)):(r=oi(r),i=oi(i)),a=e(r,i)}return a}}function Ui(e){return ea(function(t){return t=Nt(t,qt(oa())),Yr(function(n){var r=this;return e(t,function(e){return Tt(e,r,n)})})})}function Vi(e,t){var r=(t=t===n?" ":si(t)).length;if(r<2)return r?Kr(t,e):t;var i=Kr(t,ht(e/ln(t)));return rn(t)?Ci(un(i),0,e).join(""):i.slice(0,e)}function $i(e){return function(t,r,i){return i&&"number"!=typeof i&&ya(t,r,i)&&(r=i=n),t=fs(t),r===n?(r=t,t=0):r=fs(r),function(e,t,n,r){for(var i=-1,a=gn(ht((t-e)/(n||1)),0),o=Ae(a);a--;)o[r?a:++i]=e,e+=n;return o}(t,r,i=i===n?t<r?1:-1:fs(i),e)}}function ji(e){return function(t,n){return"string"==typeof t&&"string"==typeof n||(t=ys(t),n=ys(n)),e(t,n)}}function Wi(e,t,r,i,a,s,c,l,u,d){var p=8&t;t|=p?o:64,4&(t&=~(p?64:o))||(t&=-4);var h=[e,t,a,p?s:n,p?c:n,p?n:s,p?n:c,l,u,d],f=r.apply(n,h);return Ca(e)&&Ea(f,h),f.placeholder=i,La(f,e,t)}function Xi(e){var t=ve[e];return function(e,n){if(e=ys(e),(n=null==n?0:yn(ms(n),292))&&jt(e)){var r=(Cs(e)+"e").split("e");return+((r=(Cs(t(r[0]+"e"+(+r[1]+n)))+"e").split("e"))[0]+"e"+(+r[1]-n))}return t(e)}}var Ki=_n&&1/cn(new _n([,-0]))[1]==l?function(e){return new _n(e)}:lc;function Yi(e){return function(t){var n=pa(t);return n==S?an(t):n==w?function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=[e,e]}),n}(t):function(e,t){return Nt(t,function(t){return[t,e[t]]})}(t,e(t))}}function qi(e,t,i,l,u,d,p,h){var f=2&t;if(!f&&"function"!=typeof e)throw new Pe(r);var m=l?l.length:0;if(m||(t&=-97,l=u=n),p=p===n?p:gn(ms(p),0),h=h===n?h:ms(h),m-=u?u.length:0,64&t){var g=l,y=u;l=u=n}var I=f?n:ra(e),C=[e,t,i,l,u,g,y,d,p,h];if(I&&function(e,t){var n=e[1],r=t[1],i=n|r,o=i<131,l=r==s&&8==n||r==s&&n==c&&e[7].length<=t[8]||384==r&&t[7].length<=t[8]&&8==n;if(!o&&!l)return e;1&r&&(e[2]=t[2],i|=1&n?0:4);var u=t[3];if(u){var d=e[3];e[3]=d?_i(d,u,t[4]):u,e[4]=d?sn(e[3],a):t[4]}(u=t[5])&&(d=e[5],e[5]=d?wi(d,u,t[6]):u,e[6]=d?sn(e[5],a):t[6]),(u=t[7])&&(e[7]=u),r&s&&(e[8]=null==e[8]?t[8]:yn(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=i}(C,I),e=C[0],t=C[1],i=C[2],l=C[3],u=C[4],!(h=C[9]=C[9]===n?f?0:e.length:gn(C[9]-m,0))&&24&t&&(t&=-25),t&&1!=t)A=8==t||16==t?function(e,t,r){var i=Di(e);return function a(){for(var o=arguments.length,s=Ae(o),c=o,l=aa(a);c--;)s[c]=arguments[c];var u=o<3&&s[0]!==l&&s[o-1]!==l?[]:sn(s,l);return(o-=u.length)<r?Wi(e,t,Gi,a.placeholder,n,s,u,n,n,r-o):Tt(this&&this!==dt&&this instanceof a?i:e,this,s)}}(e,t,h):t!=o&&33!=t||u.length?Gi.apply(n,C):function(e,t,n,r){var i=1&t,a=Di(e);return function t(){for(var o=-1,s=arguments.length,c=-1,l=r.length,u=Ae(l+s),d=this&&this!==dt&&this instanceof t?a:e;++c<l;)u[c]=r[c];for(;s--;)u[c++]=arguments[++o];return Tt(d,i?n:this,u)}}(e,t,i,l);else var A=function(e,t,n){var r=1&t,i=Di(e);return function t(){return(this&&this!==dt&&this instanceof t?i:e).apply(r?n:this,arguments)}}(e,t,i);return La((I?zr:Ea)(A,C),e,t)}function Qi(e,t,r,i){return e===n||Uo(e,Ne[r])&&!Me.call(i,r)?t:e}function Ji(e,t,r,i,a,o){return ts(e)&&ts(t)&&(o.set(t,e),xr(e,t,n,Ji,o),o.delete(t)),e}function zi(e){return as(e)?n:e}function Zi(e,t,r,i,a,o){var s=1&r,c=e.length,l=t.length;if(c!=l&&!(s&&l>c))return!1;var u=o.get(e),d=o.get(t);if(u&&d)return u==t&&d==e;var p=-1,h=!0,f=2&r?new Xn:n;for(o.set(e,t),o.set(t,e);++p<c;){var m=e[p],g=t[p];if(i)var y=s?i(g,m,p,t,e,o):i(m,g,p,e,t,o);if(y!==n){if(y)continue;h=!1;break}if(f){if(!Dt(t,function(e,t){if(!Jt(f,t)&&(m===e||a(m,e,r,i,o)))return f.push(t)})){h=!1;break}}else if(m!==g&&!a(m,g,r,i,o)){h=!1;break}}return o.delete(e),o.delete(t),h}function ea(e){return Ra(va(e,n,Wa),e+"")}function ta(e){return br(e,Os,ua)}function na(e){return br(e,Bs,da)}var ra=Pn?function(e){return Pn.get(e)}:lc;function ia(e){for(var t=e.name+"",n=Rn[t],r=Me.call(Rn,t)?n.length:0;r--;){var i=n[r],a=i.func;if(null==a||a==e)return i.name}return t}function aa(e){return(Me.call(Gn,"placeholder")?Gn:e).placeholder}function oa(){var e=Gn.iteratee||ac;return e=e===ac?Br:e,arguments.length?e(arguments[0],arguments[1]):e}function sa(e,t){var n,r,i=e.__data__;return("string"==(r=typeof(n=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==n:null===n)?i["string"==typeof t?"string":"hash"]:i.map}function ca(e){for(var t=Os(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,ba(i)]}return t}function la(e,t){var r=function(e,t){return null==e?n:e[t]}(e,t);return Or(r)?r:n}var ua=gt?function(e){return null==e?[]:(e=_e(e),Pt(gt(e),function(t){return Ke.call(e,t)}))}:gc,da=gt?function(e){for(var t=[];e;)Ot(t,ua(e)),e=We(e);return t}:gc,pa=Tr;function ha(e,t,n){for(var r=-1,i=(t=yi(t,e)).length,a=!1;++r<i;){var o=ka(t[r]);if(!(a=null!=e&&n(e,o)))break;e=e[o]}return a||++r!=i?a:!!(i=null==e?0:e.length)&&es(i)&&ga(o,i)&&(Wo(e)||jo(e))}function fa(e){return"function"!=typeof e.constructor||Sa(e)?{}:Hn(We(e))}function ma(e){return Wo(e)||jo(e)||!!(qe&&e&&e[qe])}function ga(e,t){var n=typeof e;return!!(t=null==t?u:t)&&("number"==n||"symbol"!=n&&ge.test(e))&&e>-1&&e%1==0&&e<t}function ya(e,t,n){if(!ts(n))return!1;var r=typeof t;return!!("number"==r?Ko(n)&&ga(t,n.length):"string"==r&&t in n)&&Uo(n[t],e)}function Ia(e,t){if(Wo(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!ls(e))||z.test(e)||!J.test(e)||null!=t&&e in _e(t)}function Ca(e){var t=ia(e),n=Gn[t];if("function"!=typeof n||!(t in Vn.prototype))return!1;if(e===n)return!0;var r=ra(n);return!!r&&e===r[0]}(bn&&pa(new bn(new ArrayBuffer(1)))!=N||Tn&&pa(new Tn)!=S||vn&&pa(vn.resolve())!=v||_n&&pa(new _n)!=w||wn&&pa(new wn)!=R)&&(pa=function(e){var t=Tr(e),r=t==T?e.constructor:n,i=r?Ga(r):"";if(i)switch(i){case Ln:return N;case Nn:return S;case On:return v;case Bn:return w;case Mn:return R}return t});var Aa=Oe?zo:yc;function Sa(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Ne)}function ba(e){return e==e&&!ts(e)}function Ta(e,t){return function(r){return null!=r&&r[e]===t&&(t!==n||e in _e(r))}}function va(e,t,r){return t=gn(t===n?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=gn(n.length-t,0),o=Ae(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Ae(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),Tt(e,this,s)}}function _a(e,t){return t.length<2?e:Sr(e,ti(t,0,-1))}function wa(e,t){if(("constructor"!==t||"function"!=typeof e[t])&&"__proto__"!=t)return e[t]}var Ea=Na(zr),Pa=pt||function(e,t){return dt.setTimeout(e,t)},Ra=Na(Zr);function La(e,t,n){var r=t+"";return Ra(e,function(e,t){var n=t.length;if(!n)return e;var r=n-1;return t[r]=(n>1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return _t(h,function(n){var r="_."+n[0];t&n[1]&&!Rt(e,r)&&e.push(r)}),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(oe):[]}(r),n)))}function Na(e){var t=0,r=0;return function(){var i=In(),a=16-(i-r);if(r=i,a>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(n,arguments)}}function Oa(e,t){var r=-1,i=e.length,a=i-1;for(t=t===n?i:t;++r<t;){var o=Xr(r,a),s=e[o];e[o]=e[r],e[r]=s}return e.length=t,e}var Ba,Ma,Da,Fa=(Ba=function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(Z,function(e,n,r,i){t.push(r?i.replace(le,"$1"):n||e)}),t},Ma=Do(Ba,function(e){return 500===Da.size&&Da.clear(),e}),Da=Ma.cache,Ma);function ka(e){if("string"==typeof e||ls(e))return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}function Ga(e){if(null!=e){try{return Be.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ha(e){if(e instanceof Vn)return e.clone();var t=new Un(e.__wrapped__,e.__chain__);return t.__actions__=Ei(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}var xa=Yr(function(e,t){return Yo(e)?lr(e,mr(t,1,Yo,!0)):[]}),Ua=Yr(function(e,t){var r=Qa(t);return Yo(r)&&(r=n),Yo(e)?lr(e,mr(t,1,Yo,!0),oa(r,2)):[]}),Va=Yr(function(e,t){var r=Qa(t);return Yo(r)&&(r=n),Yo(e)?lr(e,mr(t,1,Yo,!0),n,r):[]});function $a(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ms(n);return i<0&&(i=gn(r+i,0)),Gt(e,oa(t,3),i)}function ja(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var a=i-1;return r!==n&&(a=ms(r),a=r<0?gn(i+a,0):yn(a,i-1)),Gt(e,oa(t,3),a,!0)}function Wa(e){return null!=e&&e.length?mr(e,1):[]}function Xa(e){return e&&e.length?e[0]:n}var Ka=Yr(function(e){var t=Nt(e,mi);return t.length&&t[0]===e[0]?Er(t):[]}),Ya=Yr(function(e){var t=Qa(e),r=Nt(e,mi);return t===Qa(r)?t=n:r.pop(),r.length&&r[0]===e[0]?Er(r,oa(t,2)):[]}),qa=Yr(function(e){var t=Qa(e),r=Nt(e,mi);return(t="function"==typeof t?t:n)&&r.pop(),r.length&&r[0]===e[0]?Er(r,n,t):[]});function Qa(e){var t=null==e?0:e.length;return t?e[t-1]:n}var Ja=Yr(za);function za(e,t){return e&&e.length&&t&&t.length?jr(e,t):e}var Za=ea(function(e,t){var n=null==e?0:e.length,r=ir(e,t);return Wr(e,Nt(t,function(e){return ga(e,n)?+e:e}).sort(vi)),r});function eo(e){return null==e?e:Sn.call(e)}var to=Yr(function(e){return ci(mr(e,1,Yo,!0))}),no=Yr(function(e){var t=Qa(e);return Yo(t)&&(t=n),ci(mr(e,1,Yo,!0),oa(t,2))}),ro=Yr(function(e){var t=Qa(e);return t="function"==typeof t?t:n,ci(mr(e,1,Yo,!0),n,t)});function io(e){if(!e||!e.length)return[];var t=0;return e=Pt(e,function(e){if(Yo(e))return t=gn(e.length,t),!0}),Kt(t,function(t){return Nt(e,$t(t))})}function ao(e,t){if(!e||!e.length)return[];var r=io(e);return null==t?r:Nt(r,function(e){return Tt(t,n,e)})}var oo=Yr(function(e,t){return Yo(e)?lr(e,t):[]}),so=Yr(function(e){return hi(Pt(e,Yo))}),co=Yr(function(e){var t=Qa(e);return Yo(t)&&(t=n),hi(Pt(e,Yo),oa(t,2))}),lo=Yr(function(e){var t=Qa(e);return t="function"==typeof t?t:n,hi(Pt(e,Yo),n,t)}),uo=Yr(io),po=Yr(function(e){var t=e.length,r=t>1?e[t-1]:n;return r="function"==typeof r?(e.pop(),r):n,ao(e,r)});function ho(e){var t=Gn(e);return t.__chain__=!0,t}function fo(e,t){return t(e)}var mo=ea(function(e){var t=e.length,r=t?e[0]:0,i=this.__wrapped__,a=function(t){return ir(t,e)};return!(t>1||this.__actions__.length)&&i instanceof Vn&&ga(r)?((i=i.slice(r,+r+(t?1:0))).__actions__.push({func:fo,args:[a],thisArg:n}),new Un(i,this.__chain__).thru(function(e){return t&&!e.length&&e.push(n),e})):this.thru(a)}),go=Ri(function(e,t,n){Me.call(e,n)?++e[n]:rr(e,n,1)}),yo=Fi($a),Io=Fi(ja);function Co(e,t){return(Wo(e)?_t:ur)(e,oa(t,3))}function Ao(e,t){return(Wo(e)?wt:dr)(e,oa(t,3))}var So=Ri(function(e,t,n){Me.call(e,n)?e[n].push(t):rr(e,n,[t])}),bo=Yr(function(e,t,n){var r=-1,i="function"==typeof t,a=Ko(e)?Ae(e.length):[];return ur(e,function(e){a[++r]=i?Tt(t,e,n):Pr(e,t,n)}),a}),To=Ri(function(e,t,n){rr(e,n,t)});function vo(e,t){return(Wo(e)?Nt:kr)(e,oa(t,3))}var _o=Ri(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]}),wo=Yr(function(e,t){if(null==e)return[];var n=t.length;return n>1&&ya(e,t[0],t[1])?t=[]:n>2&&ya(t[0],t[1],t[2])&&(t=[t[0]]),Vr(e,mr(t,1),[])}),Eo=ut||function(){return dt.Date.now()};function Po(e,t,r){return t=r?n:t,t=e&&null==t?e.length:t,qi(e,s,n,n,n,n,t)}function Ro(e,t){var i;if("function"!=typeof t)throw new Pe(r);return e=ms(e),function(){return--e>0&&(i=t.apply(this,arguments)),e<=1&&(t=n),i}}var Lo=Yr(function(e,t,n){var r=1;if(n.length){var i=sn(n,aa(Lo));r|=o}return qi(e,r,t,n,i)}),No=Yr(function(e,t,n){var r=3;if(n.length){var i=sn(n,aa(No));r|=o}return qi(t,r,e,n,i)});function Oo(e,t,i){var a,o,s,c,l,u,d=0,p=!1,h=!1,f=!0;if("function"!=typeof e)throw new Pe(r);function m(t){var r=a,i=o;return a=o=n,d=t,c=e.apply(i,r)}function g(e){var r=e-u;return u===n||r>=t||r<0||h&&e-d>=s}function y(){var e=Eo();if(g(e))return I(e);l=Pa(y,function(e){var n=t-(e-u);return h?yn(n,s-(e-d)):n}(e))}function I(e){return l=n,f&&a?m(e):(a=o=n,c)}function C(){var e=Eo(),r=g(e);if(a=arguments,o=this,u=e,r){if(l===n)return function(e){return d=e,l=Pa(y,t),p?m(e):c}(u);if(h)return Ai(l),l=Pa(y,t),m(u)}return l===n&&(l=Pa(y,t)),c}return t=ys(t)||0,ts(i)&&(p=!!i.leading,s=(h="maxWait"in i)?gn(ys(i.maxWait)||0,t):s,f="trailing"in i?!!i.trailing:f),C.cancel=function(){l!==n&&Ai(l),d=0,a=u=o=l=n},C.flush=function(){return l===n?c:I(Eo())},C}var Bo=Yr(function(e,t){return cr(e,1,t)}),Mo=Yr(function(e,t,n){return cr(e,ys(t)||0,n)});function Do(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new Pe(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o)||a,o};return n.cache=new(Do.Cache||Wn),n}function Fo(e){if("function"!=typeof e)throw new Pe(r);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}Do.Cache=Wn;var ko=Ii(function(e,t){var n=(t=1==t.length&&Wo(t[0])?Nt(t[0],qt(oa())):Nt(mr(t,1),qt(oa()))).length;return Yr(function(r){for(var i=-1,a=yn(r.length,n);++i<a;)r[i]=t[i].call(this,r[i]);return Tt(e,this,r)})}),Go=Yr(function(e,t){var r=sn(t,aa(Go));return qi(e,o,n,t,r)}),Ho=Yr(function(e,t){var r=sn(t,aa(Ho));return qi(e,64,n,t,r)}),xo=ea(function(e,t){return qi(e,c,n,n,n,t)});function Uo(e,t){return e===t||e!=e&&t!=t}var Vo=ji(vr),$o=ji(function(e,t){return e>=t}),jo=Rr(/* @__PURE__ */function(){return arguments}())?Rr:function(e){return ns(e)&&Me.call(e,"callee")&&!Ke.call(e,"callee")},Wo=Ae.isArray,Xo=yt?qt(yt):function(e){return ns(e)&&Tr(e)==L};function Ko(e){return null!=e&&es(e.length)&&!zo(e)}function Yo(e){return ns(e)&&Ko(e)}var qo=Ft||yc,Qo=It?qt(It):function(e){return ns(e)&&Tr(e)==y};function Jo(e){if(!ns(e))return!1;var t=Tr(e);return t==I||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!as(e)}function zo(e){if(!ts(e))return!1;var t=Tr(e);return t==C||t==A||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Zo(e){return"number"==typeof e&&e==ms(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=u}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=Ct?qt(Ct):function(e){return ns(e)&&pa(e)==S};function is(e){return"number"==typeof e||ns(e)&&Tr(e)==b}function as(e){if(!ns(e)||Tr(e)!=T)return!1;var t=We(e);if(null===t)return!0;var n=Me.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Be.call(n)==Ge}var os=At?qt(At):function(e){return ns(e)&&Tr(e)==_},ss=St?qt(St):function(e){return ns(e)&&pa(e)==w};function cs(e){return"string"==typeof e||!Wo(e)&&ns(e)&&Tr(e)==E}function ls(e){return"symbol"==typeof e||ns(e)&&Tr(e)==P}var us=bt?qt(bt):function(e){return ns(e)&&es(e.length)&&!!it[Tr(e)]},ds=ji(Fr),ps=ji(function(e,t){return e<=t});function hs(e){if(!e)return[];if(Ko(e))return cs(e)?un(e):Ei(e);if(ze&&e[ze])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[ze]());var t=pa(e);return(t==S?an:t==w?cn:Us)(e)}function fs(e){return e?(e=ys(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function ms(e){var t=fs(e),n=t%1;return t==t?n?t-n:t:0}function gs(e){return e?ar(ms(e),0,p):0}function ys(e){if("number"==typeof e)return e;if(ls(e))return d;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Yt(e);var n=he.test(e);return n||me.test(e)?ct(e.slice(2),n?2:8):pe.test(e)?d:+e}function Is(e){return Pi(e,Bs(e))}function Cs(e){return null==e?"":si(e)}var As=Li(function(e,t){if(Sa(t)||Ko(t))Pi(t,Os(t),e);else for(var n in t)Me.call(t,n)&&Zn(e,n,t[n])}),Ss=Li(function(e,t){Pi(t,Bs(t),e)}),bs=Li(function(e,t,n,r){Pi(t,Bs(t),e,r)}),Ts=Li(function(e,t,n,r){Pi(t,Os(t),e,r)}),vs=ea(ir),_s=Yr(function(e,t){e=_e(e);var r=-1,i=t.length,a=i>2?t[2]:n;for(a&&ya(t[0],t[1],a)&&(i=1);++r<i;)for(var o=t[r],s=Bs(o),c=-1,l=s.length;++c<l;){var u=s[c],d=e[u];(d===n||Uo(d,Ne[u])&&!Me.call(e,u))&&(e[u]=o[u])}return e}),ws=Yr(function(e){return e.push(n,Ji),Tt(Ds,n,e)});function Es(e,t,r){var i=null==e?n:Sr(e,t);return i===n?r:i}function Ps(e,t){return null!=e&&ha(e,t,wr)}var Rs=Hi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=ke.call(t)),e[t]=n},tc(ic)),Ls=Hi(function(e,t,n){null!=t&&"function"!=typeof t.toString&&(t=ke.call(t)),Me.call(e,t)?e[t].push(n):e[t]=[n]},oa),Ns=Yr(Pr);function Os(e){return Ko(e)?Yn(e):Mr(e)}function Bs(e){return Ko(e)?Yn(e,!0):Dr(e)}var Ms=Li(function(e,t,n){xr(e,t,n)}),Ds=Li(function(e,t,n,r){xr(e,t,n,r)}),Fs=ea(function(e,t){var n={};if(null==e)return n;var r=!1;t=Nt(t,function(t){return t=yi(t,e),r||(r=t.length>1),t}),Pi(e,na(e),n),r&&(n=or(n,7,zi));for(var i=t.length;i--;)li(n,t[i]);return n}),ks=ea(function(e,t){return null==e?{}:function(e,t){return $r(e,t,function(t,n){return Ps(e,n)})}(e,t)});function Gs(e,t){if(null==e)return{};var n=Nt(na(e),function(e){return[e]});return t=oa(t),$r(e,n,function(e,n){return t(e,n[0])})}var Hs=Yi(Os),xs=Yi(Bs);function Us(e){return null==e?[]:Qt(e,Os(e))}var Vs=Mi(function(e,t,n){return t=t.toLowerCase(),e+(n?$s(t):t)});function $s(e){return Js(Cs(e).toLowerCase())}function js(e){return(e=Cs(e))&&e.replace(ye,en).replace(Je,"")}var Ws=Mi(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),Xs=Mi(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),Ks=Bi("toLowerCase"),Ys=Mi(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()}),qs=Mi(function(e,t,n){return e+(n?" ":"")+Js(t)}),Qs=Mi(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),Js=Bi("toUpperCase");function zs(e,t,r){return e=Cs(e),(t=r?n:t)===n?function(e){return tt.test(e)}(e)?function(e){return e.match(Ze)||[]}(e):function(e){return e.match(se)||[]}(e):e.match(t)||[]}var Zs=Yr(function(e,t){try{return Tt(e,n,t)}catch(r){return Jo(r)?r:new be(r)}}),ec=ea(function(e,t){return _t(t,function(t){t=ka(t),rr(e,t,Lo(e[t],e))}),e});function tc(e){return function(){return e}}var nc=ki(),rc=ki(!0);function ic(e){return e}function ac(e){return Br("function"==typeof e?e:or(e,1))}var oc=Yr(function(e,t){return function(n){return Pr(n,e,t)}}),sc=Yr(function(e,t){return function(n){return Pr(e,n,t)}});function cc(e,t,n){var r=Os(t),i=Ar(t,r);null!=n||ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=Ar(t,Os(t)));var a=!(ts(n)&&"chain"in n&&!n.chain),o=zo(e);return _t(i,function(n){var r=t[n];e[n]=r,o&&(e.prototype[n]=function(){var t=this.__chain__;if(a||t){var n=e(this.__wrapped__);return(n.__actions__=Ei(this.__actions__)).push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,Ot([this.value()],arguments))})}),e}function lc(){}var uc=Ui(Nt),dc=Ui(Et),pc=Ui(Dt);function hc(e){return Ia(e)?$t(ka(e)):function(e){return function(t){return Sr(t,e)}}(e)}var fc=$i(),mc=$i(!0);function gc(){return[]}function yc(){return!1}var Ic,Cc=xi(function(e,t){return e+t},0),Ac=Xi("ceil"),Sc=xi(function(e,t){return e/t},1),bc=Xi("floor"),Tc=xi(function(e,t){return e*t},1),vc=Xi("round"),_c=xi(function(e,t){return e-t},0);return Gn.after=function(e,t){if("function"!=typeof t)throw new Pe(r);return e=ms(e),function(){if(--e<1)return t.apply(this,arguments)}},Gn.ary=Po,Gn.assign=As,Gn.assignIn=Ss,Gn.assignInWith=bs,Gn.assignWith=Ts,Gn.at=vs,Gn.before=Ro,Gn.bind=Lo,Gn.bindAll=ec,Gn.bindKey=No,Gn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Wo(e)?e:[e]},Gn.chain=ho,Gn.chunk=function(e,t,r){t=(r?ya(e,t,r):t===n)?1:gn(ms(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,o=0,s=Ae(ht(i/t));a<i;)s[o++]=ti(e,a,a+=t);return s},Gn.compact=function(e){for(var t=-1,n=null==e?0:e.length,r=0,i=[];++t<n;){var a=e[t];a&&(i[r++]=a)}return i},Gn.concat=function(){var e=arguments.length;if(!e)return[];for(var t=Ae(e-1),n=arguments[0],r=e;r--;)t[r-1]=arguments[r];return Ot(Wo(n)?Ei(n):[n],mr(t,1))},Gn.cond=function(e){var t=null==e?0:e.length,n=oa();return e=t?Nt(e,function(e){if("function"!=typeof e[1])throw new Pe(r);return[n(e[0]),e[1]]}):[],Yr(function(n){for(var r=-1;++r<t;){var i=e[r];if(Tt(i[0],this,n))return Tt(i[1],this,n)}})},Gn.conforms=function(e){return function(e){var t=Os(e);return function(n){return sr(n,e,t)}}(or(e,1))},Gn.constant=tc,Gn.countBy=go,Gn.create=function(e,t){var n=Hn(e);return null==t?n:nr(n,t)},Gn.curry=function e(t,r,i){var a=qi(t,8,n,n,n,n,n,r=i?n:r);return a.placeholder=e.placeholder,a},Gn.curryRight=function e(t,r,i){var a=qi(t,16,n,n,n,n,n,r=i?n:r);return a.placeholder=e.placeholder,a},Gn.debounce=Oo,Gn.defaults=_s,Gn.defaultsDeep=ws,Gn.defer=Bo,Gn.delay=Mo,Gn.difference=xa,Gn.differenceBy=Ua,Gn.differenceWith=Va,Gn.drop=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=r||t===n?1:ms(t))<0?0:t,i):[]},Gn.dropRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,0,(t=i-(t=r||t===n?1:ms(t)))<0?0:t):[]},Gn.dropRightWhile=function(e,t){return e&&e.length?di(e,oa(t,3),!0,!0):[]},Gn.dropWhile=function(e,t){return e&&e.length?di(e,oa(t,3),!0):[]},Gn.fill=function(e,t,r,i){var a=null==e?0:e.length;return a?(r&&"number"!=typeof r&&ya(e,t,r)&&(r=0,i=a),function(e,t,r,i){var a=e.length;for((r=ms(r))<0&&(r=-r>a?0:a+r),(i=i===n||i>a?a:ms(i))<0&&(i+=a),i=r>i?0:gs(i);r<i;)e[r++]=t;return e}(e,t,r,i)):[]},Gn.filter=function(e,t){return(Wo(e)?Pt:fr)(e,oa(t,3))},Gn.flatMap=function(e,t){return mr(vo(e,t),1)},Gn.flatMapDeep=function(e,t){return mr(vo(e,t),l)},Gn.flatMapDepth=function(e,t,r){return r=r===n?1:ms(r),mr(vo(e,t),r)},Gn.flatten=Wa,Gn.flattenDeep=function(e){return null!=e&&e.length?mr(e,l):[]},Gn.flattenDepth=function(e,t){return null!=e&&e.length?mr(e,t=t===n?1:ms(t)):[]},Gn.flip=function(e){return qi(e,512)},Gn.flow=nc,Gn.flowRight=rc,Gn.fromPairs=function(e){for(var t=-1,n=null==e?0:e.length,r={};++t<n;){var i=e[t];rr(r,i[0],i[1])}return r},Gn.functions=function(e){return null==e?[]:Ar(e,Os(e))},Gn.functionsIn=function(e){return null==e?[]:Ar(e,Bs(e))},Gn.groupBy=So,Gn.initial=function(e){return null!=e&&e.length?ti(e,0,-1):[]},Gn.intersection=Ka,Gn.intersectionBy=Ya,Gn.intersectionWith=qa,Gn.invert=Rs,Gn.invertBy=Ls,Gn.invokeMap=bo,Gn.iteratee=ac,Gn.keyBy=To,Gn.keys=Os,Gn.keysIn=Bs,Gn.map=vo,Gn.mapKeys=function(e,t){var n={};return t=oa(t,3),Ir(e,function(e,r,i){rr(n,t(e,r,i),e)}),n},Gn.mapValues=function(e,t){var n={};return t=oa(t,3),Ir(e,function(e,r,i){rr(n,r,t(e,r,i))}),n},Gn.matches=function(e){return Gr(or(e,1))},Gn.matchesProperty=function(e,t){return Hr(e,or(t,1))},Gn.memoize=Do,Gn.merge=Ms,Gn.mergeWith=Ds,Gn.method=oc,Gn.methodOf=sc,Gn.mixin=cc,Gn.negate=Fo,Gn.nthArg=function(e){return e=ms(e),Yr(function(t){return Ur(t,e)})},Gn.omit=Fs,Gn.omitBy=function(e,t){return Gs(e,Fo(oa(t)))},Gn.once=function(e){return Ro(2,e)},Gn.orderBy=function(e,t,r,i){return null==e?[]:(Wo(t)||(t=null==t?[]:[t]),Wo(r=i?n:r)||(r=null==r?[]:[r]),Vr(e,t,r))},Gn.over=uc,Gn.overArgs=ko,Gn.overEvery=dc,Gn.overSome=pc,Gn.partial=Go,Gn.partialRight=Ho,Gn.partition=_o,Gn.pick=ks,Gn.pickBy=Gs,Gn.property=hc,Gn.propertyOf=function(e){return function(t){return null==e?n:Sr(e,t)}},Gn.pull=Ja,Gn.pullAll=za,Gn.pullAllBy=function(e,t,n){return e&&e.length&&t&&t.length?jr(e,t,oa(n,2)):e},Gn.pullAllWith=function(e,t,r){return e&&e.length&&t&&t.length?jr(e,t,n,r):e},Gn.pullAt=Za,Gn.range=fc,Gn.rangeRight=mc,Gn.rearg=xo,Gn.reject=function(e,t){return(Wo(e)?Pt:fr)(e,Fo(oa(t,3)))},Gn.remove=function(e,t){var n=[];if(!e||!e.length)return n;var r=-1,i=[],a=e.length;for(t=oa(t,3);++r<a;){var o=e[r];t(o,r,e)&&(n.push(o),i.push(r))}return Wr(e,i),n},Gn.rest=function(e,t){if("function"!=typeof e)throw new Pe(r);return Yr(e,t=t===n?t:ms(t))},Gn.reverse=eo,Gn.sampleSize=function(e,t,r){return t=(r?ya(e,t,r):t===n)?1:ms(t),(Wo(e)?Qn:Qr)(e,t)},Gn.set=function(e,t,n){return null==e?e:Jr(e,t,n)},Gn.setWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:Jr(e,t,r,i)},Gn.shuffle=function(e){return(Wo(e)?Jn:ei)(e)},Gn.slice=function(e,t,r){var i=null==e?0:e.length;return i?(r&&"number"!=typeof r&&ya(e,t,r)?(t=0,r=i):(t=null==t?0:ms(t),r=r===n?i:ms(r)),ti(e,t,r)):[]},Gn.sortBy=wo,Gn.sortedUniq=function(e){return e&&e.length?ai(e):[]},Gn.sortedUniqBy=function(e,t){return e&&e.length?ai(e,oa(t,2)):[]},Gn.split=function(e,t,r){return r&&"number"!=typeof r&&ya(e,t,r)&&(t=r=n),(r=r===n?p:r>>>0)?(e=Cs(e))&&("string"==typeof t||null!=t&&!os(t))&&!(t=si(t))&&rn(e)?Ci(un(e),0,r):e.split(t,r):[]},Gn.spread=function(e,t){if("function"!=typeof e)throw new Pe(r);return t=null==t?0:gn(ms(t),0),Yr(function(n){var r=n[t],i=Ci(n,0,t);return r&&Ot(i,r),Tt(e,this,i)})},Gn.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Gn.take=function(e,t,r){return e&&e.length?ti(e,0,(t=r||t===n?1:ms(t))<0?0:t):[]},Gn.takeRight=function(e,t,r){var i=null==e?0:e.length;return i?ti(e,(t=i-(t=r||t===n?1:ms(t)))<0?0:t,i):[]},Gn.takeRightWhile=function(e,t){return e&&e.length?di(e,oa(t,3),!1,!0):[]},Gn.takeWhile=function(e,t){return e&&e.length?di(e,oa(t,3)):[]},Gn.tap=function(e,t){return t(e),e},Gn.throttle=function(e,t,n){var i=!0,a=!0;if("function"!=typeof e)throw new Pe(r);return ts(n)&&(i="leading"in n?!!n.leading:i,a="trailing"in n?!!n.trailing:a),Oo(e,t,{leading:i,maxWait:t,trailing:a})},Gn.thru=fo,Gn.toArray=hs,Gn.toPairs=Hs,Gn.toPairsIn=xs,Gn.toPath=function(e){return Wo(e)?Nt(e,ka):ls(e)?[e]:Ei(Fa(Cs(e)))},Gn.toPlainObject=Is,Gn.transform=function(e,t,n){var r=Wo(e),i=r||qo(e)||us(e);if(t=oa(t,4),null==n){var a=e&&e.constructor;n=i?r?new a:[]:ts(e)&&zo(a)?Hn(We(e)):{}}return(i?_t:Ir)(e,function(e,r,i){return t(n,e,r,i)}),n},Gn.unary=function(e){return Po(e,1)},Gn.union=to,Gn.unionBy=no,Gn.unionWith=ro,Gn.uniq=function(e){return e&&e.length?ci(e):[]},Gn.uniqBy=function(e,t){return e&&e.length?ci(e,oa(t,2)):[]},Gn.uniqWith=function(e,t){return t="function"==typeof t?t:n,e&&e.length?ci(e,n,t):[]},Gn.unset=function(e,t){return null==e||li(e,t)},Gn.unzip=io,Gn.unzipWith=ao,Gn.update=function(e,t,n){return null==e?e:ui(e,t,gi(n))},Gn.updateWith=function(e,t,r,i){return i="function"==typeof i?i:n,null==e?e:ui(e,t,gi(r),i)},Gn.values=Us,Gn.valuesIn=function(e){return null==e?[]:Qt(e,Bs(e))},Gn.without=oo,Gn.words=zs,Gn.wrap=function(e,t){return Go(gi(t),e)},Gn.xor=so,Gn.xorBy=co,Gn.xorWith=lo,Gn.zip=uo,Gn.zipObject=function(e,t){return fi(e||[],t||[],Zn)},Gn.zipObjectDeep=function(e,t){return fi(e||[],t||[],Jr)},Gn.zipWith=po,Gn.entries=Hs,Gn.entriesIn=xs,Gn.extend=Ss,Gn.extendWith=bs,cc(Gn,Gn),Gn.add=Cc,Gn.attempt=Zs,Gn.camelCase=Vs,Gn.capitalize=$s,Gn.ceil=Ac,Gn.clamp=function(e,t,r){return r===n&&(r=t,t=n),r!==n&&(r=(r=ys(r))==r?r:0),t!==n&&(t=(t=ys(t))==t?t:0),ar(ys(e),t,r)},Gn.clone=function(e){return or(e,4)},Gn.cloneDeep=function(e){return or(e,5)},Gn.cloneDeepWith=function(e,t){return or(e,5,t="function"==typeof t?t:n)},Gn.cloneWith=function(e,t){return or(e,4,t="function"==typeof t?t:n)},Gn.conformsTo=function(e,t){return null==t||sr(e,t,Os(t))},Gn.deburr=js,Gn.defaultTo=function(e,t){return null==e||e!=e?t:e},Gn.divide=Sc,Gn.endsWith=function(e,t,r){e=Cs(e),t=si(t);var i=e.length,a=r=r===n?i:ar(ms(r),0,i);return(r-=t.length)>=0&&e.slice(r,a)==t},Gn.eq=Uo,Gn.escape=function(e){return(e=Cs(e))&&K.test(e)?e.replace(W,tn):e},Gn.escapeRegExp=function(e){return(e=Cs(e))&&te.test(e)?e.replace(ee,"\\$&"):e},Gn.every=function(e,t,r){var i=Wo(e)?Et:pr;return r&&ya(e,t,r)&&(t=n),i(e,oa(t,3))},Gn.find=yo,Gn.findIndex=$a,Gn.findKey=function(e,t){return kt(e,oa(t,3),Ir)},Gn.findLast=Io,Gn.findLastIndex=ja,Gn.findLastKey=function(e,t){return kt(e,oa(t,3),Cr)},Gn.floor=bc,Gn.forEach=Co,Gn.forEachRight=Ao,Gn.forIn=function(e,t){return null==e?e:gr(e,oa(t,3),Bs)},Gn.forInRight=function(e,t){return null==e?e:yr(e,oa(t,3),Bs)},Gn.forOwn=function(e,t){return e&&Ir(e,oa(t,3))},Gn.forOwnRight=function(e,t){return e&&Cr(e,oa(t,3))},Gn.get=Es,Gn.gt=Vo,Gn.gte=$o,Gn.has=function(e,t){return null!=e&&ha(e,t,_r)},Gn.hasIn=Ps,Gn.head=Xa,Gn.identity=ic,Gn.includes=function(e,t,n,r){e=Ko(e)?e:Us(e),n=n&&!r?ms(n):0;var i=e.length;return n<0&&(n=gn(i+n,0)),cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ht(e,t,n)>-1},Gn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:ms(n);return i<0&&(i=gn(r+i,0)),Ht(e,t,i)},Gn.inRange=function(e,t,r){return t=fs(t),r===n?(r=t,t=0):r=fs(r),function(e,t,n){return e>=yn(t,n)&&e<gn(t,n)}(e=ys(e),t,r)},Gn.invoke=Ns,Gn.isArguments=jo,Gn.isArray=Wo,Gn.isArrayBuffer=Xo,Gn.isArrayLike=Ko,Gn.isArrayLikeObject=Yo,Gn.isBoolean=function(e){return!0===e||!1===e||ns(e)&&Tr(e)==g},Gn.isBuffer=qo,Gn.isDate=Qo,Gn.isElement=function(e){return ns(e)&&1===e.nodeType&&!as(e)},Gn.isEmpty=function(e){if(null==e)return!0;if(Ko(e)&&(Wo(e)||"string"==typeof e||"function"==typeof e.splice||qo(e)||us(e)||jo(e)))return!e.length;var t=pa(e);if(t==S||t==w)return!e.size;if(Sa(e))return!Mr(e).length;for(var n in e)if(Me.call(e,n))return!1;return!0},Gn.isEqual=function(e,t){return Lr(e,t)},Gn.isEqualWith=function(e,t,r){var i=(r="function"==typeof r?r:n)?r(e,t):n;return i===n?Lr(e,t,n,r):!!i},Gn.isError=Jo,Gn.isFinite=function(e){return"number"==typeof e&&jt(e)},Gn.isFunction=zo,Gn.isInteger=Zo,Gn.isLength=es,Gn.isMap=rs,Gn.isMatch=function(e,t){return e===t||Nr(e,t,ca(t))},Gn.isMatchWith=function(e,t,r){return r="function"==typeof r?r:n,Nr(e,t,ca(t),r)},Gn.isNaN=function(e){return is(e)&&e!=+e},Gn.isNative=function(e){if(Aa(e))throw new be("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return Or(e)},Gn.isNil=function(e){return null==e},Gn.isNull=function(e){return null===e},Gn.isNumber=is,Gn.isObject=ts,Gn.isObjectLike=ns,Gn.isPlainObject=as,Gn.isRegExp=os,Gn.isSafeInteger=function(e){return Zo(e)&&e>=-9007199254740991&&e<=u},Gn.isSet=ss,Gn.isString=cs,Gn.isSymbol=ls,Gn.isTypedArray=us,Gn.isUndefined=function(e){return e===n},Gn.isWeakMap=function(e){return ns(e)&&pa(e)==R},Gn.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Tr(e)},Gn.join=function(e,t){return null==e?"":fn.call(e,t)},Gn.kebabCase=Ws,Gn.last=Qa,Gn.lastIndexOf=function(e,t,r){var i=null==e?0:e.length;if(!i)return-1;var a=i;return r!==n&&(a=(a=ms(r))<0?gn(i+a,0):yn(a,i-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,a):Gt(e,Ut,a,!0)},Gn.lowerCase=Xs,Gn.lowerFirst=Ks,Gn.lt=ds,Gn.lte=ps,Gn.max=function(e){return e&&e.length?hr(e,ic,vr):n},Gn.maxBy=function(e,t){return e&&e.length?hr(e,oa(t,2),vr):n},Gn.mean=function(e){return Vt(e,ic)},Gn.meanBy=function(e,t){return Vt(e,oa(t,2))},Gn.min=function(e){return e&&e.length?hr(e,ic,Fr):n},Gn.minBy=function(e,t){return e&&e.length?hr(e,oa(t,2),Fr):n},Gn.stubArray=gc,Gn.stubFalse=yc,Gn.stubObject=function(){return{}},Gn.stubString=function(){return""},Gn.stubTrue=function(){return!0},Gn.multiply=Tc,Gn.nth=function(e,t){return e&&e.length?Ur(e,ms(t)):n},Gn.noConflict=function(){return dt._===this&&(dt._=He),this},Gn.noop=lc,Gn.now=Eo,Gn.pad=function(e,t,n){e=Cs(e);var r=(t=ms(t))?ln(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Vi(mt(i),n)+e+Vi(ht(i),n)},Gn.padEnd=function(e,t,n){e=Cs(e);var r=(t=ms(t))?ln(e):0;return t&&r<t?e+Vi(t-r,n):e},Gn.padStart=function(e,t,n){e=Cs(e);var r=(t=ms(t))?ln(e):0;return t&&r<t?Vi(t-r,n)+e:e},Gn.parseInt=function(e,t,n){return n||null==t?t=0:t&&(t=+t),Cn(Cs(e).replace(ne,""),t||0)},Gn.random=function(e,t,r){if(r&&"boolean"!=typeof r&&ya(e,t,r)&&(t=r=n),r===n&&("boolean"==typeof t?(r=t,t=n):"boolean"==typeof e&&(r=e,e=n)),e===n&&t===n?(e=0,t=1):(e=fs(e),t===n?(t=e,e=0):t=fs(t)),e>t){var i=e;e=t,t=i}if(r||e%1||t%1){var a=An();return yn(e+a*(t-e+st("1e-"+((a+"").length-1))),t)}return Xr(e,t)},Gn.reduce=function(e,t,n){var r=Wo(e)?Bt:Wt,i=arguments.length<3;return r(e,oa(t,4),n,i,ur)},Gn.reduceRight=function(e,t,n){var r=Wo(e)?Mt:Wt,i=arguments.length<3;return r(e,oa(t,4),n,i,dr)},Gn.repeat=function(e,t,r){return t=(r?ya(e,t,r):t===n)?1:ms(t),Kr(Cs(e),t)},Gn.replace=function(){var e=arguments,t=Cs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Gn.result=function(e,t,r){var i=-1,a=(t=yi(t,e)).length;for(a||(a=1,e=n);++i<a;){var o=null==e?n:e[ka(t[i])];o===n&&(i=a,o=r),e=zo(o)?o.call(e):o}return e},Gn.round=vc,Gn.runInContext=e,Gn.sample=function(e){return(Wo(e)?qn:qr)(e)},Gn.size=function(e){if(null==e)return 0;if(Ko(e))return cs(e)?ln(e):e.length;var t=pa(e);return t==S||t==w?e.size:Mr(e).length},Gn.snakeCase=Ys,Gn.some=function(e,t,r){var i=Wo(e)?Dt:ni;return r&&ya(e,t,r)&&(t=n),i(e,oa(t,3))},Gn.sortedIndex=function(e,t){return ri(e,t)},Gn.sortedIndexBy=function(e,t,n){return ii(e,t,oa(n,2))},Gn.sortedIndexOf=function(e,t){var n=null==e?0:e.length;if(n){var r=ri(e,t);if(r<n&&Uo(e[r],t))return r}return-1},Gn.sortedLastIndex=function(e,t){return ri(e,t,!0)},Gn.sortedLastIndexBy=function(e,t,n){return ii(e,t,oa(n,2),!0)},Gn.sortedLastIndexOf=function(e,t){if(null!=e&&e.length){var n=ri(e,t,!0)-1;if(Uo(e[n],t))return n}return-1},Gn.startCase=qs,Gn.startsWith=function(e,t,n){return e=Cs(e),n=null==n?0:ar(ms(n),0,e.length),t=si(t),e.slice(n,n+t.length)==t},Gn.subtract=_c,Gn.sum=function(e){return e&&e.length?Xt(e,ic):0},Gn.sumBy=function(e,t){return e&&e.length?Xt(e,oa(t,2)):0},Gn.template=function(e,t,r){var i=Gn.templateSettings;r&&ya(e,t,r)&&(t=n),e=Cs(e),t=Ts({},t,i,Qi);var a=Ts({},t.imports,i.imports,Qi),o=Os(a),s=Qt(a,o);_t(o,function(e){if(ce.test(e))throw new be("Invalid `imports` option passed into `_.template`")});var c,l,u=0,d=t.interpolate||Ie,p="__p += '",h=we((t.escape||Ie).source+"|"+d.source+"|"+(d===Q?ue:Ie).source+"|"+(t.evaluate||Ie).source+"|$","g"),f="//# sourceURL="+(Me.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++rt+"]")+"\n";e.replace(h,function(t,n,r,i,a,o){return r||(r=i),p+=e.slice(u,o).replace(Ce,nn),n&&(c=!0,p+="' +\n__e("+n+") +\n'"),a&&(l=!0,p+="';\n"+a+";\n__p += '"),r&&(p+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),u=o+t.length,t}),p+="';\n";var m=Me.call(t,"variable")&&t.variable;if(m){if(ce.test(m))throw new be("Invalid `variable` option passed into `_.template`")}else p="with (obj) {\n"+p+"\n}\n";p=(l?p.replace(U,""):p).replace(V,"$1").replace($,"$1;"),p="function("+(m||"obj")+") {\n"+(m?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(c?", __e = _.escape":"")+(l?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+p+"return __p\n}";var g=Zs(function(){return Te(o,f+"return "+p).apply(n,s)});if(g.source=p,Jo(g))throw g;return g},Gn.times=function(e,t){if((e=ms(e))<1||e>u)return[];var n=p,r=yn(e,p);t=oa(t),e-=p;for(var i=Kt(r,t);++n<e;)t(n);return i},Gn.toFinite=fs,Gn.toInteger=ms,Gn.toLength=gs,Gn.toLower=function(e){return Cs(e).toLowerCase()},Gn.toNumber=ys,Gn.toSafeInteger=function(e){return e?ar(ms(e),-9007199254740991,u):0===e?e:0},Gn.toString=Cs,Gn.toUpper=function(e){return Cs(e).toUpperCase()},Gn.trim=function(e,t,r){if((e=Cs(e))&&(r||t===n))return Yt(e);if(!e||!(t=si(t)))return e;var i=un(e),a=un(t);return Ci(i,zt(i,a),Zt(i,a)+1).join("")},Gn.trimEnd=function(e,t,r){if((e=Cs(e))&&(r||t===n))return e.slice(0,dn(e)+1);if(!e||!(t=si(t)))return e;var i=un(e);return Ci(i,0,Zt(i,un(t))+1).join("")},Gn.trimStart=function(e,t,r){if((e=Cs(e))&&(r||t===n))return e.replace(ne,"");if(!e||!(t=si(t)))return e;var i=un(e);return Ci(i,zt(i,un(t))).join("")},Gn.truncate=function(e,t){var r=30,i="...";if(ts(t)){var a="separator"in t?t.separator:a;r="length"in t?ms(t.length):r,i="omission"in t?si(t.omission):i}var o=(e=Cs(e)).length;if(rn(e)){var s=un(e);o=s.length}if(r>=o)return e;var c=r-ln(i);if(c<1)return i;var l=s?Ci(s,0,c).join(""):e.slice(0,c);if(a===n)return l+i;if(s&&(c+=l.length-c),os(a)){if(e.slice(c).search(a)){var u,d=l;for(a.global||(a=we(a.source,Cs(de.exec(a))+"g")),a.lastIndex=0;u=a.exec(d);)var p=u.index;l=l.slice(0,p===n?c:p)}}else if(e.indexOf(si(a),c)!=c){var h=l.lastIndexOf(a);h>-1&&(l=l.slice(0,h))}return l+i},Gn.unescape=function(e){return(e=Cs(e))&&X.test(e)?e.replace(j,pn):e},Gn.uniqueId=function(e){var t=++De;return Cs(e)+t},Gn.upperCase=Qs,Gn.upperFirst=Js,Gn.each=Co,Gn.eachRight=Ao,Gn.first=Xa,cc(Gn,(Ic={},Ir(Gn,function(e,t){Me.call(Gn.prototype,t)||(Ic[t]=e)}),Ic),{chain:!1}),Gn.VERSION="4.18.1",_t(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){Gn[e].placeholder=Gn}),_t(["drop","take"],function(e,t){Vn.prototype[e]=function(r){r=r===n?1:gn(ms(r),0);var i=this.__filtered__&&!t?new Vn(this):this.clone();return i.__filtered__?i.__takeCount__=yn(r,i.__takeCount__):i.__views__.push({size:yn(r,p),type:e+(i.__dir__<0?"Right":"")}),i},Vn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}}),_t(["filter","map","takeWhile"],function(e,t){var n=t+1,r=1==n||3==n;Vn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:oa(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}}),_t(["head","last"],function(e,t){var n="take"+(t?"Right":"");Vn.prototype[e]=function(){return this[n](1).value()[0]}}),_t(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");Vn.prototype[e]=function(){return this.__filtered__?new Vn(this):this[n](1)}}),Vn.prototype.compact=function(){return this.filter(ic)},Vn.prototype.find=function(e){return this.filter(e).head()},Vn.prototype.findLast=function(e){return this.reverse().find(e)},Vn.prototype.invokeMap=Yr(function(e,t){return"function"==typeof e?new Vn(this):this.map(function(n){return Pr(n,e,t)})}),Vn.prototype.reject=function(e){return this.filter(Fo(oa(e)))},Vn.prototype.slice=function(e,t){e=ms(e);var r=this;return r.__filtered__&&(e>0||t<0)?new Vn(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==n&&(r=(t=ms(t))<0?r.dropRight(-t):r.take(t-e)),r)},Vn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Vn.prototype.toArray=function(){return this.take(p)},Ir(Vn.prototype,function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),i=/^(?:head|last)$/.test(t),a=Gn[i?"take"+("last"==t?"Right":""):t],o=i||/^find/.test(t);a&&(Gn.prototype[t]=function(){var t=this.__wrapped__,s=i?[1]:arguments,c=t instanceof Vn,l=s[0],u=c||Wo(t),d=function(e){var t=a.apply(Gn,Ot([e],s));return i&&p?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var p=this.__chain__,h=!!this.__actions__.length,f=o&&!p,m=c&&!h;if(!o&&u){t=m?t:new Vn(this);var g=e.apply(t,s);return g.__actions__.push({func:fo,args:[d],thisArg:n}),new Un(g,p)}return f&&m?e.apply(this,s):(g=this.thru(d),f?i?g.value()[0]:g.value():g)})}),_t(["pop","push","shift","sort","splice","unshift"],function(e){var t=Re[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Gn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Wo(i)?i:[],e)}return this[n](function(n){return t.apply(Wo(n)?n:[],e)})}}),Ir(Vn.prototype,function(e,t){var n=Gn[t];if(n){var r=n.name+"";Me.call(Rn,r)||(Rn[r]=[]),Rn[r].push({name:t,func:n})}}),Rn[Gi(n,2).name]=[{name:"wrapper",func:n}],Vn.prototype.clone=function(){var e=new Vn(this.__wrapped__);return e.__actions__=Ei(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ei(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ei(this.__views__),e},Vn.prototype.reverse=function(){if(this.__filtered__){var e=new Vn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Vn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Wo(e),r=t<0,i=n?e.length:0,a=function(e,t,n){for(var r=-1,i=n.length;++r<i;){var a=n[r],o=a.size;switch(a.type){case"drop":e+=o;break;case"dropRight":t-=o;break;case"take":t=yn(t,e+o);break;case"takeRight":e=gn(e,t-o)}}return{start:e,end:t}}(0,i,this.__views__),o=a.start,s=a.end,c=s-o,l=r?s:o-1,u=this.__iteratees__,d=u.length,p=0,h=yn(c,this.__takeCount__);if(!n||!r&&i==c&&h==c)return pi(e,this.__actions__);var f=[];e:for(;c--&&p<h;){for(var m=-1,g=e[l+=t];++m<d;){var y=u[m],I=y.iteratee,C=y.type,A=I(g);if(2==C)g=A;else if(!A){if(1==C)continue e;break e}}f[p++]=g}return f},Gn.prototype.at=mo,Gn.prototype.chain=function(){return ho(this)},Gn.prototype.commit=function(){return new Un(this.value(),this.__chain__)},Gn.prototype.next=function(){this.__values__===n&&(this.__values__=hs(this.value()));var e=this.__index__>=this.__values__.length;return{done:e,value:e?n:this.__values__[this.__index__++]}},Gn.prototype.plant=function(e){for(var t,r=this;r instanceof xn;){var i=Ha(r);i.__index__=0,i.__values__=n,t?a.__wrapped__=i:t=i;var a=i;r=r.__wrapped__}return a.__wrapped__=e,t},Gn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Vn){var t=e;return this.__actions__.length&&(t=new Vn(this)),(t=t.reverse()).__actions__.push({func:fo,args:[eo],thisArg:n}),new Un(t,this.__chain__)}return this.thru(eo)},Gn.prototype.toJSON=Gn.prototype.valueOf=Gn.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Gn.prototype.first=Gn.prototype.head,ze&&(Gn.prototype[ze]=function(){return this}),Gn}();ht?((ht.exports=hn)._=hn,pt._=hn):dt._=hn}.call(ya)),ga.exports;var e,t}function Ca(){if(sa)return oa;sa=1;const{omitBy:e,isNil:t}=Ia(),{toDateString:n}=function(){if(aa)return ia;function e(e){return e<10?"0"+e:e}return aa=1,ia={toDateString:function(t){return null==t||"string"==typeof t?t:`${t.getUTCFullYear()}-${e(t.getUTCMonth()+1)}-${e(t.getUTCDate())}`}}}();return oa={get:function({start:r,end:i}={}){const a=e({start:n(r),end:n(i)},t);return this.sendRequest("/calendar",a)}}}var Aa,Sa,ba,Ta,va,_a,wa,Ea,Pa,Ra,La,Na,Oa,Ba,Ma,Da,Fa,ka,Ga,Ha,xa,Ua,Va,$a,ja,Wa,Xa,Ka,Ya,qa,Qa,Ja,za,Za,eo,to,no,ro,io,ao,oo,so,co,lo,uo,po,ho={},fo={};function mo(){if(Sa)return Aa;Sa=1;var e="object"==typeof Hi&&Hi&&Hi.Object===Object&&Hi;return Aa=e}function go(){if(Ta)return ba;Ta=1;var e=mo(),t="object"==typeof self&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return ba=n}function yo(){if(_a)return va;_a=1;var e=go().Symbol;return va=e}function Io(){if(Na)return La;Na=1;var e=yo(),t=function(){if(Ea)return wa;Ea=1;var e=yo(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;return wa=function(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch(c){}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}}(),n=function(){if(Ra)return Pa;Ra=1;var e=Object.prototype.toString;return Pa=function(t){return e.call(t)}}(),r=e?e.toStringTag:void 0;return La=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?t(e):n(e)}}function Co(){if(Ba)return Oa;return Ba=1,Oa=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}}function Ao(){if(Da)return Ma;Da=1;var e=Io(),t=Co();return Ma=function(n){if(!t(n))return!1;var r=e(n);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function So(){if(Ha)return Ga;Ha=1;var e,t=function(){if(ka)return Fa;ka=1;var e=go()["__core-js_shared__"];return Fa=e}(),n=(e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Ga=function(e){return!!n&&n in e}}function bo(){if(Ua)return xa;Ua=1;var e=Function.prototype.toString;return xa=function(t){if(null!=t){try{return e.call(t)}catch(n){}try{return t+""}catch(n){}}return""}}function To(){if(Ka)return Xa;Ka=1;var e=function(){if($a)return Va;$a=1;var e=Ao(),t=So(),n=Co(),r=bo(),i=/^\[object .+?Constructor\]$/,a=Function.prototype,o=Object.prototype,s=a.toString,c=o.hasOwnProperty,l=RegExp("^"+s.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Va=function(a){return!(!n(a)||t(a))&&(e(a)?l:i).test(r(a))}}(),t=Wa?ja:(Wa=1,ja=function(e,t){return null==e?void 0:e[t]});return Xa=function(n,r){var i=t(n,r);return e(i)?i:void 0}}function vo(){if(Ja)return Qa;Ja=1;var e=function(){if(qa)return Ya;qa=1;var e=To(),t=function(){try{var t=e(Object,"defineProperty");return t({},"",{}),t}catch(n){}}();return Ya=t}();return Qa=function(t,n,r){"__proto__"==n&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}}function _o(){if(to)return eo;to=1;var e=(Za?za:(Za=1,za=function(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(!1===n(a[c],c,a))break}return t}}))();return eo=e}function wo(){if(ao)return io;return ao=1,io=function(e){return null!=e&&"object"==typeof e}}function Eo(){if(lo)return co;lo=1;var e=function(){if(so)return oo;so=1;var e=Io(),t=wo();return oo=function(n){return t(n)&&"[object Arguments]"==e(n)}}(),t=wo(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable,a=e(/* @__PURE__ */function(){return arguments}())?e:function(e){return t(e)&&r.call(e,"callee")&&!i.call(e,"callee")};return co=a}function Po(){if(po)return uo;po=1;var e=Array.isArray;return uo=e}var Ro,Lo,No,Oo,Bo,Mo,Do,Fo,ko,Go,Ho,xo={exports:{}};function Uo(){return No||(No=1,e=xo,t=xo.exports,n=go(),r=Lo?Ro:(Lo=1,Ro=function(){return!1}),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i?n.Buffer:void 0,s=(o?o.isBuffer:void 0)||r,e.exports=s),xo.exports;var e,t,n,r,i,a,o,s}function Vo(){if(Bo)return Oo;Bo=1;var e=/^(?:0|[1-9]\d*)$/;return Oo=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}}function $o(){if(Do)return Mo;Do=1;return Mo=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}}var jo,Wo,Xo,Ko,Yo,qo,Qo,Jo,zo,Zo,es,ts,ns,rs,is,as,os,ss,cs,ls,us,ds,ps,hs,fs,ms,gs,ys,Is,Cs,As,Ss,bs,Ts,vs,_s,ws,Es,Ps,Rs,Ls,Ns,Os,Bs,Ms,Ds,Fs,ks,Gs,Hs,xs,Us,Vs,$s,js,Ws,Xs,Ks,Ys,qs,Qs,Js,zs,Zs,ec,tc,nc,rc,ic,ac,oc,sc,cc,lc,uc,dc,pc,hc,fc,mc,gc,yc,Ic,Cc,Ac,Sc,bc,Tc,vc,_c,wc,Ec,Pc,Rc,Lc,Nc,Oc,Bc,Mc,Dc,Fc,kc,Gc,Hc,xc,Uc,Vc,$c,jc,Wc,Xc,Kc,Yc,qc,Qc,Jc,zc,Zc,el,tl,nl,rl,il,al,ol,sl,cl,ll,ul,dl,pl,hl,fl,ml,gl,yl,Il,Cl,Al,Sl,bl,Tl,vl,_l,wl,El,Pl,Rl,Ll,Nl,Ol,Bl,Ml,Dl,Fl,kl,Gl,Hl,xl,Ul,Vl,$l,jl,Wl,Xl,Kl,Yl,ql,Ql,Jl,zl,Zl,eu,tu,nu,ru,iu,au,ou,su,cu,lu,uu,du,pu,hu={exports:{}};function fu(){if(Xo)return Wo;Xo=1;var e=function(){if(ko)return Fo;ko=1;var e=Io(),t=$o(),n=wo(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,Fo=function(i){return n(i)&&t(i.length)&&!!r[e(i)]}}(),t=Ho?Go:(Ho=1,Go=function(e){return function(t){return e(t)}}),n=function(){return jo||(jo=1,e=hu,t=hu.exports,n=mo(),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process,o=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(e){}}(),e.exports=o),hu.exports;var e,t,n,r,i,a,o}(),r=n&&n.isTypedArray,i=r?t(r):e;return Wo=i}function mu(){if(Yo)return Ko;Yo=1;var e=ro?no:(ro=1,no=function(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}),t=Eo(),n=Po(),r=Uo(),i=Vo(),a=fu(),o=Object.prototype.hasOwnProperty;return Ko=function(s,c){var l=n(s),u=!l&&t(s),d=!l&&!u&&r(s),p=!l&&!u&&!d&&a(s),h=l||u||d||p,f=h?e(s.length,String):[],m=f.length;for(var g in s)!c&&!o.call(s,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||p&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||i(g,m))||f.push(g);return f}}function gu(){if(es)return Zo;es=1;var e=(zo?Jo:(zo=1,Jo=function(e,t){return function(n){return e(t(n))}}))(Object.keys,Object);return Zo=e}function yu(){if(ns)return ts;ns=1;var e=function(){if(Qo)return qo;Qo=1;var e=Object.prototype;return qo=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}}(),t=gu(),n=Object.prototype.hasOwnProperty;return ts=function(r){if(!e(r))return t(r);var i=[];for(var a in Object(r))n.call(r,a)&&"constructor"!=a&&i.push(a);return i}}function Iu(){if(os)return as;os=1;var e=mu(),t=yu(),n=function(){if(is)return rs;is=1;var e=Ao(),t=$o();return rs=function(n){return null!=n&&t(n.length)&&!e(n)}}();return as=function(r){return n(r)?e(r):t(r)}}function Cu(){if(cs)return ss;cs=1;var e=_o(),t=Iu();return ss=function(n,r){return n&&e(n,r,t)}}function Au(){if(ps)return ds;return ps=1,ds=function(e,t){return e===t||e!=e&&t!=t}}function Su(){if(fs)return hs;fs=1;var e=Au();return hs=function(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}}function bu(){if(vs)return Ts;vs=1;var e=us?ls:(us=1,ls=function(){this.__data__=[],this.size=0}),t=function(){if(gs)return ms;gs=1;var e=Su(),t=Array.prototype.splice;return ms=function(n){var r=this.__data__,i=e(r,n);return!(i<0||(i==r.length-1?r.pop():t.call(r,i,1),--this.size,0))}}(),n=function(){if(Is)return ys;Is=1;var e=Su();return ys=function(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}}(),r=function(){if(As)return Cs;As=1;var e=Su();return Cs=function(t){return e(this.__data__,t)>-1}}(),i=function(){if(bs)return Ss;bs=1;var e=Su();return Ss=function(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ts=a}function Tu(){if(Ms)return Bs;Ms=1;var e=To()(go(),"Map");return Bs=e}function vu(){if(Fs)return Ds;Fs=1;var e=To()(Object,"create");return Ds=e}function _u(){if(Ys)return Ks;Ys=1;var e=function(){if(Gs)return ks;Gs=1;var e=vu();return ks=function(){this.__data__=e?e(null):{},this.size=0}}(),t=xs?Hs:(xs=1,Hs=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}),n=function(){if(Vs)return Us;Vs=1;var e=vu(),t=Object.prototype.hasOwnProperty;return Us=function(n){var r=this.__data__;if(e){var i=r[n];return"__lodash_hash_undefined__"===i?void 0:i}return t.call(r,n)?r[n]:void 0}}(),r=function(){if(js)return $s;js=1;var e=vu(),t=Object.prototype.hasOwnProperty;return $s=function(n){var r=this.__data__;return e?void 0!==r[n]:t.call(r,n)}}(),i=function(){if(Xs)return Ws;Xs=1;var e=vu();return Ws=function(t,n){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=e&&void 0===n?"__lodash_hash_undefined__":n,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Ks=a}function wu(){if(ec)return Zs;ec=1;var e=zs?Js:(zs=1,Js=function(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e});return Zs=function(t,n){var r=t.__data__;return e(n)?r["string"==typeof n?"string":"hash"]:r.map}}function Eu(){if(uc)return lc;uc=1;var e=function(){if(Qs)return qs;Qs=1;var e=_u(),t=bu(),n=Tu();return qs=function(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}}(),t=function(){if(nc)return tc;nc=1;var e=wu();return tc=function(t){var n=e(this,t).delete(t);return this.size-=n?1:0,n}}(),n=function(){if(ic)return rc;ic=1;var e=wu();return rc=function(t){return e(this,t).get(t)}}(),r=function(){if(oc)return ac;oc=1;var e=wu();return ac=function(t){return e(this,t).has(t)}}(),i=function(){if(cc)return sc;cc=1;var e=wu();return sc=function(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}}();function a(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,lc=a}function Pu(){if(fc)return hc;fc=1;var e=bu(),t=function(){if(ws)return _s;ws=1;var e=bu();return _s=function(){this.__data__=new e,this.size=0}}(),n=Ps?Es:(Ps=1,Es=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}),r=Ls?Rs:(Ls=1,Rs=function(e){return this.__data__.get(e)}),i=Os?Ns:(Os=1,Ns=function(e){return this.__data__.has(e)}),a=function(){if(pc)return dc;pc=1;var e=bu(),t=Tu(),n=Eu();return dc=function(r,i){var a=this.__data__;if(a instanceof e){var o=a.__data__;if(!t||o.length<199)return o.push([r,i]),this.size=++a.size,this;a=this.__data__=new n(o)}return a.set(r,i),this.size=a.size,this}}();function o(t){var n=this.__data__=new e(t);this.size=n.size}return o.prototype.clear=t,o.prototype.delete=n,o.prototype.get=r,o.prototype.has=i,o.prototype.set=a,hc=o}function Ru(){if(Ac)return Cc;Ac=1;var e=Eu(),t=gc?mc:(gc=1,mc=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),n=Ic?yc:(Ic=1,yc=function(e){return this.__data__.has(e)});function r(t){var n=-1,r=null==t?0:t.length;for(this.__data__=new e;++n<r;)this.add(t[n])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,Cc=r}function Lu(){if(wc)return _c;wc=1;var e=Ru(),t=bc?Sc:(bc=1,Sc=function(e,t){for(var n=-1,r=null==e?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}),n=vc?Tc:(vc=1,Tc=function(e,t){return e.has(t)});return _c=function(r,i,a,o,s,c){var l=1&a,u=r.length,d=i.length;if(u!=d&&!(l&&d>u))return!1;var p=c.get(r),h=c.get(i);if(p&&h)return p==i&&h==r;var f=-1,m=!0,g=2&a?new e:void 0;for(c.set(r,i),c.set(i,r);++f<u;){var y=r[f],I=i[f];if(o)var C=l?o(I,y,f,i,r,c):o(y,I,f,r,i,c);if(void 0!==C){if(C)continue;m=!1;break}if(g){if(!t(i,function(e,t){if(!n(g,t)&&(y===e||s(y,e,a,o,c)))return g.push(t)})){m=!1;break}}else if(y!==I&&!s(y,I,a,o,c)){m=!1;break}}return c.delete(r),c.delete(i),m}}function Nu(){if(Mc)return Bc;Mc=1;var e=yo(),t=function(){if(Pc)return Ec;Pc=1;var e=go().Uint8Array;return Ec=e}(),n=Au(),r=Lu(),i=Lc?Rc:(Lc=1,Rc=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}),a=Oc?Nc:(Oc=1,Nc=function(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}),o=e?e.prototype:void 0,s=o?o.valueOf:void 0;return Bc=function(e,o,c,l,u,d,p){switch(c){case"[object DataView]":if(e.byteLength!=o.byteLength||e.byteOffset!=o.byteOffset)return!1;e=e.buffer,o=o.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=o.byteLength||!d(new t(e),new t(o)));case"[object Boolean]":case"[object Date]":case"[object Number]":return n(+e,+o);case"[object Error]":return e.name==o.name&&e.message==o.message;case"[object RegExp]":case"[object String]":return e==o+"";case"[object Map]":var h=i;case"[object Set]":var f=1&l;if(h||(h=a),e.size!=o.size&&!f)return!1;var m=p.get(e);if(m)return m==o;l|=2,p.set(e,o);var g=r(h(e),h(o),l,u,d,p);return p.delete(e),g;case"[object Symbol]":if(s)return s.call(e)==s.call(o)}return!1}}function Ou(){if(Gc)return kc;Gc=1;var e=Fc?Dc:(Fc=1,Dc=function(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}),t=Po();return kc=function(n,r,i){var a=r(n);return t(n)?a:e(a,i(n))}}function Bu(){if(jc)return $c;jc=1;var e=xc?Hc:(xc=1,Hc=function(e,t){for(var n=-1,r=null==e?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}),t=Vc?Uc:(Vc=1,Uc=function(){return[]}),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return $c=r?function(t){return null==t?[]:(t=Object(t),e(r(t),function(e){return n.call(t,e)}))}:t}function Mu(){if(Yc)return Kc;Yc=1;var e=function(){if(Xc)return Wc;Xc=1;var e=Ou(),t=Bu(),n=Iu();return Wc=function(r){return e(r,n,t)}}(),t=Object.prototype.hasOwnProperty;return Kc=function(n,r,i,a,o,s){var c=1&i,l=e(n),u=l.length;if(u!=e(r).length&&!c)return!1;for(var d=u;d--;){var p=l[d];if(!(c?p in r:t.call(r,p)))return!1}var h=s.get(n),f=s.get(r);if(h&&f)return h==r&&f==n;var m=!0;s.set(n,r),s.set(r,n);for(var g=c;++d<u;){var y=n[p=l[d]],I=r[p];if(a)var C=c?a(I,y,p,r,n,s):a(y,I,p,n,r,s);if(!(void 0===C?y===I||o(y,I,i,a,s):C)){m=!1;break}g||(g="constructor"==p)}if(m&&!g){var A=n.constructor,S=r.constructor;A==S||!("constructor"in n)||!("constructor"in r)||"function"==typeof A&&A instanceof A&&"function"==typeof S&&S instanceof S||(m=!1)}return s.delete(n),s.delete(r),m}}function Du(){if(il)return rl;il=1;var e=function(){if(Qc)return qc;Qc=1;var e=To()(go(),"DataView");return qc=e}(),t=Tu(),n=function(){if(zc)return Jc;zc=1;var e=To()(go(),"Promise");return Jc=e}(),r=function(){if(el)return Zc;el=1;var e=To()(go(),"Set");return Zc=e}(),i=function(){if(nl)return tl;nl=1;var e=To()(go(),"WeakMap");return tl=e}(),a=Io(),o=bo(),s="[object Map]",c="[object Promise]",l="[object Set]",u="[object WeakMap]",d="[object DataView]",p=o(e),h=o(t),f=o(n),m=o(r),g=o(i),y=a;return(e&&y(new e(new ArrayBuffer(1)))!=d||t&&y(new t)!=s||n&&y(n.resolve())!=c||r&&y(new r)!=l||i&&y(new i)!=u)&&(y=function(e){var t=a(e),n="[object Object]"==t?e.constructor:void 0,r=n?o(n):"";if(r)switch(r){case p:return d;case h:return s;case f:return c;case m:return l;case g:return u}return t}),rl=y}function Fu(){if(cl)return sl;cl=1;var e=function(){if(ol)return al;ol=1;var e=Pu(),t=Lu(),n=Nu(),r=Mu(),i=Du(),a=Po(),o=Uo(),s=fu(),c="[object Arguments]",l="[object Array]",u="[object Object]",d=Object.prototype.hasOwnProperty;return al=function(p,h,f,m,g,y){var I=a(p),C=a(h),A=I?l:i(p),S=C?l:i(h),b=(A=A==c?u:A)==u,T=(S=S==c?u:S)==u,v=A==S;if(v&&o(p)){if(!o(h))return!1;I=!0,b=!1}if(v&&!b)return y||(y=new e),I||s(p)?t(p,h,f,m,g,y):n(p,h,A,f,m,g,y);if(!(1&f)){var _=b&&d.call(p,"__wrapped__"),w=T&&d.call(h,"__wrapped__");if(_||w){var E=_?p.value():p,P=w?h.value():h;return y||(y=new e),g(E,P,f,m,y)}}return!!v&&(y||(y=new e),r(p,h,f,m,g,y))}}(),t=wo();return sl=function n(r,i,a,o,s){return r===i||(null==r||null==i||!t(r)&&!t(i)?r!=r&&i!=i:e(r,i,a,o,n,s))},sl}function ku(){if(pl)return dl;pl=1;var e=Co();return dl=function(t){return t==t&&!e(t)}}function Gu(){if(gl)return ml;return gl=1,ml=function(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}}function Hu(){if(Il)return yl;Il=1;var e=function(){if(ul)return ll;ul=1;var e=Pu(),t=Fu();return ll=function(n,r,i,a){var o=i.length,s=o,c=!a;if(null==n)return!s;for(n=Object(n);o--;){var l=i[o];if(c&&l[2]?l[1]!==n[l[0]]:!(l[0]in n))return!1}for(;++o<s;){var u=(l=i[o])[0],d=n[u],p=l[1];if(c&&l[2]){if(void 0===d&&!(u in n))return!1}else{var h=new e;if(a)var f=a(d,p,u,n,r,h);if(!(void 0===f?t(p,d,3,a,h):f))return!1}}return!0}}(),t=function(){if(fl)return hl;fl=1;var e=ku(),t=Iu();return hl=function(n){for(var r=t(n),i=r.length;i--;){var a=r[i],o=n[a];r[i]=[a,o,e(o)]}return r}}(),n=Gu();return yl=function(r){var i=t(r);return 1==i.length&&i[0][2]?n(i[0][0],i[0][1]):function(t){return t===r||e(t,r,i)}}}function xu(){if(Al)return Cl;Al=1;var e=Io(),t=wo();return Cl=function(n){return"symbol"==typeof n||t(n)&&"[object Symbol]"==e(n)}}function Uu(){if(bl)return Sl;bl=1;var e=Po(),t=xu(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Sl=function(i,a){if(e(i))return!1;var o=typeof i;return!("number"!=o&&"symbol"!=o&&"boolean"!=o&&null!=i&&!t(i))||(r.test(i)||!n.test(i)||null!=a&&i in Object(a))}}function Vu(){if(wl)return _l;wl=1;var e=function(){if(vl)return Tl;vl=1;var e=Eu();function t(n,r){if("function"!=typeof n||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var i=function(){var e=arguments,t=r?r.apply(this,e):e[0],a=i.cache;if(a.has(t))return a.get(t);var o=n.apply(this,e);return i.cache=a.set(t,o)||a,o};return i.cache=new(t.Cache||e),i}return t.Cache=e,Tl=t}();return _l=function(t){var n=e(t,function(e){return 500===r.size&&r.clear(),e}),r=n.cache;return n}}function $u(){if(Ol)return Nl;Ol=1;var e=yo(),t=Ll?Rl:(Ll=1,Rl=function(e,t){for(var n=-1,r=null==e?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}),n=Po(),r=xu(),i=e?e.prototype:void 0,a=i?i.toString:void 0;return Nl=function e(i){if("string"==typeof i)return i;if(n(i))return t(i,e)+"";if(r(i))return a?a.call(i):"";var o=i+"";return"0"==o&&1/i==-1/0?"-0":o},Nl}function ju(){if(Fl)return Dl;Fl=1;var e=Po(),t=Uu(),n=function(){if(Pl)return El;Pl=1;var e=Vu(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,"$1"):t||e)}),r});return El=r}(),r=function(){if(Ml)return Bl;Ml=1;var e=$u();return Bl=function(t){return null==t?"":e(t)}}();return Dl=function(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}}function Wu(){if(Gl)return kl;Gl=1;var e=xu();return kl=function(t){if("string"==typeof t||e(t))return t;var n=t+"";return"0"==n&&1/t==-1/0?"-0":n}}function Xu(){if(xl)return Hl;xl=1;var e=ju(),t=Wu();return Hl=function(n,r){for(var i=0,a=(r=e(r,n)).length;null!=n&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}}function Ku(){if(Yl)return Kl;Yl=1;var e=jl?$l:(jl=1,$l=function(e,t){return null!=e&&t in Object(e)}),t=function(){if(Xl)return Wl;Xl=1;var e=ju(),t=Eo(),n=Po(),r=Vo(),i=$o(),a=Wu();return Wl=function(o,s,c){for(var l=-1,u=(s=e(s,o)).length,d=!1;++l<u;){var p=a(s[l]);if(!(d=null!=o&&c(o,p)))break;o=o[p]}return d||++l!=u?d:!!(u=null==o?0:o.length)&&i(u)&&r(p,u)&&(n(o)||t(o))}}();return Kl=function(n,r){return null!=n&&t(n,r,e)}}function Yu(){if(Ql)return ql;Ql=1;var e=Fu(),t=function(){if(Vl)return Ul;Vl=1;var e=Xu();return Ul=function(t,n,r){var i=null==t?void 0:e(t,n);return void 0===i?r:i}}(),n=Ku(),r=Uu(),i=ku(),a=Gu(),o=Wu();return ql=function(s,c){return r(s)&&i(c)?a(o(s),c):function(r){var i=t(r,s);return void 0===i&&i===c?n(r,s):e(c,i,3)}}}function qu(){if(iu)return ru;iu=1;var e=eu?Zl:(eu=1,Zl=function(e){return function(t){return null==t?void 0:t[e]}}),t=function(){if(nu)return tu;nu=1;var e=Xu();return tu=function(t){return function(n){return e(n,t)}}}(),n=Uu(),r=Wu();return ru=function(i){return n(i)?e(r(i)):t(i)}}function Qu(){if(ou)return au;ou=1;var e=Hu(),t=Yu(),n=zl?Jl:(zl=1,Jl=function(e){return e}),r=Po(),i=qu();return au=function(a){return"function"==typeof a?a:null==a?n:"object"==typeof a?r(a)?t(a[0],a[1]):e(a):i(a)}}function Ju(){if(du)return fo;du=1;var e=fo&&fo.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(fo,"__esModule",{value:!0}),fo.mergeCorporateActions=fo.getCorporateActionsSize=fo.convertCorporateActions=fo.NewTimeframe=fo.TimeFrameUnit=fo.AlpacaNews=fo.AlpacaOptionSnapshotV1Beta1=fo.AlpacaOptionQuoteV1Beta1=fo.AlpacaOptionTradeV1Beta1=fo.AlpacaOptionBarV1Beta1=fo.AlpacaCryptoOrderbook=fo.AlpacaCryptoSnapshot=fo.AlpacaCryptoBar=fo.AlpacaCryptoQuote=fo.AlpacaCryptoTrade=fo.AlpacaCorrectionV2=fo.AlpacaCancelErrorV2=fo.AlpacaLuldV2=fo.AlpacaStatusV2=fo.AlpacaSnapshotV2=fo.AlpacaBarV2=fo.AlpacaQuoteV2=fo.AlpacaTradeV2=void 0;const t=e(function(){if(cu)return su;cu=1;var e=vo(),t=Cu(),n=Qu();return su=function(r,i){var a={};return i=n(i,3),t(r,function(t,n,r){e(a,i(t,n,r),t)}),a}}()),n=e(function(){if(uu)return lu;uu=1;var e=vo(),t=Cu(),n=Qu();return lu=function(r,i){var a={};return i=n(i,3),t(r,function(t,n,r){e(a,n,i(t,n,r))}),a}}()),r={S:"Symbol",i:"ID",x:"Exchange",p:"Price",s:"Size",t:"Timestamp",c:"Conditions",z:"Tape"},i={S:"Symbol",bx:"BidExchange",bp:"BidPrice",bs:"BidSize",ax:"AskExchange",ap:"AskPrice",as:"AskSize",t:"Timestamp",c:"Conditions",z:"Tape"},a={S:"Symbol",o:"OpenPrice",h:"HighPrice",l:"LowPrice",c:"ClosePrice",v:"Volume",t:"Timestamp",vw:"VWAP",n:"TradeCount"},o={symbol:"symbol",latestTrade:"LatestTrade",latestQuote:"LatestQuote",minuteBar:"MinuteBar",dailyBar:"DailyBar",prevDailyBar:"PrevDailyBar"},s={S:"Symbol",sc:"StatusCode",sm:"StatusMessage",rc:"ReasonCode",rm:"ReasonMessage",t:"Timestamp",z:"Tape"},c={S:"Symbol",u:"LimitUpPrice",d:"LimitDownPrice",i:"Indicator",t:"Timestamp",z:"Tape"},l={S:"Symbol",i:"ID",x:"Exchange",p:"Price",s:"Size",a:"CancelErrorAction",z:"Tape",t:"Timestamp"},u={S:"Symbol",x:"Exchange",oi:"OriginalID",op:"OriginalPrice",os:"OriginalSize",oc:"OriginalConditions",ci:"CorrectedID",cp:"CorrectedPrice",cs:"CorrectedSize",cc:"CorrectedConditions",z:"Tape",t:"Timestamp"},d={S:"Symbol",t:"Timestamp",x:"Exchange",p:"Price",s:"Size",tks:"TakerSide",i:"ID"},p={t:"Timestamp",bp:"BidPrice",bs:"BidSize",ap:"AskPrice",as:"AskSize"},h={t:"Timestamp",o:"Open",h:"High",l:"Low",c:"Close",v:"Volume",vw:"VWAP",n:"TradeCount"},f={latestTrade:"LatestTrade",latestQuote:"LatestQuote",minuteBar:"MinuteBar",dailyBar:"DailyBar",prevDailyBar:"PrevDailyBar"},m={p:"Price",s:"Size"},g={t:"Timestamp",b:"Bids",a:"Asks"},y={size:"Size",url:"URL"},I={id:"ID",author:"Author",created_at:"CreatedAt",updated_at:"UpdatedAt",headline:"Headline",summary:"Summary",content:"Content",images:"Images",url:"URL",symbols:"Symbols",source:"Source"},C={S:"Symbol",o:"Open",h:"High",l:"Low",c:"Close",v:"Volume",t:"Timestamp",vw:"VWAP",n:"TradeCount"},A={S:"Symbol",x:"Exchange",p:"Price",s:"Size",t:"Timestamp",c:"Condition"},S={S:"Symbol",bx:"BidExchange",bp:"BidPrice",bs:"BidSize",ax:"AskExchange",ap:"AskPrice",as:"AskSize",t:"Timestamp",c:"Conditions",z:"Tape"},b={symbol:"symbol",latestTrade:"LatestTrade",latestQuote:"LatestQuote",impliedVolatility:"ImpliedVolatility",greeks:"Greeks"};function T(e){return N(e,r)}function v(e){return N(e,i)}function _(e){return N(e,a)}function w(e){return N(e,d)}function E(e){return N(e,p)}function P(e){return N(e,h)}function R(e){return N(e,A)}function L(e){return N(e,S)}function N(e,n){return(0,t.default)(e,(e,t)=>Object.hasOwn(n,t)?n[t]:t)}function O(e,t,n){switch(e){case"LatestTrade":return n?w(t):T(t);case"LatestQuote":return n?E(t):v(t);case"MinuteBar":case"DailyBar":case"PrevDailyBar":return n?P(t):_(t);default:return t}}var B,M;fo.AlpacaTradeV2=T,fo.AlpacaQuoteV2=v,fo.AlpacaBarV2=_,fo.AlpacaSnapshotV2=function(e){const t=N(e,o);return(0,n.default)(t,(e,t)=>O(t,e,!1))},fo.AlpacaStatusV2=function(e){return N(e,s)},fo.AlpacaLuldV2=function(e){return N(e,c)},fo.AlpacaCancelErrorV2=function(e){return N(e,l)},fo.AlpacaCorrectionV2=function(e){return N(e,u)},fo.AlpacaCryptoTrade=w,fo.AlpacaCryptoQuote=E,fo.AlpacaCryptoBar=P,fo.AlpacaCryptoSnapshot=function(e){const t=N(e,f);return(0,n.default)(t,(e,t)=>O(t,e,!0))},fo.AlpacaCryptoOrderbook=function(e){const t=e=>e.map(e=>N(e,m)),n=N(e,g);return Object.assign(Object.assign({},n),{Bids:t(n.Bids),Asks:t(n.Asks)})},fo.AlpacaOptionBarV1Beta1=function(e){return N(e,C)},fo.AlpacaOptionTradeV1Beta1=R,fo.AlpacaOptionQuoteV1Beta1=L,fo.AlpacaOptionSnapshotV1Beta1=function(e){const t=N(e,b);return(0,n.default)(t,(e,t)=>function(e,t){switch(e){case"LatestTrade":return R(t);case"LatestQuote":return L(t);default:return t}}(t,e))},fo.AlpacaNews=function(e){const t=N(e,I);return t.Images&&t.Images.forEach(e=>N(e,y)),t},(M=B||(fo.TimeFrameUnit=B={})).MIN="Min",M.HOUR="Hour",M.DAY="Day",M.WEEK="Week",M.MONTH="Month",fo.NewTimeframe=function(e,t){if(e<=0)throw new Error("amount must be a positive integer value");if(t==B.MIN&&e>59)throw new Error("minute timeframe can only be used with amount between 1-59");if(t==B.HOUR&&e>23)throw new Error("hour timeframe can only be used with amounts 1-23");if((t==B.DAY||t==B.WEEK)&&1!=e)throw new Error("day and week timeframes can only be used with amount 1");if(t==B.MONTH&&![1,2,3,6,12].includes(e))throw new Error("month timeframe can only be used with amount 1, 2, 3, 6 and 12");return`${e}${t}`};const D={ex_date:"ExDate",foreign:"Foreign",payable_date:"PayableDate",process_date:"ProcessDate",rate:"Rate",record_date:"RecordDate",special:"Special",symbol:"Symbol"},F={ex_date:"ExDate",new_rate:"NewRate",old_rate:"OldRate",payable_date:"PayableDate",process_date:"ProcessDate",record_date:"RecordDate",symbol:"Symbol"},k={due_bill_redemption_date:"DueBillRedemptionDate",ex_date:"ExDate",new_rate:"NewRate",old_rate:"OldRate",payable_date:"PayableDate",process_date:"ProcessDate",record_date:"RecordDate",symbol:"Symbol"},G={alternate_rate:"AlternateRate",alternate_symbol:"AlternateSymbol",effective_date:"EffectiveDate",new_rate:"NewRate",new_symbol:"NewSymbol",old_rate:"OldRate",old_symbol:"OldSymbol",process_date:"ProcessDate"},H={acquiree_symbol:"AcquireeSymbol",acquirer_symbol:"AcquirerSymbol",effective_date:"EffectiveDate",process_date:"ProcessDate",rate:"Rate"},x={acquiree_rate:"AcquireeRate",acquiree_symbol:"AcquireeSymbol",acquirer_rate:"AcquirerRate",acquirer_symbol:"AcquirerSymbol",effective_date:"EffectiveDate",payable_date:"PayableDate",process_date:"ProcessDate"},U={stock_merger_mapping:x,cash_rate:"CashRate"},V={ex_date:"ExDate",payable_date:"PayableDate",process_date:"ProcessDate",rate:"Rate",record_date:"RecordDate",symbol:"Symbol"},$={payable_date:"PayableDate",process_date:"ProcessDate",rate:"Rate",symbol:"Symbol"},j={ex_date:"ExDate",new_rate:"NewRate",new_symbol:"NewSymbol",process_date:"ProcessDate",record_date:"RecordDate",source_rate:"Rate",source_symbol:"SourceSymbol"},W={new_symbol:"NewSymbol",old_symbol:"OldSymbol",process_date:"ProcessDate"},X={symbol:"Symbol",process_date:"ProcessDate"},K={source_symbol:"SourceSymbol",new_symbol:"NewSymbol",rate:"Rate",process_date:"ProcessDate",ex_date:"ExDate",payable_date:"PayableDate",record_date:"RecordDate",expiration_date:"ExpirationDate"};return fo.convertCorporateActions=function(e){var t,n,r,i,a,o,s,c,l,u,d,p,h;let f={};return(null===(t=e.cash_dividends)||void 0===t?void 0:t.length)>0&&(f.CashDividends=f.CashDividends?f.CashDividends:Array(),e.cash_dividends.forEach(e=>{f.CashDividends.push(N(e,D))})),(null===(n=e.reverse_splits)||void 0===n?void 0:n.length)>0&&(f.ReverseSplits=f.ReverseSplits?f.ReverseSplits:Array(),e.reverse_splits.forEach(e=>{f.ReverseSplits.push(N(e,F))})),(null===(r=e.forward_splits)||void 0===r?void 0:r.length)>0&&(f.ForwardSplits=f.ForwardSplits?f.ForwardSplits:Array(),e.forward_splits.forEach(e=>{f.ForwardSplits.push(N(e,k))})),(null===(i=e.unit_splits)||void 0===i?void 0:i.length)>0&&(f.UnitSplits=f.UnitSplits?f.UnitSplits:Array(),e.unit_splits.forEach(e=>{f.UnitSplits.push(N(e,G))})),(null===(a=e.cash_mergers)||void 0===a?void 0:a.length)>0&&(f.CashMergers=f.CashMergers?f.CashMergers:Array(),e.cash_mergers.forEach(e=>{f.CashMergers.push(N(e,H))})),(null===(o=e.stock_mergers)||void 0===o?void 0:o.length)>0&&(f.StockMergers=f.StockMergers?f.StockMergers:Array(),e.stock_mergers.forEach(e=>{f.StockMergers.push(N(e,x))})),(null===(s=e.stock_and_cash_mergers)||void 0===s?void 0:s.length)>0&&(f.StockAndCashMerger=f.StockAndCashMerger?f.StockAndCashMerger:Array(),e.stock_and_cash_mergers.forEach(e=>{f.StockAndCashMerger.push(N(e,U))})),(null===(c=e.stock_dividends)||void 0===c?void 0:c.length)>0&&(f.StockDividends=f.StockDividends?f.StockDividends:Array(),e.stock_dividends.forEach(e=>{f.StockDividends.push(N(e,V))})),(null===(l=e.redemptions)||void 0===l?void 0:l.length)>0&&(f.Redemptions=f.Redemptions?f.Redemptions:Array(),e.redemptions.forEach(e=>{f.Redemptions.push(N(e,$))})),(null===(u=e.spin_offs)||void 0===u?void 0:u.length)>0&&(f.SpinOffs=f.SpinOffs?f.SpinOffs:Array(),e.spin_offs.forEach(e=>{f.SpinOffs.push(N(e,j))})),(null===(d=e.name_changes)||void 0===d?void 0:d.length)>0&&(f.NameChanges=f.NameChanges?f.NameChanges:Array(),e.name_changes.forEach(e=>{f.NameChanges.push(N(e,W))})),(null===(p=e.worthless_removals)||void 0===p?void 0:p.length)>0&&(f.WorthlessRemovals=f.WorthlessRemovals?f.WorthlessRemovals:Array(),e.worthless_removals.forEach(e=>{f.WorthlessRemovals.push(N(e,X))})),(null===(h=e.rights_distributions)||void 0===h?void 0:h.length)>0&&(f.RightsDistributions=f.RightsDistributions?f.RightsDistributions:Array(),e.rights_distributions.forEach(e=>{f.RightsDistributions.push(N(e,K))})),f},fo.getCorporateActionsSize=function(e){let t=0;for(const n in e)t+=e[n]?e[n].length:0;return t},fo.mergeCorporateActions=function(e,t){return{CashDividends:(e.CashDividends||[]).concat(t.CashDividends||[]),ReverseSplits:(e.ReverseSplits||[]).concat(t.ReverseSplits||[]),ForwardSplits:(e.ForwardSplits||[]).concat(t.ForwardSplits||[]),UnitSplits:(e.UnitSplits||[]).concat(t.UnitSplits||[]),CashMergers:(e.CashMergers||[]).concat(t.CashMergers||[]),StockMergers:(e.StockMergers||[]).concat(t.StockMergers||[]),StockAndCashMerger:(e.StockAndCashMerger||[]).concat(t.StockAndCashMerger||[]),StockDividends:(e.StockDividends||[]).concat(t.StockDividends||[]),Redemptions:(e.Redemptions||[]).concat(t.Redemptions||[]),SpinOffs:(e.SpinOffs||[]).concat(t.SpinOffs||[]),NameChanges:(e.NameChanges||[]).concat(t.NameChanges||[]),WorthlessRemovals:(e.WorthlessRemovals||[]).concat(t.WorthlessRemovals||[]),RightsDistributions:(e.RightsDistributions||[]).concat(t.RightsDistributions||[])}},fo}function zu(){if(pu)return ho;pu=1;var e=ho&&ho.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(i,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function s(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(o,s)}c((r=r.apply(e,t||[])).next())})},t=ho&&ho.__await||function(e){return this instanceof t?(this.v=e,this):new t(e)},n=ho&&ho.__asyncGenerator||function(e,n,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,a=r.apply(e,n||[]),o=[];return i={},s("next"),s("throw"),s("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),i[Symbol.asyncIterator]=function(){return this},i;function s(e,t){a[e]&&(i[e]=function(t){return new Promise(function(n,r){o.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,n){try{(r=a[e](n)).value instanceof t?Promise.resolve(r.value.v).then(l,u):d(o[0][2],r)}catch(i){d(o[0][3],i)}var r}function l(e){c("next",e)}function u(e){c("throw",e)}function d(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}},r=ho&&ho.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise(function(r,i){(function(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)})(r,i,(t=e[n](t)).done,t.value)})}}},i=ho&&ho.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ho,"__esModule",{value:!0}),ho.getCorporateActions=ho.getOptionChain=ho.getOptionSnapshots=ho.getLatestOptionQuotes=ho.getLatestOptionTrades=ho.getMultiOptionTradesAsync=ho.getMultiOptionTrades=ho.getMultiOptionBarsAsync=ho.getMultiOptionBars=ho.getNews=ho.Sort=ho.getLatestCryptoOrderbooks=ho.getCryptoSnapshots=ho.getLatestCryptoQuotes=ho.getLatestCryptoTrades=ho.getLatestCryptoBars=ho.getCryptoBars=ho.getCryptoQuotes=ho.getCryptoTrades=ho.getSnapshots=ho.getSnapshot=ho.getLatestBars=ho.getLatestBar=ho.getLatestQuotes=ho.getLatestQuote=ho.getLatestTrades=ho.getLatestTrade=ho.getMultiBarsAsync=ho.getMultiBars=ho.getBars=ho.getMultiQuotesAsync=ho.getMultiQuotes=ho.getQuotes=ho.getMultiTradesAsync=ho.getMultiTrades=ho.getTrades=ho.getMultiDataV2=ho.getDataV2=ho.dataV2HttpRequest=ho.TYPE=ho.Adjustment=void 0;const a=i(d),o=Ju(),s=1e4,c=1e3;var l,u,p,h,f,m;function g(e,t,n){const{dataBaseUrl:r,keyId:i,secretKey:o,oauth:s}=n,c={"Content-Type":"application/json","Accept-Encoding":"gzip"};return""==s?(c["APCA-API-KEY-ID"]=i,c["APCA-API-SECRET-KEY"]=o):c.Authorization="Bearer "+s,a.default.get(`${r}${e}`,{params:t,headers:c}).catch(e=>{var t,n;throw new Error(`code: ${(null===(t=e.response)||void 0===t?void 0:t.status)||e.statusCode}, message: ${null===(n=e.response)||void 0===n?void 0:n.data.message}`)})}function y(e,t,n){let r=0;if(0!==t&&(r=t),0!==e){const t=e-n;if(t<=0)return-1;(0==r||r>t)&&(r=t)}return r}function I(e,r,i,a){return n(this,arguments,function*(){var n;let o=null,c=0;const l=i.pageLimit?Math.min(i.pageLimit,s):s;for(delete i.pageLimit,i.limit=null!==(n=i.limit)&&void 0!==n?n:0;i.limit>c||0===i.limit;){let n;if(0!==i.limit){if(n=y(i.limit,l,c),-1==n)break}else n=null;const s=yield t(g(r,Object.assign(Object.assign({},i),{limit:n,page_token:o}),a)),u=s.data[e]||[];for(const e of u)yield yield t(e);if(c+=u.length,o=s.data.next_page_token,!o)break}})}function C(e,r,i,a,o){return n(this,arguments,function*(){var n;let c=null,l=0;const u=a.pageLimit?Math.min(a.pageLimit,s):s;for(delete a.pageLimit,a.limit=null!==(n=a.limit)&&void 0!==n?n:0;a.limit>l||0===a.limit;){const n=y(a.limit,u,l);if(-1==n)break;const s=Object.assign(Object.assign({},a),{symbols:e.join(","),limit:n,page_token:c}),d=yield t(g(`${r}${i}`,s,o)),p=d.data[i];for(const e in p)for(const n of p[e])l++,yield yield t({symbol:e,data:n});if(c=d.data.next_page_token,!c)break}})}function A(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=C(e,"/v2/stocks/",p.TRADES,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,o.AlpacaTradeV2)(e.data))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})}function S(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=C(e,"/v2/stocks/",p.QUOTES,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,o.AlpacaQuoteV2)(e.data))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})}function b(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=C(e,"/v2/stocks/",p.BARS,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,o.AlpacaBarV2)(e.data))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})}function T(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=C(e,"/v1beta1/options/",p.BARS,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,o.AlpacaOptionBarV1Beta1)(e.data))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})}function v(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=C(e,"/v1beta1/options/",p.TRADES,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;e.data=Object.assign(Object.assign({},e.data),{S:e.symbol}),yield yield t((0,o.AlpacaOptionTradeV1Beta1)(e.data))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})}return(u=l||(ho.Adjustment=l={})).RAW="raw",u.DIVIDEND="dividend",u.SPLIT="split",u.ALL="all",(h=p||(ho.TYPE=p={})).TRADES="trades",h.QUOTES="quotes",h.BARS="bars",h.SNAPSHOTS="snapshots",ho.dataV2HttpRequest=g,ho.getDataV2=I,ho.getMultiDataV2=C,ho.getTrades=function(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=I(p.TRADES,`/v2/stocks/${e}/${p.TRADES}`,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;yield yield t((0,o.AlpacaTradeV2)(e))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})},ho.getMultiTrades=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=A(t,n,i),l=/* @__PURE__ */new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s,t=l.get(e.Symbol)||new Array;l.set(e.Symbol,[...t,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},ho.getMultiTradesAsync=A,ho.getQuotes=function(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=I(p.QUOTES,`/v2/stocks/${e}/${p.QUOTES}`,i,a);try{for(var d,h=!0,f=r(u);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;yield yield t((0,o.AlpacaQuoteV2)(e))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})},ho.getMultiQuotes=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=S(t,n,i),l=/* @__PURE__ */new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s,t=l.get(e.Symbol)||new Array;l.set(e.Symbol,[...t,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},ho.getMultiQuotesAsync=S,ho.getBars=function(e,i,a){return n(this,arguments,function*(){var n,s,c,l;const u=I(p.BARS,`/v2/stocks/${e}/${p.BARS}`,i,a);try{for(var d,h=!0,f=r(u||[]);!(n=(d=yield t(f.next())).done);h=!0){l=d.value,h=!1;const e=l;yield yield t((0,o.AlpacaBarV2)(e))}}catch(m){s={error:m}}finally{try{h||n||!(c=f.return)||(yield t(c.call(f)))}finally{if(s)throw s.error}}})},ho.getMultiBars=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=b(t,n,i),l=/* @__PURE__ */new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s,t=l.get(e.Symbol)||new Array;l.set(e.Symbol,[...t,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},ho.getMultiBarsAsync=b,ho.getLatestTrade=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/trades/latest`,{},n);return(0,o.AlpacaTradeV2)(e.data.trade)})},ho.getLatestTrades=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v2/stocks/${p.TRADES}/latest`,{symbols:t.join(",")},n)).data.trades,r=/* @__PURE__ */new Map;for(const t in e)r.set(t,(0,o.AlpacaTradeV2)(Object.assign({S:t},e[t])));return r})},ho.getLatestQuote=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/quotes/latest`,{},n);return(0,o.AlpacaQuoteV2)(e.data.quote)})},ho.getLatestQuotes=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v2/stocks/${p.QUOTES}/latest`,{symbols:t.join(",")},n)).data.quotes,r=/* @__PURE__ */new Map;for(const t in e)r.set(t,(0,o.AlpacaQuoteV2)(Object.assign({S:t},e[t])));return r})},ho.getLatestBar=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/bars/latest`,{},n);return(0,o.AlpacaBarV2)(e.data.bar)})},ho.getLatestBars=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v2/stocks/${p.BARS}/latest`,{symbols:t.join(",")},n)).data.bars,r=/* @__PURE__ */new Map;for(const t in e)r.set(t,(0,o.AlpacaBarV2)(Object.assign({S:t},e[t])));return r})},ho.getSnapshot=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/${t}/snapshot`,{},n);return(0,o.AlpacaSnapshotV2)(e.data)})},ho.getSnapshots=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v2/stocks/snapshots?symbols=${t.join(",")}`,{},n);return Object.entries(e.data).map(([e,t])=>(0,o.AlpacaSnapshotV2)(Object.assign({symbol:e},t)))})},ho.getCryptoTrades=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,s,c;const l=C(t,"/v1beta3/crypto/us/",p.TRADES,n,i),u=/* @__PURE__ */new Map;try{for(var d,h=!0,f=r(l);!(e=(d=yield f.next()).done);h=!0){c=d.value,h=!1;const e=c,t=u.get(e.symbol)||new Array;u.set(e.symbol,[...t,(0,o.AlpacaCryptoTrade)(e.data)])}}catch(m){a={error:m}}finally{try{h||e||!(s=f.return)||(yield s.call(f))}finally{if(a)throw a.error}}return u})},ho.getCryptoQuotes=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,s,c;const l=C(t,"/v1beta3/crypto/us/",p.QUOTES,n,i),u=/* @__PURE__ */new Map;try{for(var d,h=!0,f=r(l);!(e=(d=yield f.next()).done);h=!0){c=d.value,h=!1;const e=c,t=u.get(e.symbol)||new Array;u.set(e.symbol,[...t,(0,o.AlpacaCryptoQuote)(e.data)])}}catch(m){a={error:m}}finally{try{h||e||!(s=f.return)||(yield s.call(f))}finally{if(a)throw a.error}}return u})},ho.getCryptoBars=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,s,c;const l=C(t,"/v1beta3/crypto/us/",p.BARS,n,i),u=/* @__PURE__ */new Map;try{for(var d,h=!0,f=r(l);!(e=(d=yield f.next()).done);h=!0){c=d.value,h=!1;const e=c,t=u.get(e.symbol)||new Array;u.set(e.symbol,[...t,(0,o.AlpacaCryptoBar)(e.data)])}}catch(m){a={error:m}}finally{try{h||e||!(s=f.return)||(yield s.call(f))}finally{if(a)throw a.error}}return u})},ho.getLatestCryptoBars=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/bars",e,n)).data.bars,i=/* @__PURE__ */new Map;for(const t in r){const e=r[t];i.set(t,(0,o.AlpacaCryptoBar)(e))}return i})},ho.getLatestCryptoTrades=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/trades",e,n)).data.trades,i=/* @__PURE__ */new Map;for(const t in r){const e=r[t];i.set(t,(0,o.AlpacaCryptoTrade)(e))}return i})},ho.getLatestCryptoQuotes=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/quotes",e,n)).data.quotes,i=/* @__PURE__ */new Map;for(const t in r){const e=r[t];i.set(t,(0,o.AlpacaCryptoQuote)(e))}return i})},ho.getCryptoSnapshots=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/snapshots",e,n)).data.snapshots,i=/* @__PURE__ */new Map;for(const t in r){const e=r[t];i.set(t,(0,o.AlpacaCryptoSnapshot)(e))}return i})},ho.getLatestCryptoOrderbooks=function(t,n){return e(this,void 0,void 0,function*(){const e={symbols:t.join(",")},r=(yield g("/v1beta3/crypto/us/latest/orderbooks",e,n)).data.orderbooks,i=/* @__PURE__ */new Map;for(const t in r){const e=r[t];i.set(t,(0,o.AlpacaCryptoOrderbook)(e))}return i})},(m=f||(ho.Sort=f={})).ASC="asc",m.DESC="desc",ho.getNews=function(t,n){return e(this,void 0,void 0,function*(){var e;if(t.totalLimit&&t.totalLimit<0)throw new Error("negative total limit");if(t.pageLimit&&t.pageLimit<0)throw new Error("negative page limit");let r=null,i=0;const a=(null==t?void 0:t.pageLimit)?Math.min(t.pageLimit,50):50;null==t||delete t.pageLimit;const s=null!==(e=t.totalLimit)&&void 0!==e?e:10,c=[],l=function(e){var t;const n={};return n.symbols=(null===(t=e.symbols)||void 0===t?void 0:t.length)>0?e.symbols.join(","):null,n.start=e.start,n.end=e.end,n.sort=e.sort,n.include_content=e.includeContent,n.exclude_contentless=e.excludeContentless,n}(t);let u;for(;u=y(s,a,i),!(u<1);){const e=yield g("/v1beta1/news",Object.assign(Object.assign({},l),{limit:u,page_token:r}),n);if(e.data.news.forEach(e=>c.push((0,o.AlpacaNews)(e))),i+=e.data.news.length,r=e.data.next_page_token,!r)break}return c})},ho.getMultiOptionBars=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=T(t,n,i),l=/* @__PURE__ */new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s;let t=e.Symbol?e.Symbol:"";delete e.Symbol;const n=l.get(t)||new Array;l.set(t,[...n,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},ho.getMultiOptionBarsAsync=T,ho.getMultiOptionTrades=function(t,n,i){return e(this,void 0,void 0,function*(){var e,a,o,s;const c=v(t,n,i),l=/* @__PURE__ */new Map;try{for(var u,d=!0,p=r(c);!(e=(u=yield p.next()).done);d=!0){s=u.value,d=!1;const e=s;let t=e.Symbol?e.Symbol:"";delete e.Symbol;const n=l.get(t)||new Array;l.set(t,[...n,e])}}catch(h){a={error:h}}finally{try{d||e||!(o=p.return)||(yield o.call(p))}finally{if(a)throw a.error}}return l})},ho.getMultiOptionTradesAsync=v,ho.getLatestOptionTrades=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v1beta1/options/${p.TRADES}/latest`,{symbols:t.join(",")},n)).data.trades,r=/* @__PURE__ */new Map;for(const t in e)r.set(t,(0,o.AlpacaOptionTradeV1Beta1)(Object.assign({},e[t])));return r})},ho.getLatestOptionQuotes=function(t,n){return e(this,void 0,void 0,function*(){const e=(yield g(`/v1beta1/options/${p.QUOTES}/latest`,{symbols:t.join(",")},n)).data.quotes,r=/* @__PURE__ */new Map;for(const t in e)r.set(t,(0,o.AlpacaOptionQuoteV1Beta1)(Object.assign({},e[t])));return r})},ho.getOptionSnapshots=function(t,n){return e(this,void 0,void 0,function*(){const e=yield g(`/v1beta1/options/snapshots?symbols=${t.join(",")}`,{},n);return Object.entries(e.data.snapshots).map(([e,t])=>(0,o.AlpacaOptionSnapshotV1Beta1)(Object.assign({Symbol:e},t)))})},ho.getOptionChain=function(t,n,r){return e(this,void 0,void 0,function*(){var e;if(n.totalLimit&&n.totalLimit<0)throw new Error("negative total limit");if(n.pageLimit&&n.pageLimit<0)throw new Error("negative page limit");let i=null,a=0;const s=(null==n?void 0:n.pageLimit)?Math.min(n.pageLimit,c):c;delete n.pageLimit;const l=null!==(e=null==n?void 0:n.totalLimit)&&void 0!==e?e:1e4;delete n.totalLimit;const u=[];let d;for(;d=y(l,s,a),!(d<1);){const e=yield g(`/v1beta1/options/snapshots/${t}`,Object.assign(Object.assign({},n),{limit:d,page_token:i}),r),s=Object.entries(e.data.snapshots).map(([e,t])=>(0,o.AlpacaOptionSnapshotV1Beta1)(Object.assign({Symbol:e},t)));if(a+=s.length,u.push(...s),i=e.data.next_page_token,!i)break}return u})},ho.getCorporateActions=function(t,n,r){return e(this,void 0,void 0,function*(){var e,i;if(n.totalLimit&&n.totalLimit<0)throw new Error("negative total limit");if(n.pageLimit&&n.pageLimit<0)throw new Error("negative page limit");let a=null,l=0;const u=(null==n?void 0:n.pageLimit)?Math.min(n.pageLimit,c):c;null==n||delete n.pageLimit;const d=null!==(e=null==n?void 0:n.totalLimit)&&void 0!==e?e:s;delete n.totalLimit;let p={};const h=null===(i=null==n?void 0:n.types)||void 0===i?void 0:i.join(","),f=Object.assign(Object.assign({},n),{symbols:t,types:h});let m;for(;m=y(d,u,l),!(m<1);){const e=yield g("/v1beta1/corporate-actions",Object.assign(Object.assign({},f),{limit:m,page_token:a}),r),t=(0,o.convertCorporateActions)(e.data.corporate_actions);if(p=(0,o.mergeCorporateActions)(p,t),l+=(0,o.getCorporateActionsSize)(t),a=e.data.next_page_token,!a)break}return p})},ho}var Zu,ed,td,nd={},rd={},id={exports:{}};function ad(){if(Zu)return id.exports;Zu=1;var e,t="object"==typeof Reflect?Reflect:null,n=t&&"function"==typeof t.apply?t.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};e=t&&"function"==typeof t.ownKeys?t.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}id.exports=i,id.exports.once=function(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}f(e,t,a,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&f(e,"error",t,n)}(e,i,{once:!0})})},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var a=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function s(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function c(e,t,n,r){var i,a,c,l;if(o(n),void 0===(a=e._events)?(a=e._events=/* @__PURE__ */Object.create(null),e._eventsCount=0):(void 0!==a.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),a=e._events),c=a[t]),void 0===c)c=a[t]=n,++e._eventsCount;else if("function"==typeof c?c=a[t]=r?[n,c]:[c,n]:r?c.unshift(n):c.push(n),(i=s(e))>0&&c.length>i&&!c.warned){c.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=c.length,l=u,console&&console.warn&&console.warn(l)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):h(i,i.length)}function p(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function h(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function f(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)})}}return Object.defineProperty(i,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),i.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=/* @__PURE__ */Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},i.prototype.getMaxListeners=function(){return s(this)},i.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,a=this._events;if(void 0!==a)i=i&&void 0===a.error;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var c=a[e];if(void 0===c)return!1;if("function"==typeof c)n(c,this,t);else{var l=c.length,u=h(c,l);for(r=0;r<l;++r)n(u[r],this,t)}return!0},i.prototype.addListener=function(e,t){return c(this,e,t,!1)},i.prototype.on=i.prototype.addListener,i.prototype.prependListener=function(e,t){return c(this,e,t,!0)},i.prototype.once=function(e,t){return o(t),this.on(e,u(this,e,t)),this},i.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,u(this,e,t)),this},i.prototype.removeListener=function(e,t){var n,r,i,a,s;if(o(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=/* @__PURE__ */Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){s=n[a].listener,i=a;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,s||t)}return this},i.prototype.off=i.prototype.removeListener,i.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=/* @__PURE__ */Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=/* @__PURE__ */Object.create(null):delete n[e]),this;if(0===arguments.length){var i,a=Object.keys(n);for(r=0;r<a.length;++r)"removeListener"!==(i=a[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=/* @__PURE__ */Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return d(this,e,!0)},i.prototype.rawListeners=function(e){return d(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]},id.exports}function od(){return td?ed:(td=1,ed=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")})}var sd,cd={exports:{}},ld={},ud={};function dd(){if(sd)return ud;sd=1,ud.byteLength=function(e){var t=a(e),n=t[0],r=t[1];return 3*(n+r)/4-r},ud.toByteArray=function(e){var r,i,o=a(e),s=o[0],c=o[1],l=new n(function(e,t,n){return 3*(t+n)/4-n}(0,s,c)),u=0,d=c>0?s-4:s;for(i=0;i<d;i+=4)r=t[e.charCodeAt(i)]<<18|t[e.charCodeAt(i+1)]<<12|t[e.charCodeAt(i+2)]<<6|t[e.charCodeAt(i+3)],l[u++]=r>>16&255,l[u++]=r>>8&255,l[u++]=255&r;2===c&&(r=t[e.charCodeAt(i)]<<2|t[e.charCodeAt(i+1)]>>4,l[u++]=255&r);1===c&&(r=t[e.charCodeAt(i)]<<10|t[e.charCodeAt(i+1)]<<4|t[e.charCodeAt(i+2)]>>2,l[u++]=r>>8&255,l[u++]=255&r);return l},ud.fromByteArray=function(t){for(var n,r=t.length,i=r%3,a=[],o=16383,c=0,l=r-i;c<l;c+=o)a.push(s(t,c,c+o>l?l:c+o));1===i?(n=t[r-1],a.push(e[n>>2]+e[n<<4&63]+"==")):2===i&&(n=(t[r-2]<<8)+t[r-1],a.push(e[n>>10]+e[n>>4&63]+e[n<<2&63]+"="));return a.join("")};for(var e=[],t=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)e[i]=r[i],t[r.charCodeAt(i)]=i;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function o(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(o(r));return i.join("")}return t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63,ud}var pd,hd,fd,md={};function gd(){return pd||(pd=1,md.read=function(e,t,n,r,i){var a,o,s=8*i-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,p=n?-1:1,h=e[t+d];for(d+=p,a=h&(1<<-u)-1,h>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=p,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=p,u-=8);if(0===a)a=1-l;else{if(a===c)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,r),a-=l}return(h?-1:1)*o*Math.pow(2,a-r)},md.write=function(e,t,n,r,i,a){var o,s,c,l=8*a-i-1,u=(1<<l)-1,d=u>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:a-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+h]=255&s,h+=f,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+h]=255&o,h+=f,o/=256,l-=8);e[n+h-f]|=128*m}),md}function yd(){return hd||(hd=1,function(e){const t=dd(),n=gd(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},e.INSPECT_MAX_BYTES=50;const i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,n)}function s(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|h(e,t);let r=a(n);const i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(K(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(K(e,ArrayBuffer)||e&&K(e.buffer,ArrayBuffer))return d(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(K(e,SharedArrayBuffer)||e&&K(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const i=function(e){if(o.isBuffer(e)){const t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||Y(e.length)?a(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),a(e<0?0:0|p(e))}function u(e){const t=e.length<0?0:0|p(e.length),n=a(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||K(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return j(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(e).length;default:if(i)return r?-1:j(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return v(this,t,n);case"ascii":return w(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),Y(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){let a,o=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let r=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===r?0:a-r)){if(-1===r&&(r=a),a-r+1===c)return r*o}else-1!==r&&(a-=a-r),r=-1}else for(n+c>s&&(n=s-c),a=n;a>=0;a--){let n=!0;for(let r=0;r<c;r++)if(l(e,a+r)!==l(t,r)){n=!1;break}if(n)return a}return-1}function I(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const a=t.length;let o;for(r>a/2&&(r=a/2),o=0;o<r;++o){const r=parseInt(t.substr(2*o,2),16);if(Y(r))return o;e[n+o]=r}return o}function C(e,t,n,r){return X(j(t,e.length-n),e,n,r)}function A(e,t,n,r){return X(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return X(W(t),e,n,r)}function b(e,t,n,r){return X(function(e,t){let n,r,i;const a=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function T(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function v(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,c;switch(o){case 1:t<128&&(a=t);break;case 2:n=e[i+1],128==(192&n)&&(c=(31&t)<<6|63&n,c>127&&(a=c));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(c=(15&t)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(a=c));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(c=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,c>65535&&c<1114112&&(a=c))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=o}return function(e){const t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}e.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return s(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(K(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),K(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(K(t,Uint8Array))i+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?v(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(K(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n);for(let o=0;o<c;++o)if(l[o]!==u[o]){a=l[o],s=u[o];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let a=!1;for(;;)switch(r){case"hex":return I(this,e,t,n);case"utf8":case"utf-8":return C(this,e,t,n);case"ascii":case"latin1":case"binary":return A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const _=4096;function w(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function E(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let a=t;a<n;++a)i+=q[e[a]];return i}function R(e,t,n){const r=e.slice(t,n);let i="";for(let a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,i){x(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function B(e,t,n,r,i){x(t,r,i,e,n,7);let a=Number(t&BigInt(4294967295));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function M(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,r,i,a){return t=+t,r>>>=0,a||M(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function F(e,t,r,i,a){return t=+t,r>>>=0,a||M(e,0,r,8),n.write(e,t,r,i,52,8),r+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))}),o.prototype.readBigUInt64BE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)}),o.prototype.readBigInt64BE=Q(function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||V(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)}),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){N(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Q(function(e,t=0){return O(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeBigUInt64BE=Q(function(e,t=0){return B(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);N(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Q(function(e,t=0){return O(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeBigInt64BE=Q(function(e,t=0){return B(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),o.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const a=o.isBuffer(e)?e:o.from(e,r),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};const k={};function G(e,t,n){k[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function H(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function x(e,t,n,r,i,a){if(e>n||e<t){const n="bigint"==typeof t?"n":"";let r;throw r=0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(a+1)}${n}`:`>= -(2${n} ** ${8*(a+1)-1}${n}) and < 2 ** ${8*(a+1)-1}${n}`,new k.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||V(t,e.length-(n+1))}(r,i,a)}function U(e,t){if("number"!=typeof e)throw new k.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new k.ERR_OUT_OF_RANGE("offset","an integer",e);if(t<0)throw new k.ERR_BUFFER_OUT_OF_BOUNDS;throw new k.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}G("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),G("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),G("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=H(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=H(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r},RangeError);const $=/[^+/0-9A-Za-z-_]/g;function j(e,t){let n;t=t||1/0;const r=e.length;let i=null;const a=[];for(let o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function W(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace($,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function X(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function K(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function Y(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Q(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}}(ld)),ld}function Id(){return fd||(fd=1,function(e,t){var n=yd(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(cd,cd.exports)),cd.exports}var Cd,Ad,Sd,bd,Td,vd,_d={exports:{}},wd={exports:{}};function Ed(){return Ad?Cd:(Ad=1,Cd=ad().EventEmitter)}function Pd(){if(bd)return Sd;function e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function t(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach(function(e){n(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function n(e,t,n){return(t=i(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t,n){return t&&function(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,i(r.key),r)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:String(t)}bd=1;var a=yd().Buffer,o=Ki.inspect,s=o&&o.custom||"inspect";function c(e,t,n){a.prototype.copy.call(e,t,n)}return Sd=/* @__PURE__ */function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.head=null,this.tail=null,this.length=0}return r(e,[{key:"push",value:function(e){var t={data:e,next:null};this.length>0?this.tail.next=t:this.head=t,this.tail=t,++this.length}},{key:"unshift",value:function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length}},{key:"shift",value:function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(e){if(0===this.length)return"";for(var t=this.head,n=""+t.data;t=t.next;)n+=e+t.data;return n}},{key:"concat",value:function(e){if(0===this.length)return a.alloc(0);for(var t=a.allocUnsafe(e>>>0),n=this.head,r=0;n;)c(n.data,t,r),r+=n.data.length,n=n.next;return t}},{key:"consume",value:function(e,t){var n;return e<this.head.data.length?(n=this.head.data.slice(0,e),this.head.data=this.head.data.slice(e)):n=e===this.head.data.length?this.shift():t?this._getString(e):this._getBuffer(e),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(e){var t=this.head,n=1,r=t.data;for(e-=r.length;t=t.next;){var i=t.data,a=e>i.length?i.length:e;if(a===i.length?r+=i:r+=i.slice(0,e),0===(e-=a)){a===i.length?(++n,t.next?this.head=t.next:this.head=this.tail=null):(this.head=t,t.data=i.slice(a));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(e){var t=a.allocUnsafe(e),n=this.head,r=1;for(n.data.copy(t),e-=n.data.length;n=n.next;){var i=n.data,o=e>i.length?i.length:e;if(i.copy(t,t.length-e,0,o),0===(e-=o)){o===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(o));break}++r}return this.length-=r,t}},{key:s,value:function(e,n){return o(this,t(t({},n),{},{depth:0,customInspect:!1}))}}]),e}()}function Rd(){if(vd)return Td;function e(e,r){n(e,r),t(e)}function t(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function n(e,t){e.emit("error",t)}return vd=1,Td={destroy:function(r,i){var a=this,o=this._readableState&&this._readableState.destroyed,s=this._writableState&&this._writableState.destroyed;return o||s?(i?i(r):r&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process.nextTick(n,this,r)):process.nextTick(n,this,r)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(r||null,function(n){!i&&n?a._writableState?a._writableState.errorEmitted?process.nextTick(t,a):(a._writableState.errorEmitted=!0,process.nextTick(e,a,n)):process.nextTick(e,a,n):i?(process.nextTick(t,a),i(n)):process.nextTick(t,a)}),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)},errorOrDestroy:function(e,t){var n=e._readableState,r=e._writableState;n&&n.autoDestroy||r&&r.autoDestroy?e.destroy(t):e.emit("error",t)}}}var Ld,Nd,Od,Bd={};function Md(){if(Ld)return Bd;Ld=1;var e={};function t(t,n,r){r||(r=Error);var i=/* @__PURE__ */function(e){var t,r;function i(t,r,i){return e.call(this,function(e,t,r){return"string"==typeof n?n:n(e,t,r)}(t,r,i))||this}return r=e,(t=i).prototype=Object.create(r.prototype),t.prototype.constructor=t,t.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function n(e,t){if(Array.isArray(e)){var n=e.length;return e=e.map(function(e){return String(e)}),n>2?"one of ".concat(t," ").concat(e.slice(0,n-1).join(", "),", or ")+e[n-1]:2===n?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}return"of ".concat(t," ").concat(String(e))}return t("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError),t("ERR_INVALID_ARG_TYPE",function(e,t,r){var i,a,o;if("string"==typeof t&&(a="not ",t.substr(0,a.length)===a)?(i="must not be",t=t.replace(/^not /,"")):i="must be",function(e,t,n){return(void 0===n||n>e.length)&&(n=e.length),e.substring(n-t.length,n)===t}(e," argument"))o="The ".concat(e," ").concat(i," ").concat(n(t,"type"));else{var s=function(e,t,n){return"number"!=typeof n&&(n=0),!(n+t.length>e.length)&&-1!==e.indexOf(t,n)}(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(s," ").concat(i," ").concat(n(t,"type"))}return o+=". Received type ".concat(typeof r)},TypeError),t("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),t("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"}),t("ERR_STREAM_PREMATURE_CLOSE","Premature close"),t("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"}),t("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),t("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),t("ERR_STREAM_WRITE_AFTER_END","write after end"),t("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),t("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError),t("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),Bd.codes=e,Bd}function Dd(){if(Od)return Nd;Od=1;var e=Md().codes.ERR_INVALID_OPT_VALUE;return Nd={getHighWaterMark:function(t,n,r,i){var a=function(e,t,n){return null!=e.highWaterMark?e.highWaterMark:t?e[n]:null}(n,i,r);if(null!=a){if(!isFinite(a)||Math.floor(a)!==a||a<0)throw new e(i?r:"highWaterMark",a);return Math.floor(a)}return t.objectMode?16:16384}}}var Fd,kd,Gd,Hd,xd,Ud,Vd,$d={exports:{}};function jd(){return Fd||(Fd=1,"function"==typeof Object.create?$d.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:$d.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}),$d.exports}function Wd(){if(Gd)return kd;function e(e){try{if(!Hi.localStorage)return!1}catch(n){return!1}var t=Hi.localStorage[e];return null!=t&&"true"===String(t).toLowerCase()}return Gd=1,kd=function(t,n){if(e("noDeprecation"))return t;var r=!1;return function(){if(!r){if(e("throwDeprecation"))throw new Error(n);e("traceDeprecation")?console.trace(n):console.warn(n),r=!0}return t.apply(this,arguments)}},kd}function Xd(){if(xd)return Hd;function e(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var i=r.callback;t.pendingcb--,i(n),r=r.next}t.corkedRequestsFree.next=e}(t,e)}}var t;xd=1,Hd=S,S.WritableState=A;var n={deprecate:Wd()},r=Ed(),i=yd().Buffer,a=(void 0!==Hi?Hi:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var o,s=Rd(),c=Dd().getHighWaterMark,l=Md().codes,u=l.ERR_INVALID_ARG_TYPE,d=l.ERR_METHOD_NOT_IMPLEMENTED,p=l.ERR_MULTIPLE_CALLBACK,h=l.ERR_STREAM_CANNOT_PIPE,f=l.ERR_STREAM_DESTROYED,m=l.ERR_STREAM_NULL_VALUES,g=l.ERR_STREAM_WRITE_AFTER_END,y=l.ERR_UNKNOWN_ENCODING,I=s.errorOrDestroy;function C(){}function A(n,r,i){t=t||Kd(),n=n||{},"boolean"!=typeof i&&(i=r instanceof t),this.objectMode=!!n.objectMode,i&&(this.objectMode=this.objectMode||!!n.writableObjectMode),this.highWaterMark=c(this,n,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===n.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=n.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new p;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,i){--t.pendingcb,n?(process.nextTick(i,r),process.nextTick(E,e,t),e._writableState.errorEmitted=!0,I(e,r)):(i(r),e._writableState.errorEmitted=!0,I(e,r),E(e,t))}(e,n,r,t,i);else{var a=_(n)||e.destroyed;a||n.corked||n.bufferProcessing||!n.bufferedRequest||v(e,n),r?process.nextTick(T,e,n,a,i):T(e,n,a,i)}}(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==n.emitClose,this.autoDestroy=!!n.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}function S(e){var n=this instanceof(t=t||Kd());if(!n&&!o.call(S,this))return new S(e);this._writableState=new A(e,this,n),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),r.call(this)}function b(e,t,n,r,i,a,o){t.writelen=r,t.writecb=o,t.writing=!0,t.sync=!0,t.destroyed?t.onwrite(new f("write")):n?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function T(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),E(e,t)}function v(t,n){n.bufferProcessing=!0;var r=n.bufferedRequest;if(t._writev&&r&&r.next){var i=n.bufferedRequestCount,a=new Array(i),o=n.corkedRequestsFree;o.entry=r;for(var s=0,c=!0;r;)a[s]=r,r.isBuf||(c=!1),r=r.next,s+=1;a.allBuffers=c,b(t,n,!0,n.length,a,"",o.finish),n.pendingcb++,n.lastBufferedRequest=null,o.next?(n.corkedRequestsFree=o.next,o.next=null):n.corkedRequestsFree=new e(n),n.bufferedRequestCount=0}else{for(;r;){var l=r.chunk,u=r.encoding,d=r.callback;if(b(t,n,!1,n.objectMode?1:l.length,l,u,d),r=r.next,n.bufferedRequestCount--,n.writing)break}null===r&&(n.lastBufferedRequest=null)}n.bufferedRequest=r,n.bufferProcessing=!1}function _(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function w(e,t){e._final(function(n){t.pendingcb--,n&&I(e,n),t.prefinished=!0,e.emit("prefinish"),E(e,t)})}function E(e,t){var n=_(t);if(n&&(function(e,t){t.prefinished||t.finalCalled||("function"!=typeof e._final||t.destroyed?(t.prefinished=!0,e.emit("prefinish")):(t.pendingcb++,t.finalCalled=!0,process.nextTick(w,e,t)))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"),t.autoDestroy))){var r=e._readableState;(!r||r.autoDestroy&&r.endEmitted)&&e.destroy()}return n}return jd()(S,r),A.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(A.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(o=Function.prototype[Symbol.hasInstance],Object.defineProperty(S,Symbol.hasInstance,{value:function(e){return!!o.call(this,e)||this===S&&(e&&e._writableState instanceof A)}})):o=function(e){return e instanceof this},S.prototype.pipe=function(){I(this,new h)},S.prototype.write=function(e,t,n){var r,o=this._writableState,s=!1,c=!o.objectMode&&(r=e,i.isBuffer(r)||r instanceof a);return c&&!i.isBuffer(e)&&(e=function(e){return i.from(e)}(e)),"function"==typeof t&&(n=t,t=null),c?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=C),o.ending?function(e,t){var n=new g;I(e,n),process.nextTick(t,n)}(this,n):(c||function(e,t,n,r){var i;return null===n?i=new m:"string"==typeof n||t.objectMode||(i=new u("chunk",["string","Buffer"],n)),!i||(I(e,i),process.nextTick(r,i),!1)}(this,o,e,n))&&(o.pendingcb++,s=function(e,t,n,r,a,o){if(!n){var s=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=i.from(t,n));return t}(t,r,a);r!==s&&(n=!0,a="buffer",r=s)}var c=t.objectMode?1:r.length;t.length+=c;var l=t.length<t.highWaterMark;l||(t.needDrain=!0);if(t.writing||t.corked){var u=t.lastBufferedRequest;t.lastBufferedRequest={chunk:r,encoding:a,isBuf:n,callback:o,next:null},u?u.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else b(e,t,!1,c,r,a,o);return l}(this,o,c,e,t,n)),s},S.prototype.cork=function(){this._writableState.corked++},S.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.bufferProcessing||!e.bufferedRequest||v(this,e))},S.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new y(e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(S.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(S.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),S.prototype._write=function(e,t,n){n(new d("_write()"))},S.prototype._writev=null,S.prototype.end=function(e,t,n){var r=this._writableState;return"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!=e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||function(e,t,n){t.ending=!0,E(e,t),n&&(t.finished?process.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n),this},Object.defineProperty(S.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),S.prototype.destroy=s.destroy,S.prototype._undestroy=s.undestroy,S.prototype._destroy=function(e,t){t(e)},Hd}function Kd(){if(Vd)return Ud;Vd=1;var e=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};Ud=o;var t=gp(),n=Xd();jd()(o,t);for(var r=e(n.prototype),i=0;i<r.length;i++){var a=r[i];o.prototype[a]||(o.prototype[a]=n.prototype[a])}function o(e){if(!(this instanceof o))return new o(e);t.call(this,e),n.call(this,e),this.allowHalfOpen=!0,e&&(!1===e.readable&&(this.readable=!1),!1===e.writable&&(this.writable=!1),!1===e.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",s)))}function s(){this._writableState.ended||process.nextTick(c,this)}function c(e){e.end()}return Object.defineProperty(o.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(o.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(o.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(o.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(e){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=e,this._writableState.destroyed=e)}}),Ud}var Yd,qd,Qd,Jd,zd,Zd,ep,tp,np,rp,ip,ap,op,sp,cp,lp,up,dp={},pp={exports:{}};function hp(){if(qd)return dp;qd=1;var e=(Yd||(Yd=1,function(e,t){var n=yd(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}function a(e,t,n){return r(e,t,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?e.exports=n:(i(n,t),t.Buffer=a),i(r,a),a.from=function(e,t,n){if("number"==typeof e)throw new TypeError("Argument must not be a number");return r(e,t,n)},a.alloc=function(e,t,n){if("number"!=typeof e)throw new TypeError("Argument must be a number");var i=r(e);return void 0!==t?"string"==typeof n?i.fill(t,n):i.fill(t):i.fill(0),i},a.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return r(e)},a.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}}(pp,pp.exports)),pp.exports).Buffer,t=e.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function n(n){var r;switch(this.encoding=function(n){var r=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(n);if("string"!=typeof r&&(e.isEncoding===t||!t(n)))throw new Error("Unknown encoding: "+n);return r||n}(n),this.encoding){case"utf16le":this.text=a,this.end=o,r=4;break;case"utf8":this.fillLast=i,r=4;break;case"base64":this.text=s,this.end=c,r=3;break;default:return this.write=l,void(this.end=u)}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(r)}function r(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function i(e){var t=this.lastTotal-this.lastNeed,n=function(e,t){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function a(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function o(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function s(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function c(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function l(e){return e.toString(this.encoding)}function u(e){return e&&e.length?this.write(e):""}return dp.StringDecoder=n,n.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<e.length?t?t+this.text(e,n):this.text(e,n):t||""},n.prototype.end=function(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�":t},n.prototype.text=function(e,t){var n=function(e,t,n){var i=t.length-1;if(i<n)return 0;var a=r(t[i]);if(a>=0)return a>0&&(e.lastNeed=a-1),a;if(--i<n||-2===a)return 0;if(a=r(t[i]),a>=0)return a>0&&(e.lastNeed=a-2),a;if(--i<n||-2===a)return 0;if(a=r(t[i]),a>=0)return a>0&&(2===a?a=0:e.lastNeed=a-3),a;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var i=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,i),e.toString("utf8",t,i)},n.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length},dp}function fp(){if(Jd)return Qd;Jd=1;var e=Md().codes.ERR_STREAM_PREMATURE_CLOSE;function t(){}return Qd=function n(r,i,a){if("function"==typeof i)return n(r,null,i);i||(i={}),a=function(e){var t=!1;return function(){if(!t){t=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.apply(this,r)}}}(a||t);var o=i.readable||!1!==i.readable&&r.readable,s=i.writable||!1!==i.writable&&r.writable,c=function(){r.writable||u()},l=r._writableState&&r._writableState.finished,u=function(){s=!1,l=!0,o||a.call(r)},d=r._readableState&&r._readableState.endEmitted,p=function(){o=!1,d=!0,s||a.call(r)},h=function(e){a.call(r,e)},f=function(){var t;return o&&!d?(r._readableState&&r._readableState.ended||(t=new e),a.call(r,t)):s&&!l?(r._writableState&&r._writableState.ended||(t=new e),a.call(r,t)):void 0},m=function(){r.req.on("finish",u)};return!function(e){return e.setHeader&&"function"==typeof e.abort}(r)?s&&!r._writableState&&(r.on("end",c),r.on("close",c)):(r.on("complete",u),r.on("abort",f),r.req?m():r.on("request",m)),r.on("end",p),r.on("finish",u),!1!==i.error&&r.on("error",h),r.on("close",f),function(){r.removeListener("complete",u),r.removeListener("abort",f),r.removeListener("request",m),r.req&&r.req.removeListener("finish",u),r.removeListener("end",c),r.removeListener("close",c),r.removeListener("finish",u),r.removeListener("end",p),r.removeListener("error",h),r.removeListener("close",f)}},Qd}function mp(){if(Zd)return zd;var e;function t(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Zd=1;var n=fp(),r=/* @__PURE__ */Symbol("lastResolve"),i=/* @__PURE__ */Symbol("lastReject"),a=/* @__PURE__ */Symbol("error"),o=/* @__PURE__ */Symbol("ended"),s=/* @__PURE__ */Symbol("lastPromise"),c=/* @__PURE__ */Symbol("handlePromise"),l=/* @__PURE__ */Symbol("stream");function u(e,t){return{value:e,done:t}}function d(e){var t=e[r];if(null!==t){var n=e[l].read();null!==n&&(e[s]=null,e[r]=null,e[i]=null,t(u(n,!1)))}}function p(e){process.nextTick(d,e)}var h=Object.getPrototypeOf(function(){}),f=Object.setPrototypeOf((t(e={get stream(){return this[l]},next:function(){var e=this,t=this[a];if(null!==t)return Promise.reject(t);if(this[o])return Promise.resolve(u(void 0,!0));if(this[l].destroyed)return new Promise(function(t,n){process.nextTick(function(){e[a]?n(e[a]):t(u(void 0,!0))})});var n,r=this[s];if(r)n=new Promise(function(e,t){return function(n,r){e.then(function(){t[o]?n(u(void 0,!0)):t[c](n,r)},r)}}(r,this));else{var i=this[l].read();if(null!==i)return Promise.resolve(u(i,!1));n=new Promise(this[c])}return this[s]=n,n}},Symbol.asyncIterator,function(){return this}),t(e,"return",function(){var e=this;return new Promise(function(t,n){e[l].destroy(null,function(e){e?n(e):t(u(void 0,!0))})})}),e),h);return zd=function(e){var d,h=Object.create(f,(t(d={},l,{value:e,writable:!0}),t(d,r,{value:null,writable:!0}),t(d,i,{value:null,writable:!0}),t(d,a,{value:null,writable:!0}),t(d,o,{value:e._readableState.endEmitted,writable:!0}),t(d,c,{value:function(e,t){var n=h[l].read();n?(h[s]=null,h[r]=null,h[i]=null,e(u(n,!1))):(h[r]=e,h[i]=t)},writable:!0}),d));return h[s]=null,n(e,function(e){if(e&&"ERR_STREAM_PREMATURE_CLOSE"!==e.code){var t=h[i];return null!==t&&(h[s]=null,h[r]=null,h[i]=null,t(e)),void(h[a]=e)}var n=h[r];null!==n&&(h[s]=null,h[r]=null,h[i]=null,n(u(void 0,!0))),h[o]=!0}),e.on("readable",p.bind(null,h)),h}}function gp(){if(rp)return np;var e;rp=1,np=S,S.ReadableState=A,ad().EventEmitter;var t=function(e,t){return e.listeners(t).length},n=Ed(),r=yd().Buffer,i=(void 0!==Hi?Hi:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{}).Uint8Array||function(){};var a,o=Ki;a=o&&o.debuglog?o.debuglog("stream"):function(){};var s,c,l,u=Pd(),d=Rd(),p=Dd().getHighWaterMark,h=Md().codes,f=h.ERR_INVALID_ARG_TYPE,m=h.ERR_STREAM_PUSH_AFTER_EOF,g=h.ERR_METHOD_NOT_IMPLEMENTED,y=h.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;jd()(S,n);var I=d.errorOrDestroy,C=["error","close","destroy","pause","resume"];function A(t,n,r){e=e||Kd(),t=t||{},"boolean"!=typeof r&&(r=n instanceof e),this.objectMode=!!t.objectMode,r&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=p(this,t,"readableHighWaterMark",r),this.buffer=new u,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.paused=!0,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(s||(s=hp().StringDecoder),this.decoder=new s(t.encoding),this.encoding=t.encoding)}function S(t){if(e=e||Kd(),!(this instanceof S))return new S(t);var r=this instanceof e;this._readableState=new A(t,this,r),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),n.call(this)}function b(e,t,n,o,s){a("readableAddChunk",t);var c,l=e._readableState;if(null===t)l.reading=!1,function(e,t){if(a("onEofChunk"),t.ended)return;if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,t.sync?w(e):(t.needReadable=!1,t.emittedReadable||(t.emittedReadable=!0,E(e)))}(e,l);else if(s||(c=function(e,t){var n;a=t,r.isBuffer(a)||a instanceof i||"string"==typeof t||void 0===t||e.objectMode||(n=new f("chunk",["string","Buffer","Uint8Array"],t));var a;return n}(l,t)),c)I(e,c);else if(l.objectMode||t&&t.length>0)if("string"==typeof t||l.objectMode||Object.getPrototypeOf(t)===r.prototype||(t=function(e){return r.from(e)}(t)),o)l.endEmitted?I(e,new y):T(e,l,t,!0);else if(l.ended)I(e,new m);else{if(l.destroyed)return!1;l.reading=!1,l.decoder&&!n?(t=l.decoder.write(t),l.objectMode||0!==t.length?T(e,l,t,!1):P(e,l)):T(e,l,t,!1)}else o||(l.reading=!1,P(e,l));return!l.ended&&(l.length<l.highWaterMark||0===l.length)}function T(e,t,n,r){t.flowing&&0===t.length&&!t.sync?(t.awaitDrain=0,e.emit("data",n)):(t.length+=t.objectMode?1:n.length,r?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&w(e)),P(e,t)}Object.defineProperty(S.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(e){this._readableState&&(this._readableState.destroyed=e)}}),S.prototype.destroy=d.destroy,S.prototype._undestroy=d.undestroy,S.prototype._destroy=function(e,t){t(e)},S.prototype.push=function(e,t){var n,i=this._readableState;return i.objectMode?n=!0:"string"==typeof e&&((t=t||i.defaultEncoding)!==i.encoding&&(e=r.from(e,t),t=""),n=!0),b(this,e,t,!1,n)},S.prototype.unshift=function(e){return b(this,e,null,!0,!1)},S.prototype.isPaused=function(){return!1===this._readableState.flowing},S.prototype.setEncoding=function(e){s||(s=hp().StringDecoder);var t=new s(e);this._readableState.decoder=t,this._readableState.encoding=this._readableState.decoder.encoding;for(var n=this._readableState.buffer.head,r="";null!==n;)r+=t.write(n.data),n=n.next;return this._readableState.buffer.clear(),""!==r&&this._readableState.buffer.push(r),this._readableState.length=r.length,this};var v=1073741824;function _(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!=e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=function(e){return e>=v?e=v:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function w(e){var t=e._readableState;a("emitReadable",t.needReadable,t.emittedReadable),t.needReadable=!1,t.emittedReadable||(a("emitReadable",t.flowing),t.emittedReadable=!0,process.nextTick(E,e))}function E(e){var t=e._readableState;a("emitReadable_",t.destroyed,t.length,t.ended),t.destroyed||!t.length&&!t.ended||(e.emit("readable"),t.emittedReadable=!1),t.needReadable=!t.flowing&&!t.ended&&t.length<=t.highWaterMark,B(e)}function P(e,t){t.readingMore||(t.readingMore=!0,process.nextTick(R,e,t))}function R(e,t){for(;!t.reading&&!t.ended&&(t.length<t.highWaterMark||t.flowing&&0===t.length);){var n=t.length;if(a("maybeReadMore read 0"),e.read(0),n===t.length)break}t.readingMore=!1}function L(e){var t=e._readableState;t.readableListening=e.listenerCount("readable")>0,t.resumeScheduled&&!t.paused?t.flowing=!0:e.listenerCount("data")>0&&e.resume()}function N(e){a("readable nexttick read 0"),e.read(0)}function O(e,t){a("resume",t.reading),t.reading||e.read(0),t.resumeScheduled=!1,e.emit("resume"),B(e),t.flowing&&!t.reading&&e.read(0)}function B(e){var t=e._readableState;for(a("flow",t.flowing);t.flowing&&null!==e.read(););}function M(e,t){return 0===t.length?null:(t.objectMode?n=t.buffer.shift():!e||e>=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.first():t.buffer.concat(t.length),t.buffer.clear()):n=t.buffer.consume(e,t.decoder),n);var n}function D(e){var t=e._readableState;a("endReadable",t.endEmitted),t.endEmitted||(t.ended=!0,process.nextTick(F,t,e))}function F(e,t){if(a("endReadableNT",e.endEmitted,e.length),!e.endEmitted&&0===e.length&&(e.endEmitted=!0,t.readable=!1,t.emit("end"),e.autoDestroy)){var n=t._writableState;(!n||n.autoDestroy&&n.finished)&&t.destroy()}}function k(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}return S.prototype.read=function(e){a("read",e),e=parseInt(e,10);var t=this._readableState,n=e;if(0!==e&&(t.emittedReadable=!1),0===e&&t.needReadable&&((0!==t.highWaterMark?t.length>=t.highWaterMark:t.length>0)||t.ended))return a("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?D(this):w(this),null;if(0===(e=_(e,t))&&t.ended)return 0===t.length&&D(this),null;var r,i=t.needReadable;return a("need readable",i),(0===t.length||t.length-e<t.highWaterMark)&&a("length less than watermark",i=!0),t.ended||t.reading?a("reading or ended",i=!1):i&&(a("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1,t.reading||(e=_(n,t))),null===(r=e>0?M(e,t):null)?(t.needReadable=t.length<=t.highWaterMark,e=0):(t.length-=e,t.awaitDrain=0),0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&D(this)),null!==r&&this.emit("data",r),r},S.prototype._read=function(e){I(this,new g("_read()"))},S.prototype.pipe=function(e,n){var r=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,a("pipe count=%d opts=%j",i.pipesCount,n);var o=(!n||!1!==n.end)&&e!==process.stdout&&e!==process.stderr?c:m;function s(t,n){a("onunpipe"),t===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,a("cleanup"),e.removeListener("close",h),e.removeListener("finish",f),e.removeListener("drain",l),e.removeListener("error",p),e.removeListener("unpipe",s),r.removeListener("end",c),r.removeListener("end",m),r.removeListener("data",d),u=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||l())}function c(){a("onend"),e.end()}i.endEmitted?process.nextTick(o):r.once("end",o),e.on("unpipe",s);var l=function(e){return function(){var n=e._readableState;a("pipeOnDrain",n.awaitDrain),n.awaitDrain&&n.awaitDrain--,0===n.awaitDrain&&t(e,"data")&&(n.flowing=!0,B(e))}}(r);e.on("drain",l);var u=!1;function d(t){a("ondata");var n=e.write(t);a("dest.write",n),!1===n&&((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==k(i.pipes,e))&&!u&&(a("false write response, pause",i.awaitDrain),i.awaitDrain++),r.pause())}function p(n){a("onerror",n),m(),e.removeListener("error",p),0===t(e,"error")&&I(e,n)}function h(){e.removeListener("finish",f),m()}function f(){a("onfinish"),e.removeListener("close",h),m()}function m(){a("unpipe"),r.unpipe(e)}return r.on("data",d),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?Array.isArray(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",p),e.once("close",h),e.once("finish",f),e.emit("pipe",r),i.flowing||(a("pipe resume"),r.resume()),e},S.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes||(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n)),this;if(!e){var r=t.pipes,i=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var a=0;a<i;a++)r[a].emit("unpipe",this,{hasUnpiped:!1});return this}var o=k(t.pipes,e);return-1===o||(t.pipes.splice(o,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this,n)),this},S.prototype.on=function(e,t){var r=n.prototype.on.call(this,e,t),i=this._readableState;return"data"===e?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===e&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,a("on readable",i.length,i.reading),i.length?w(this):i.reading||process.nextTick(N,this))),r},S.prototype.addListener=S.prototype.on,S.prototype.removeListener=function(e,t){var r=n.prototype.removeListener.call(this,e,t);return"readable"===e&&process.nextTick(L,this),r},S.prototype.removeAllListeners=function(e){var t=n.prototype.removeAllListeners.apply(this,arguments);return"readable"!==e&&void 0!==e||process.nextTick(L,this),t},S.prototype.resume=function(){var e=this._readableState;return e.flowing||(a("resume"),e.flowing=!e.readableListening,function(e,t){t.resumeScheduled||(t.resumeScheduled=!0,process.nextTick(O,e,t))}(this,e)),e.paused=!1,this},S.prototype.pause=function(){return a("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(a("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},S.prototype.wrap=function(e){var t=this,n=this._readableState,r=!1;for(var i in e.on("end",function(){if(a("wrapped end"),n.decoder&&!n.ended){var e=n.decoder.end();e&&e.length&&t.push(e)}t.push(null)}),e.on("data",function(i){(a("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(t.push(i)||(r=!0,e.pause()))}),e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=/* @__PURE__ */function(t){return function(){return e[t].apply(e,arguments)}}(i));for(var o=0;o<C.length;o++)e.on(C[o],this.emit.bind(this,C[o]));return this._read=function(t){a("wrapped _read",t),r&&(r=!1,e.resume())},this},"function"==typeof Symbol&&(S.prototype[Symbol.asyncIterator]=function(){return void 0===c&&(c=mp()),c(this)}),Object.defineProperty(S.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(S.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(S.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(e){this._readableState&&(this._readableState.flowing=e)}}),S._fromList=M,Object.defineProperty(S.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(S.from=function(e,t){return void 0===l&&(l=tp?ep:(tp=1,ep=function(){throw new Error("Readable.from is not available in the browser")})),l(S,e,t)}),np}function yp(){if(ap)return ip;ap=1,ip=s;var e=Md().codes,t=e.ERR_METHOD_NOT_IMPLEMENTED,n=e.ERR_MULTIPLE_CALLBACK,r=e.ERR_TRANSFORM_ALREADY_TRANSFORMING,i=e.ERR_TRANSFORM_WITH_LENGTH_0,a=Kd();function o(e,t){var r=this._transformState;r.transforming=!1;var i=r.writecb;if(null===i)return this.emit("error",new n);r.writechunk=null,r.writecb=null,null!=t&&this.push(t),i(e);var a=this._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&this._read(a.highWaterMark)}function s(e){if(!(this instanceof s))return new s(e);a.call(this,e),this._transformState={afterTransform:o.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.on("prefinish",c)}function c(){var e=this;"function"!=typeof this._flush||this._readableState.destroyed?l(this,null,null):this._flush(function(t,n){l(e,t,n)})}function l(e,t,n){if(t)return e.emit("error",t);if(null!=n&&e.push(n),e._writableState.length)throw new i;if(e._transformState.transforming)throw new r;return e.push(null)}return jd()(s,a),s.prototype.push=function(e,t){return this._transformState.needTransform=!1,a.prototype.push.call(this,e,t)},s.prototype._transform=function(e,n,r){r(new t("_transform()"))},s.prototype._write=function(e,t,n){var r=this._transformState;if(r.writecb=n,r.writechunk=e,r.writeencoding=t,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},s.prototype._read=function(e){var t=this._transformState;null===t.writechunk||t.transforming?t.needTransform=!0:(t.transforming=!0,this._transform(t.writechunk,t.writeencoding,t.afterTransform))},s.prototype._destroy=function(e,t){a.prototype._destroy.call(this,e,function(e){t(e)})},ip}function Ip(){if(lp)return cp;var e;lp=1;var t=Md().codes,n=t.ERR_MISSING_ARGS,r=t.ERR_STREAM_DESTROYED;function i(e){if(e)throw e}function a(e){e()}function o(e,t){return e.pipe(t)}return cp=function(){for(var t=arguments.length,s=new Array(t),c=0;c<t;c++)s[c]=arguments[c];var l,u=function(e){return e.length?"function"!=typeof e[e.length-1]?i:e.pop():i}(s);if(Array.isArray(s[0])&&(s=s[0]),s.length<2)throw new n("streams");var d=s.map(function(t,n){var i=n<s.length-1;return function(t,n,i,a){a=function(e){var t=!1;return function(){t||(t=!0,e.apply(void 0,arguments))}}(a);var o=!1;t.on("close",function(){o=!0}),void 0===e&&(e=fp()),e(t,{readable:n,writable:i},function(e){if(e)return a(e);o=!0,a()});var s=!1;return function(e){if(!o&&!s)return s=!0,function(e){return e.setHeader&&"function"==typeof e.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void a(e||new r("pipe"))}}(t,i,n>0,function(e){l||(l=e),e&&d.forEach(a),i||(d.forEach(a),u(l))})});return s.reduce(o)},cp}function Cp(){return up||(up=1,e=wd.exports,(e=wd.exports=gp()).Stream=e,e.Readable=e,e.Writable=Xd(),e.Duplex=Kd(),e.Transform=yp(),e.PassThrough=function(){if(sp)return op;sp=1,op=t;var e=yp();function t(n){if(!(this instanceof t))return new t(n);e.call(this,n)}return jd()(t,e),t.prototype._transform=function(e,t,n){n(null,e)},op}(),e.finished=fp(),e.pipeline=Ip()),wd.exports;var e}var Ap,Sp,bp,Tp,vp={};function _p(){return Ap||(Ap=1,function(e){var t=dd(),n=gd(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=o,e.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},e.INSPECT_MAX_BYTES=50;var i=2147483647;function a(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return l(e)}return s(e,t,n)}function s(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|h(e,t),r=a(n),i=r.write(e,t);i!==n&&(r=r.slice(0,i));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){var t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return u(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return d(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);var i=function(e){if(o.isBuffer(e)){var t=0|p(e.length),n=a(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||x(e.length)?a(0):u(e);if("Buffer"===e.type&&Array.isArray(e.data))return u(e.data)}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function l(e){return c(e),a(e<0?0:0|p(e))}function u(e){for(var t=e.length<0?0:0|p(e.length),n=a(t),r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function p(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function h(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return k(e).length;default:if(i)return r?-1:F(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return v(this,t,n);case"ascii":return w(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function m(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function g(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),x(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var a,o=1,s=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,s/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(a=n;a<s;a++)if(l(e,a)===l(t,-1===u?0:a-u)){if(-1===u&&(u=a),a-u+1===c)return u*o}else-1!==u&&(a-=a-u),u=-1}else for(n+c>s&&(n=s-c),a=n;a>=0;a--){for(var d=!0,p=0;p<c;p++)if(l(e,a+p)!==l(t,p)){d=!1;break}if(d)return a}return-1}function I(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(2*o,2),16);if(x(s))return o;e[n+o]=s}return o}function C(e,t,n,r){return G(F(t,e.length-n),e,n,r)}function A(e,t,n,r){return G(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function S(e,t,n,r){return G(k(t),e,n,r)}function b(e,t,n,r){return G(function(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,a.push(i),a.push(r);return a}(t,e.length-n),e,n,r)}function T(e,n,r){return 0===n&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function v(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a,o,s,c,l=e[i],u=null,d=l>239?4:l>223?3:l>191?2:1;if(i+d<=n)switch(d){case 1:l<128&&(u=l);break;case 2:128==(192&(a=e[i+1]))&&(c=(31&l)<<6|63&a)>127&&(u=c);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(c=(15&l)<<12|(63&a)<<6|63&o)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(c=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=d}return function(e){var t=e.length;if(t<=_)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=_));return n}(r)}e.kMaxLength=i,o.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(n){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return s(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return c(e),e<=0?a(e):void 0!==t?"string"==typeof n?a(e).fill(t,n):a(e).fill(t):a(e)}(e,t,n)},o.allocUnsafe=function(e){return l(e)},o.allocUnsafeSlow=function(e){return l(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=o.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(H(a,Uint8Array))i+a.length>r.length?o.from(a).copy(r,i):Uint8Array.prototype.set.call(r,a,i);else{if(!o.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i)}i+=a.length}return r},o.byteLength=h,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)m(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},o.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?v(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0),c=Math.min(a,s),l=this.slice(r,i),u=e.slice(t,n),d=0;d<c;++d)if(l[d]!==u[d]){a=l[d],s=u[d];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return g(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return g(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return I(this,e,t,n);case"utf8":case"utf-8":return C(this,e,t,n);case"ascii":case"latin1":case"binary":return A(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,e,t,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var _=4096;function w(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function E(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",a=t;a<n;++a)i+=U[e[a]];return i}function R(e,t,n){for(var r=e.slice(t,n),i="",a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+256*r[a+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function O(e,t,n,r,i,a){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function M(e,t,r,i,a){return t=+t,r>>>=0,a||O(e,0,r,8),n.write(e,t,r,i,52,8),r+8}o.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),n.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),n.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t>>>=0,n>>>=0,r)||N(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<n&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=Math.pow(2,8*n-1);N(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o|0)-s&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeFloatLE=function(e,t,n){return B(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return B(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return M(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return M(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){var i=e.charCodeAt(0);("utf8"===r&&i<128||"latin1"===r)&&(e=i)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var a;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(a=t;a<n;++a)this[a]=e;else{var s=o.isBuffer(e)?e:o.from(e,r),c=s.length;if(0===c)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(a=0;a<n-t;++a)this[a+t]=s[a%c]}return this};var D=/[^+/0-9A-Za-z-_]/g;function F(e,t){var n;t=t||1/0;for(var r=e.length,i=null,a=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function k(e){return t.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function x(e){return e!=e}var U=function(){for(var e="0123456789abcdef",t=new Array(256),n=0;n<16;++n)for(var r=16*n,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t}()}(vp)),vp}function wp(){if(Tp)return _d.exports;Tp=1;const e=Cp().Duplex,t=jd(),n=function(){if(bp)return Sp;bp=1;const{Buffer:e}=_p(),t=/* @__PURE__ */Symbol.for("BufferList");function n(e){if(!(this instanceof n))return new n(e);n._init.call(this,e)}return n._init=function(e){Object.defineProperty(this,t,{value:!0}),this._bufs=[],this.length=0,e&&this.append(e)},n.prototype._new=function(e){return new n(e)},n.prototype._offset=function(e){if(0===e)return[0,0];let t=0;for(let n=0;n<this._bufs.length;n++){const r=t+this._bufs[n].length;if(e<r||n===this._bufs.length-1)return[n,e-t];t=r}},n.prototype._reverseOffset=function(e){const t=e[0];let n=e[1];for(let r=0;r<t;r++)n+=this._bufs[r].length;return n},n.prototype.get=function(e){if(e>this.length||e<0)return;const t=this._offset(e);return this._bufs[t[0]][t[1]]},n.prototype.slice=function(e,t){return"number"==typeof e&&e<0&&(e+=this.length),"number"==typeof t&&t<0&&(t+=this.length),this.copy(null,0,e,t)},n.prototype.copy=function(t,n,r,i){if(("number"!=typeof r||r<0)&&(r=0),("number"!=typeof i||i>this.length)&&(i=this.length),r>=this.length)return t||e.alloc(0);if(i<=0)return t||e.alloc(0);const a=!!t,o=this._offset(r),s=i-r;let c=s,l=a&&n||0,u=o[1];if(0===r&&i===this.length){if(!a)return 1===this._bufs.length?this._bufs[0]:e.concat(this._bufs,this.length);for(let e=0;e<this._bufs.length;e++)this._bufs[e].copy(t,l),l+=this._bufs[e].length;return t}if(c<=this._bufs[o[0]].length-u)return a?this._bufs[o[0]].copy(t,n,u,u+c):this._bufs[o[0]].slice(u,u+c);a||(t=e.allocUnsafe(s));for(let e=o[0];e<this._bufs.length;e++){const n=this._bufs[e].length-u;if(!(c>n)){this._bufs[e].copy(t,l,u,u+c),l+=n;break}this._bufs[e].copy(t,l,u),l+=n,c-=n,u&&(u=0)}return t.length>l?t.slice(0,l):t},n.prototype.shallowSlice=function(e,t){if(e=e||0,t="number"!=typeof t?this.length:t,e<0&&(e+=this.length),t<0&&(t+=this.length),e===t)return this._new();const n=this._offset(e),r=this._offset(t),i=this._bufs.slice(n[0],r[0]+1);return 0===r[1]?i.pop():i[i.length-1]=i[i.length-1].slice(0,r[1]),0!==n[1]&&(i[0]=i[0].slice(n[1])),this._new(i)},n.prototype.toString=function(e,t,n){return this.slice(t,n).toString(e)},n.prototype.consume=function(e){if(e=Math.trunc(e),Number.isNaN(e)||e<=0)return this;for(;this._bufs.length;){if(!(e>=this._bufs[0].length)){this._bufs[0]=this._bufs[0].slice(e),this.length-=e;break}e-=this._bufs[0].length,this.length-=this._bufs[0].length,this._bufs.shift()}return this},n.prototype.duplicate=function(){const e=this._new();for(let t=0;t<this._bufs.length;t++)e.append(this._bufs[t]);return e},n.prototype.append=function(t){if(null==t)return this;if(t.buffer)this._appendBuffer(e.from(t.buffer,t.byteOffset,t.byteLength));else if(Array.isArray(t))for(let e=0;e<t.length;e++)this.append(t[e]);else if(this._isBufferList(t))for(let e=0;e<t._bufs.length;e++)this.append(t._bufs[e]);else"number"==typeof t&&(t=t.toString()),this._appendBuffer(e.from(t));return this},n.prototype._appendBuffer=function(e){this._bufs.push(e),this.length+=e.length},n.prototype.indexOf=function(t,n,r){if(void 0===r&&"string"==typeof n&&(r=n,n=void 0),"function"==typeof t||Array.isArray(t))throw new TypeError('The "value" argument must be one of type string, Buffer, BufferList, or Uint8Array.');if("number"==typeof t?t=e.from([t]):"string"==typeof t?t=e.from(t,r):this._isBufferList(t)?t=t.slice():Array.isArray(t.buffer)?t=e.from(t.buffer,t.byteOffset,t.byteLength):e.isBuffer(t)||(t=e.from(t)),n=Number(n||0),isNaN(n)&&(n=0),n<0&&(n=this.length+n),n<0&&(n=0),0===t.length)return n>this.length?this.length:n;const i=this._offset(n);let a=i[0],o=i[1];for(;a<this._bufs.length;a++){const e=this._bufs[a];for(;o<e.length;)if(e.length-o>=t.length){const n=e.indexOf(t,o);if(-1!==n)return this._reverseOffset([a,n]);o=e.length-t.length+1}else{const e=this._reverseOffset([a,o]);if(this._match(e,t))return e;o++}o=0}return-1},n.prototype._match=function(e,t){if(this.length-e<t.length)return!1;for(let n=0;n<t.length;n++)if(this.get(e+n)!==t[n])return!1;return!0},function(){const e={readDoubleBE:8,readDoubleLE:8,readFloatBE:4,readFloatLE:4,readInt32BE:4,readInt32LE:4,readUInt32BE:4,readUInt32LE:4,readInt16BE:2,readInt16LE:2,readUInt16BE:2,readUInt16LE:2,readInt8:1,readUInt8:1,readIntBE:null,readIntLE:null,readUIntBE:null,readUIntLE:null};for(const t in e)(function(t){n.prototype[t]=null===e[t]?function(e,n){return this.slice(e,e+n)[t](0,n)}:function(n=0){return this.slice(n,n+e[t])[t](0)}})(t)}(),n.prototype._isBufferList=function(e){return e instanceof n||n.isBufferList(e)},n.isBufferList=function(e){return null!=e&&e[t]},Sp=n}();function r(t){if(!(this instanceof r))return new r(t);if("function"==typeof t){this._callback=t;const e=function(e){this._callback&&(this._callback(e),this._callback=null)}.bind(this);this.on("pipe",function(t){t.on("error",e)}),this.on("unpipe",function(t){t.removeListener("error",e)}),t=null}n._init.call(this,t),e.call(this)}return t(r,e),Object.assign(r.prototype,n.prototype),r.prototype._new=function(e){return new r(e)},r.prototype._write=function(e,t,n){this._appendBuffer(e),"function"==typeof n&&n()},r.prototype._read=function(e){if(!this.length)return this.push(null);e=Math.min(e,this.length),this.push(this.slice(0,e)),this.consume(e)},r.prototype.end=function(t){e.prototype.end.call(this,t),this._callback&&(this._callback(null,this.slice()),this._callback=null)},r.prototype._destroy=function(e,t){this._bufs.length=0,this.length=0,t(e)},r.prototype._isBufferList=function(e){return e instanceof r||e instanceof n||r.isBufferList(e)},r.isBufferList=n.isBufferList,_d.exports=r,_d.exports.BufferListStream=r,_d.exports.BufferList=n,_d.exports}var Ep,Pp={};var Rp,Lp,Np,Op,Bp,Mp,Dp,Fp,kp,Gp,Hp,xp={};function Up(){if(Rp)return xp;Rp=1;const e=Ki;function t(e){Error.call(this),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.message=e||"unable to decode"}return xp.IncompleteBufferError=t,e.inherits(t,Error),xp.isFloat=function(e){return e%1!=0},xp}function Vp(){if(Np)return Lp;Np=1;const e=wp(),t=Up().IncompleteBufferError,n={196:2,197:3,198:5,199:3,200:4,201:6,202:5,203:9,204:2,205:3,206:5,207:9,208:2,209:3,210:5,211:9,212:3,213:4,214:6,215:10,216:18,217:2,218:3,219:5,222:3,220:3,221:5};function r(e,t,n){return t>=n+e}function i(e,t,n,r,i){let a=t;const s=[];let c=0;for(;c++<n;){const t=o(e,a,i);if(!t)return null;s.push(t[0]),a+=t[1]}return[s,r+a-t]}function a(e,t,n,r,a){const o=i(e,t,2*n,r,a);if(!o)return null;const[s,c]=o;let l=!a.options.preferMap;if(l)for(let i=0;i<2*n;i+=2)if("string"!=typeof s[i]){l=!1;break}if(l){const e={};for(let t=0;t<2*n;t+=2){const n=s[t],r=s[t+1];if("__proto__"===n){if("error"===a.options.protoAction)throw new SyntaxError("Object contains forbidden prototype property");if("remove"===a.options.protoAction)continue}e[n]=r}return[e,c]}{const e=/* @__PURE__ */new Map;for(let t=0;t<2*n;t+=2){const n=s[t],r=s[t+1];e.set(n,r)}return[e,c]}}function o(e,t,o){if(e.length<=t)return null;const c=e.length-t;let l=t;const u=e.readUInt8(l);l+=1;const d=n[u]||-1;if(c<d)return null;if(u<128)return[u,1];if(128==(240&u)){return a(e,l,15&u,l-t,o)}if(144==(240&u)){return i(e,l,15&u,l-t,o)}if(160==(224&u)){const t=31&u;if(!r(t,c,1))return null;return[e.toString("utf8",l,l+t),t+1]}if(u>=192&&u<=195)return function(e){if(192===e)return[null,1];if(194===e)return[!1,1];if(195===e)return[!0,1]}(u);if(u>=196&&u<=198){const t=e.readUIntBE(l,d-1);if(l+=d-1,!r(t,c,d))return null;return[e.slice(l,l+t),d+t]}if(u>=199&&u<=201){const t=e.readUIntBE(l,d-2);l+=d-2;const n=e.readInt8(l);return l+=1,r(t,c,d)?s(e,l,n,t,d,o):null}if(u>=202&&u<=203)return function(e,t,n){let r;4===n&&(r=e.readFloatBE(t));8===n&&(r=e.readDoubleBE(t));return[r,n+1]}(e,l,d-1);if(u>=204&&u<=207)return function(e,t,n){const r=t+n;let i=0;for(;t<r;)i+=e.readUInt8(t++)*Math.pow(256,r-t);return[i,n+1]}(e,l,d-1);if(u>=208&&u<=211)return function(e,t,n){let r;1===n&&(r=e.readInt8(t));2===n&&(r=e.readInt16BE(t));4===n&&(r=e.readInt32BE(t));8===n&&(r=function(e,t){var n=!(128&~e[t]);if(n){let n=1;for(let r=t+7;r>=t;r--){const t=(255^e[r])+n;e[r]=255&t,n=t>>8}}const r=e.readUInt32BE(t+0),i=e.readUInt32BE(t+4);return(4294967296*r+i)*(n?-1:1)}(e.slice(t,t+8),0));return[r,n+1]}(e,l,d-1);if(u>=212&&u<=216){const t=e.readInt8(l);return l+=1,s(e,l,t,d-2,2,o)}if(u>=217&&u<=219){const t=e.readUIntBE(l,d-1);if(l+=d-1,!r(t,c,d))return null;return[e.toString("utf8",l,l+t),d+t]}if(u>=220&&u<=221){const t=e.readUIntBE(l,d-1);return l+=d-1,i(e,l,t,d,o)}if(u>=222&&u<=223){let t;switch(u){case 222:return t=e.readUInt16BE(l),l+=2,a(e,l,t,3,o);case 223:return t=e.readUInt32BE(l),l+=4,a(e,l,t,5,o)}}if(u>=224)return[u-256,1];throw new Error("not implemented yet")}function s(e,t,n,r,i,a){const o=e.slice(t,t+r),s=a.decodingTypes.get(n);if(!s)throw new Error("unable to find ext type "+n);return[s(o),i+r]}return Lp=function(n,r){const i={decodingTypes:n,options:r};return function(n){n instanceof e||(n=e().append(n));const r=o(n,0,i);if(!r)throw new t;return n.consume(r[1]),r[0]}}}function $p(){if(Bp)return Op;Bp=1;const e=Id().Buffer,t=wp(),n=Up().isFloat;function r(e,t,n){const r=n%4294967296,i=Math.floor(n/4294967296);e.writeUInt32BE(i,t+0),e.writeUInt32BE(r,t+4)}Op=function(i,l){function u(d){if(void 0===d)throw new Error("undefined is not encodable in msgpack!");if(null===d)return e.from([192]);if(!0===d)return e.from([195]);if(!1===d)return e.from([194]);if(d instanceof Map)return function(e,n,r){const i=[s(e.size,128,222)],a=[...e.keys()];n.preferMap||a.every(e=>"string"==typeof e)&&console.warn("Map with string only keys will be deserialized as an object!");return a.forEach(t=>{i.push(r(t),r(e.get(t)))}),t(i)}(d,l,u);if("string"==typeof d)return function(t,n){const r=e.byteLength(t);let i;r<32?(i=e.allocUnsafe(1+r),i[0]=160|r,r>0&&i.write(t,1)):r<=255&&!n.compatibilityMode?(i=e.allocUnsafe(2+r),i[0]=217,i[1]=r,i.write(t,2)):r<=65535?(i=e.allocUnsafe(3+r),i[0]=218,i.writeUInt16BE(r,1),i.write(t,3)):(i=e.allocUnsafe(5+r),i[0]=219,i.writeUInt32BE(r,1),i.write(t,5));return i}(d,l);if(d&&(d.readUInt32LE||d instanceof Uint8Array))return d instanceof Uint8Array&&(d=e.from(d)),t([c(d.length),d]);if(Array.isArray(d))return function(e,n){const r=[s(e.length,144,220)];if(e.forEach(e=>{r.push(n(e))}),r.length!==e.length+1)throw new Error("Sparse arrays are not encodable in msgpack");return t(r)}(d,u);if("object"==typeof d)return function(e,n){const r=n.find(t=>t.check(e));if(!r)return null;const i=r.encode(e);return i?t([o(i.length-1),i]):null}(d,i)||function(e,n,r){const i=[];for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&void 0!==e[t]&&"function"!=typeof e[t]&&i.push(t);const a=[s(i.length,128,222)];n.sortKeys&&i.sort();return i.forEach(t=>{a.push(r(t),r(e[t]))}),t(a)}(d,l,u);if("number"==typeof d)return function(t,i){let o;if(n(t))return a(t,i.forceFloat64);if(Math.abs(t)>9007199254740991)return a(t,!0);if(t>=0){if(t<128)return e.from([t]);if(t<256)return e.from([204,t]);if(t<65536)return e.from([205,255&t>>8,255&t]);if(t<=4294967295)return e.from([206,255&t>>24,255&t>>16,255&t>>8,255&t]);t<=9007199254740991&&(o=e.allocUnsafe(9),o[0]=207,r(o,1,t))}else t>=-32?(o=e.allocUnsafe(1),o[0]=256+t):t>=-128?(o=e.allocUnsafe(2),o[0]=208,o.writeInt8(t,1)):t>=-32768?(o=e.allocUnsafe(3),o[0]=209,o.writeInt16BE(t,1)):t>-214748365?(o=e.allocUnsafe(5),o[0]=210,o.writeInt32BE(t,1)):t>=-9007199254740991&&(o=e.allocUnsafe(9),o[0]=211,function(e,t,n){const i=n<0;n=Math.abs(n),r(e,t,n),i&&function(e,t){let n=t+8;for(;n-- >t;)if(0!==e[n]){e[n]=1+(255^e[n]);break}for(;n-- >t;)e[n]=255^e[n]}(e,t)}(o,1,t));return o}(d,l);throw new Error("not implemented yet")}return function(e){return u(e).slice()}};const i=Math.fround;function a(t,n){let r;return!n&&i&&Object.is(i(t),t)?(r=e.allocUnsafe(5),r[0]=202,r.writeFloatBE(t,1)):(r=e.allocUnsafe(9),r[0]=203,r.writeDoubleBE(t,1)),r}function o(t){return 1===t?e.from([212]):2===t?e.from([213]):4===t?e.from([214]):8===t?e.from([215]):16===t?e.from([216]):t<256?e.from([199,t]):t<65536?e.from([200,t>>8,255&t]):e.from([201,t>>24,t>>16&255,t>>8&255,255&t])}function s(t,n,r){if(t<16)return e.from([n|t]);const i=t<65536?2:4,a=e.allocUnsafe(1+i);return a[0]=t<65536?r:r+1,a.writeUIntBE(t,1,i),a}function c(t){let n;return t<=255?(n=e.allocUnsafe(2),n[0]=196,n[1]=t):t<=65535?(n=e.allocUnsafe(3),n[0]=197,n.writeUInt16BE(t,1)):(n=e.allocUnsafe(5),n[0]=198,n.writeUInt32BE(t,1)),n}return Op}function jp(){if(kp)return Fp;kp=1;const e=Id().Buffer,t=Ki,n=wp(),r=function(){if(Ep)return Pp;Ep=1;const e=Cp().Transform,t=jd(),n=wp();function r(t){(t=t||{}).objectMode=!0,t.highWaterMark=16,e.call(this,t),this._msgpack=t.msgpack}function i(e){if(!(this instanceof i))return(e=e||{}).msgpack=this,new i(e);r.call(this,e),this._wrap="wrap"in e&&e.wrap}function a(e){if(!(this instanceof a))return(e=e||{}).msgpack=this,new a(e);r.call(this,e),this._chunks=n(),this._wrap="wrap"in e&&e.wrap}return t(r,e),t(i,r),i.prototype._transform=function(e,t,n){let r=null;try{r=this._msgpack.encode(this._wrap?e.value:e).slice(0)}catch(i){return this.emit("error",i),n()}this.push(r),n()},t(a,r),a.prototype._transform=function(e,t,n){e&&this._chunks.append(e);try{let e=this._msgpack.decode(this._chunks);this._wrap&&(e={value:e}),this.push(e)}catch(r){return void(r instanceof this._msgpack.IncompleteBufferError?n():this.emit("error",r))}this._chunks.length>0?this._transform(null,t,n):n()},Pp.decoder=a,Pp.encoder=i,Pp}(),i=Vp(),a=$p(),o=Up().IncompleteBufferError,s=Dp?Mp:(Dp=1,Mp={check:function(e){return"function"==typeof e.getDate},type:-1,encode:function(e){if(null===e)return;const t=1*e,n=Math.floor(t/1e3),r=1e6*(t-1e3*n);if(n<0||n>17179869184){const e=Buffer.allocUnsafe(13);e[0]=-1,e.writeUInt32BE(r,1);let t="";if(n>=0){const e="0000000000000000";t=n.toString(16),t=e.slice(0,-1*t.length)+t}else{let e=(-1*n).toString(2),r=e.length-1;for(;"0"===e[r];)r--;e=e.slice(0,r).split("").map(function(e){return"1"===e?0:1}).join("")+e.slice(r,e.length),e="1111111111111111111111111111111111111111111111111111111111111111".slice(0,-1*e.length)+e,e.match(/.{1,8}/g).forEach(function(e){1===(e=parseInt(e,2).toString(16)).length&&(e="0"+e),t+=e})}return e.write(t,5,"hex"),e}if(r||n>4294967295){const e=Buffer.allocUnsafe(9);e[0]=-1;const t=4*r+n/Math.pow(2,32)&4294967295,i=4294967295&n;return e.writeInt32BE(t,1),e.writeInt32BE(i,5),e}{const e=Buffer.allocUnsafe(5);return e[0]=-1,e.writeUInt32BE(Math.floor(t/1e3),1),e}},decode:function(e){let t,n,r,i,a=0;switch(e.length){case 4:t=e.readUInt32BE(0);break;case 8:n=e.readUInt32BE(0),r=e.readUInt32BE(4),a=n/4,t=(3&n)*Math.pow(2,32)+r;break;case 12:if(i=e.toString("hex",4,12),128&parseInt(e.toString("hex",4,6),16)){let e="";const n="00000000";i.match(/.{1,2}/g).forEach(function(t){t=parseInt(t,16).toString(2),t=n.slice(0,-1*t.length)+t,e+=t}),t=-1*parseInt(e.split("").map(function(e){return"1"===e?0:1}).join(""),2)-1}else t=parseInt(i,16);a=e.readUInt32BE(0)}const o=1e3*t+Math.round(a/1e6);return new Date(o)}});return Fp=function(c){const l=[],u=/* @__PURE__ */new Map;return c=c||{forceFloat64:!1,compatibilityMode:!1,disableTimestampEncoding:!1,preferMap:!1,protoAction:"error"},u.set(s.type,s.decode),c.disableTimestampEncoding||l.push(s),{encode:a(l,c),decode:i(u,c),register:function(r,i,a,o){return t(i,"must have a constructor"),t(a,"must have an encode function"),t(r>=0,"must have a non-negative type"),t(o,"must have a decode function"),this.registerEncoder(function(e){return e instanceof i},function(t){const i=n(),o=e.allocUnsafe(1);return o.writeInt8(r,0),i.append(o),i.append(a(t)),i}),this.registerDecoder(r,o),this},registerEncoder:function(e,n){return t(e,"must have an encode function"),t(n,"must have an encode function"),l.push({check:e,encode:n}),this},registerDecoder:function(e,n){return t(e>=0,"must have a non-negative type"),t(n,"must have a decode function"),u.set(e,n),this},encoder:r.encoder,decoder:r.decoder,buffer:!0,type:"msgpack5",IncompleteBufferError:o}}}function Wp(){return Gp||(Gp=1,function(e){var t=rd&&rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.AlpacaWebsocket=e.ERROR=e.CONN_ERROR=e.EVENT=e.STATE=void 0;const n=t(ad()),r=t(od()),i=t(jp());var a,o,s,c,l,u;(o=a||(e.STATE=a={})).AUTHENTICATING="authenticating",o.AUTHENTICATED="authenticated",o.CONNECTED="connected",o.CONNECTING="connecting",o.DISCONNECTED="disconnected",o.WAITING_TO_CONNECT="waiting to connect",o.WAITING_TO_RECONNECT="waiting to reconnect",(c=s||(e.EVENT=s={})).CLIENT_ERROR="client_error",c.STATE_CHANGE="state_change",c.AUTHORIZED="authorized",c.UNAUTHORIZED="unauthorized",c.TRADES="stock_trades",c.QUOTES="stock_quotes",c.BARS="stock_bars",c.UPDATED_BARS="stock_updated_bars",c.DAILY_BARS="stock_daily_bars",c.TRADING_STATUSES="trading_statuses",c.LULDS="lulds",c.CANCEL_ERRORS="cancel_errors",c.CORRECTIONS="corrections",c.ORDERBOOKS="orderbooks",c.NEWS="news",e.CONN_ERROR=/* @__PURE__ */new Map([[400,"invalid syntax"],[401,"not authenticated"],[402,"auth failed"],[403,"already authenticated"],[404,"auth timeout"],[405,"symbol limit exceeded"],[406,"connection limit exceeded"],[407,"slow client"],[408,"v2 not enabled"],[409,"insufficient subscription"],[500,"internal error"]]),(u=l||(e.ERROR=l={})).MISSING_SECERT_KEY="missing secret key",u.MISSING_API_KEY="missing api key",u.UNEXPECTED_MESSAGE="unexpected message";class d extends n.default.EventEmitter{constructor(e){super(),this.msgpack=(0,i.default)(),this.session={apiKey:e.apiKey,secretKey:e.secretKey,subscriptions:e.subscriptions,reconnect:!0,verbose:e.verbose,backoff:!0,reconnectTimeout:0,maxReconnectTimeout:30,backoffIncrement:.5,url:e.url,currentState:a.WAITING_TO_CONNECT,isReconnected:!1,pongWait:5e3},Object.values(a).forEach(e=>{this.on(e,()=>{this.emit(s.STATE_CHANGE,e)})})}connect(){if(this.emit(a.CONNECTING),this.session.currentState=a.CONNECTING,0===this.session.apiKey.length)throw new Error(l.MISSING_API_KEY);if(0===this.session.secretKey.length)throw new Error(l.MISSING_SECERT_KEY);this.resetSession(),this.conn=new r.default(this.session.url,{perMessageDeflate:{serverNoContextTakeover:!1,clientNoContextTakeover:!1},headers:{"Content-Type":"application/msgpack"}}),this.conn.binaryType="nodebuffer",this.conn.once("open",()=>this.authenticate()),this.conn.on("message",e=>{this.handleMessage(this.msgpack.decode(e))}),this.conn.on("error",e=>{this.emit(s.CLIENT_ERROR,e.message),this.disconnect()}),this.conn.on("close",(e,t)=>{this.log(`connection closed with code: ${e} and message: ${t}`),this.session.reconnect&&this.reconnect()}),this.conn.on("pong",()=>{this.session.pongTimeout&&clearTimeout(this.session.pongTimeout)}),this.session.pingInterval=setInterval(()=>{this.ping()},1e4),this.on(a.WAITING_TO_RECONNECT,e=>{this.log(`backoff: ${e}`)})}onConnect(e){this.on(a.AUTHENTICATED,()=>{this.session.isReconnected?this.subscribeAll():e()})}reconnect(){this.log("Reconnecting..."),this.session.isReconnected=!0;const{backoff:e,backoffIncrement:t,maxReconnectTimeout:n}=this.session;let r=this.session.reconnectTimeout;e&&setTimeout(()=>{r+=t,r>n&&(r=n),this.emit(a.WAITING_TO_RECONNECT,r),this.connect()},1e3*r)}ping(){this.conn.ping(),this.session.pongTimeout=setTimeout(()=>{this.log("no pong received from server, terminating..."),this.conn.terminate()},this.session.pongWait)}authenticate(){const e={action:"auth",key:this.session.apiKey,secret:this.session.secretKey};this.conn.send(this.msgpack.encode(e)),this.emit(a.AUTHENTICATING),this.session.currentState=a.AUTHENTICATING}disconnect(){this.emit(a.DISCONNECTED),this.session.currentState=a.DISCONNECTED,this.conn.close(),this.session.reconnect=!1,this.session.pongTimeout&&clearTimeout(this.session.pongTimeout),this.session.pingInterval&&clearInterval(this.session.pingInterval)}onDisconnect(e){this.on(a.DISCONNECTED,()=>e())}onError(e){this.on(s.CLIENT_ERROR,t=>e(t))}onStateChange(e){this.on(s.STATE_CHANGE,t=>e(t))}handleMessage(t){switch((null==t?void 0:t.length)?t[0].T:""){case"success":"connected"===t[0].msg?(this.emit(a.CONNECTED),this.session.currentState=a.CONNECTED):"authenticated"===t[0].msg&&(this.emit(a.AUTHENTICATED),this.session.currentState=a.AUTHENTICATED);break;case"subscription":this.updateSubscriptions(t[0]);break;case"error":this.emit(s.CLIENT_ERROR,e.CONN_ERROR.get(t[0].code));break;default:this.dataHandler(t)}}log(e){this.session.verbose&&console.log(e)}getSubscriptions(){return this.session.subscriptions}resetSession(){this.session.reconnect=!0,this.session.backoff=!0,this.session.reconnectTimeout=0,this.session.maxReconnectTimeout=30,this.session.backoffIncrement=.5,this.session.pongTimeout&&clearTimeout(this.session.pongTimeout),this.session.pingInterval&&clearInterval(this.session.pingInterval)}}e.AlpacaWebsocket=d}(rd)),rd}var Xp,Kp={};var Yp,qp={};var Qp,Jp={};var zp,Zp,eh,th,nh,rh={};function ih(){return eh||(eh=1,function(e){Object.defineProperty(e,"__esModule",{value:!0});const t=ad(),n=od(),r=function(){if(Zp)return zp;Zp=1;let e={T:"symbol",X:"askexchange",P:"askprice",S:"asksize",x:"bidexchange",p:"bidprice",s:"bidsize",c:"conditions",t:"timestamp"},t={T:"symbol",i:"tradeID",x:"exchange",p:"price",s:"size",t:"timestamp",z:"tapeID",c:"conditions"},n={T:"symbol",v:"volume",av:"accumulatedVolume",op:"officialOpenPrice",vw:"vwap",o:"openPrice",h:"highPrice",l:"lowPrice",c:"closePrice",a:"averagePrice",s:"startEpochTime",e:"endEpochTime"},r={t:"startEpochTime",o:"openPrice",h:"highPrice",l:"lowPrice",c:"closePrice",v:"volume"};function i(e,t){const n={};for(let[r,i]of Object.entries(e))t.hasOwnProperty(r)?n[t[r]]=i:n[r]=i;return n}return zp={AlpacaTrade:function(e){return i(e,t)},AlpacaQuote:function(t){return i(t,e)},AggMinuteBar:function(e){return i(e,n)},Bar:function(e){return i(e,r)}}}();var i,a,o,s,c,l;(a=i=e.STATE||(e.STATE={})).AUTHENTICATING="authenticating",a.CONNECTED="connected",a.CONNECTING="connecting",a.DISCONNECTED="disconnected",a.WAITING_TO_CONNECT="waiting to connect",a.WAITING_TO_RECONNECT="waiting to reconnect",(s=o=e.EVENT||(e.EVENT={})).CLIENT_ERROR="client_error",s.STATE_CHANGE="state_change",s.AUTHORIZED="authorized",s.UNAUTHORIZED="unauthorized",s.ORDER_UPDATE="trade_updates",s.ACCOUNT_UPDATE="account_updates",s.STOCK_TRADES="stock_trades",s.STOCK_QUOTES="stock_quotes",s.STOCK_AGG_SEC="stock_agg_sec",s.STOCK_AGG_MIN="stock_agg_min",(l=c=e.ERROR||(e.ERROR={})).BAD_KEY_OR_SECRET="bad key id or secret",l.CONNECTION_REFUSED="connection refused",l.MISSING_API_KEY="missing api key",l.MISSING_SECRET_KEY="missing secret key",l.UNKNOWN="unknown error";class u extends t.EventEmitter{constructor(e={}){super(),this.defaultOptions={subscriptions:[],reconnect:!0,backoff:!0,reconnectTimeout:0,maxReconnectTimeout:30,backoffIncrement:.5,verbose:!1,usePolygon:!1},!e.backoff&&e.reconnectTimeout<1&&(e.reconnectTimeout=1),this.session=Object.assign(this.defaultOptions,e),this.session.url=this.session.url.replace(/^http/,"ws")+"/stream",this.subscriptionState={},this.session.subscriptions.forEach(e=>{this.subscriptionState[e]=!0}),this.currentState=i.WAITING_TO_CONNECT,Object.keys(i).forEach(e=>{this.on(i[e],()=>{this.currentState=i[e],this.log("info",`state change: ${i[e]}`),this.emit(o.STATE_CHANGE,i[e])})}),Object.keys(c).forEach(e=>{this.on(c[e],()=>{this.log("error",c[e]),this.emit(o.CLIENT_ERROR,c[e])})})}connect(){if(0===this.session.apiKey.length&&0===this.session.oauth.length)throw new Error(c.MISSING_API_KEY);if(0===this.session.secretKey.length&&0===this.session.oauth.length)throw new Error(c.MISSING_SECRET_KEY);this.reconnectDisabled=!1,this.emit(i.CONNECTING),this.conn=new n(this.session.url),this.conn.once("open",()=>{this.authenticate()}),this.conn.on("message",e=>this.handleMessage(e)),this.conn.once("error",e=>{this.emit(c.CONNECTION_REFUSED)}),this.conn.once("close",()=>{this.emit(i.DISCONNECTED),this.session.reconnect&&!this.reconnectDisabled&&this.reconnect()})}_ensure_polygon(e){this.polygon.connectCalled?e&&this.polygon.subscribe(e):this.polygon.connect(e)}_unsubscribe_polygon(e){this.polygon.connectCalled&&e&&this.polygon.unsubscribe(e)}subscribe(e){let t=[],n=[];if(e.forEach(e=>{["Q.","T.","A.","AM."].filter(t=>e.startsWith(t)).length>0?n.push(e):t.push(e)}),t.length>0){const e={action:"listen",data:{streams:t}};this.send(JSON.stringify(e))}n.length>0&&this._ensure_polygon(n),e.forEach(e=>{this.subscriptionState[e]=!0})}unsubscribe(e){let t=[];e.forEach(e=>{["Q.","T.","A.","AM."].filter(t=>e.startsWith(t)).length>0&&t.push(e)}),t.length>0&&this._unsubscribe_polygon(t),e.forEach(e=>{this.subscriptionState[e]=!1})}subscriptions(){return Object.keys(this.subscriptionState).filter(e=>this.subscriptionState[e])}onConnect(e){this.on(i.CONNECTED,()=>e())}onDisconnect(e){this.on(i.DISCONNECTED,()=>e())}onStateChange(e){this.on(o.STATE_CHANGE,t=>e(t))}onError(e){this.on(o.CLIENT_ERROR,t=>e(t))}onOrderUpdate(e){this.on(o.ORDER_UPDATE,t=>e(t))}onAccountUpdate(e){this.on(o.ACCOUNT_UPDATE,t=>e(t))}onPolygonConnect(e){this.polygon.on(i.CONNECTED,()=>e())}onPolygonDisconnect(e){this.polygon.on(i.DISCONNECTED,()=>e())}onStockTrades(e){this.session.usePolygon?this.polygon.on(o.STOCK_TRADES,function(t,n){e(t,n)}):this.on(o.STOCK_TRADES,function(t,n){e(t,n)})}onStockQuotes(e){this.session.usePolygon?this.polygon.on(o.STOCK_QUOTES,function(t,n){e(t,n)}):this.on(o.STOCK_QUOTES,function(t,n){e(t,n)})}onStockAggSec(e){this.polygon.on(o.STOCK_AGG_SEC,function(t,n){e(t,n)})}onStockAggMin(e){this.session.usePolygon?this.polygon.on(o.STOCK_AGG_MIN,function(t,n){e(t,n)}):this.on(o.STOCK_AGG_MIN,function(t,n){e(t,n)})}send(e){this.conn.send(e)}disconnect(){this.reconnectDisabled=!0,this.conn.close(),this.polygon&&this.polygon.close()}state(){return this.currentState}get(e){return this.session[e]}reconnect(){setTimeout(()=>{this.session.backoff&&(this.session.reconnectTimeout+=this.session.backoffIncrement,this.session.reconnectTimeout>this.session.maxReconnectTimeout&&(this.session.reconnectTimeout=this.session.maxReconnectTimeout)),this.connect()},1e3*this.session.reconnectTimeout),this.emit(i.WAITING_TO_RECONNECT,this.session.reconnectTimeout)}authenticate(){this.emit(i.AUTHENTICATING);const e={action:"authenticate",data:{key_id:this.session.apiKey,secret_key:this.session.secretKey}};this.send(JSON.stringify(e))}handleMessage(e){const t=new Uint8Array(e);if(1===t.length&&1===t[0])return;let n=JSON.parse(e);const i=n.stream;switch("error"in n.data&&console.log(n.data.error),i){case"authorization":this.authResultHandler(n.data.status);break;case"listening":this.log(`listening to the streams: ${n.data.streams}`);break;case"trade_updates":this.emit(o.ORDER_UPDATE,n.data);break;case"account_updates":this.emit(o.ACCOUNT_UPDATE,n.data);break;default:n.stream.startsWith("T.")?this.emit(o.STOCK_TRADES,i,r.AlpacaTrade(n.data)):n.stream.startsWith("Q.")?this.emit(o.STOCK_QUOTES,i,r.AlpacaQuote(n.data)):n.stream.startsWith("AM.")?this.emit(o.STOCK_AGG_MIN,i,r.AggMinuteBar(n.data)):this.emit(c.PROTOBUF)}}authResultHandler(e){switch(e){case"authorized":this.emit(i.CONNECTED);break;case"unauthorized":this.emit(c.BAD_KEY_OR_SECRET),this.disconnect()}}log(e,...t){this.session.verbose&&console[e](...t)}}e.AlpacaStreamClient=u}(rh)),rh}function ah(){if(nh)return th;nh=1,u.config();const e=function(){if(Ji)return Qi;Ji=1;const e=d,t=zi();return Qi={httpRequest:function(n,r,i,a){const{baseUrl:o,keyId:s,secretKey:c,apiVersion:l,oauth:u}=this.configuration,d={method:a||"GET",url:t(o,l,n),params:r||{},headers:""!==u?{"content-type":"DELETE"!==a?"application/json":"",Authorization:"Bearer "+u}:{"content-type":"DELETE"!==a?"application/json":"","APCA-API-KEY-ID":s,"APCA-API-SECRET-KEY":c},data:i||void 0};return e(d)},dataHttpRequest:function(n,r,i,a){const{dataBaseUrl:o,keyId:s,secretKey:c,oauth:l}=this.configuration,u={method:a||"GET",url:t(o,"v1",n),params:r||{},headers:""!==l?{"content-type":"DELETE"!==a?"application/json":"",Authorization:"Bearer "+l}:{"content-type":"DELETE"!==a?"application/json":"","APCA-API-KEY-ID":s,"APCA-API-SECRET-KEY":c},data:i||void 0};return e(u)},sendRequest:function(e,t,n,r,i){return e(t,n,r,i).then(e=>e.data)}}}(),t=function(){if(ta)return ea;ta=1;const{omitBy:e,isNil:t}=Ia();return ea={get:function(){return this.sendRequest("/account")},getConfigs:function(){return this.sendRequest("/account/configurations")},updateConfigs:function(e){return this.sendRequest("/account/configurations",null,e,"PATCH")},getActivities:function({activityTypes:n,until:r,after:i,direction:a,date:o,pageSize:s,pageToken:c}){Array.isArray(n)&&(n=n.join(","));const l=e({activity_types:n,until:r,after:i,direction:a,date:o,page_size:s,page_token:c},t);return this.sendRequest("/account/activities",l)},getPortfolioHistory:function({date_start:n,date_end:r,period:i,timeframe:a,extended_hours:o}){const s=e({date_start:n,date_end:r,period:i,timeframe:a,extended_hours:o},t);return this.sendRequest("/account/portfolio/history",s)}}}(),n=ra?na:(ra=1,na={getAll:function(){return this.sendRequest("/positions")},getOne:function(e){return this.sendRequest("/positions/"+e)},closeAll:function(){return this.sendRequest("/positions",null,null,"DELETE")},closeOne:function(e){return this.sendRequest("/positions/"+e,null,null,"DELETE")}}),r=Ca(),i=la?ca:(la=1,ca={get:function(){return this.sendRequest("/clock")}}),a=da?ua:(da=1,ua={getAll:function(e={}){return this.sendRequest("/assets",e)},getOne:function(e){return this.sendRequest("/assets/"+e)}}),o=function(){if(ha)return pa;ha=1;const{omitBy:e,isNil:t}=Ia();return pa={getAll:function({status:n,until:r,after:i,limit:a,direction:o,nested:s,symbols:c}={}){const l=e({status:n,until:r,after:i,limit:a,direction:o,nested:s,symbols:c},t);return this.sendRequest("/orders",l)},getOne:function(e){return this.sendRequest("/orders/"+e)},getByClientOrderId:function(e){const t={client_order_id:e};return this.sendRequest("/orders:by_client_order_id",t)},post:function(e){return this.sendRequest("/orders",null,e,"POST")},patchOrder:function(e,t){return this.sendRequest(`/orders/${e}`,null,t,"PATCH")},cancel:function(e){return this.sendRequest("/orders/"+e,null,null,"DELETE")},cancelAll:function(){return this.sendRequest("/orders",null,null,"DELETE")}}}(),s=ma?fa:(ma=1,fa={getAll:function(){return this.sendRequest("/watchlists")},getOne:function(e){return this.sendRequest(`/watchlists/${e}`)},addWatchlist:function(e,t=void 0){const n={name:e,symbols:t};return this.sendRequest("/watchlists",null,n,"POST")},addToWatchlist:function(e,t){const n={symbol:t};return this.sendRequest(`/watchlists/${e}`,null,n,"POST")},updateWatchlist:function(e,t){return this.sendRequest(`/watchlists/${e}`,null,t,"PUT")},deleteWatchlist:function(e){return this.sendRequest(`/watchlists/${e}`,null,null,"DELETE")},deleteFromWatchlist:function(e,t){return this.sendRequest(`/watchlists/${e}/${t}`,null,null,"DELETE")}}),c=zu(),l=Ju(),p=function(){if(Hp)return nd;Hp=1,Object.defineProperty(nd,"__esModule",{value:!0}),nd.AlpacaCryptoClient=void 0;const e=Ju(),t=Wp(),n=/* @__PURE__ */new Map([["t",{event:t.EVENT.TRADES,parse:e.AlpacaCryptoTrade}],["q",{event:t.EVENT.QUOTES,parse:e.AlpacaCryptoQuote}],["b",{event:t.EVENT.BARS,parse:e.AlpacaCryptoBar}],["u",{event:t.EVENT.UPDATED_BARS,parse:e.AlpacaCryptoBar}],["d",{event:t.EVENT.DAILY_BARS,parse:e.AlpacaCryptoBar}],["o",{event:t.EVENT.ORDERBOOKS,parse:e.AlpacaCryptoOrderbook}]]);class r extends t.AlpacaWebsocket{constructor(e){e.url=e.url.replace("https","wss")+"/v1beta3/crypto/us",e.subscriptions={trades:[],quotes:[],bars:[],updatedBars:[],dailyBars:[],orderbooks:[]},super(e)}subscribeForTrades(e){this.session.subscriptions.trades.push(...e),this.subscribe({trades:e})}subscribeForQuotes(e){this.session.subscriptions.quotes.push(...e),this.subscribe({quotes:e})}subscribeForBars(e){this.session.subscriptions.bars.push(...e),this.subscribe({bars:e})}subscribeForUpdatedBars(e){this.session.subscriptions.updatedBars.push(...e),this.subscribe({updatedBars:e})}subscribeForDailyBars(e){this.session.subscriptions.dailyBars.push(...e),this.subscribe({dailyBars:e})}subscribeForOrderbooks(e){this.session.subscriptions.orderbooks.push(...e),this.subscribe({orderbooks:e})}subscribe(e){var t,n,r,i,a,o;const s={action:"subscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],orderbooks:null!==(o=e.orderbooks)&&void 0!==o?o:[]};this.conn.send(this.msgpack.encode(s))}subscribeAll(){this.subscribe(this.session.subscriptions)}unsubscribeFromTrades(e){this.session.subscriptions.trades=this.session.subscriptions.trades.filter(t=>!e.includes(t)),this.unsubscribe({trades:e})}unsubscribeFromQuotes(e){this.session.subscriptions.quotes=this.session.subscriptions.quotes.filter(t=>!e.includes(t)),this.unsubscribe({quotes:e})}unsubscribeFromBars(e){this.session.subscriptions.bars=this.session.subscriptions.bars.filter(t=>!e.includes(t)),this.unsubscribe({bars:e})}unsubscribeFromUpdatedBars(e){this.session.subscriptions.updatedBars=this.session.subscriptions.updatedBars.filter(t=>!e.includes(t)),this.unsubscribe({updatedBars:e})}unsubscriceFromDailyBars(e){this.session.subscriptions.dailyBars=this.session.subscriptions.dailyBars.filter(t=>!e.includes(t)),this.unsubscribe({dailyBars:e})}unsubscribeFromOrderbooks(e){this.session.subscriptions.orderbooks=this.session.subscriptions.orderbooks.filter(t=>!e.includes(t)),this.unsubscribe({orderbooks:e})}unsubscribe(e){var t,n,r,i,a,o;const s={action:"unsubscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],orderbooks:null!==(o=e.orderbooks)&&void 0!==o?o:[]};this.conn.send(this.msgpack.encode(s))}updateSubscriptions(e){this.session.subscriptions={trades:e.trades,quotes:e.quotes,bars:e.bars,updatedBars:e.updatedBars,dailyBars:e.dailyBars,orderbooks:e.orderbooks},this.log(`listening to streams:\n ${JSON.stringify(this.session.subscriptions)}`)}onCryptoTrade(e){this.on(t.EVENT.TRADES,t=>e(t))}onCryptoQuote(e){this.on(t.EVENT.QUOTES,t=>e(t))}onCryptoBar(e){this.on(t.EVENT.BARS,t=>e(t))}onCryptoUpdatedBar(e){this.on(t.EVENT.UPDATED_BARS,t=>e(t))}onCryptoDailyBar(e){this.on(t.EVENT.DAILY_BARS,t=>e(t))}onCryptoOrderbook(e){this.on(t.EVENT.ORDERBOOKS,t=>e(t))}dataHandler(e){e.forEach(e=>{if("T"in e){const r=n.get(e.T);r?this.emit(r.event,r.parse(e)):this.emit(t.EVENT.CLIENT_ERROR,t.ERROR.UNEXPECTED_MESSAGE)}})}}return nd.AlpacaCryptoClient=r,nd}(),h=function(){if(Xp)return Kp;Xp=1,Object.defineProperty(Kp,"__esModule",{value:!0}),Kp.AlpacaNewsCLient=void 0;const e=Wp(),t=Ju(),n=Wp();class r extends n.AlpacaWebsocket{constructor(e){const t="wss"+e.url.substr(e.url.indexOf(":"))+"/v1beta1/news";e.url=t,e.subscriptions={news:[]},super(e)}subscribeForNews(e){this.session.subscriptions.news.push(...e),this.subscribe(e)}subscribe(e){const t={action:"subscribe",news:e};console.log("subscribing",t),this.conn.send(this.msgpack.encode(t))}subscribeAll(){this.session.subscriptions.news.length>0&&this.subscribe(this.session.subscriptions.news)}unsubscribeFromNews(e){this.session.subscriptions.news=this.session.subscriptions.news.filter(t=>!e.includes(t)),this.unsubscribe(e)}unsubscribe(e){const t={action:"unsubscribe",news:e};this.conn.send(this.msgpack.encode(t))}updateSubscriptions(e){this.log(`listening to streams:\n news: ${e.news}`),this.session.subscriptions={news:e.news}}onNews(t){this.on(e.EVENT.NEWS,e=>t(e))}dataHandler(n){n.forEach(n=>{"T"in n&&"n"===n.T?this.emit(e.EVENT.NEWS,(0,t.AlpacaNews)(n)):this.emit(e.EVENT.CLIENT_ERROR,e.ERROR.UNEXPECTED_MESSAGE)})}}return Kp.AlpacaNewsCLient=r,Kp}(),f=function(){if(Yp)return qp;Yp=1,Object.defineProperty(qp,"__esModule",{value:!0}),qp.AlpacaStocksClient=void 0;const e=Ju(),t=Wp();class n extends t.AlpacaWebsocket{constructor(e){const t="wss"+e.url.substr(e.url.indexOf(":"))+"/v2/"+e.feed;e.url=t,e.subscriptions={trades:[],quotes:[],bars:[],updatedBars:[],dailyBars:[],statuses:[],lulds:[],cancelErrors:[],corrections:[]},super(e)}subscribeForTrades(e){this.session.subscriptions.trades.push(...e),this.subscribe({trades:e})}subscribeForQuotes(e){this.session.subscriptions.quotes.push(...e),this.subscribe({quotes:e})}subscribeForBars(e){this.session.subscriptions.bars.push(...e),this.subscribe({bars:e})}subscribeForUpdatedBars(e){this.session.subscriptions.updatedBars.push(...e),this.subscribe({updatedBars:e})}subscribeForDailyBars(e){this.session.subscriptions.dailyBars.push(...e),this.subscribe({dailyBars:e})}subscribeForStatuses(e){this.session.subscriptions.statuses.push(...e),this.subscribe({statuses:e})}subscribeForLulds(e){this.session.subscriptions.lulds.push(...e),this.subscribe({lulds:e})}subscribe(e){var t,n,r,i,a,o,s;const c={action:"subscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],statuses:null!==(o=e.statuses)&&void 0!==o?o:[],lulds:null!==(s=e.lulds)&&void 0!==s?s:[]};this.conn.send(this.msgpack.encode(c))}subscribeAll(){this.subscribe(this.session.subscriptions)}unsubscribeFromTrades(e){this.session.subscriptions.trades=this.session.subscriptions.trades.filter(t=>!e.includes(t)),this.unsubscribe({trades:e})}unsubscribeFromQuotes(e){this.session.subscriptions.quotes=this.session.subscriptions.quotes.filter(t=>!e.includes(t)),this.unsubscribe({quotes:e})}unsubscribeFromBars(e){this.session.subscriptions.bars=this.session.subscriptions.bars.filter(t=>!e.includes(t)),this.unsubscribe({bars:e})}unsubscribeFromUpdatedBars(e){this.session.subscriptions.updatedBars=this.session.subscriptions.updatedBars.filter(t=>!e.includes(t)),this.unsubscribe({updatedBars:e})}unsubscribeFromDailyBars(e){this.session.subscriptions.dailyBars=this.session.subscriptions.dailyBars.filter(t=>!e.includes(t)),this.unsubscribe({dailyBars:e})}unsubscribeFromStatuses(e){this.session.subscriptions.statuses=this.session.subscriptions.statuses.filter(t=>!e.includes(t)),this.unsubscribe({statuses:e})}unsubscribeFromLulds(e){this.session.subscriptions.lulds=this.session.subscriptions.lulds.filter(t=>!e.includes(t)),this.unsubscribe({lulds:e})}unsubscribe(e){var t,n,r,i,a,o,s;const c={action:"unsubscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[],bars:null!==(r=e.bars)&&void 0!==r?r:[],updatedBars:null!==(i=e.updatedBars)&&void 0!==i?i:[],dailyBars:null!==(a=e.dailyBars)&&void 0!==a?a:[],statuses:null!==(o=e.statuses)&&void 0!==o?o:[],lulds:null!==(s=e.lulds)&&void 0!==s?s:[]};this.conn.send(this.msgpack.encode(c))}updateSubscriptions(e){this.log(`listening to streams:\n trades: ${e.trades},\n quotes: ${e.quotes},\n bars: ${e.bars},\n updatedBars: ${e.updatedBars},\n dailyBars: ${e.dailyBars},\n statuses: ${e.statuses},\n lulds: ${e.lulds},\n cancelErrors: ${e.cancelErrors},\n corrections: ${e.corrections}`),this.session.subscriptions={trades:e.trades,quotes:e.quotes,bars:e.bars,updatedBars:e.updatedBars,dailyBars:e.dailyBars,statuses:e.statuses,lulds:e.lulds,cancelErrors:e.cancelErrors,corrections:e.corrections}}onStockTrade(e){this.on(t.EVENT.TRADES,t=>e(t))}onStockQuote(e){this.on(t.EVENT.QUOTES,t=>e(t))}onStockBar(e){this.on(t.EVENT.BARS,t=>e(t))}onStockUpdatedBar(e){this.on(t.EVENT.UPDATED_BARS,t=>e(t))}onStockDailyBar(e){this.on(t.EVENT.DAILY_BARS,t=>e(t))}onStatuses(e){this.on(t.EVENT.TRADING_STATUSES,t=>e(t))}onLulds(e){this.on(t.EVENT.LULDS,t=>e(t))}onCancelErrors(e){this.on(t.EVENT.CANCEL_ERRORS,t=>e(t))}onCorrections(e){this.on(t.EVENT.CORRECTIONS,t=>e(t))}dataHandler(n){n.forEach(n=>{if("T"in n)switch(n.T){case"t":this.emit(t.EVENT.TRADES,(0,e.AlpacaTradeV2)(n));break;case"q":this.emit(t.EVENT.QUOTES,(0,e.AlpacaQuoteV2)(n));break;case"b":this.emit(t.EVENT.BARS,(0,e.AlpacaBarV2)(n));break;case"u":this.emit(t.EVENT.UPDATED_BARS,(0,e.AlpacaBarV2)(n));break;case"d":this.emit(t.EVENT.DAILY_BARS,(0,e.AlpacaBarV2)(n));break;case"s":this.emit(t.EVENT.TRADING_STATUSES,(0,e.AlpacaStatusV2)(n));break;case"l":this.emit(t.EVENT.LULDS,(0,e.AlpacaLuldV2)(n));break;case"x":this.emit(t.EVENT.CANCEL_ERRORS,(0,e.AlpacaCancelErrorV2)(n));break;case"c":this.emit(t.EVENT.CORRECTIONS,(0,e.AlpacaCorrectionV2)(n));break;default:this.emit(t.EVENT.CLIENT_ERROR,t.ERROR.UNEXPECTED_MESSAGE)}})}}return qp.AlpacaStocksClient=n,qp}(),m=function(){if(Qp)return Jp;Qp=1,Object.defineProperty(Jp,"__esModule",{value:!0}),Jp.AlpacaOptionClient=void 0;const e=Ju(),t=Wp();class n extends t.AlpacaWebsocket{constructor(e){const t="wss"+e.url.substr(e.url.indexOf(":"))+"/v1beta1/"+e.feed;e.url=t,e.subscriptions={trades:[],quotes:[]},super(e)}subscribeForTrades(e){this.session.subscriptions.trades.push(...e),this.subscribe({trades:e})}subscribeForQuotes(e){this.session.subscriptions.quotes.push(...e),this.subscribe({quotes:e})}subscribe(e){var t,n;const r={action:"subscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[]};this.conn.send(this.msgpack.encode(r))}subscribeAll(){this.subscribe(this.session.subscriptions)}unsubscribeFromTrades(e){this.session.subscriptions.trades=this.session.subscriptions.trades.filter(t=>!e.includes(t)),this.unsubscribe({trades:e})}unsubscribeFromQuotes(e){this.session.subscriptions.quotes=this.session.subscriptions.quotes.filter(t=>!e.includes(t)),this.unsubscribe({quotes:e})}unsubscribe(e){var t,n;const r={action:"unsubscribe",trades:null!==(t=e.trades)&&void 0!==t?t:[],quotes:null!==(n=e.quotes)&&void 0!==n?n:[]};this.conn.send(this.msgpack.encode(r))}updateSubscriptions(e){this.log(`listening to streams:\n trades: ${e.trades},\n quotes: ${e.quotes}`),this.session.subscriptions={trades:e.trades,quotes:e.quotes}}onOptionTrade(e){this.on(t.EVENT.TRADES,t=>e(t))}onOptionQuote(e){this.on(t.EVENT.QUOTES,t=>e(t))}dataHandler(n){n.forEach(n=>{if("T"in n)switch(n.T){case"t":this.emit(t.EVENT.TRADES,(0,e.AlpacaOptionTradeV1Beta1)(n));break;case"q":this.emit(t.EVENT.QUOTES,(0,e.AlpacaOptionQuoteV1Beta1)(n));break;default:this.emit(t.EVENT.CLIENT_ERROR,t.ERROR.UNEXPECTED_MESSAGE)}})}}return Jp.AlpacaOptionClient=n,Jp}(),g=ih();return th=class{constructor(u={}){this.httpRequest=e.httpRequest.bind(this),this.dataHttpRequest=e.dataHttpRequest,this.getAccount=t.get,this.updateAccountConfigurations=t.updateConfigs,this.getAccountConfigurations=t.getConfigs,this.getAccountActivities=t.getActivities,this.getPortfolioHistory=t.getPortfolioHistory,this.getPositions=n.getAll,this.getPosition=n.getOne,this.closeAllPositions=n.closeAll,this.closePosition=n.closeOne,this.getCalendar=r.get,this.getClock=i.get,this.getAssets=a.getAll,this.getAsset=a.getOne,this.getOrders=o.getAll,this.getOrder=o.getOne,this.getOrderByClientId=o.getByClientOrderId,this.createOrder=o.post,this.replaceOrder=o.patchOrder,this.cancelOrder=o.cancel,this.cancelAllOrders=o.cancelAll,this.getWatchlists=s.getAll,this.getWatchlist=s.getOne,this.addWatchlist=s.addWatchlist,this.addToWatchlist=s.addToWatchlist,this.updateWatchlist=s.updateWatchlist,this.deleteWatchlist=s.deleteWatchlist,this.deleteFromWatchlist=s.deleteFromWatchlist,this.configuration={baseUrl:u.baseUrl||process.env.APCA_API_BASE_URL||(u.paper?"https://paper-api.alpaca.markets":"https://api.alpaca.markets"),dataBaseUrl:u.dataBaseUrl||process.env.APCA_DATA_BASE_URL||process.env.DATA_PROXY_WS||"https://data.alpaca.markets",dataStreamUrl:u.dataStreamUrl||process.env.APCA_API_STREAM_URL||"https://stream.data.alpaca.markets",keyId:u.keyId||process.env.APCA_API_KEY_ID||"",secretKey:u.secretKey||process.env.APCA_API_SECRET_KEY||"",apiVersion:u.apiVersion||process.env.APCA_API_VERSION||"v2",oauth:u.oauth||process.env.APCA_API_OAUTH||"",feed:u.feed||"iex",optionFeed:u.optionFeed||"indicative",verbose:u.verbose},this.data_ws=new g.AlpacaStreamClient({url:this.configuration.dataBaseUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,oauth:this.configuration.oauth}),this.data_ws.STATE=g.STATE,this.data_ws.EVENT=g.EVENT,this.data_ws.ERROR=g.ERROR,this.trade_ws=new g.AlpacaStreamClient({url:this.configuration.baseUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,oauth:this.configuration.oauth}),this.trade_ws.STATE=g.STATE,this.trade_ws.EVENT=g.EVENT,this.trade_ws.ERROR=g.ERROR,this.data_stream_v2=new f.AlpacaStocksClient({url:this.configuration.dataStreamUrl,feed:this.configuration.feed,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose}),this.adjustment=c.Adjustment,this.timeframeUnit=l.TimeFrameUnit,this.crypto_stream_v1beta3=new p.AlpacaCryptoClient({url:this.configuration.dataStreamUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose}),this.news_stream=new h.AlpacaNewsCLient({url:this.configuration.dataStreamUrl,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose}),this.option_stream=new m.AlpacaOptionClient({url:this.configuration.dataStreamUrl,feed:this.configuration.optionFeed,apiKey:this.configuration.keyId,secretKey:this.configuration.secretKey,verbose:this.configuration.verbose})}sendRequest(t,n,r,i){return e.sendRequest(this.httpRequest,t,n,r,i)}getTradesV2(e,t,n=this.configuration){return c.getTrades(e,t,n)}getMultiTradesV2(e,t,n=this.configuration){return c.getMultiTrades(e,t,n)}getMultiTradesAsyncV2(e,t,n=this.configuration){return c.getMultiTradesAsync(e,t,n)}getQuotesV2(e,t,n=this.configuration){return c.getQuotes(e,t,n)}getMultiQuotesV2(e,t,n=this.configuration){return c.getMultiQuotes(e,t,n)}getMultiQuotesAsyncV2(e,t,n=this.configuration){return c.getMultiQuotesAsync(e,t,n)}getBarsV2(e,t,n=this.configuration){return c.getBars(e,t,n)}getMultiBarsV2(e,t,n=this.configuration){return c.getMultiBars(e,t,n)}getMultiBarsAsyncV2(e,t,n=this.configuration){return c.getMultiBarsAsync(e,t,n)}getLatestTrade(e,t=this.configuration){return c.getLatestTrade(e,t)}getLatestTrades(e,t=this.configuration){return c.getLatestTrades(e,t)}getLatestQuote(e,t=this.configuration){return c.getLatestQuote(e,t)}getLatestQuotes(e,t=this.configuration){return c.getLatestQuotes(e,t)}getLatestBar(e,t=this.configuration){return c.getLatestBar(e,t)}getLatestBars(e,t=this.configuration){return c.getLatestBars(e,t)}getSnapshot(e,t=this.configuration){return c.getSnapshot(e,t)}getSnapshots(e,t=this.configuration){return c.getSnapshots(e,t)}getCryptoTrades(e,t,n=this.configuration){return c.getCryptoTrades(e,t,n)}getCryptoQuotes(e,t,n=this.configuration){return c.getCryptoQuotes(e,t,n)}getCryptoBars(e,t,n=this.configuration){return c.getCryptoBars(e,t,n)}getLatestCryptoTrades(e,t=this.configuration){return c.getLatestCryptoTrades(e,t)}getLatestCryptoQuotes(e,t=this.configuration){return c.getLatestCryptoQuotes(e,t)}getLatestCryptoBars(e,t=this.configuration){return c.getLatestCryptoBars(e,t)}getCryptoSnapshots(e,t=this.configuration){return c.getCryptoSnapshots(e,t)}getCryptoOrderbooks(e,t=this.configuration){return c.getLatestCryptoOrderbooks(e,t)}getOptionBars(e,t,n=this.configuration){return c.getMultiOptionBars(e,t,n)}getOptionTrades(e,t,n=this.configuration){return c.getMultiOptionTrades(e,t,n)}getOptionLatestTrades(e,t=this.configuration){return c.getLatestOptionTrades(e,t)}getOptionLatestQuotes(e,t=this.configuration){return c.getLatestOptionQuotes(e,t)}getOptionSnapshots(e,t=this.configuration){return c.getOptionSnapshots(e,t)}getOptionChain(e,t,n=this.configuration){return c.getOptionChain(e,t,n)}getCorporateActions(e,t,n=this.configuration){return c.getCorporateActions(e,t,n)}getNews(e,t=this.configuration){return c.getNews(e,t)}newTimeframe(e,t){return l.NewTimeframe(e,t)}},th}var oh,sh=ji.exports;const ch=/* @__PURE__ */xi((oh||(oh=1,function(e,t){var n=sh&&sh.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const r=n(ah());t.default=r.default,e.exports=r.default}(ji,ji.exports)),ji.exports));function lh(e){const t=e?.keyId||process.env.ALPACA_API_KEY||process.env.ALPACA_KEY_ID||process.env.APCA_API_KEY_ID||"",n=e?.secretKey||process.env.ALPACA_SECRET||process.env.ALPACA_SECRET_KEY||process.env.APCA_API_SECRET_KEY||"",r=e?.paper??!0;t&&n?console.log(`[Alpaca] Client initialized with API key: ${t.substring(0,4)}...${t.substring(t.length-4)}`):console.warn("[Alpaca] API keys missing - check .env or user settings. Expected: ALPACA_API_KEY and ALPACA_SECRET (or APCA_API_KEY_ID and APCA_API_SECRET_KEY)");let i=e?.baseUrl;return i||(i=r?process.env.ALPACA_BASE_URL||process.env.APCA_API_BASE_URL||"https://paper-api.alpaca.markets":process.env.ALPACA_BASE_URL||process.env.APCA_API_BASE_URL||"https://api.alpaca.markets"),new ch({keyId:t,secretKey:n,paper:r,baseUrl:i,usePolygon:!1})}function uh(e){const t=e?.keyId||process.env.ALPACA_BROKER_API_KEY||process.env.ALPACA_API_KEY||"",n=e?.secretKey||process.env.ALPACA_BROKER_SECRET_KEY||process.env.ALPACA_SECRET||"",r=e?.baseUrl||process.env.ALPACA_BROKER_BASE_URL||"https://broker-api.alpaca.markets";if(!t||!n)throw new Error("Alpaca Broker API keys missing - check .env");return new ch({keyId:t,secretKey:n,baseUrl:r,paper:!1})}const dh=/* @__PURE__ */JSON.parse('[["A","Agilent Technologies Inc.",71,38908,0],["AA","Alcoa Corporation",102,13272,0],["AAA","AAA",1,0,0],["AAAC","AAAC",1,0,0],["AACB","Artius II Acquisition Inc. Class A",1,0,0],["AACBU","Artius II Acquisition Inc.",2,0,0],["AACG","ATA Creativity Global",3,28,0],["AADR","AADR",1,0,0],["AAEQ","AAEQ",1,0,0],["AAL","American Airlines Group Inc.",4,10416,0],["AALG","AALG",1,0,0],["AAM","AA Mission Acquisition Corp. Class A",1,0,0],["AAM.U","AAM.U",1,0,0],["AAME","Atlantic American Corporation",5,66,0],["AAMI","Acadian Asset Management Inc.",11,1698,0],["AAOI","Applied Optoelectronics Inc.",6,2138,0],["AAON","AAON Inc.",7,6150,0],["AAP","Advance Auto Parts Inc.",141,2425,0],["AAPB","AAPB",1,0,0],["AAPD","AAPD",1,0,0],["AAPG","Ascentage Pharma Group International American Depository Shares",8,2552,0],["AAPL","Apple Inc.",9,4043845,0],["AAPU","AAPU",1,0,0],["AARD","Aardvark Therapeutics Inc.",8,300,0],["AAT","American Assets Trust Inc.",30,1147,0],["AAUC","Allied Gold Corporation",1,2887,0],["AAUS","AAUS",1,0,0],["AAVM","AAVM",1,0,0],["AAXJ","AAXJ",1,0,0],["AB","AllianceBernstein Holding L.P. ",11,3577,0],["ABAT","American Battery Technology Company",10,516,0],["ABBV","AbbVie Inc.",8,400878,0],["ABCB","Ameris Bancorp",26,5297,0],["ABCL","AbCellera Biologics Inc.",8,1061,0],["ABCS","ABCS",1,0,0],["ABEO","Abeona Therapeutics Inc.",8,277,0],["ABEQ","ABEQ",1,0,0],["ABEV","Ambev S.A.",46,38985,0],["ABG","Asbury Automotive Group Inc",97,4605,0],["ABI","ABI",1,0,0],["ABIG","ABIG",1,0,0],["ABL","Abacus Global Management Inc. Class A",11,832,0],["ABLLL","Abacus Global Management Inc. 9.875% Fixed Rate Senior Notes due 2028",11,1896,0],["ABLV","Able View Global Inc. Class B",3,40,0],["ABM","ABM Industries Incorporated",12,2582,0],["ABNB","Airbnb Inc. Class A",12,83272,0],["ABNG","ABNG",1,0,0],["ABNY","ABNY",1,0,0],["ABOS","Acumen Pharmaceuticals Inc.",13,130,0],["ABP","Abpro Holdings Inc",8,14,0],["ABR","Arbor Realty Trust",30,1560,0],["ABR/PD","ABR/PD",1,0,0],["ABR/PE","ABR/PE",1,0,0],["ABR/PF","ABR/PF",1,0,0],["ABSI","Absci Corporation",14,508,0],["ABT","Abbott Laboratories",8,218141,0],["ABTC","American Bitcoin Corp. Class A",15,1651,0],["ABTS","Abits Group Inc",16,13,0],["ABUS","Arbutus Biopharma Corporation",8,852,0],["ABVC","ABVC BioPharma Inc.",8,53,0],["ABVE","Above Food Ingredients Inc.",17,87,0],["ABVX","Abivax SA",8,8931,0],["ACA","Arcosa Inc.",55,5455,0],["ACAD","ACADIA Pharmaceuticals Inc.",8,4595,0],["ACB","Aurora Cannabis Inc.",18,281,0],["ACCL","Acco Group Holdings Limited",19,44,0],["ACCO","Acco Brands Corporation",109,342,0],["ACCS","ACCESS Newswire Inc.",109,34,0],["ACDC","ProFrac Holding Corp. Class A",20,689,0],["ACEI","ACEI",1,0,0],["ACEL","Accel Entertainment Inc.",45,929,0],["ACEP","ACEP",1,0,0],["ACES","ACES",1,0,0],["ACET","Adicet Bio Inc.",8,76,0],["ACFN","Acorn Energy Inc.",21,38,0],["ACGL","Arch Capital Group Ltd.",22,34885,0],["ACGLN","Arch Capital Group Ltd.",22,6110,0],["ACGLO","Arch Capital Group Ltd.",22,7370,0],["ACGR","ACGR",1,0,0],["ACHC","Acadia Healthcare Company Inc.",23,1329,0],["ACHR","Archer Aviation Inc. Class A",50,5327,0],["ACHV","Achieve Life Sciences Inc.",24,230,0],["ACI","Albertsons Companies Inc. Class A",67,9574,0],["ACIC","American Coastal Insurance Corporation",22,621,0],["ACII","ACII",1,0,0],["ACIU","AC Immune SA",8,304,0],["ACIW","ACI Worldwide Inc.",25,4963,0],["ACKY","ACKY",1,0,0],["ACLC","ACLC",1,0,0],["ACLO","ACLO",1,0,0],["ACLS","Axcelis Technologies Inc.",7,2564,0],["ACLX","Arcellx Inc.",13,3698,0],["ACM","AECOM",21,12751,0],["ACMR","ACM Research Inc. Class A",7,2580,0],["ACN","Accenture plc Class A",36,179187,0],["ACNB","ACNB Corporation",26,536,0],["ACNT","Ascent Industries Co.",27,147,0],["ACOG","Alpha Cognition Inc.",1,90,0],["ACON","Aclarion Inc.",23,4,0],["ACP","abrdn Income Credit Strategies Fund",11,0,0],["ACP/PA","ACP/PA",1,0,0],["ACR","ACRES Commercial Realty Corp.",30,169,0],["ACR/PC","ACR/PC",1,0,0],["ACR/PD","ACR/PD",1,0,0],["ACRE","Ares Commercial Real Estate Corporation",30,293,0],["ACRS","Aclaris Therapeutics Inc.",8,340,0],["ACRV","Acrivon Therapeutics Inc.",8,68,0],["ACT","Enact Holdings Inc.",28,5834,0],["ACTG","Acacia Research Corporation (Acacia Tech)",29,357,0],["ACTU","Actuate Therapeutics Inc.",8,274,0],["ACU","Acme United Corporation.",7,161,0],["ACV","Virtus Diversified Income & Convertible Fund",123,270,0],["ACVA","ACV Auctions Inc. Class A",36,1343,0],["ACVF","ACVF",1,0,0],["ACVT","ACVT",1,0,0],["ACWI","ACWI",1,0,0],["ACWX","ACWX",1,0,0],["ACXP","Acurx Pharmaceuticals Inc.",8,7,0],["AD","Array Digital Infrastructure Inc.",33,4481,0],["ADACU","American Drive Acquisition Company",2,0,0],["ADAG","Adagene Inc.",8,86,0],["ADAM","Adamas Trust Inc.",25,675,0],["ADAMG","Adamas Trust Inc. 9.125% Senior Notes Due 2030",30,0,0],["ADAMH","Adamas Trust Inc. 9.875% Senior Notes Due 2030",30,0,0],["ADAMI","Adamas Trust Inc. 9.125% Senior Notes Due 2029",30,2271,0],["ADAML","Adamas Trust Inc. 6.875% Series F Fixed-to-Floating Rate Cumulative Redeemable",30,2064,0],["ADAMM","Adamas Trust Inc. 7.875% Series E Fixed-to-Floating Rate Cumulative Redeemable",30,2269,0],["ADAMN","Adamas Trust Inc. 8.00% Series D Fixed-to-Floating Rate Cumulative Redeemable",30,2018,0],["ADAMZ","Adamas Trust Inc. 7.000% Series G Cumulative Redeemable",30,1744,0],["ADBE","Adobe Inc.",25,148963,0],["ADBG","ADBG",1,0,0],["ADC","Agree Realty Corporation",30,8287,0],["ADC/PA","ADC/PA",1,0,0],["ADCT","ADC Therapeutics SA",8,462,0],["ADEA","Adeia Inc.",25,1398,0],["ADGM","Adagio Medical Holdings Inc",31,29,0],["ADI","Analog Devices Inc.",6,134381,0],["ADIL","Adial Pharmaceuticals Inc",8,10,0],["ADIV","ADIV",1,0,0],["ADM","Archer-Daniels-Midland Company",17,27988,0],["ADMA","ADMA Biologics Inc",13,4660,0],["ADNT","Adient plc",42,1550,0],["ADP","Automatic Data Processing Inc.",12,104324,0],["ADPT","Adaptive Biotechnologies Corporation",13,2595,0],["ADPV","ADPV",1,0,0],["ADSE","ADS-TEC ENERGY PLC",32,735,0],["ADSK","Autodesk Inc.",25,63617,0],["ADT","ADT Inc.",12,6665,0],["ADTN","ADTRAN Holdings Inc.",33,696,0],["ADTX","Aditxt Inc.",8,1,0],["ADUR","Aduro Clean Technologies Inc.",34,367,0],["ADUS","Addus HomeCare Corporation",35,2085,0],["ADV","Advantage Solutions Inc. Class A",36,298,0],["ADVB","Advanced Biomed Inc.",23,8,0],["ADVE","ADVE",1,0,0],["ADX","Adams Diversified Equity Fund Inc.",11,0,0],["ADXN","Addex Therapeutics Ltd",8,13,0],["AEAQU","Activate Energy Acquisition Corp. Unit",1,0,0],["AEBI","Aebi Schmidt Holding AG",37,1024,0],["AEC","Anfield Energy Inc.",10,78,0],["AEE","Ameren Corporation",129,26638,0],["AEF","abrdn Emerging Markets ex-China Fund Inc.",123,739,0],["AEFC","Aegon Funding Company LLC 5.10% Subordinated Notes due 2049",1,0,0],["AEG","Aegon Ltd. New York Registry Shares",5,15127,0],["AEHL","Antelope Enterprise Holdings Limited Class A",38,6,0],["AEHR","Aehr Test Systems",39,654,0],["AEI","Alset Inc.",36,105,0],["AEIS","Advanced Energy Industries Inc.",7,8156,0],["AEM","Agnico Eagle Mines Limited",104,87578,0],["AEMD","Aethlon Medical Inc.",31,2,0],["AENT","Alliance Entertainment Holding Corporation Class A",40,398,0],["AEO","American Eagle Outfitters Inc.",120,4719,0],["AEON","AEON Biopharma Inc. Class A",8,13,0],["AEP","American Electric Power Company Inc.",41,61283,0],["AER","AerCap Holdings N.V.",12,27042,0],["AERO","Grupo Aeromexico S.A.B. de C.V.",4,3108,0],["AERT","Aeries Technology Inc. Class A",19,31,0],["AES","The AES Corporation",41,9635,0],["AESI","Atlas Energy Solutions Inc.",74,1142,0],["AETH","AETH",1,0,0],["AEVA","Aeva Technologies Inc.",42,859,0],["AEXA","American Exceptionalism Acquisition Corp. A Class A",1,0,0],["AEYE","AudioEye Inc.",25,137,0],["AFB","AllianceBernstein National Municipal Income Fund Inc",81,0,0],["AFBI","Affinity Bancshares Inc.",43,139,0],["AFCG","Advanced Flower Capital Inc.",36,65,0],["AFG","American Financial Group Inc.",22,11465,0],["AFGB","American Financial Group Inc. 5.875% Subordinated Debentures due 2059",22,1810,0],["AFGC","American Financial Group Inc. 5.125% Subordinated Debentures due 2059",22,1589,0],["AFGD","American Financial Group Inc. 5.625% Subordinated Debentures due 2060",22,1748,0],["AFGE","American Financial Group Inc. 4.500% Subordinated Debentures due 2060",22,1418,0],["AFIX","AFIX",1,0,0],["AFJK","Aimei Health Technology Co. Ltd",1,0,0],["AFJKU","Aimei Health Technology Co. Ltd Unit",1,0,0],["AFK","AFK",1,0,0],["AFL","AFLAC Incorporated",143,57841,0],["AFLG","AFLG",1,0,0],["AFMC","AFMC",1,0,0],["AFOS","AFOS",1,0,0],["AFRI","Forafric Global PLC",17,291,0],["AFRM","Affirm Holdings Inc. Class A",44,25158,0],["AFSC","AFSC",1,0,0],["AFSM","AFSM",1,0,0],["AFYA","Afya Limited Class A",3,1316,0],["AG","First Majestic Silver Corp.",104,8199,0],["AGAE","Allied Gaming & Entertainment Inc.",45,14,0],["AGCC","Agencia Comercial Spirits Ltd Class A",46,345,0],["AGCO","AGCO Corporation",7,7894,0],["AGD","abrdn Global Dynamic Dividend Fund",81,0,0],["AGEM","AGEM",1,0,0],["AGEN","Agenus Inc.",13,117,0],["AGG","AGG",1,0,0],["AGGA","AGGA",1,0,0],["AGGH","AGGH",1,0,0],["AGGS","AGGS",1,0,0],["AGGY","AGGY",1,0,0],["AGH","Aureus Greenway Holdings Inc.",47,61,0],["AGI","Alamos Gold Inc. Class A",104,16188,0],["AGIG","Abundia Global Impact Group Inc.",59,63,0],["AGIO","Agios Pharmaceuticals Inc.",8,1426,0],["AGIQ","AGIQ",1,0,0],["AGIX","AGIX",1,0,0],["AGL","agilon health inc.",137,305,0],["AGM","Federal Agricultural Mortgage Corporation",116,1931,0],["AGM.A","AGM.A",1,0,0],["AGM/PD","AGM/PD",1,0,0],["AGM/PE","AGM/PE",1,0,0],["AGM/PF","AGM/PF",1,0,0],["AGM/PG","AGM/PG",1,0,0],["AGM/PH","AGM/PH",1,0,0],["AGMH","AGM Group Holdings Inc. Class A",15,5,0],["AGMI","AGMI",1,0,0],["AGNC","AGNC Investment Corp.",30,11435,0],["AGNCL","AGNC Investment Corp.",30,26668,0],["AGNCM","AGNC Investment Corp.",30,26807,0],["AGNCN","AGNC Investment Corp.",30,27569,0],["AGNCO","AGNC Investment Corp.",30,27344,0],["AGNCP","AGNC Investment Corp.",30,26882,0],["AGNCZ","AGNC Investment Corp.",1,27666,0],["AGNG","AGNG",1,0,0],["AGO","Assured Guaranty Ltd.",22,4173,0],["AGOX","AGOX",1,0,0],["AGPU","Axe Compute Inc.",32,23,0],["AGQ","AGQ",1,0,0],["AGQI","AGQI",1,0,0],["AGRH","AGRH",1,0,0],["AGRO","Adecoagro S.A.",48,1040,0],["AGRW","AGRW",1,0,0],["AGRZ","Agroz Inc.",48,39,0],["AGX","Argan Inc.",82,4517,0],["AGYS","Agilysys Inc.",15,3407,0],["AGZ","AGZ",1,0,0],["AGZD","AGZD",1,0,0],["AHCO","AdaptHealth Corp.",35,1350,0],["AHG","Akso Health Group ADS",36,712,0],["AHH","Armada Hoffler Properties Inc.",36,541,0],["AHH/PA","AHH/PA",1,0,0],["AHL","Aspen Insurance Holdings Limited Class A",22,3407,0],["AHL/PD","AHL/PD",1,0,0],["AHL/PE","AHL/PE",1,0,0],["AHL/PF","AHL/PF",1,0,0],["AHLT","AHLT",1,0,0],["AHMA","Ambitions Enterprise Management Co. L.L.C Class A",45,213,0],["AHR","American Healthcare REIT Inc.",30,9061,0],["AHT","Ashford Hospitality Trust Inc",30,24,0],["AHT/PD","AHT/PD",1,0,0],["AHT/PF","AHT/PF",1,0,0],["AHT/PG","AHT/PG",1,0,0],["AHT/PH","AHT/PH",1,0,0],["AHT/PI","AHT/PI",1,0,0],["AHYB","AHYB",1,0,0],["AI","C3.ai Inc. Class A",25,2032,0],["AIA","AIA",1,0,0],["AIBD","AIBD",1,0,0],["AIBU","AIBU",1,0,0],["AIEQ","AIEQ",1,0,0],["AIFD","AIFD",1,0,0],["AIFF","Firefly Neuroscience Inc.",25,18,0],["AIFU","AIFU Inc. Class A",28,38,0],["AIG","American International Group Inc. New",5,46420,0],["AIHS","Senmiao Technology Limited",44,4,0],["AII","American Integrity Insurance Group Inc.",22,402,0],["AIIA","AI Infrastructure Acquisition Corp. Class A",2,0,0],["AIIA.U","AIIA.U",1,0,0],["AIIO","Robo.ai Inc. Class B",37,91,0],["AIM","AIM ImmunoTech Inc.",13,4,0],["AIMD","Ainos Inc.",8,10,0],["AIN","Albany International Corporation",115,1448,0],["AINP","AINP",1,0,0],["AIO","Virtus Artificial Intelligence & Technology Opportunities Fund",123,780,0],["AIOT","PowerFleet Inc.",33,717,0],["AIP","Arteris Inc.",6,746,0],["AIPI","AIPI",1,0,0],["AIPO","AIPO",1,0,0],["AIQ","AIQ",1,0,0],["AIR","AAR Corp.",50,2987,0],["AIRE","reAlpha Tech Corp.",36,56,0],["AIRG","Airgain Inc.",49,48,0],["AIRI","Air Industries Group",21,14,0],["AIRJ","AirJoule Technologies Corporation Class A",7,203,0],["AIRO","AIRO Group Holdings Inc.",50,251,0],["AIRR","AIRR",1,0,0],["AIRS","AirSculpt Technologies Inc.",35,137,0],["AIRT","Air T Inc.",4,50,0],["AIRTP","Air T Inc. Air T Funding Alpha Income Trust Preferred Securities",4,53,0],["AIS","AIS",1,0,0],["AISP","Airship AI Holdings Inc. Class A",25,103,0],["AIT","Applied Industrial Technologies Inc.",32,9898,0],["AIV","Apartment Investment and Management Company",30,810,0],["AIVC","AIVC",1,0,0],["AIVI","AIVI",1,0,0],["AIVL","AIVL",1,0,0],["AIXC","AIxCrypto Holdings Inc.",8,64,0],["AIXI","XIAO-I Corporation",25,6,0],["AIYY","AIYY",1,0,0],["AIZ","Assurant Inc.",22,11970,0],["AIZN","Assurant Inc. 5.25% Subordinated Notes due 2061",22,998,0],["AJG","Arthur J. Gallagher & Co.",28,65071,0],["AKA","a.k.a. Brands Holding Corp.",57,116,0],["AKAF","AKAF",1,0,0],["AKAM","Akamai Technologies Inc.",36,12836,0],["AKAN","Akanda Corp.",18,0,0],["AKBA","Akebia Therapeutics Inc.",8,441,0],["AKO.A","AKO.A",1,0,0],["AKO.B","AKO.B",1,0,0],["AKR","Acadia Realty Trust",30,2699,0],["AKRE","AKRE",1,0,0],["AKTX","Akari Therapeutics plc ADS",8,12,0],["AL","Air Lease Corporation Class A",12,7170,0],["ALAB","Astera Labs Inc.",6,27768,0],["ALAI","ALAI",1,0,0],["ALAR","Alarum Technologies Ltd. American",25,54,0],["ALB","Albemarle Corporation",34,17170,0],["ALB/PA","ALB/PA",1,0,0],["ALBT","Avalon GloboCare Corp.",13,5,0],["ALC","Alcon Inc.",111,39554,0],["ALCO","Alico Inc.",1,288,0],["ALCY","Alchemy Investments Acquisition Corp 1 Class A",2,0,0],["ALDF","Aldel Financial II Inc. Class A",1,0,0],["ALDFU","Aldel Financial II Inc.",2,0,0],["ALDX","Aldeyra Therapeutics Inc.",8,298,0],["ALEC","Alector Inc.",13,153,0],["ALEX","Alexander & Baldwin Inc.",30,1502,0],["ALF","Centurion Acquisition Corp. Class A",1,0,0],["ALG","Alamo Group Inc.",7,2107,0],["ALGM","Allegro MicroSystems Inc.",6,4943,0],["ALGN","Align Technology Inc.",32,11314,0],["ALGS","Aligos Therapeutics Inc.",13,66,0],["ALGT","Allegiant Travel Company",4,1559,0],["ALH","Alliance Laundry Holdings Inc.",7,4035,0],["ALHC","Alignment Healthcare Inc.",23,4086,0],["ALIL","ALIL",1,0,0],["ALIS","Calisa Acquisition Corp",1,0,0],["ALISU","ALISU",1,0,0],["ALIT","Alight Inc. Class A",36,1034,0],["ALK","Alaska Air Group Inc.",4,6031,0],["ALKS","Alkermes plc",8,4698,0],["ALKT","Alkami Technology Inc.",25,2387,0],["ALL","Allstate Corporation (The)",22,53645,0],["ALL/PB","ALL/PB",1,0,0],["ALL/PH","ALL/PH",1,0,0],["ALL/PI","ALL/PI",1,0,0],["ALL/PJ","ALL/PJ",1,0,0],["ALLE","Allegion plc",12,13765,0],["ALLO","Allogene Therapeutics Inc.",13,319,0],["ALLR","Allarity Therapeutics Inc.",8,16,0],["ALLT","Allot Ltd.",51,354,0],["ALLW","ALLW",1,0,0],["ALLY","Ally Financial Inc.",26,14075,0],["ALM","Almonty Industries Inc.",52,1902,0],["ALMS","Alumis Inc.",8,1179,0],["ALMU","Aeluma Inc.",6,259,0],["ALNT","Allient Inc.",39,933,0],["ALNY","Alnylam Pharmaceuticals Inc.",8,52876,0],["ALOT","AstroNova Inc.",53,62,0],["ALPS","ALPS Group Inc",1,158,0],["ALRG","ALRG",1,0,0],["ALRM","Alarm.com Holdings Inc.",25,2627,0],["ALRS","Alerus Financial Corporation",26,576,0],["ALSN","Allison Transmission Holdings Inc.",42,8216,0],["ALT","Altimmune Inc.",8,407,0],["ALTG","Alta Equipment Group Inc. Class A",7,157,0],["ALTG/PA","ALTG/PA",1,0,0],["ALTI","AlTi Global Inc. Class A",11,716,0],["ALTL","ALTL",1,0,0],["ALTO","Alto Ingredients Inc.",34,229,0],["ALTS","ALT5 Sigma Corporation",44,161,0],["ALTY","ALTY",1,0,0],["ALUB.U","ALUB.U",1,0,0],["ALUR","Allurion Technologies Inc.",31,14,0],["ALV","Autoliv Inc.",42,9197,0],["ALVO","Alvotech",13,1479,0],["ALX","Alexander\'s Inc.",30,1106,0],["ALXO","ALX Oncology Holdings Inc.",8,79,0],["ALZN","Alzamend Neuro Inc.",8,8,0],["AM","Antero Midstream Corporation",107,8340,0],["AMAL","Amalgamated Financial Corp.",26,987,0],["AMAT","Applied Materials Inc.",6,203319,0],["AMAX","AMAX",1,0,0],["AMBA","Ambarella Inc.",6,3122,0],["AMBO","Ambow Education Holding Ltd. American Depository Shares (each representing twenty (20) Class A",3,10,0],["AMBP","Ardagh Metal Packaging S.A.",125,2427,0],["AMBQ","Ambiq Micro Inc.",6,556,0],["AMBR","Amber International Holding Limited",44,160,0],["AMC","AMC Entertainment Holdings Inc. Class A",89,898,0],["AMCI","AMC Robotics Corporation",73,37,0],["AMCR","Amcor plc",69,19136,0],["AMCX","AMC Networks Inc. Class A",54,419,0],["AMD","Advanced Micro Devices Inc.",6,347473,0],["AMDD","AMDD",1,0,0],["AMDG","AMDG",1,0,0],["AMDL","AMDL",1,0,0],["AMDU","AMDU",1,0,0],["AMDY","AMDY",1,0,0],["AME","AMETEK Inc.",7,46798,0],["AMG","Affiliated Managers Group Inc.",11,7850,0],["AMGN","Amgen Inc.",13,176288,0],["AMH","American Homes 4 Rent",30,11549,0],["AMH/PG","AMH/PG",1,0,0],["AMH/PH","AMH/PH",1,0,0],["AMID","AMID",1,0,0],["AMIX","Autonomix Medical Inc.",31,4,0],["AMJB","AMJB",1,0,0],["AMKR","Amkor Technology Inc.",6,9984,0],["AMLP","AMLP",1,0,0],["AMLX","Amylyx Pharmaceuticals Inc.",8,1320,0],["AMN","AMN Healthcare Services Inc",19,616,0],["AMOD","Alpha Modus Holdings Inc. Class A",29,26,0],["AMOM","AMOM",1,0,0],["AMP","Ameriprise Financial Inc.",11,45447,0],["AMPG","Amplitech Group Inc.",33,63,0],["AMPH","Amphastar Pharmaceuticals Inc.",8,1222,0],["AMPL","Amplitude Inc. Class A",25,1531,0],["AMPX","Amprius Technologies Inc.",7,1220,0],["AMPY","Amplify Energy Corp.",59,192,0],["AMR","Alpha Metallurgical Resources Inc.",65,2675,0],["AMRC","Ameresco Inc. Class A",82,1564,0],["AMRN","Amarin Corporation plc",8,287,0],["AMRX","Amneal Pharmaceuticals Inc. Class A",8,3952,0],["AMRZ","Amrize Ltd",38,30016,0],["AMS","American Shared Hospital Services",23,14,0],["AMSC","American Superconductor Corporation",55,1385,0],["AMSF","AMERISAFE Inc.",22,739,0],["AMST","Amesite Inc.",25,12,0],["AMT","American Tower Corporation (REIT)",30,80713,0],["AMTB","Amerant Bancorp Inc. Class A",26,832,0],["AMTD","AMTD IDEA Group",44,99,0],["AMTM","Amentum Holdings Inc.",36,7115,0],["AMTX","Aemetis Inc. (DE)",34,97,0],["AMUB","AMUB",1,0,0],["AMUN","AMUN",1,0,0],["AMUU","AMUU",1,0,0],["AMWD","American Woodmark Corporation",56,795,0],["AMWL","American Well Corporation Class A",36,76,0],["AMX","America Movil S.A.B. de C.V.",33,61894,0],["AMYY","AMYY",1,0,0],["AMZA","AMZA",1,0,0],["AMZD","AMZD",1,0,0],["AMZE","Amaze Holdings Inc.",46,8,0],["AMZN","Amazon.com Inc.",57,2430421,0],["AMZU","AMZU",1,0,0],["AMZY","AMZY",1,0,0],["AMZZ","AMZZ",1,0,0],["AN","AutoNation Inc.",97,7627,0],["ANAB","AnaptysBio Inc.",8,1359,0],["ANDE","Andersons Inc. (The)",48,1824,0],["ANDG","Andersen Group Inc. Class A",36,0,0],["ANEB","Anebulo Pharmaceuticals Inc.",8,89,0],["ANEL","ANEL",1,0,0],["ANET","Arista Networks Inc.",51,165117,0],["ANEW","ANEW",1,0,0],["ANF","Abercrombie & Fitch Company",120,5552,0],["ANG/PD","ANG/PD",1,0,0],["ANGH","Anghami Inc.",33,17,0],["ANGI","Angi Inc. Class A",58,552,0],["ANGL","ANGL",1,0,0],["ANGO","AngioDynamics Inc.",31,551,0],["ANGX","Angel Studios Inc. Class A",89,1082,0],["ANIK","Anika Therapeutics Inc.",31,138,0],["ANIP","ANI Pharmaceuticals Inc.",8,1861,0],["ANIX","Anixa Biosciences Inc.",8,109,0],["ANL","Adlai Nortye Ltd.",8,56,0],["ANNA","AleAnna Inc. Class A",59,206,0],["ANNX","Annexon Inc.",8,619,0],["ANPA","Rich Sparkle Holdings Limited",3,267,0],["ANRO","Alto Neuroscience Inc.",8,621,0],["ANSC","Agriculture & Natural Solutions Acquisition Corporation Class A",1,0,0],["ANTA","Antalpha Platform Holding Company Class A",60,227,0],["ANTX","AN2 Therapeutics Inc.",8,31,0],["ANVS","Annovis Bio Inc.",8,97,0],["ANY","Sphere 3D Corp.",44,16,0],["AOA","AOA",1,0,0],["AOD","abrdn Total Dynamic Dividend Fund",11,0,0],["AOHY","AOHY",1,0,0],["AOK","AOK",1,0,0],["AOM","AOM",1,0,0],["AOMD","Angel Oak Mortgage REIT Inc. 9.750% Senior Notes due 2030",36,0,0],["AOMN","Angel Oak Mortgage REIT Inc. 9.500% Senior Notes due 2029",36,0,0],["AOMR","Angel Oak Mortgage REIT Inc.",36,217,0],["AON","Aon plc Class A",28,75236,0],["AOR","AOR",1,0,0],["AORT","Artivion Inc.",31,2205,0],["AOS","A.O. Smith Corporation",133,9470,0],["AOSL","Alpha and Omega Semiconductor Limited",6,611,0],["AOTG","AOTG",1,0,0],["AOUT","American Outdoor Brands Inc.",61,106,0],["AP","Ampco-Pittsburgh Corporation",148,83,0],["APA","APA Corporation",59,8555,0],["APAC","StoneBridge Acquisition II Corporation Class A",1,0,0],["APACU","StoneBridge Acquisition II Corporation",2,0,0],["APAD","A Paradise Acquisition Corp. Class A",1,0,0],["APADU","A Paradise Acquisition Corp. Unit",1,0,0],["APAM","Artisan Partners Asset Management Inc. Class A",11,3348,0],["APCB","APCB",1,0,0],["APD","Air Products and Chemicals Inc.",34,53413,0],["APED","APED",1,0,0],["APEI","American Public Education Inc.",3,694,0],["APG","APi Group Corporation",82,16170,0],["APGE","Apogee Therapeutics Inc.",13,5366,0],["APH","Amphenol Corporation",39,165602,0],["API","Agora Inc.",25,368,0],["APIE","APIE",1,0,0],["APLD","Applied Digital Corporation",44,7777,0],["APLE","Apple Hospitality REIT Inc.",30,2879,0],["APLM","Apollomics Inc. Class A",8,18,0],["APLS","Apellis Pharmaceuticals Inc.",8,3119,0],["APLT","Applied Therapeutics Inc.",8,18,0],["APLU","APLU",1,0,0],["APLY","APLY",1,0,0],["APM","Aptorum Group Limited Class A",8,9,0],["APMU","APMU",1,0,0],["APO","Apollo Global Management Inc. (New)",11,84939,0],["APO/PA","APO/PA",1,0,0],["APOG","Apogee Enterprises Inc.",42,834,0],["APOS","Apollo Global Management Inc. 7.625% Fixed-Rate Resettable Junior Subordinated Notes due 2053",11,14825,0],["APP","Applovin Corporation Class A",16,243791,0],["APPF","AppFolio Inc. Class A",25,8394,0],["APPN","Appian Corporation Class A",25,2720,0],["APPS","Digital Turbine Inc.",29,590,0],["APPX","APPX",1,0,0],["APRE","Aprea Therapeutics Inc.",8,6,0],["APRT","APRT",1,0,0],["APRW","APRW",1,0,0],["APT","Alpha Pro Tech Ltd.",32,45,0],["APTV","Aptiv PLC",42,16917,0],["APUE","APUE",1,0,0],["APUS","Apimeds Pharmaceuticals US Inc.",8,19,0],["APVO","Aptevo Therapeutics Inc.",8,22,0],["APWC","Asia Pacific Wire & Cable Corporation Ltd.",33,38,0],["APXT","Apex Treasury Corporation Class A",25,0,0],["APXTU","Apex Treasury Corporation",2,0,0],["APYX","Apyx Medical Corporation",31,143,0],["AQB","AquaBounty Technologies Inc.",62,3,0],["AQMS","Aqua Metals Inc.",55,52,0],["AQN","Algonquin Power & Utilities Corp.",41,4732,0],["AQNB","Algonquin Power & Utilities Corp. 6.20% Fixed-to-Floating Subordinated Notes Series 2019-A due July 1 2079",41,19623,0],["AQST","Aquestive Therapeutics Inc.",8,708,0],["AQWA","AQWA",1,0,0],["AR","Antero Resources Corporation",59,10495,0],["ARAI","Arrive AI Inc.",12,108,0],["ARAY","Accuray Incorporated",31,103,0],["ARB","ARB",1,0,0],["ARBB","ARB IOT Group Limited",15,12,0],["ARBE","Arbe Robotics Ltd.",15,124,0],["ARBK","Argo Blockchain plc",44,64,0],["ARCB","ArcBest Corporation",63,1765,0],["ARCC","Ares Capital Corporation",44,14272,0],["ARCO","Arcos Dorados Holdings Inc. Class A Shares",68,1517,0],["ARCT","Arcturus Therapeutics Holdings Inc.",8,186,0],["ARDC","Ares Dynamic Credit Allocation Fund Inc.",11,304,0],["ARDT","Ardent Health Inc.",126,1261,0],["ARDX","Ardelyx Inc.",8,1380,0],["ARE","Alexandria Real Estate Equities Inc.",30,8285,0],["AREA","AREA",1,0,0],["AREB","American Rebel Holdings Inc.",64,6,0],["AREC","American Resources Corporation Class A",65,193,0],["AREN","The Arena Group Holdings Inc.",15,200,0],["ARES","Ares Management Corporation Class A",11,54156,0],["ARES/PB","ARES/PB",1,0,0],["ARGT","ARGT",1,0,0],["ARGX","argenx SE",13,52147,0],["ARHS","Arhaus Inc. Class A",66,1632,0],["ARI","Apollo Commercial Real Estate Finance Inc",30,1394,0],["ARKO","ARKO Corp.",67,549,0],["ARKR","Ark Restaurants Corp.",68,22,0],["ARL","American Realty Investors Inc.",3,262,0],["ARLO","Arlo Technologies Inc.",133,1489,0],["ARLP","Alliance Resource Partners L.P. Common",65,2992,0],["ARM","Arm Holdings plc",6,120788,0],["ARMG","ARMG",1,0,0],["ARMH","ARMH",1,0,0],["ARMK","Aramark",68,9984,0],["ARMN","Aris Mining Corporation",1,3225,0],["ARMP","Armata Pharmaceuticals Inc.",13,311,0],["AROC","Archrock Inc.",107,4444,0],["AROW","Arrow Financial Corporation",26,525,0],["ARP","ARP",1,0,0],["ARQ","Arq Inc.",34,137,0],["ARQQ","Arqit Quantum Inc.",25,399,0],["ARQT","Arcutis Biotherapeutics Inc.",8,3431,0],["ARR","ARMOUR Residential REIT Inc.",30,1947,0],["ARR/PC","ARR/PC",1,0,0],["ARRY","Array Technologies Inc.",69,1450,0],["ARTL","Artelo Biosciences Inc.",8,3,0],["ARTNA","Artesian Resources Corporation Class A",70,327,0],["ARTV","Artiva Biotherapeutics Inc.",13,116,0],["ARTW","Art\'s-Way Manufacturing Co. Inc.",7,11,0],["ARTY","ARTY",1,0,0],["ARVN","Arvinas Inc.",8,750,0],["ARVR","ARVR",1,0,0],["ARW","Arrow Electronics Inc.",76,5831,0],["ARWR","Arrowhead Pharmaceuticals Inc.",8,9745,0],["ARX","Accelerant Holdings Class A",28,3618,0],["AS","Amer Sports Inc.",86,21162,0],["ASA","ASA Gold and Precious Metals Limited",104,1108,0],["ASAN","Asana Inc. Class A",25,3433,0],["ASB","Associated Banc-Corp",26,4385,0],["ASB/PE","ASB/PE",1,0,0],["ASB/PF","ASB/PF",1,0,0],["ASBP","Aspire Biopharma Holdings Inc.",8,14,0],["ASC","Ardmore Shipping Corporation",98,441,0],["ASCE","ASCE",1,0,0],["ASCI","ASCI",1,0,0],["ASEA","ASEA",1,0,0],["ASG","Liberty All-Star Growth Fund Inc.",11,0,0],["ASGI","abrdn Global Infrastructure Income Fund",11,0,0],["ASGM","ASGM",1,0,0],["ASGN","ASGN Incorporated",19,2084,0],["ASH","Ashland Inc.",135,2718,0],["ASHR","ASHR",1,0,0],["ASHS","ASHS",1,0,0],["ASIA","ASIA",1,0,0],["ASIC","Ategrity Specialty Insurance Company Holdings",22,994,0],["ASIX","AdvanSix Inc.",34,445,0],["ASLE","AerSale Corporation",32,331,0],["ASLV","ASLV",1,0,0],["ASM","Avino Silver & Gold Mines Ltd.",10,1007,0],["ASMB","Assembly Biosciences Inc.",8,558,0],["ASMF","ASMF",1,0,0],["ASMG","ASMG",1,0,0],["ASMH","ASMH",1,0,0],["ASML","ASML Holding N.V. New York Registry Shares",7,415315,0],["ASND","Ascendis Pharma A/S",8,12137,0],["ASNS","Actelis Networks Inc.",33,2,0],["ASO","Academy Sports and Outdoors Inc.",66,3581,0],["ASPC","A SPAC III Acquisition Corp. Class A",2,0,0],["ASPCU","A SPAC III Acquisition Corp. Unit",2,0,0],["ASPI","ASP Isotopes Inc.",34,674,0],["ASPN","Aspen Aerogels Inc.",130,245,0],["ASPS","Altisource Portfolio Solutions S.A.",3,74,0],["ASR","Grupo Aeroportuario del Sureste S.A. de C.V.",50,9676,0],["ASRT","Assertio Holdings Inc.",8,69,0],["ASRV","AmeriServ Financial Inc.",26,50,0],["ASST","Strive Inc. Class A",25,733,0],["ASTC","Astrotech Corporation (DE)",71,6,0],["ASTE","Astec Industries Inc.",72,1044,0],["ASTH","Astrana Health Inc.",19,1344,0],["ASTI","Ascent Solar Technologies Inc.",6,15,0],["ASTL","Algoma Steel Group Inc.",27,453,0],["ASTS","AST SpaceMobile Inc. Class A",33,27835,0],["ASUR","Asure Software Inc",15,246,0],["ASX","ASE Technology Holding Co. Ltd.",6,33477,0],["ASYS","Amtech Systems Inc.",7,175,0],["ATAI","Atai Beckley N.V",8,1438,0],["ATAT","Atour Lifestyle Holdings Limited",47,5776,0],["ATCH","AtlasClear Holdings Inc.",44,40,0],["ATEC","Alphatec Holdings Inc.",31,2972,0],["ATEN","A10 Networks Inc.",51,1288,0],["ATER","Aterian Inc.",73,7,0],["ATEX","Anterix Inc.",33,414,0],["ATFV","ATFV",1,0,0],["ATGE","Adtalem Global Education Inc.",3,3655,0],["ATGL","Alpha Technology Group Limited Class A",15,381,0],["ATH/PA","ATH/PA",1,0,0],["ATH/PB","ATH/PB",1,0,0],["ATH/PD","ATH/PD",1,0,0],["ATH/PE","ATH/PE",1,0,0],["ATHA","Athira Pharma Inc.",13,27,0],["ATHE","Alterity Therapeutics Limited",8,47,0],["ATHM","Autohome Inc.",15,2731,0],["ATHR","Aether Holdings Inc.",25,74,0],["ATHS","Athene Holding Ltd. 7.250% Fixed-Rate Reset Junior Subordinated Debentures due 2064",5,5105,0],["ATI","ATI Inc.",27,15391,0],["ATII","Archimedes Tech SPAC Partners II Co.",1,0,0],["ATKR","Atkore Inc.",7,2165,0],["ATLC","Atlanticus Holdings Corporation",44,1048,0],["ATLCL","Atlanticus Holdings Corporation 6.125% Senior Notes due 2026",44,372,0],["ATLCP","Atlanticus Holdings Corporation 7.625% Series B Cumulative Perpetual",44,363,0],["ATLCZ","Atlanticus Holdings Corporation 9.25% Senior Notes due 2029",44,386,0],["ATLN","Atlantic International Corp.",71,76,0],["ATLO","Ames National Corporation",26,207,0],["ATLX","Atlas Lithium Corporation",74,141,0],["ATMC","ATMC",1,0,0],["ATMCU","ATMCU",1,0,0],["ATMU","Atmus Filtration Technologies Inc.",42,4366,0],["ATNI","ATN International Inc.",33,339,0],["ATNM","Actinium Pharmaceuticals Inc. (Delaware)",8,53,0],["ATO","Atmos Energy Corporation",140,26954,0],["ATOM","Atomera Incorporated",6,74,0],["ATON","AlphaTON Capital Corp.",59,6,0],["ATOS","Atossa Therapeutics Inc.",8,94,0],["ATPC","Agape ATP Corporation",35,6,0],["ATR","AptarGroup Inc.",64,7966,0],["ATRA","Atara Biotherapeutics Inc.",13,124,0],["ATRC","AtriCure Inc.",31,2036,0],["ATRO","Astronics Corporation",21,1952,0],["ATS","ATS Corporation",7,2733,0],["ATXG","Addentax Group Corp.",19,5,0],["ATXS","Astria Therapeutics Inc.",8,732,0],["ATYR","aTyr Pharma Inc.",13,73,0],["AU","AngloGold Ashanti PLC",104,43404,0],["AUAU","AUAU",1,0,0],["AUB","Atlantic Union Bankshares Corporation",26,5216,0],["AUB/PA","AUB/PA",1,0,0],["AUBN","Auburn National Bancorporation Inc.",26,98,0],["AUDC","AudioCodes Ltd.",33,268,0],["AUGO","Aura Minerals Inc.",1,4180,0],["AUGT","AUGT",1,0,0],["AUGW","AUGW",1,0,0],["AUID","authID Inc.",25,12,0],["AUMI","AUMI",1,0,0],["AUNA","Auna SA Class A",35,341,0],["AUPH","Aurinia Pharmaceuticals Inc",8,2133,0],["AUR","Aurora Innovation Inc. Class A",15,8051,0],["AURA","Aura Biosciences Inc.",13,372,0],["AURE","Aurelion Inc. Class A",44,12,0],["AUSF","AUSF",1,0,0],["AUSM","AUSM",1,0,0],["AUST","Austin Gold Corp.",104,24,0],["AUTL","Autolus Therapeutics plc American",13,434,0],["AUUD","Auddia Inc.",15,3,0],["AVA","Avista Corporation",129,3067,0],["AVAH","Aveanna Healthcare Holdings Inc.",35,1899,0],["AVAL","Grupo Aval Acciones y Valores S.A. ADR (Each representing 20",75,4867,0],["AVAV","AeroVironment Inc.",50,12132,0],["AVB","AvalonBay Communities Inc.",30,25364,0],["AVBC","Avidia Bancorp Inc.",43,350,0],["AVBH","Avidbank Holdings Inc.",75,300,0],["AVBP","ArriVent BioPharma Inc.",8,909,0],["AVD","American Vanguard Corporation",85,111,0],["AVDE","AVDE",1,0,0],["AVDL","Avadel Pharmaceuticals plc",8,2097,0],["AVDS","AVDS",1,0,0],["AVDV","AVDV",1,0,0],["AVEE","AVEE",1,0,0],["AVEM","AVEM",1,0,0],["AVES","AVES",1,0,0],["AVGB","AVGB",1,0,0],["AVGE","AVGE",1,0,0],["AVGG","AVGG",1,0,0],["AVGO","Broadcom Inc.",6,1607304,0],["AVGU","AVGU",1,0,0],["AVGV","AVGV",1,0,0],["AVGX","AVGX",1,0,0],["AVIE","AVIE",1,0,0],["AVIG","AVIG",1,0,0],["AVIR","Atea Pharmaceuticals Inc.",8,245,0],["AVIV","AVIV",1,0,0],["AVK","Advent Convertible and Income Fund",81,0,0],["AVL","AVL",1,0,0],["AVLC","AVLC",1,0,0],["AVLV","AVLV",1,0,0],["AVMA","AVMA",1,0,0],["AVMC","AVMC",1,0,0],["AVMU","AVMU",1,0,0],["AVMV","AVMV",1,0,0],["AVNM","AVNM",1,0,0],["AVNS","Avanos Medical Inc.",32,542,0],["AVNT","Avient Corporation",34,2847,0],["AVNV","AVNV",1,0,0],["AVNW","Aviat Networks Inc.",49,268,0],["AVO","Mission Produce Inc.",48,932,0],["AVPT","AvePoint Inc. Class A",25,3008,0],["AVR","Anteris Technologies Global Corp.",32,204,0],["AVRE","AVRE",1,0,0],["AVS","AVS",1,0,0],["AVSC","AVSC",1,0,0],["AVSD","AVSD",1,0,0],["AVSE","AVSE",1,0,0],["AVSF","AVSF",1,0,0],["AVSU","AVSU",1,0,0],["AVT","Avnet Inc.",76,4047,0],["AVTR","Avantor Inc.",71,7684,0],["AVTX","Avalo Therapeutics Inc.",8,337,0],["AVUQ","AVUQ",1,0,0],["AVUS","AVUS",1,0,0],["AVUV","AVUV",1,0,0],["AVX","Avax One Technology Ltd.",44,115,0],["AVXC","AVXC",1,0,0],["AVXL","Anavex Life Sciences Corp.",13,328,0],["AVXX","AVXX",1,0,0],["AVY","Avery Dennison Corporation",125,14002,0],["AWAY","AWAY",1,0,0],["AWEG","AWEG",1,0,0],["AWF","Alliancebernstein Global High Income Fund",81,0,0],["AWI","Armstrong World Industries Inc",64,8031,0],["AWK","American Water Works Company Inc.",70,25415,0],["AWP","abrdn Global Premier Properties Fund",81,0,0],["AWR","American States Water Company",70,2829,0],["AWRE","Aware Inc.",25,44,0],["AWX","Avalon Holdings Corporation",122,10,0],["AX","Axos Financial Inc.",84,4957,0],["AXG","Solowin Holdings Class A",60,788,0],["AXGN","Axogen Inc.",77,1475,0],["AXIA","AXIA Energia",41,25614,0],["AXIA/P","AXIA/P",1,0,0],["AXIL","AXIL Brands Inc.",90,53,0],["AXIN","Axiom Intelligence Acquisition Corp 1 Class A",2,0,0],["AXL","American Axle & Manufacturing Holdings Inc.",42,787,0],["AXON","Axon Enterprise Inc.",78,46889,0],["AXP","American Express Company",44,259360,0],["AXR","AMREP Corporation",121,100,0],["AXS","Axis Capital Holdings Limited",22,8315,0],["AXS/PE","AXS/PE",1,0,0],["AXSM","Axsome Therapeutics Inc.",8,7695,0],["AXTA","Axalta Coating Systems Ltd.",149,6840,0],["AXTI","AXT Inc",6,683,0],["AYI","Acuity Inc.",91,11108,0],["AYTU","Aytu BioPharma Inc. ",8,26,0],["AZ","A2Z Cust2Mate Solutions Corp.",7,243,0],["AZI","Autozi Internet Technology (Global) Ltd. Class A",79,8,0],["AZN","AstraZeneca PLC",8,283349,0],["AZO","AutoZone Inc.",141,56424,0],["AZTA","Azenta Inc.",7,1583,0],["AZTD","AZTD",1,0,0],["AZTR","Azitra Inc",8,18,0],["AZYY","AZYY",1,0,0],["AZZ","AZZ Inc.",32,3240,0],["B","Barrick Mining Corporation",104,75479,0],["BA","Boeing Company (The)",50,162721,0],["BA/PA","BA/PA",1,0,0],["BAB","BAB",1,0,0],["BABA","Alibaba Group Holding Limited",36,345907,0],["BABO","BABO",1,0,0],["BABX","BABX",1,0,0],["BAC","Bank of America Corporation",26,403609,0],["BAC/PB","BAC/PB",1,0,0],["BAC/PE","BAC/PE",1,0,0],["BAC/PK","BAC/PK",1,0,0],["BAC/PL","BAC/PL",1,0,0],["BAC/PM","BAC/PM",1,0,0],["BAC/PN","BAC/PN",1,0,0],["BAC/PO","BAC/PO",1,0,0],["BAC/PP","BAC/PP",1,0,0],["BAC/PQ","BAC/PQ",1,0,0],["BAC/PS","BAC/PS",1,0,0],["BACC","Blue Acquisition Corp. Class A",2,0,0],["BACCU","Blue Acquisition Corp. Unit",2,0,0],["BACQ","Inflection Point Acquisition Corp. IV Class A",1,0,0],["BACQU","BACQU",1,0,0],["BAER","Bridger Aerospace Group Holdings Inc.",36,93,0],["BAFE","BAFE",1,0,0],["BAFN","BayFirst Financial Corp.",26,32,0],["BAH","Booz Allen Hamilton Holding Corporation",19,10342,0],["BAI","BAI",1,0,0],["BAIG","BAIG",1,0,0],["BAK","Braskem SA ADR",34,1265,0],["BALL","Ball Corporation",125,13943,0],["BALQ","BALQ",1,0,0],["BALY","Bally\'s Corporation",47,867,0],["BAM","Brookfield Asset Management Inc Class A Limited Voting Shares",3,84065,0],["BANC","Banc of California Inc.",26,2982,0],["BANC/PF","BANC/PF",1,0,0],["BAND","Bandwidth Inc. Class A",25,454,0],["BANF","BancFirst Corporation",26,3753,0],["BANFP","BancFirst Corporation - BFC Capital Trust II Cumulative Trust Preferred Securities",26,864,0],["BANL","CBL International Limited",80,13,0],["BANR","Banner Corporation",26,2258,0],["BANX","ArrowMark Financial Corp.",81,159,0],["BAOS","Baosheng Media Group Holdings Limited",36,5,0],["BAP","Credicorp Ltd.",75,26972,0],["BAR","BAR",1,0,0],["BARK","BARK Inc. Class A",66,107,0],["BASG","BASG",1,0,0],["BASV","BASV",1,0,0],["BATL","Battalion Oil Corporation",59,20,0],["BATRA","Atlanta Braves Holdings Inc. Series A",45,2692,0],["BATRK","Atlanta Braves Holdings Inc. Series C",45,2493,0],["BATT","BATT",1,0,0],["BAX","Baxter International Inc.",31,9746,0],["BAYA","Bayview Acquisition Corp",1,0,0],["BB","BlackBerry Limited",25,2226,0],["BBAG","BBAG",1,0,0],["BBAI","BigBear.ai Inc.",25,2733,0],["BBAR","Banco BBVA Argentina S.A. ADS",75,3731,0],["BBB","BBB",1,0,0],["BBBI","BBBI",1,0,0],["BBBL","BBBL",1,0,0],["BBBS","BBBS",1,0,0],["BBBY","Bed Bath & Beyond Inc.",57,414,0],["BBC","BBC",1,0,0],["BBCB","BBCB",1,0,0],["BBCP","Concrete Pumping Holdings Inc.",82,361,0],["BBD","Banco Bradesco Sa",26,35651,0],["BBDC","Barings BDC Inc.",146,932,0],["BBDO","Banco Bradesco Sa",26,31394,0],["BBGI","Beasley Broadcast Group Inc. Class A",83,9,0],["BBH","BBH",1,0,0],["BBHL","BBHL",1,0,0],["BBHM","BBHM",1,0,0],["BBIO","BridgeBio Pharma Inc.",8,14704,0],["BBLG","Bone Biologics Corp",32,3,0],["BBLU","BBLU",1,0,0],["BBMC","BBMC",1,0,0],["BBN","BlackRock Taxable Municipal Bond Trust",116,0,0],["BBNX","Beta Bionics Inc.",31,1288,0],["BBOT","BridgeBio Oncology Therapeutics Inc.",8,294,0],["BBP","BBP",1,0,0],["BBSC","BBSC",1,0,0],["BBSI","Barrett Business Services Inc.",19,936,0],["BBT","Beacon Financial Corporation",43,2307,0],["BBU","Brookfield Business Partners L.P. Limited Partnership",82,7513,0],["BBUC","Brookfield Business Corporation Class A Exchangeable Subordinate Voting Shares",82,3467,0],["BBVA","Banco Bilbao Vizcaya Argentaria S.A.",75,132844,0],["BBW","Build-A-Bear Workshop Inc.",61,702,0],["BBWI","Bath & Body Works Inc.",120,4051,0],["BBY","Best Buy Co. Inc.",110,15051,0],["BBYY","BBYY",1,0,0],["BC","Brunswick Corporation",7,4927,0],["BC/PC","BC/PC",1,0,0],["BCAB","BioAtla Inc.",13,44,0],["BCAL","California BanCorp",26,630,0],["BCAR","D. Boral ARC Acquisition I Corp. Class A",2,0,0],["BCARU","D. Boral ARC Acquisition I Corp.",2,0,0],["BCAT","BlackRock Capital Allocation Term Trust",123,1563,0],["BCAX","Bicara Therapeutics Inc.",8,1101,0],["BCBP","BCB Bancorp Inc. (NJ)",84,145,0],["BCC","Boise Cascade L.L.C.",130,2770,0],["BCD","BCD",1,0,0],["BCDA","BioCardia Inc.",13,13,0],["BCDF","BCDF",1,0,0],["BCE","BCE Inc.",33,21299,0],["BCFN","BCFN",1,0,0],["BCG","Binah Capital Group Inc.",44,38,0],["BCGD","BCGD",1,0,0],["BCH","Banco De Chile ADS",75,19037,0],["BCHI","BCHI",1,0,0],["BCI","BCI",1,0,0],["BCIC","BCP Investment Corporation",44,157,0],["BCIL","BCIL",1,0,0],["BCLO","BCLO",1,0,0],["BCML","BayCom Corp",26,348,0],["BCO","Brinks Company (The)",105,4942,0],["BCOR","BCOR",1,0,0],["BCPC","Balchem Corporation",34,5062,0],["BCRX","BioCryst Pharmaceuticals Inc.",13,1560,0],["BCS","Barclays PLC",75,87400,0],["BCSF","Bain Capital Specialty Finance Inc.",123,901,0],["BCSM","BCSM",1,0,0],["BCSS","Bain Capital GSS Investment Corp. Class A",1,0,0],["BCSS.U","BCSS.U",1,0,0],["BCTK","BCTK",1,0,0],["BCTX","BriaCell Therapeutics Corp.",8,17,0],["BCUS","BCUS",1,0,0],["BCV","Bancroft Fund Ltd.",123,0,0],["BCV/PA","BCV/PA",1,0,0],["BCX","BlackRock Resources",123,919,0],["BCYC","Bicycle Therapeutics plc",8,477,0],["BDBT","BDBT",1,0,0],["BDC","Belden Inc",33,4628,0],["BDCI","BTC Development Corp. Class A",2,0,0],["BDCIU","BTC Development Corp. Unit",2,0,0],["BDCX","BDCX",1,0,0],["BDCZ","BDCZ",1,0,0],["BDGS","BDGS",1,0,0],["BDIV","BDIV",1,0,0],["BDJ","Blackrock Enhanced Equity Dividend Trust",116,1661,0],["BDL","Flanigan\'s Enterprises Inc.",68,52,0],["BDMD","Baird Medical Investment Holdings Ltd",31,51,0],["BDN","Brandywine Realty Trust",30,521,0],["BDRX","Biodexa Pharmaceuticals plc American Depositary Shs",8,2,0],["BDRY","BDRY",1,0,0],["BDSX","Biodesix Inc.",23,53,0],["BDTX","Black Diamond Therapeutics Inc.",13,145,0],["BDVG","BDVG",1,0,0],["BDVL","BDVL",1,0,0],["BDX","Becton Dickinson and Company",31,55825,0],["BDYN","BDYN",1,0,0],["BE","Bloom Energy Corporation Class A",7,21007,0],["BEAG","Bold Eagle Acquisition Corp. Class A",1,0,0],["BEAGU","BEAGU",1,0,0],["BEAM","Beam Therapeutics Inc.",13,2696,0],["BEAT","Heartbeam Inc.",31,107,0],["BEBE.U","BEBE.U",1,0,0],["BEDY","BEDY",1,0,0],["BEDZ","BEDZ",1,0,0],["BEEM","Beam Global",6,31,0],["BEEP","Mobile Infrastructure Corporation",2,110,0],["BEEX","BEEX",1,0,0],["BEEZ","BEEZ",1,0,0],["BEG","BEG",1,0,0],["BEKE","KE Holdings Inc",36,18620,0],["BELFA","Bel Fuse Inc. Class A",1,1936,0],["BELFB","Bel Fuse Inc. Class B",1,2224,0],["BELT","BELT",1,0,0],["BEN","Franklin Resources Inc.",11,12503,0],["BENF","Beneficient Class A",44,95,0],["BENJ","BENJ",1,0,0],["BEP","Brookfield Renewable Partners L.P. Limited Partnership",41,17687,0],["BEP/PA","BEP/PA",1,0,0],["BEPC","Brookfield Renewable Corporation Brookfield Renewable Corporation Class A Subordinate Voting Shares",41,14265,0],["BEPH","Brookfield BRP Holdings (Canada) Inc. 4.625% Perpetual Subordinated Notes",41,4417,0],["BEPI","Brookfield BRP Holdings (Canada) Inc. 4.875% Perpetual Subordinated Notes",41,4649,0],["BEPJ","Brookfield BRP Holdings (Canada) Inc. 7.250% Perpetual Subordinated Notes",41,7248,0],["BERZ","BERZ",1,0,0],["BETA","Beta Technologies Inc. Class A",50,6999,0],["BETE","BETE",1,0,0],["BETH","BETH",1,0,0],["BETR","Better Home & Finance Holding Company Class A",44,518,0],["BETZ","BETZ",1,0,0],["BF.A","BF.A",1,0,0],["BF.B","BF.B",1,0,0],["BFAM","Bright Horizons Family Solutions Inc.",3,5748,0],["BFAP","BFAP",1,0,0],["BFC","Bank First Corporation",26,1303,0],["BFH","Bread Financial Holdings Inc.",36,3562,0],["BFH/PA","BFH/PA",1,0,0],["BFIN","BankFinancial Corporation",84,158,0],["BFIX","BFIX",1,0,0],["BFJL","BFJL",1,0,0],["BFK","BlackRock Municipal Income Trust",116,0,0],["BFLY","Butterfly Network Inc. Class A",132,899,0],["BFOC","BFOC",1,0,0],["BFOR","BFOR",1,0,0],["BFRE","BFRE",1,0,0],["BFRG","Bullfrog AI Holdings Inc.",8,17,0],["BFRI","Biofrontera Inc.",8,9,0],["BFRZ","BFRZ",1,0,0],["BFS","Saul Centers Inc.",30,766,0],["BFS/PD","BFS/PD",1,0,0],["BFS/PE","BFS/PE",1,0,0],["BFST","Business First Bancshares Inc.",26,819,0],["BFZ","BlackRock California Municipal Income Trust",116,0,0],["BG","Bunge Limited",17,17687,0],["BGB","Blackstone Strategic Credit 2027 Term Fund",81,0,0],["BGC","BGC Group Inc. Class A",60,4223,0],["BGDV","BGDV",1,0,0],["BGH","Barings Global Short Duration High Yield Fund",11,0,0],["BGI","Birks Group Inc.",94,18,0],["BGIG","BGIG",1,0,0],["BGIN","Bgin Blockchain Limited Class A",1,230,0],["BGL","Blue Gold Limited Class A",10,90,0],["BGLC","BioNexus Gene Lab Corp",23,8,0],["BGM","BGM Group Ltd. Class A",8,424,0],["BGMS","Bio Green Med Solution Inc.",1,0,0],["BGMSP","Bio Green Med Solution Inc. 6% Convertible",1,0,0],["BGR","BlackRock Energy and Resources Trust",81,1820,0],["BGRN","BGRN",1,0,0],["BGRO","BGRO",1,0,0],["BGS","B&G Foods Inc.",17,366,0],["BGSF","BGSF Inc.",19,52,0],["BGSI","Boyd Group Services Inc.",1,4468,0],["BGT","BlackRock Floating Rate Income Trust",81,0,0],["BGX","Blackstone Long Short Credit Income Fund",81,0,0],["BGY","Blackrock Enhanced International Dividend Trust",81,0,0],["BH","Biglari Holdings Inc. Class B",68,795,0],["BH.A","BH.A",1,0,0],["BHAT","Blue Hat Interactive Entertainment Technology",61,9,0],["BHB","Bar Harbor Bankshares Inc.",26,541,0],["BHC","Bausch Health Companies Inc.",8,2549,0],["BHE","Benchmark Electronics Inc.",39,1588,0],["BHF","Brighthouse Financial Inc.",5,3711,0],["BHFAL","Brighthouse Financial Inc. 6.25% Junior Subordinated Debentures due 2058",5,951,0],["BHFAM","Brighthouse Financial Inc.",5,638,0],["BHFAN","Brighthouse Financial Inc.",5,726,0],["BHFAO","Brighthouse Financial Inc.",5,892,0],["BHFAP","Brighthouse Financial Inc.",5,873,0],["BHK","Blackrock Core Bond Trust",116,0,0],["BHM","Bluerock Homes Trust Inc. Class A",30,36,0],["BHP","BHP Group Limited",65,150641,0],["BHR","Braemar Hotels & Resorts Inc.",30,198,0],["BHR/PB","BHR/PB",1,0,0],["BHR/PD","BHR/PD",1,0,0],["BHRB","Burke & Herbert Financial Services Corp.",26,994,0],["BHST","BioHarvest Sciences Inc.",1,118,0],["BHV","BlackRock Virginia Municipal Bond Trust",123,0,0],["BHVN","Biohaven Ltd.",8,1149,0],["BIAF","bioAffinity Technologies Inc.",14,6,0],["BIB","BIB",1,0,0],["BIBL","BIBL",1,0,0],["BIDD","BIDD",1,0,0],["BIDG","BIDG",1,0,0],["BIDU","Baidu Inc. ADS",16,42566,0],["BIGY","BIGY",1,0,0],["BIIB","Biogen Inc.",13,25644,0],["BIL","BIL",1,0,0],["BILD","BILD",1,0,0],["BILI","Bilibili Inc.",15,10328,0],["BILL","BILL Holdings Inc.",15,5607,0],["BILS","BILS",1,0,0],["BILZ","BILZ",1,0,0],["BINC","BINC",1,0,0],["BINT","BINT",1,0,0],["BIO","Bio-Rad Laboratories Inc. Class A",71,8134,0],["BIOA","BioAge Labs Inc.",8,480,0],["BIOX","Bioceres Crop Solutions Corp.",85,89,0],["BIP","Brookfield Infrastructure Partners LP Limited Partnership",98,16083,0],["BIP/PA","BIP/PA",1,0,0],["BIP/PB","BIP/PB",1,0,0],["BIPC","Brookfield Infrastructure Corporation Brookfield Infrastructure Corporation",59,6085,0],["BIPH","Brookfield Infrastructure Corporation 5.000% Subordinated Notes due 2081",59,7668,0],["BIPI","BIP Bermuda Holdings I Limited 5.125% Perpetual Subordinated Notes",98,160,0],["BIPJ","Brookfield Infrastructure Corporation 7.250% Subordinated Notes due 2084",59,11524,0],["BIRD","Allbirds Inc. Class A",86,33,0],["BIRK","Birkenstock Holding plc",114,7996,0],["BIS","BIS",1,0,0],["BIT","BlackRock Multi-Sector Income Trust",81,0,0],["BITB","BITB",1,0,0],["BITC","BITC",1,0,0],["BITF","Bitfarms Ltd.",44,1513,0],["BITI","BITI",1,0,0],["BITO","BITO",1,0,0],["BITQ","BITQ",1,0,0],["BITS","BITS",1,0,0],["BITU","BITU",1,0,0],["BITW","BITW",1,0,0],["BIV","BIV",1,0,0],["BIVI","BioVie Inc. Class A",8,11,0],["BIXI","Bitcoin Infrastructure Acquisition Corp Ltd. Class A",1,0,0],["BIXIU","Bitcoin Infrastructure Acquisition Corp Ltd. Unit",2,0,0],["BIYA","Baiya International Group Inc.",12,3,0],["BIZD","BIZD",1,0,0],["BJ","BJ\'s Wholesale Club Holdings Inc.",113,12386,0],["BJDX","Bluejay Diagnostics Inc.",31,1,0],["BJK","BJK",1,0,0],["BJRI","BJ\'s Restaurants Inc.",68,875,0],["BK","The Bank of New York Mellon Corporation",26,80781,0],["BK/PK","BK/PK",1,0,0],["BKAG","BKAG",1,0,0],["BKCG","BKCG",1,0,0],["BKCH","BKCH",1,0,0],["BKCI","BKCI",1,0,0],["BKD","Brookdale Senior Living Inc.",126,2564,0],["BKDV","BKDV",1,0,0],["BKE","Buckle Inc. (The)",120,2873,0],["BKEM","BKEM",1,0,0],["BKF","BKF",1,0,0],["BKH","Black Hills Corporation",41,5094,0],["BKHA","BKHA",1,0,0],["BKHAU","Black Hawk Acquisition Corporation",1,0,0],["BKHY","BKHY",1,0,0],["BKIE","BKIE",1,0,0],["BKKT","Bakkt Holdings Inc. Class A",44,254,0],["BKLC","BKLC",1,0,0],["BKLN","BKLN",1,0,0],["BKMC","BKMC",1,0,0],["BKN","BlackRock Investment Quality Municipal Trust Inc. (The)",81,0,0],["BKNG","Booking Holdings Inc.",87,173861,0],["BKR","Baker Hughes Company Class A",88,44119,0],["BKSE","BKSE",1,0,0],["BKSY","BlackSky Technology Inc. Class A",49,798,0],["BKT","BlackRock Income Trust Inc. (The)",60,1639,0],["BKTI","BK Technologies Corporation",49,292,0],["BKU","BankUnited Inc.",84,3404,0],["BKUI","BKUI",1,0,0],["BKV","BKV Corporation",59,2565,0],["BKYI","BIO-key International Inc.",25,11,0],["BL","BlackLine Inc.",25,3441,0],["BLBD","Blue Bird Corporation",72,1640,0],["BLBX","Blackboxstocks Inc.",15,34,0],["BLCN","BLCN",1,0,0],["BLCO","Bausch + Lomb Corporation",111,6014,0],["BLCR","BLCR",1,0,0],["BLCV","BLCV",1,0,0],["BLD","TopBuild Corp.",82,11980,0],["BLDP","Ballard Power Systems Inc.",7,785,0],["BLDR","Builders FirstSource Inc.",130,11477,0],["BLE","BlackRock Municipal Income Trust II",123,0,0],["BLES","BLES",1,0,0],["BLFS","BioLife Solutions Inc.",77,1207,0],["BLFY","Blue Foundry Bancorp",43,262,0],["BLGR","BLGR",1,0,0],["BLIN","Bridgeline Digital Inc.",25,12,0],["BLIV","BeLive Holdings",15,42,0],["BLK","BlackRock Inc.",60,164486,0],["BLKB","Blackbaud Inc.",25,3044,0],["BLLN","BillionToOne Inc. Class A",23,4696,0],["BLMN","Bloomin\' Brands Inc.",68,590,0],["BLND","Blend Labs Inc. Class A",16,803,0],["BLNE","Beeline Holdings Inc.",44,56,0],["BLNK","Blink Charging Co.",32,110,0],["BLOK","BLOK",1,0,0],["BLOX","BLOX",1,0,0],["BLRKU","Bluerock Acquisition Corp. Unit",1,0,0],["BLRX","BioLineRx Ltd.",8,11,0],["BLSG","BLSG",1,0,0],["BLSH","Bullish",44,6520,0],["BLST","BLST",1,0,0],["BLTD","BLTD",1,0,0],["BLTE","Belite Bio Inc",8,5852,0],["BLUC","BLUC",1,0,0],["BLUI","BLUI",1,0,0],["BLUW","Blue Water Acquisition Corp. III Class A",1,75,0],["BLUWU","Blue Water Acquisition Corp. III Unit.",13,0,0],["BLUX","BLUX",1,0,0],["BLV","BLV",1,0,0],["BLW","Blackrock Limited Duration Income Trust",3,494,0],["BLX","Banco Latinoamericano de Comercio Exterior S.A.",75,1611,0],["BLZE","Backblaze Inc. Class A",25,278,0],["BLZR","Trailblazer Acquisition Corp. Class A",2,0,0],["BLZRU","Trailblazer Acquisition Corp. Unit",1,0,0],["BMA","Banco Macro S.A. ADR (representing Ten Class B",75,5757,0],["BMAX","BMAX",1,0,0],["BMBL","Bumble Inc. Class A",16,390,0],["BMDL","BMDL",1,0,0],["BME","Blackrock Health Sciences Trust",81,547,0],["BMEA","Biomea Fusion Inc.",8,99,0],["BMED","BMED",1,0,0],["BMEZ","BlackRock Health Sciences Term Trust",81,202,0],["BMGL","Basel Medical Group Ltd",35,14,0],["BMHL","Bluemount Holdings Limited Class B",44,88,0],["BMI","Badger Meter Inc.",7,5353,0],["BML/PG","BML/PG",1,0,0],["BML/PH","BML/PH",1,0,0],["BML/PJ","BML/PJ",1,0,0],["BML/PL","BML/PL",1,0,0],["BMN","BlackRock 2037 Municipal Target Term Trust",81,0,0],["BMNG","BMNG",1,0,0],["BMNR","BitMine Immersion Technologies Inc.",44,12044,0],["BMNZ","BMNZ",1,0,0],["BMO","Bank Of Montreal",75,91959,0],["BMR","Beamr Imaging Ltd.",25,31,0],["BMRA","Biomerica Inc.",24,7,0],["BMRC","Bank of Marin Bancorp",26,437,0],["BMRN","BioMarin Pharmaceutical Inc.",8,11748,0],["BMVP","BMVP",1,0,0],["BMY","Bristol-Myers Squibb Company",8,110317,0],["BN","Brookfield Corporation Class A Limited Voting Shares",134,101669,0],["BNAI","Brand Engagement Network Inc.",15,8,0],["BNBX","BNB Plus Corp.",3,3,0],["BNC","CEA Industries Inc.",7,297,0],["BND","BND",1,0,0],["BNDC","BNDC",1,0,0],["BNDD","BNDD",1,0,0],["BNDI","BNDI",1,0,0],["BNDP","BNDP",1,0,0],["BNDS","BNDS",1,0,0],["BNDW","BNDW",1,0,0],["BNDX","BNDX",1,0,0],["BNED","Barnes & Noble Education Inc",66,292,0],["BNGE","BNGE",1,0,0],["BNGO","Bionano Genomics Inc.",71,16,0],["BNH","Brookfield Finance Inc. 4.625% Subordinated Notes due October 16 2080",134,24607,0],["BNJ","Brookfield Finance Inc. 4.50% Perpetual Subordinated Notes",134,23001,0],["BNKD","BNKD",1,0,0],["BNKK","Bonk Inc.",90,21,0],["BNKU","BNKU",1,0,0],["BNL","Broadstone Net Lease Inc.",30,3315,0],["BNO","BNO",1,0,0],["BNR","Burning Rock Biotech Limited",23,234,0],["BNRG","Brenmiller Energy Ltd",91,3,0],["BNS","Bank Nova Scotia Halifax Pfd 3",26,90064,0],["BNT","Brookfield Wealth Solutions Ltd. Class A Exchangeable Limited Voting Shares",22,13920,0],["BNTC","Benitec Biopharma Inc.",8,389,0],["BNTX","BioNTech SE American",13,22197,0],["BNY","BlackRock New York Municipal Income Trust",81,0,0],["BNZI","Banzai International Inc. Class A",25,10,0],["BOAT","BOAT",1,0,0],["BOBP","BOBP",1,0,0],["BOC","Boston Omaha Corporation Class A",36,394,0],["BODI","The Beachbody Company Inc. Class A",3,80,0],["BOE","Blackrock Enhanced Global Dividend Trust",81,0,0],["BOED","BOED",1,0,0],["BOEG","BOEG",1,0,0],["BOEU","BOEU",1,0,0],["BOF","BranchOut Food Inc.",17,42,0],["BOH","Bank of Hawaii Corporation",26,2822,0],["BOH/PA","BOH/PA",1,0,0],["BOH/PB","BOH/PB",1,0,0],["BOIL","BOIL",1,0,0],["BOKF","BOK Financial Corporation",26,7588,0],["BOLD","Boundless Bio Inc.",8,27,0],["BOLT","Bolt Biotherapeutics Inc.",8,10,0],["BON","Bon Natural Life Limited Class A",18,4,0],["BOND","BOND",1,0,0],["BOOM","DMC Global Inc.",32,132,0],["BOOT","Boot Barn Holdings Inc.",120,5826,0],["BORR","Borr Drilling Limited",59,1197,0],["BOSC","B.O.S. Better Online Solutions",51,26,0],["BOTJ","Bank of the James Financial Group Inc.",26,82,0],["BOTT","BOTT",1,0,0],["BOTZ","BOTZ",1,0,0],["BOUT","BOUT",1,0,0],["BOW","Bowhead Specialty Holdings Inc.",22,918,0],["BOX","Box Inc. Class A",25,4360,0],["BOXL","Boxlight Corporation Class A",3,4,0],["BP","BP p.l.c.",106,88540,0],["BPACU","Blueport Acquisition Ltd",2,0,0],["BPAY","BPAY",1,0,0],["BPH","BPH",1,0,0],["BPI","BPI",1,0,0],["BPOP","Popular Inc.",26,8331,0],["BPOPM","Popular Inc. Popular Capital Trust II - 6.125% Cumulative Monthly Income Trust Preferred Securities",26,1677,0],["BPRE","Bluerock Private Real Estate Fund",1,0,0],["BPRN","Princeton Bancorp Inc.",26,239,0],["BPYPM","Brookfield Property Partners L.P. 6.25% Class A Cumulative Redeemable Preferred",36,16186,0],["BPYPN","Brookfield Property Partners L.P. 5.750% Class A Cumulative Redeemable Perpetual Preferred",36,14066,0],["BPYPO","Brookfield Property Partners L.P. 6.375% Class A Cumulative Redeemable Perpetual Preferred",36,15251,0],["BPYPP","Brookfield Property Partners L.P. 6.50% Class A Cumulative Redeemable Perpetual Preferred",36,15469,0],["BQ","Boqii Holding Limited Class A",66,6,0],["BR","Broadridge Financial Solutions Inc.",36,26376,0],["BRAG","Bragg Gaming Group Inc.",92,55,0],["BRAZ","BRAZ",1,0,0],["BRBI","BRBI BR Partners S.A. ADSs",44,668,0],["BRBR","BellRing Brands Inc.",17,3475,0],["BRBS","Blue Ridge Bankshares Inc.",26,408,0],["BRC","Brady Corporation",69,3820,0],["BRCB","Black Rock Coffee Bar Inc. Class A",68,1136,0],["BRCC","BRC Inc. Class A",46,313,0],["BRCE","BRCE",1,0,0],["BREM","BREM",1,0,0],["BRF","BRF",1,0,0],["BRFH","Barfresh Food Group Inc.",17,45,0],["BRHY","BRHY",1,0,0],["BRIA","BrilliA Inc Class A",86,51,0],["BRID","Bridgford Foods Corporation",93,67,0],["BRIE","BRIE",1,0,0],["BRIF","BRIF",1,0,0],["BRK.A","BRK.A",1,0,0],["BRK.B","BRK.B",1,0,0],["BRKC","BRKC",1,0,0],["BRKD","BRKD",1,0,0],["BRKR","Bruker Corporation",71,7062,0],["BRKRP","Bruker Corporation 6.375% Mandatory Convertible",71,54723,0],["BRKU","BRKU",1,0,0],["BRLS","Borealis Foods Inc. Class A",17,39,0],["BRLT","Brilliant Earth Group Inc. Class A",94,181,0],["BRN","Barnwell Industries Inc.",59,11,0],["BRNS","Barinthus Biotherapeutics plc",8,30,0],["BRNY","BRNY",1,0,0],["BRO","Brown & Brown Inc.",28,27375,0],["BROS","Dutch Bros Inc. Class A",68,10666,0],["BRR","ProCap Financial Inc.",44,263,0],["BRRR","BRRR",1,0,0],["BRSL","Brightstar Lottery PLC Trading under the Legal Name to begin at the market open on July 21 2025.",45,3251,0],["BRSP","BrightSpire Capital Inc. Class A",30,764,0],["BRT","BRT Apartments Corp. (MD)",30,281,0],["BRTR","BRTR",1,0,0],["BRTX","BioRestorative Therapies Inc.",95,10,0],["BRW","Saba Capital Income & Opportunities Fund SBI",81,0,0],["BRX","Brixmor Property Group Inc.",30,7888,0],["BRZE","Braze Inc. Class A",25,3980,0],["BRZU","BRZU",1,0,0],["BSAA","BSAA",1,0,0],["BSAAU","BSAAU",1,0,0],["BSAC","Banco Santander - Chile ADS",75,14459,0],["BSBK","Bogota Financial Corp.",43,106,0],["BSBR","Banco Santander Brasil SA",75,43937,0],["BSCQ","BSCQ",1,0,0],["BSCR","BSCR",1,0,0],["BSCS","BSCS",1,0,0],["BSCT","BSCT",1,0,0],["BSCU","BSCU",1,0,0],["BSCV","BSCV",1,0,0],["BSCW","BSCW",1,0,0],["BSCX","BSCX",1,0,0],["BSCY","BSCY",1,0,0],["BSCZ","BSCZ",1,0,0],["BSET","Bassett Furniture Industries Incorporated",73,153,0],["BSJQ","BSJQ",1,0,0],["BSJR","BSJR",1,0,0],["BSJS","BSJS",1,0,0],["BSJT","BSJT",1,0,0],["BSJU","BSJU",1,0,0],["BSJV","BSJV",1,0,0],["BSJW","BSJW",1,0,0],["BSJX","BSJX",1,0,0],["BSL","Blackstone Senior Floating Rate 2027 Term Fund",81,0,0],["BSLK","Bolt Projects Holdings Inc.",34,7,0],["BSM","Black Stone Minerals L.P. Common",59,3036,0],["BSMQ","BSMQ",1,0,0],["BSMR","BSMR",1,0,0],["BSMS","BSMS",1,0,0],["BSMT","BSMT",1,0,0],["BSMU","BSMU",1,0,0],["BSMV","BSMV",1,0,0],["BSMW","BSMW",1,0,0],["BSMY","BSMY",1,0,0],["BSMZ","BSMZ",1,0,0],["BSOL","BSOL",1,0,0],["BSR","BSR",1,0,0],["BSRR","Sierra Bancorp",26,450,0],["BSSX","BSSX",1,0,0],["BST","BlackRock Science and Technology Trust",116,914,0],["BSTP","BSTP",1,0,0],["BSTZ","BlackRock Science and Technology Term Trust",81,515,0],["BSV","BSV",1,0,0],["BSVN","Bank7 Corp.",26,414,0],["BSVO","BSVO",1,0,0],["BSX","Boston Scientific Corporation",31,141736,0],["BSY","Bentley Systems Incorporated Class B",25,12066,0],["BTA","BlackRock Long-Term Municipal Advantage Trust",81,0,0],["BTAI","BioXcel Therapeutics Inc.",8,38,0],["BTAL","BTAL",1,0,0],["BTBD","BT Brands Inc.",68,11,0],["BTBT","Bit Digital Inc.",44,722,0],["BTC","BTC",1,0,0],["BTCC","BTCC",1,0,0],["BTCS","BTCS Inc.",44,149,0],["BTCT","BTC Digital Ltd.",3,12,0],["BTDR","Bitdeer Technologies Group Class A",44,2166,0],["BTE","Baytex Energy Corp",59,2374,0],["BTF","BTF",1,0,0],["BTG","B2Gold Corp",104,6039,0],["BTGD","BTGD",1,0,0],["BTI","British American Tobacco Industries p.l.c.",18,123165,0],["BTM","Bitcoin Depot Inc. Class A",44,99,0],["BTMD","Biote Corp. Class A",18,127,0],["BTO","John Hancock Financial Opportunities Fund",11,0,0],["BTOC","Armlogi Holding Corp.",92,25,0],["BTOG","Bit Origin Limited Class A",44,19,0],["BTOP","BTOP",1,0,0],["BTOT","BTOT",1,0,0],["BTQ","BTQ Technologies Corp.",1,893,0],["BTR","BTR",1,0,0],["BTRN","BTRN",1,0,0],["BTSG","BrightSpring Health Services Inc.",35,6761,0],["BTSGU","BrightSpring Health Services Inc. Tangible Equity Unit",35,22957,0],["BTT","BlackRock Municipal 2030 Target Term Trust",11,0,0],["BTTC","Black Titan Corporation",13,3,0],["BTU","Peabody Energy Corporation",65,3754,0],["BTX","BlackRock Technology and Private Equity Term Trust",1,1585,0],["BTZ","BlackRock Credit Allocation Income Trust",116,1177,0],["BU","BU",1,0,0],["BUCK","BUCK",1,0,0],["BUD","Anheuser-Busch Inbev SA Sponsored ADR (Belgium)",46,115901,0],["BUFC","BUFC",1,0,0],["BUFI","BUFI",1,0,0],["BUFM","BUFM",1,0,0],["BUG","BUG",1,0,0],["BUI","BlackRock Utility Infrastructure & Power Opportunities Trust",81,0,0],["BUL","BUL",1,0,0],["BULD","BULD",1,0,0],["BULG","BULG",1,0,0],["BULL","Webull Corporation Class A",60,3955,0],["BULX","BULX",1,0,0],["BULZ","BULZ",1,0,0],["BUR","Burford Capital Limited",44,2028,0],["BURL","Burlington Stores Inc.",113,17542,0],["BURU","Nuburu Inc.",7,93,0],["BUSE","First Busey Corporation Class A",26,2210,0],["BUSEP","First Busey Corporation",26,2286,0],["BUUU","BUUU Group Limited Class A",45,132,0],["BUXX","BUXX",1,0,0],["BUYO","BUYO",1,0,0],["BUZZ","BUZZ",1,0,0],["BV","BrightView Holdings Inc.",36,1206,0],["BVAL","BVAL",1,0,0],["BVFL","BV Financial Inc.",84,174,0],["BVN","Buenaventura Mining Company Inc.",10,7201,0],["BVS","Bioventus Inc. Class A",31,620,0],["BW","Babcock & Wilcox Enterprises Inc.",91,544,0],["BW/PA","BW/PA",1,0,0],["BWA","BorgWarner Inc.",42,9633,0],["BWAY","BrainsWay Ltd.",31,323,0],["BWB","Bridgewater Bancshares Inc.",26,508,0],["BWBBP","Bridgewater Bancshares Inc.",26,529,0],["BWEB","BWEB",1,0,0],["BWEN","Broadwind Inc.",55,69,0],["BWET","BWET",1,0,0],["BWFG","Bankwell Financial Group Inc.",26,384,0],["BWG","BrandywineGLOBAL Global Income Opportunities Fund Inc.",123,0,0],["BWIN","The Baldwin Insurance Group Inc. Class A",28,2811,0],["BWLP","BW LPG Limited",87,1896,0],["BWMN","Bowman Consulting Group Ltd.",19,582,0],["BWMX","Betterware de Mexico S.A.P.I. de C.V.",57,515,0],["BWNB","Babcock & Wilcox Enterprises Inc. 6.50% Senior Notes due 2026",91,2465,0],["BWOW","BWOW",1,0,0],["BWX","BWX",1,0,0],["BWXT","BWX Technologies Inc.",7,16130,0],["BWZ","BWZ",1,0,0],["BX","Blackstone Inc.",11,111942,0],["BXC","Bluelinx Holdings Inc.",150,494,0],["BXMT","Blackstone Mortgage Trust Inc.",30,3375,0],["BXMX","Nuveen S&P 500 Buy-Write Income Fund",11,0,0],["BXP","BXP Inc.",30,10888,0],["BXSL","Blackstone Secured Lending Fund",81,0,0],["BY","Byline Bancorp Inc.",26,1398,0],["BYAH","Park Ha Biological Technology Co. Ltd.",90,6,0],["BYD","Boyd Gaming Corporation",47,6747,0],["BYFC","Broadway Financial Corporation Class A",84,54,0],["BYLD","BYLD",1,0,0],["BYM","Blackrock Municipal Income Quality Trust",11,0,0],["BYND","Beyond Meat Inc.",17,503,0],["BYRE","BYRE",1,0,0],["BYRN","Byrna Technologies Inc.",7,394,0],["BYSI","BeyondSpring Inc.",8,95,0],["BZ","KANZHUN LIMITED American Depository Shares",16,9051,0],["BZAI","Blaize Holdings Inc.",2,262,0],["BZFD","BuzzFeed Inc. Class A",33,34,0],["BZH","Beazer Homes USA Inc.",121,624,0],["BZQ","BZQ",1,0,0],["BZUN","Baozun Inc.",57,158,0],["C","Citigroup Inc.",26,205515,0],["C/PN","C/PN",1,0,0],["CA","CA",1,0,0],["CAAA","CAAA",1,0,0],["CAAP","Corporacion America Airports SA",50,4101,0],["CAAS","China Automotive Systems Inc.",42,130,0],["CABA","Cabaletta Bio Inc.",13,230,0],["CABO","Cable One Inc.",54,716,0],["CABR","Caring Brands Inc.",90,14,0],["CAC","Camden National Corporation",26,778,0],["CACC","Credit Acceptance Corporation",44,5098,0],["CACI","CACI International Inc. Class A",15,12290,0],["CADE","Cadence Bank",26,7979,0],["CADE/PA","CADE/PA",1,0,0],["CADL","Candel Therapeutics Inc.",13,306,0],["CAE","CAE Inc.",7,9695,0],["CAEP","Cantor Equity Partners III Inc. Class A",1,0,0],["CAF","Morgan Stanley China A Share Fund Inc.",11,0,0],["CAFG","CAFG",1,0,0],["CAFX","CAFX",1,0,0],["CAG","ConAgra Brands Inc.",17,8299,0],["CAH","Cardinal Health Inc.",112,48220,0],["CAI","Caris Life Sciences Inc.",23,7883,0],["CAIE","CAIE",1,0,0],["CAIQ","CAIQ",1,0,0],["CAKE","Cheesecake Factory Incorporated (The)",68,2593,0],["CAL","Caleres Inc.",114,447,0],["CALC","CalciMedica Inc.",8,91,0],["CALI","CALI",1,0,0],["CALM","Cal-Maine Foods Inc.",48,4156,0],["CALX","Calix Inc",33,3625,0],["CAM","CAM",1,0,0],["CAML","CAML",1,0,0],["CAMP","CAMP4 Therapeutics Corporation",1,467,0],["CAMT","Camtek Ltd.",76,4744,0],["CAMX","CAMX",1,0,0],["CAN","Canaan Inc.",6,346,0],["CANC","CANC",1,0,0],["CANE","CANE",1,0,0],["CANF","Can-Fite Biopharma Ltd Sponsored ADR (Israel)",8,3,0],["CANG","Cango Inc. Class A",25,161,0],["CANQ","CANQ",1,0,0],["CAPE","CAPE",1,0,0],["CAPL","CrossAmerica Partners LP Common",80,781,0],["CAPN","Cayson Acquisition Corp",1,0,0],["CAPR","Capricor Therapeutics Inc.",8,1438,0],["CAPS","Capstone Holding Corp.",130,6,0],["CAPT","Captivision Inc.",7,12,0],["CAR","Avis Budget Group Inc.",96,4596,0],["CARD","CARD",1,0,0],["CARE","Carter Bankshares Inc.",26,443,0],["CARG","CarGurus Inc. Class A",15,3686,0],["CARK","CARK",1,0,0],["CARL","Carlsmed Inc.",31,342,0],["CARR","Carrier Global Corporation",7,45286,0],["CARS","Cars.com Inc.",15,772,0],["CART","Maplebear Inc.",36,12061,0],["CARU","CARU",1,0,0],["CARY","CARY",1,0,0],["CARZ","CARZ",1,0,0],["CAS","CAS",1,0,0],["CASH","Pathward Financial Inc.",26,1685,0],["CASI","CASI Pharmaceuticals Inc.",8,13,0],["CASS","Cass Information Systems Inc",36,567,0],["CASY","Casey\'s General Stores Inc.",97,20702,0],["CAT","Caterpillar Inc.",72,269659,0],["CATF","CATF",1,0,0],["CATH","CATH",1,0,0],["CATO","Cato Corporation (The) Class A",120,61,0],["CATX","Perspective Therapeutics Inc.",31,204,0],["CATY","Cathay General Bancorp",26,3432,0],["CAVA","CAVA Group Inc.",68,6601,0],["CB","Chubb Limited ",22,122237,0],["CBAN","Colony Bankcorp Inc.",26,320,0],["CBAT","CBAK Energy Technology Inc.",7,82,0],["CBC","Central Bancompany Inc. Class A",1,5580,0],["CBFV","CB Financial Services Inc.",26,188,0],["CBIO","Crescent Biopharma Inc.",8,165,0],["CBK","Commercial Bancgroup Inc.",26,310,0],["CBL","CBL & Associates Properties Inc.",30,1138,0],["CBLL","CeriBell Inc.",77,786,0],["CBLS","CBLS",1,0,0],["CBNA","Chain Bridge Bancorp Inc. Class A",26,251,0],["CBNK","Capital Bancorp Inc.",26,480,0],["CBON","CBON",1,0,0],["CBRE","CBRE Group Inc",36,48100,0],["CBRL","Cracker Barrel Old Country Store Inc",68,585,0],["CBSE","CBSE",1,0,0],["CBSH","Commerce Bancshares Inc.",26,7342,0],["CBT","Cabot Corporation",34,3498,0],["CBU","Community Financial System Inc.",26,3176,0],["CBUS","Cibus Inc. Class A",85,93,0],["CBZ","CBIZ Inc.",36,2847,0],["CC","Chemours Company (The)",34,1772,0],["CCAP","Crescent Capital BDC Inc.",44,542,0],["CCB","Coastal Financial Corporation",26,1767,0],["CCBG","Capital City Bank Group",26,748,0],["CCC","CCC Intelligent Solutions Holdings Inc.",25,5072,0],["CCCC","C4 Therapeutics Inc.",13,302,0],["CCCX","Churchill Capital Corp X Class A",2,0,0],["CCCXU","Churchill Capital Corp X Unit",2,0,0],["CCD","Calamos Dynamic Convertible & Income Fund",81,0,0],["CCEC","Capital Clean Energy Carriers Corp.",98,1231,0],["CCEF","CCEF",1,0,0],["CCEL","Cryo-Cell International Inc.",137,30,0],["CCEP","Coca-Cola Europacific Partners plc",46,41830,0],["CCFE","CCFE",1,0,0],["CCG","Cheche Group Inc. Class A",28,78,0],["CCHH","CCH Holdings Ltd",68,12,0],["CCI","Crown Castle Inc.",30,37495,0],["CCID","Carlyle Credit Income Fund 7.375% Series D Term",1,0,0],["CCIF","Carlyle Credit Income Fund Shares of Beneficial Interest",123,0,0],["CCII","Cohen Circle Acquisition Corp. II Class A",1,0,0],["CCIIU","Cohen Circle Acquisition Corp. II Unit",1,0,0],["CCIX","Churchill Capital Corp IX",15,0,0],["CCIXU","Churchill Capital Corp IX Unit",15,0,0],["CCJ","Cameco Corporation",52,39182,0],["CCK","Crown Holdings Inc.",125,11764,0],["CCL","Carnival Corporation",98,42199,0],["CCLD","CareCloud Inc.",25,136,0],["CCLDO","CareCloud Inc. 8.75% Series B Cumulative Redeemable Perpetual",25,1077,0],["CCM","Concord Medical Services Holdings Limited",35,18,0],["CCNE","CNB Financial Corporation",26,807,0],["CCNEP","CNB Financial Corporation",26,730,0],["CCNR","CCNR",1,0,0],["CCO","Clear Channel Outdoor Holdings Inc.",58,1015,0],["CCOI","Cogent Communications Holdings Inc.",33,1070,0],["CCOR","CCOR",1,0,0],["CCRN","Cross Country Healthcare Inc.",19,260,0],["CCRP","CCRP",1,0,0],["CCS","Century Communities Inc.",121,1752,0],["CCSB","CCSB",1,0,0],["CCSI","Consensus Cloud Solutions Inc.",25,439,0],["CCSO","CCSO",1,0,0],["CCTG","CCSC Technology International Holdings Limited Class A",91,2,0],["CCU","Compania Cervecerias Unidas S.A.",46,924,0],["CCXIU","Churchill Capital Corp XI",2,0,0],["CCZ","Comcast Holdings ZONES",54,227379,0],["CD","Chaince Digital Holdings Inc.",44,336,0],["CDC","CDC",1,0,0],["CDE","Coeur Mining Inc.",104,11720,0],["CDEI","CDEI",1,0,0],["CDIG","CDIG",1,0,0],["CDIO","Cardio Diagnostics Holdings Inc.",24,6,0],["CDL","CDL",1,0,0],["CDLR","Cadeler A/S American Depositary Share (each representing four (4)",98,1626,0],["CDLX","Cardlytics Inc.",16,56,0],["CDNA","CareDx Inc.",23,1000,0],["CDNL","Cardinal Infrastructure Group Inc. Class A",21,881,0],["CDNS","Cadence Design Systems Inc.",25,85719,0],["CDP","COPT Defense Properties",30,3243,0],["CDR/PB","CDR/PB",1,0,0],["CDR/PC","CDR/PC",1,0,0],["CDRE","Cadre Holdings Inc.",32,1692,0],["CDRO","Codere Online Luxembourg S.A.",45,364,0],["CDT","CDT Equity Inc.",8,3,0],["CDTG","CDT Environmental Technology Investment Holdings Limited",99,5,0],["CDTX","Cidara Therapeutics Inc.",13,6942,0],["CDW","CDW Corporation",100,18312,0],["CDX","CDX",1,0,0],["CDXS","Codexis Inc.",34,150,0],["CDZI","CADIZ Inc.",70,445,0],["CDZIP","Cadiz Inc.",70,1629,0],["CE","Celanese Corporation",34,4631,0],["CECO","CECO Environmental Corp.",101,2092,0],["CEE","The Central and Eastern Europe Fund Inc. (The)",116,0,0],["CEF","CEF",1,0,0],["CEFA","CEFA",1,0,0],["CEFD","CEFD",1,0,0],["CEG","Constellation Energy Corporation",41,110988,0],["CELC","Celcuity Inc.",23,4681,0],["CELH","Celsius Holdings Inc.",46,11033,0],["CELU","Celularity Inc. Class A",8,41,0],["CELZ","Creative Medical Technology Holdings Inc.",44,5,0],["CENN","Cenntro Inc.",37,14,0],["CENT","Central Garden & Pet Company",94,1996,0],["CENTA","Central Garden & Pet Company Class A",94,1811,0],["CENX","Century Aluminum Company",102,3380,0],["CEPF","Cantor Equity Partners IV Inc. Class A",2,0,0],["CEPI","CEPI",1,0,0],["CEPO","Cantor Equity Partners I Inc. Class A",2,0,0],["CEPT","Cantor Equity Partners II Inc. Class A",2,0,0],["CEPU","Central Puerto S.A.",41,2657,0],["CEPV","Cantor Equity Partners V Inc. Class A",1,0,0],["CERS","Cerus Corporation",15,401,0],["CERT","Certara Inc.",25,1445,0],["CERY","CERY",1,0,0],["CET","Central Securities Corporation",123,12232,0],["CETX","Cemtrex Inc.",39,16,0],["CETY","Clean Energy Technologies Inc.",55,14,0],["CEV","Eaton Vance California Municipal Income Trust Shares of Beneficial Interest",123,71,0],["CEVA","CEVA Inc.",16,510,0],["CEW","CEW",1,0,0],["CF","CF Industries Holdings Inc.",85,12275,0],["CFA","CFA",1,0,0],["CFBK","CF Bankshares Inc.",26,171,0],["CFFI","C&F Financial Corporation",26,249,0],["CFFN","Capitol Federal Financial Inc.",84,946,0],["CFG","Citizens Financial Group Inc.",26,25421,0],["CFG/PE","CFG/PE",1,0,0],["CFG/PH","CFG/PH",1,0,0],["CFG/PI","CFG/PI",1,0,0],["CFLT","Confluent Inc. Class A",25,10481,0],["CFND","C1 Fund Inc.",1,0,0],["CFO","CFO",1,0,0],["CFR","Cullen/Frost Bankers Inc.",26,8250,0],["CFR/PB","CFR/PB",1,0,0],["CG","The Carlyle Group Inc.",11,21459,0],["CGABL","The Carlyle Group Inc. 4.625% Subordinated Notes due 2061",11,6326,0],["CGAU","Centerra Gold Inc.",104,2927,0],["CGBD","Carlyle Secured Lending Inc.",44,913,0],["CGBL","CGBL",1,0,0],["CGC","Canopy Growth Corporation",18,545,0],["CGCB","CGCB",1,0,0],["CGCP","CGCP",1,0,0],["CGCT","Cartesian Growth Corporation III Class A",2,0,0],["CGCTU","Cartesian Growth Corporation III Unit",2,0,0],["CGCV","CGCV",1,0,0],["CGDG","CGDG",1,0,0],["CGDV","CGDV",1,0,0],["CGEM","Cullinan Therapeutics Inc.",13,572,0],["CGEN","Compugen Ltd.",13,142,0],["CGGE","CGGE",1,0,0],["CGGG","CGGG",1,0,0],["CGGO","CGGO",1,0,0],["CGGR","CGGR",1,0,0],["CGHM","CGHM",1,0,0],["CGHY","CGHY",1,0,0],["CGIB","CGIB",1,0,0],["CGIC","CGIC",1,0,0],["CGIE","CGIE",1,0,0],["CGMM","CGMM",1,0,0],["CGMS","CGMS",1,0,0],["CGMU","CGMU",1,0,0],["CGNG","CGNG",1,0,0],["CGNT","Cognyte Software Ltd.",25,681,0],["CGNX","Cognex Corporation",7,6168,0],["CGO","Calamos Global Total Return Fund",11,0,0],["CGON","CG Oncology Inc.",13,3148,0],["CGRO","CGRO",1,0,0],["CGSD","CGSD",1,0,0],["CGSM","CGSM",1,0,0],["CGTL","Creative Global Technology Holdings Limited Class A",100,24,0],["CGTX","Cognition Therapeutics Inc.",13,136,0],["CGUI","CGUI",1,0,0],["CGUS","CGUS",1,0,0],["CGV","CGV",1,0,0],["CGVV","CGVV",1,0,0],["CGW","CGW",1,0,0],["CGXU","CGXU",1,0,0],["CHA","Chagee Holdings Limited",68,1473,0],["CHAC","Crane Harbor Acquisition Corp. Class A",1,0,0],["CHACU","CHACU",1,0,0],["CHAI","Core AI Holdings Inc.",33,46,0],["CHAR","Charlton Aria Acquisition Corporation Class A",1,0,0],["CHAT","CHAT",1,0,0],["CHAU","CHAU",1,0,0],["CHCI","Comstock Holding Companies Inc. Class A",36,119,0],["CHCO","City Holding Company",26,1804,0],["CHCT","Community Healthcare Trust Incorporated",30,454,0],["CHD","Church & Dwight Company Inc.",90,20430,0],["CHDN","Churchill Downs Incorporated",45,8002,0],["CHE","Chemed Corp",35,6166,0],["CHEC","Chenghe Acquisition III Co. Class A",1,0,0],["CHECU","CHECU",1,0,0],["CHEF","The Chefs\' Warehouse Inc.",103,2623,0],["CHGG","Chegg Inc.",3,104,0],["CHGX","CHGX",1,0,0],["CHH","Choice Hotels International Inc.",47,4487,0],["CHI","Calamos Convertible Opportunities and Income Fund",11,0,0],["CHIQ","CHIQ",1,0,0],["CHKP","Check Point Software Technologies Ltd.",25,20497,0],["CHMG","Chemung Financial Corp",26,277,0],["CHMI","Cherry Hill Mortgage Investment Corporation",30,97,0],["CHMI/PA","CHMI/PA",1,0,0],["CHMI/PB","CHMI/PB",1,0,0],["CHNR","China Natural Resources Inc.",104,5,0],["CHOW","ChowChow Cloud International Holdings Limited",25,31,0],["CHPG","ChampionsGate Acquisition Corporation Class A",1,0,0],["CHPGU","ChampionsGate Acquisition Corporation Unit",1,0,0],["CHPS","CHPS",1,0,0],["CHPT","ChargePoint Holdings Inc.",32,173,0],["CHPX","CHPX",1,0,0],["CHPY","CHPY",1,0,0],["CHR","Cheer Holding Inc. Class A",15,0,0],["CHRD","Chord Energy Corporation",59,5127,0],["CHRI","CHRI",1,0,0],["CHRS","Coherus Oncology Inc.",13,164,0],["CHRW","C.H. Robinson Worldwide Inc.",105,19665,0],["CHSCL","CHS Inc Class B Cumulative Redeemable",48,311,0],["CHSCM","CHS Inc Class B Reset Rate Cumulative Redeemable",48,303,0],["CHSCN","CHS Inc Preferred Class B Series 2 Reset Rate",48,306,0],["CHSCO","CHS Inc. Class B Cumulative Redeemable",48,317,0],["CHSCP","CHS Inc. 8% Cumulative Redeemable",48,345,0],["CHSN","Chanson International Holding Class A",17,87,0],["CHT","Chunghwa Telecom Co. Ltd.",33,31852,0],["CHTR","Charter Communications Inc. Class A",54,26529,0],["CHW","Calamos Global Dynamic Income Fund",11,0,0],["CHWY","Chewy Inc. Class A",57,13471,0],["CHY","Calamos Convertible and High Income Fund",11,0,0],["CHYM","Chime Financial Inc. Class A",44,9653,0],["CI","The Cigna Group",23,72629,0],["CIA","Citizens Inc. Class A",5,300,0],["CIB","Grupo Cibest S.A.",75,7987,0],["CIBR","CIBR",1,0,0],["CICB","CION Investment Corporation 7.50% Notes due 2029",123,0,0],["CIEN","Ciena Corporation",33,32444,0],["CIF","MFS Intermediate High Income Fund",81,0,0],["CIFG","CIFG",1,0,0],["CIFR","Cipher Mining Inc.",44,6404,0],["CIG","Comp En De Mn Cemig ADS",41,5666,0],["CIG.C","CIG.C",1,0,0],["CIGI","Colliers International Group Inc. Subordinate Voting Shares",36,7414,0],["CIGL","Concorde International Group Ltd Class A",12,44,0],["CII","BlackRock Enhanced Large Cap Core Fund Inc.",60,3561,0],["CIIT","Tianci International Inc.",59,10,0],["CIK","Credit Suisse Asset Management Income Fund Inc.",123,0,0],["CIL","CIL",1,0,0],["CIM","Chimera Investment Corporation",30,1073,0],["CIM/PA","CIM/PA",1,0,0],["CIM/PB","CIM/PB",1,0,0],["CIM/PC","CIM/PC",1,0,0],["CIM/PD","CIM/PD",1,0,0],["CIMN","Chimera Investment Corporation 9.000% Senior Notes due 2029",30,2041,0],["CIMO","Chimera Investment Corporation 9.250% Senior Notes due 2029",30,0,0],["CIMP","Chimera Investment Corporation 8.875% Senior Notes due 2030",30,0,0],["CINF","Cincinnati Financial Corporation",22,26100,0],["CING","Cingulate Inc.",8,27,0],["CINT","CI&T Inc Class A",15,633,0],["CIO","City Office REIT Inc.",30,281,0],["CIO/PA","CIO/PA",1,0,0],["CION","CION Investment Corporation",123,500,0],["CISO","CISO Global Inc.",19,19,0],["CISS","C3is Inc.",98,2,0],["CITR","General Enterprise Ventures Inc.",122,149,0],["CIVB","Civista Bancshares Inc.",26,462,0],["CIVI","Civitas Resources Inc.",59,2312,0],["CIX","CompX International Inc.",7,277,0],["CJMB","Callan JMB Inc.",36,7,0],["CKX","CKX Lands Inc.",59,19,0],["CL","Colgate-Palmolive Company",90,63163,0],["CLAR","Clarus Corporation",61,130,0],["CLB","Core Laboratories Inc.",20,756,0],["CLBK","Columbia Financial Inc.",84,1723,0],["CLBT","Cellebrite DI Ltd.",25,4600,0],["CLCG","CLCG",1,0,0],["CLCO","Cool Company Ltd.",98,529,0],["CLCV","CLCV",1,0,0],["CLDI","Calidi Biotherapeutics Inc.",13,10,0],["CLDT","Chatham Lodging Trust (REIT)",30,339,0],["CLDT/PA","CLDT/PA",1,0,0],["CLDX","Celldex Therapeutics Inc.",24,1701,0],["CLF","Cleveland-Cliffs Inc.",10,6540,0],["CLFD","Clearfield Inc.",33,396,0],["CLGN","CollPlant Biotechnologies Ltd",32,17,0],["CLH","Clean Harbors Inc.",122,12786,0],["CLIK","Click Holdings Limited Class A",12,19,0],["CLIP","CLIP",1,0,0],["CLIR","ClearSign Technologies Corporation",7,30,0],["CLIX","CLIX",1,0,0],["CLLS","Cellectis S.A.",8,315,0],["CLM","Cornerstone Strategic Investment Fund Inc.",123,0,0],["CLMB","Climb Global Solutions Inc.",100,497,0],["CLMT","Calumet Inc.",106,1758,0],["CLNE","Clean Energy Fuels Corp.",107,489,0],["CLNN","Clene Inc.",8,69,0],["CLOA","CLOA",1,0,0],["CLOB","CLOB",1,0,0],["CLOC","CLOC",1,0,0],["CLOD","CLOD",1,0,0],["CLOI","CLOI",1,0,0],["CLOU","CLOU",1,0,0],["CLOV","Clover Health Investments Corp. Class A",23,1333,0],["CLOX","CLOX",1,0,0],["CLOZ","CLOZ",1,0,0],["CLPR","Clipper Realty Inc.",30,55,0],["CLPS","CLPS Incorporation",25,25,0],["CLPT","ClearPoint Neuro Inc.",31,404,0],["CLRB","Cellectar Biosciences Inc. ",8,11,0],["CLRO","ClearOne Inc. (DE)",33,9,0],["CLS","Celestica Inc.",39,33624,0],["CLSK","CleanSpark Inc.",44,3075,0],["CLSM","CLSM",1,0,0],["CLST","Catalyst Bancorp Inc.",84,63,0],["CLVT","Clarivate Plc",15,2308,0],["CLW","Clearwater Paper Corporation",138,298,0],["CLWT","Euro Tech Holdings Company Limited",108,9,0],["CLX","Clorox Company (The)",135,11992,0],["CLYM","Climb Bio Inc.",8,292,0],["CM","Canadian Imperial Bank of Commerce",75,85960,0],["CMA","Comerica Incorporated",26,11275,0],["CMA/PB","CMA/PB",1,0,0],["CMBM","Cambium Networks Corporation",49,46,0],["CMBO","CMBO",1,0,0],["CMBS","CMBS",1,0,0],["CMBT","CMB.TECH NV",98,2112,0],["CMC","Commercial Metals Company",27,7711,0],["CMCL","Caledonia Mining Corporation Plc",104,519,0],["CMCM","Cheetah Mobile Inc.",25,5156,0],["CMCO","Columbus McKinnon Corporation",72,497,0],["CMCSA","Comcast Corporation Class A",54,107750,0],["CMCSV","Comcast Corporation Class A",54,0,0],["CMCT","Creative Media & Community Trust Corporation",30,3,0],["CMDB","Costamare Bulkers Holdings Limited",98,368,0],["CMDT","CMDT",1,0,0],["CMDY","CMDY",1,0,0],["CME","CME Group Inc. Class A",60,97033,0],["CMF","CMF",1,0,0],["CMG","Chipotle Mexican Grill Inc.",68,49771,0],["CMGG","CMGG",1,0,0],["CMI","Cummins Inc.",7,69946,0],["CMMB","Chemomab Therapeutics Ltd. American",8,10,0],["CMND","Clearmind Medicine Inc.",8,4,0],["CMP","Compass Minerals Intl Inc",74,820,0],["CMPO","CompoSecure Inc. Class A",44,2451,0],["CMPR","Cimpress plc",109,1801,0],["CMPS","COMPASS Pathways Plc American Depository Shares",8,612,0],["CMPX","Compass Therapeutics Inc.",13,888,0],["CMRC","Commerce.com Inc. Series 1",25,343,0],["CMRE","Costamare Inc.",98,1827,0],["CMRE/PB","CMRE/PB",1,0,0],["CMRE/PC","CMRE/PC",1,0,0],["CMRE/PD","CMRE/PD",1,0,0],["CMS","CMS Energy Corporation",129,21050,0],["CMS/PB","CMS/PB",1,0,0],["CMS/PC","CMS/PC",1,0,0],["CMSA","CMS Energy Corporation 5.625% Junior Subordinated Notes due 2078",129,6585,0],["CMSC","CMS Energy Corporation 5.875% Junior Subordinated Notes due 2078",129,6936,0],["CMSD","CMS Energy Corporation 5.875% Junior Subordinated Notes due 2079",129,6960,0],["CMT","Core Molding Technologies Inc",64,189,0],["CMTG","Claros Mortgage Trust Inc.",36,464,0],["CMTL","Comtech Telecommunications Corp.",49,99,0],["CMU","MFS Municipal Income Trust",11,98,0],["CNA","CNA Financial Corporation",22,12838,0],["CNBS","CNBS",1,0,0],["CNC","Centene Corporation",23,19179,0],["CNCK","Coincheck Group N.V.",44,293,0],["CNDT","Conduent Incorporated",36,315,0],["CNEQ","CNEQ",1,0,0],["CNET","ZW Data Action Technologies Inc.",16,4,0],["CNEY","CN Energy Group Inc. Class A",34,2,0],["CNF","CNFinance Holdings Limited",44,43,0],["CNH","CNH Industrial N.V.",72,11978,0],["CNI","Canadian National Railway Company",117,60442,0],["CNK","Cinemark Holdings Inc Cinemark Holdings Inc.",89,2616,0],["CNL","Collective Mining Ltd.",1,1287,0],["CNM","Core & Main Inc. Class A",40,10532,0],["CNMD","CONMED Corporation",77,1237,0],["CNNE","Cannae Holdings Inc.",68,793,0],["CNO","CNO Financial Group Inc.",143,4153,0],["CNO/PA","CNO/PA",1,0,0],["CNOB","ConnectOne Bancorp Inc.",26,1387,0],["CNOBP","ConnectOne Bancorp Inc.",26,1215,0],["CNP","CenterPoint Energy Inc (Holding Co)",41,24548,0],["CNQ","Canadian Natural Resources Limited",59,66451,0],["CNQQ","CNQQ",1,0,0],["CNR","Core Natural Resources Inc.",65,4528,0],["CNRG","CNRG",1,0,0],["CNS","Cohen & Steers Inc",11,3180,0],["CNSP","CNS Pharmaceuticals Inc.",8,4,0],["CNTA","Centessa Pharmaceuticals plc",8,3562,0],["CNTB","Connect Biopharma Holdings Limited",8,127,0],["CNTX","Context Therapeutics Inc.",8,117,0],["CNTY","Century Casinos Inc.",47,40,0],["CNVS","Cineverse Corp. Class A",110,41,0],["CNX","CNX Resources Corporation",59,5080,0],["CNXC","Concentrix Corporation",25,2591,0],["CNXN","PC Connection Inc.",57,1502,0],["CNXT","CNXT",1,0,0],["COAL","COAL",1,0,0],["COCH","Envoy Medical Inc. Class A",32,21,0],["COCO","The Vita Coco Company Inc.",46,3046,0],["COCP","Cocrystal Pharma Inc.",8,14,0],["CODA","Coda Octopus Group Inc.",7,106,0],["CODI","D/B/A Compass Diversified Holdings Shares of Beneficial Interest",73,360,0],["CODI/PA","CODI/PA",1,0,0],["CODI/PB","CODI/PB",1,0,0],["CODI/PC","CODI/PC",1,0,0],["CODX","Co-Diagnostics Inc.",31,16,0],["COE","51Talk Online Education Group",3,194,0],["COEP","Coeptis Therapeutics Holdings Inc.",13,79,0],["COF","Capital One Financial Corporation",26,154947,0],["COF/PI","COF/PI",1,0,0],["COF/PJ","COF/PJ",1,0,0],["COF/PK","COF/PK",1,0,0],["COF/PL","COF/PL",1,0,0],["COF/PN","COF/PN",1,0,0],["COFS","ChoiceOne Financial Services Inc.",26,458,0],["COGT","Cogent Biosciences Inc.",8,5631,0],["COHN","Cohen & Company Inc.",60,31,0],["COHR","Coherent Corp.",76,34828,0],["COHU","Cohu Inc.",39,1098,0],["COIA","COIA",1,0,0],["COIG","COIG",1,0,0],["COIN","Coinbase Global Inc. Class A",44,66095,0],["COKE","Coca-Cola Consolidated Inc.",46,14200,0],["COLA","Columbus Acquisition Corp",1,0,0],["COLAU","Columbus Acquisition Corp Unit",1,0,0],["COLB","Columbia Banking System Inc.",26,8630,0],["COLD","Americold Realty Trust Inc.",30,3478,0],["COLL","Collegium Pharmaceutical Inc.",8,1545,0],["COLM","Columbia Sportswear Company",86,2976,0],["COLO","COLO",1,0,0],["COM","COM",1,0,0],["COMB","COMB",1,0,0],["COMM","CommScope Holding Company Inc.",49,4052,0],["COMP","Compass Inc. Class A",15,5948,0],["COMT","COMT",1,0,0],["CON","Concentra Group Holdings Parent Inc.",23,2490,0],["CONI","CONI",1,0,0],["CONL","CONL",1,0,0],["CONX","CONX",1,0,0],["CONY","CONY",1,0,0],["COO","The Cooper Companies Inc.",111,16217,0],["COOK","Traeger Inc.",133,141,0],["COOT","Australian Oilseeds Holdings Limited",17,17,0],["COP","ConocoPhillips",106,113612,0],["COPJ","COPJ",1,0,0],["COPL","Copley Acquisition Corp",1,0,0],["COPP","COPP",1,0,0],["COPX","COPX",1,0,0],["COPY","COPY",1,0,0],["COR","Cencora Inc.",112,66138,0],["CORB","CORB",1,0,0],["CORN","CORN",1,0,0],["CORO","CORO",1,0,0],["CORP","CORP",1,0,0],["CORT","Corcept Therapeutics Incorporated",8,8811,0],["CORZ","Core Scientific Inc.",44,4837,0],["COSM","Cosmos Health Inc.",112,17,0],["COSO","CoastalSouth Bancshares Inc.",26,292,0],["COST","Costco Wholesale Corporation",113,379784,0],["COTG","COTG",1,0,0],["COTY","Coty Inc. Class A",90,2851,0],["COUR","Coursera Inc.",25,1260,0],["COWG","COWG",1,0,0],["COWS","COWS",1,0,0],["COYA","Coya Therapeutics Inc.",8,115,0],["COYY","COYY",1,0,0],["CP","Canadian Pacific Kansas City Limited",117,66842,0],["CPA","Copa Holdings S.A. Class A",4,5110,0],["CPAC","Cementos Pacasmayo S.A.A.",38,901,0],["CPAG","CPAG",1,0,0],["CPAI","CPAI",1,0,0],["CPAY","Corpay Inc.",36,21674,0],["CPB","The Campbell\'s Company",17,8521,0],["CPBI","Central Plains Bancshares Inc.",84,71,0],["CPER","CPER",1,0,0],["CPF","Central Pacific Financial Corp New",26,871,0],["CPHC","Canterbury Park Holding Corporation \'New\'",45,74,0],["CPHI","China Pharma Holdings Inc.",8,7,0],["CPHY","CPHY",1,0,0],["CPII","CPII",1,0,0],["CPIX","Cumberland Pharmaceuticals Inc.",8,66,0],["CPK","Chesapeake Utilities Corporation",59,2959,0],["CPLB","CPLB",1,0,0],["CPLS","CPLS",1,0,0],["CPNG","Coupang Inc. Class A",57,42378,0],["CPNJ","CPNJ",1,0,0],["CPNM","CPNM",1,0,0],["CPNQ","CPNQ",1,0,0],["CPNS","CPNS",1,0,0],["CPOP","Pop Culture Group Co. Ltd Class A",45,38,0],["CPRA","CPRA",1,0,0],["CPRI","Capri Holdings Limited",86,3008,0],["CPRJ","CPRJ",1,0,0],["CPRO","CPRO",1,0,0],["CPRT","Copart Inc. (DE)",97,37820,0],["CPRX","Catalyst Pharmaceuticals Inc.",8,2918,0],["CPRY","CPRY",1,0,0],["CPS","Cooper-Standard Holdings Inc.",42,614,0],["CPSA","CPSA",1,0,0],["CPSD","CPSD",1,0,0],["CPSF","CPSF",1,0,0],["CPSH","CPS Technologies Corp.",38,58,0],["CPSJ","CPSJ",1,0,0],["CPSM","CPSM",1,0,0],["CPSN","CPSN",1,0,0],["CPSO","CPSO",1,0,0],["CPSP","CPSP",1,0,0],["CPSR","CPSR",1,0,0],["CPSS","Consumer Portfolio Services Inc.",44,211,0],["CPST","CPST",1,0,0],["CPSU","CPSU",1,0,0],["CPSY","CPSY",1,0,0],["CPT","Camden Property Trust",30,11414,0],["CPXR","CPXR",1,0,0],["CPZ","Calamos Long/Short Equity & Dynamic Income Trust",81,292,0],["CQP","Cheniere Energy Partners LP Common",140,25887,0],["CQQQ","CQQQ",1,0,0],["CR","Crane Company",55,10771,0],["CRAC","Crown Reserve Acquisition Corp. I Class A",1,0,0],["CRACU","Crown Reserve Acquisition Corp. I Unit",2,0,0],["CRAI","CRA International Inc.",3,1370,0],["CRAK","CRAK",1,0,0],["CRANU","Crane Harbor Acquisition Corp. II",1,0,0],["CRAQ","Cal Redwood Acquisition Corp. Class A",2,0,0],["CRBD","Corebridge Financial Inc. 6.375% Junior Subordinated Notes due 2064",5,0,0],["CRBG","Corebridge Financial Inc.",5,15990,0],["CRBN","CRBN",1,0,0],["CRBP","Corbus Pharmaceuticals Holdings Inc.",8,143,0],["CRBU","Caribou Biosciences Inc.",13,157,0],["CRC","California Resources Corporation",59,3650,0],["CRCA","CRCA",1,0,0],["CRCG","CRCG",1,0,0],["CRCL","Circle Internet Group Inc. Class A",44,20282,0],["CRCO","CRCO",1,0,0],["CRCT","Cricut Inc. Class A",7,1078,0],["CRD.A","CRD.A",1,0,0],["CRD.B","CRD.B",1,0,0],["CRDF","Cardiff Oncology Inc.",13,173,0],["CRDL","Cardiol Therapeutics Inc. Class A",13,101,0],["CRDO","Credo Technology Group Holding Ltd",6,27118,0],["CRDT","CRDT",1,0,0],["CRE","Cre8 Enterprise Limited Class A",109,8,0],["CRED","CRED",1,0,0],["CREG","Smart Powerr Corp.",36,20,0],["CRESY","Cresud S.A.C.I.F. y A.",36,720,0],["CREV","Carbon Revolution Public Limited",42,3,0],["CREX","Creative Realities Inc.",15,29,0],["CRF","Cornerstone Total Return Fund Inc. (The)",123,0,0],["CRGO","Freightos Limited",105,122,0],["CRGY","Crescent Energy Company Class A",59,2050,0],["CRH","CRH PLC",38,83279,0],["CRI","Carter\'s Inc.",86,1165,0],["CRIS","Curis Inc.",13,14,0],["CRK","Comstock Resources Inc.",59,6315,0],["CRL","Charles River Laboratories International Inc.",14,9698,0],["CRM","Salesforce Inc.",25,243536,0],["CRMD","CorMedix Inc.",8,947,0],["CRMG","CRMG",1,0,0],["CRML","Critical Metals Corp.",10,805,0],["CRMT","America\'s Car-Mart Inc",97,223,0],["CRNC","Cerence Inc.",25,504,0],["CRNT","Ceragon Networks Ltd.",49,190,0],["CRNX","Crinetics Pharmaceuticals Inc.",8,4556,0],["CRON","Cronos Group Inc.",18,1133,0],["CROX","Crocs Inc.",114,4637,0],["CRPT","CRPT",1,0,0],["CRS","Carpenter Technology Corporation",27,16298,0],["CRSH","CRSH",1,0,0],["CRSP","CRISPR Therapeutics AG",13,5323,0],["CRSR","Corsair Gaming Inc.",53,654,0],["CRT","Cross Timbers Royalty Trust",59,48,0],["CRTC","CRTC",1,0,0],["CRTO","Criteo S.A.",58,1025,0],["CRUS","Cirrus Logic Inc.",6,6182,0],["CRVL","CorVel Corp.",28,3525,0],["CRVO","CervoMed Inc.",8,70,0],["CRVS","Corvus Pharmaceuticals Inc.",8,559,0],["CRWD","CrowdStrike Holdings Inc. Class A",25,121330,0],["CRWG","CRWG",1,0,0],["CRWL","CRWL",1,0,0],["CRWS","Crown Crafts Inc",115,28,0],["CRWV","CoreWeave Inc. Class A",25,41360,0],["CRXP","CRXP",1,0,0],["CSAI","Cloudastructure Inc. Class A",16,22,0],["CSAN","Cosan S.A. ADS",97,1877,0],["CSB","CSB",1,0,0],["CSBR","Champions Oncology Inc.",13,100,0],["CSCL","CSCL",1,0,0],["CSCO","Cisco Systems Inc.",51,309845,0],["CSCS","CSCS",1,0,0],["CSD","CSD",1,0,0],["CSGP","CoStar Group Inc.",36,27646,0],["CSGS","CSG Systems International Inc.",15,2196,0],["CSHI","CSHI",1,0,0],["CSHP","CSHP",1,0,0],["CSIO","CSIO",1,0,0],["CSIQ","Canadian Solar Inc.",6,1640,0],["CSL","Carlisle Companies Incorporated",135,13737,0],["CSMD","CSMD",1,0,0],["CSNR","CSNR",1,0,0],["CSPF","CSPF",1,0,0],["CSPI","CSP Inc.",15,133,0],["CSQ","Calamos Strategic Total Return",116,3054,0],["CSR","D/B/A Centerspace",30,1091,0],["CSRE","CSRE",1,0,0],["CSSD","CSSD",1,0,0],["CSTE","Caesarstone Ltd.",38,62,0],["CSTL","Castle Biosciences Inc.",23,1151,0],["CSTM","Constellium SE",55,2585,0],["CSV","Carriage Services Inc.",3,681,0],["CSW","CSW Industrials Inc.",73,5106,0],["CSWC","Capital Southwest Corporation",115,1240,0],["CSX","CSX Corporation",117,67968,0],["CTA","CTA",1,0,0],["CTA/PA","CTA/PA",1,0,0],["CTA/PB","CTA/PB",1,0,0],["CTAP","CTAP",1,0,0],["CTAS","Cintas Corporation",118,75378,0],["CTBI","Community Trust Bancorp Inc.",26,1064,0],["CTEC","CTEC",1,0,0],["CTEV","Claritev Corporation Class A",36,678,0],["CTEX","CTEX",1,0,0],["CTGO","Contango ORE Inc.",104,423,0],["CTKB","Cytek Biosciences Inc.",71,633,0],["CTLP","Cantaloupe Inc.",92,780,0],["CTM","Castellum Inc.",19,100,0],["CTMX","CytomX Therapeutics Inc.",8,678,0],["CTNM","Contineum Therapeutics Inc. Class A",8,429,0],["CTNT","Cheetah Net Supply Chain Service Inc. Class A",119,4,0],["CTO","CTO Realty Growth Inc.",30,585,0],["CTO/PA","CTO/PA",1,0,0],["CTOR","Citius Oncology Inc.",8,118,0],["CTOS","Custom Truck One Source Inc.",12,1350,0],["CTRA","Coterra Energy Inc.",59,19324,0],["CTRE","CareTrust REIT Inc.",30,8113,0],["CTRI","Centuri Holdings Inc.",59,2316,0],["CTRM","Castor Maritime Inc.",98,22,0],["CTRN","Citi Trends Inc.",120,350,0],["CTS","CTS Corporation",39,1273,0],["CTSH","Cognizant Technology Solutions Corporation Class A",15,41223,0],["CTSO","Cytosorbents Corporation",31,40,0],["CTVA","Corteva Inc.",48,44808,0],["CTW","CTW Cayman Class A",15,112,0],["CTWO","CTWO",1,0,0],["CTXR","Citius Pharmaceuticals Inc.",8,18,0],["CUB","Lionheart Holdings Class A",7,338,0],["CUBB","Customers Bancorp Inc 5.375% Subordinated Notes Due 2034",26,702,0],["CUBE","CubeSmart",30,8111,0],["CUBI","Customers Bancorp Inc",26,2591,0],["CUBWU","Lionheart Holdings Unit",2,0,0],["CUE","Cue Biopharma Inc.",8,21,0],["CUK","Carnival Plc ADS ADS",98,41983,0],["CULP","Culp Inc.",115,44,0],["CUPR","Cuprina Holdings (Cayman) Limited Class A",8,9,0],["CURB","Curbline Properties Corp.",36,2469,0],["CURE","CURE",1,0,0],["CURI","CuriosityStream Inc. Class A",89,238,0],["CURR","Currenc Group Inc.",36,133,0],["CURV","Torrid Holdings Inc.",120,107,0],["CURX","Curanex Pharmaceuticals Inc",8,11,0],["CUT","CUT",1,0,0],["CUZ","Cousins Properties Incorporated",30,4234,0],["CV","CapsoVision Inc.",77,620,0],["CVAC","CureVac N.V.",8,933,0],["CVBF","CVB Financial Corporation",26,2673,0],["CVCO","Cavco Industries Inc.",121,4722,0],["CVE","Cenovus Energy Inc",59,29844,0],["CVEO","Civeo Corporation (Canada)",47,265,0],["CVGI","Commercial Vehicle Group Inc.",42,56,0],["CVGW","Calavo Growers Inc.",93,394,0],["CVI","CVR Energy Inc.",106,2771,0],["CVIE","CVIE",1,0,0],["CVKD","Cadrenal Therapeutics Inc.",8,17,0],["CVLC","CVLC",1,0,0],["CVLG","Covenant Logistics Group Inc. Class A",63,567,0],["CVLT","Commvault Systems Inc.",25,5520,0],["CVM","Cel-Sci Corporation",13,34,0],["CVMC","CVMC",1,0,0],["CVNA","Carvana Co. Class A",97,97942,0],["CVNX","CVNX",1,0,0],["CVNY","CVNY",1,0,0],["CVR","Chicago Rivet & Machine Co.",7,12,0],["CVRD","CVRD",1,0,0],["CVRT","CVRT",1,0,0],["CVRX","CVRx Inc.",31,210,0],["CVS","CVS Health Corporation",142,98660,0],["CVSB","CVSB",1,0,0],["CVU","CPI Aerostructures Inc.",21,44,0],["CVV","CVD Equipment Corporation",7,21,0],["CVX","Chevron Corporation",106,297498,0],["CVY","CVY",1,0,0],["CW","Curtiss-Wright Corporation",7,20462,0],["CWAN","Clearwater Analytics Holdings Inc. Class A",25,6512,0],["CWB","CWB",1,0,0],["CWBC","Community West Bancshares",26,441,0],["CWCO","Consolidated Water Co. Ltd.",70,571,0],["CWD","CaliberCos Inc. Class A",36,10,0],["CWEB","CWEB",1,0,0],["CWEN","Clearway Energy Inc. Class C",41,6651,0],["CWEN.A","CWEN.A",1,0,0],["CWH","Camping World Holdings Inc. Class A",97,1023,0],["CWI","CWI",1,0,0],["CWK","Cushman & Wakefield Ltd.",36,3747,0],["CWS","CWS",1,0,0],["CWST","Casella Waste Systems Inc. Class A",122,6253,0],["CWT","California Water Service Group",70,2555,0],["CX","Cemex S.A.B. de C.V. Sponsored ADR",38,16916,0],["CXAI","CXApp Inc. Class A",15,11,0],["CXDO","Crexendo Inc.",33,213,0],["CXE","MFS High Income Municipal Trust",11,118,0],["CXH","MFS Investment Grade Municipal Trust",11,72,0],["CXM","Sprinklr Inc. Class A",25,1934,0],["CXRN","CXRN",1,0,0],["CXSE","CXSE",1,0,0],["CXT","Crane NXT Co.",55,2710,0],["CXW","CoreCivic Inc.",30,1984,0],["CYBN","Cybin Inc.",8,358,0],["CYBR","CyberArk Software Ltd.",25,22346,0],["CYCN","Cyclerion Therapeutics Inc.",8,6,0],["CYCU","Cycurion Inc.",15,10,0],["CYD","China Yuchai International Limited",7,1361,0],["CYH","Community Health Systems Inc.",126,452,0],["CYN","Cyngn Inc.",15,26,0],["CYPH","Cypherpunk Technologies Inc.",8,74,0],["CYRX","CryoPort Inc.",8,472,0],["CYTK","Cytokinetics Incorporated",8,7668,0],["CZA","CZA",1,0,0],["CZAR","CZAR",1,0,0],["CZFS","Citizens Financial Services Inc.",26,283,0],["CZNC","Citizens & Northern Corp",26,374,0],["CZR","Caesars Entertainment Inc.",47,4976,0],["CZWI","Citizens Community Bancorp Inc.",84,178,0],["D","Dominion Energy Inc.",41,50748,0],["DAAQ","Digital Asset Acquisition Corp. Class A",1,0,0],["DAAQU","DAAQU",1,0,0],["DABS","DABS",1,0,0],["DAC","Danaos Corporation",98,1721,0],["DADS","DADS",1,0,0],["DAIC","CID HoldCo Inc.",15,33,0],["DAIO","Data I/O Corporation",39,28,0],["DAK","DAK",1,0,0],["DAKT","Daktronics Inc.",69,917,0],["DAL","Delta Air Lines Inc.",4,46400,0],["DALI","DALI",1,0,0],["DAMD","DAMD",1,0,0],["DAN","Dana Incorporated",42,2773,0],["DANA","DANA",1,0,0],["DAO","Youdao Inc.",3,1074,0],["DAPP","DAPP",1,0,0],["DAR","Darling Ingredients Inc.",17,5437,0],["DARE","Dare Bioscience Inc.",8,30,0],["DARP","DARP",1,0,0],["DASH","DoorDash Inc. Class A",15,100961,0],["DAT","DAT",1,0,0],["DAVA","Endava plc",15,372,0],["DAVE","Dave Inc. Class A",44,2907,0],["DAWN","Day One Biopharmaceuticals Inc.",8,949,0],["DAX","DAX",1,0,0],["DAY","Dayforce Inc.",25,11086,0],["DB","Deutsche Bank AG",26,75121,0],["DBA","DBA",1,0,0],["DBAW","DBAW",1,0,0],["DBB","DBB",1,0,0],["DBC","DBC",1,0,0],["DBD","Diebold Nixdorf Incorporated",92,2459,0],["DBE","DBE",1,0,0],["DBEF","DBEF",1,0,0],["DBEM","DBEM",1,0,0],["DBEU","DBEU",1,0,0],["DBEZ","DBEZ",1,0,0],["DBGI","Digital Brands Group Inc.",120,87,0],["DBI","Designer Brands Inc. Class A",120,379,0],["DBJP","DBJP",1,0,0],["DBL","DoubleLine Opportunistic Credit Fund",1,0,0],["DBMF","DBMF",1,0,0],["DBND","DBND",1,0,0],["DBO","DBO",1,0,0],["DBP","DBP",1,0,0],["DBRG","DigitalBridge Group Inc.",30,2409,0],["DBRG/PH","DBRG/PH",1,0,0],["DBRG/PI","DBRG/PI",1,0,0],["DBRG/PJ","DBRG/PJ",1,0,0],["DBSC","DBSC",1,0,0],["DBVT","DBV Technologies S.A.",13,770,0],["DBX","Dropbox Inc. Class A",25,7423,0],["DC","Dakota Gold Corp.",10,659,0],["DCBO","Docebo Inc.",25,628,0],["DCGO","DocGo Inc.",35,87,0],["DCI","Donaldson Company Inc.",101,10681,0],["DCMT","DCMT",1,0,0],["DCO","Ducommun Incorporated",21,1409,0],["DCOM","Dime Community Bancshares Inc.",26,1393,0],["DCOMG","Dime Community Bancshares Inc. 9.000% Fixed-to-Floating Rate Subordinated Notes due 2034",26,1043,0],["DCOMP","Dime Community Bancshares Inc. Fixed-Rate Non-Cumulative Perpetual",26,799,0],["DCOR","DCOR",1,0,0],["DCRE","DCRE",1,0,0],["DCTH","Delcath Systems Inc.",31,355,0],["DCX","Digital Currency X Technology Inc. Class A",37,6,0],["DD","DuPont de Nemours Inc.",34,17287,0],["DDC","DDC Enterprise Limited Class A",17,9,0],["DDD","3D Systems Corporation",25,237,0],["DDI","DoubleDown Interactive Co. Ltd. American Depository Shares",15,426,0],["DDIV","DDIV",1,0,0],["DDL","Dingdong (Cayman) Limited",57,600,0],["DDM","DDM",1,0,0],["DDOG","Datadog Inc. Class A",25,49231,0],["DDS","Dillard\'s Inc.",113,10361,0],["DDT","Dillard\'s Capital Trust I",113,410,0],["DE","Deere & Company",7,127209,0],["DEA","Easterly Government Properties Inc.",30,989,0],["DEC","Diversified Energy Company",1,1052,0],["DECK","Deckers Outdoor Corporation",114,14497,0],["DECO","DECO",1,0,0],["DECT","DECT",1,0,0],["DECW","DECW",1,0,0],["DEED","DEED",1,0,0],["DEEF","DEEF",1,0,0],["DEEP","DEEP",1,0,0],["DEFI","DEFI",1,0,0],["DEFT","Defi Technologies Inc.",44,417,0],["DEHP","DEHP",1,0,0],["DEI","Douglas Emmett Inc.",30,1855,0],["DELL","Dell Technologies Inc. Class C",9,83777,0],["DEM","DEM",1,0,0],["DEMZ","DEMZ",1,0,0],["DENN","Denny\'s Corporation",68,320,0],["DEO","Diageo plc",46,49627,0],["DERM","Journey Medical Corporation",8,214,0],["DES","DES",1,0,0],["DESK","DESK",1,0,0],["DEUS","DEUS",1,0,0],["DEVS","DevvStream Corp.",123,6,0],["DEW","DEW",1,0,0],["DEXC","DEXC",1,0,0],["DFAC","DFAC",1,0,0],["DFAE","DFAE",1,0,0],["DFAI","DFAI",1,0,0],["DFAR","DFAR",1,0,0],["DFAS","DFAS",1,0,0],["DFAT","DFAT",1,0,0],["DFAU","DFAU",1,0,0],["DFAW","DFAW",1,0,0],["DFAX","DFAX",1,0,0],["DFCA","DFCA",1,0,0],["DFCF","DFCF",1,0,0],["DFDV","DeFi Development Corp.",44,162,0],["DFE","DFE",1,0,0],["DFEM","DFEM",1,0,0],["DFEN","DFEN",1,0,0],["DFEV","DFEV",1,0,0],["DFGP","DFGP",1,0,0],["DFGR","DFGR",1,0,0],["DFGX","DFGX",1,0,0],["DFH","Dream Finders Homes Inc. Class A",121,1660,0],["DFII","DFII",1,0,0],["DFIN","Donnelley Financial Solutions Inc.",3,1220,0],["DFIP","DFIP",1,0,0],["DFIV","DFIV",1,0,0],["DFJ","DFJ",1,0,0],["DFLI","Dragonfly Energy Holdings Corp.",7,49,0],["DFLV","DFLV",1,0,0],["DFNM","DFNM",1,0,0],["DFP","Flaherty & Crumrine Dynamic Preferred and Income Fund Inc.",11,0,0],["DFSB","DFSB",1,0,0],["DFSC","DEFSEC Technologies Inc.",25,3,0],["DFSD","DFSD",1,0,0],["DFSE","DFSE",1,0,0],["DFSI","DFSI",1,0,0],["DFSU","DFSU",1,0,0],["DFSV","DFSV",1,0,0],["DFTT","DFTT",1,0,0],["DFUS","DFUS",1,0,0],["DFUV","DFUV",1,0,0],["DFVE","DFVE",1,0,0],["DFVX","DFVX",1,0,0],["DG","Dollar General Corporation",113,30218,0],["DGCB","DGCB",1,0,0],["DGICA","Donegal Group Inc. Class A",22,752,0],["DGICB","Donegal Group Inc. Class B",22,628,0],["DGII","Digi International Inc.",51,1633,0],["DGIN","DGIN",1,0,0],["DGLO","DGLO",1,0,0],["DGLY","Digital Ally Inc.",49,4,0],["DGNX","Diginex Limited",15,1410,0],["DGP","DGP",1,0,0],["DGRE","DGRE",1,0,0],["DGRO","DGRO",1,0,0],["DGRS","DGRS",1,0,0],["DGRW","DGRW",1,0,0],["DGS","DGS",1,0,0],["DGT","DGT",1,0,0],["DGX","Quest Diagnostics Incorporated",23,19585,0],["DGXX","Digi Power X Inc. Subordinate Voting Shares",44,185,0],["DGZ","DGZ",1,0,0],["DH","Definitive Healthcare Corp. Class A",25,262,0],["DHC","Diversified Healthcare Trust",30,1245,0],["DHCNI","Diversified Healthcare Trust 5.625% Senior Notes due 2042",30,4114,0],["DHCNL","Diversified Healthcare Trust 6.25% Senior Notes Due 2046",30,4319,0],["DHF","BNY Mellon High Yield Strategies Fund",116,0,0],["DHI","D.R. Horton Inc.",121,42985,0],["DHIL","Diamond Hill Investment Group Inc. Class A",11,456,0],["DHLX","DHLX",1,0,0],["DHR","Danaher Corporation",7,158816,0],["DHS","DHS",1,0,0],["DHSB","DHSB",1,0,0],["DHT","DHT Holdings Inc.",98,1964,0],["DHX","DHI Group Inc.",36,72,0],["DHY","Credit Suisse High Yield Credit Fund",123,0,0],["DIA","DIA",1,0,0],["DIAL","DIAL",1,0,0],["DIAX","Nuveen Dow 30SM Dynamic Overwrite Fund",116,0,0],["DIBS","1stdibs.com Inc.",57,217,0],["DIEM","DIEM",1,0,0],["DIG","DIG",1,0,0],["DIM","DIM",1,0,0],["DIME","DIME",1,0,0],["DIN","Dine Brands Global Inc.",68,495,0],["DINO","HF Sinclair Corporation",107,8684,0],["DIOD","Diodes Incorporated",6,2361,0],["DIPS","DIPS",1,0,0],["DIS","Walt Disney Company (The)",45,198596,0],["DISO","DISO",1,0,0],["DIT","AMCON Distributing Company",103,69,0],["DIV","DIV",1,0,0],["DIVD","DIVD",1,0,0],["DIVE","DIVE",1,0,0],["DIVG","DIVG",1,0,0],["DIVI","DIVI",1,0,0],["DIVL","DIVL",1,0,0],["DIVO","DIVO",1,0,0],["DIVP","DIVP",1,0,0],["DIVS","DIVS",1,0,0],["DIVY","DIVY",1,0,0],["DIVZ","DIVZ",1,0,0],["DJCO","Daily Journal Corp. (S.C.)",124,724,0],["DJD","DJD",1,0,0],["DJIA","DJIA",1,0,0],["DJP","DJP",1,0,0],["DJT","Trump Media & Technology Group Corp.",16,4505,0],["DK","Delek US Holdings Inc.",106,1843,0],["DKI","DarkIris Inc. Class A",25,7,0],["DKL","Delek Logistics Partners L.P. Common",107,2379,0],["DKNG","DraftKings Inc. Class A",45,17029,0],["DKNX","DKNX",1,0,0],["DKS","Dick\'s Sporting Goods Inc",66,19086,0],["DLB","Dolby Laboratories",29,6327,0],["DLHC","DLH Holdings Corp.",19,82,0],["DLLL","DLLL",1,0,0],["DLN","DLN",1,0,0],["DLNG","Dynagas LNG Partners LP Common",98,144,0],["DLNG/PA","DLNG/PA",1,0,0],["DLO","DLocal Limited Class A",36,4065,0],["DLPN","Dolphin Entertainment Inc.",3,18,0],["DLR","Digital Realty Trust Inc.",30,51522,0],["DLR/PJ","DLR/PJ",1,0,0],["DLR/PK","DLR/PK",1,0,0],["DLR/PL","DLR/PL",1,0,0],["DLS","DLS",1,0,0],["DLTH","Duluth Holdings Inc. Class B",120,81,0],["DLTR","Dollar Tree Inc.",113,25421,0],["DLX","Deluxe Corporation",109,1010,0],["DLXY","Delixy Holdings Limited",80,14,0],["DLY","DoubleLine Yield Opportunities Fund",11,696,0],["DMA","Destra Multi-Alternative Fund",81,0,0],["DMAA","Drugs Made In America Acquisition Corp.",1,0,0],["DMAAU","DMAAU",1,0,0],["DMAC","DiaMedica Therapeutics Inc.",8,442,0],["DMAT","DMAT",1,0,0],["DMB","BNY Mellon Municipal Bond Infrastructure Fund Inc.",81,0,0],["DMBS","DMBS",1,0,0],["DMCY","DMCY",1,0,0],["DMII","Drugs Made In America Acquisition II Corp.",2,0,0],["DMIIU","Drugs Made In America Acquisition II Corp. Unit",1,0,0],["DMLP","Dorchester Minerals L.P. Common",59,1071,0],["DMO","Western Asset Mortgage Opportunity Fund Inc.",81,0,0],["DMRC","Digimarc Corporation",15,176,0],["DMX","DMX",1,0,0],["DMXF","DMXF",1,0,0],["DNA","Ginkgo Bioworks Holdings Inc. Class A",13,491,0],["DNL","DNL",1,0,0],["DNLI","Denali Therapeutics Inc.",13,2625,0],["DNMX","Dynamix Corporation III Class A",2,0,0],["DNMXU","Dynamix Corporation III Unit",2,0,0],["DNN","Denison Mines Corp",52,2459,0],["DNOW","DNOW Inc.",88,1438,0],["DNP","DNP Select Income Fund Inc.",11,0,0],["DNTH","Dianthus Therapeutics Inc.",8,1820,0],["DNUT","Krispy Kreme Inc.",67,781,0],["DOC","Healthpeak Properties Inc.",30,11112,0],["DOCN","DigitalOcean Holdings Inc.",16,4348,0],["DOCS","Doximity Inc. Class A",15,8218,0],["DOCU","DocuSign Inc.",25,14015,0],["DOG","DOG",1,0,0],["DOGZ","Dogness (International) Corporation Class A",69,141,0],["DOL","DOL",1,0,0],["DOLE","Dole plc",48,1453,0],["DOMH","Dominari Holdings Inc.",8,73,0],["DOMO","Domo Inc. Class B",25,361,0],["DON","DON",1,0,0],["DOO","BRP Inc. Common Subordinate Voting Shares",32,5267,0],["DORM","Dorman Products Inc.",42,3867,0],["DOUG","Douglas Elliman Inc.",36,219,0],["DOV","Dover Corporation",7,26911,0],["DOW","Dow Inc.",34,16532,0],["DOX","Amdocs Limited",15,8688,0],["DOYU","DouYu International Holdings Limited ADS",16,213,0],["DPG","Duff & Phelps Utility and Infrastructure Fund Inc.",81,0,0],["DPRO","Draganfly Inc.",50,175,0],["DPST","DPST",1,0,0],["DPZ","Domino\'s Pizza Inc",103,14579,0],["DQ","DAQO New Energy Corp.",6,2211,0],["DRAI","DRAI",1,0,0],["DRAY","DRAY",1,0,0],["DRCT","Direct Digital Holdings Inc. Class A",58,2,0],["DRD","DRDGOLD Limited",104,2701,0],["DRDB","Roman DBDR Acquisition Corp. II",1,0,0],["DRDBU","Roman DBDR Acquisition Corp. II Unit",1,0,0],["DRES","DRES",1,0,0],["DRH","Diamondrock Hospitality Company",30,1876,0],["DRH/PA","DRH/PA",1,0,0],["DRI","Darden Restaurants Inc.",68,22084,0],["DRIO","DarioHealth Corp.",31,78,0],["DRIP","DRIP",1,0,0],["DRIV","DRIV",1,0,0],["DRKY","DRKY",1,0,0],["DRLL","DRLL",1,0,0],["DRMA","Dermata Therapeutics Inc.",8,2,0],["DRN","DRN",1,0,0],["DRNZ","DRNZ",1,0,0],["DRS","Leonardo DRS Inc.",7,8949,0],["DRTS","Alpha Tau Medical Ltd.",31,357,0],["DRUG","Bright Minds Biosciences Inc.",8,595,0],["DRUP","DRUP",1,0,0],["DRV","DRV",1,0,0],["DRVN","Driven Brands Holdings Inc.",79,2450,0],["DSACU","Daedalus Special Acquisition Corp. Unit",2,0,0],["DSGN","Design Therapeutics Inc.",8,551,0],["DSGR","Distribution Solutions Group Inc.",32,1334,0],["DSGX","Descartes Systems Group Inc. (The)",25,7697,0],["DSI","DSI",1,0,0],["DSL","DoubleLine Income Solutions Fund",81,1143,0],["DSM","BNY Mellon Strategic Municipal Bond Fund Inc.",11,0,0],["DSMC","DSMC",1,0,0],["DSP","Viant Technology Inc. Class A",16,734,0],["DSPY","DSPY",1,0,0],["DSS","DSS Inc.",125,9,0],["DSTL","DSTL",1,0,0],["DSTX","DSTX",1,0,0],["DSU","Blackrock Debt Strategies Fund Inc.",116,0,0],["DSWL","Deswell Industries Inc.",64,53,0],["DSX","Diana Shipping inc.",98,193,0],["DSX/PB","DSX/PB",1,0,0],["DSY","Big Tree Cloud Holdings Limited",125,30,0],["DT","Dynatrace Inc.",25,13317,0],["DTAN","DTAN",1,0,0],["DTB","DTE Energy Company 2020 Series G 4.375% Junior Subordinated Debentures due 2080",41,3607,0],["DTCK","Davis Commodities Limited Class A",48,6,0],["DTCR","DTCR",1,0,0],["DTCX","Datacentrex Inc.",15,55,0],["DTD","DTD",1,0,0],["DTE","DTE Energy Company",41,26509,0],["DTEC","DTEC",1,0,0],["DTF","DTF Tax-Free Income 2028 Term Fund Inc.",11,79,0],["DTG","DTE Energy Company 2021 Series E 4.375% Junior Subordinated Debentures",41,3589,0],["DTH","DTH",1,0,0],["DTI","Drilling Tools International Corporation",88,96,0],["DTIL","Precision BioSciences Inc.",13,60,0],["DTK","DTE Energy Company 2025 Series H 6.25% Junior Subordinated Debentures due 2085",41,0,0],["DTM","DT Midstream Inc.",107,12000,0],["DTRE","DTRE",1,0,0],["DTSQ","DT Cloud Star Acquisition Corporation",1,0,0],["DTSS","Datasea Inc.",25,8,0],["DTST","Data Storage Corporation",15,38,0],["DTW","DTE Energy Company 2017 Series E 5.25% Junior Subordinated Debentures due 2077",41,4440,0],["DUG","DUG",1,0,0],["DUHP","DUHP",1,0,0],["DUK","Duke Energy Corporation (Holding Company)",129,89867,0],["DUK/PA","DUK/PA",1,0,0],["DUKB","Duke Energy Corporation 5.625% Junior Subordinated Debentures due 2078",129,19286,0],["DUKH","DUKH",1,0,0],["DUKQ","DUKQ",1,0,0],["DUKX","DUKX",1,0,0],["DUKZ","DUKZ",1,0,0],["DULL","DULL",1,0,0],["DUNK","DUNK",1,0,0],["DUO","Fangdd Network Group Ltd. Class A",36,7,0],["DUOG","DUOG",1,0,0],["DUOL","Duolingo Inc. Class A",25,8596,0],["DUOT","Duos Technologies Group Inc.",25,195,0],["DUSB","DUSB",1,0,0],["DUSL","DUSL",1,0,0],["DUST","DUST",1,0,0],["DV","DoubleVerify Holdings Inc.",16,1817,0],["DVA","DaVita Inc.",137,8133,0],["DVAL","DVAL",1,0,0],["DVAX","Dynavax Technologies Corporation",8,1275,0],["DVDN","DVDN",1,0,0],["DVGR","DVGR",1,0,0],["DVIN","DVIN",1,0,0],["DVLT","Datavault AI Inc.",6,277,0],["DVLU","DVLU",1,0,0],["DVN","Devon Energy Corporation",59,22482,0],["DVND","DVND",1,0,0],["DVOL","DVOL",1,0,0],["DVQQ","DVQQ",1,0,0],["DVRE","DVRE",1,0,0],["DVS","Dolly Varden Silver Corporation",1,428,0],["DVSP","DVSP",1,0,0],["DVUT","DVUT",1,0,0],["DVXB","DVXB",1,0,0],["DVXC","DVXC",1,0,0],["DVXE","DVXE",1,0,0],["DVXF","DVXF",1,0,0],["DVXK","DVXK",1,0,0],["DVXP","DVXP",1,0,0],["DVXV","DVXV",1,0,0],["DVXY","DVXY",1,0,0],["DVY","DVY",1,0,0],["DVYA","DVYA",1,0,0],["DVYE","DVYE",1,0,0],["DWAS","DWAS",1,0,0],["DWAW","DWAW",1,0,0],["DWM","DWM",1,0,0],["DWMF","DWMF",1,0,0],["DWSH","DWSH",1,0,0],["DWSN","Dawson Geophysical Company",59,51,0],["DWTX","Dogwood Therapeutics Inc.",8,200,0],["DWUS","DWUS",1,0,0],["DWX","DWX",1,0,0],["DX","Dynex Capital Inc.",30,2031,0],["DX/PC","DX/PC",1,0,0],["DXC","DXC Technology Company",15,2687,0],["DXCM","DexCom Inc.",31,25764,0],["DXD","DXD",1,0,0],["DXF","Eason Technology Limited",44,3,0],["DXIV","DXIV",1,0,0],["DXJ","DXJ",1,0,0],["DXLG","Destination XL Group Inc.",120,51,0],["DXPE","DXP Enterprises Inc.",7,1748,0],["DXR","Daxor Corporation",31,62,0],["DXST","Decent Holding Inc Class A",99,21,0],["DXUV","DXUV",1,0,0],["DXYZ","Destiny Tech100 Inc.",1,0,0],["DY","Dycom Industries Inc.",128,9972,0],["DYAI","Dyadic International Inc.",13,36,0],["DYFI","DYFI",1,0,0],["DYLD","DYLD",1,0,0],["DYLG","DYLG",1,0,0],["DYN","Dyne Therapeutics Inc.",8,3208,0],["DYNB","DYNB",1,0,0],["DYNF","DYNF",1,0,0],["DYOR","Insight Digital Partners II Class A",2,0,0],["DYORU","Insight Digital Partners II",2,0,0],["DYTA","DYTA",1,0,0],["DZZ","DZZ",1,0,0],["E","ENI S.p.A.",59,61174,0],["EA","Electronic Arts Inc.",45,50859,0],["EAD","Allspring Income Opportunities Fund",123,0,0],["EAF","GrafTech International Ltd.",7,397,0],["EAFG","EAFG",1,0,0],["EAGG","EAGG",1,0,0],["EAGL","EAGL",1,0,0],["EAI","Entergy Arkansas LLC First Mortgage Bonds 4.875% Series Due September 1 2066",41,9486,0],["EAPR","EAPR",1,0,0],["EARN","Ellington Credit Company",30,198,0],["EASG","EASG",1,0,0],["EASY","EASY",1,0,0],["EAT","Brinker International Inc.",68,6640,0],["EATZ","EATZ",1,0,0],["EB","Eventbrite Inc. Class A",16,433,0],["EBAY","eBay Inc.",36,38266,0],["EBC","Eastern Bankshares Inc.",84,3961,0],["EBF","Ennis Inc.",92,463,0],["EBI","EBI",1,0,0],["EBIT","EBIT",1,0,0],["EBIZ","EBIZ",1,0,0],["EBMT","Eagle Bancorp Montana Inc.",26,158,0],["EBND","EBND",1,0,0],["EBON","Ebang International Holdings Inc. Class A",6,23,0],["EBS","Emergent BioSolutions Inc.",8,652,0],["EBUF","EBUF",1,0,0],["EC","Ecopetrol S.A.",59,18934,0],["ECAT","BlackRock ESG Capital Allocation Term Trust",81,1723,0],["ECBK","ECB Bancorp Inc.",43,153,0],["ECC","Eagle Point Credit Company Inc.",81,347,0],["ECC/PD","ECC/PD",1,0,0],["ECCC","Eagle Point Credit Company Inc. 6.50% Series C Term",81,1508,0],["ECCF","Eagle Point Credit Company Inc. 8.00% Series F Term",1,27454,0],["ECCU","Eagle Point Credit Company Inc. 7.75% Notes due 2030",1,0,0],["ECCV","Eagle Point Credit Company Inc. 5.375% Notes due 2029",81,1437,0],["ECCW","Eagle Point Credit Company Inc. 6.75% Notes due 2031",81,1504,0],["ECCX","Eagle Point Credit Company Inc. 6.6875% Notes due 2028",81,1514,0],["ECDA","ECD Automotive Design Inc.",37,0,0],["ECF","Ellsworth Growth and Income Fund Ltd.",123,0,0],["ECF/PA","ECF/PA",1,0,0],["ECG","Everus Construction Group Inc.",121,4541,0],["ECL","Ecolab Inc.",90,74658,0],["ECML","ECML",1,0,0],["ECNS","ECNS",1,0,0],["ECO","Okeanis Eco Tankers Corp.",98,1092,0],["ECON","ECON",1,0,0],["ECOR","electroCore Inc.",77,37,0],["ECOW","ECOW",1,0,0],["ECPG","Encore Capital Group Inc",116,1216,0],["ECVT","Ecovyst Inc.",34,1093,0],["ECX","ECARX Holdings Inc. Class A",15,622,0],["ED","Consolidated Edison Inc.",129,35393,0],["EDAP","EDAP TMS S.A.",77,110,0],["EDBL","Edible Garden AG Incorporated",48,5,0],["EDC","EDC",1,0,0],["EDD","Morgan Stanley Emerging Markets Domestic Debt Fund Inc.",116,0,0],["EDF","Virtus Stone Harbor Emerging Markets Income Fund",11,0,0],["EDGF","EDGF",1,0,0],["EDGH","EDGH",1,0,0],["EDGI","EDGI",1,0,0],["EDGU","EDGU",1,0,0],["EDHL","Everbright Digital Holding Limited",58,12,0],["EDIT","Editas Medicine Inc.",13,228,0],["EDIV","EDIV",1,0,0],["EDN","Empresa Distribuidora Y Comercializadora Norte S.A. (Edenor)",41,1436,0],["EDOG","EDOG",1,0,0],["EDOW","EDOW",1,0,0],["EDRY","EuroDry Ltd.",98,37,0],["EDSA","Edesa Biotech Inc.",8,12,0],["EDTK","Skillful Craftsman Education Technology Limited",3,15,0],["EDU","New Oriental Education & Technology Group Inc. Sponsored ADR representing 10",3,22074,0],["EDUC","Educational Development Corporation",94,11,0],["EDV","EDV",1,0,0],["EDZ","EDZ",1,0,0],["EE","Excelerate Energy Inc. Class A",140,3049,0],["EEA","The European Equity Fund Inc.",81,0,0],["EEFT","Euronet Worldwide Inc.",60,3238,0],["EEIQ","EpicQuest Education Group International Limited",3,11,0],["EELV","EELV",1,0,0],["EEM","EEM",1,0,0],["EEMA","EEMA",1,0,0],["EEMO","EEMO",1,0,0],["EEMS","EEMS",1,0,0],["EEMX","EEMX",1,0,0],["EES","EES",1,0,0],["EET","EET",1,0,0],["EETH","EETH",1,0,0],["EEV","EEV",1,0,0],["EEX","Emerald Holding Inc.",36,928,0],["EFA","EFA",1,0,0],["EFAA","EFAA",1,0,0],["EFAS","EFAS",1,0,0],["EFAX","EFAX",1,0,0],["EFC","Ellington Financial Inc.",36,1485,0],["EFC/PA","EFC/PA",1,0,0],["EFC/PB","EFC/PB",1,0,0],["EFC/PC","EFC/PC",1,0,0],["EFC/PD","EFC/PD",1,0,0],["EFFE","EFFE",1,0,0],["EFFI","EFFI",1,0,0],["EFIV","EFIV",1,0,0],["EFO","EFO",1,0,0],["EFOI","Energy Focus Inc.",91,13,0],["EFR","Eaton Vance Senior Floating-Rate Fund",81,0,0],["EFRA","EFRA",1,0,0],["EFSC","Enterprise Financial Services Corporation",26,2065,0],["EFSCP","Enterprise Financial Services Corporation",26,735,0],["EFSI","Eagle Financial Services Inc",26,219,0],["EFT","Eaton Vance Floating Rate Income Trust",116,327,0],["EFU","EFU",1,0,0],["EFX","Equifax Inc.",44,26824,0],["EFXT","Enerflex Ltd",7,1826,0],["EFZ","EFZ",1,0,0],["EG","Everest Group Ltd.",22,13908,0],["EGAN","eGain Corporation",25,286,0],["EGBN","Eagle Bancorp Inc.",26,647,0],["EGG","Enigmatig Limited Class A",19,124,0],["EGGQ","EGGQ",1,0,0],["EGGS","EGGS",1,0,0],["EGGY","EGGY",1,0,0],["EGHA","EGH Acquisition Corp. Class A",123,0,0],["EGHAU","EGHAU",1,0,0],["EGHT","8x8 Inc",15,288,0],["EGLE","EGLE",1,0,0],["EGO","EGO",1,0,0],["EGP","EGP",1,0,0],["EGY","VAALCO Energy Inc. ",59,358,0],["EH","EHang Holdings Limited ADS",50,984,0],["EHAB","Enhabit Inc.",35,484,0],["EHC","Encompass Health Corporation",126,10705,0],["EHGO","Eshallgo Inc. Class A",12,7,0],["EHI","Western Asset Global High Income Fund Inc",11,0,0],["EHLD","Euroholdings Ltd.",98,19,0],["EHLS","EHLS",1,0,0],["EHTH","eHealth Inc.",28,134,0],["EIC","Eagle Point Income Company Inc.",123,101,0],["EICA","Eagle Point Income Company Inc. 5.00% Series A Term",123,219,0],["EICB","Eagle Point Income Company Inc. 7.75% Series B Term",1,0,0],["EICC","Eagle Point Income Company Inc. 8.00% Series C Term",1,0,0],["EIDO","EIDO",1,0,0],["EIG","Employers Holdings Inc",22,965,0],["EIIA","Eagle Point Institutional Income Fund 8.125% Series A Term",1,0,0],["EIM","Eaton Vance Municipal Bond Fund",123,0,0],["EINC","EINC",1,0,0],["EIPI","EIPI",1,0,0],["EIPX","EIPX",1,0,0],["EIRL","EIRL",1,0,0],["EIS","EIS",1,0,0],["EIX","Edison International",41,23126,0],["EJAN","EJAN",1,0,0],["EJH","E-Home Household Service Holdings Limited",3,73,0],["EJUL","EJUL",1,0,0],["EKG","EKG",1,0,0],["EKSO","Ekso Bionics Holdings Inc.",7,13,0],["EL","Estee Lauder Companies Inc. (The)",90,38919,0],["ELA","Envela Corporation",94,378,0],["ELAB","PMGC Holdings Inc.",8,13,0],["ELAN","Elanco Animal Health Incorporated",8,11080,0],["ELBM","Electra Battery Materials Corporation",7,87,0],["ELC","Entergy Louisiana Inc. Collateral Trust Mortgage Bonds 4.875 % Series due September 1 2066",41,4418,0],["ELCV","ELCV",1,0,0],["ELD","ELD",1,0,0],["ELDN","Eledon Pharmaceuticals Inc.",8,98,0],["ELE","Elemental Royalty Corporation",104,1041,0],["ELF","e.l.f. Beauty Inc.",90,4797,0],["ELFY","ELFY",1,0,0],["ELIL","ELIL",1,0,0],["ELIS","ELIS",1,0,0],["ELLO","Ellomay Capital Ltd",41,290,0],["ELM","ELM",1,0,0],["ELMD","Electromed Inc.",77,239,0],["ELME","Elme Communities",30,1527,0],["ELOG","Eastern International Ltd.",105,20,0],["ELP","Companhia Paranaense de Energia (COPEL)",41,3147,0],["ELPC","Companhia Paranaense de Energia (COPEL)",41,3115,0],["ELPW","Elong Power Holding Limited Class A",7,11,0],["ELS","Equity Lifestyle Properties Inc.",30,11878,0],["ELSE","Electro-Sensors Inc.",7,14,0],["ELTK","Eltek Ltd.",39,60,0],["ELTX","Elicio Therapeutics Inc.",8,139,0],["ELUT","Elutia Inc. Class A",13,25,0],["ELV","Elevance Health Inc.",23,75715,0],["ELVA","Electrovaya Inc.",1,285,0],["ELVN","Enliven Therapeutics Inc.",8,1001,0],["ELVR","Elevra Lithium Limited American Depository Shares",74,56920,0],["ELWS","Earlyworks Co. Ltd.",15,15,0],["ELWT","Elauwit Connection Inc.",33,34,0],["EM","Smart Share Global Limited",3,304,0],["EMA","Emera Incorporated",41,14518,0],["EMB","EMB",1,0,0],["EMBC","Embecta Corp.",31,688,0],["EMBD","EMBD",1,0,0],["EMBJ","Embraer S.A.",50,11656,0],["EMBX","EMBX",1,0,0],["EMC","EMC",1,0,0],["EMCB","EMCB",1,0,0],["EMCR","EMCR",1,0,0],["EMCS","EMCS",1,0,0],["EMD","Western Asset Emerging Markets Debt Fund Inc",123,0,0],["EMDM","EMDM",1,0,0],["EME","EMCOR Group Inc.",82,27370,0],["EMEQ","EMEQ",1,0,0],["EMES","EMES",1,0,0],["EMF","Templeton Emerging Markets Fund",123,0,0],["EMHC","EMHC",1,0,0],["EMIF","EMIF",1,0,0],["EMIS","Emmis Acquisition Corp. Class A",8,0,0],["EMKT","EMKT",1,0,0],["EML","Eastern Company (The)",7,122,0],["EMLC","EMLC",1,0,0],["EMLP","EMLP",1,0,0],["EMM","EMM",1,0,0],["EMMF","EMMF",1,0,0],["EMN","Eastman Chemical Company",34,7250,0],["EMNT","EMNT",1,0,0],["EMO","ClearBridge Energy Midstream Opportunity Fund Inc.",11,0,0],["EMOP","EMOP",1,0,0],["EMOT","EMOT",1,0,0],["EMP","Entergy Mississippi LLC First Mortgage Bonds 4.90% Series Due October 1 2066",41,9441,0],["EMPB","EMPB",1,0,0],["EMPD","Empery Digital Inc.",1,0,0],["EMQQ","EMQQ",1,0,0],["EMR","Emerson Electric Company",133,74708,0],["EMSF","EMSF",1,0,0],["EMTY","EMTY",1,0,0],["EMXC","EMXC",1,0,0],["EMXF","EMXF",1,0,0],["ENB","Enbridge Inc",107,101713,0],["ENDW","ENDW",1,0,0],["ENFR","ENFR",1,0,0],["ENGN","enGene Holdings Inc.",13,444,0],["ENGS","Energys Group Limited",82,11,0],["ENHU","ENHU",1,0,0],["ENIC","Enel Chile S.A.",41,5423,0],["ENJ","Entergy New Orleans LLC First Mortgage Bonds 5.0% Series due December 1 2052",129,9410,0],["ENLT","Enlight Renewable Energy Ltd.",41,5513,0],["ENLV","Enlivex Therapeutics Ltd.",8,197,0],["ENO","Entergy New Orleans LLC First Mortgage Bonds 5.50% Series due April 1 2066",129,4897,0],["ENOV","Enovis Corporation",32,1530,0],["ENPH","Enphase Energy Inc.",6,4351,0],["ENR","Energizer Holdings Inc.",7,1356,0],["ENS","EnerSys",7,5422,0],["ENSC","Ensysce Biosciences Inc.",8,4,0],["ENSG","The Ensign Group Inc.",126,10507,0],["ENTA","Enanta Pharmaceuticals Inc.",8,444,0],["ENTG","Entegris Inc.",64,12743,0],["ENTX","Entera Bio Ltd.",13,81,0],["ENVA","Enova International Inc.",44,4064,0],["ENVB","Enveric Biosciences Inc.",8,3,0],["ENVX","Enovix Corporation",7,1696,0],["ENZL","ENZL",1,0,0],["EOCT","EOCT",1,0,0],["EOD","Allspring Global Dividend Opportunity Fund",11,0,0],["EOG","EOG Resources Inc.",59,55307,0],["EOI","Eaton Vance Enhance Equity Income Fund Eaton Vance Enhanced Equity Income Fund Shares of Beneficial Interest",123,0,0],["EOLS","Evolus Inc.",8,458,0],["EONR","EON Resources Inc. Class A",59,19,0],["EOS","Eaton Vance Enhance Equity Income Fund II",81,0,0],["EOSE","Eos Energy Enterprises Inc. Class A",7,3767,0],["EOT","Eaton Vance Municipal Income Trust EATON VANCE NATIONAL MUNICIPAL OPPORTUNITIES TRUST",60,260,0],["EP","Empire Petroleum Corporation",59,105,0],["EP/PC","EP/PC",1,0,0],["EPAC","Enerpac Tool Group Corp.",7,1973,0],["EPAI","EPAI",1,0,0],["EPAM","EPAM Systems Inc.",15,11555,0],["EPC","Edgewell Personal Care Company",90,814,0],["EPD","Enterprise Products Partners L.P.",107,69096,0],["EPEM","EPEM",1,0,0],["EPHE","EPHE",1,0,0],["EPI","EPI",1,0,0],["EPIN","EPIN",1,0,0],["EPM","Evolution Petroleum Corporation Inc.",59,122,0],["EPMB","EPMB",1,0,0],["EPMV","EPMV",1,0,0],["EPOL","EPOL",1,0,0],["EPOW","Sunrise New Energy Co. Ltd Class A",36,25,0],["EPP","EPP",1,0,0],["EPR","EPR Properties",30,3820,0],["EPR/PC","EPR/PC",1,0,0],["EPR/PE","EPR/PE",1,0,0],["EPR/PG","EPR/PG",1,0,0],["EPRT","Essential Properties Realty Trust Inc.",30,6026,0],["EPRX","Eupraxia Pharmaceuticals Inc.",127,332,0],["EPS","EPS",1,0,0],["EPSB","EPSB",1,0,0],["EPSM","Epsium Enterprise Limited Class A",46,32,0],["EPSN","Epsilon Energy Ltd.",59,101,0],["EPSV","EPSV",1,0,0],["EPU","EPU",1,0,0],["EPV","EPV",1,0,0],["EPWK","EPWK Holdings Ltd. Class A",36,1,0],["EQ","Equillium Inc.",8,70,0],["EQAL","EQAL",1,0,0],["EQBK","Equity Bancshares Inc. Class A",26,873,0],["EQH","Equitable Holdings Inc.",28,13759,0],["EQH/PA","EQH/PA",1,0,0],["EQH/PC","EQH/PC",1,0,0],["EQIN","EQIN",1,0,0],["EQIX","Equinix Inc.",30,74475,0],["EQL","EQL",1,0,0],["EQNR","Equinor ASA",106,67199,0],["EQR","Equity Residential",30,23350,0],["EQRR","EQRR",1,0,0],["EQS","Equus Total Return Inc.",123,24,0],["EQT","EQT Corporation",59,33618,0],["EQTY","EQTY",1,0,0],["EQWL","EQWL",1,0,0],["EQX","Equinox Gold Corp.",104,11065,0],["ERAS","Erasca Inc.",8,979,0],["ERC","Allspring Multi-Sector Income Fund",123,0,0],["ERET","ERET",1,0,0],["ERH","Allspring Utilities and High Income Fund",123,0,0],["ERIC","Ericsson",49,32411,0],["ERIE","Erie Indemnity Company Class A",28,13110,0],["ERII","Energy Recovery Inc.",7,745,0],["ERNA","Ernexa Therapeutics Inc.",8,10,0],["ERNZ","ERNZ",1,0,0],["ERO","Ero Copper Corp.",10,2721,0],["ERTH","ERTH",1,0,0],["ERX","ERX",1,0,0],["ERY","ERY",1,0,0],["ES","Eversource Energy (D/B/A)",41,25198,0],["ESAB","ESAB Corporation",7,6903,0],["ESBA","ESBA",1,0,0],["ESBG","ESBG",1,0,0],["ESCA","Escalade Incorporated",61,177,0],["ESE","ESCO Technologies Inc.",33,5138,0],["ESEA","Euroseas Ltd.",98,378,0],["ESGD","ESGD",1,0,0],["ESGE","ESGE",1,0,0],["ESGL","ESGL Holdings Limited",122,167,0],["ESGU","ESGU",1,0,0],["ESHA","ESH Acquisition Corp. Class A",2,0,0],["ESI","Element Solutions Inc.",34,6089,0],["ESIM","ESIM",1,0,0],["ESIX","ESIX",1,0,0],["ESLA","Estrella Immunopharma Inc.",13,64,0],["ESLG","ESLG",1,0,0],["ESLT","Elbit Systems Ltd.",21,24723,0],["ESLV","ESLV",1,0,0],["ESMV","ESMV",1,0,0],["ESN","ESN",1,0,0],["ESNT","Essent Group Ltd.",22,6405,0],["ESOA","Energy Services of America Corporation",128,136,0],["ESP","Espey Mfg. & Electronics Corp.",7,126,0],["ESPO","ESPO",1,0,0],["ESPR","Esperion Therapeutics Inc.",8,940,0],["ESQ","Esquire Financial Holdings Inc.",75,917,0],["ESRT","Empire State Realty Trust Inc. Class A",30,1120,0],["ESS","Essex Property Trust Inc.",30,16577,0],["ESSC","ESSC",1,0,0],["ESTA","Establishment Labs Holdings Inc.",32,2162,0],["ESTC","Elastic N.V.",25,8053,0],["ESUM","ESUM",1,0,0],["ET","Energy Transfer LP Common",107,56273,0],["ET/PI","ET/PI",1,0,0],["ETB","Eaton Vance Tax-Managed Buy-Write Income Fund Eaton Vance Tax-Managed Buy-Write Income Fund",60,447,0],["ETCO","ETCO",1,0,0],["ETD","Ethan Allen Interiors Inc.",73,600,0],["ETEC","ETEC",1,0,0],["ETFT","ETFT",1,0,0],["ETG","Eaton Vance Tax-Advantaged Global Dividend Income Fund",11,0,0],["ETH","ETH",1,0,0],["ETHA","ETHA",1,0,0],["ETHD","ETHD",1,0,0],["ETHE","ETHE",1,0,0],["ETHI","ETHI",1,0,0],["ETHM","Dynamix Corporation Class A",1,0,0],["ETHMU","Dynamix Corporation Unit",1,0,0],["ETHO","ETHO",1,0,0],["ETHT","ETHT",1,0,0],["ETHW","ETHW",1,0,0],["ETHZ","ETHZilla Corporation",8,133,0],["ETI/P","ETI/P",1,0,0],["ETJ","Eaton Vance Risk-Managed Diversified Equity Income Fund",116,0,0],["ETN","Eaton Corporation PLC",7,123434,0],["ETO","Eaton Vance Tax-Advantage Global Dividend Opp",11,477,0],["ETON","Eton Pharmaceuticals Inc.",8,439,0],["ETOR","eToro Group Ltd. Class A",60,2928,0],["ETR","Entergy Corporation",41,40864,0],["ETRL","ETRL",1,0,0],["ETS","Elite Express Holding Inc. Class A",63,8,0],["ETSY","Etsy Inc.",36,5363,0],["ETV","Eaton Vance Corporation Eaton Vance Tax-Managed Buy-Write Opportunities Fund",60,1568,0],["ETW","Eaton Vance Corporation Eaton Vance Tax-Managed Global Buy-Write Opportunites Fund",11,1006,0],["ETX","Eaton Vance Municipal Income 2028 Term Trust",11,204,0],["ETY","Eaton Vance Tax-Managed Diversified Equity Income Fund",116,0,0],["EU","enCore Energy Corp.",52,502,0],["EUDA","EUDA Health Holdings Limited",35,111,0],["EUDG","EUDG",1,0,0],["EUFN","EUFN",1,0,0],["EUM","EUM",1,0,0],["EUO","EUO",1,0,0],["EURK","Eureka Acquisition Corp Class A",1,0,0],["EURL","EURL",1,0,0],["EUSA","EUSA",1,0,0],["EUSB","EUSB",1,0,0],["EVAC","EQV Ventures Acquisition Corp. II Class A",148,0,0],["EVAC.U","EVAC.U",1,0,0],["EVAX","Evaxion A/S American",13,39,0],["EVC","Entravision Communications Corporation",83,289,0],["EVCM","EverCommerce Inc.",25,2147,0],["EVER","EverQuote Inc. Class A",16,965,0],["EVEX","Eve Holding Inc.",50,1672,0],["EVF","Eaton Vance Senior Income Trust",60,92,0],["EVG","Eaton Vance Short Diversified Income Fund Eaton Vance Short Duration Diversified Income Fund",11,0,0],["EVGN","Evogene Ltd",85,7,0],["EVGO","EVgo Inc. Class A",15,939,0],["EVH","Evolent Health Inc Class A",3,445,0],["EVHY","EVHY",1,0,0],["EVI","EVI Industries Inc. ",3,303,0],["EVIM","EVIM",1,0,0],["EVLN","EVLN",1,0,0],["EVLV","Evolv Technologies Holdings Inc. Class A",53,1259,0],["EVMN","Evommune Inc.",8,575,0],["EVMO","EVMO",1,0,0],["EVMT","EVMT",1,0,0],["EVN","Eaton Vance Municipal Income Trust",11,426,0],["EVNT","EVNT",1,0,0],["EVO","Evotec SE",8,262,0],["EVOX","Evolution Global Acquisition Corp Class A",2,0,0],["EVOXU","Evolution Global Acquisition Corp",2,0,0],["EVR","Evercore Inc. Class A",11,13242,0],["EVRG","Evergy Inc.",129,16684,0],["EVSB","EVSB",1,0,0],["EVSD","EVSD",1,0,0],["EVSM","EVSM",1,0,0],["EVT","Eaton Vance Tax Advantaged Dividend Income Fund",116,0,0],["EVTC","Evertec Inc.",15,1858,0],["EVTL","Vertical Aerospace Ltd.",50,470,0],["EVTR","EVTR",1,0,0],["EVTV","Envirotech Vehicles Inc.",42,2,0],["EVV","Eaton Vance Limited Duration Income Fund",123,0,0],["EVX","EVX",1,0,0],["EVYM","EVYM",1,0,0],["EW","Edwards Lifesciences Corporation",32,49708,0],["EWA","EWA",1,0,0],["EWBC","East West Bancorp Inc.",26,15624,0],["EWC","EWC",1,0,0],["EWCZ","European Wax Center Inc. Class A",3,197,0],["EWD","EWD",1,0,0],["EWG","EWG",1,0,0],["EWH","EWH",1,0,0],["EWI","EWI",1,0,0],["EWJ","EWJ",1,0,0],["EWJV","EWJV",1,0,0],["EWK","EWK",1,0,0],["EWL","EWL",1,0,0],["EWM","EWM",1,0,0],["EWN","EWN",1,0,0],["EWO","EWO",1,0,0],["EWP","EWP",1,0,0],["EWQ","EWQ",1,0,0],["EWS","EWS",1,0,0],["EWT","EWT",1,0,0],["EWTX","Edgewise Therapeutics Inc.",8,2705,0],["EWU","EWU",1,0,0],["EWV","EWV",1,0,0],["EWW","EWW",1,0,0],["EWX","EWX",1,0,0],["EWY","EWY",1,0,0],["EWZ","EWZ",1,0,0],["EWZS","EWZS",1,0,0],["EXAS","Exact Sciences Corporation",23,19292,0],["EXC","Exelon Corporation",129,44109,0],["EXE","Expand Energy Corporation",59,25899,0],["EXEL","Exelixis Inc.",13,11877,0],["EXFY","Expensify Inc. Class A",25,135,0],["EXG","Eaton Vance Tax-Managed Global Diversified Equity Income Fund",116,0,0],["EXI","EXI",1,0,0],["EXK","Endeavour Silver Corporation",104,2801,0],["EXLS","ExlService Holdings Inc.",36,6840,0],["EXOD","Exodus Movement Inc. Class A",44,455,0],["EXOZ","eXoZymes Inc.",13,103,0],["EXP","Eagle Materials Inc",38,6975,0],["EXPD","Expeditors International of Washington Inc.",105,20488,0],["EXPE","Expedia Group Inc.",87,35443,0],["EXPI","eXp World Holdings Inc.",36,1568,0],["EXPO","Exponent Inc.",19,3593,0],["EXR","Extra Space Storage Inc",30,27607,0],["EXTR","Extreme Networks Inc.",51,2253,0],["EXUS","EXUS",1,0,0],["EYE","National Vision Holdings Inc.",111,2271,0],["EYEG","EYEG",1,0,0],["EYPT","EyePoint Inc.",71,1443,0],["EZA","EZA",1,0,0],["EZGO","EZGO Technologies Ltd.",119,2,0],["EZJ","EZJ",1,0,0],["EZM","EZM",1,0,0],["EZMO","EZMO",1,0,0],["EZPW","EZCORP Inc. Class A Non Voting",66,1170,0],["EZRO","EZRO",1,0,0],["F","Ford Motor Company",37,53671,0],["F/PB","F/PB",1,0,0],["F/PC","F/PC",1,0,0],["F/PD","F/PD",1,0,0],["FA","First Advantage Corporation",15,2647,0],["FAAR","FAAR",1,0,0],["FAB","FAB",1,0,0],["FACT","FACT II Acquisition Corp. Class A",1,0,0],["FACTU","FACT II Acquisition Corp. Unit",2,0,0],["FAD","FAD",1,0,0],["FAF","First American Corporation (New)",28,6419,0],["FAI","FAI",1,0,0],["FALN","FALN",1,0,0],["FAMI","Farmmi Inc.",17,2,0],["FAN","FAN",1,0,0],["FANG","Diamondback Energy Inc.",59,42443,0],["FARM","Farmer Brothers Company",17,33,0],["FARX","FARX",1,0,0],["FAS","FAS",1,0,0],["FAST","Fastenal Company",130,48619,0],["FAT","FAT Brands Inc. Class A",68,8,0],["FATBB","FAT Brands Inc. Class B",68,22,0],["FATBP","FAT Brands Inc. 8.25% Series B Cumulative",68,17,0],["FATE","Fate Therapeutics Inc.",13,121,0],["FATN","FatPipe Inc.",25,39,0],["FAX","abrdn Asia-Pacific Income Fund Inc.",11,0,0],["FAZ","FAZ",1,0,0],["FBDC","FBDC",1,0,0],["FBGL","FBS Global Limited",69,12,0],["FBIN","Fortune Brands Innovations Inc.",56,6129,0],["FBIO","Fortress Biotech Inc.",8,112,0],["FBIOP","Fortress Biotech Inc. 9.375% Series A Cumulative Redeemable Perpetual",8,291,0],["FBIZ","First Business Financial Services Inc.",26,473,0],["FBK","FB Financial Corporation",26,3036,0],["FBL","FBL",1,0,0],["FBLA","FB Bancorp Inc.",43,259,0],["FBLG","FibroBiologics Inc.",8,19,0],["FBNC","First Bancorp",26,2169,0],["FBND","FBND",1,0,0],["FBOT","FBOT",1,0,0],["FBP","First BanCorp. New",26,3392,0],["FBRT","Franklin BSP Realty Trust Inc.",30,865,0],["FBRT/PE","FBRT/PE",1,0,0],["FBRX","Forte Biosciences Inc.",8,372,0],["FBT","FBT",1,0,0],["FBY","FBY",1,0,0],["FBYD","Falcon\'s Beyond Global Inc. Class A",45,2541,0],["FBYY","FBYY",1,0,0],["FC","Franklin Covey Company",3,205,0],["FCA","FCA",1,0,0],["FCAL","FCAL",1,0,0],["FCAP","First Capital Inc.",84,223,0],["FCBC","First Community Bankshares Inc. (VA)",26,633,0],["FCBD","FCBD",1,0,0],["FCCO","First Community Corporation",26,236,0],["FCEF","FCEF",1,0,0],["FCEL","FuelCell Energy Inc.",7,398,0],["FCF","First Commonwealth Financial Corporation",26,1791,0],["FCFS","FirstCash Holdings Inc.",66,7108,0],["FCFY","FCFY",1,0,0],["FCG","FCG",1,0,0],["FCHL","Fitness Champs Holdings Limited",45,4,0],["FCN","FTI Consulting Inc.",19,5451,0],["FCNCA","First Citizens BancShares Inc. Class A",26,26550,0],["FCNCO","First Citizens BancShares Inc. 5.625% Non-Cumulative Perpetual",26,266,0],["FCNCP","First Citizens BancShares Inc.",26,254,0],["FCO","abrdn Global Income Fund Inc.",11,0,0],["FCOM","FCOM",1,0,0],["FCOR","FCOR",1,0,0],["FCPT","Four Corners Property Trust Inc.",30,2470,0],["FCRS","FutureCrest Acquisition Corp. Class A",2,0,0],["FCRS.U","FCRS.U",1,0,0],["FCRX","Crescent Capital BDC Inc. 5.00% Notes due 2026",44,925,0],["FCSH","FCSH",1,0,0],["FCT","First Trust Senior Floating Rate Income Fund II",116,0,0],["FCTE","FCTE",1,0,0],["FCUS","FCUS",1,0,0],["FCUV","Focus Universal Inc.",7,38,0],["FCVT","FCVT",1,0,0],["FCX","Freeport-McMoRan Inc.",10,70576,0],["FDAT","FDAT",1,0,0],["FDBC","Fidelity D & D Bancorp Inc.",26,267,0],["FDCF","FDCF",1,0,0],["FDD","FDD",1,0,0],["FDFF","FDFF",1,0,0],["FDG","FDG",1,0,0],["FDHY","FDHY",1,0,0],["FDIF","FDIF",1,0,0],["FDIG","FDIG",1,0,0],["FDIS","FDIS",1,0,0],["FDIV","FDIV",1,0,0],["FDL","FDL",1,0,0],["FDLO","FDLO",1,0,0],["FDLS","FDLS",1,0,0],["FDM","FDM",1,0,0],["FDMO","FDMO",1,0,0],["FDMT","4D Molecular Therapeutics Inc.",13,496,0],["FDN","FDN",1,0,0],["FDNI","FDNI",1,0,0],["FDP","Fresh Del Monte Produce Inc.",48,1794,0],["FDRR","FDRR",1,0,0],["FDS","FDS",1,0,0],["FDSB","Fifth District Bancorp Inc.",84,81,0],["FDT","FDT",1,0,0],["FDTS","FDTS",1,0,0],["FDTX","FDTX",1,0,0],["FDUS","Fidus Investment Corporation",123,687,0],["FDV","FDV",1,0,0],["FDVV","FDVV",1,0,0],["FDX","FedEx Corporation",4,68139,0],["FE","FirstEnergy Corp.",41,25550,0],["FEAC","FEAC",1,0,0],["FEAM","5E Advanced Materials Inc.",74,80,0],["FEAT","FEAT",1,0,0],["FEBO","Fenbo Holdings Limited Class A",73,15,0],["FEBT","FEBT",1,0,0],["FEBW","FEBW",1,0,0],["FEDM","FEDM",1,0,0],["FEDU","Four Seasons Education (Cayman) Inc.",3,25,0],["FEED","ENvue Medical Inc.",32,3,0],["FEGE","FEGE",1,0,0],["FEIG","FEIG",1,0,0],["FEIM","Frequency Electronics Inc.",39,471,0],["FELC","FELC",1,0,0],["FELE","Franklin Electric Co. Inc.",55,4332,0],["FELG","FELG",1,0,0],["FELV","FELV",1,0,0],["FEM","FEM",1,0,0],["FEMB","FEMB",1,0,0],["FEMR","FEMR",1,0,0],["FEMS","FEMS",1,0,0],["FEMY","Femasys Inc.",31,50,0],["FENC","Fennec Pharmaceuticals Inc.",13,215,0],["FENG","Phoenix New Media Limited",83,24,0],["FENI","FENI",1,0,0],["FENY","FENY",1,0,0],["FEOE","FEOE",1,0,0],["FEP","FEP",1,0,0],["FEPI","FEPI",1,0,0],["FER","Ferrovial SE",21,47813,0],["FERA","Fifth Era Acquisition Corp I Class A",1,0,0],["FERAU","FERAU",1,0,0],["FERG","Ferguson Enterprises Inc.",99,46090,0],["FESM","FESM",1,0,0],["FET","Forum Energy Technologies Inc.",88,406,0],["FEUS","FEUS",1,0,0],["FEUZ","FEUZ",1,0,0],["FEX","FEX",1,0,0],["FEZ","FEZ",1,0,0],["FF","FutureFuel Corp. ",34,149,0],["FFA","First Trust Enhanced Equity Income Fund",11,0,0],["FFAI","Faraday Future Intelligent Electric Inc. Class A",37,190,0],["FFBC","First Financial Bancorp.",26,2591,0],["FFC","Flaherty & Crumrine Preferred and Income Securities Fund Incorporated",81,0,0],["FFIC","Flushing Financial Corporation",26,586,0],["FFIN","First Financial Bankshares Inc.",26,4448,0],["FFIU","FFIU",1,0,0],["FFIV","F5 Inc.",51,14924,0],["FFLS","FFLS",1,0,0],["FFND","FFND",1,0,0],["FFOX","FFOX",1,0,0],["FFTY","FFTY",1,0,0],["FFUT","FFUT",1,0,0],["FFWM","First Foundation Inc.",26,517,0],["FG","F&G Annuities & Life Inc.",5,4193,0],["FGBI","First Guaranty Bancshares Inc.",84,78,0],["FGBIP","First Guaranty Bancshares Inc. 6.75% Series A Fixed-Rate Non-Cumulative Perpetual",84,232,0],["FGD","FGD",1,0,0],["FGDL","FGDL",1,0,0],["FGEN","FibroGen Inc",8,35,0],["FGI","FGI Industries Ltd.",32,13,0],["FGL","Founder Group Limited Class A",82,3,0],["FGM","FGM",1,0,0],["FGMC","FG Merger II Corp.",1,103,0],["FGMCU","FG Merger II Corp. Unit",1,0,0],["FGN","F&G Annuities & Life Inc. 7.950% Senior Notes due 2053",5,3210,0],["FGNX","FG Nexus Inc.",22,127,0],["FGNXP","FG Nexus Inc. 8.00% Cumulative",22,831,0],["FGSI","FGSI",1,0,0],["FGSM","FGSM",1,0,0],["FGSN","F&G Annuities & Life Inc. 7.300% Junior Subordinated Notes due 2065",5,0,0],["FHB","First Hawaiian Inc.",26,3249,0],["FHI","Federated Hermes Inc.",11,4082,0],["FHLC","FHLC",1,0,0],["FHN","First Horizon Corporation",26,12029,0],["FHN/PC","FHN/PC",1,0,0],["FHN/PE","FHN/PE",1,0,0],["FHN/PF","FHN/PF",1,0,0],["FHTX","Foghorn Therapeutics Inc.",8,296,0],["FHYS","FHYS",1,0,0],["FIAT","FIAT",1,0,0],["FIAX","FIAX",1,0,0],["FIBK","First Interstate BancSystem Inc.",26,3679,0],["FICO","Fair Isaac Corporation",36,41454,0],["FICS","FICS",1,0,0],["FID","FID",1,0,0],["FIDI","FIDI",1,0,0],["FIDU","FIDU",1,0,0],["FIEE","FiEE Inc",33,17,0],["FIG","Figma Inc. Class A",25,19566,0],["FIGB","FIGB",1,0,0],["FIGG","FIGG",1,0,0],["FIGR","Figure Technology Solutions Inc. Class A",44,9033,0],["FIGS","FIGS Inc. Class A",86,1997,0],["FIGX","FIGX Capital Acquisition Corp. Class A",1,0,0],["FIGXU","FIGX Capital Acquisition Corp.",2,0,0],["FIHL","Fidelis Insurance Holdings Limited",22,2147,0],["FIIG","FIIG",1,0,0],["FINS","Angel Oak Financial Strategies Income Term Trust",123,324,0],["FINT","FINT",1,0,0],["FINV","FinVolution Group",44,1313,0],["FINW","FinWise Bancorp",26,248,0],["FINX","FINX",1,0,0],["FIP","FTAI Infrastructure Inc.",80,547,0],["FIS","Fidelity National Information Services Inc.",36,34204,0],["FISI","Financial Institutions Inc.",26,645,0],["FISK","FISK",1,0,0],["FISR","FISR",1,0,0],["FISV","Fiserv Inc.",36,36542,0],["FITB","Fifth Third Bancorp",26,31616,0],["FITBI","Fifth Third Bancorp",26,17081,0],["FITBO","Fifth Third Bancorp",26,13009,0],["FITBP","Fifth Third Bancorp",26,16446,0],["FITE","FITE",1,0,0],["FIVA","FIVA",1,0,0],["FIVE","Five Below Inc.",113,10042,0],["FIVN","Five9 Inc.",15,1607,0],["FIVY","FIVY",1,0,0],["FIW","FIW",1,0,0],["FIX","Comfort Systems USA Inc.",82,33182,0],["FIXD","FIXD",1,0,0],["FIXP","FIXP",1,0,0],["FIXT","FIXT",1,0,0],["FIZZ","National Beverage Corp.",46,3026,0],["FJET","Starfighters Space Inc.",4,0,0],["FJP","FJP",1,0,0],["FKU","FKU",1,0,0],["FKWL","Franklin Wireless Corp.",33,49,0],["FLAG","FLAG",1,0,0],["FLAO","FLAO",1,0,0],["FLAU","FLAU",1,0,0],["FLAX","FLAX",1,0,0],["FLBR","FLBR",1,0,0],["FLC","Flaherty & Crumrine Total Return Fund Inc",81,0,0],["FLCA","FLCA",1,0,0],["FLCB","FLCB",1,0,0],["FLCC","FLCC",1,0,0],["FLCE","FLCE",1,0,0],["FLCG","FLCG",1,0,0],["FLCH","FLCH",1,0,0],["FLCO","FLCO",1,0,0],["FLCV","FLCV",1,0,0],["FLD","Fold Holdings Inc. Class A",44,133,0],["FLDB","FLDB",1,0,0],["FLEE","FLEE",1,0,0],["FLEU","FLEU",1,0,0],["FLEX","Flex Ltd.",39,23755,0],["FLG","Flagstar Bank N.A.",43,5567,0],["FLG/PA","FLG/PA",1,0,0],["FLG/PU","FLG/PU",1,0,0],["FLGB","FLGB",1,0,0],["FLGC","Flora Growth Corp.",8,5,0],["FLGR","FLGR",1,0,0],["FLGT","Fulgent Genetics Inc.",23,853,0],["FLGV","FLGV",1,0,0],["FLIN","FLIN",1,0,0],["FLJH","FLJH",1,0,0],["FLJJ","FLJJ",1,0,0],["FLJP","FLJP",1,0,0],["FLKR","FLKR",1,0,0],["FLL","Full House Resorts Inc.",47,104,0],["FLLA","FLLA",1,0,0],["FLMB","FLMB",1,0,0],["FLMI","FLMI",1,0,0],["FLMX","FLMX",1,0,0],["FLN","FLN",1,0,0],["FLNC","Fluence Energy Inc. Class A",7,3650,0],["FLNG","FLEX LNG Ltd.",98,1360,0],["FLNT","Fluent Inc.",58,61,0],["FLO","Flowers Foods Inc.",17,2308,0],["FLOC","Flowco Holdings Inc. Class A",88,1618,0],["FLOW","FLOW",1,0,0],["FLR","Fluor Corporation",21,6594,0],["FLRG","FLRG",1,0,0],["FLRN","FLRN",1,0,0],["FLRT","FLRT",1,0,0],["FLS","Flowserve Corporation",148,9033,0],["FLSA","FLSA",1,0,0],["FLSP","FLSP",1,0,0],["FLSW","FLSW",1,0,0],["FLTB","FLTB",1,0,0],["FLTR","FLTR",1,0,0],["FLTW","FLTW",1,0,0],["FLUD","FLUD",1,0,0],["FLUT","Flutter Entertainment plc",16,38909,0],["FLUX","Flux Power Holdings Inc.",7,29,0],["FLV","FLV",1,0,0],["FLWS","1-800-FLOWERS.COM Inc.",66,264,0],["FLX","BingEx Limited",63,225,0],["FLXR","FLXR",1,0,0],["FLXS","Flexsteel Industries Inc.",73,215,0],["FLY","Firefly Aerospace Inc.",21,3926,0],["FLYD","FLYD",1,0,0],["FLYE","Fly-E Group Inc.",50,11,0],["FLYU","FLYU",1,0,0],["FLYW","Flywire Corporation Voting",36,1780,0],["FLYX","flyExclusive Inc. Class A",87,253,0],["FMAO","Farmers & Merchants Bancorp Inc.",84,378,0],["FMAT","FMAT",1,0,0],["FMB","FMB",1,0,0],["FMBH","First Mid Bancshares Inc.",26,988,0],["FMC","FMC Corporation",34,1664,0],["FMCE","FMCE",1,0,0],["FMCX","FMCX",1,0,0],["FMDE","FMDE",1,0,0],["FMED","FMED",1,0,0],["FMET","FMET",1,0,0],["FMF","FMF",1,0,0],["FMFC","Kandal M Venture Limited Class A",86,6,0],["FMHI","FMHI",1,0,0],["FMKT","FMKT",1,0,0],["FMN","Federated Hermes Premier Municipal Income Fund",11,959,0],["FMNB","Farmers National Banc Corp.",26,528,0],["FMNY","FMNY",1,0,0],["FMQQ","FMQQ",1,0,0],["FMS","Fresenius Medical Care AG",137,13796,0],["FMST","Foremost Clean Energy Ltd.",52,36,0],["FMTL","FMTL",1,0,0],["FMTM","FMTM",1,0,0],["FMUB","FMUB",1,0,0],["FMUN","FMUN",1,0,0],["FMX","Fomento Economico Mexicano S.A.B. de C.V.",46,34809,0],["FMY","First Trust Mortgage Income Fund",123,0,0],["FN","Fabrinet",33,17035,0],["FNB","F.N.B. Corporation",26,6361,0],["FNCL","FNCL",1,0,0],["FND","Floor & Decor Holdings Inc.",130,6708,0],["FNDA","FNDA",1,0,0],["FNDB","FNDB",1,0,0],["FNDC","FNDC",1,0,0],["FNDE","FNDE",1,0,0],["FNDF","FNDF",1,0,0],["FNDX","FNDX",1,0,0],["FNF","Fidelity National Financial Inc.",28,15137,0],["FNGD","FNGD",1,0,0],["FNGG","FNGG",1,0,0],["FNGO","FNGO",1,0,0],["FNGR","FingerMotion Inc.",25,91,0],["FNGS","FNGS",1,0,0],["FNGU","FNGU",1,0,0],["FNK","FNK",1,0,0],["FNKO","Funko Inc. Class A",61,166,0],["FNLC","First Bancorp Inc (ME)",26,313,0],["FNV","Franco-Nevada Corporation",104,40846,0],["FNWB","First Northwest Bancorp",43,93,0],["FNWD","Finward Bancorp",26,165,0],["FNX","FNX",1,0,0],["FNY","FNY",1,0,0],["FOA","Finance of America Companies Inc. Class A",44,179,0],["FOF","Cohen & Steers Closed-End Opportunity Fund Inc.",11,644,0],["FOFO","Hang Feng Technology Innovation Co. Ltd.",19,64,0],["FOLD","Amicus Therapeutics Inc.",8,4375,0],["FONR","Fonar Corporation",77,103,0],["FOPC","FOPC",1,0,0],["FOR","Forestar Group Inc",36,1282,0],["FORA","Forian Inc.",15,63,0],["FORM","FormFactor Inc. FormFactor Inc.",6,4416,0],["FORR","Forrester Research Inc.",12,141,0],["FORTY","Formula Systems (1985) Ltd.",15,2728,0],["FOSL","Fossil Group Inc.",94,202,0],["FOUR","Shift4 Payments Inc. Class A",36,5678,0],["FOUR/PA","FOUR/PA",1,0,0],["FOX","Fox Corporation Class B",83,28235,0],["FOXA","Fox Corporation Class A",83,31862,0],["FOXF","Fox Factory Holding Corp.",119,724,0],["FOXX","Foxx Development Holdings Inc.",51,32,0],["FOXY","FOXY",1,0,0],["FPA","FPA",1,0,0],["FPE","FPE",1,0,0],["FPEI","FPEI",1,0,0],["FPF","First Trust Intermediate Duration Preferred & Income Fund",81,0,0],["FPH","Five Point Holdings LLC Class A",36,807,0],["FPI","Farmland Partners Inc.",30,433,0],["FPWR","FPWR",1,0,0],["FPX","FPX",1,0,0],["FPXE","FPXE",1,0,0],["FPXI","FPXI",1,0,0],["FQAL","FQAL",1,0,0],["FR","First Industrial Realty Trust Inc.",30,7695,0],["FRA","Blackrock Floating Rate Income Strategies Fund Inc ",60,1755,0],["FRAF","Franklin Financial Services Corporation",26,246,0],["FRBA","First Bank",75,447,0],["FRD","Friedman Industries Inc.",27,152,0],["FRDD","FRDD",1,0,0],["FRDU","FRDU",1,0,0],["FREL","FREL",1,0,0],["FRGE","Forge Global Holdings Inc.",60,614,0],["FRGN","FRGN",1,0,0],["FRGT","Freight Technologies Inc.",19,4,0],["FRHC","Freedom Holding Corp.",60,8335,0],["FRI","FRI",1,0,0],["FRIZ","FRIZ",1,0,0],["FRME","First Merchants Corporation",26,2218,0],["FRMEP","First Merchants Corporation Depository Shares",26,1498,0],["FRMI","Fermi Inc.",30,5182,0],["FRO","Frontline Plc",98,4835,0],["FROG","JFrog Ltd.",25,7904,0],["FRPH","FRP Holdings Inc.",36,427,0],["FRPT","Freshpet Inc.",17,3056,0],["FRSH","Freshworks Inc. Class A",25,3533,0],["FRST","Primis Financial Corp.",26,331,0],["FRSX","Foresight Autonomous Holdings Ltd.",25,7,0],["FRT","Federal Realty Investment Trust",30,8745,0],["FRT/PC","FRT/PC",1,0,0],["FRTY","FRTY",1,0,0],["FSBC","Five Star Bancorp",26,790,0],["FSBW","FS Bancorp Inc.",43,325,0],["FSCC","FSCC",1,0,0],["FSCO","FS Credit Opportunities Corp.",81,1216,0],["FSCS","FSCS",1,0,0],["FSEA","First Seacoast Bancorp Inc.",84,67,0],["FSEC","FSEC",1,0,0],["FSFG","First Savings Financial Group Inc.",84,231,0],["FSGS","FSGS",1,0,0],["FSHP","Flag Ship Acquisition Corp.",1,0,0],["FSHPU","FSHPU",1,0,0],["FSI","Flexible Solutions International Inc.",34,89,0],["FSIG","FSIG",1,0,0],["FSK","FS KKR Capital Corp.",11,4114,0],["FSLR","First Solar Inc.",6,28649,0],["FSLY","Fastly Inc. Class A",25,1528,0],["FSM","Fortuna Mining Corp.",104,3024,0],["FSMB","FSMB",1,0,0],["FSMD","FSMD",1,0,0],["FSML","FSML",1,0,0],["FSOL","FSOL",1,0,0],["FSP","Franklin Street Properties Corp.",30,94,0],["FSS","Federal Signal Corporation",37,6845,0],["FSSL","FS Specialty Lending Fund",123,0,0],["FSTA","FSTA",1,0,0],["FSTR","L.B. Foster Company",55,295,0],["FSUN","FirstSun Capital Bancorp",26,1089,0],["FSV","FirstService Corporation",36,7071,0],["FSYD","FSYD",1,0,0],["FSZ","FSZ",1,0,0],["FT","Franklin Universal Trust",81,199,0],["FTA","FTA",1,0,0],["FTAG","FTAG",1,0,0],["FTAI","FTAI Aviation Ltd.",131,17283,0],["FTAIM","FTAI Aviation Ltd. 9.500% Fixed-Rate Reset Series D Cumulative Perpetual Redeemable",131,2740,0],["FTAIN","FTAI Aviation Ltd. 8.25% Fixed - Rate Reset Series C Cumulative Perpetual Redeemable",131,2605,0],["FTBD","FTBD",1,0,0],["FTBI","FTBI",1,0,0],["FTC","FTC",1,0,0],["FTCA","FTCA",1,0,0],["FTCB","FTCB",1,0,0],["FTCE","FTCE",1,0,0],["FTCI","FTC Solar Inc.",6,156,0],["FTCS","FTCS",1,0,0],["FTDR","Frontdoor Inc.",12,4095,0],["FTDS","FTDS",1,0,0],["FTEC","FTEC",1,0,0],["FTEK","Fuel Tech Inc.",101,52,0],["FTEL","Fitell Corporation Class A",61,3,0],["FTF","Franklin Limited Duration Income Trust",123,244,0],["FTFT","Future FinTech Group Inc.",36,31,0],["FTGC","FTGC",1,0,0],["FTGS","FTGS",1,0,0],["FTHF","FTHF",1,0,0],["FTHI","FTHI",1,0,0],["FTHM","Fathom Holdings Inc.",36,35,0],["FTHY","First Trust High Yield Opportunities 2027 Term Fund",11,515,0],["FTI","TechnipFMC plc",88,18090,0],["FTIF","FTIF",1,0,0],["FTK","Flotek Industries Inc.",34,489,0],["FTKI","FTKI",1,0,0],["FTLF","FitLife Brands Inc.",18,159,0],["FTLS","FTLS",1,0,0],["FTMA","FTMA",1,0,0],["FTMH","FTMH",1,0,0],["FTMN","FTMN",1,0,0],["FTMS","FTMS",1,0,0],["FTMU","FTMU",1,0,0],["FTNJ","FTNJ",1,0,0],["FTNT","Fortinet Inc.",53,59670,0],["FTNY","FTNY",1,0,0],["FTOH","FTOH",1,0,0],["FTPA","FTPA",1,0,0],["FTQI","FTQI",1,0,0],["FTRB","FTRB",1,0,0],["FTRE","Fortrea Holdings Inc.",23,1639,0],["FTRI","FTRI",1,0,0],["FTRK","FAST TRACK GROUP",90,17,0],["FTS","Fortis Inc.",41,25705,0],["FTSD","FTSD",1,0,0],["FTSL","FTSL",1,0,0],["FTSM","FTSM",1,0,0],["FTV","Fortive Corporation",7,17440,0],["FTW","EQV Ventures Acquisition Corp. Class A",59,467,0],["FTW.U","FTW.U",1,0,0],["FTWO","FTWO",1,0,0],["FTXG","FTXG",1,0,0],["FTXH","FTXH",1,0,0],["FTXL","FTXL",1,0,0],["FTXN","FTXN",1,0,0],["FTXO","FTXO",1,0,0],["FTXR","FTXR",1,0,0],["FUBO","FuboTV Inc. Class A",89,3498,0],["FUFU","BitFuFu Inc. Class A",44,426,0],["FUL","H. B. Fuller Company",73,3239,0],["FULC","Fulcrum Therapeutics Inc.",8,810,0],["FULT","Fulton Financial Corporation",26,3646,0],["FULTP","Fulton Financial Corporation",26,3485,0],["FUMB","FUMB",1,0,0],["FUN","Six Flags Entertainment Corporation",45,1429,0],["FUNC","First United Corporation",26,262,0],["FUND","Sprott Focus Trust Inc.",11,255,0],["FURY","Fury Gold Mines Limited",104,115,0],["FUSB","First US Bancshares Inc.",26,76,0],["FUSE","Fusemachines Inc.",15,53,0],["FUSI","FUSI",1,0,0],["FUTG","FUTG",1,0,0],["FUTU","Futu Holdings Limited",60,22925,0],["FUTY","FUTY",1,0,0],["FV","FV",1,0,0],["FVAL","FVAL",1,0,0],["FVC","FVC",1,0,0],["FVCB","FVCBankcorp Inc.",26,252,0],["FVD","FVD",1,0,0],["FVN","Future Vision II Acquisition Corporation",1,0,0],["FVR","FrontView REIT Inc.",30,329,0],["FVRR","Fiverr International Ltd.",36,715,0],["FWD","FWD",1,0,0],["FWDI","Forward Industries Inc.",64,608,0],["FWONA","Liberty Media Corporation Series A Liberty Formula One",83,22117,0],["FWONK","Liberty Media Corporation Series C Liberty Formula One",83,24300,0],["FWRD","Forward Air Corporation",105,782,0],["FWRG","First Watch Restaurant Group Inc.",68,989,0],["FXA","FXA",1,0,0],["FXB","FXB",1,0,0],["FXC","FXC",1,0,0],["FXD","FXD",1,0,0],["FXE","FXE",1,0,0],["FXED","FXED",1,0,0],["FXF","FXF",1,0,0],["FXG","FXG",1,0,0],["FXH","FXH",1,0,0],["FXI","FXI",1,0,0],["FXL","FXL",1,0,0],["FXN","FXN",1,0,0],["FXNC","First National Corporation",26,233,0],["FXO","FXO",1,0,0],["FXP","FXP",1,0,0],["FXR","FXR",1,0,0],["FXU","FXU",1,0,0],["FXY","FXY",1,0,0],["FXZ","FXZ",1,0,0],["FYBR","Frontier Communications Parent Inc.",33,9538,0],["FYC","FYC",1,0,0],["FYT","FYT",1,0,0],["FYX","FYX",1,0,0],["G","Genpact Limited",19,8260,0],["GAB","Gabelli Equity Trust Inc. (The)",11,1830,0],["GAB/PG","GAB/PG",1,0,0],["GAB/PH","GAB/PH",1,0,0],["GAB/PK","GAB/PK",1,0,0],["GABC","German American Bancorp Inc.",26,1526,0],["GABF","GABF",1,0,0],["GAEM","GAEM",1,0,0],["GAIA","Gaia Inc. Class A",89,95,0],["GAIN","Gladstone Investment Corporation Business Development Company",44,550,0],["GAINI","Gladstone Investment Corporation 7.875% Notes due 2030",44,0,0],["GAINN","Gladstone Investment Corporation 5.00% Notes Due 2026",44,959,0],["GAINZ","Gladstone Investment Corporation 4.875% Notes due 2028",44,912,0],["GAL","GAL",1,0,0],["GALT","Galectin Therapeutics Inc.",8,282,0],["GAM","General American Investors Inc.",11,1403,0],["GAM/PB","GAM/PB",1,0,0],["GAMB","Gambling.com Group Limited",45,179,0],["GAME","GameSquare Holdings Inc.",45,46,0],["GAMR","GAMR",1,0,0],["GANX","Gain Therapeutics Inc.",8,143,0],["GAP","Gap Inc. (The)",120,10421,0],["GASS","StealthGas Inc.",98,252,0],["GATX","GATX Corporation",87,6168,0],["GAU","Galiano Gold Inc.",74,665,0],["GAUZ","Gauzy Ltd.",7,21,0],["GBAB","Guggenheim Taxable Municipal Bond & Investment Grade Debt Trust",11,337,0],["GBCI","Glacier Bancorp Inc.",26,5929,0],["GBDC","Golub Capital BDC Inc.",44,3546,0],["GBF","GBF",1,0,0],["GBFH","GBank Financial Holdings Inc.",75,516,0],["GBHI","GBHI",1,0,0],["GBIL","GBIL",1,0,0],["GBIO","Generation Bio Co.",8,37,0],["GBLD","GBLD",1,0,0],["GBLI","Global Indemnity Group LLC Class A",22,398,0],["GBND","GBND",1,0,0],["GBR","New Concept Energy Inc",59,4,0],["GBTC","GBTC",1,0,0],["GBTG","Global Business Travel Group Inc. Class A",87,4104,0],["GBUG","GBUG",1,0,0],["GBX","Greenbrier Companies Inc. (The)",117,1435,0],["GCAD","GCAD",1,0,0],["GCAL","GCAL",1,0,0],["GCBC","Greene County Bancorp Inc.",43,415,0],["GCC","GCC",1,0,0],["GCL","GCL Global Holdings Ltd",25,144,0],["GCMG","GCM Grosvenor Inc. Class A",11,2198,0],["GCO","Genesco Inc.",120,252,0],["GCOR","GCOR",1,0,0],["GCT","GigaCloud Technology Inc Class A",57,1496,0],["GCTK","GlucoTrack Inc.",31,4,0],["GCTS","GCT Semiconductor Holding Inc.",6,74,0],["GCV","Gabelli Convertible and Income Securities Fund Inc. (The)",123,78,0],["GD","General Dynamics Corporation",98,91668,0],["GDC","GD Culture Group Limited",27,294,0],["GDDY","GoDaddy Inc. Class A",15,17193,0],["GDEN","Golden Entertainment Inc.",45,724,0],["GDEV","GDEV Inc.",15,309,0],["GDFN","GDFN",1,0,0],["GDHG","Golden Heaven Group Holdings Ltd. Class A",45,7,0],["GDIV","GDIV",1,0,0],["GDL","GDL Fund The",11,0,0],["GDLC","GDLC",1,0,0],["GDO","Western Asset Global Corporate Opportunity Fund Inc.",116,0,0],["GDOC","GDOC",1,0,0],["GDOG","GDOG",1,0,0],["GDOT","Green Dot Corporation Class A",44,714,0],["GDRX","GoodRx Holdings Inc. Class A",15,940,0],["GDS","GDS Holdings Limited ADS",16,7200,0],["GDTC","CytoMed Therapeutics Limited",8,16,0],["GDV","Gabelli Dividend & Income Trust",11,2489,0],["GDV/PH","GDV/PH",1,0,0],["GDV/PK","GDV/PK",1,0,0],["GDX","GDX",1,0,0],["GDXD","GDXD",1,0,0],["GDXJ","GDXJ",1,0,0],["GDXU","GDXU",1,0,0],["GDXY","GDXY",1,0,0],["GDYN","Grid Dynamics Holdings Inc. Class A",25,790,0],["GE","GE Aerospace",133,324049,0],["GECC","Great Elm Capital Corp.",44,51,0],["GECCG","Great Elm Capital Corp. 7.75% Notes Due 2030",44,0,0],["GECCH","Great Elm Capital Corp. 8.125% Notes Due 2029",1,0,0],["GECCI","Great Elm Capital Corp. 8.50% NOTES DUE 2029",116,0,0],["GECCO","Great Elm Capital Corp. 5.875% Notes due 2026",116,0,0],["GEF","Greif Inc. Class A",1,3264,0],["GEF.B","GEF.B",1,0,0],["GEG","Great Elm Group Inc.",25,80,0],["GEGGL","Great Elm Group Inc. 7.25% Notes due 2027",25,715,0],["GEHC","GE HealthCare Technologies Inc.",132,37758,0],["GEL","Genesis Energy L.P. Common",80,1899,0],["GELS","Gelteq Limited",8,10,0],["GEM","GEM",1,0,0],["GEME","GEME",1,0,0],["GEMG","GEMG",1,0,0],["GEMI","Gemini Space Station Inc. Class A",60,1344,0],["GEN","Gen Digital Inc.",25,17028,0],["GENC","Gencor Industries Inc.",72,186,0],["GEND","GEND",1,0,0],["GENI","Genius Sports Limited",45,2590,0],["GENK","GEN Restaurant Group Inc. Class A",68,81,0],["GENM","GENM",1,0,0],["GENT","GENT",1,0,0],["GENW","GENW",1,0,0],["GEO","Geo Group Inc (The) REIT",121,2224,0],["GEOA","GEOA",1,0,0],["GEOS","Geospace Technologies Corporation",7,195,0],["GERN","Geron Corporation",8,849,0],["GES","Guess? Inc.",86,874,0],["GETY","Getty Images Holdings Inc. Class A",36,524,0],["GEV","GE Vernova Inc.",1,178605,0],["GEVG","GEVG",1,0,0],["GEVO","Gevo Inc.",34,523,0],["GEW","GEW",1,0,0],["GF","New Germany Fund Inc. (The)",11,0,0],["GFAI","Guardforce AI Co. Limited",12,17,0],["GFF","Griffon Corporation",91,3547,0],["GFGF","GFGF",1,0,0],["GFI","Gold Fields Limited",104,40419,0],["GFL","GFL Environmental Inc. Subordinate voting shares no par value",122,15471,0],["GFLW","GFLW",1,0,0],["GFR","Greenfire Resources Ltd.",59,309,0],["GFS","GlobalFoundries Inc.",6,20253,0],["GGAL","Grupo Financiero Galicia S.A.",75,8701,0],["GGB","Gerdau S.A.",27,7588,0],["GGG","Graco Inc.",148,13708,0],["GGLL","GGLL",1,0,0],["GGLS","GGLS",1,0,0],["GGM","GGM",1,0,0],["GGME","GGME",1,0,0],["GGN","GAMCO Global Gold Natural Resources & Income Trust",123,0,0],["GGN/PB","GGN/PB",1,0,0],["GGOV","GGOV",1,0,0],["GGR","Gogoro Inc.",37,53,0],["GGRW","GGRW",1,0,0],["GGT","Gabelli Multi-Media Trust Inc. (The)",81,115,0],["GGT/PE","GGT/PE",1,0,0],["GGT/PG","GGT/PG",1,0,0],["GGTL","GGTL",1,0,0],["GGUS","GGUS",1,0,0],["GGZ","Gabelli Global Small and Mid Cap Value Trust (The)",11,131,0],["GH","Guardant Health Inc.",23,12571,0],["GHC","Graham Holdings Company",3,4806,0],["GHG","GreenTree Hospitality Group Ltd.",47,175,0],["GHI","Greystone Housing Impact Investors LP Beneficial Unit Certificates representing assignments of limited partnership interests",44,162,0],["GHM","Graham Corporation",7,677,0],["GHRS","GH Research PLC",8,804,0],["GHY","PGIM Global High Yield Fund Inc.",81,0,0],["GHYB","GHYB",1,0,0],["GIAX","GIAX",1,0,0],["GIB","CGI Inc.",19,20118,0],["GIBO","GIBO Holdings Limited Class A",25,10,0],["GIC","Global Industrial Company",7,1143,0],["GIFI","Gulf Island Fabrication Inc.",55,191,0],["GIFT","Giftify Inc.",57,32,0],["GIG","GigCapital7 Corp. Class A",2,0,0],["GIGB","GIGB",1,0,0],["GIGGU","GigCapital7 Corp. Unit",25,1649,0],["GIGL","GIGL",1,0,0],["GIGM","GigaMedia Limited",16,17,0],["GII","GII",1,0,0],["GIII","G-III Apparel Group LTD.",86,1277,0],["GIL","Gildan Activewear Inc. Class A Sub. Vot.",86,9448,0],["GILD","Gilead Sciences Inc.",13,154204,0],["GILT","Gilat Satellite Networks Ltd.",49,674,0],["GIND","GIND",1,0,0],["GINN","GINN",1,0,0],["GINX","GINX",1,0,0],["GIPR","Generation Income Properties Inc.",30,4,0],["GIS","General Mills Inc.",17,25537,0],["GITS","Global Interactive Technologies Inc.",16,6,0],["GIW","GigCapital8 Corp. Class A",1,0,0],["GIWWU","GigCapital8 Corp.",1,0,0],["GJH","Synthetic Fixed-Income Securities Inc 6.375% (STRATS) Cl A-1",44,0,0],["GJO","Synthetic Fixed-Income Securities Inc. on behalf of STRATS(SM) Trust for Wal-Mart Stores Inc. Securities Series 2004-5",44,0,0],["GJP","Synthetic Fixed-Income Securities Inc. on behalf of STRATS (SM) Trust for Dominion Resources Inc. Securities Series 2005-6 Floating Rate Structured Repackaged Asset-Backed Trust Securities (STRATS) Certificates",44,0,0],["GJR","Synthetic Fixed-Income Securities Inc. STRATS Trust for Procter&Gamble Securities Series 2006-1",44,0,0],["GJS","Goldman Sachs Group Securities STRATS Trust for Goldman Sachs Group Securities Series 2006-2",44,7239,0],["GJT","Synthetic Fixed-Income Securities Inc. Floating Rate Structured Repackaged Asset-Backed Trust Securities Certificates Series 2006-3",44,0,0],["GK","GK",1,0,0],["GKAT","GKAT",1,0,0],["GKOS","Glaukos Corporation",31,6675,0],["GL","Globe Life Inc.",5,11116,0],["GL/PD","GL/PD",1,0,0],["GLAD","Gladstone Capital Corporation",115,466,0],["GLBE","Global-E Online Ltd.",25,6797,0],["GLBS","Globus Maritime Limited",98,35,0],["GLBZ","Glen Burnie Bancorp",26,13,0],["GLCR","GLCR",1,0,0],["GLD","GLD",1,0,0],["GLDB","GLDB",1,0,0],["GLDD","Great Lakes Dredge & Dock Corporation",21,919,0],["GLDG","GoldMining Inc.",104,264,0],["GLDI","GLDI",1,0,0],["GLDM","GLDM",1,0,0],["GLDY","GLDY",1,0,0],["GLE","Global Engine Group Holding Limited Class A",15,8,0],["GLGG","GLGG",1,0,0],["GLIBA","GCI Liberty Inc. Series A GCI Group",54,1057,0],["GLIBK","GCI Liberty Inc. Series C GCI Group",54,1056,0],["GLIN","GLIN",1,0,0],["GLIX","GLIX",1,0,0],["GLL","GLL",1,0,0],["GLMD","Galmed Pharmaceuticals Ltd.",8,2,0],["GLNG","Golar Lng Ltd",98,3985,0],["GLNK","GLNK",1,0,0],["GLO","Clough Global Opportunities Fund",123,0,0],["GLOB","Globant S.A.",15,3060,0],["GLOF","GLOF",1,0,0],["GLOO","Gloo Holdings Inc. Class A",15,465,0],["GLOP/PA","GLOP/PA",1,0,0],["GLOP/PB","GLOP/PB",1,0,0],["GLOP/PC","GLOP/PC",1,0,0],["GLOW","GLOW",1,0,0],["GLP","Global Partners LP Common",80,1469,0],["GLP/PB","GLP/PB",1,0,0],["GLPG","Galapagos NV",8,2132,0],["GLPI","Gaming and Leisure Properties Inc.",30,12642,0],["GLQ","Clough Global Equity Fund Clough Global Equity Fund",123,0,0],["GLRE","Greenlight Capital Re Ltd. Class A",22,492,0],["GLRY","GLRY",1,0,0],["GLSI","Greenwich LifeSciences Inc.",8,180,0],["GLTO","Galecto Inc.",8,43,0],["GLTR","GLTR",1,0,0],["GLU","Gabelli Global Utility",123,112,0],["GLU/PA","GLU/PA",1,0,0],["GLU/PB","GLU/PB",1,0,0],["GLUE","Monte Rosa Therapeutics Inc.",13,1012,0],["GLV","Clough Global Dividend and Income Fund",123,76,0],["GLW","Corning Incorporated",33,75328,0],["GLXG","Galaxy Payroll Group Limited Class A",12,5,0],["GLXY","Galaxy Digital Inc. Class A",60,9375,0],["GM","General Motors Company",37,76821,0],["GMAB","Genmab A/S ADS",8,21431,0],["GME","GameStop Corporation",151,10085,0],["GMED","Globus Medical Inc. Class A",31,11652,0],["GMET","GMET",1,0,0],["GMEY","GMEY",1,0,0],["GMF","GMF",1,0,0],["GMGI","Golden Matrix Group Inc.",25,116,0],["GMHS","Gamehaus Holdings Inc. Class A",15,54,0],["GMM","Global Mofy AI Limited Class A",16,4,0],["GMMA","GMMA",1,0,0],["GMMF","GMMF",1,0,0],["GMNY","GMNY",1,0,0],["GMOC","GMOC",1,0,0],["GMOD","GMOD",1,0,0],["GMOI","GMOI",1,0,0],["GMOV","GMOV",1,0,0],["GMRE","Global Medical REIT Inc.",30,458,0],["GMRE/PA","GMRE/PA",1,0,0],["GMRE/PB","GMRE/PB",1,0,0],["GMUB","GMUB",1,0,0],["GMUN","GMUN",1,0,0],["GNE","Genie Energy Ltd. Class B",129,374,0],["GNK","Genco Shipping & Trading Limited",98,790,0],["GNL","Global Net Lease Inc.",30,1828,0],["GNL/PA","GNL/PA",1,0,0],["GNL/PB","GNL/PB",1,0,0],["GNL/PD","GNL/PD",1,0,0],["GNL/PE","GNL/PE",1,0,0],["GNLN","Greenlane Holdings Inc. Class A",40,4,0],["GNLX","Genelux Corporation",8,160,0],["GNMA","GNMA",1,0,0],["GNOM","GNOM",1,0,0],["GNPX","Genprex Inc.",8,8,0],["GNR","GNR",1,0,0],["GNRC","Generac Holdlings Inc.",55,8154,0],["GNS","Genius Group Limited",45,45,0],["GNSS","Genasys Inc.",133,101,0],["GNT","GAMCO Natural Resources Gold & Income Trust",123,145,0],["GNT/PA","GNT/PA",1,0,0],["GNTA","Genenta Science S.p.A.",13,34,0],["GNTX","Gentex Corporation",42,5160,0],["GNW","Genworth Financial Inc",5,3662,0],["GO","Grocery Outlet Holding Corp.",67,981,0],["GOAU","GOAU",1,0,0],["GOCO","GoHealth Inc. Class A",28,67,0],["GOEX","GOEX",1,0,0],["GOF","Guggenheim Strategic Opportunities Fund",123,0,0],["GOGO","Gogo Inc.",33,606,0],["GOLD","Gold.com Inc.",66,817,0],["GOLF","Acushnet Holdings Corp.",61,4837,0],["GOOD","Gladstone Commercial Corporation Real Estate Investment Trust",36,523,0],["GOODN","Gladstone Commercial Corporation 6.625% Series E Cumulative Redeemable",36,1121,0],["GOODO","Gladstone Commercial Corporation 6.00% Series G Cumulative Redeemable",36,1005,0],["GOOG","Alphabet Inc. Class C",16,3723997,0],["GOOGL","Alphabet Inc. Class A",16,3706500,0],["GOOS","Canada Goose Holdings Inc. Subordinate Voting Shares",86,1249,0],["GOOY","GOOY",1,0,0],["GORO","Gold Resource Corporation",104,143,0],["GOSS","Gossamer Bio Inc.",8,796,0],["GOTU","Gaotu Techedu Inc.",3,571,0],["GOU","GOU",1,0,0],["GOVI","GOVI",1,0,0],["GOVX","GeoVax Labs Inc.",8,8,0],["GP","GreenPower Motor Company Inc.",72,3,0],["GPACU","General Purpose Acquisition Corp.",1,0,0],["GPAT","GP-Act III Acquisition Corp. Class A",1,0,0],["GPC","Genuine Parts Company",79,17453,0],["GPCR","Structure Therapeutics Inc.",8,4490,0],["GPI","Group 1 Automotive Inc.",97,5118,0],["GPIQ","GPIQ",1,0,0],["GPIX","GPIX",1,0,0],["GPJA","Georgia Power Company Series 2017A 5.00% Junior Subordinated Notes due October 1 2077",41,210,0],["GPK","Graphic Packaging Holding Company",125,4554,0],["GPMT","Granite Point Mortgage Trust Inc.",30,115,0],["GPMT/PA","GPMT/PA",1,0,0],["GPN","Global Payments Inc.",36,19141,0],["GPOR","Gulfport Energy Corporation",59,3888,0],["GPRE","Green Plains Inc.",34,656,0],["GPRF","GPRF",1,0,0],["GPRK","Geopark Ltd",59,363,0],["GPRO","GoPro Inc. Class A",7,259,0],["GPT","GPT",1,0,0],["GPTY","GPTY",1,0,0],["GPUS","Hyperscale Data Inc.",7,89,0],["GPUS/PD","GPUS/PD",1,0,0],["GPZ","GPZ",1,0,0],["GQGU","GQGU",1,0,0],["GQI","GQI",1,0,0],["GQQQ","GQQQ",1,0,0],["GQRE","GQRE",1,0,0],["GRAB","Grab Holdings Limited Class A",36,20086,0],["GRAF","Graf Global Corp. Class A",1,0,0],["GRAG","GRAG",1,0,0],["GRAL","GRAIL Inc.",23,3551,0],["GRAN","Grande Group Limited Class A",44,82,0],["GRBK","Green Brick Partners Inc.",121,2792,0],["GRBK/PA","GRBK/PA",1,0,0],["GRC","Gorman-Rupp Company (The)",148,1292,0],["GRCE","Grace Therapeutics Inc.",8,47,0],["GRDN","Guardian Pharmacy Services Inc. Class A",142,1997,0],["GRDX","GridAI Technologies Corp.",8,8,0],["GREE","Greenidge Generation Holdings Inc. Class A",44,27,0],["GREEL","Greenidge Generation Holdings Inc. 8.50% Senior Notes due 2026",44,283,0],["GREK","GREK",1,0,0],["GRF","Eagle Capital Growth Fund Inc.",123,0,0],["GRFS","Grifols S.A.",8,6202,0],["GRI","GRI Bio Inc.",8,3,0],["GRID","GRID",1,0,0],["GRIN","GRIN",1,0,0],["GRMN","Garmin Ltd.",7,38779,0],["GRN","GRN",1,0,0],["GRNB","GRNB",1,0,0],["GRND","Grindr Inc.",16,2566,0],["GRNI","GRNI",1,0,0],["GRNJ","GRNJ",1,0,0],["GRNQ","Greenpro Capital Corp.",15,15,0],["GRNT","Granite Ridge Resources Inc.",59,609,0],["GRNY","GRNY",1,0,0],["GRO","Brazil Potash Corp.",74,104,0],["GROV","Grove Collaborative Holdings Inc. Class A",57,50,0],["GROW","U.S. Global Investors Inc. Class A",11,30,0],["GROY","Gold Royalty Corp.",104,711,0],["GRP.U","GRP.U",1,0,0],["GRPM","GRPM",1,0,0],["GRPN","Groupon Inc.",58,677,0],["GRPZ","GRPZ",1,0,0],["GRRR","Gorilla Technology Group Inc.",25,248,0],["GRVY","GRAVITY Co. Ltd. American Depository Shares",36,397,0],["GRW","GRW",1,0,0],["GRWG","GrowGeneration Corp.",130,107,0],["GRX","The Gabelli Healthcare & Wellness Trust",123,165,0],["GS","Goldman Sachs Group Inc. (The)",60,267980,0],["GS/PA","GS/PA",1,0,0],["GS/PC","GS/PC",1,0,0],["GS/PD","GS/PD",1,0,0],["GSAT","Globalstar Inc.",33,7896,0],["GSBC","Great Southern Bancorp Inc.",26,720,0],["GSBD","Goldman Sachs BDC Inc.",11,1098,0],["GSC","GSC",1,0,0],["GSEU","GSEU",1,0,0],["GSG","GSG",1,0,0],["GSGO","GSGO",1,0,0],["GSHD","Goosehead Insurance Inc. Class A",28,2706,0],["GSHR","Gesher Acquisition Corp. II Class A",1,0,0],["GSHRU","Gesher Acquisition Corp. II",2,0,0],["GSIB","GSIB",1,0,0],["GSIE","GSIE",1,0,0],["GSIG","GSIG",1,0,0],["GSIT","GSI Technology",6,209,0],["GSIW","Garden Stage Limited",60,10,0],["GSJY","GSJY",1,0,0],["GSK","GSK plc",8,99136,0],["GSKH","GSKH",1,0,0],["GSL","Global Ship Lease Inc New Class A",98,1209,0],["GSL/PB","GSL/PB",1,0,0],["GSLC","GSLC",1,0,0],["GSM","Ferroglobe PLC",10,872,0],["GSOL","GSOL",1,0,0],["GSPY","GSPY",1,0,0],["GSRF","GSR IV Acquisition Corp. Class A",1,0,0],["GSRFU","GSR IV Acquisition Corp.",1,0,0],["GSSC","GSSC",1,0,0],["GSUN","Golden Sun Health Technology Group Limited Class A",3,2,0],["GSY","GSY",1,0,0],["GT","The Goodyear Tire & Rubber Company",79,2538,0],["GTBP","GT Biopharma Inc.",8,8,0],["GTE","Gran Tierra Energy Inc.",59,136,0],["GTEC","Greenland Technologies Holding Corporation",7,18,0],["GTEK","GTEK",1,0,0],["GTEN","Gores Holdings X Inc. Class A",1,0,0],["GTENU","GTENU",1,0,0],["GTERA","Globa Terra Acquisition Corporation Class A",2,0,0],["GTERU","GTERU",1,0,0],["GTES","Gates Industrial Corporation plc",7,5581,0],["GTIM","Good Times Restaurants Inc.",68,14,0],["GTLB","GitLab Inc. Class A",25,6399,0],["GTLS","Chart Industries Inc.",55,9256,0],["GTM","ZoomInfo Technologies Inc",25,3200,0],["GTN","Gray Media Inc.",83,521,0],["GTN.A","GTN.A",1,0,0],["GTO","GTO",1,0,0],["GTOP","GTOP",1,0,0],["GTPE","GTPE",1,0,0],["GTR","GTR",1,0,0],["GTX","Garrett Motion Inc.",42,3382,0],["GTY","Getty Realty Corporation",36,1617,0],["GUG","Guggenheim Active Allocation Fund",81,0,0],["GUMI","GUMI",1,0,0],["GUNR","GUNR",1,0,0],["GURE","Gulf Resources Inc. (NV)",34,6,0],["GURU","GURU",1,0,0],["GUSA","GUSA",1,0,0],["GUSE","GUSE",1,0,0],["GUSH","GUSH",1,0,0],["GUT","Gabelli Utility Trust (The)",81,446,0],["GUT/PC","GUT/PC",1,0,0],["GUTS","Fractyl Health Inc.",31,301,0],["GV","Visionary Holdings Inc.",3,5,0],["GVA","Granite Construction Incorporated",21,5039,0],["GVH","Globavend Holdings Limited",105,4,0],["GVIP","GVIP",1,0,0],["GVLE","GVLE",1,0,0],["GVLU","GVLU",1,0,0],["GVUS","GVUS",1,0,0],["GWAV","Greenwave Technology Solutions Inc.",55,5,0],["GWH","ESS Tech Inc.",7,42,0],["GWRE","Guidewire Software Inc.",25,16997,0],["GWRS","Global Water Resources Inc.",70,243,0],["GWW","W.W. Grainger Inc.",92,48739,0],["GWX","GWX",1,0,0],["GXAI","Gaxos.ai Inc.",25,8,0],["GXC","GXC",1,0,0],["GXDW","GXDW",1,0,0],["GXIG","GXIG",1,0,0],["GXLC","GXLC",1,0,0],["GXO","GXO Logistics Inc.",87,6101,0],["GXPC","GXPC",1,0,0],["GXPD","GXPD",1,0,0],["GXPE","GXPE",1,0,0],["GXPS","GXPS",1,0,0],["GXPT","GXPT",1,0,0],["GXRP","GXRP",1,0,0],["GXUS","GXUS",1,0,0],["GYLD","GYLD",1,0,0],["GYRE","Gyre Therapeutics Inc.",8,687,0],["GYRO","Gyrodyne LLC",134,20,0],["H","Hyatt Hotels Corporation Class A",47,15628,0],["HACK","HACK",1,0,0],["HAE","Haemonetics Corporation",31,3755,0],["HAFC","Hanmi Financial Corporation",26,854,0],["HAFN","Hafnia Limited",87,2679,0],["HAIL","HAIL",1,0,0],["HAIN","Hain Celestial Group Inc. (The)",17,107,0],["HAL","Halliburton Company",20,23330,0],["HALO","Halozyme Therapeutics Inc.",13,7920,0],["HAO","Haoxi Health Technology Limited Class A",58,3,0],["HAP","HAP",1,0,0],["HAPI","HAPI",1,0,0],["HAPS","HAPS",1,0,0],["HARD","HARD",1,0,0],["HAS","Hasbro Inc.",61,11505,0],["HASI","HA Sustainable Infrastructure Capital Inc.",123,4124,0],["HAUZ","HAUZ",1,0,0],["HAVA","Harvard Ave Acquisition Corporation Class A",1,0,0],["HAVAU","Harvard Ave Acquisition Corporation Unit",2,0,0],["HAWX","HAWX",1,0,0],["HAYW","Hayward Holdings Inc.",7,3468,0],["HBAN","Huntington Bancshares Incorporated",26,27858,0],["HBANL","Huntington Bancshares Incorporated",26,40488,0],["HBANM","Huntington Bancshares Incorporated",26,34819,0],["HBANP","Huntington Bancshares Incorporated",26,27244,0],["HBB","Hamilton Beach Brands Holding Company Class A",73,214,0],["HBCP","Home Bancorp Inc.",43,477,0],["HBDC","HBDC",1,0,0],["HBIO","Harvard Bioscience Inc.",71,34,0],["HBM","Hudbay Minerals Inc.",10,7634,0],["HBNB","Hotel101 Global Holdings Corp. Class A",47,1758,0],["HBNC","Horizon Bancorp Inc.",26,926,0],["HBR","Canary HBAR ETF Shares of Beneficial Interest",44,53,0],["HBT","HBT Financial Inc.",26,842,0],["HBTA","HBTA",1,0,0],["HCA","HCA Healthcare Inc.",126,107931,0],["HCACU","Hall Chadwick Acquisition Corp. Unit",42,0,0],["HCAI","Huachen AI Parking Management Technology Holding Co. Ltd. Class A",69,12,0],["HCAT","Health Catalyst Inc",16,166,0],["HCC","Warrior Met Coal Inc.",65,4596,0],["HCHL","Happy City Holdings Limited Class A",68,71,0],["HCI","HCI Group Inc.",22,2462,0],["HCKT","Hackett Group Inc (The).",19,541,0],["HCM","HUTCHMED (China) Limited",8,2364,0],["HCMA","HCM III Acquisition Corp. Class A",47,799,0],["HCMAU","HCM III Acquisition Corp.",1,0,0],["HCMT","HCMT",1,0,0],["HCOW","HCOW",1,0,0],["HCSG","Healthcare Services Group Inc.",126,1377,0],["HCTI","Healthcare Triangle Inc.",15,88,0],["HCWB","HCW Biologics Inc.",8,4,0],["HCWC","Healthy Choice Wellness Corp. Class A",67,4,0],["HCXY","Hercules Capital Inc. 6.25% Notes due 2033",11,4622,0],["HD","Home Depot Inc. (The)",130,343451,0],["HDB","HDFC Bank Limited",75,183686,0],["HDEF","HDEF",1,0,0],["HDG","HDG",1,0,0],["HDGE","HDGE",1,0,0],["HDL","SUPER HI INTERNATIONAL HOLDING LTD.",68,1106,0],["HDLB","HDLB",1,0,0],["HDMV","HDMV",1,0,0],["HDSN","Hudson Technologies Inc.",32,307,0],["HDUS","HDUS",1,0,0],["HDV","HDV",1,0,0],["HE","Hawaiian Electric Industries Inc.",41,1971,0],["HEAL","HEAL",1,0,0],["HECA","HECA",1,0,0],["HECO","HECO",1,0,0],["HEDG","HEDG",1,0,0],["HEDJ","HEDJ",1,0,0],["HEFT","HEFT",1,0,0],["HEI","Heico Corporation",50,45475,0],["HEI.A","HEI.A",1,0,0],["HEJD","HEJD",1,0,0],["HELE","Helen of Troy Limited",73,470,0],["HELO","HELO",1,0,0],["HELS","HELS",1,0,0],["HEPS","D-Market Electronic Services & Trading",57,1057,0],["HEQ","John Hancock Diversified Income Fund",11,0,0],["HEQQ","HEQQ",1,0,0],["HEQT","HEQT",1,0,0],["HERD","HERD",1,0,0],["HERE","Here Group Limited",3,278,0],["HERO","HERO",1,0,0],["HERZ","Herzfeld Credit Income Fund Inc.",11,0,0],["HESM","Hess Midstream LP Class A Representing Limited Partner Interests",59,4381,0],["HEWJ","HEWJ",1,0,0],["HEZU","HEZU",1,0,0],["HF","HF",1,0,0],["HFBL","Home Federal Bancorp Inc. of Louisiana",84,50,0],["HFEQ","HFEQ",1,0,0],["HFFG","HF Foods Group Inc.",103,128,0],["HFGM","HFGM",1,0,0],["HFMF","HFMF",1,0,0],["HFND","HFND",1,0,0],["HFRO","Highland Opportunities and Income Fund",123,0,0],["HFRO/PA","HFRO/PA",1,0,0],["HFRO/PB","HFRO/PB",1,0,0],["HFSP","HFSP",1,0,0],["HFWA","Heritage Financial Corporation",43,846,0],["HFXI","HFXI",1,0,0],["HG","Hamilton Insurance Group Ltd. Class B",1,1823,0],["HGBL","Heritage Global Inc.",36,43,0],["HGER","HGER",1,0,0],["HGLB","Highland Global Allocation Fund",81,0,0],["HGRO","HGRO",1,0,0],["HGTY","Hagerty Inc. Class A",28,4491,0],["HGV","Hilton Grand Vacations Inc.",47,3879,0],["HHH","Howard Hughes Holdings Inc.",30,4660,0],["HHS","Harte Hanks Inc.",58,25,0],["HI","Hillenbrand Inc",69,2232,0],["HIBL","HIBL",1,0,0],["HIBS","HIBS",1,0,0],["HIDE","HIDE",1,0,0],["HIDV","HIDV",1,0,0],["HIFS","Hingham Institution for Savings",43,635,0],["HIG","The Hartford Insurance Group Inc.",22,38735,0],["HIG/PG","HIG/PG",1,0,0],["HIGH","HIGH",1,0,0],["HIHO","Highway Holdings Limited",55,4,0],["HII","Huntington Ingalls Industries Inc.",98,13210,0],["HIMS","Hims & Hers Health Inc. Class A",35,8095,0],["HIMX","Himax Technologies Inc.",6,1417,0],["HIMY","HIMY",1,0,0],["HIMZ","HIMZ",1,0,0],["HIND","Vyome Holdings Inc.",31,21,0],["HIO","Western Asset High Income Opportunity Fund Inc.",123,0,0],["HIPO","Hippo Holdings Inc.",22,783,0],["HIPS","HIPS",1,0,0],["HISF","HISF",1,0,0],["HIT","Health In Tech Inc. Class A",28,77,0],["HITI","High Tide Inc.",66,241,0],["HIVE","HIVE Digital Technologies Ltd.",44,673,0],["HIW","Highwoods Properties Inc.",30,2791,0],["HIX","Western Asset High Income Fund II Inc.",123,0,0],["HIYY","HIYY",1,0,0],["HKD","AMTD Digital Inc.",44,172,0],["HKIT","Hitek Global Inc. Class A",25,193,0],["HKPD","Hong Kong Pharma Digital Technology Holdings Limited",112,8,0],["HL","Hecla Mining Company",74,13181,0],["HL/PB","HL/PB",1,0,0],["HLAL","HLAL",1,0,0],["HLF","Herbalife Ltd.",112,1445,0],["HLI","Houlihan Lokey Inc. Class A",11,12371,0],["HLIO","Helios Technologies Inc.",55,1811,0],["HLIT","Harmonic Inc.",49,1109,0],["HLLY","Holley Inc.",42,508,0],["HLMN","Hillman Solutions Corp.",7,1752,0],["HLN","Haleon plc",90,44087,0],["HLNE","Hamilton Lane Incorporated Class A",11,7502,0],["HLP","Hongli Group Inc.",7,87,0],["HLT","Hilton Worldwide Holdings Inc.",47,67929,0],["HLX","Helix Energy Solutions Group Inc.",20,903,0],["HMC","Honda Motor Company Ltd.",37,43639,0],["HMN","Horace Mann Educators Corporation",22,1893,0],["HMOP","HMOP",1,0,0],["HMR","Heidmar Maritime Holdings Corp.",98,54,0],["HMY","Harmony Gold Mining Company Limited",104,13121,0],["HMYY","HMYY",1,0,0],["HNDL","HNDL",1,0,0],["HNGE","Hinge Health Inc. Class A",15,3719,0],["HNI","HNI Corporation",92,1929,0],["HNNA","Hennessy Advisors Inc.",11,73,0],["HNNAZ","Hennessy Advisors Inc. 4.875% Notes due 2026",11,193,0],["HNRG","Hallador Energy Company",65,845,0],["HNST","The Honest Company Inc.",57,312,0],["HNVR","Hanover Bancorp Inc.",26,172,0],["HODU","HODU",1,0,0],["HOFT","Hooker Furnishings Corporation",73,119,0],["HOG","Harley-Davidson Inc.",119,2511,0],["HOLA","HOLA",1,0,0],["HOLD","HOLD",1,0,0],["HOLO","MicroCloud Hologram Inc.",16,43,0],["HOLX","Hologic Inc.",132,16707,0],["HOMB","Home BancShares Inc.",26,5592,0],["HOMZ","HOMZ",1,0,0],["HON","Honeywell International Inc.",50,126412,0],["HOOD","Robinhood Markets Inc. Class A",60,109117,0],["HOOG","HOOG",1,0,0],["HOOI","HOOI",1,0,0],["HOOX","HOOX",1,0,0],["HOOY","HOOY",1,0,0],["HOOZ","HOOZ",1,0,0],["HOPE","Hope Bancorp Inc.",26,1468,0],["HOTH","Hoth Therapeutics Inc.",8,17,0],["HOUR","Hour Loop Inc.",57,69,0],["HOUS","Anywhere Real Estate Inc.",36,1624,0],["HOV","Hovnanian Enterprises Inc. Class A",121,607,0],["HOVNP","Hovnanian Enterprises Inc Dep Shr Srs A Pfd",121,118,0],["HOVR","New Horizon Aircraft Ltd. Class A",50,73,0],["HOWL","Werewolf Therapeutics Inc.",8,33,0],["HOYY","HOYY",1,0,0],["HP","Helmerich & Payne Inc.",59,2751,0],["HPAI","Helport AI Limited",25,155,0],["HPE","Hewlett Packard Enterprise Company",100,32234,0],["HPE/PC","HPE/PC",1,0,0],["HPF","John Hancock Pfd Income Fund II Pfd Income Fund II",116,0,0],["HPI","John Hancock Preferred Income Fund",81,0,0],["HPK","HighPeak Energy Inc.",59,534,0],["HPP","Hudson Pacific Properties Inc.",36,560,0],["HPP/PC","HPP/PC",1,0,0],["HPQ","HP Inc.",9,21352,0],["HPS","John Hancock Preferred Income Fund III Preferred Income Fund III",11,0,0],["HQGO","HQGO",1,0,0],["HQH","abrdn Healthcare Investors Shares of Beneficial Interest",116,898,0],["HQI","HireQuest Inc.",19,118,0],["HQL","abrdn Life Sciences Investors Shares of Beneficial Interest",11,434,0],["HQY","HealthEquity Inc.",36,8159,0],["HR","Healthcare Realty Trust Incorporated",30,5925,0],["HRB","H&R Block Inc.",3,5526,0],["HRI","Herc Holdings Inc.",131,5118,0],["HRL","Hormel Foods Corporation",62,13021,0],["HRMY","Harmony Biosciences Holdings Inc.",8,2178,0],["HROW","Harrow Inc.",8,1719,0],["HRTG","Heritage Insurance Holdings Inc.",22,895,0],["HRTS","HRTS",1,0,0],["HRTX","Heron Therapeutics Inc.",8,238,0],["HRZN","Horizon Technology Finance Corporation",44,285,0],["HSAI","Hesai Group American",7,3121,0],["HSBC","HSBC Holdings plc.",84,267659,0],["HSCS","HeartSciences Inc.",32,8,0],["HSCZ","HSCZ",1,0,0],["HSDT","Solana Company Class A",77,123,0],["HSHP","Himalaya Shipping Ltd.",98,411,0],["HSIC","Henry Schein Inc.",23,9106,0],["HSMV","HSMV",1,0,0],["HSPT","Horizon Space Acquisition II Corp.",1,0,0],["HSPTU","Horizon Space Acquisition II Corp.",1,0,0],["HST","Host Hotels & Resorts Inc.",30,12729,0],["HSTM","HealthStream Inc.",16,710,0],["HSY","The Hershey Company",93,38379,0],["HTAB","HTAB",1,0,0],["HTAX","HTAX",1,0,0],["HTB","HomeTrust Bancshares Inc.",84,779,0],["HTBK","Heritage Commerce Corp",26,761,0],["HTCO","High-Trend International Group Class A",98,62,0],["HTCR","Heartcore Enterprises Inc.",15,9,0],["HTD","John Hancock Tax Advantaged Dividend Income Fund",116,0,0],["HTEC","HTEC",1,0,0],["HTFB","Horizon Technology Finance Corporation 4.875% Notes due 2026",44,1058,0],["HTFC","Horizon Technology Finance Corporation 6.25% Notes due 2027",44,1055,0],["HTFL","Heartflow Inc.",31,2598,0],["HTGC","Hercules Capital Inc.",11,3364,0],["HTH","Hilltop Holdings Inc.",26,2128,0],["HTHT","H World Group Limited",47,15077,0],["HTLD","Heartland Express Inc.",63,695,0],["HTLM","HomesToLife Ltd",66,232,0],["HTO","H2O America",70,1753,0],["HTOO","Fusion Fuel Green PLC Class A",7,3,0],["HTRB","HTRB",1,0,0],["HTZ","Hertz Global Holdings Inc",96,1605,0],["HUBB","Hubbell Inc",39,23517,0],["HUBC","Hub Cyber Security Ltd.",51,4,0],["HUBG","Hub Group Inc. Class A",105,2679,0],["HUBS","HubSpot Inc.",25,20402,0],["HUDI","Huadi International Group Co. Ltd.",27,18,0],["HUHU","HUHUTECH International Group Inc.",55,240,0],["HUIZ","Huize Holding Limited",28,31,0],["HUM","Humana Inc.",23,31199,0],["HUMA","Humacyte Inc.",13,233,0],["HUN","Huntsman Corporation",34,1751,0],["HURA","TuHURA Biosciences Inc.",8,50,0],["HURC","Hurco Companies Inc.",7,95,0],["HURN","Huron Consulting Group Inc.",19,3114,0],["HUSV","HUSV",1,0,0],["HUT","Hut 8 Corp.",44,4767,0],["HUYA","HUYA Inc.",16,679,0],["HVAC","HVAC",1,0,0],["HVII","Hennessy Capital Investment Corp. VII",1,0,0],["HVIIU","Hennessy Capital Investment Corp. VII Unit",2,0,0],["HVMC","Highview Merger Corp. Class A",1,0,0],["HVMCU","Highview Merger Corp.",2,0,0],["HVT","Haverty Furniture Companies Inc.",66,395,0],["HVT.A","HVT.A",1,0,0],["HWAY","HWAY",1,0,0],["HWBK","Hawthorn Bancshares Inc.",26,251,0],["HWC","Hancock Whitney Corporation",26,5503,0],["HWCPZ","Hancock Whitney Corporation 6.25% Subordinated Notes due 2060",26,1996,0],["HWH","HWH International Inc.",112,10,0],["HWKN","Hawkins Inc.",135,3012,0],["HWM","Howmet Aerospace Inc.",55,81816,0],["HWSM","HWSM",1,0,0],["HXHX","Haoxin Holdings Limited Class A",63,5,0],["HXL","Hexcel Corporation",34,5933,0],["HY","Hyster-Yale Inc. Class A",72,544,0],["HYAC","Haymaker Acquisition Corp. 4 Class A",1,0,0],["HYAC.U","HYAC.U",1,0,0],["HYBB","HYBB",1,0,0],["HYBI","HYBI",1,0,0],["HYBX","HYBX",1,0,0],["HYDR","HYDR",1,0,0],["HYDW","HYDW",1,0,0],["HYEM","HYEM",1,0,0],["HYFI","HYFI",1,0,0],["HYFM","Hydrofarm Holdings Group Inc.",94,8,0],["HYFT","MindWalk Holdings Corp.",8,78,0],["HYG","HYG",1,0,0],["HYGH","HYGH",1,0,0],["HYGV","HYGV",1,0,0],["HYI","Western Asset High Yield Opportunity Fund Inc.",11,0,0],["HYLB","HYLB",1,0,0],["HYLN","Hyliion Holdings Corp. Class A",72,327,0],["HYLS","HYLS",1,0,0],["HYMB","HYMB",1,0,0],["HYMC","Hycroft Mining Holding Corporation Class A",104,1329,0],["HYNE","Hoyne Bancorp Inc.",43,111,0],["HYP","HYP",1,0,0],["HYPD","Hyperion DeFi Inc.",8,216,0],["HYPR","Hyperfine Inc. Class A",77,107,0],["HYRM","HYRM",1,0,0],["HYS","HYS",1,0,0],["HYSA","HYSA",1,0,0],["HYSD","HYSD",1,0,0],["HYT","Blackrock Corporate High Yield Fund Inc.",116,0,0],["HYTI","HYTI",1,0,0],["HYTR","HYTR",1,0,0],["HYUP","HYUP",1,0,0],["HYXF","HYXF",1,0,0],["HYZD","HYZD",1,0,0],["HZO","MarineMax Inc. (FL)",141,541,0],["IAC","IAC Inc.",16,3102,0],["IAE","Voya Asia Pacific High Dividend Equity Income Fund ING Asia Pacific High Dividend Equity Income Fund",81,0,0],["IAF","abrdn Australia Equity Fund Inc.",123,0,0],["IAG","Iamgold Corporation",104,9659,0],["IAI","IAI",1,0,0],["IAK","IAK",1,0,0],["IALT","IALT",1,0,0],["IAPR","IAPR",1,0,0],["IART","Integra LifeSciences Holdings Corporation",31,985,0],["IAS","Integral Ad Science Holding Corp.",16,1722,0],["IAT","IAT",1,0,0],["IAU","IAU",1,0,0],["IAUG","IAUG",1,0,0],["IAUM","IAUM",1,0,0],["IAUX","i-80 Gold Corp.",104,1272,0],["IBAC","IB Acquisition Corp.",2,0,0],["IBAT","IBAT",1,0,0],["IBB","IBB",1,0,0],["IBBQ","IBBQ",1,0,0],["IBCA","IBCA",1,0,0],["IBCP","Independent Bank Corporation",26,706,0],["IBD","IBD",1,0,0],["IBDR","IBDR",1,0,0],["IBDS","IBDS",1,0,0],["IBDT","IBDT",1,0,0],["IBDU","IBDU",1,0,0],["IBDV","IBDV",1,0,0],["IBDW","IBDW",1,0,0],["IBDX","IBDX",1,0,0],["IBDY","IBDY",1,0,0],["IBDZ","IBDZ",1,0,0],["IBEX","IBEX Limited",15,512,0],["IBG","Innovation Beverage Group Limited",46,6,0],["IBGA","IBGA",1,0,0],["IBGB","IBGB",1,0,0],["IBGK","IBGK",1,0,0],["IBGL","IBGL",1,0,0],["IBIC","IBIC",1,0,0],["IBID","IBID",1,0,0],["IBIE","IBIE",1,0,0],["IBIF","IBIF",1,0,0],["IBIG","IBIG",1,0,0],["IBIH","IBIH",1,0,0],["IBII","IBII",1,0,0],["IBIJ","IBIJ",1,0,0],["IBIK","IBIK",1,0,0],["IBIL","IBIL",1,0,0],["IBIO","iBio Inc.",8,45,0],["IBIT","IBIT",1,0,0],["IBKR","Interactive Brokers Group Inc. Class A",60,28619,0],["IBLC","IBLC",1,0,0],["IBM","International Business Machines Corporation",9,281337,0],["IBN","ICICI Bank Limited",75,106748,0],["IBND","IBND",1,0,0],["IBO","Impact BioMedical Inc.",8,68,0],["IBOC","International Bancshares Corporation",26,4379,0],["IBOT","IBOT",1,0,0],["IBP","Installed Building Products Inc.",121,7247,0],["IBRN","IBRN",1,0,0],["IBRX","ImmunityBio Inc.",13,2049,0],["IBTA","Ibotta Inc. Class A",58,574,0],["IBTG","IBTG",1,0,0],["IBTH","IBTH",1,0,0],["IBTI","IBTI",1,0,0],["IBTJ","IBTJ",1,0,0],["IBTK","IBTK",1,0,0],["IBTL","IBTL",1,0,0],["IBTM","IBTM",1,0,0],["IBTO","IBTO",1,0,0],["IBTP","IBTP",1,0,0],["IBTQ","IBTQ",1,0,0],["IBUF","IBUF",1,0,0],["IBUY","IBUY",1,0,0],["ICAP","ICAP",1,0,0],["ICCC","ImmuCell Corporation",24,54,0],["ICCM","IceCure Medical Ltd.",31,38,0],["ICE","Intercontinental Exchange Inc.",60,91400,0],["ICFI","ICF International Inc.",19,1575,0],["ICG","Intchains Group Limited",6,216,0],["ICHR","Ichor Holdings",6,606,0],["ICL","ICL Group Ltd.",85,6426,0],["ICLN","ICLN",1,0,0],["ICLR","ICON plc",14,14033,0],["ICMB","Investcorp Credit Management BDC Inc.",44,41,0],["ICOI","ICOI",1,0,0],["ICON","Icon Energy Corp.",98,2,0],["ICOP","ICOP",1,0,0],["ICPI","ICPI",1,0,0],["ICPY","ICPY",1,0,0],["ICR/PA","ICR/PA",1,0,0],["ICRC","ICRC",1,0,0],["ICU","SeaStar Medical Holding Corporation",31,9,0],["ICUI","ICU Medical Inc.",31,3583,0],["IDA","IDACORP Inc.",41,6800,0],["IDAI","T Stamp Inc. Class A",25,20,0],["IDCC","InterDigital Inc.",29,8609,0],["IDE","Voya Infrastructure Industrials and Materials Fund",123,0,0],["IDEC","IDEC",1,0,0],["IDEF","IDEF",1,0,0],["IDEQ","IDEQ",1,0,0],["IDEV","IDEV",1,0,0],["IDGT","IDGT",1,0,0],["IDHQ","IDHQ",1,0,0],["IDLV","IDLV",1,0,0],["IDMO","IDMO",1,0,0],["IDN","Intellicheck Inc.",25,139,0],["IDNA","IDNA",1,0,0],["IDOG","IDOG",1,0,0],["IDR","Idaho Strategic Resources Inc.",104,715,0],["IDRV","IDRV",1,0,0],["IDT","IDT Corporation Class B",33,1291,0],["IDU","IDU",1,0,0],["IDVO","IDVO",1,0,0],["IDX","IDX",1,0,0],["IDXX","IDEXX Laboratories Inc.",24,55923,0],["IDYA","IDEAYA Biosciences Inc.",8,2941,0],["IDYN","IDYN",1,0,0],["IE","Ivanhoe Electric Inc.",10,2252,0],["IEF","IEF",1,0,0],["IEI","IEI",1,0,0],["IEMG","IEMG",1,0,0],["IEP","Icahn Enterprises L.P.",42,4610,0],["IESC","IES Holdings Inc.",82,8143,0],["IETH","IETH",1,0,0],["IEUR","IEUR",1,0,0],["IEUS","IEUS",1,0,0],["IEV","IEV",1,0,0],["IEX","IDEX Corporation",148,13307,0],["IEZ","IEZ",1,0,0],["IFBD","Infobird Co. Ltd",25,8,0],["IFEB","IFEB",1,0,0],["IFED","IFED",1,0,0],["IFF","International Flavors & Fragrances Inc.",34,16843,0],["IFGL","IFGL",1,0,0],["IFLO","IFLO",1,0,0],["IFLR","IFLR",1,0,0],["IFN","India Fund Inc. (The)",123,0,0],["IFRX","InflaRx N.V.",8,66,0],["IFS","Intercorp Financial Services Inc.",75,4925,0],["IFV","IFV",1,0,0],["IG","IG",1,0,0],["IGA","Voya Global Advantage and Premium Opportunity Fund",11,0,0],["IGACU","Invest Green Acquisition Corporation",2,0,0],["IGBH","IGBH",1,0,0],["IGC","IGC Pharma Inc.",8,28,0],["IGCB","IGCB",1,0,0],["IGD","Voya Global Equity Dividend and Premium Opportunity Fund",81,0,0],["IGF","IGF",1,0,0],["IGGY","IGGY",1,0,0],["IGI","Western Asset Investment Grade Opportunity Trust Inc.",11,0,0],["IGIB","IGIB",1,0,0],["IGIC","International General Insurance Holdings Ltd.",22,1139,0],["IGLB","IGLB",1,0,0],["IGM","IGM",1,0,0],["IGME","IGME",1,0,0],["IGOV","IGOV",1,0,0],["IGPT","IGPT",1,0,0],["IGR","CBRE Global Real Estate Income Fund",116,0,0],["IGSB","IGSB",1,0,0],["IGTR","IGTR",1,0,0],["IH","iHuman Inc.",3,114,0],["IHAK","IHAK",1,0,0],["IHD","Voya Emerging Markets High Income Dividend Equity Fund",11,0,0],["IHDG","IHDG",1,0,0],["IHE","IHE",1,0,0],["IHF","IHF",1,0,0],["IHG","Intercontinental Hotels Group",47,21626,0],["IHI","IHI",1,0,0],["IHRT","iHeartMedia Inc. Class A",83,661,0],["IHS","IHS Holding Limited",33,2447,0],["IHT","InnSuites Hospitality Trust Shares of Beneficial Interest",60,12,0],["IHY","IHY",1,0,0],["IHYF","IHYF",1,0,0],["IIF","Morgan Stanley India Investment Fund Inc.",81,0,0],["IIGD","IIGD",1,0,0],["III","Information Services Group Inc.",19,283,0],["IIIN","Insteel Industries Inc.",27,616,0],["IIIV","i3 Verticals Inc. Class A",36,838,0],["IIM","Invesco Value Municipal Income Trust",11,578,0],["IINN","Inspira Technologies Oxy B.H.N. Ltd.",31,36,0],["IIPR","Innovative Industrial Properties Inc.",36,1489,0],["IIPR/PA","IIPR/PA",1,0,0],["IJAN","IJAN",1,0,0],["IJH","IJH",1,0,0],["IJJ","IJJ",1,0,0],["IJK","IJK",1,0,0],["IJR","IJR",1,0,0],["IJS","IJS",1,0,0],["IJT","IJT",1,0,0],["IJUL","IJUL",1,0,0],["IJUN","IJUN",1,0,0],["IKT","Inhibikase Therapeutics Inc.",13,208,0],["ILAG","Intelligent Living Application Group Inc.",92,7,0],["ILCB","ILCB",1,0,0],["ILCG","ILCG",1,0,0],["ILCV","ILCV",1,0,0],["ILDR","ILDR",1,0,0],["ILF","ILF",1,0,0],["ILIT","ILIT",1,0,0],["ILLR","Triller Group Inc.",11,96,0],["ILMN","Illumina Inc.",23,20594,0],["ILOW","ILOW",1,0,0],["ILPT","Industrial Logistics Properties Trust",30,363,0],["ILS","ILS",1,0,0],["ILTB","ILTB",1,0,0],["IMA","ImageneBio Inc.",13,69,0],["IMAR","IMAR",1,0,0],["IMAX","Imax Corporation",7,2006,0],["IMAY","IMAY",1,0,0],["IMCB","IMCB",1,0,0],["IMCC","IM Cannabis Corp.",18,5,0],["IMCG","IMCG",1,0,0],["IMCR","Immunocore Holdings plc",13,1732,0],["IMCV","IMCV",1,0,0],["IMDX","Insight Molecular Diagnostics Inc.",24,155,0],["IMG","CIMG Inc.",66,21,0],["IMKTA","Ingles Markets Incorporated Class A",67,1362,0],["IMMP","Immutep Limited",8,387,0],["IMMR","Immersion Corporation",53,209,0],["IMMX","Immix Biopharma Inc.",8,298,0],["IMNM","Immunome Inc.",8,2366,0],["IMNN","Imunon Inc.",8,12,0],["IMO","Imperial Oil Limited",106,41850,0],["IMOM","IMOM",1,0,0],["IMOS","ChipMOS TECHNOLOGIES INC.",6,1006,0],["IMPP","Imperial Petroleum Inc.",98,175,0],["IMPPP","Imperial Petroleum Inc. 8.75% Series A Cumulative Redeemable Perpetual",98,1189,0],["IMRA","IMRA",1,0,0],["IMRN","Immuron Limited",8,6,0],["IMRX","Immuneering Corporation Class A",8,365,0],["IMSR","Terrestrial Energy Inc.",1,819,0],["IMST","IMST",1,0,0],["IMTB","IMTB",1,0,0],["IMTE","Integrated Media Technology Limited",133,2,0],["IMTM","IMTM",1,0,0],["IMTX","Immatics N.V.",13,1377,0],["IMUX","Immunic Inc.",8,69,0],["IMVT","Immunovant Inc.",13,5407,0],["IMXI","International Money Express Inc.",36,456,0],["INAB","IN8bio Inc.",13,6,0],["INAC","Indigo Acquisition Corp.",1,0,0],["INACU","Indigo Acquisition Corp. Unit",1,0,0],["INBK","First Internet Bancorp",26,188,0],["INBKZ","First Internet Bancorp 6.0% Fixed-to-Floating Rate Subordinated Notes Due 2029",26,216,0],["INBS","Intelligent Bio Solutions Inc.",31,6,0],["INBX","Inhibrx Biosciences Inc.",13,1253,0],["INCE","INCE",1,0,0],["INCM","INCM",1,0,0],["INCO","INCO",1,0,0],["INCR","Intercure Ltd.",8,74,0],["INCY","Incyte Corp.",14,20160,0],["IND","IND",1,0,0],["INDB","Independent Bank Corp.",26,3837,0],["INDE","INDE",1,0,0],["INDH","INDH",1,0,0],["INDI","indie Semiconductor Inc. Class A",6,832,0],["INDL","INDL",1,0,0],["INDO","Indonesia Energy Corporation Limited",59,40,0],["INDP","Indaptus Therapeutics Inc.",8,4,0],["INDS","INDS",1,0,0],["INDV","Indivior PLC",8,4393,0],["INDY","INDY",1,0,0],["INEO","INNEOVA Holdings Limited Class A",119,5,0],["INEQ","INEQ",1,0,0],["INFL","INFL",1,0,0],["INFO","INFO",1,0,0],["INFR","INFR",1,0,0],["INFU","InfuSystems Holdings Inc.",31,187,0],["INFY","Infosys Limited",15,83998,0],["ING","ING Group N.V.",75,87749,0],["INGM","Ingram Micro Holding Corporation",100,5270,0],["INGN","Inogen Inc",32,182,0],["INGR","Ingredion Incorporated",17,7019,0],["INHD","Inno Holdings Inc.",27,7,0],["INKM","INKM",1,0,0],["INKT","MiNK Therapeutics Inc.",13,98,0],["INLF","INLIF LIMITED Class A",7,8,0],["INLX","Intellinetics Inc.",25,36,0],["INM","InMed Pharmaceuticals Inc.",8,3,0],["INMB","INmune Bio Inc.",13,49,0],["INMD","InMode Ltd.",77,999,0],["INMU","INMU",1,0,0],["INN","Summit Hotel Properties Inc.",30,555,0],["INN/PE","INN/PE",1,0,0],["INN/PF","INN/PF",1,0,0],["INNV","InnovAge Holding Corp.",35,814,0],["INO","Inovio Pharmaceuticals Inc.",31,122,0],["INOD","Innodata Inc.",15,1689,0],["INOV","INOV",1,0,0],["INQQ","INQQ",1,0,0],["INR","Infinity Natural Resources Inc. Class A",59,883,0],["INRO","INRO",1,0,0],["INSE","Inspired Entertainment Inc.",25,244,0],["INSG","Inseego Corp.",33,164,0],["INSM","Insmed Incorporated",8,37289,0],["INSP","Inspire Medical Systems Inc.",31,2805,0],["INSW","International Seaways Inc.",98,2389,0],["INTA","Intapp Inc.",25,3765,0],["INTC","Intel Corporation",6,161161,0],["INTF","INTF",1,0,0],["INTG","Intergroup Corporation (The)",134,59,0],["INTJ","Intelligent Group Limited Class A",19,17,0],["INTR","Inter & Co. Inc. Class A",75,3619,0],["INTS","Intensity Therapeutics Inc.",13,25,0],["INTT","inTest Corporation",39,91,0],["INTU","Intuit Inc.",25,186890,0],["INTW","INTW",1,0,0],["INTZ","Intrusion Inc.",51,26,0],["INUV","Inuvo Inc.",58,39,0],["INV","Innventure Inc.",2,294,0],["INVA","Innoviva Inc.",8,1495,0],["INVE","Identiv Inc.",53,85,0],["INVG","INVG",1,0,0],["INVH","Invitation Homes Inc.",36,16582,0],["INVN","INVN",1,0,0],["INVX","Innovex International Inc.",88,1492,0],["INVZ","Innoviz Technologies Ltd.",42,235,0],["IOBT","IO Biotech Inc.",8,48,0],["IOCT","IOCT",1,0,0],["ION","ION",1,0,0],["IONL","IONL",1,0,0],["IONQ","IonQ Inc.",15,17175,0],["IONR","ioneer Ltd",74,297,0],["IONS","Ionis Pharmaceuticals Inc.",8,12888,0],["IONX","IONX",1,0,0],["IONZ","IONZ",1,0,0],["IOO","IOO",1,0,0],["IOPP","IOPP",1,0,0],["IOR","Income Opportunity Realty Investors Inc.",30,71,0],["IOSP","Innospec Inc.",34,1923,0],["IOT","Samsara Inc. Class A",15,22036,0],["IOTR","iOThree Limited",33,7,0],["IOVA","Iovance Biotherapeutics Inc.",13,984,0],["IOYY","IOYY",1,0,0],["IP","International Paper Company",138,20192,0],["IPAC","IPAC",1,0,0],["IPAR","Interparfums Inc.",90,2699,0],["IPAY","IPAY",1,0,0],["IPB","IPB",1,0,0],["IPCX","Inflection Point Acquisition Corp. III Class A",1,0,0],["IPCXU","IPCXU",1,0,0],["IPDN","Professional Diversity Network Inc.",16,8,0],["IPEX","Inflection Point Acquisition Corp. V Class A",8,0,0],["IPEXU","Inflection Point Acquisition Corp. V",2,0,0],["IPGP","IPG Photonics Corporation",6,3196,0],["IPHA","Innate Pharma S.A. ADS",13,161,0],["IPI","Intrepid Potash Inc",74,361,0],["IPKW","IPKW",1,0,0],["IPM","Intelligent Protection Management Corp.",36,16,0],["IPO","IPO",1,0,0],["IPOD","Dune Acquisition Corporation II Class A",2,0,0],["IPOS","IPOS",1,0,0],["IPSC","Century Therapeutics Inc.",13,79,0],["IPST","Heritage Distilling Holding Company Inc.",46,25,0],["IPW","iPower Inc.",130,13,0],["IPWR","Ideal Power Inc.",6,26,0],["IPX","IperionX Limited American",52,1058,0],["IQ","iQIYI Inc.",110,1781,0],["IQDF","IQDF",1,0,0],["IQDY","IQDY",1,0,0],["IQHI","IQHI",1,0,0],["IQI","Invesco Quality Municipal Income Trust",116,527,0],["IQLT","IQLT",1,0,0],["IQQQ","IQQQ",1,0,0],["IQRA","IQRA",1,0,0],["IQSI","IQSI",1,0,0],["IQSM","IQSM",1,0,0],["IQST","iQSTEL Inc.",33,13,0],["IQSU","IQSU",1,0,0],["IQSZ","IQSZ",1,0,0],["IQV","IQVIA Holdings Inc.",14,37584,0],["IR","Ingersoll Rand Inc.",7,31324,0],["IRBT","iRobot Corporation",133,15,0],["IRD","Opus Genetics Inc.",8,138,0],["IRDM","Iridium Communications Inc",33,1785,0],["IRE","IRE",1,0,0],["IREG","IREG",1,0,0],["IREN","IREN Limited",15,13107,0],["IRET","IRET",1,0,0],["IRHOU","Iron Horse Acquisitions II Corp.",2,0,0],["IRIX","IRIDEX Corporation",77,17,0],["IRM","Iron Mountain Incorporated (Delaware)Common Stock REIT",30,23674,0],["IRMD","iRadimed Corporation",31,1236,0],["IRON","Disc Medicine Inc.",8,3022,0],["IROQ","IF Bancorp Inc.",84,90,0],["IRS","IRSA Inversiones Y Representaciones S.A. Global",121,1186,0],["IRT","Independence Realty Trust Inc.",30,4015,0],["IRTC","iRhythm Technologies Inc.",31,5612,0],["IRTR","IRTR",1,0,0],["IRVH","IRVH",1,0,0],["IRWD","Ironwood Pharmaceuticals Inc. Class A",8,509,0],["ISBA","Isabella Bank Corporation",26,415,0],["ISCB","ISCB",1,0,0],["ISCF","ISCF",1,0,0],["ISCG","ISCG",1,0,0],["ISCV","ISCV",1,0,0],["ISD","PGIM High Yield Bond Fund Inc.",81,0,0],["ISEP","ISEP",1,0,0],["ISHG","ISHG",1,0,0],["ISHP","ISHP",1,0,0],["ISMD","ISMD",1,0,0],["ISOU","IsoEnergy Ltd.",1,461,0],["ISPC","iSpecimen Inc.",14,4,0],["ISPO","Inspirato Incorporated Class A",2,53,0],["ISPR","Ispire Technology Inc.",18,167,0],["ISRA","ISRA",1,0,0],["ISRG","Intuitive Surgical Inc.",32,202938,0],["ISSC","Innovative Solutions and Support Inc.",15,293,0],["ISTB","ISTB",1,0,0],["ISTR","Investar Holding Corporation",26,269,0],["ISUL","ISUL",1,0,0],["ISWN","ISWN",1,0,0],["IT","Gartner Inc.",3,18074,0],["ITAN","ITAN",1,0,0],["ITDB","ITDB",1,0,0],["ITDC","ITDC",1,0,0],["ITDD","ITDD",1,0,0],["ITDE","ITDE",1,0,0],["ITDF","ITDF",1,0,0],["ITDG","ITDG",1,0,0],["ITDH","ITDH",1,0,0],["ITDI","ITDI",1,0,0],["ITDJ","ITDJ",1,0,0],["ITEQ","ITEQ",1,0,0],["ITGR","Integer Holdings Corporation",77,2753,0],["ITHAU","ITHAX Acquisition Corp III",1,0,0],["ITIC","Investors Title Company",28,480,0],["ITOT","ITOT",1,0,0],["ITP","IT Tech Packaging Inc.",125,4,0],["ITRG","Integra Resources Corp.",104,747,0],["ITRI","Itron Inc.",39,4408,0],["ITRM","Iterum Therapeutics plc",8,20,0],["ITRN","Ituran Location and Control Ltd.",76,857,0],["ITT","ITT Inc.",148,15001,0],["ITUB","Itau Unibanco Banco Holding SA",26,69606,0],["ITW","Illinois Tool Works Inc.",7,72566,0],["IUS","IUS",1,0,0],["IUSB","IUSB",1,0,0],["IUSG","IUSG",1,0,0],["IUSV","IUSV",1,0,0],["IVA","Inventiva S.A. American Depository Shares",8,403,0],["IVAL","IVAL",1,0,0],["IVDA","Iveda Solutions Inc.",25,6,0],["IVE","IVE",1,0,0],["IVES","IVES",1,0,0],["IVF","INVO Fertility Inc.",31,9,0],["IVLU","IVLU",1,0,0],["IVOG","IVOG",1,0,0],["IVOL","IVOL",1,0,0],["IVOO","IVOO",1,0,0],["IVOV","IVOV",1,0,0],["IVP","Inspire Veterinary Partners Inc. Class A",48,4,0],["IVR","INVESCO MORTGAGE CAPITAL INC",30,626,0],["IVR/PC","IVR/PC",1,0,0],["IVRS","IVRS",1,0,0],["IVSI","IVSI",1,0,0],["IVSS","IVSS",1,0,0],["IVT","InvenTrust Properties Corp.",30,2215,0],["IVV","IVV",1,0,0],["IVVD","Invivyd Inc.",13,536,0],["IVW","IVW",1,0,0],["IVZ","Invesco Ltd",11,12018,0],["IWB","IWB",1,0,0],["IWC","IWC",1,0,0],["IWD","IWD",1,0,0],["IWDL","IWDL",1,0,0],["IWF","IWF",1,0,0],["IWFG","IWFG",1,0,0],["IWFL","IWFL",1,0,0],["IWL","IWL",1,0,0],["IWLG","IWLG",1,0,0],["IWM","IWM",1,0,0],["IWML","IWML",1,0,0],["IWMY","IWMY",1,0,0],["IWN","IWN",1,0,0],["IWO","IWO",1,0,0],["IWP","IWP",1,0,0],["IWR","IWR",1,0,0],["IWS","IWS",1,0,0],["IWV","IWV",1,0,0],["IWX","IWX",1,0,0],["IWY","IWY",1,0,0],["IX","ORIX Corporation",146,33540,0],["IXC","IXC",1,0,0],["IXG","IXG",1,0,0],["IXHL","Incannex Healthcare Inc.",8,152,0],["IXJ","IXJ",1,0,0],["IXN","IXN",1,0,0],["IXP","IXP",1,0,0],["IXUS","IXUS",1,0,0],["IYC","IYC",1,0,0],["IYE","IYE",1,0,0],["IYF","IYF",1,0,0],["IYG","IYG",1,0,0],["IYH","IYH",1,0,0],["IYK","IYK",1,0,0],["IYM","IYM",1,0,0],["IYR","IYR",1,0,0],["IYW","IYW",1,0,0],["IYY","IYY",1,0,0],["IZEA","IZEA Worldwide Inc.",58,79,0],["IZM","ICZOOM Group Inc. Class A",110,15,0],["J","Jacobs Solutions Inc.",21,15921,0],["JAAA","JAAA",1,0,0],["JABS","JABS",1,0,0],["JACK","Jack In The Box Inc.",68,367,0],["JACS","Jackson Acquisition Company II Class A",1,0,0],["JADE","JADE",1,0,0],["JAGX","Jaguar Health Inc.",8,4,0],["JAKK","JAKKS Pacific Inc.",61,193,0],["JAMF","Jamf Holding Corp.",25,1732,0],["JANT","JANT",1,0,0],["JANW","JANW",1,0,0],["JANX","Janux Therapeutics Inc.",8,829,0],["JAPN","JAPN",1,0,0],["JAVA","JAVA",1,0,0],["JAZZ","Jazz Pharmaceuticals plc",8,10147,0],["JBDI","JBDI Holdings Limited",1,18,0],["JBGS","JBG SMITH Properties",30,1019,0],["JBHT","J.B. Hunt Transport Services Inc.",63,18823,0],["JBI","Janus International Group Inc.",91,941,0],["JBIO","Jade Biosciences Inc.",8,783,0],["JBK","JBK",1,0,0],["JBL","Jabil Inc.",39,24211,0],["JBLU","JetBlue Airways Corporation",4,1746,0],["JBND","JBND",1,0,0],["JBS","JBS N.V. Class A",62,32163,0],["JBSS","John B. Sanfilippo & Son Inc.",93,862,0],["JBTM","JBT Marel Corporation",7,8024,0],["JCAP","Jefferson Capital Inc.",116,1316,0],["JCE","Nuveen Core Equity Alpha Fund",81,0,0],["JCHI","JCHI",1,0,0],["JCI","Johnson Controls International plc",7,73049,0],["JCSE","JE Cleantech Holdings Limited",69,6,0],["JCTC","Jewett-Cameron Trading Company",130,7,0],["JD","JD.com Inc.",66,41884,0],["JDIV","JDIV",1,0,0],["JDOC","JDOC",1,0,0],["JDST","JDST",1,0,0],["JDVI","JDVI",1,0,0],["JDVL","JDVL",1,0,0],["JDZG","JIADE LIMITED Class A",3,3,0],["JEDI","JEDI",1,0,0],["JEF","Jefferies Financial Group Inc.",60,12779,0],["JELD","JELD-WEN Holding Inc.",56,236,0],["JEM","707 Cayman Holdings Limited",120,4,0],["JEMB","JEMB",1,0,0],["JENA","Jena Acquisition Corporation II Class A",1,0,0],["JENA.U","JENA.U",1,0,0],["JEPI","JEPI",1,0,0],["JEPQ","JEPQ",1,0,0],["JETD","JETD",1,0,0],["JETS","JETS",1,0,0],["JETU","JETU",1,0,0],["JFB","JFB Construction Holdings Class A",136,435,0],["JFBR","Jeffs\' Brands Ltd",66,21,0],["JFIN","Jiayin Group Inc.",44,353,0],["JFLI","JFLI",1,0,0],["JFLX","JFLX",1,0,0],["JFR","Nuveen Floating Rate Income Fund",81,0,0],["JFU","9F Inc.",44,76,0],["JG","Aurora Mobile Limited",16,41,0],["JGH","Nuveen Global High Income Fund",11,0,0],["JGLO","JGLO",1,0,0],["JGRO","JGRO",1,0,0],["JGRW","JGRW",1,0,0],["JHAC","JHAC",1,0,0],["JHAI","JHAI",1,0,0],["JHCB","JHCB",1,0,0],["JHCP","JHCP",1,0,0],["JHCR","JHCR",1,0,0],["JHDV","JHDV",1,0,0],["JHEM","JHEM",1,0,0],["JHG","Janus Henderson Group plc",11,7109,0],["JHHY","JHHY",1,0,0],["JHI","John Hancock Investors Trust",81,118,0],["JHID","JHID",1,0,0],["JHLN","JHLN",1,0,0],["JHMB","JHMB",1,0,0],["JHMD","JHMD",1,0,0],["JHML","JHML",1,0,0],["JHMM","JHMM",1,0,0],["JHMU","JHMU",1,0,0],["JHPI","JHPI",1,0,0],["JHS","John Hancock Income Securities Trust",116,133,0],["JHSC","JHSC",1,0,0],["JHX","James Hardie Industries plc.",38,8816,0],["JIG","JIG",1,0,0],["JIII","JIII",1,0,0],["JILL","J. Jill Inc.",86,221,0],["JIRE","JIRE",1,0,0],["JIVE","JIVE",1,0,0],["JJSF","J & J Snack Foods Corp.",93,1788,0],["JKHY","Jack Henry & Associates Inc.",15,13354,0],["JKS","JinkoSolar Holding Company Limited",6,1453,0],["JL","J-Long Group Limited Class A",120,23,0],["JLHL","Julong Holding Limited Class A",21,77,0],["JLL","Jones Lang LaSalle Incorporated",36,15888,0],["JLQD","JLQD",1,0,0],["JLS","Nuveen Mortgage and Income Fund",11,0,0],["JMBS","JMBS",1,0,0],["JMEE","JMEE",1,0,0],["JMG","JM Group Limited",32,120,0],["JMHI","JMHI",1,0,0],["JMIA","Jumia Technologies AG",57,1581,0],["JMID","JMID",1,0,0],["JMM","Nuveen Multi-Market Income Fund (MA)",81,0,0],["JMMF","JMMF",1,0,0],["JMOM","JMOM",1,0,0],["JMSB","John Marshall Bancorp Inc.",26,303,0],["JMSI","JMSI",1,0,0],["JMTG","JMTG",1,0,0],["JNJ","Johnson & Johnson",8,497206,0],["JNK","JNK",1,0,0],["JNUG","JNUG",1,0,0],["JOB","GEE Group Inc.",12,21,0],["JOBY","Joby Aviation Inc.",50,12966,0],["JOE","St. Joe Company (The)",121,3540,0],["JOET","JOET",1,0,0],["JOF","Japan Smaller Capitalization Fund Inc",81,0,0],["JOJO","JOJO",1,0,0],["JOUT","Johnson Outdoors Inc. Class A",61,458,0],["JOYY","JOYY Inc.",15,3371,0],["JPAN","JPAN",1,0,0],["JPC","Nuveen Preferred & Income Opportunities Fund",11,0,0],["JPEF","JPEF",1,0,0],["JPEM","JPEM",1,0,0],["JPIE","JPIE",1,0,0],["JPIN","JPIN",1,0,0],["JPM","JP Morgan Chase & Co.",26,863529,0],["JPM/PC","JPM/PC",1,0,0],["JPM/PD","JPM/PD",1,0,0],["JPM/PJ","JPM/PJ",1,0,0],["JPM/PK","JPM/PK",1,0,0],["JPM/PL","JPM/PL",1,0,0],["JPM/PM","JPM/PM",1,0,0],["JPMB","JPMB",1,0,0],["JPME","JPME",1,0,0],["JPMO","JPMO",1,0,0],["JPRE","JPRE",1,0,0],["JPSE","JPSE",1,0,0],["JPST","JPST",1,0,0],["JPSV","JPSV",1,0,0],["JPUS","JPUS",1,0,0],["JPX","JPX",1,0,0],["JPXN","JPXN",1,0,0],["JPY","JPY",1,0,0],["JQC","Nuveen Credit Strategies Income Fund Shares of Beneficial Interest",116,0,0],["JQUA","JQUA",1,0,0],["JRE","JRE",1,0,0],["JRI","Nuveen Real Asset Income and Growth Fund",116,0,0],["JRS","Nuveen Real Estate Income Fund",123,0,0],["JRSH","Jerash Holdings (US) Inc.",86,37,0],["JRVR","James River Group Holdings Inc.",22,288,0],["JSCP","JSCP",1,0,0],["JSI","JSI",1,0,0],["JSM","Navient Corporation 6% Senior Notes due December 15 2043",60,1952,0],["JSMD","JSMD",1,0,0],["JSML","JSML",1,0,0],["JSPR","Jasper Therapeutics Inc.",13,52,0],["JSTC","JSTC",1,0,0],["JTAI","Jet.AI Inc.",87,7,0],["JTEK","JTEK",1,0,0],["JULT","JULT",1,0,0],["JULW","JULW",1,0,0],["JUNS","Jupiter Neurosciences Inc.",8,38,0],["JUNT","JUNT",1,0,0],["JUNW","JUNW",1,0,0],["JUSA","JUSA",1,0,0],["JUST","JUST",1,0,0],["JVA","Coffee Holding Co. Inc.",17,21,0],["JVAL","JVAL",1,0,0],["JWEL","Jowell Global Ltd.",3,5,0],["JXG","JX Luxventure Group Inc.",86,11,0],["JXI","JXI",1,0,0],["JXN","Jackson Financial Inc. Class A",5,7320,0],["JXN/PA","JXN/PA",1,0,0],["JYD","Jayud Global Logistics Limited Class A",105,10,0],["JYNT","The Joint Corp.",29,134,0],["JZ","Jianzhi Education Technology Group Company Limited American Depositary Shs",3,4,0],["JZXN","Jiuzi Holdings Inc.",97,5,0],["KAI","Kadant Inc",7,3403,0],["KALA","KALA BIO Inc.",8,12,0],["KALU","Kaiser Aluminum Corporation",55,1849,0],["KALV","KalVista Pharmaceuticals Inc.",8,770,0],["KAPA","Kairos Pharma Ltd.",8,18,0],["KAR","OPENLANE Inc.",97,3246,0],["KARO","Karooooo Ltd.",25,1449,0],["KARS","KARS",1,0,0],["KAT","KAT",1,0,0],["KAVL","Kaival Brands Innovations Group Inc.",3,2,0],["KB","KB Financial Group Inc",75,31958,0],["KBA","KBA",1,0,0],["KBAB","KBAB",1,0,0],["KBDC","Kayne Anderson BDC Inc.",1,1040,0],["KBDU","KBDU",1,0,0],["KBE","KBE",1,0,0],["KBH","KB Home",121,3717,0],["KBONU","Karbon Capital Partners Corp.",2,0,0],["KBR","KBR Inc.",21,5118,0],["KBSX","FST Corp.",61,53,0],["KBUF","KBUF",1,0,0],["KBWB","KBWB",1,0,0],["KBWD","KBWD",1,0,0],["KBWP","KBWP",1,0,0],["KBWR","KBWR",1,0,0],["KBWY","KBWY",1,0,0],["KC","Kingsoft Cloud Holdings Limited",25,3078,0],["KCAI","KCAI",1,0,0],["KCCA","KCCA",1,0,0],["KCE","KCE",1,0,0],["KCHV","Kochav Defense Acquisition Corp. Class A",1,0,0],["KCHVU","Kochav Defense Acquisition Corp.",1,0,0],["KCSH","KCSH",1,0,0],["KD","Kyndryl Holdings Inc.",15,6190,0],["KDEF","KDEF",1,0,0],["KDK","Kodiak AI Inc.",15,1870,0],["KDP","Keurig Dr Pepper Inc.",46,37891,0],["KDRN","KDRN",1,0,0],["KDVD","KDVD",1,0,0],["KE","Kimball Electronics Inc.",39,694,0],["KEAT","KEAT",1,0,0],["KELYA","Kelly Services Inc. Class A",19,311,0],["KELYB","Kelly Services Inc. Class B",19,316,0],["KEMQ","KEMQ",1,0,0],["KEMX","KEMX",1,0,0],["KEN","Kenon Holdings Ltd.",41,3351,0],["KEP","Korea Electric Power Corporation",41,21711,0],["KEQU","Kewaunee Scientific Corporation",23,110,0],["KEUA","KEUA",1,0,0],["KEX","Kirby Corporation",98,6013,0],["KEY","KeyCorp",26,22929,0],["KEY/PI","KEY/PI",1,0,0],["KEY/PJ","KEY/PJ",1,0,0],["KEY/PK","KEY/PK",1,0,0],["KEY/PL","KEY/PL",1,0,0],["KEYS","Keysight Technologies Inc.",7,34788,0],["KF","Korea Fund Inc. (The) New",11,0,0],["KFFB","Kentucky First Federal Bancorp",84,35,0],["KFII","K&F Growth Acquisition Corp. II Class A",1,0,0],["KFIIU","KFIIU",1,0,0],["KFRC","Kforce Inc.",19,556,0],["KFS","Kingsway Financial Services Inc.",22,371,0],["KFY","Korn Ferry",12,3563,0],["KG","Kestrel Group Ltd.",22,83,0],["KGC","Kinross Gold Corporation",104,34511,0],["KGEI","Kolibri Global Energy Inc.",59,134,0],["KGRN","KGRN",1,0,0],["KGS","Kodiak Gas Services Inc.",107,3147,0],["KHC","The Kraft Heinz Company",17,29011,0],["KHYB","KHYB",1,0,0],["KIDS","OrthoPediatrics Corp.",31,428,0],["KIDZ","Classover Holdings Inc. Class B",3,8,0],["KIE","KIE",1,0,0],["KIM","Kimco Realty Corporation (HC)",30,13537,0],["KIM/PL","KIM/PL",1,0,0],["KIM/PM","KIM/PM",1,0,0],["KIM/PN","KIM/PN",1,0,0],["KINS","Kingstone Companies Inc.",22,240,0],["KIO","KKR Income Opportunities Fund",11,0,0],["KITT","Nauticus Robotics Inc.",7,12,0],["KJD","KJD",1,0,0],["KKR","KKR & Co. Inc.",11,116420,0],["KKR/PD","KKR/PD",1,0,0],["KKRS","KKR Group Finance Co. IX LLC 4.625% Subordinated Notes due 2061",11,15554,0],["KKRT","KKR & Co. Inc. 6.875% Subordinated Notes due 2065",11,0,0],["KLAC","KLA Corporation",76,163671,0],["KLAG","KLAG",1,0,0],["KLAR","Klarna Group plc",44,22129,0],["KLC","KinderCare Learning Companies Inc.",3,536,0],["KLIC","Kulicke and Soffa Industries Inc.",6,2391,0],["KLIP","KLIP",1,0,0],["KLMN","KLMN",1,0,0],["KLMT","KLMT",1,0,0],["KLRS","Kalaris Therapeutics Inc.",13,171,0],["KLTO","Klotho Neurosciences Inc.",13,28,0],["KLTR","Kaltura Inc.",25,263,0],["KLXE","KLX Energy Services Holdings Inc.",20,28,0],["KLXY","KLXY",1,0,0],["KMB","Kimberly-Clark Corporation",125,33405,0],["KMDA","Kamada Ltd.",8,419,0],["KMI","Kinder Morgan Inc.",107,58934,0],["KMID","KMID",1,0,0],["KMLI","KMLI",1,0,0],["KMLM","KMLM",1,0,0],["KMPB","Kemper Corporation 5.875% Fixed-Rate Reset Junior Subordinated Debentures due 2062",22,1365,0],["KMPR","Kemper Corporation",22,2388,0],["KMRK","K-Tech Solutions Company Limited Class A",61,20,0],["KMT","Kennametal Inc.",7,2187,0],["KMTS","Kestra Medical Technologies Ltd.",31,1594,0],["KMX","CarMax Inc",97,5649,0],["KN","Knowles Corporation",133,1883,0],["KNCT","KNCT",1,0,0],["KNDI","Kandi Technologies Group Inc.",37,77,0],["KNF","Knife Riv Holding Co.",74,4163,0],["KNGZ","KNGZ",1,0,0],["KNO","KNO",1,0,0],["KNOP","KNOT Offshore Partners LP Common",98,359,0],["KNRG","KNRG",1,0,0],["KNRX","KNOREX LTD. Class A",16,44,0],["KNSA","Kiniksa Pharmaceuticals International plc Class A",8,3274,0],["KNSL","Kinsale Capital Group Inc.",22,9289,0],["KNTK","Kinetik Holdings Inc. Class A",107,5432,0],["KNX","Knight-Swift Transportation Holdings Inc.",63,8500,0],["KO","Coca-Cola Company (The)",46,301371,0],["KOD","Kodiak Sciences Inc",13,1559,0],["KODK","Eastman Kodak Company Common New",7,803,0],["KOF","Coca Cola Femsa S.A.B. de C.V. ",46,19950,0],["KOID","KOID",1,0,0],["KOKU","KOKU",1,0,0],["KOLD","KOLD",1,0,0],["KOMP","KOMP",1,0,0],["KOOL","KOOL",1,0,0],["KOP","Koppers Holdings Inc.",56,539,0],["KOPN","Kopin Corporation",6,443,0],["KORE","KORE Group Holdings Inc.",33,78,0],["KORP","KORP",1,0,0],["KORU","KORU",1,0,0],["KOS","Kosmos Energy Ltd.",59,475,0],["KOSS","Koss Corporation",133,40,0],["KOYN","CSLM Digital Asset Acquisition Corp III Class A",1,0,0],["KOYNU","CSLM Digital Asset Acquisition Corp III",1,0,0],["KPDD","KPDD",1,0,0],["KPHO","KPHO",1,0,0],["KPLT","Katapult Holdings Inc.",12,30,0],["KPRO","KPRO",1,0,0],["KPRX","Kiora Pharmaceuticals Inc. ",8,8,0],["KPTI","Karyopharm Therapeutics Inc.",8,118,0],["KQQQ","KQQQ",1,0,0],["KR","Kroger Company (The)",67,39496,0],["KRBN","KRBN",1,0,0],["KRC","Kilroy Realty Corporation",30,4560,0],["KRE","KRE",1,0,0],["KREF","KKR Real Estate Finance Trust Inc.",30,554,0],["KREF/PA","KREF/PA",1,0,0],["KRG","Kite Realty Group Trust",30,5142,0],["KRKR","36Kr Holdings Inc.",36,158,0],["KRMA","KRMA",1,0,0],["KRMD","KORU Medical Systems Inc.",31,269,0],["KRMN","Karman Holdings Inc.",21,9481,0],["KRNT","Kornit Digital Ltd.",7,652,0],["KRNY","Kearny Financial Corp",84,509,0],["KRO","Kronos Worldwide Inc",34,532,0],["KROP","KROP",1,0,0],["KROS","Keros Therapeutics Inc.",8,617,0],["KRP","Kimbell Royalty Partners Common",59,1226,0],["KRRO","Korro Bio Inc.",8,74,0],["KRSP","Rice Acquisition Corporation 3 Class A",1,0,0],["KRSP.U","KRSP.U",1,0,0],["KRT","Karat Packaging Inc.",64,459,0],["KRUS","Kura Sushi USA Inc. Class A",68,671,0],["KRYS","Krystal Biotech Inc.",13,6983,0],["KSA","KSA",1,0,0],["KSCP","Knightscope Inc. Class A",33,43,0],["KSPI","Joint Stock Company Kaspi.kz American Depository Shares",1,14683,0],["KSPY","KSPY",1,0,0],["KSS","Kohl\'s Corporation",113,2603,0],["KSTR","KSTR",1,0,0],["KT","KT Corporation",33,9155,0],["KTB","Kontoor Brands Inc.",118,3564,0],["KTCC","Key Tronic Corporation",39,28,0],["KTEC","KTEC",1,0,0],["KTF","DWS Municipal Income Trust",116,357,0],["KTH","Structures Products Cp 8% CorTS Issued by Peco Energy Cap Tr II",44,0,0],["KTN","Structured Products Corp 8.205% CorTS 8.205% Corporate Backed Trust Securities (CorTS)",44,0,0],["KTOS","Kratos Defense & Security Solutions Inc.",21,12729,0],["KTTA","Pasithea Therapeutics Corp.",8,26,0],["KULR","KULR Technology Group Inc.",39,145,0],["KURA","Kura Oncology Inc.",8,856,0],["KURE","KURE",1,0,0],["KVAC","Keen Vision Acquisition Corporation",1,0,0],["KVHI","KVH Industries Inc.",49,138,0],["KVLE","KVLE",1,0,0],["KVUE","Kenvue Inc.",135,32607,0],["KVYO","Klaviyo Inc. Series A",25,9647,0],["KW","Kennedy-Wilson Holdings Inc.",36,1339,0],["KWEB","KWEB",1,0,0],["KWIN","KWIN",1,0,0],["KWM","K Wave Media Ltd.",89,33,0],["KWR","Quaker Houghton",34,2513,0],["KXI","KXI",1,0,0],["KXIN","Kaixin Holdings",97,3,0],["KYIV","Kyivstar Group Ltd.",33,3244,0],["KYMR","Kymera Therapeutics Inc.",13,6613,0],["KYN","Kayne Anderson Energy Infrastructure Fund Inc.",123,1609,0],["KYTX","Kyverna Therapeutics Inc.",13,315,0],["KZIA","Kazia Therapeutics Limited",8,18,0],["KZR","Kezar Life Sciences Inc.",8,46,0],["L","Loews Corporation",22,22026,0],["LAB","Standard BioTools Inc.",71,627,0],["LABD","LABD",1,0,0],["LABU","LABU",1,0,0],["LAC","Lithium Americas Corp.",10,1442,0],["LACG","LACG",1,0,0],["LAD","Lithia Motors Inc.",97,8339,0],["LADR","Ladder Capital Corp Class A",30,1449,0],["LAES","SEALSQ Corp",6,439,0],["LAFA","LaFayette Acquisition Corp.",1,0,0],["LAFAU","LaFayette Acquisition Corp. Unit",1,0,0],["LAKE","Lakeland Industries Inc.",32,78,0],["LALT","LALT",1,0,0],["LAMR","Lamar Advertising Company Class A",30,12894,0],["LAND","Gladstone Land Corporation",30,328,0],["LANDM","Gladstone Land Corporation 5.00% Series D Cumulative Term",30,930,0],["LANDO","Gladstone Land Corporation 6.00% Series B Cumulative Redeemable",30,706,0],["LANDP","Gladstone Land Corporation 6.00% Series C Cumulative Redeemable",30,701,0],["LANV","Lanvin Group Holdings Limited",86,252,0],["LAR","Lithium Argentina AG",10,880,0],["LARK","Landmark Bancorp Inc.",26,174,0],["LASE","Laser Photonics Corporation",7,37,0],["LASR","nLIGHT Inc.",6,1915,0],["LATA","Galata Acquisition Corp. II Class A",2,0,0],["LAUR","Laureate Education Inc.",3,4985,0],["LAW","CS Disco Inc.",25,524,0],["LAYS","LAYS",1,0,0],["LAZ","Lazard Inc.",11,5601,0],["LAZR","Luminar Technologies Inc. Class A",42,47,0],["LB","LandBridge Company LLC Class A Shares Representing Limited Liability Company Interests",59,4046,0],["LBAY","LBAY",1,0,0],["LBGJ","Li Bang International Corporation Inc. Class A",7,12,0],["LBRDA","Liberty Broadband Corporation Class A",54,6862,0],["LBRDK","Liberty Broadband Corporation Class C",54,6854,0],["LBRDP","Liberty Broadband Corporation Series A Cumulative Redeemable",54,3534,0],["LBRT","Liberty Energy Inc. Class A",20,2831,0],["LBRX","LB Pharmaceuticals Inc",8,533,0],["LBTYA","Liberty Global Ltd. Class A",54,3765,0],["LBTYB","Liberty Global Ltd. Class B",54,3705,0],["LBTYK","Liberty Global Ltd. Class C",54,3748,0],["LC","LendingClub Corporation",44,2266,0],["LCCC","Lakeshore Acquisition III Corp.",2,0,0],["LCCCU","Lakeshore Acquisition III Corp. Unit",2,0,0],["LCDL","LCDL",1,0,0],["LCDS","LCDS",1,0,0],["LCFY","Locafy Limited",16,6,0],["LCID","Lucid Group Inc.",37,3832,0],["LCII","LCI Industries",42,2992,0],["LCLG","LCLG",1,0,0],["LCNB","LCNB Corporation",26,239,0],["LCR","LCR",1,0,0],["LCTD","LCTD",1,0,0],["LCTU","LCTU",1,0,0],["LCTX","Lineage Cell Therapeutics Inc.",13,387,0],["LCUT","Lifetime Brands Inc.",7,84,0],["LDEM","LDEM",1,0,0],["LDI","loanDepot Inc. Class A",44,750,0],["LDOS","Leidos Holdings Inc.",15,23612,0],["LDP","Cohen & Steers Limited Duration Preferred and Income Fund Inc.",116,0,0],["LDRC","LDRC",1,0,0],["LDRH","LDRH",1,0,0],["LDRI","LDRI",1,0,0],["LDRT","LDRT",1,0,0],["LDRX","LDRX",1,0,0],["LDSF","LDSF",1,0,0],["LDUR","LDUR",1,0,0],["LDWY","Lendway Inc.",48,6,0],["LE","Lands\' End Inc.",120,457,0],["LEA","Lear Corporation",42,6163,0],["LECO","Lincoln Electric Holdings Inc.",7,13396,0],["LEDS","SemiLEDS Corporation",6,15,0],["LEE","Lee Enterprises Incorporated",124,23,0],["LEG","Leggett & Platt Incorporated",73,1509,0],["LEGH","Legacy Housing Corporation",121,474,0],["LEGN","Legend Biotech Corporation",8,4026,0],["LEGR","LEGR",1,0,0],["LEGT","Legato Merger Corp. III",1,0,0],["LEGT.U","LEGT.U",1,0,0],["LEMB","LEMB",1,0,0],["LEN","Lennar Corporation Class A",121,27540,0],["LEN.B","LEN.B",1,0,0],["LENZ","LENZ Therapeutics Inc.",13,563,0],["LEO","BNY Mellon Strategic Municipals Inc.",81,393,0],["LESL","Leslie\'s Inc.",66,17,0],["LEU","Centrus Energy Corp. Class A",74,4767,0],["LEVI","Levi Strauss & Co Class A",86,8485,0],["LEXI","LEXI",1,0,0],["LEXX","Lexaria Bioscience Corp.",8,13,0],["LFACU","Leapfrog Acquisition Corporation",1,0,0],["LFCR","Lifecore Biomedical Inc.",8,301,0],["LFEQ","LFEQ",1,0,0],["LFGY","LFGY",1,0,0],["LFMD","LifeMD Inc.",35,155,0],["LFMDP","LifeMD Inc. 8.875% Series A Cumulative Perpetual",35,1009,0],["LFS","LEIFRAS Co. Ltd.",3,99,0],["LFSC","LFSC",1,0,0],["LFST","LifeStance Health Group Inc.",35,2742,0],["LFT","Lument Finance Trust Inc.",30,77,0],["LFT/PA","LFT/PA",1,0,0],["LFUS","Littelfuse Inc.",39,6350,0],["LFVN","Lifevantage Corporation",8,79,0],["LFWD","Lifeward Ltd.",32,12,0],["LGCB","Linkage Global Inc. Class A",57,22,0],["LGCF","LGCF",1,0,0],["LGCL","Lucas GC Limited",16,6,0],["LGCY","Legacy Education Inc.",3,132,0],["LGDX","LGDX",1,0,0],["LGH","LGH",1,0,0],["LGHL","Lion Group Holding Ltd. American",60,3,0],["LGHT","LGHT",1,0,0],["LGI","Lazard Global Total Return and Income Fund",1,0,0],["LGIH","LGI Homes Inc.",121,1026,0],["LGL","LGL Group Inc. (The)",7,31,0],["LGLV","LGLV",1,0,0],["LGN","Legence Corp. Class A",82,4651,0],["LGND","Ligand Pharmaceuticals Incorporated",8,3943,0],["LGO","Largo Inc.",74,78,0],["LGOV","LGOV",1,0,0],["LGPS","LogProstyle Inc.",121,24,0],["LGRO","LGRO",1,0,0],["LGVN","Longeveron Inc. Class A",8,12,0],["LH","Labcorp Holdings Inc.",23,20893,0],["LHAI","Linkhome Holdings Inc.",36,208,0],["LHSW","Lianhe Sowell International Group Ltd Class A",25,32,0],["LHX","L3Harris Technologies Inc.",7,53768,0],["LI","Li Auto Inc.",37,17990,0],["LICN","Lichen International Limited Class A",19,52,0],["LIDR","AEye Inc. Class A",42,105,0],["LIEN","Chicago Atlantic BDC Inc.",44,242,0],["LIF","Life360 Inc.",15,5062,0],["LII","Lennox International Inc.",7,17428,0],["LILA","Liberty Latin America Ltd. Class A",54,1598,0],["LILAK","Liberty Latin America Ltd. Class C",54,1608,0],["LIMN","Liminatus Pharma Inc. Class A",1,21,0],["LIN","Linde plc",34,196786,0],["LINC","Lincoln Educational Services Corporation",3,754,0],["LIND","Lindblad Expeditions Holdings Inc.",87,815,0],["LINE","Lineage Inc.",30,7792,0],["LINK","Interlink Electronics Inc.",53,57,0],["LINT","LINT",1,0,0],["LION","Lionsgate Studios Corp",89,2408,0],["LIQT","LiqTech International Inc.",7,18,0],["LIT","LIT",1,0,0],["LITB","LightInTheBox Holding Co. Ltd.",57,225,0],["LITE","Lumentum Holdings Inc.",33,26334,0],["LITL","LITL",1,0,0],["LITM","Snow Lake Resources Ltd.",52,32,0],["LITP","LITP",1,0,0],["LITS","Lite Strategy Inc.",8,53,0],["LIVE","Live Ventures Incorporated",66,48,0],["LIVN","LivaNova PLC",77,3430,0],["LIXT","Lixte Biotechnology Holdings Inc.",8,25,0],["LKFN","Lakeland Financial Corporation",26,1514,0],["LKQ","LKQ Corporation",119,7612,0],["LKSP","Lake Superior Acquisition Corp. Class A",1,0,0],["LKSPR","Lake Superior Acquisition Corp.",1,0,0],["LKSPU","Lake Superior Acquisition Corp.",1,0,0],["LLDR","LLDR",1,0,0],["LLY","Eli Lilly and Company",8,1012922,0],["LLYVA","Liberty Live Holdings Inc. Series A Liberty Live Group",45,7550,0],["LLYVK","Liberty Live Holdings Inc. Series C Liberty Live Group",45,7756,0],["LLYX","LLYX",1,0,0],["LLYZ","LLYZ",1,0,0],["LMAT","LeMaitre Vascular Inc.",31,1927,0],["LMB","Limbach Holdings Inc.",82,912,0],["LMBO","LMBO",1,0,0],["LMBS","LMBS",1,0,0],["LMFA","LM Funding America Inc.",44,7,0],["LMND","Lemonade Inc.",22,6174,0],["LMNR","Limoneira Co",48,265,0],["LMNX","LMNX",1,0,0],["LMRI","Lumexa Imaging Holdings Inc.",23,1678,0],["LMT","Lockheed Martin Corporation",21,109713,0],["LMTL","LMTL",1,0,0],["LMTS","LMTS",1,0,0],["LMUB","LMUB",1,0,0],["LNAI","Lunai Bioworks Inc.",8,34,0],["LNC","Lincoln National Corporation",5,8777,0],["LNC/PD","LNC/PD",1,0,0],["LND","Brasilagro Brazilian Agric Real Estate Co Sponsored ADR (Brazil)",48,368,0],["LNG","Cheniere Energy Inc.",140,40843,0],["LNGX","LNGX",1,0,0],["LNKB","LINKBANCORP Inc.",26,325,0],["LNKS","Linkers Industries Limited Class A",39,4,0],["LNN","Lindsay Corporation",7,1303,0],["LNSR","LENSAR Inc.",31,143,0],["LNT","Alliant Energy Corporation",129,16613,0],["LNTH","Lantheus Holdings Inc.",24,4371,0],["LNZA","LanzaTech Global Inc.",34,31,0],["LOAN","Manhattan Bridge Capital Inc",30,57,0],["LOAR","Loar Holdings Inc.",21,6321,0],["LOB","Live Oak Bancshares Inc.",26,1672,0],["LOB/PA","LOB/PA",1,0,0],["LOBO","LOBO TECHNOLOGIES LTD. Class A",119,10,0],["LOCL","Local Bounti Corporation",48,66,0],["LOCO","El Pollo Loco Holdings Inc.",68,325,0],["LODE","Comstock Inc.",34,189,0],["LODI","LODI",1,0,0],["LOGI","Logitech International S.A.",53,15314,0],["LOGO","LOGO",1,0,0],["LOKV","Live Oak Acquisition Corp. V Class A",1,0,0],["LOKVU","LOKVU",1,0,0],["LOMA","Loma Negra Compania Industrial Argentina Sociedad Anonima ADS",38,1473,0],["LONZ","LONZ",1,0,0],["LOOP","Loop Industries Inc.",34,46,0],["LOPE","Grand Canyon Education Inc.",3,4641,0],["LOPP","LOPP",1,0,0],["LOT","Lotus Technology Inc.",37,909,0],["LOTI","LOTI",1,0,0],["LOUP","LOUP",1,0,0],["LOVE","The Lovesac Company",66,212,0],["LOW","Lowe\'s Companies Inc.",130,134875,0],["LOWV","LOWV",1,0,0],["LPA","Logistic Properties of the Americas",36,108,0],["LPAA","Launch One Acquisition Corp. Class A",1,0,0],["LPAAU","LPAAU",1,0,0],["LPBB","Launch Two Acquisition Corp. Class A",1,0,0],["LPBBU","Launch Two Acquisition Corp. Unit",2,0,0],["LPCN","Lipocine Inc.",8,24,0],["LPCVU","Launchpad Cadenza Acquisition Corp I Unit",2,0,0],["LPG","Dorian LPG Ltd.",98,1051,0],["LPL","LG Display Co Ltd AMERICAN DEPOSITORY SHARES",7,4150,0],["LPLA","LPL Financial Holdings Inc.",60,29010,0],["LPRE","LPRE",1,0,0],["LPRO","Open Lending Corporation",44,190,0],["LPSN","LivePerson Inc.",25,50,0],["LPTH","LightPath Technologies Inc. Class A",6,407,0],["LPX","Louisiana-Pacific Corporation",56,5628,0],["LQAI","LQAI",1,0,0],["LQD","LQD",1,0,0],["LQDA","Liquidia Corporation",8,3004,0],["LQDB","LQDB",1,0,0],["LQDH","LQDH",1,0,0],["LQDT","Liquidity Services Inc.",36,966,0],["LQIG","LQIG",1,0,0],["LQPE","LQPE",1,0,0],["LQTI","LQTI",1,0,0],["LRCX","Lam Research Corporation",7,216376,0],["LRE","Lead Real Estate Co. Ltd",121,19,0],["LRGC","LRGC",1,0,0],["LRGE","LRGE",1,0,0],["LRGF","LRGF",1,0,0],["LRGG","LRGG",1,0,0],["LRHC","La Rosa Holdings Corp.",36,1,0],["LRMR","Larimar Therapeutics Inc.",8,312,0],["LRN","Stride Inc.",3,2898,0],["LRND","LRND",1,0,0],["LRNZ","LRNZ",1,0,0],["LSAF","LSAF",1,0,0],["LSAK","Lesaka Technologies Inc.",60,373,0],["LSAT","LSAT",1,0,0],["LSBK","Lake Shore Bancorp Inc.",84,116,0],["LSCC","Lattice Semiconductor Corporation",6,10301,0],["LSE","Leishen Energy Holding Co. Ltd.",88,72,0],["LSEQ","LSEQ",1,0,0],["LSF","Laird Superfood Inc.",17,24,0],["LSGR","LSGR",1,0,0],["LSH","Lakeside Holding Limited",1,16,0],["LSPD","Lightspeed Commerce Inc. Subordinate Voting Shares",25,1634,0],["LST","LST",1,0,0],["LSTA","Lisata Therapeutics Inc.",137,18,0],["LSTR","Landstar System Inc.",63,4972,0],["LSVD","LSVD",1,0,0],["LTBR","Lightbridge Corporation",19,457,0],["LTC","LTC Properties Inc.",30,1628,0],["LTCC","Canary Litecoin ETF Shares of Beneficial Interest",60,7,0],["LTH","Life Time Group Holdings Inc.",47,5830,0],["LTL","LTL",1,0,0],["LTM","LATAM Airlines Group S.A.",4,16592,0],["LTPZ","LTPZ",1,0,0],["LTRN","Lantern Pharma Inc.",8,36,0],["LTRX","Lantronix Inc.",51,219,0],["LTTI","LTTI",1,0,0],["LU","Lufax Holding Ltd",44,2314,0],["LUCD","Lucid Diagnostics Inc.",31,154,0],["LUCK","Lucky Strike Entertainment Corporation Class A",45,1257,0],["LUCY","Innovative Eyewear Inc.",111,7,0],["LUD","Luda Technology Group Limited",27,165,0],["LULG","LULG",1,0,0],["LULU","lululemon athletica inc.",86,23498,0],["LUMN","Lumen Technologies Inc.",33,8400,0],["LUNG","Pulmonx Corporation",31,107,0],["LUNR","Intuitive Machines Inc. Class A",7,2692,0],["LUV","Southwest Airlines Company",4,21338,0],["LUXE","LuxExperience B.V.",57,1229,0],["LVHD","LVHD",1,0,0],["LVLN","LVLN",1,0,0],["LVLU","Lulu\'s Fashion Lounge Holdings Inc.",57,15,0],["LVO","LiveOne Inc.",68,55,0],["LVRO","Lavoro Limited Class A",66,71,0],["LVS","Las Vegas Sands Corp.",47,45267,0],["LVWR","LiveWire Group Inc.",119,977,0],["LW","Lamb Weston Holdings Inc.",17,6123,0],["LWAC","LightWave Acquisition Corp. Class A",1,0,0],["LWAY","Lifeway Foods Inc.",17,360,0],["LWLG","Lightwave Logic Inc.",125,400,0],["LX","LexinFintech Holdings Ltd.",44,555,0],["LXEH","Lixiang Education Holding Co. Ltd.",3,5,0],["LXEO","Lexeo Therapeutics Inc.",13,755,0],["LXFR","Luxfer Holdings PLC",34,368,0],["LXP","LXP Industrial Trust",30,2998,0],["LXP/PC","LXP/PC",1,0,0],["LXRX","Lexicon Pharmaceuticals Inc.",8,425,0],["LXU","LSB Industries Inc.",34,624,0],["LYB","LyondellBasell Industries NV",34,13870,0],["LYEL","Lyell Immunopharma Inc.",8,707,0],["LYFT","Lyft Inc. Class A",36,7755,0],["LYG","Lloyds Banking Group Plc",75,77514,0],["LYRA","Lyra Therapeutics Inc.",31,6,0],["LYTS","LSI Industries Inc.",91,575,0],["LYV","Live Nation Entertainment Inc.",45,33122,0],["LZ","LegalZoom.com Inc.",15,1810,0],["LZB","La-Z-Boy Incorporated",73,1625,0],["LZM","Lifezone Metals Limited",10,320,0],["LZMH","LZ Technology Holdings Limited Class B",15,225,0],["M","Macy\'s Inc",113,6336,0],["MA","Mastercard Incorporated",36,513860,0],["MAA","Mid-America Apartment Communities Inc.",30,15716,0],["MAA/PI","MAA/PI",1,0,0],["MAAS","Maase Inc. Class A",11,1589,0],["MAAY","MAAY",1,0,0],["MAC","Macerich Company (The)",30,4771,0],["MACI","Melar Acquisition Corp. I Class A",1,0,0],["MADE","MADE",1,0,0],["MAGG","MAGG",1,0,0],["MAGN","Magnera Corporation",138,532,0],["MAIA","MAIA Biotechnology Inc.",8,45,0],["MAIN","Main Street Capital Corporation",123,5391,0],["MAKX","MAKX",1,0,0],["MAMA","Mama\'s Creations Inc.",93,572,0],["MAMO","Massimo Group",32,220,0],["MAN","ManpowerGroup",19,1382,0],["MANH","Manhattan Associates Inc.",25,10596,0],["MANI","MANI",1,0,0],["MANU","Manchester United Ltd. Class A",45,2735,0],["MAPP","MAPP",1,0,0],["MAPS","WM Technology Inc. Class A",25,146,0],["MAR","Marriott International Class A",47,83232,0],["MARA","MARA Holdings Inc.",15,3850,0],["MARB","MARB",1,0,0],["MARO","MARO",1,0,0],["MARPS","Marine Petroleum Trust",59,9,0],["MART","MART",1,0,0],["MARW","MARW",1,0,0],["MAS","Masco Corporation",32,13317,0],["MASI","Masimo Corporation",77,7200,0],["MASK","3 E Network Technology Group Ltd Class A",15,4,0],["MASS","908 Devices Inc.",7,211,0],["MAT","Mattel Inc.",61,6238,0],["MATE","MATE",1,0,0],["MATH","Metalpha Technology Holding Limited",123,96,0],["MATV","Mativ Holdings Inc.",138,683,0],["MATW","Matthews International Corporation Class A",55,801,0],["MATX","Matson Inc.",98,3888,0],["MAVF","MAVF",1,0,0],["MAX","MediaAlpha Inc. Class A",36,834,0],["MAXI","MAXI",1,0,0],["MAXN","Maxeon Solar Technologies Ltd.",6,57,0],["MAYS","J. W. Mays Inc.",134,76,0],["MAYT","MAYT",1,0,0],["MAYW","MAYW",1,0,0],["MAZE","Maze Therapeutics Inc.",13,2007,0],["MB","MasterBeef Group",68,104,0],["MBAI","Check-Cap Ltd.",132,11,0],["MBAV","M3-Brigade Acquisition V Corp. Class A",1,0,0],["MBB","MBB",1,0,0],["MBBC","Marathon Bancorp Inc.",43,35,0],["MBC","MasterBrand Inc.",73,1421,0],["MBCN","Middlefield Banc Corp.",26,290,0],["MBI","MBIA Inc.",22,365,0],["MBIN","Merchants Bancorp",26,1611,0],["MBINL","Merchants Bancorp",26,1066,0],["MBINM","Merchants Bancorp",26,1161,0],["MBINN","Merchants Bancorp",26,860,0],["MBIO","Mustang Bio Inc.",8,8,0],["MBLY","Mobileye Global Inc. Class A",25,2201,0],["MBNKO","Medallion Bank Fixed-Rate Reset Non-Cumulative Perpetual",75,25,0],["MBOT","Microbot Medical Inc.",13,140,0],["MBOX","MBOX",1,0,0],["MBRX","Moleculin Biotech Inc.",8,8,0],["MBS","MBS",1,0,0],["MBSD","MBSD",1,0,0],["MBSF","MBSF",1,0,0],["MBSX","MBSX",1,0,0],["MBUU","Malibu Boats Inc. Class A",98,566,0],["MBVI","M3-Brigade Acquisition VI Corp. Class A",1,0,0],["MBVIU","M3-Brigade Acquisition VI Corp.",2,0,0],["MBWM","Mercantile Bank Corporation",26,805,0],["MBX","MBX Biosciences Inc.",8,1366,0],["MC","Moelis & Company Class A",11,5485,0],["MCB","Metropolitan Bank Holding Corp.",26,832,0],["MCBS","MetroCity Bankshares Inc.",26,713,0],["MCD","McDonald\'s Corporation",68,224927,0],["MCDS","MCDS",1,0,0],["MCFT","MasterCraft Boat Holdings Inc.",98,321,0],["MCGA","Yorkville Acquisition Corp. Class A",41,0,0],["MCGAU","Yorkville Acquisition Corp. Unit",2,0,0],["MCH","MCH",1,0,0],["MCHB","Mechanics Bancorp Class A",26,3135,0],["MCHI","MCHI",1,0,0],["MCHP","Microchip Technology Incorporated",6,35080,0],["MCHPP","Microchip Technology Incorporated",6,32038,0],["MCHS","MCHS",1,0,0],["MCHX","Marchex Inc. Class B",25,74,0],["MCI","Barings Corporate Investors",81,393,0],["MCK","McKesson Corporation",112,101241,0],["MCN","XAI Madison Equity Premium Income Fund",1,0,0],["MCO","Moody\'s Corporation",44,89749,0],["MCR","MFS Charter Income Trust",81,275,0],["MCRB","Seres Therapeutics Inc.",8,136,0],["MCRI","Monarch Casino & Resort Inc.",47,1818,0],["MCRP","Micropolis AI Robotics",42,46,0],["MCS","Marcus Corporation (The)",89,471,0],["MCSE","MCSE",1,0,0],["MCW","Mister Car Wash Inc.",79,1880,0],["MCY","Mercury General Corporation",22,5185,0],["MD","Pediatrix Medical Group Inc.",126,1882,0],["MDAA","MDAA",1,0,0],["MDAI","Spectral AI Inc. Class A",31,48,0],["MDB","MongoDB Inc. Class A",25,35051,0],["MDBH","MDB Capital Holdings LLC Class A common",44,34,0],["MDCX","Medicus Pharma Ltd.",1,35,0],["MDGL","Madrigal Pharmaceuticals Inc.",8,13423,0],["MDIA","Mediaco Holding Inc. Class A",83,52,0],["MDIV","MDIV",1,0,0],["MDLN","Medline Inc. Class A",31,54772,0],["MDLZ","Mondelez International Inc. Class A",17,70325,0],["MDRR","Medalist Diversified REIT Inc.",30,14,0],["MDST","MDST",1,0,0],["MDT","Medtronic plc.",77,126445,0],["MDU","MDU Resources Group Inc.",74,3918,0],["MDV","Modiv Industrial Inc. Class C",30,152,0],["MDV/PA","MDV/PA",1,0,0],["MDWD","MediWound Ltd.",18,211,0],["MDXG","MiMedx Group Inc",8,1044,0],["MDXH","MDxHealth SA",23,156,0],["MDY","MDY",1,0,0],["MDYG","MDYG",1,0,0],["MDYV","MDYV",1,0,0],["MEC","Mayville Engineering Company Inc.",32,352,0],["MED","MEDIFAST INC",17,130,0],["MEDI","MEDI",1,0,0],["MEDP","Medpace Holdings Inc.",14,16010,0],["MEDX","MEDX",1,0,0],["MEG","Montrose Environmental Group Inc.",19,923,0],["MEGI","NYLI CBRE Global Infrastructure Megatrends Term Fund",11,0,0],["MEGL","Magic Empire Global Limited Class A",44,6,0],["MEHA","Functional Brands Inc.",18,4,0],["MEI","Methode Electronics Inc.",39,241,0],["MELI","MercadoLibre Inc.",36,101273,0],["MEM","MEM",1,0,0],["MEMA","MEMA",1,0,0],["MEME","MEME",1,0,0],["MEMS","MEMS",1,0,0],["MEMX","MEMX",1,0,0],["MENS","Jyong Biotech Ltd.",8,241,0],["MEOH","Methanex Corporation",34,3028,0],["MER/PK","MER/PK",1,0,0],["MERC","Mercer International Inc.",138,139,0],["MESHU","Meshflow Acquisition Corp.",1,0,0],["MESO","Mesoblast Limited",13,2496,0],["MET","MetLife Inc.",5,53746,0],["MET/PA","MET/PA",1,0,0],["MET/PE","MET/PE",1,0,0],["MET/PF","MET/PF",1,0,0],["META","Meta Platforms Inc. Class A",16,1660448,0],["METC","Ramaco Resources Inc. Class A",65,975,0],["METCB","Ramaco Resources Inc. Class B",65,686,0],["METCI","Ramaco Resources Inc. 8.250% Senior Notes due 2030",1,0,0],["METCZ","Ramaco Resources Inc. 8.375% Senior Notes due 2029",65,0,0],["METD","METD",1,0,0],["METL","METL",1,0,0],["METU","METU",1,0,0],["METV","METV",1,0,0],["MEXX","MEXX",1,0,0],["MFA","MFA Financial Inc.",30,994,0],["MFA/PB","MFA/PB",1,0,0],["MFA/PC","MFA/PC",1,0,0],["MFAN","MFA Financial Inc. 8.875% Senior Notes due 2029",30,2587,0],["MFAO","MFA Financial Inc. 9.000% Senior Notes due 2029",30,2601,0],["MFC","Manulife Financial Corporation",5,60929,0],["MFDX","MFDX",1,0,0],["MFEM","MFEM",1,0,0],["MFG","Mizuho Financial Group Inc. Sponosred ADR (Japan)",26,91845,0],["MFI","mF International Limited Class A",15,31,0],["MFIC","MidCap Financial Investment Corporation",123,1070,0],["MFIG","MFIG",1,0,0],["MFIN","Medallion Financial Corp.",44,252,0],["MFLX","MFLX",1,0,0],["MFM","MFS Municipal Income Trust",116,221,0],["MFMO","MFMO",1,0,0],["MFSB","MFSB",1,0,0],["MFSG","MFSG",1,0,0],["MFSI","MFSI",1,0,0],["MFSM","MFSM",1,0,0],["MFSV","MFSV",1,0,0],["MFUS","MFUS",1,0,0],["MFVL","MFVL",1,0,0],["MG","Mistras Group Inc",21,404,0],["MGA","Magna International Inc.",42,15536,0],["MGC","MGC",1,0,0],["MGEE","MGE Energy Inc",41,2879,0],["MGF","MFS Government Markets Income Trust",81,97,0],["MGIC","Magic Software Enterprises Ltd.",25,1291,0],["MGIH","Millennium Group International Holdings Limited",109,14,0],["MGK","MGK",1,0,0],["MGLD","The Marygold Companies Inc.",44,44,0],["MGM","MGM Resorts International",47,10202,0],["MGMT","MGMT",1,0,0],["MGN","Megan Holdings Limited",48,33,0],["MGNI","Magnite Inc.",16,2356,0],["MGNR","MGNR",1,0,0],["MGNX","MacroGenics Inc.",8,95,0],["MGOV","MGOV",1,0,0],["MGPI","MGP Ingredients Inc.",46,511,0],["MGR","Affiliated Managers Group Inc. 5.875% Junior Subordinated Notes due 2059",11,611,0],["MGRB","Affiliated Managers Group Inc. 4.750% Junior Subordinated Notes due 2060",11,498,0],["MGRC","McGrath RentCorp",12,2660,0],["MGRD","Affiliated Managers Group Inc. 4.200% Junior Subordinated Notes due 2061",11,450,0],["MGRE","Affiliated Managers Group Inc. 6.750% Junior Subordinated Notes due 2064",11,708,0],["MGRT","Mega Fortune Company Limited",15,100,0],["MGRX","Mangoceuticals Inc.",137,10,0],["MGTX","MeiraGTx Holdings plc",13,646,0],["MGV","MGV",1,0,0],["MGX","Metagenomi Inc.",13,66,0],["MGY","Magnolia Oil & Gas Corporation Class A",59,4083,0],["MGYR","Magyar Bancorp Inc.",84,115,0],["MH","McGraw Hill Inc.",109,3270,0],["MHD","Blackrock MuniHoldings Fund Inc.",60,1739,0],["MHF","Western Asset Municipal High Income Fund Inc.",123,0,0],["MHH","Mastech Digital Inc",19,85,0],["MHK","Mohawk Industries Inc.",73,6669,0],["MHLA","Maiden Holdings Ltd. 6.625% Notes due 2046",22,101,0],["MHN","Blackrock MuniHoldings New York Quality Fund Inc.",60,1528,0],["MHNC","Maiden Holdings North America Ltd. 7.75% Notes due 2043",22,122,0],["MHO","M/I Homes Inc.",121,3338,0],["MHY","MHY",1,0,0],["MI","NFT Limited Class A",66,21,0],["MIAX","Miami International Holdings Inc.",60,3634,0],["MICC","The Magnum Ice Cream Company N.V.",93,9723,0],["MID","MID",1,0,0],["MIDD","Middleby Corporation (The)",7,7437,0],["MIDE","MIDE",1,0,0],["MIDU","MIDU",1,0,0],["MIGI","Mawson Infrastructure Group Inc.",44,5,0],["MILN","MILN",1,0,0],["MIMI","Mint Incorporation Limited Class A",36,12,0],["MIN","MFS Intermediate Income Trust",81,300,0],["MIND","MIND Technology Inc.",7,71,0],["MINO","MINO",1,0,0],["MINT","MINT",1,0,0],["MINV","MINV",1,0,0],["MIR","Mirion Technologies Inc. Class A",7,5977,0],["MIRA","MIRA Pharmaceuticals Inc.",8,68,0],["MIRM","Mirum Pharmaceuticals Inc.",8,3995,0],["MISL","MISL",1,0,0],["MIST","Milestone Pharmaceuticals Inc.",8,183,0],["MITK","Mitek Systems Inc.",53,479,0],["MITN","AG Mortgage Investment Trust Inc. 9.500% Senior Notes due 2029",30,748,0],["MITP","AG Mortgage Investment Trust Inc. 9.500% Senior Notes due 2029",30,749,0],["MITQ","Moving iMage Technologies Inc.",7,6,0],["MITT","AG Mortgage Investment Trust Inc.",30,280,0],["MITT/PA","MITT/PA",1,0,0],["MITT/PB","MITT/PB",1,0,0],["MITT/PC","MITT/PC",1,0,0],["MIY","Blackrock MuniYield Michigan Quality Fund Inc.",60,1723,0],["MJ","MJ",1,0,0],["MJSC","MJSC",1,0,0],["MKAM","MKAM",1,0,0],["MKC","McCormick & Company Incorporated",17,18405,0],["MKC.V","MKC.V",1,0,0],["MKDW","MKDWELL Tech Inc.",133,28,0],["MKL","Markel Group Inc.",22,27322,0],["MKLY","McKinley Acquisition Corporation Class A",1,0,0],["MKLYU","McKinley Acquisition Corporation",2,0,0],["MKOR","MKOR",1,0,0],["MKSI","MKS Inc.",7,10718,0],["MKTN","MKTN",1,0,0],["MKTW","MarketWise Inc. Class A",25,244,0],["MKTX","MarketAxess Holdings Inc.",60,6646,0],["MKZR","MacKenzie Realty Capital Inc.",30,8,0],["MLAB","Mesa Laboratories Inc.",7,448,0],["MLAC","Mountain Lake Acquisition Corp. Class A",37,0,0],["MLACU","MLACU",1,0,0],["MLCI","Mount Logan Capital Inc.",11,108,0],["MLCO","Melco Resorts & Entertainment Limited",47,3400,0],["MLDR","MLDR",1,0,0],["MLEC","Moolec Science SA",2,1,0],["MLGO","MicroAlgo Inc. Class A",15,79,0],["MLI","Mueller Industries Inc.",55,12833,0],["MLKN","MillerKnoll Inc.",92,1245,0],["MLM","Martin Marietta Materials Inc.",74,38231,0],["MLP","Maui Land & Pineapple Company Inc.",36,334,0],["MLPA","MLPA",1,0,0],["MLPB","MLPB",1,0,0],["MLPD","MLPD",1,0,0],["MLPR","MLPR",1,0,0],["MLPX","MLPX",1,0,0],["MLR","Miller Industries Inc.",72,425,0],["MLSS","Milestone Scientific Inc.",32,25,0],["MLTX","MoonLake Immunotherapeutics Class A",8,860,0],["MLYS","Mineralys Therapeutics Inc.",8,2915,0],["MMA","Mixed Martial Arts Group Limited",3,15,0],["MMC","Marsh & McLennan Companies Inc.",28,90486,0],["MMCA","MMCA",1,0,0],["MMD","NYLI MacKay DefinedTerm Muni Opportunities Fund",11,0,0],["MMI","Marcus & Millichap Inc.",36,1066,0],["MMID","MMID",1,0,0],["MMIN","MMIN",1,0,0],["MMIT","MMIT",1,0,0],["MMKT","MMKT",1,0,0],["MMLG","MMLG",1,0,0],["MMLP","Martin Midstream Partners L.P. Limited Partnership",80,88,0],["MMM","3M Company",31,86037,0],["MMMA","MMMA",1,0,0],["MMS","Maximus Inc.",36,4798,0],["MMSC","MMSC",1,0,0],["MMSD","MMSD",1,0,0],["MMSI","Merit Medical Systems Inc.",31,5200,0],["MMT","MFS Multimarket Income Trust",81,277,0],["MMTM","MMTM",1,0,0],["MMTX","Miluna Acquisition Corp Class A",2,0,0],["MMTXU","Miluna Acquisition Corp",1,0,0],["MMU","Western Asset Managed Municipals Fund Inc.",11,0,0],["MMYT","MakeMyTrip Limited",87,9612,0],["MNA","MNA",1,0,0],["MNBD","MNBD",1,0,0],["MNDO","MIND C.T.I. Ltd.",15,24,0],["MNDR","Mobile-health Network Solutions Class A",25,2,0],["MNDY","monday.com Ltd.",25,7468,0],["MNKD","MannKind Corporation",8,1793,0],["MNMD","Mind Medicine (MindMed) Inc.",18,1251,0],["MNOV","Medicinova Inc",8,70,0],["MNPR","Monopar Therapeutics Inc.",8,459,0],["MNR","Mach Natural Resources LP Common",59,1876,0],["MNRO","Monro Inc.",79,628,0],["MNRS","MNRS",1,0,0],["MNSB","MainStreet Bancshares Inc.",26,165,0],["MNSBP","MainStreet Bancshares Inc.",26,190,0],["MNSO","MINISO Group Holding Limited",113,6127,0],["MNST","Monster Beverage Corporation",46,74508,0],["MNTK","Montauk Renewables Inc.",107,266,0],["MNTN","MNTN Inc. Class A",58,863,0],["MNTS","Momentus Inc. Class A",21,12,0],["MNY","MoneyHero Limited Class A",36,60,0],["MNZL","MNZL",1,0,0],["MO","Altria Group Inc.",18,97480,0],["MOB","Mobilicom Limited",50,66,0],["MOBX","Mobix Labs Inc. Class A",6,21,0],["MOD","Modine Manufacturing Company",42,7169,0],["MODD","Modular Medical Inc.",31,26,0],["MODG","Topgolf Callaway Brands Corp.",61,2243,0],["MODL","MODL",1,0,0],["MOFG","MidWestOne Financial Gp",26,836,0],["MOG.A","MOG.A",1,0,0],["MOG.B","MOG.B",1,0,0],["MOGO","Mogo Inc.",44,27,0],["MOGU","MOGU Inc.",36,21,0],["MOH","Molina Healthcare Inc",23,8414,0],["MOLN","Molecular Partners AG",13,177,0],["MOMO","Hello Group Inc.",25,1068,0],["MOO","MOO",1,0,0],["MOOD","MOOD",1,0,0],["MORN","Morningstar Inc.",11,8860,0],["MORT","MORT",1,0,0],["MOS","Mosaic Company (The)",85,7554,0],["MOTO","MOTO",1,0,0],["MOV","Movado Group Inc.",94,466,0],["MOVE","Movano Inc.",77,7,0],["MP","MP Materials Corp.",10,9565,0],["MPA","Blackrock MuniYield Pennsylvania Quality Fund",116,0,0],["MPAA","Motorcar Parts of America Inc.",42,252,0],["MPB","Mid Penn Bancorp",26,746,0],["MPC","Marathon Petroleum Corporation",106,50597,0],["MPG","MPG",1,0,0],["MPL","MPL",1,0,0],["MPLT","MapLight Therapeutics Inc.",8,932,0],["MPLX","MPLX LP Common",107,54616,0],["MPTI","M-tron Industries Inc.",7,154,0],["MPU","Mega Matrix Inc. Class A",12,75,0],["MPV","Barings Participation Investors",116,197,0],["MPW","Medical Properties Trust Inc.",30,3092,0],["MPWR","Monolithic Power Systems Inc.",6,44894,0],["MPX","Marine Products Corporation",98,319,0],["MQ","Marqeta Inc. Class A",25,2231,0],["MQQQ","MQQQ",1,0,0],["MQT","Blackrock MuniYield Quality Fund II Inc.",60,1488,0],["MQY","Blackrock MuniYield Quality Fund Inc.",60,1696,0],["MRAL","MRAL",1,0,0],["MRAM","Everspin Technologies Inc.",6,204,0],["MRBK","Meridian Corporation",26,206,0],["MRCC","Monroe Capital Corporation",11,141,0],["MRCY","Mercury Systems Inc",39,4186,0],["MREO","Mereo BioPharma Group plc",8,310,0],["MRK","Merck & Company Inc.",8,250908,0],["MRKR","Marker Therapeutics Inc.",8,21,0],["MRM","MEDIROM Healthcare Technologies Inc. American",3,17,0],["MRNA","Moderna Inc.",13,13205,0],["MRNO","Murano Global Investments PLC",47,67,0],["MRNY","MRNY",1,0,0],["MRP","Millrose Properties Inc. Class A",36,4884,0],["MRSK","MRSK",1,0,0],["MRSN","Mersana Therapeutics Inc.",8,145,0],["MRT","Marti Technologies Inc. Class A",96,170,0],["MRTN","Marten Transport Ltd.",63,934,0],["MRUS","Merus N.V.",8,7358,0],["MRVI","Maravai LifeSciences Holdings Inc. Class A",8,877,0],["MRVL","Marvell Technology Inc.",6,71317,0],["MRX","Marex Group plc",60,2755,0],["MS","Morgan Stanley",60,281276,0],["MS/PA","MS/PA",1,0,0],["MS/PE","MS/PE",1,0,0],["MS/PF","MS/PF",1,0,0],["MS/PI","MS/PI",1,0,0],["MS/PK","MS/PK",1,0,0],["MS/PL","MS/PL",1,0,0],["MS/PO","MS/PO",1,0,0],["MS/PP","MS/PP",1,0,0],["MS/PQ","MS/PQ",1,0,0],["MSA","MSA Safety Incorporated",32,6268,0],["MSAI","MultiSensor AI Holdings Inc.",76,23,0],["MSB","Mesabi Trust",104,452,0],["MSBI","Midland States Bancorp Inc.",26,465,0],["MSBIP","Midland States Bancorp Inc.",26,534,0],["MSC","Studio City International Holdings Limited",47,634,0],["MSCI","MSCI Inc.",36,42700,0],["MSD","Morgan Stanley Emerging Markets Debt Fund Inc.",81,0,0],["MSDD","MSDD",1,0,0],["MSDL","Morgan Stanley Direct Lending Fund",1,0,0],["MSEX","Middlesex Water Company",70,948,0],["MSFD","MSFD",1,0,0],["MSFL","MSFL",1,0,0],["MSFO","MSFO",1,0,0],["MSFT","Microsoft Corporation",25,3611541,0],["MSFU","MSFU",1,0,0],["MSGE","Madison Square Garden Entertainment Corp. Class A",45,2485,0],["MSGM","Motorsport Games Inc. Class A",25,18,0],["MSGS","Madison Square Garden Sports Corp. Class A",45,5928,0],["MSGY","Masonglory Limited",1,38,0],["MSI","Motorola Solutions Inc.",49,61620,0],["MSIF","MSC Income Fund Inc.",123,620,0],["MSLC","MSLC",1,0,0],["MSM","MSC Industrial Direct Company Inc.",7,4819,0],["MSN","Emerson Radio Corporation",133,9,0],["MSOS","MSOS",1,0,0],["MSOX","MSOX",1,0,0],["MSPR","MSP Recovery Inc. Class A",15,3,0],["MSS","Maison Solutions Inc. Class A",67,21,0],["MSSM","MSSM",1,0,0],["MST","MST",1,0,0],["MSTI","MSTI",1,0,0],["MSTP","MSTP",1,0,0],["MSTR","Strategy Inc",25,47362,0],["MSTX","MSTX",1,0,0],["MSTY","MSTY",1,0,0],["MSW","Ming Shing Group Holdings Limited",82,15,0],["MT","Arcelor Mittal NY Registry Shares NEW",27,34316,0],["MTA","Metalla Royalty & Streaming Ltd.",104,763,0],["MTB","M&T Bank Corporation",26,31633,0],["MTB/PH","MTB/PH",1,0,0],["MTB/PJ","MTB/PJ",1,0,0],["MTB/PK","MTB/PK",1,0,0],["MTBA","MTBA",1,0,0],["MTC","MMTec Inc.",25,86,0],["MTCH","Match Group Inc.",16,7795,0],["MTD","Mettler-Toledo International Inc.",71,28651,0],["MTDR","Matador Resources Company",59,5109,0],["MTEK","Maris-Tech Ltd.",33,10,0],["MTEN","Mingteng International Corporation Inc. Class A",91,68,0],["MTEST","MTEST",1,0,0],["MTEST.A","MTEST.A",1,0,0],["MTEX","Mannatech Incorporated",18,15,0],["MTG","MGIC Investment Corporation",22,6629,0],["MTGP","MTGP",1,0,0],["MTH","Meritage Homes Corporation",121,4688,0],["MTLS","Materialise NV",25,336,0],["MTN","Vail Resorts Inc.",45,5493,0],["MTNB","Matinas Biopharma Holdings Inc.",8,5,0],["MTR","Mesa Royalty Trust",59,8,0],["MTRN","Materion Corporation",32,2150,0],["MTRX","Matrix Service Company",82,330,0],["MTSI","MACOM Technology Solutions Holdings Inc.",6,13070,0],["MTUL","MTUL",1,0,0],["MTUS","Metallus Inc.",27,727,0],["MTVA","MetaVia Inc.",8,21,0],["MTW","Manitowoc Company Inc. (The)",72,463,0],["MTX","Minerals Technologies Inc.",34,1885,0],["MTYY","MTYY",1,0,0],["MTZ","MasTec Inc.",128,17215,0],["MU","Micron Technology Inc.",6,298486,0],["MUA","Blackrock MuniAssets Fund Inc",60,1602,0],["MUB","MUB",1,0,0],["MUC","Blackrock MuniHoldings California Quality Fund Inc. ",60,1599,0],["MUD","MUD",1,0,0],["MUE","Blackrock MuniHoldings Quality Fund II Inc.",60,1488,0],["MUFG","Mitsubishi UFJ Financial Group Inc.",75,189946,0],["MUJ","Blackrock MuniHoldings New Jersey Quality Fund Inc.",60,1803,0],["MULL","MULL",1,0,0],["MULT","MULT",1,0,0],["MUNA","MUNA",1,0,0],["MUNB","MUNB",1,0,0],["MUNC","MUNC",1,0,0],["MUND","MUND",1,0,0],["MUNI","MUNI",1,0,0],["MUNX","MUNX",1,0,0],["MUR","Murphy Oil Corporation",59,4508,0],["MUSA","Murphy USA Inc.",97,7585,0],["MUSE","MUSE",1,0,0],["MUSI","MUSI",1,0,0],["MUSQ","MUSQ",1,0,0],["MUST","MUST",1,0,0],["MUU","MUU",1,0,0],["MUX","McEwen Inc.",104,1054,0],["MVBF","MVB Financial Corp.",26,344,0],["MVF","Blackrock MuniVest Fund Inc.",60,1025,0],["MVIS","MicroVision Inc.",7,288,0],["MVLL","MVLL",1,0,0],["MVO","MV Oil Trust",59,14,0],["MVPA","MVPA",1,0,0],["MVPL","MVPL",1,0,0],["MVRL","MVRL",1,0,0],["MVST","Microvast Holdings Inc.",7,965,0],["MVT","Blackrock MuniVest Fund II Inc. ",60,1590,0],["MVV","MVV",1,0,0],["MWA","MUELLER WATER PRODUCTS",55,3829,0],["MWG","Multi Ways Holdings Limited Class A",69,8,0],["MWYN","Marwynn Holdings Inc.",103,17,0],["MX","Magnachip Semiconductor Corporation",6,98,0],["MXC","Mexco Energy Corporation",59,20,0],["MXCT","MaxCyte Inc.",14,160,0],["MXE","Mexico Equity and Income Fund Inc. (The)",116,0,0],["MXF","Mexico Fund Inc. (The)",81,0,0],["MXI","MXI",1,0,0],["MXL","MaxLinear Inc.",6,1540,0],["MYCF","MYCF",1,0,0],["MYCG","MYCG",1,0,0],["MYCH","MYCH",1,0,0],["MYCI","MYCI",1,0,0],["MYCJ","MYCJ",1,0,0],["MYCK","MYCK",1,0,0],["MYCL","MYCL",1,0,0],["MYCM","MYCM",1,0,0],["MYCN","MYCN",1,0,0],["MYCO","MYCO",1,0,0],["MYD","Blackrock MuniYield Fund Inc. ",60,1549,0],["MYE","Myers Industries Inc.",64,723,0],["MYFW","First Western Financial Inc.",26,254,0],["MYGN","Myriad Genetics Inc.",24,611,0],["MYI","Blackrock MuniYield Quality Fund III Inc",60,1613,0],["MYMF","MYMF",1,0,0],["MYMG","MYMG",1,0,0],["MYMH","MYMH",1,0,0],["MYMI","MYMI",1,0,0],["MYMJ","MYMJ",1,0,0],["MYMK","MYMK",1,0,0],["MYN","Blackrock MuniYield New York Quality Fund Inc.Common Stock",116,0,0],["MYND","Mynd.ai Inc.",3,24,0],["MYNZ","Mainz Biomed N.V.",8,13,0],["MYO","Myomo Inc.",32,36,0],["MYPS","PLAYSTUDIOS Inc. Class A",25,83,0],["MYRG","MYR Group Inc.",128,3433,0],["MYSE","Myseum Inc.",33,9,0],["MYSZ","My Size Inc.",25,3,0],["MYY","MYY",1,0,0],["MZTI","The Marzetti Company",17,4650,0],["MZZ","MZZ",1,0,0],["NA","Nano Labs Ltd Class A",6,89,0],["NAAS","NaaS Technology Inc.",66,8,0],["NABL","N-able Inc.",25,1424,0],["NAC","Nuveen California Quality Municipal Income Fund",11,0,0],["NACP","NACP",1,0,0],["NAD","Nuveen Quality Municipal Income Fund",11,0,0],["NAGE","Niagen Bioscience Inc.",18,520,0],["NAII","Natural Alternatives International Inc.",18,11,0],["NAIL","NAIL",1,0,0],["NAK","Northern Dynasty Minerals Ltd.",104,1221,0],["NAKA","Kindly MD Inc.",35,173,0],["NAMI","Jinxin Technology Holding Company",3,46,0],["NAMM","Namib Minerals",104,75,0],["NAMS","NewAmsterdam Pharma Company N.V.",8,3981,0],["NAN","Nuveen New York Quality Municipal Income Fund",11,3401,0],["NANR","NANR",1,0,0],["NAT","Nordic American Tankers Limited",98,714,0],["NATH","Nathan\'s Famous Inc.",68,392,0],["NATL","NCR Atleos Corporation",92,2876,0],["NATO","NATO",1,0,0],["NATR","Nature\'s Sunshine Products Inc.",8,389,0],["NAUT","Nautilus Biotechnology Inc.",71,245,0],["NAVI","Navient Corporation",60,1275,0],["NAVN","Navan Inc. Class A",25,3757,0],["NAZ","Nuveen Arizona Quality Municipal Income Fund",123,0,0],["NB","NioCorp Developments Ltd.",10,684,0],["NBB","Nuveen Taxable Municipal Income Fund",116,0,0],["NBBK","NB Bancorp Inc.",43,842,0],["NBCE","NBCE",1,0,0],["NBCM","NBCM",1,0,0],["NBCR","NBCR",1,0,0],["NBDS","NBDS",1,0,0],["NBET","NBET",1,0,0],["NBFC","NBFC",1,0,0],["NBGX","NBGX",1,0,0],["NBH","Neuberger Municipal Fund Inc.",123,0,0],["NBHC","National Bank Holdings Corporation",26,1513,0],["NBIG","NBIG",1,0,0],["NBIL","NBIL",1,0,0],["NBIS","Nebius Group N.V. Class A",16,21301,0],["NBIX","Neurocrine Biosciences Inc.",13,14457,0],["NBJP","NBJP",1,0,0],["NBN","Northeast Bank",26,871,0],["NBOS","NBOS",1,0,0],["NBP","NovaBridge Biosciences",8,341,0],["NBR","Nabors Industries Ltd.",59,746,0],["NBSD","NBSD",1,0,0],["NBSM","NBSM",1,0,0],["NBTB","NBT Bancorp Inc.",26,2276,0],["NBTR","NBTR",1,0,0],["NBTX","Nanobiotix S.A.",8,1050,0],["NBXG","Neuberger Next Generation Connectivity Fund Inc.",81,0,0],["NBY","NovaBay Pharmaceuticals Inc.",8,668,0],["NC","NACCO Industries Inc.",65,367,0],["NCA","Nuveen California Municipal Value Fund",11,0,0],["NCDL","Nuveen Churchill Direct Lending Corp.",1,695,0],["NCEL","NewcelX Ltd.",8,12,0],["NCEW","New Century Logistics (BVI) Limited",105,14,0],["NCI","Neo-Concept International Group Holdings Limited Class A",86,6,0],["NCIQ","NCIQ",1,0,0],["NCL","Northann Corp.",64,6,0],["NCLH","Norwegian Cruise Line Holdings Ltd.",98,10489,0],["NCLO","NCLO",1,0,0],["NCMI","National CineMedia Inc.",58,362,0],["NCNA","NuCana plc American",8,7,0],["NCNO","nCino Inc.",25,2945,0],["NCPB","NCPB",1,0,0],["NCPL","Netcapital Inc.",44,6,0],["NCRA","Nocera Inc.",48,267,0],["NCSM","NCS Multistage Holdings Inc.",20,101,0],["NCT","Intercont (Cayman) Limited",68,24,0],["NCTY","The9 Limited American Depository Shares",44,116,0],["NCV","Virtus Convertible & Income Fund",116,1377,0],["NCV/PA","NCV/PA",1,0,0],["NCZ","Virtus Convertible & Income Fund II",116,1058,0],["NCZ/PA","NCZ/PA",1,0,0],["NDAA","NDAA",1,0,0],["NDAQ","Nasdaq Inc.",60,54450,0],["NDIA","NDIA",1,0,0],["NDIV","NDIV",1,0,0],["NDLS","Noodles & Company Class A",68,31,0],["NDMO","Nuveen Dynamic Municipal Opportunities Fund",81,593,0],["NDRA","ENDRA Life Sciences Inc.",77,6,0],["NDSN","Nordson Corporation",7,13419,0],["NDVG","NDVG",1,0,0],["NE","Noble Corporation plc A",59,4443,0],["NEA","Nuveen AMT-Free Quality Municipal Income Fund",123,0,0],["NECB","NorthEast Community Bancorp Inc.",43,324,0],["NEE","NextEra Energy Inc.",15,165651,0],["NEE/PN","NEE/PN",1,0,0],["NEE/PS","NEE/PS",1,0,0],["NEE/PT","NEE/PT",1,0,0],["NEE/PU","NEE/PU",1,0,0],["NEGG","Newegg Commerce Inc.",66,1059,0],["NEM","Newmont Corporation",104,110534,0],["NEMD","NEMD",1,0,0],["NEMG","NEMG",1,0,0],["NEN","New England Realty Associates Limited Partnership Class A Depositary Receipts Evidencing",134,180,0],["NEO","NeoGenomics Inc.",139,1531,0],["NEOG","Neogen Corporation",24,1565,0],["NEON","Neonode Inc.",7,34,0],["NEOV","NeoVolta Inc.",7,113,0],["NEPH","Nephros Inc.",31,53,0],["NERV","Minerva Neurosciences Inc",8,28,0],["NESR","National Energy Services Reunited Corp",20,1414,0],["NET","Cloudflare Inc. Class A",25,68543,0],["NETG","NETG",1,0,0],["NETL","NETL",1,0,0],["NEU","NewMarket Corp",34,6854,0],["NEUP","Neuphoria Therapeutics Inc.",8,21,0],["NEWP","New Pacific Metals Corp.",104,657,0],["NEWT","NewtekOne Inc.",26,353,0],["NEWTG","NewtekOne Inc. 8.50% Fixed Rate Senior Notes due 2029",26,660,0],["NEWTH","NewtekOne Inc. 8.625% Fixed Rate Senior Notes due 2029",26,0,0],["NEWTI","NewtekOne Inc. 8.00% Fixed Rate Senior Notes due 2028",26,663,0],["NEWTP","NewtekOne Inc.",26,672,0],["NEWTZ","NewtekOne Inc. 5.50% Notes Due 2026",26,652,0],["NEWZ","NEWZ",1,0,0],["NEXA","Nexa Resources S.A.",10,1085,0],["NEXM","NexMetals Mining Corp.",1,0,0],["NEXN","Nexxen International Ltd.",16,427,0],["NEXT","NextDecade Corporation",59,1451,0],["NFBK","Northfield Bancorp Inc.",84,503,0],["NFE","New Fortress Energy Inc. Class A",140,344,0],["NFG","National Fuel Gas Company",140,7325,0],["NFGC","New Found Gold Corp",104,679,0],["NFJ","Virtus Dividend Interest & Premium Strategy Fund",44,0,0],["NFLT","NFLT",1,0,0],["NFLX","Netflix Inc.",110,399961,0],["NFLY","NFLY",1,0,0],["NFRA","NFRA",1,0,0],["NFTY","NFTY",1,0,0],["NFXL","NFXL",1,0,0],["NFXS","NFXS",1,0,0],["NG","Novagold Resources Inc.",104,4045,0],["NGD","New Gold Inc.",10,6983,0],["NGG","National Grid Transco PLC National Grid PLC (NEW)",107,75525,0],["NGL","NGL ENERGY PARTNERS LP Common",107,1194,0],["NGL/PB","NGL/PB",1,0,0],["NGL/PC","NGL/PC",1,0,0],["NGNE","Neurogene Inc.",8,318,0],["NGS","Natural Gas Services Group Inc.",20,408,0],["NGVC","Natural Grocers by Vitamin Cottage Inc.",67,580,0],["NGVT","Ingevity Corporation",34,2108,0],["NHC","National HealthCare Corporation",126,2198,0],["NHI","National Health Investors Inc.",30,3708,0],["NHIC","NewHold Investment Corp III Class A",1,0,0],["NHICU","NHICU",1,0,0],["NHPAP","National Healthcare Properties Inc. 7.375% Series A Cumulative Redeemable Perpetual",30,539,0],["NHPBP","National Healthcare Properties Inc. 7.125% Series B Cumulative Redeemable Perpetual",30,529,0],["NHS","Neuberger High Yield Strategies Fund Inc.",81,0,0],["NHTC","Natural Health Trends Corp.",94,38,0],["NHYB","NHYB",1,0,0],["NHYM","NHYM",1,0,0],["NI","NiSource Inc",129,19551,0],["NIC","Nicolet Bankshares Inc.",26,1901,0],["NICE","NICE Ltd",25,6896,0],["NIE","Virtus Equity & Convertible Income Fund",11,692,0],["NIKL","NIKL",1,0,0],["NIM","Nuveen Select Maturities Municipal Fund",81,0,0],["NINE","Nine Energy Service Inc.",20,15,0],["NIO","NIO Inc.",37,11207,0],["NIOG","NIOG",1,0,0],["NIPG","NIP Group Inc.",45,154,0],["NIQ","NIQ Global Intelligence plc",16,4897,0],["NISN","NiSun International Enterprise Development Group Co. Ltd. Class A",55,8,0],["NITE","NITE",1,0,0],["NITO","N2OFF Inc.",85,7,0],["NIU","Niu Technologies",37,240,0],["NIVF","NewGenIvf Group Limited Class A",137,6,0],["NIXT","NIXT",1,0,0],["NIXX","Nixxy Inc.",15,28,0],["NJNK","NJNK",1,0,0],["NJR","NewJersey Resources Corporation",140,4665,0],["NKE","Nike Inc.",114,86785,0],["NKLR","Terra Innovatum Global N.V.",55,355,0],["NKSH","National Bankshares Inc.",26,220,0],["NKTR","Nektar Therapeutics ",8,953,0],["NKTX","Nkarta Inc.",8,127,0],["NKX","Nuveen California AMT-Free Quality Municipal Income Fund",123,0,0],["NL","NL Industries Inc.",34,274,0],["NLOP","Net Lease Office Properties",30,390,0],["NLR","NLR",1,0,0],["NLY","Annaly Capital Management Inc.",30,15505,0],["NLY/PF","NLY/PF",1,0,0],["NLY/PG","NLY/PG",1,0,0],["NLY/PI","NLY/PI",1,0,0],["NLY/PJ","NLY/PJ",1,0,0],["NMAI","Nuveen Multi-Asset Income Fund",11,0,0],["NMAX","Newsmax Inc. Class B",83,1176,0],["NMB","NMB",1,0,0],["NMBL","NMBL",1,0,0],["NMCO","Nuveen Municipal Credit Opportunities Fund",123,564,0],["NMFC","New Mountain Finance Corporation",123,929,0],["NMFCZ","New Mountain Finance Corporation 8.250% Notes due 2028",1,2695,0],["NMG","Nouveau Monde Graphite Inc.",52,381,0],["NMI","Nuveen Municipal Income Fund Inc.",81,0,0],["NMIH","NMI Holdings Inc.",22,3157,0],["NML","Neuberger Energy Infrastructure and Income Fund Inc.",123,0,0],["NMM","Navios Maritime Partners LP Common",98,1508,0],["NMP","NMP Acquisition Corp. Class A",2,0,0],["NMPAU","NMP Acquisition Corp.",2,0,0],["NMR","Nomura Holdings Inc ADR",60,24359,0],["NMRA","Neumora Therapeutics Inc.",13,292,0],["NMRK","Newmark Group Inc. Class A",36,3157,0],["NMS","Nuveen Minnesota Quality Municipal Income Fund",116,0,0],["NMT","Nuveen Massachusetts Quality Municipal Income Fund",123,0,0],["NMTC","NeuroOne Medical Technologies Corporation",31,37,0],["NMZ","Nuveen Municipal High Income Opportunity Fund",123,0,0],["NN","NextNav Inc.",7,2264,0],["NNBR","NN Inc.",7,60,0],["NNDM","Nano Dimension Ltd.",39,504,0],["NNE","Nano Nuclear Energy Inc.",41,1373,0],["NNI","Nelnet Inc.",44,4980,0],["NNN","NNN REIT Inc.",30,7551,0],["NNNN","Anbio Biotechnology Class A",24,4655,0],["NNOX","NANO-X IMAGING LTD",132,202,0],["NNVC","NanoViricides Inc.",8,36,0],["NNY","Nuveen New York Municipal Value Fund",11,0,0],["NOA","North American Construction Group Ltd.",20,385,0],["NOAH","Noah Holdings Limited",11,658,0],["NOC","Northrop Grumman Corporation",7,81131,0],["NODK","NI Holdings Inc.",22,287,0],["NOEM","CO2 Energy Transition Corp.",1,0,0],["NOG","Northern Oil and Gas Inc.",59,2102,0],["NOK","Nokia Corporation Sponsored",49,36438,0],["NOM","Nuveen Missouri Quality Municipal Income Fund",11,0,0],["NOMA","NOMADAR Corp. Class A",45,160,0],["NOMD","Nomad Foods Limited",17,1965,0],["NORW","NORW",1,0,0],["NOTE","FiscalNote Holdings Inc. Class A",36,29,0],["NOTV","Inotiv Inc.",14,23,0],["NOV","NOV Inc.",88,5716,0],["NOVT","Novanta Inc.",7,4270,0],["NOVTU","Novanta Inc. Tangible Equity",7,1960,0],["NOW","ServiceNow Inc.",25,161272,0],["NOWL","NOWL",1,0,0],["NP","Neptune Insurance Holdings Inc. Class A",28,3888,0],["NPAC","New Providence Acquisition Corp. III Class A",1,0,0],["NPACU","New Providence Acquisition Corp. III",2,0,0],["NPB","Northpointe Bancshares Inc.",26,584,0],["NPCE","Neuropace Inc.",31,553,0],["NPCT","Nuveen Core Plus Impact Fund",11,0,0],["NPFD","Nuveen Variable Rate Preferred & Income Fund",81,0,0],["NPFI","NPFI",1,0,0],["NPK","National Presto Industries Inc.",78,754,0],["NPKI","NPK International Inc.",88,1034,0],["NPO","Enpro Inc.",55,4363,0],["NPT","Texxon Holding Limited",135,118,0],["NPV","Nuveen Virginia Quality Municipal Income Fund",11,0,0],["NPWR","NET Power Inc. Class A",7,515,0],["NQP","Nuveen Pennsylvania Quality Municipal Income Fund",81,0,0],["NRC","National Research Corporation",14,424,0],["NRDS","NerdWallet Inc. Class A",15,1045,0],["NRDY","Nerdy Inc. Class A",3,229,0],["NREF","NexPoint Real Estate Finance Inc.",30,252,0],["NREF/PA","NREF/PA",1,0,0],["NRES","NRES",1,0,0],["NRG","NRG Energy Inc.",41,29934,0],["NRGD","NRGD",1,0,0],["NRGU","NRGU",1,0,0],["NRGV","Energy Vault Holdings Inc.",7,802,0],["NRIM","Northrim BanCorp Inc",84,598,0],["NRIX","Nurix Therapeutics Inc.",8,1424,0],["NRK","Nuveen New York AMT-Free Quality Municipal Income Fund",81,0,0],["NRO","Neuberger Real Estate Securities Income Fund Inc.",123,0,0],["NRP","Natural Resource Partners LP Limited Partnership",65,1350,0],["NRSH","NRSH",1,0,0],["NRSN","NeuroSense Therapeutics Ltd.",8,24,0],["NRT","North European Oil Royality Trust",59,58,0],["NRUC","National Rural Utilities Cooperative Finance Corporation 5.500% Subordinated Notes due 2064 (Subordinated Deferrable Interest Notes)",146,0,0],["NRXP","NRX Pharmaceuticals Inc.",8,67,0],["NRXS","Neuraxis Inc.",77,34,0],["NSA","National Storage Affiliates Trust",30,2159,0],["NSA/PA","NSA/PA",1,0,0],["NSA/PB","NSA/PB",1,0,0],["NSC","Norfolk Southern Corporation",117,65389,0],["NSCI","NSCI",1,0,0],["NSCR","NSCR",1,0,0],["NSI","NSI",1,0,0],["NSIT","Insight Enterprises Inc.",57,2456,0],["NSP","Insperity Inc.",19,1456,0],["NSPR","InspireMD Inc.",31,84,0],["NSRX","Nasus Pharma Ltd.",8,68,0],["NSSC","NAPCO Security Technologies Inc.",33,1534,0],["NSTS","NSTS Bancorp Inc.",84,63,0],["NSYS","Nortech Systems Incorporated",7,20,0],["NTAP","NetApp Inc.",76,22163,0],["NTB","Bank of N.T. Butterfield & Son Limited (The) Voting",75,2202,0],["NTCL","NETCLASS TECHNOLOGY INC Class A",25,12,0],["NTCT","NetScout Systems Inc.",15,2027,0],["NTES","NetEase Inc.",25,87027,0],["NTGR","NETGEAR Inc.",33,693,0],["NTHI","NeOnc Technologies Holdings Inc.",8,168,0],["NTIC","Northern Technologies International Corporation",32,74,0],["NTIP","Network-1 Technologies Inc.",29,30,0],["NTLA","Intellia Therapeutics Inc.",24,1069,0],["NTNX","Nutanix Inc. Class A",25,14142,0],["NTR","Nutrien Ltd.",85,30102,0],["NTRA","Natera Inc.",23,32014,0],["NTRB","Nutriband Inc.",32,55,0],["NTRP","NextTrip Inc.",69,35,0],["NTRS","Northern Trust Corporation",26,26374,0],["NTRSO","Northern Trust Corporation",26,3656,0],["NTSE","NTSE",1,0,0],["NTSI","NTSI",1,0,0],["NTSK","Netskope Inc. Class A",25,7574,0],["NTST","NetSTREIT Corp.",30,1459,0],["NTSX","NTSX",1,0,0],["NTWK","NetSol Technologies Inc. Common Stock",25,36,0],["NTWO","Newbury Street II Acquisition Corp Class A",1,0,0],["NTZ","Natuzzi S.p.A.",73,25,0],["NU","Nu Holdings Ltd. Class A",44,78737,0],["NUAG","NUAG",1,0,0],["NUAI","New Era Energy & Digital Inc.",59,202,0],["NUBD","NUBD",1,0,0],["NUE","Nucor Corporation",27,36423,0],["NUG","NUG",1,0,0],["NUGO","NUGO",1,0,0],["NUGT","NUGT",1,0,0],["NUGY","NUGY",1,0,0],["NUHY","NUHY",1,0,0],["NUKK","Nukkleus Inc.",19,74,0],["NUKZ","NUKZ",1,0,0],["NUMI","NUMI",1,0,0],["NUS","Nu Skin Enterprises Inc.",112,501,0],["NUSA","NUSA",1,0,0],["NUSB","NUSB",1,0,0],["NUTX","Nutex Health Inc.",36,1216,0],["NUV","Nuveen Municipal Value Fund Inc.",81,0,0],["NUVB","Nuvation Bio Inc. Class A",8,3236,0],["NUVL","Nuvalent Inc. Class A",8,7547,0],["NUW","Nuveen AMT-Free Municipal Value Fund",11,0,0],["NUWE","Nuwellis Inc.",77,4,0],["NVA","Nova Minerals Limited",104,232,0],["NVAX","Novavax Inc.",13,1082,0],["NVBT","NVBT",1,0,0],["NVBW","NVBW",1,0,0],["NVCR","NovoCure Limited",31,1438,0],["NVCT","Nuvectis Pharma Inc.",8,199,0],["NVD","NVD",1,0,0],["NVDA","NVIDIA Corporation",6,4398057,0],["NVDB","NVDB",1,0,0],["NVDD","NVDD",1,0,0],["NVDG","NVDG",1,0,0],["NVDL","NVDL",1,0,0],["NVDS","NVDS",1,0,0],["NVDU","NVDU",1,0,0],["NVDY","NVDY",1,0,0],["NVEC","NVE Corporation",6,325,0],["NVG","Nuveen AMT-Free Municipal Credit Income Fund",11,0,0],["NVGS","Navigator Holdings Ltd.",98,1201,0],["NVIR","NVIR",1,0,0],["NVMI","Nova Ltd.",76,9452,0],["NVNI","Nvni Group Limited",25,31,0],["NVNO","enVVeno Medical Corporation",31,6,0],["NVO","Novo Nordisk A/S",8,214722,0],["NVOH","NVOH",1,0,0],["NVOX","NVOX",1,0,0],["NVR","NVR Inc.",121,21011,0],["NVRI","Enviri Corporation",12,1469,0],["NVS","Novartis AG",8,268731,0],["NVST","Envista Holdings Corporation",31,3663,0],["NVT","nVent Electric plc",7,16384,0],["NVTS","Navitas Semiconductor Corporation",6,1679,0],["NVVE","Nuvve Holding Corp.",39,5,0],["NVX","NOVONIX Limited American Depository Shares",7,145,0],["NVYY","NVYY",1,0,0],["NWAX.U","NWAX.U",1,0,0],["NWBI","Northwest Bancshares Inc.",26,1842,0],["NWE","NorthWestern Energy Group Inc.",129,3858,0],["NWFL","Norwood Financial Corp.",26,275,0],["NWG","NatWest Group plc",75,69344,0],["NWGL","Nature Wood Group Limited",1,21,0],["NWL","Newell Brands Inc.",64,1559,0],["NWLG","NWLG",1,0,0],["NWN","Northwest Natural Holding Company",140,1931,0],["NWPX","NWPX Infrastructure Inc.",27,616,0],["NWS","News Corporation Class B",124,16727,0],["NWSA","News Corporation Class A",124,14644,0],["NWTG","Newton Golf Company Inc.",61,8,0],["NX","Quanex Building Products Corporation",55,705,0],["NXC","Nuveen California Select Tax-Free Income Portfolio",11,84,0],["NXDR","Nextdoor Holdings Inc. Class A",16,855,0],["NXDT","NexPoint Diversified Real Estate Trust",30,184,0],["NXDT/PA","NXDT/PA",1,0,0],["NXE","Nexgen Energy Ltd.",52,5976,0],["NXG","NXG NextGen Infrastructure Income Fund",1,128,0],["NXGL","NexGel Inc",31,13,0],["NXJ","Nuveen New Jersey Qualified Municipal Fund",123,0,0],["NXL","Nexalin Technology Inc.",77,16,0],["NXN","Nuveen New York Select Tax-Free Income Portfolio",81,48,0],["NXP","Nuveen Select Tax Free Income Portfolio",81,662,0],["NXPI","NXP Semiconductors N.V.",6,56946,0],["NXPL","NextPlat Corp",33,16,0],["NXRT","NexPoint Residential Trust Inc.",30,717,0],["NXST","Nexstar Media Group Inc.",83,6125,0],["NXT","Nextpower Inc. Class A",7,13162,0],["NXTC","NextCure Inc.",8,59,0],["NXTE","NXTE",1,0,0],["NXTG","NXTG",1,0,0],["NXTT","Next Technology Holding Inc.",15,33,0],["NXUS","NXUS",1,0,0],["NXXT","NextNRG Inc.",97,193,0],["NYAX","Nayax Ltd.",25,1708,0],["NYC","American Strategic Investment Co. Class A",30,22,0],["NYF","NYF",1,0,0],["NYM","NYM",1,0,0],["NYT","New York Times Company (The)",124,11493,0],["NYXH","Nyxoah SA",31,182,0],["NZAC","NZAC",1,0,0],["NZF","Nuveen Municipal Credit Income Fund",116,0,0],["NZUS","NZUS",1,0,0],["O","Realty Income Corporation",30,51818,0],["OABI","OmniAb Inc.",14,301,0],["OACC","Oaktree Acquisition Corp. III Life Sciences Class A",2,0,0],["OACCU","Oaktree Acquisition Corp. III Life Sciences Unit",2,0,0],["OACP","OACP",1,0,0],["OAEM","OAEM",1,0,0],["OAIM","OAIM",1,0,0],["OAK/PA","OAK/PA",1,0,0],["OAK/PB","OAK/PB",1,0,0],["OAKG","OAKG",1,0,0],["OAKI","OAKI",1,0,0],["OAKM","OAKM",1,0,0],["OAKU","Oak Woods Acquisition Corporation Class A",2,0,0],["OALC","OALC",1,0,0],["OARK","OARK",1,0,0],["OASC","OASC",1,0,0],["OBA","Oxley Bridge Acquisition Limited Class A",2,0,0],["OBDC","Blue Owl Capital Corporation",146,6465,0],["OBE","Obsidian Energy Ltd.",59,377,0],["OBIL","OBIL",1,0,0],["OBIO","Orchestra BioMed Holdings Inc.",18,246,0],["OBK","Origin Bancorp Inc.",26,1204,0],["OBOR","OBOR",1,0,0],["OBT","Orange County Bancorp Inc.",26,399,0],["OC","Owens Corning Inc",7,9414,0],["OCC","Optical Cable Corporation",33,44,0],["OCCI","OFS Credit Company Inc.",81,55,0],["OCCIM","OFS Credit Company Inc. 7.875% Series F Term",1,0,0],["OCCIN","OFS Credit Company Inc. 5.25% Series E Term",81,283,0],["OCCIO","OFS Credit Company Inc. 6.125% Series C Term",81,291,0],["OCFC","OceanFirst Financial Corp.",26,1155,0],["OCG","Oriental Culture Holding LTD",3,5,0],["OCGN","Ocugen Inc.",13,437,0],["OCIO","OCIO",1,0,0],["OCS","Oculis Holding AG",8,1123,0],["OCSL","Oaktree Specialty Lending Corporation",44,1127,0],["OCTT","OCTT",1,0,0],["OCTW","OCTW",1,0,0],["OCUL","Ocular Therapeutix Inc.",8,2676,0],["ODC","Oil-Dri Corporation Of America",69,742,0],["ODD","ODDITY Tech Ltd. Class A",90,2333,0],["ODDS","ODDS",1,0,0],["ODFL","Old Dominion Freight Line Inc.",63,32910,0],["ODHY","ODHY",1,0,0],["ODV","Osisko Development Corp.",104,961,0],["ODYS","Odysight.ai Inc.",76,55,0],["OEC","Orion S.A.",34,284,0],["OEF","OEF",1,0,0],["OEI","OEI",1,0,0],["OESX","Orion Energy Systems Inc.",91,57,0],["OFAL","OFA Group Class A",21,9,0],["OFG","OFG Bancorp",26,1859,0],["OFIX","Orthofix Medical Inc.",31,612,0],["OFLX","Omega Flex Inc.",32,284,0],["OFS","OFS Capital Corporation",123,62,0],["OFSSH","OFSSH",1,0,0],["OFSSO","OFS Capital Corporation 7.50% Notes due 2028",1,0,0],["OGCP","OGCP",1,0,0],["OGE","OGE Energy Corp",41,8562,0],["OGEN","Oragenics Inc.",8,4,0],["OGI","Organigram Global Inc.",8,270,0],["OGN","Organon & Co.",8,1776,0],["OGS","ONE Gas Inc.",140,4652,0],["OGSP","OGSP",1,0,0],["OHI","Omega Healthcare Investors Inc.",30,12994,0],["OI","O-I Glass Inc.",125,2250,0],["OIA","Invesco Municipal Income Opportunities Trust",116,289,0],["OIH","OIH",1,0,0],["OII","Oceaneering International Inc.",20,2356,0],["OILD","OILD",1,0,0],["OILT","OILT",1,0,0],["OILU","OILU",1,0,0],["OIS","Oil States International Inc.",88,410,0],["OKE","ONEOK Inc.",59,45097,0],["OKLL","OKLL",1,0,0],["OKLO","Oklo Inc. Class A",41,13004,0],["OKLS","OKLS",1,0,0],["OKTA","Okta Inc. Class A",25,15988,0],["OKTG","OKTG",1,0,0],["OKUR","OnKure Therapeutics Inc. Class A",8,41,0],["OKYO","OKYO Pharma Limited",13,69,0],["OLB","The OLB Group Inc.",36,8,0],["OLED","Universal Display Corporation",39,5560,0],["OLLI","Ollie\'s Bargain Outlet Holdings Inc.",113,6622,0],["OLMA","Olema Pharmaceuticals Inc.",8,2100,0],["OLN","Olin Corporation",34,2327,0],["OLP","One Liberty Properties Inc.",30,450,0],["OLPX","Olaplex Holdings Inc.",90,841,0],["OM","Outset Medical Inc.",77,67,0],["OMAB","Grupo Aeroportuario del Centro Norte S.A.B. de C.V. ADS",50,5207,0],["OMAH","OMAH",1,0,0],["OMC","Omnicom Group Inc.",58,15483,0],["OMCC","Old Market Capital Corporation",116,34,0],["OMCL","Omnicell Inc.",9,2102,0],["OMDA","Omada Health Inc.",35,840,0],["OMER","Omeros Corporation",8,681,0],["OMEX","Odyssey Marine Exploration Inc.",98,121,0],["OMF","OneMain Holdings Inc.",44,8041,0],["OMH","Ohmyhome Limited Class A",36,19,0],["OMI","Owens & Minor Inc.",23,220,0],["OMSE","OMS Energy Technologies Inc.",88,181,0],["ON","ON Semiconductor Corporation",6,22215,0],["ONB","Old National Bancorp",26,9125,0],["ONBPO","Old National Bancorp",26,9808,0],["ONBPP","Old National Bancorp",26,9824,0],["ONC","BeOne Medicines Ltd.",8,34973,0],["ONCH","1RT Acquisition Corp. Class A",1,0,0],["ONCHU","1RT Acquisition Corp.",1,0,0],["ONCO","Onconetix Inc.",8,3,0],["ONCY","Oncolytics Biotech Inc.",8,109,0],["OND","OND",1,0,0],["ONDS","Ondas Holdings Inc.",49,3452,0],["ONEG","OneConstruction Group Limited",121,18,0],["ONEO","ONEO",1,0,0],["ONEQ","ONEQ",1,0,0],["ONEV","ONEV",1,0,0],["ONEW","OneWater Marine Inc. Class A",141,173,0],["ONEY","ONEY",1,0,0],["ONFO","Onfolio Holdings Inc.",15,4,0],["ONIT","Onity Group Inc.",44,359,0],["ONL","Orion Properties Inc.",30,116,0],["ONLN","ONLN",1,0,0],["ONMD","OneMedNet Corp Class A",14,67,0],["ONOF","ONOF",1,0,0],["ONON","On Holding AG Class A",114,30829,0],["ONTF","ON24 Inc.",25,245,0],["ONTO","Onto Innovation Inc.",7,7663,0],["OOMA","Ooma Inc.",15,321,0],["OOQB","OOQB",1,0,0],["OOSB","OOSB",1,0,0],["OOSP","OOSP",1,0,0],["OPAD","Offerpad Solutions Inc. Class A",36,51,0],["OPAL","OPAL Fuels Inc. Class A",107,357,0],["OPBK","OP Bancorp",26,222,0],["OPCH","Option Care Health Inc.",35,5160,0],["OPEG","OPEG",1,0,0],["OPEN","Opendoor Technologies Inc",36,6066,0],["OPER","OPER",1,0,0],["OPFI","OppFi Inc. Class A",44,928,0],["OPHC","OptimumBank Holdings Inc.",26,50,0],["OPK","OPKO Health Inc.",8,1006,0],["OPP","RiverNorth/DoubleLine Strategic Opportunity Fund Inc.",123,0,0],["OPP/PA","OPP/PA",1,0,0],["OPP/PB","OPP/PB",1,0,0],["OPP/PC","OPP/PC",1,0,0],["OPPE","OPPE",1,0,0],["OPPJ","OPPJ",1,0,0],["OPRA","Opera Limited",25,1262,0],["OPRT","Oportun Financial Corporation",44,239,0],["OPRX","OptimizeRx Corporation",36,252,0],["OPTT","Ocean Power Technologies Inc.",41,69,0],["OPTU","Optimum Communications Inc. Class A",54,799,0],["OPTX","Syntec Optics Holdings Inc. Class A",76,63,0],["OPTZ","OPTZ",1,0,0],["OPXS","Optex Systems Holdings Inc.",76,94,0],["OPY","Oppenheimer Holdings Inc. Class A",60,784,0],["OR","OR Royalties Inc.",104,6962,0],["ORA","Ormat Technologies Inc.",41,6734,0],["ORBS","Eightco Holdings Inc.",1,455,0],["ORC","Orchid Island Capital Inc.",30,1114,0],["ORCL","Oracle Corporation",25,551555,0],["ORCS","ORCS",1,0,0],["ORCU","ORCU",1,0,0],["ORCX","ORCX",1,0,0],["ORGN","Origin Materials Inc.",34,41,0],["ORGO","Organogenesis Holdings Inc. Class A",8,711,0],["ORI","Old Republic International Corporation",22,11261,0],["ORIC","Oric Pharmaceuticals Inc.",8,783,0],["ORIQ","Origin Investment Corp I",1,0,0],["ORIQU","ORIQU",1,0,0],["ORIS","Oriental Rise Holdings Limited",48,2,0],["ORKA","Oruka Therapeutics Inc.",24,1541,0],["ORKT","Orangekloud Technology Inc. Class A",25,5,0],["ORLA","Orla Mining Ltd.",104,4820,0],["ORLY","O\'Reilly Automotive Inc.",141,76813,0],["ORMP","Oramed Pharmaceuticals Inc.",8,117,0],["ORN","Orion Group Holdings Inc. Common",21,415,0],["ORR","ORR",1,0,0],["ORRF","Orrstown Financial Services Inc.",26,714,0],["OS","OneStream Inc. Class A",25,4491,0],["OSBC","Old Second Bancorp Inc.",26,1081,0],["OSCG","OSCG",1,0,0],["OSCR","Oscar Health Inc. Class A",23,3944,0],["OSCX","OSCX",1,0,0],["OSEA","OSEA",1,0,0],["OSG","Octave Specialty Group Inc.",22,363,0],["OSIS","OSI Systems Inc.",6,4491,0],["OSK","Oshkosh Corporation (Holding Company)Common Stock",37,8247,0],["OSPN","OneSpan Inc.",15,486,0],["OSRH","OSR Holdings Inc.",31,17,0],["OSS","One Stop Systems Inc.",9,180,0],["OSTX","OS Therapies Incorporated",8,54,0],["OSUR","OraSure Technologies Inc.",31,171,0],["OSW","OneSpaWorld Holdings Limited",47,2191,0],["OTEX","Open Text Corporation",15,8410,0],["OTF","Blue Owl Technology Finance Corp.",1,6354,0],["OTGA","OTG Acquisition Corp. I Class A",2,0,0],["OTGAU","OTG Acquisition Corp. I Unit",2,0,0],["OTGL","OTGL",1,0,0],["OTH","Off The Hook YS Inc.",98,56,0],["OTIS","Otis Worldwide Corporation",133,33929,0],["OTLK","Outlook Therapeutics Inc.",13,89,0],["OTLY","Oatly Group AB",17,333,0],["OTTR","Otter Tail Corporation",41,3441,0],["OUNZ","OUNZ",1,0,0],["OUST","Ouster Inc.",7,1334,0],["OUT","OUTFRONT Media Inc.",30,3997,0],["OVBC","Ohio Valley Banc Corp.",26,194,0],["OVID","Ovid Therapeutics Inc.",8,191,0],["OVLY","Oak Valley Bancorp (CA)",26,258,0],["OVV","Ovintiv Inc. (DE)",59,9469,0],["OWL","Blue Owl Capital Inc. Class A",11,24003,0],["OWLS","OBOOK Holdings Inc. Class A",25,533,0],["OWLT","Owlet Inc. Class A",7,388,0],["OWNB","OWNB",1,0,0],["OWNS","OWNS",1,0,0],["OXBR","Oxbridge Re Holdings Limited",22,10,0],["OXLC","Oxford Lane Capital Corp.",11,2418,0],["OXLCG","Oxford Lane Capital Corp. 7.95% Notes due 2032",11,0,0],["OXLCI","Oxford Lane Capital Corp. 8.75% Notes due 2030",1,0,0],["OXLCL","Oxford Lane Capital Corp. 6.75% Notes due 2031",116,4175,0],["OXLCN","Oxford Lane Capital Corp. 7.125% Series 2029 Term",11,4232,0],["OXLCO","Oxford Lane Capital Corp.",11,4071,0],["OXLCP","Oxford Lane Capital Corp. 6.25% Series 2027 Term",11,4253,0],["OXLCZ","Oxford Lane Capital Corp. 5.00% Notes due 2027",116,4227,0],["OXM","Oxford Industries Inc.",118,540,0],["OXSQ","Oxford Square Capital Corp.",2,144,0],["OXSQG","Oxford Square Capital Corp. 5.50% Notes due 2028",3,1531,0],["OXSQH","Oxford Square Capital Corp. 7.75% Notes due 2030",2,0,0],["OXY","Occidental Petroleum Corporation",59,39034,0],["OYSE","Oyster Enterprises II Acquisition Corp Class A",2,0,0],["OYSEU","Oyster Enterprises II Acquisition Corp",1,0,0],["OZ","Belpointe PREP LLC Class A",30,251,0],["OZEM","OZEM",1,0,0],["OZK","Bank OZK",26,5349,0],["OZKAP","Bank OZK 4.625% Series A Non-Cumulative Perpetual",26,1857,0],["PAA","Plains All American Pipeline L.P. Common",107,12381,0],["PAAA","PAAA",1,0,0],["PAAS","Pan American Silver Corp.",104,21849,0],["PAB","PAB",1,0,0],["PABD","PABD",1,0,0],["PABU","PABU",1,0,0],["PAC","Grupo Aeroportuario Del Pacifico S.A. B. de C.V. Grupo Aeroportuario Del Pacifico S.A. de C.V. (each representing 10 Series B shares)",50,13484,0],["PACB","Pacific Biosciences of California Inc.",71,556,0],["PACH","Pioneer Acquisition I Corp Class A",1,0,0],["PACHU","Pioneer Acquisition I Corp",1,0,0],["PACK","Ranpak Holdings Corp Class A",125,459,0],["PACS","PACS Group Inc.",126,5699,0],["PAG","Penske Automotive Group Inc.",97,10949,0],["PAGP","Plains GP Holdings L.P. Class A",107,3701,0],["PAGS","PagSeguro Digital Ltd. Class A",15,3151,0],["PAHC","Phibro Animal Health Corporation Class A",8,1510,0],["PAI","Western Asset Investment Grade Income Fund Inc.",81,0,0],["PAII","Pyrophyte Acquisition Corp. II Class A",1,0,0],["PAII.U","PAII.U",1,0,0],["PAL","Proficient Auto Logistics Inc.",87,271,0],["PALC","PALC",1,0,0],["PALD","PALD",1,0,0],["PALI","Palisade Bio Inc.",13,273,0],["PALL","PALL",1,0,0],["PALU","PALU",1,0,0],["PAM","Pampa Energia S.A.",41,4876,0],["PAMC","PAMC",1,0,0],["PAMT","PAMT CORP",63,225,0],["PANG","PANG",1,0,0],["PANL","Pangaea Logistics Solutions Ltd.",98,451,0],["PANW","Palo Alto Networks Inc.",53,130255,0],["PAPI","PAPI",1,0,0],["PAPL","Pineapple Financial Inc.",44,3,0],["PAR","PAR Technology Corporation",92,1507,0],["PARK","Park Dental Partners Inc.",137,72,0],["PARR","Par Pacific Holdings Inc. ",59,1899,0],["PASG","Passage Bio Inc.",13,30,0],["PASW","Ping An Biomedical Co. Ltd.",86,12,0],["PATH","UiPath Inc. Class A",25,8620,0],["PATK","Patrick Industries Inc.",42,3684,0],["PATN","PATN",1,0,0],["PAVM","PAVmed Inc.",31,9,0],["PAVS","Paranovus Entertainment Technology Ltd. Class A",18,2,0],["PAX","Patria Investments Limited Class A",11,2477,0],["PAXS","PIMCO Access Income Fund",11,0,0],["PAY","Paymentus Holdings Inc. Class A",36,3775,0],["PAYC","Paycom Software Inc.",25,9156,0],["PAYO","Payoneer Global Inc.",36,2067,0],["PAYS","Paysign Inc.",15,293,0],["PAYX","Paychex Inc.",12,40409,0],["PB","Prosperity Bancshares Inc.",26,6782,0],["PBA","Pembina Pipeline Corp.",59,21423,0],["PBBK","PB Bankshares Inc.",43,58,0],["PBD","PBD",1,0,0],["PBDC","PBDC",1,0,0],["PBE","PBE",1,0,0],["PBEU","PBEU",1,0,0],["PBF","PBF Energy Inc. Class A",106,3053,0],["PBFS","Pioneer Bancorp Inc.",43,367,0],["PBH","Prestige Consumer Healthcare Inc.",8,2969,0],["PBHC","Pathfinder Bancorp Inc.",26,87,0],["PBI","Pitney Bowes Inc.",92,1709,0],["PBI/PB","PBI/PB",1,0,0],["PBJ","PBJ",1,0,0],["PBM","Psyence Biomedical Ltd.",8,2,0],["PBOG","PBOG",1,0,0],["PBOT","PBOT",1,0,0],["PBPH","PBPH",1,0,0],["PBQQ","PBQQ",1,0,0],["PBR","Petroleo Brasileiro S.A. Petrobras ADS",59,75721,0],["PBR.A","PBR.A",1,0,0],["PBRG","PBRG",1,0,0],["PBT","Permian Basin Royalty Trust",59,780,0],["PBW","PBW",1,0,0],["PBYI","Puma Biotechnology Inc",8,284,0],["PCAP","ProCap Acquisition Corp Class A",2,0,0],["PCAPU","ProCap Acquisition Corp Unit",1,0,0],["PCAR","PACCAR Inc.",119,58597,0],["PCB","PCB Bancorp",26,326,0],["PCCE","PCCE",1,0,0],["PCEF","PCEF",1,0,0],["PCEM","PCEM",1,0,0],["PCF","High Income Securities Fund",81,0,0],["PCFI","PCFI",1,0,0],["PCG","Pacific Gas & Electric Co.",129,42088,0],["PCG/PA","PCG/PA",1,0,0],["PCG/PB","PCG/PB",1,0,0],["PCG/PC","PCG/PC",1,0,0],["PCG/PD","PCG/PD",1,0,0],["PCG/PE","PCG/PE",1,0,0],["PCG/PG","PCG/PG",1,0,0],["PCG/PH","PCG/PH",1,0,0],["PCG/PI","PCG/PI",1,0,0],["PCG/PX","PCG/PX",1,0,0],["PCGG","PCGG",1,0,0],["PCH","PotlatchDeltic Corporation",30,3065,0],["PCHI","PCHI",1,0,0],["PCIG","PCIG",1,0,0],["PCLA","PicoCELA Inc.",91,3,0],["PCLG","PCLG",1,0,0],["PCLN","PCLN",1,0,0],["PCLO","PCLO",1,0,0],["PCM","PCM Fund Inc.",81,0,0],["PCMM","PCMM",1,0,0],["PCN","Pimco Corporate & Income Strategy Fund",11,0,0],["PCOR","Procore Technologies Inc.",25,11525,0],["PCQ","PIMCO California Municipal Income Fund",11,0,0],["PCR","PCR",1,0,0],["PCRB","PCRB",1,0,0],["PCRX","Pacira BioSciences Inc.",8,1134,0],["PCSA","Processa Pharmaceuticals Inc.",8,9,0],["PCSC","Perceptive Capital Solutions Corp Class A",1,0,0],["PCT","PureCycle Technologies Inc.",34,1600,0],["PCTTU","PureCycle Technologies Inc. Unit",34,1753,0],["PCTY","Paylocity Holding Corporation",25,8312,0],["PCVX","Vaxcyte Inc.",8,6077,0],["PCY","PCY",1,0,0],["PCYO","Pure Cycle Corporation",70,273,0],["PD","PagerDuty Inc.",25,1177,0],["PDBA","PDBA",1,0,0],["PDBC","PDBC",1,0,0],["PDCC","Pearl Diver Credit Company Inc.",1,0,0],["PDD","PDD Holdings Inc.",15,155465,0],["PDDL","PDDL",1,0,0],["PDEX","Pro-Dex Inc.",31,126,0],["PDFS","PDF Solutions Inc.",25,1104,0],["PDI","PIMCO Dynamic Income Fund",81,4305,0],["PDLB","Ponce Financial Group Inc.",84,409,0],["PDM","Piedmont Realty Trust Inc. Class A",134,1041,0],["PDN","PDN",1,0,0],["PDO","PIMCO Dynamic Income Opportunities Fund",81,1874,0],["PDP","PDP",1,0,0],["PDPA","Pearl Diver Credit Company Inc. 8.00% Series A",1,0,0],["PDS","Precision Drilling Corporation",59,927,0],["PDSB","PDS Biotechnology Corporation",8,44,0],["PDT","John Hancock Premium Dividend Fund",116,0,0],["PDX","PIMCO Dynamic Income Strategy Fund",123,933,0],["PDYN","Palladyne AI Corp.",25,186,0],["PEB","Pebblebrook Hotel Trust",30,1307,0],["PEB/PE","PEB/PE",1,0,0],["PEB/PF","PEB/PF",1,0,0],["PEB/PG","PEB/PG",1,0,0],["PEB/PH","PEB/PH",1,0,0],["PEBK","Peoples Bancorp of North Carolina Inc.",26,207,0],["PEBO","Peoples Bancorp Inc.",26,1117,0],["PECO","Phillips Edison & Company Inc.",30,4535,0],["PED","Pedevco Corp.",59,51,0],["PEG","Public Service Enterprise Group Incorporated",129,39937,0],["PEGA","Pegasystems Inc.",15,10382,0],["PEJ","PEJ",1,0,0],["PELI","Pelican Acquisition Corporation",2,0,0],["PELIU","Pelican Acquisition Corporation Unit",2,0,0],["PEMX","PEMX",1,0,0],["PEN","Penumbra Inc.",31,12371,0],["PENG","Penguin Solutions Inc.",6,1040,0],["PENN","PENN Entertainment Inc.",47,1940,0],["PEO","Adams Natural Resources Fund Inc.",123,0,0],["PEP","PepsiCo Inc.",46,202585,0],["PEPG","PepGen Inc.",8,373,0],["PEPS","PEPS",1,0,0],["PERF","Perfect Corp. Class A",25,184,0],["PERI","Perion Network Ltd.",15,445,0],["PESI","Perma-Fix Environmental Services Inc.",122,245,0],["PETS","PetMed Express Inc.",142,76,0],["PETZ","TDH Holdings Inc.",27,10,0],["PEVC","PEVC",1,0,0],["PEW","GrabAGun Digital Holdings Inc.",66,95,0],["PEXL","PEXL",1,0,0],["PEY","PEY",1,0,0],["PEZ","PEZ",1,0,0],["PFAI","Pinnacle Food Group Limited Class A",48,26,0],["PFBC","Preferred Bank",26,1441,0],["PFD","Flaherty & Crumrine Preferred and Income Fund Incorporated",11,0,0],["PFE","Pfizer Inc.",8,143223,0],["PFF","PFF",1,0,0],["PFFA","PFFA",1,0,0],["PFFD","PFFD",1,0,0],["PFFL","PFFL",1,0,0],["PFFR","PFFR",1,0,0],["PFFV","PFFV",1,0,0],["PFG","Principal Financial Group Inc",143,19542,0],["PFGC","Performance Food Group Company",103,14373,0],["PFH","Prudential Financial Inc. 4.125% Junior Subordinated Notes due 2060",5,6226,0],["PFI","PFI",1,0,0],["PFIG","PFIG",1,0,0],["PFIS","Peoples Financial Services Corp.",26,511,0],["PFIX","PFIX",1,0,0],["PFL","PIMCO Income Strategy Fund Shares of Beneficial Interest",116,0,0],["PFLD","PFLD",1,0,0],["PFLT","PennantPark Floating Rate Capital Ltd.",44,896,0],["PFM","PFM",1,0,0],["PFN","PIMCO Income Strategy Fund II",123,0,0],["PFO","Flaherty & Crumrine Preferred and Income Opportunity Fund Incorporated",116,0,0],["PFRL","PFRL",1,0,0],["PFS","Provident Financial Services Inc",84,2731,0],["PFSA","Profusa Inc.",31,8,0],["PFSI","PennyMac Financial Services Inc.",44,6996,0],["PFUT","PFUT",1,0,0],["PFX","PhenixFIN Corporation",44,92,0],["PFXF","PFXF",1,0,0],["PFXNZ","PhenixFIN Corporation 5.25% Notes due 2028",44,47,0],["PG","Procter & Gamble Company (The)",90,337565,0],["PGAC","Pantages Capital Acquisition Corporation Class A",1,0,0],["PGACU","PGACU",1,0,0],["PGC","Peapack-Gladstone Financial Corporation",75,520,0],["PGEN","Precigen Inc.",8,1529,0],["PGF","PGF",1,0,0],["PGHY","PGHY",1,0,0],["PGJ","PGJ",1,0,0],["PGNY","Progyny Inc.",137,2296,0],["PGP","Pimco Global StocksPlus & Income Fund",116,0,0],["PGR","Progressive Corporation (The)",22,131517,0],["PGRI","PGRI",1,0,0],["PGRO","PGRO",1,0,0],["PGX","PGX",1,0,0],["PGY","Pagaya Technologies Ltd. Class A",44,1883,0],["PGZ","Principal Real Estate Income Fund",11,0,0],["PH","Parker-Hannifin Corporation",55,110389,0],["PHAR","Pharming Group N.V. ADS each representing 10",8,1137,0],["PHAT","Phathom Pharmaceuticals Inc.",8,1247,0],["PHB","PHB",1,0,0],["PHDG","PHDG",1,0,0],["PHEQ","PHEQ",1,0,0],["PHG","Koninklijke Philips N.V. NY Registry Shares",132,24663,0],["PHGE","BiomX Inc.",13,3,0],["PHI","PLDT Inc. Sponsored ADR",33,4559,0],["PHIN","PHINIA Inc.",42,2327,0],["PHIO","Phio Pharmaceuticals Corp.",8,25,0],["PHK","Pimco High Income Fund",123,0,0],["PHM","PulteGroup Inc.",121,23339,0],["PHO","PHO",1,0,0],["PHOE","Phoenix Asia Holdings Limited",82,354,0],["PHR","Phreesia Inc.",36,998,0],["PHUN","Phunware Inc.",15,39,0],["PHVS","Pharvaris N.V.",8,1394,0],["PHXE/P","PHXE/P",1,0,0],["PHYD","PHYD",1,0,0],["PHYL","PHYL",1,0,0],["PHYS","PHYS",1,0,0],["PI","Impinj Inc.",7,5214,0],["PICB","PICB",1,0,0],["PID","PID",1,0,0],["PIE","PIE",1,0,0],["PIFI","PIFI",1,0,0],["PII","Polaris Inc.",32,3913,0],["PIII","P3 Health Partners Inc. Class A",35,30,0],["PILL","PILL",1,0,0],["PIM","Putnam Master Intermediate Income Trust",116,163,0],["PIN","PIN",1,0,0],["PINE","Alpine Income Property Trust Inc.",30,233,0],["PINE/PA","PINE/PA",1,0,0],["PINK","PINK",1,0,0],["PINS","Pinterest Inc. Class A",16,17619,0],["PIO","PIO",1,0,0],["PIPR","Piper Sandler Companies",60,6137,0],["PIZ","PIZ",1,0,0],["PJFG","PJFG",1,0,0],["PJFV","PJFV",1,0,0],["PJIO","PJIO",1,0,0],["PJP","PJP",1,0,0],["PJT","PJT Partners Inc. Class A",11,4089,0],["PK","Park Hotels & Resorts Inc.",47,2183,0],["PKB","PKB",1,0,0],["PKBK","Parke Bancorp Inc.",26,291,0],["PKE","Park Aerospace Corp.",21,427,0],["PKG","Packaging Corporation of America",125,18249,0],["PKOH","Park-Ohio Holdings Corp.",32,325,0],["PKST","Peakstone Realty Trust",30,526,0],["PKW","PKW",1,0,0],["PKX","POSCO HOLDINGS INC.",27,16859,0],["PL","Planet Labs PBC Class A",49,6016,0],["PLAB","Photronics Inc.",6,1954,0],["PLAG","Planet Green Holdings Corp.",17,19,0],["PLAY","Dave & Buster\'s Entertainment Inc.",68,590,0],["PLBC","Plumas Bancorp",116,321,0],["PLBL","Polibeli Group Ltd Class A",133,4369,0],["PLBY","Playboy Inc.",66,198,0],["PLCE","Children\'s Place Inc. (The)",120,96,0],["PLD","Prologis Inc.",30,118180,0],["PLDR","PLDR",1,0,0],["PLG","Platinum Group Metals Ltd.",104,299,0],["PLMK","Plum Acquisition Corp. IV Class A",1,0,0],["PLMR","Palomar Holdings Inc.",22,3577,0],["PLNT","Planet Fitness Inc.",47,9278,0],["PLOW","Douglas Dynamics Inc.",72,776,0],["PLPC","Preformed Line Products Company",128,1055,0],["PLRX","Pliant Therapeutics Inc.",8,76,0],["PLRZ","Polyrizon Ltd.",8,15,0],["PLSE","Pulse Biosciences Inc",31,1034,0],["PLT","PLT",1,0,0],["PLTA","PLTA",1,0,0],["PLTD","PLTD",1,0,0],["PLTG","PLTG",1,0,0],["PLTK","Playtika Holding Corp.",15,1546,0],["PLTM","PLTM",1,0,0],["PLTR","Palantir Technologies Inc. Class A",25,460909,0],["PLTU","PLTU",1,0,0],["PLTY","PLTY",1,0,0],["PLTZ","PLTZ",1,0,0],["PLUG","Plug Power Inc.",7,3064,0],["PLUR","Pluri Inc.",13,31,0],["PLUS","ePlus inc.",100,2367,0],["PLUT","Plutus Financial Group Limited",60,48,0],["PLX","Protalix BioTherapeutics Inc. (DE)",13,139,0],["PLXS","Plexus Corp.",39,4104,0],["PLYM","Plymouth Industrial REIT Inc.",30,975,0],["PLYY","PLYY",1,0,0],["PM","Philip Morris International Inc",18,244143,0],["PMAX","Powell Max Limited Class A",3,28,0],["PMBS","PMBS",1,0,0],["PMCB","PharmaCyte Biotech Inc.",13,6,0],["PMEC","Primech Holdings Ltd.",12,41,0],["PMI","Picard Medical Inc.",31,172,0],["PMIO","PMIO",1,0,0],["PML","Pimco Municipal Income Fund II",11,0,0],["PMM","Putnam Managed Municipal Income Trust",11,300,0],["PMMF","PMMF",1,0,0],["PMN","ProMIS Neurosciences Inc.",8,18,0],["PMNT","Perfect Moment Ltd.",86,17,0],["PMO","Putnam Municipal Opportunities Trust",116,354,0],["PMT","PennyMac Mortgage Investment Trust",30,1147,0],["PMT/PA","PMT/PA",1,0,0],["PMT/PB","PMT/PB",1,0,0],["PMT/PC","PMT/PC",1,0,0],["PMTR","Perimeter Acquisition Corp. I Class A",2,0,0],["PMTRU","Perimeter Acquisition Corp. I Unit",2,0,0],["PMTS","CPI Card Group Inc.",109,180,0],["PMTU","PennyMac Mortgage Investment Trust 8.50% Senior Notes due 2028",30,2207,0],["PMTV","PennyMac Mortgage Investment Trust 9.00% Senior Notes due 2030",30,0,0],["PMTW","PennyMac Mortgage Investment Trust 9.00% Senior Notes due 2030",30,0,0],["PMVP","PMV Pharmaceuticals Inc.",8,66,0],["PN","Skycorp Solar Group Limited",100,29,0],["PNBK","Patriot National Bancorp Inc.",26,221,0],["PNC","PNC Financial Services Group Inc. (The)",26,82432,0],["PNFP","Pinnacle Financial Partners Inc.",26,7807,0],["PNFPP","Pinnacle Financial Partners Inc.",26,1940,0],["PNI","Pimco New York Municipal Income Fund II",81,0,0],["PNNT","PennantPark Investment Corporation",44,382,0],["PNQI","PNQI",1,0,0],["PNR","Pentair plc.",7,16997,0],["PNRG","PrimeEnergy Resources Corporation",59,275,0],["PNTG","The Pennant Group Inc.",35,1015,0],["PNW","Pinnacle West Capital Corporation",41,10449,0],["POAS","Phaos Technology Holdings (Cayman) Limited Class A",7,107,0],["POCI","Precision Optics Corporation Inc.",77,31,0],["PODC","PodcastOne Inc.",16,60,0],["PODD","Insulet Corporation",31,20374,0],["POET","POET Technologies Inc.",6,617,0],["POLA","Polar Power Inc.",7,5,0],["POLE","Andretti Acquisition Corp. II Class A",1,0,0],["POLEU","POLEU",1,0,0],["POM","POMDOCTOR LIMITED",66,36,0],["PONY","Pony AI Inc.",15,5663,0],["POOL","Pool Corporation",32,8642,0],["POR","Portland General Electric Co",41,5368,0],["POST","Post Holdings Inc.",17,5259,0],["POW","POW",1,0,0],["POWA","POWA",1,0,0],["POWI","Power Integrations Inc.",6,2024,0],["POWL","Powell Industries Inc.",39,4025,0],["POWR","POWR",1,0,0],["POWW","Outdoor Holding Company",78,218,0],["POWWP","Outdoor Holding Company 8.75% Series A Cumulative Redeemable Perpetual",78,2811,0],["PPA","PPA",1,0,0],["PPBT","Purple Biotech Ltd.",8,2,0],["PPC","Pilgrim\'s Pride Corporation",62,9369,0],["PPCB","Propanc Biopharma Inc.",8,10,0],["PPEM","PPEM",1,0,0],["PPG","PPG Industries Inc.",149,23041,0],["PPH","PPH",1,0,0],["PPI","PPI",1,0,0],["PPIE","PPIE",1,0,0],["PPIH","Perma-Pipe International Holdings Inc.",101,261,0],["PPL","PPL Corporation",41,25366,0],["PPLT","PPLT",1,0,0],["PPSI","Pioneer Power Solutions Inc.",39,42,0],["PPT","Putnam Premier Income Trust",116,351,0],["PPTA","Perpetua Resources Corp.",104,3364,0],["PPTY","PPTY",1,0,0],["PQAP","PQAP",1,0,0],["PQDI","PQDI",1,0,0],["PQJA","PQJA",1,0,0],["PQJL","PQJL",1,0,0],["PQNT","PQNT",1,0,0],["PQOC","PQOC",1,0,0],["PR","Permian Resources Corporation Class A",59,11461,0],["PRA","ProAssurance Corporation",22,1239,0],["PRAA","PRA Group Inc.",44,661,0],["PRAE","PRAE",1,0,0],["PRAX","Praxis Precision Medicines Inc.",8,6825,0],["PRAY","PRAY",1,0,0],["PRCH","Porch Group Inc.",25,1106,0],["PRCS","PRCS",1,0,0],["PRCT","PROCEPT BioRobotics Corporation",31,1791,0],["PRDO","Perdoceo Education Corporation",3,1886,0],["PRE","Prenetics Global Limited Class A",2,228,0],["PREF","PREF",1,0,0],["PRF","PRF",1,0,0],["PRFD","PRFD",1,0,0],["PRFX","PainReform Ltd.",8,2,0],["PRFZ","PRFZ",1,0,0],["PRG","PROG Holdings Inc.",12,1184,0],["PRGO","Perrigo Company plc",8,1821,0],["PRGS","Progress Software Corporation",25,1845,0],["PRH","Prudential Financial Inc. 5.950% Junior Subordinated Notes due 2062",5,8744,0],["PRHI","Presurance Holdings Inc.",22,11,0],["PRHIZ","Presurance Holdings Inc. 9.75% Senior Unsecured Notes due 2028",22,214,0],["PRI","Primerica Inc.",5,8261,0],["PRIF/PD","PRIF/PD",1,0,0],["PRIF/PJ","PRIF/PJ",1,0,0],["PRIF/PK","PRIF/PK",1,0,0],["PRIF/PL","PRIF/PL",1,0,0],["PRIM","Primoris Services Corporation",128,6764,0],["PRIV","PRIV",1,0,0],["PRK","Park National Corporation",26,2607,0],["PRKS","United Parks & Resorts Inc.",77,1891,0],["PRLB","Proto Labs Inc.",55,1234,0],["PRLD","Prelude Therapeutics Incorporated",8,135,0],["PRM","Perimeter Solutions SA",34,4188,0],["PRMB","Primo Brands Corporation Class A",46,5887,0],["PRME","Prime Medicine Inc.",13,657,0],["PRMR","PRMR",1,0,0],["PRN","PRN",1,0,0],["PROF","Profound Medical Corp.",31,229,0],["PROK","ProKidney Corp. Class A",13,713,0],["PROP","Prairie Operating Co.",44,100,0],["PROV","Provident Financial Holdings Inc.",84,103,0],["PRPH","ProPhase Labs Inc.",8,4,0],["PRPL","Purple Innovation Inc.",73,81,0],["PRPO","Precipio Inc. ",71,39,0],["PRQR","ProQR Therapeutics N.V.",8,233,0],["PRS","Prudential Financial Inc. 5.625% Junior Subordinated Notes due 2058",5,8427,0],["PRSD","PRSD",1,0,0],["PRSO","Peraso Inc.",6,10,0],["PRSU","Pursuit Attractions and Hospitality Inc.",36,991,0],["PRT","PermRock Royalty Trust",59,47,0],["PRTA","Prothena Corporation plc",8,496,0],["PRTC","PureTech Health plc",8,412,0],["PRTH","Priority Technology Holdings Inc.",36,459,0],["PRTS","CarParts.com Inc.",141,31,0],["PRU","Prudential Financial Inc.",5,44813,0],["PRVA","Privia Health Group Inc.",35,2908,0],["PRVS","PRVS",1,0,0],["PRXG","PRXG",1,0,0],["PRXV","PRXV",1,0,0],["PRZO","ParaZero Technologies Ltd.",21,19,0],["PSA","Public Storage",30,45471,0],["PSA/PF","PSA/PF",1,0,0],["PSA/PG","PSA/PG",1,0,0],["PSA/PH","PSA/PH",1,0,0],["PSA/PI","PSA/PI",1,0,0],["PSA/PJ","PSA/PJ",1,0,0],["PSA/PK","PSA/PK",1,0,0],["PSA/PL","PSA/PL",1,0,0],["PSA/PM","PSA/PM",1,0,0],["PSA/PN","PSA/PN",1,0,0],["PSA/PO","PSA/PO",1,0,0],["PSA/PP","PSA/PP",1,0,0],["PSA/PQ","PSA/PQ",1,0,0],["PSA/PR","PSA/PR",1,0,0],["PSA/PS","PSA/PS",1,0,0],["PSBD","Palmer Square Capital BDC Inc.",1,0,0],["PSC","PSC",1,0,0],["PSCC","PSCC",1,0,0],["PSCD","PSCD",1,0,0],["PSCE","PSCE",1,0,0],["PSCF","PSCF",1,0,0],["PSCH","PSCH",1,0,0],["PSCI","PSCI",1,0,0],["PSCM","PSCM",1,0,0],["PSCT","PSCT",1,0,0],["PSCU","PSCU",1,0,0],["PSEC","Prospect Capital Corporation",44,1158,0],["PSEC/PA","PSEC/PA",1,0,0],["PSET","PSET",1,0,0],["PSF","Cohen & Steers Select Preferred and Income Fund Inc.",11,991,0],["PSFE","Paysafe Limited",36,481,0],["PSHG","Performance Shipping Inc.",98,28,0],["PSI","PSI",1,0,0],["PSIG","PS International Group Ltd.",105,36,0],["PSIL","PSIL",1,0,0],["PSIX","Power Solutions International Inc.",7,1584,0],["PSK","PSK",1,0,0],["PSKY","Paramount Skydance Corporation Class B",83,14396,0],["PSL","PSL",1,0,0],["PSLV","PSLV",1,0,0],["PSMT","PriceSmart Inc.",113,3851,0],["PSN","Parsons Corporation",15,6536,0],["PSNL","Personalis Inc.",23,759,0],["PSNY","Polestar Automotive Holding UK PLC Class A ADS",37,985,0],["PSNYW","Polestar Automotive Holding UK PLC Class C-1 ADS (ADW)",37,423,0],["PSO","Pearson Plc",145,8945,0],["PSP","PSP",1,0,0],["PSQ","PSQ",1,0,0],["PSQA","PSQA",1,0,0],["PSQH","PSQ Holdings Inc. Class A",58,47,0],["PSQO","PSQO",1,0,0],["PSR","PSR",1,0,0],["PST","PST",1,0,0],["PSTG","Pure Storage Inc. Class A",76,22825,0],["PSTL","Postal Realty Trust Inc. Class A",30,420,0],["PSTP","PSTP",1,0,0],["PSTR","PSTR",1,0,0],["PSTV","PLUS THERAPEUTICS Inc.",31,78,0],["PSWD","PSWD",1,0,0],["PSX","Phillips 66",106,51933,0],["PT","Pintec Technology Holdings Limited",16,15,0],["PTA","Cohen & Steers Tax-Advantaged Preferred Securities and Income Fund",81,1064,0],["PTBD","PTBD",1,0,0],["PTC","PTC Inc.",25,21282,0],["PTCT","PTC Therapeutics Inc.",8,6308,0],["PTEN","Patterson-UTI Energy Inc.",59,2211,0],["PTF","PTF",1,0,0],["PTGX","Protagonist Therapeutics Inc.",8,5379,0],["PTH","PTH",1,0,0],["PTHL","Pheton Holdings Ltd Class A",77,7,0],["PTHS","Pelthos Therapeutics Inc.",13,78,0],["PTIN","PTIN",1,0,0],["PTIR","PTIR",1,0,0],["PTIX","Protagenic Therapeutics Inc.",8,2,0],["PTL","PTL",1,0,0],["PTLE","PTL LTD Class A",80,10,0],["PTLO","Portillo\'s Inc. Class A",68,347,0],["PTN","Palatin Technologies Inc.",8,29,0],["PTNQ","PTNQ",1,0,0],["PTON","Peloton Interactive Inc. Class A",61,2590,0],["PTRB","PTRB",1,0,0],["PTRN","Pattern Group Inc. Series A",57,1840,0],["PTY","Pimco Corporate & Income Opportunity Fund",11,0,0],["PUBM","PubMatic Inc. Class A",16,410,0],["PUI","PUI",1,0,0],["PUK","Prudential Public Limited Company",5,39402,0],["PULM","Pulmatrix Inc.",8,9,0],["PULS","PULS",1,0,0],["PULT","PULT",1,0,0],["PUMP","ProPetro Holding Corp.",20,947,0],["PURR","Hyperliquid Strategies Inc",8,433,0],["PUSH","PUSH",1,0,0],["PVAL","PVAL",1,0,0],["PVH","PVH Corp.",118,3234,0],["PVI","PVI",1,0,0],["PVL","Permianville Royalty Trust",59,58,0],["PVLA","Palvella Therapeutics Inc.",8,1180,0],["PW","Power REIT (MD)",30,3,0],["PW/PA","PW/PA",1,0,0],["PWB","PWB",1,0,0],["PWER","PWER",1,0,0],["PWP","Perella Weinberg Partners Class A",44,1545,0],["PWR","Quanta Services Inc.",82,63622,0],["PWRD","PWRD",1,0,0],["PWV","PWV",1,0,0],["PWZ","PWZ",1,0,0],["PX","P10 Inc. Class A",11,1090,0],["PXE","PXE",1,0,0],["PXED","Phoenix Education Partners Inc.",3,1177,0],["PXF","PXF",1,0,0],["PXH","PXH",1,0,0],["PXI","PXI",1,0,0],["PXJ","PXJ",1,0,0],["PXLW","Pixelworks Inc. ",6,40,0],["PXS","Pyxis Tankers Inc.",98,31,0],["PY","PY",1,0,0],["PYLD","PYLD",1,0,0],["PYPD","PolyPid Ltd.",8,40,0],["PYPG","PYPG",1,0,0],["PYPL","PayPal Holdings Inc.",12,55961,0],["PYPY","PYPY",1,0,0],["PYT","PPlus Tr GSC-2 Tr Ctf Fltg Rate",44,0,0],["PYXS","Pyxis Oncology Inc.",8,116,0],["PYZ","PYZ",1,0,0],["PZA","PZA",1,0,0],["PZG","Paramount Gold Nevada Corp.",10,93,0],["PZT","PZT",1,0,0],["PZZA","Papa John\'s International Inc.",68,1340,0],["Q","Qnity Electronics Inc.",6,16694,0],["QABA","QABA",1,0,0],["QAI","QAI",1,0,0],["QALT","QALT",1,0,0],["QARP","QARP",1,0,0],["QAT","QAT",1,0,0],["QB","QB",1,0,0],["QBIG","QBIG",1,0,0],["QBTS","D-Wave Quantum Inc.",15,9390,0],["QBTZ","QBTZ",1,0,0],["QBUF","QBUF",1,0,0],["QBY","QBY",1,0,0],["QCLN","QCLN",1,0,0],["QCLR","QCLR",1,0,0],["QCLS","Q/C Technologies Inc.",24,20,0],["QCMD","QCMD",1,0,0],["QCML","QCML",1,0,0],["QCMU","QCMU",1,0,0],["QCOM","QUALCOMM Incorporated",49,187693,0],["QCRH","QCR Holdings Inc.",26,1441,0],["QD","Qudian Inc.",44,632,0],["QDEF","QDEF",1,0,0],["QDEL","QuidelOrtho Corporation",24,1967,0],["QDF","QDF",1,0,0],["QDIV","QDIV",1,0,0],["QDPL","QDPL",1,0,0],["QDTY","QDTY",1,0,0],["QDVO","QDVO",1,0,0],["QEFA","QEFA",1,0,0],["QEMM","QEMM",1,0,0],["QETA","Quetta Acquisition Corporation",2,0,0],["QFIN","Qfin Holdings Inc.",44,2556,0],["QFLR","QFLR",1,0,0],["QGEN","Qiagen N.V.",13,9851,0],["QGRO","QGRO",1,0,0],["QGRW","QGRW",1,0,0],["QH","Quhuo Limited American Depository Shares",36,1,0],["QHDG","QHDG",1,0,0],["QID","QID",1,0,0],["QIDX","QIDX",1,0,0],["QINT","QINT",1,0,0],["QIPT","Quipt Home Medical Corp.",137,155,0],["QIS","QIS",1,0,0],["QLD","QLD",1,0,0],["QLDY","QLDY",1,0,0],["QLTA","QLTA",1,0,0],["QLTI","QLTI",1,0,0],["QLTY","QLTY",1,0,0],["QLV","QLV",1,0,0],["QLVD","QLVD",1,0,0],["QLVE","QLVE",1,0,0],["QLYS","Qualys Inc.",25,5119,0],["QMCO","Quantum Corporation",76,100,0],["QMID","QMID",1,0,0],["QMOM","QMOM",1,0,0],["QNCX","Quince Therapeutics Inc.",13,199,0],["QNRX","Quoin Pharmaceuticals Ltd.",31,154,0],["QNST","QuinStreet Inc.",36,821,0],["QNTM","Quantum Biopharma Ltd. Class B Subordinate Voting Shares",8,34,0],["QNXT","QNXT",1,0,0],["QOWZ","QOWZ",1,0,0],["QPUX","QPUX",1,0,0],["QPX","QPX",1,0,0],["QQA","QQA",1,0,0],["QQDN","QQDN",1,0,0],["QQEW","QQEW",1,0,0],["QQH","QQH",1,0,0],["QQHG","QQHG",1,0,0],["QQJG","QQJG",1,0,0],["QQLV","QQLV",1,0,0],["QQMG","QQMG",1,0,0],["QQQ","QQQ",1,0,0],["QQQA","QQQA",1,0,0],["QQQD","QQQD",1,0,0],["QQQE","QQQE",1,0,0],["QQQG","QQQG",1,0,0],["QQQH","QQQH",1,0,0],["QQQI","QQQI",1,0,0],["QQQJ","QQQJ",1,0,0],["QQQM","QQQM",1,0,0],["QQQP","QQQP",1,0,0],["QQQS","QQQS",1,0,0],["QQQT","QQQT",1,0,0],["QQQU","QQQU",1,0,0],["QQQX","Nuveen NASDAQ 100 Dynamic Overwrite Fund Shares of Beneficial Interest",116,0,0],["QQQY","QQQY",1,0,0],["QQUP","QQUP",1,0,0],["QQWZ","QQWZ",1,0,0],["QQXL","QQXL",1,0,0],["QQXT","QQXT",1,0,0],["QRFT","QRFT",1,0,0],["QRHC","Quest Resource Holding Corporation",122,44,0],["QRMI","QRMI",1,0,0],["QRVO","Qorvo Inc.",6,7912,0],["QS","QuantumScape Corporation Class A",7,6873,0],["QSEA","Quartzsea Acquisition Corporation",2,0,0],["QSEAU","QSEAU",1,0,0],["QSI","Quantum-Si Incorporated Class A",7,274,0],["QSIX","QSIX",1,0,0],["QSML","QSML",1,0,0],["QSR","Restaurant Brands International Inc.",68,31858,0],["QSU","QSU",1,0,0],["QTEC","QTEC",1,0,0],["QTOP","QTOP",1,0,0],["QTPI","QTPI",1,0,0],["QTR","QTR",1,0,0],["QTRX","Quanterix Corporation",71,308,0],["QTTB","Q32 Bio Inc.",8,36,0],["QTUM","QTUM",1,0,0],["QTWO","Q2 Holdings Inc.",25,4636,0],["QUAD","Quad Graphics Inc Class A",109,329,0],["QUBT","Quantum Computing Inc.",25,2441,0],["QUIK","QuickLogic Corporation",6,109,0],["QUIZ","QUIZ",1,0,0],["QULL","QULL",1,0,0],["QUMS","Quantumsphere Acquisition Corp.",1,0,0],["QUMSU","Quantumsphere Acquisition Corp.",1,0,0],["QURE","uniQure N.V.",8,1494,0],["QUS","QUS",1,0,0],["QUSA","QUSA",1,0,0],["QVAL","QVAL",1,0,0],["QVCGA","QVC Group Inc. Series A",57,101,0],["QVCGP","QVC Group Inc. 8.0% Fixed Rate Cumulative Redeemable",57,33,0],["QVML","QVML",1,0,0],["QVMM","QVMM",1,0,0],["QVMS","QVMS",1,0,0],["QWLD","QWLD",1,0,0],["QXO","QXO Inc.",130,14702,0],["QXO/PB","QXO/PB",1,0,0],["QXQ","QXQ",1,0,0],["QYLD","QYLD",1,0,0],["QYLG","QYLG",1,0,0],["R","Ryder System Inc.",96,7735,0],["RA","Brookfield Real Assets Income Fund Inc.",11,0,0],["RAA","RAA",1,0,0],["RAAA","RAAA",1,0,0],["RAAQ","Real Asset Acquisition Corp. Class A",1,0,0],["RAAQU","Real Asset Acquisition Corp. Unit",2,0,0],["RAAX","RAAX",1,0,0],["RAC","Rithm Acquisition Corp. Class A",1,0,0],["RAC.U","RAC.U",1,0,0],["RACE","Ferrari N.V.",37,91689,0],["RADX","Radiopharm Theranostics Limited",8,66,0],["RAFE","RAFE",1,0,0],["RAIL","FreightCar America Inc.",117,173,0],["RAIN","Rain Enhancement Technologies Holdco Inc. Class A",7,60,0],["RAL","Ralliant Corporation",7,5896,0],["RAMP","LiveRamp Holdings Inc.",15,1886,0],["RAND","Rand Capital Corporation",44,40,0],["RANG","Range Capital Acquisition Corp.",1,0,0],["RANI","Rani Therapeutics Holdings Inc. Class A",8,183,0],["RAPP","Rapport Therapeutics Inc.",8,1470,0],["RAPT","RAPT Therapeutics Inc.",8,937,0],["RARE","Ultragenyx Pharmaceutical Inc.",8,3232,0],["RAUS","RAUS",1,0,0],["RAVE","Rave Restaurant Group Inc.",103,41,0],["RAVI","RAVI",1,0,0],["RAY","Raytech Holding Limited",133,4,0],["RAYA","Erayak Power Solution Group Inc. Class A",55,4,0],["RAYD","RAYD",1,0,0],["RAYE","RAYE",1,0,0],["RAYJ","RAYJ",1,0,0],["RBA","RB Global Inc.",36,19340,0],["RBB","RBB Bancorp",26,370,0],["RBBN","Ribbon Communications Inc.",15,510,0],["RBC","RBC Bearings Incorporated",55,14259,0],["RBCAA","Republic Bancorp Inc. Class A",26,1414,0],["RBIL","RBIL",1,0,0],["RBKB","Rhinebeck Bancorp Inc.",43,138,0],["RBLD","RBLD",1,0,0],["RBLX","Roblox Corporation Class A",25,57516,0],["RBLY","RBLY",1,0,0],["RBNE","Robin Energy Ltd.",98,2,0],["RBOT","Vicarious Surgical Inc. Class A",32,0,0],["RBRK","Rubrik Inc. Class A",25,15647,0],["RC","Ready Capital Corporation",30,362,0],["RC/PC","RC/PC",1,0,0],["RC/PE","RC/PE",1,0,0],["RCAT","Red Cat Holdings Inc.",25,961,0],["RCB","Ready Capital Corporation 6.20% Senior Notes due 2026",30,4026,0],["RCC","Ready Capital Corporation 5.75% Senior Notes due 2026",30,4095,0],["RCD","Ready Capital Corporation 9.00% Senior Notes due 2029",30,0,0],["RCEL","Avita Medical Inc.",31,106,0],["RCG","RENN Fund Inc",11,0,0],["RCGE","RCGE",1,0,0],["RCI","Rogers Communication Inc.",54,19783,0],["RCKT","Rocket Pharmaceuticals Inc.",8,350,0],["RCKY","Rocky Brands Inc.",114,224,0],["RCL","Royal Caribbean Cruises Ltd.",98,80066,0],["RCLO","RCLO",1,0,0],["RCMT","RCM Technologies Inc.",19,154,0],["RCON","Recon Technology Ltd. Class A",20,42,0],["RCS","PIMCO Strategic Income Fund Inc.",11,0,0],["RCT","RedCloud Holdings plc",16,61,0],["RCTR","RCTR",1,0,0],["RCUS","Arcus Biosciences Inc.",8,2373,0],["RDAC","Rising Dragon Acquisition Corp.",1,0,0],["RDACU","Rising Dragon Acquisition Corp. Unit",2,0,0],["RDAG","Republic Digital Acquisition Company Class A",2,0,0],["RDAGU","Republic Digital Acquisition Company Unit",2,0,0],["RDCM","Radcom Ltd.",53,213,0],["RDDT","Reddit Inc. Class A",15,44189,0],["RDGT","Ridgetech Inc.",142,69,0],["RDHL","Redhill Biopharma Ltd.",8,4,0],["RDI","Reading International Inc Class A",89,23,0],["RDIB","Reading International Inc Class B",89,252,0],["RDIV","RDIV",1,0,0],["RDN","Radian Group Inc.",22,4982,0],["RDNT","RadNet Inc.",23,5926,0],["RDNW","RideNow Group Inc. Class B",15,215,0],["RDOG","RDOG",1,0,0],["RDTL","RDTL",1,0,0],["RDTY","RDTY",1,0,0],["RDVT","Red Violet Inc.",25,771,0],["RDVY","RDVY",1,0,0],["RDW","Redwire Corporation",21,1321,0],["RDWR","Radware Ltd.",36,1023,0],["RDY","Dr. Reddy\'s Laboratories Ltd",8,11833,0],["RDYY","RDYY",1,0,0],["RDZN","Roadzen Inc.",28,132,0],["REAI","REAI",1,0,0],["REAL","The RealReal Inc.",66,1812,0],["REAX","The Real Brokerage Inc.",36,820,0],["REBN","Reborn Coffee Inc.",68,9,0],["RECS","RECS",1,0,0],["RECT","Rectitude Holdings Ltd",7,23,0],["REE","REE Automotive Ltd. Class A",37,20,0],["REED","Reed\'s Inc.",1,0,0],["REET","REET",1,0,0],["REFA","REFA",1,0,0],["REFI","Chicago Atlantic Real Estate Finance Inc.",30,274,0],["REFR","Research Frontiers Incorporated",29,49,0],["REG","Regency Centers Corporation",30,12538,0],["REGCO","Regency Centers Corporation 5.875% Series B Cumulative Redeemable",30,4135,0],["REGCP","Regency Centers Corporation 6.25% Series A Cumulative Redeemable",30,4332,0],["REGN","Regeneron Pharmaceuticals Inc.",8,80712,0],["REI","Ring Energy Inc.",59,177,0],["REIT","REIT",1,0,0],["REK","REK",1,0,0],["REKR","Rekor Systems Inc.",33,217,0],["REKT","REKT",1,0,0],["RELI","Reliance Global Group Inc.",28,6,0],["RELL","Richardson Electronics Ltd.",76,156,0],["RELX","RELX PLC PLC",36,74291,0],["RELY","Remitly Global Inc.",36,3056,0],["REMC","REMC",1,0,0],["REMG","REMG",1,0,0],["REMX","REMX",1,0,0],["RENT","Rent the Runway Inc. Class A",66,294,0],["RENX","RenX Enterprises Corp.",1,25,0],["REPL","Replimune Group Inc.",13,775,0],["REPX","Riley Exploration Permian Inc.",59,559,0],["RERE","ATRenew Inc.",66,1174,0],["RES","RPC Inc.",20,1224,0],["RESM","RESM",1,0,0],["RETL","RETL",1,0,0],["RETO","ReTo Eco-Solutions Inc. Class A Shares",7,3,0],["REVB","Revelation Biosciences Inc.",8,5,0],["REVG","REV Group Inc.",37,2991,0],["REVS","REVS",1,0,0],["REW","REW",1,0,0],["REX","REX American Resources Corporation",34,1117,0],["REXR","Rexford Industrial Realty Inc.",30,9585,0],["REXR/PB","REXR/PB",1,0,0],["REXR/PC","REXR/PC",1,0,0],["REYN","Reynolds Consumer Products Inc.",125,5008,0],["REZ","REZ",1,0,0],["REZI","Resideo Technologies Inc.",150,5348,0],["RF","Regions Financial Corporation",26,24254,0],["RF/PC","RF/PC",1,0,0],["RF/PE","RF/PE",1,0,0],["RF/PF","RF/PF",1,0,0],["RFAI","RF Acquisition Corp II",1,0,0],["RFCI","RFCI",1,0,0],["RFDA","RFDA",1,0,0],["RFDI","RFDI",1,0,0],["RFEM","RFEM",1,0,0],["RFEU","RFEU",1,0,0],["RFFC","RFFC",1,0,0],["RFG","RFG",1,0,0],["RFI","Cohen & Steers Total Return Realty Fund Inc.",11,535,0],["RFIL","RF Industries Ltd.",39,64,0],["RFIX","RFIX",1,0,0],["RFL","Rafael Holdings Inc. Class B",36,64,0],["RFLR","RFLR",1,0,0],["RFM","RiverNorth Flexible Municipal Income Fund Inc.",123,86,0],["RFMZ","RiverNorth Flexible Municipal Income Fund II Inc.",81,314,0],["RFV","RFV",1,0,0],["RGA","Reinsurance Group of America Incorporated",5,13517,0],["RGC","Regencell Bioscience Holdings Limited",18,9796,0],["RGCO","RGC Resources Inc.",59,239,0],["RGEF","RGEF",1,0,0],["RGEN","Repligen Corporation",13,9140,0],["RGLD","Royal Gold Inc.",104,19212,0],["RGLO","RGLO",1,0,0],["RGNT","Regentis Biomaterials Ltd.",8,32,0],["RGNX","REGENXBIO Inc.",13,739,0],["RGP","Resources Connection Inc.",36,176,0],["RGR","Sturm Ruger & Company Inc.",78,511,0],["RGS","Regis Corporation",3,72,0],["RGT","Royce Global Trust Inc.",81,81,0],["RGTI","Rigetti Computing Inc.",15,7841,0],["RGTX","RGTX",1,0,0],["RGTZ","RGTZ",1,0,0],["RGYY","RGYY",1,0,0],["RH","RH",66,3211,0],["RHI","Robert Half Inc.",19,2826,0],["RHLD","Resolute Holdings Management",44,1855,0],["RHP","Ryman Hospitality Properties Inc. (REIT)",30,6174,0],["RHRX","RHRX",1,0,0],["RHTX","RHTX",1,0,0],["RIBB","Ribbon Acquisition Corp Class A",1,0,0],["RIBBU","Ribbon Acquisition Corp Unit",1,0,0],["RICK","RCI Hospitality Holdings Inc.",68,201,0],["RIET","RIET",1,0,0],["RIFR","RIFR",1,0,0],["RIG","Transocean Ltd (Switzerland)",59,4373,0],["RIGL","Rigel Pharmaceuticals Inc.",8,755,0],["RIGS","RIGS",1,0,0],["RILA","RILA",1,0,0],["RILY","B. Riley Financial Inc.",11,154,0],["RILYG","B. Riley Financial Inc. 5.00% Senior Notes due 2026",11,588,0],["RILYK","B. Riley Financial Inc. 5.50% Senior Notes Due 2026",11,749,0],["RILYL","B. Riley Financial Inc.",11,171,0],["RILYN","B. Riley Financial Inc. 6.50% Senior Notes Due 2026",11,625,0],["RILYP","B. Riley Financial Inc.",11,162,0],["RILYT","B. Riley Financial Inc. 6.00% Senior Notes Due 2028",11,442,0],["RILYZ","B. Riley Financial Inc. 5.25% Senior Notes due 2028",11,371,0],["RIME","Algorhythm Holdings Inc.",144,4,0],["RINF","RINF",1,0,0],["RING","RING",1,0,0],["RINT","RINT",1,0,0],["RIO","Rio Tinto Plc",10,98236,0],["RIOT","Riot Platforms Inc.",44,5391,0],["RIOX","RIOX",1,0,0],["RISN","RISN",1,0,0],["RISR","RISR",1,0,0],["RITA","RITA",1,0,0],["RITM","Rithm Capital Corp.",30,6190,0],["RITM/PA","RITM/PA",1,0,0],["RITM/PB","RITM/PB",1,0,0],["RITM/PC","RITM/PC",1,0,0],["RITM/PD","RITM/PD",1,0,0],["RITM/PE","RITM/PE",1,0,0],["RITR","Reitar Logtech Holdings Limited",36,87,0],["RIV","RiverNorth Opportunities Fund Inc.",116,0,0],["RIV/PA","RIV/PA",1,0,0],["RIVN","Rivian Automotive Inc. Class A",37,27522,0],["RJDI","RJDI",1,0,0],["RJET","Republic Airways Holdings Inc.",4,56,0],["RJF","Raymond James Financial Inc.",60,32060,0],["RJF/PB","RJF/PB",1,0,0],["RJMG","RJMG",1,0,0],["RJMI","RJMI",1,0,0],["RJVI","RJVI",1,0,0],["RKDA","Arcadia Biosciences Inc.",48,5,0],["RKLB","Rocket Lab Corporation",21,37669,0],["RKLX","RKLX",1,0,0],["RKLZ","RKLZ",1,0,0],["RKT","Rocket Companies Inc. Class A",44,53727,0],["RL","Ralph Lauren Corporation",118,21984,0],["RLAY","Relay Therapeutics Inc.",13,1456,0],["RLGT","Radiant Logistics Inc.",105,303,0],["RLI","RLI Corp.",22,6028,0],["RLJ","RLJ Lodging Trust",30,1178,0],["RLJ/PA","RLJ/PA",1,0,0],["RLMD","Relmada Therapeutics Inc.",8,319,0],["RLTY","Cohen & Steers Real Estate Opportunities and Income Fund",11,0,0],["RLX","RLX Technology Inc.",18,3597,0],["RLY","RLY",1,0,0],["RLYB","Rallybio Corporation",8,33,0],["RM","Regional Management Corp.",44,394,0],["RMAX","RE/MAX Holdings Inc. Class A",36,154,0],["RMBI","Richmond Mutual Bancorporation Inc.",26,152,0],["RMBS","Rambus Inc.",6,10377,0],["RMCA","RMCA",1,0,0],["RMCF","Rocky Mountain Chocolate Factory Inc.",93,12,0],["RMCO","Royalty Management Holding Corporation Class A",29,35,0],["RMD","ResMed Inc.",31,35753,0],["RMI","RiverNorth Opportunistic Municipal Income Fund Inc.",123,93,0],["RMM","RiverNorth Managed Duration Municipal Income Fund Inc.",81,271,0],["RMMZ","RiverNorth Managed Duration Municipal Income Fund II Inc.",11,292,0],["RMNI","Rimini Street Inc. (DE)",36,364,0],["RMNY","RMNY",1,0,0],["RMOP","RMOP",1,0,0],["RMR","The RMR Group Inc. Class A",19,484,0],["RMSG","Real Messenger Corporation",16,15,0],["RMT","Royce Micro-Cap Trust Inc.",11,487,0],["RMTI","Rockwell Medical Inc.",8,33,0],["RNA","Avidity Biosciences Inc.",8,10900,0],["RNAC","Cartesian Therapeutics Inc.",8,188,0],["RNAZ","TransCode Therapeutics Inc.",8,7,0],["RND","RND",1,0,0],["RNEM","RNEM",1,0,0],["RNG","RingCentral Inc. Class A",15,2564,0],["RNGR","Ranger Energy Services Inc. Class A",20,299,0],["RNGT","Range Capital Acquisition Corp II Class A",1,0,0],["RNGTU","Range Capital Acquisition Corp II",1,0,0],["RNIN","RNIN",1,0,0],["RNP","Cohen & Steers REIT and Preferred and Income Fund Inc.",11,961,0],["RNR","RenaissanceRe Holdings Ltd.",22,12842,0],["RNR/PF","RNR/PF",1,0,0],["RNR/PG","RNR/PG",1,0,0],["RNRG","RNRG",1,0,0],["RNST","Renasant Corporation",26,3498,0],["RNTX","Rein Therapeutics Inc.",8,37,0],["RNTY","RNTY",1,0,0],["RNW","ReNew Energy Global plc Class A",41,1941,0],["RNWZ","RNWZ",1,0,0],["RNXT","RenovoRx Inc.",8,34,0],["ROAD","Construction Partners Inc. Class A",21,6169,0],["ROAM","ROAM",1,0,0],["ROBO","ROBO",1,0,0],["ROBT","ROBT",1,0,0],["ROCK","Gibraltar Industries Inc.",27,1475,0],["RODM","RODM",1,0,0],["ROE","ROE",1,0,0],["ROG","Rogers Corporation",34,1684,0],["ROIV","Roivant Sciences Ltd.",8,15586,0],["ROK","Rockwell Automation Inc.",7,44446,0],["ROKT","ROKT",1,0,0],["ROKU","Roku Inc. Class A",54,16078,0],["ROL","Rollins Inc.",12,29107,0],["ROLR","High Roller Technologies Inc.",45,12,0],["ROM","ROM",1,0,0],["ROMA","Roma Green Finance Limited",19,132,0],["RONB","RONB",1,0,0],["ROOT","Root Inc. Class A",22,1146,0],["ROP","Roper Technologies Inc.",16,47898,0],["ROPE","ROPE",1,0,0],["ROSC","ROSC",1,0,0],["ROST","Ross Stores Inc.",120,59000,0],["ROUS","ROUS",1,0,0],["RPAR","RPAR",1,0,0],["RPAY","Repay Holdings Corporation Class A",36,326,0],["RPD","Rapid7 Inc.",25,1014,0],["RPG","RPG",1,0,0],["RPGL","Republic Power Group Limited Class A",25,3,0],["RPID","Rapid Micro Biosystems Inc. Class A",71,140,0],["RPM","RPM International Inc.",149,13480,0],["RPRX","Royalty Pharma plc Class A",8,22281,0],["RPT","Rithm Property Trust Inc.",30,126,0],["RPT/PC","RPT/PC",1,0,0],["RPTX","Repare Therapeutics Inc.",8,92,0],["RPV","RPV",1,0,0],["RQI","Cohen & Steers Quality Income Realty Fund Inc",81,1538,0],["RR","Richtech Robotics Inc. Class B",7,531,0],["RRBI","Red River Bancshares Inc.",47,509,0],["RRC","Range Resources Corporation",59,8177,0],["RRGB","Red Robin Gourmet Burgers Inc.",68,76,0],["RRR","Red Rock Resorts Inc. Class A",47,6683,0],["RRX","Regal Rexnord Corporation",55,9294,0],["RS","Reliance Inc.",55,15215,0],["RSDE","RSDE",1,0,0],["RSF","RiverNorth Capital and Income Fund",11,48,0],["RSG","Republic Services Inc.",122,65980,0],["RSHO","RSHO",1,0,0],["RSI","Rush Street Interactive Inc. Class A",45,4474,0],["RSJN","RSJN",1,0,0],["RSKD","Riskified Ltd. Class A",36,794,0],["RSMC","RSMC",1,0,0],["RSMR","RSMR",1,0,0],["RSMV","RSMV",1,0,0],["RSP","RSP",1,0,0],["RSPA","RSPA",1,0,0],["RSPC","RSPC",1,0,0],["RSPD","RSPD",1,0,0],["RSPE","RSPE",1,0,0],["RSPF","RSPF",1,0,0],["RSPG","RSPG",1,0,0],["RSPH","RSPH",1,0,0],["RSPM","RSPM",1,0,0],["RSPN","RSPN",1,0,0],["RSPR","RSPR",1,0,0],["RSPS","RSPS",1,0,0],["RSPT","RSPT",1,0,0],["RSPU","RSPU",1,0,0],["RSSE","RSSE",1,0,0],["RSSL","RSSL",1,0,0],["RSSS","Research Solutions Inc",15,95,0],["RSVR","Reservoir Media Inc.",45,491,0],["RTAC","Renatus Tactical Acquisition Corp I Class A",2,0,0],["RTACU","Renatus Tactical Acquisition Corp I Unit",2,0,0],["RTH","RTH",1,0,0],["RTO","Rentokil Initial plc",3,7503,0],["RTX","RTX Corporation",50,244034,0],["RTXG","RTXG",1,0,0],["RTYY","RTYY",1,0,0],["RUBI","Rubico Inc.",98,7,0],["RUM","Rumble Inc. Class A",16,3001,0],["RUN","Sunrun Inc.",7,4237,0],["RUNN","RUNN",1,0,0],["RUSC","RUSC",1,0,0],["RUSHA","Rush Enterprises Inc.",97,4360,0],["RUSHB","Rush Enterprises Inc. Class B",97,4511,0],["RVER","RVER",1,0,0],["RVLV","Revolve Group Inc. Class A",57,2068,0],["RVMD","Revolution Medicines Inc.",13,15230,0],["RVNL","RVNL",1,0,0],["RVNU","RVNU",1,0,0],["RVP","Retractable Technologies Inc.",31,25,0],["RVPH","Reviva Pharmaceuticals Holdings Inc.",8,69,0],["RVSB","Riverview Bancorp Inc",84,110,0],["RVSN","Rail Vision Ltd.",117,21,0],["RVT","Royce Small-Cap Trust Inc.",81,1751,0],["RVTY","Revvity Inc.",71,10911,0],["RVYL","Ryvyl Inc.",19,8,0],["RW","RW",1,0,0],["RWAY","Runway Growth Finance Corp.",44,322,0],["RWAYL","Runway Growth Finance Corp. 7.50% Notes due 2027",44,912,0],["RWAYZ","Runway Growth Finance Corp. 8.00% Notes due 2027",44,915,0],["RWJ","RWJ",1,0,0],["RWK","RWK",1,0,0],["RWL","RWL",1,0,0],["RWM","RWM",1,0,0],["RWO","RWO",1,0,0],["RWR","RWR",1,0,0],["RWT","Redwood Trust Inc.",30,733,0],["RWT/PA","RWT/PA",1,0,0],["RWTN","Redwood Trust Inc. 9.125% Senior Notes Due 2029",30,3192,0],["RWTO","Redwood Trust Inc. 9.00% Senior Notes Due 2029",30,3219,0],["RWTP","Redwood Trust Inc. 9.125% Senior Notes Due 2030",30,0,0],["RWTQ","Redwood Trust Inc. 9.500% Senior Notes Due 2030",30,0,0],["RWX","RWX",1,0,0],["RXD","RXD",1,0,0],["RXI","RXI",1,0,0],["RXL","RXL",1,0,0],["RXO","RXO Inc.",87,2225,0],["RXRX","Recursion Pharmaceuticals Inc. Class A",13,2215,0],["RXST","RxSight Inc.",111,495,0],["RXT","Rackspace Technology Inc.",16,251,0],["RY","Royal Bank Of Canada",75,236272,0],["RYAAY","Ryanair Holdings plc",4,38152,0],["RYAM","Rayonier Advanced Materials Inc.",138,383,0],["RYAN","Ryan Specialty Holdings Inc. Class A",28,13948,0],["RYDE","Ryde Group Ltd. Class A",36,31,0],["RYET","Ruanyun Edai Technology Inc.",25,42,0],["RYI","Ryerson Holding Corporation",55,823,0],["RYLD","RYLD",1,0,0],["RYLG","RYLG",1,0,0],["RYM","RYTHM Inc.",48,61,0],["RYN","Rayonier Inc. REIT",30,3352,0],["RYOJ","rYojbaba Co. Ltd.",19,40,0],["RYTM","Rhythm Pharmaceuticals Inc.",8,7484,0],["RZB","Reinsurance Group of America Incorporated 5.75% Fixed-To-Floating Rate Subordinated Debentures due 2056",5,1633,0],["RZC","Reinsurance Group of America Incorporated 7.125% Fixed-Rate Reset Subordinated Debentures due 2052",5,1691,0],["RZG","RZG",1,0,0],["RZLT","Rezolute Inc.",8,164,0],["RZLV","Rezolve AI PLC",16,948,0],["RZV","RZV",1,0,0],["S","SentinelOne Inc. Class A",25,5006,0],["SA","Seabridge Gold Inc.",104,3072,0],["SAA","SAA",1,0,0],["SABA","Saba Capital Income & Opportunities Fund II Shares of Beneficial Interest",1,0,0],["SABR","Sabre Corporation",16,584,0],["SABS","SAB Biotherapeutics Inc.",13,190,0],["SAC.U","SAC.U",1,0,0],["SACH","Sachem Capital Corp.",30,50,0],["SACH/PA","SACH/PA",1,0,0],["SAEF","SAEF",1,0,0],["SAFE","Safehold Inc. New",30,983,0],["SAFT","Safety Insurance Group Inc.",22,1167,0],["SAFX","XCF Global Inc. Class A",34,78,0],["SAGP","SAGP",1,0,0],["SAGT","SAGTEC GLOBAL LIMITED Class A",25,26,0],["SAH","Sonic Automotive Inc.",97,2173,0],["SAIA","Saia Inc.",63,8533,0],["SAIC","Science Applications International Corporation",15,4603,0],["SAIH","SAIHEAT Limited Class A",15,17,0],["SAIL","SailPoint Inc.",25,11805,0],["SAJ","Saratoga Investment Corp 8.00% Notes due 2027",11,396,0],["SAM","Boston Beer Company Inc. (The)",46,2139,0],["SAMG","Silvercrest Asset Management Group Inc. Class A",11,183,0],["SAMM","SAMM",1,0,0],["SAMT","SAMT",1,0,0],["SAN","Banco Santander S.A. Sponsored ADR (Spain)",75,172215,0],["SANA","Sana Biotechnology Inc.",13,1161,0],["SANG","Sangoma Technologies Corporation",16,172,0],["SANM","Sanmina Corporation",39,8268,0],["SAP","SAP SE ADS",25,300160,0],["SAPH","SAPH",1,0,0],["SAR","Saratoga Investment Corp New",11,370,0],["SARK","SARK",1,0,0],["SARO","StandardAero Inc.",50,9586,0],["SAT","Saratoga Investment Corp 6.00% Notes due 2027",11,389,0],["SATA","Strive Inc. Variable Rate Series A Perpetual",1,75816,0],["SATG","SATG",1,0,0],["SATL","Satellogic Inc. Class A",49,279,0],["SATS","EchoStar Corporation",33,29913,0],["SAVA","Cassava Sciences Inc.",8,105,0],["SAWG","SAWG",1,0,0],["SAWS","SAWS",1,0,0],["SAY","Saratoga Investment Corp 8.125% Notes due 2027",11,396,0],["SAZ","Saratoga Investment Corp 8.50% Notes due 2028",11,398,0],["SB","Safe Bulkers Inc",98,505,0],["SB/PC","SB/PC",1,0,0],["SB/PD","SB/PD",1,0,0],["SBAC","SBA Communications Corporation Class A",30,20245,0],["SBAR","SBAR",1,0,0],["SBB","SBB",1,0,0],["SBC","SBC Medical Group Holdings Incorporated",35,464,0],["SBCF","Seacoast Banking Corporation of Florida",26,3113,0],["SBDS","Solo Brands Inc. Class A",61,17,0],["SBET","SharpLink Gaming Inc.",25,1930,0],["SBEV","Splash Beverage Group Inc. (NV)",46,3,0],["SBFG","SB Financial Group Inc.",26,145,0],["SBFM","Sunshine Biopharma Inc.",8,6,0],["SBGI","Sinclair Inc. Class A",83,1109,0],["SBH","Sally Beauty Holdings Inc. (Name to be changed from Sally Holdings Inc.)",66,1488,0],["SBI","Western Asset Intermediate Muni Fund Inc",123,0,0],["SBIL","SBIL",1,0,0],["SBIO","SBIO",1,0,0],["SBIT","SBIT",1,0,0],["SBLK","Star Bulk Carriers Corp.",98,2143,0],["SBLX","StableX Technologies Inc.",33,5,0],["SBND","SBND",1,0,0],["SBR","Sabine Royalty Trust",59,989,0],["SBRA","Sabra Health Care REIT Inc.",30,4660,0],["SBS","Companhia de saneamento Basico Do Estado De Sao Paulo - Sabesp",70,16773,0],["SBSI","Southside Bancshares Inc.",26,964,0],["SBSW","D/B/A Sibanye-Stillwater Limited ADS",104,10133,0],["SBU","SBU",1,0,0],["SBUX","Starbucks Corporation",68,100440,0],["SBXD","SilverBox Corp IV Class A",1,0,0],["SBXD.U","SBXD.U",1,0,0],["SBXE.U","SBXE.U",1,0,0],["SCAG","Scage Future",72,177,0],["SCAP","SCAP",1,0,0],["SCC","SCC",1,0,0],["SCCF","Sachem Capital Corp. 7.125% Notes due 2027",30,1096,0],["SCCG","Sachem Capital Corp. 8.00% Notes due 2027",30,1099,0],["SCCO","Southern Copper Corporation",10,116956,0],["SCCR","SCCR",1,0,0],["SCD","LMP Capital and Income Fund Inc.",81,0,0],["SCDL","SCDL",1,0,0],["SCDS","SCDS",1,0,0],["SCDV","SCDV",1,0,0],["SCE/PG","SCE/PG",1,0,0],["SCE/PK","SCE/PK",1,0,0],["SCE/PL","SCE/PL",1,0,0],["SCE/PM","SCE/PM",1,0,0],["SCE/PN","SCE/PN",1,0,0],["SCHA","SCHA",1,0,0],["SCHB","SCHB",1,0,0],["SCHC","SCHC",1,0,0],["SCHD","SCHD",1,0,0],["SCHE","SCHE",1,0,0],["SCHF","SCHF",1,0,0],["SCHG","SCHG",1,0,0],["SCHH","SCHH",1,0,0],["SCHI","SCHI",1,0,0],["SCHJ","SCHJ",1,0,0],["SCHK","SCHK",1,0,0],["SCHL","Scholastic Corporation",145,679,0],["SCHM","SCHM",1,0,0],["SCHO","SCHO",1,0,0],["SCHP","SCHP",1,0,0],["SCHQ","SCHQ",1,0,0],["SCHR","SCHR",1,0,0],["SCHV","SCHV",1,0,0],["SCHW","Charles Schwab Corporation (The)",60,175597,0],["SCHW/PD","SCHW/PD",1,0,0],["SCHW/PJ","SCHW/PJ",1,0,0],["SCHX","SCHX",1,0,0],["SCHY","SCHY",1,0,0],["SCHZ","SCHZ",1,0,0],["SCI","Service Corporation International",3,10961,0],["SCIIU","SC II Acquisition Corp.",1,0,0],["SCIO","SCIO",1,0,0],["SCJ","SCJ",1,0,0],["SCKT","Socket Mobile Inc.",9,8,0],["SCL","Stepan Company",90,1075,0],["SCLS","SCLS",1,0,0],["SCLX","Scilex Holding Company",13,109,0],["SCM","Stellus Capital Investment Corporation",123,364,0],["SCMB","SCMB",1,0,0],["SCNI","Scinai Immunotherapeutics Ltd.",13,1,0],["SCNX","Scienture Holdings Inc.",112,23,0],["SCO","SCO",1,0,0],["SCOR","comScore Inc.",36,36,0],["SCSC","ScanSource Inc.",100,901,0],["SCUS","SCUS",1,0,0],["SCVL","Shoe Carnival Inc.",120,514,0],["SCWO","374Water Inc.",55,84,0],["SCYB","SCYB",1,0,0],["SCYX","SCYNEXIS Inc.",8,26,0],["SCZ","SCZ",1,0,0],["SD","SandRidge Energy Inc.",59,522,0],["SDA","SunCar Technology Group Inc. Class A",79,202,0],["SDCI","SDCI",1,0,0],["SDCP","SDCP",1,0,0],["SDD","SDD",1,0,0],["SDEM","SDEM",1,0,0],["SDFI","SDFI",1,0,0],["SDG","SDG",1,0,0],["SDGR","Schrodinger Inc.",8,1301,0],["SDHC","Smith Douglas Homes Corp. Class A",121,1032,0],["SDHI","Siddhi Acquisition Corp Class A",2,0,0],["SDHIU","Siddhi Acquisition Corp Unit",2,0,0],["SDHY","PGIM Short Duration High Yield Opportunities Fund",123,404,0],["SDIV","SDIV",1,0,0],["SDOG","SDOG",1,0,0],["SDOT","Sadot Group Inc.",68,3,0],["SDOW","SDOW",1,0,0],["SDP","SDP",1,0,0],["SDRL","Seadrill Limited",59,1969,0],["SDS","SDS",1,0,0],["SDSI","SDSI",1,0,0],["SDST","Stardust Power Inc.",34,32,0],["SDTY","SDTY",1,0,0],["SDVY","SDVY",1,0,0],["SDY","SDY",1,0,0],["SE","Sea Limited",3,72209,0],["SEA","SEA",1,0,0],["SEAL/PA","SEAL/PA",1,0,0],["SEAL/PB","SEAL/PB",1,0,0],["SEAT","Vivid Seats Inc. Class A",45,66,0],["SEB","Seaboard Corporation",48,4251,0],["SECR","SECR",1,0,0],["SEDG","SolarEdge Technologies Inc.",6,1738,0],["SEE","Sealed Air Corporation",34,6076,0],["SEED","Origin Agritech Limited",48,9,0],["SEEM","SEEM",1,0,0],["SEER","Seer Inc. Class A",71,100,0],["SEF","SEF",1,0,0],["SEG","Seaport Entertainment Group Inc.",45,254,0],["SEGG","Lottery.com Inc.",25,4,0],["SEI","Solaris Energy Infrastructure Inc. Class A",88,3078,0],["SEIC","SEI Investments Company",60,10216,0],["SEIE","SEIE",1,0,0],["SEIS","SEIS",1,0,0],["SEIX","SEIX",1,0,0],["SELF","Global Self Storage Inc.",30,56,0],["SELX","Semilux International Ltd.",6,23,0],["SEM","Select Medical Holdings Corporation",126,1859,0],["SEMG","SEMG",1,0,0],["SEMI","SEMI",1,0,0],["SEMR","SEMrush Holdings Inc. Class A",25,1771,0],["SEMY","SEMY",1,0,0],["SENEA","Seneca Foods Corp. Class A",17,772,0],["SENEB","Seneca Foods Corp. Class B",17,787,0],["SENS","Senseonics Holdings Inc.",31,251,0],["SEPI","SEPI",1,0,0],["SEPN","Septerna Inc.",8,1324,0],["SEPT","SEPT",1,0,0],["SEPW","SEPW",1,0,0],["SER","Serina Therapeutics Inc.",8,29,0],["SERA","Sera Prognostics Inc. Class A",23,137,0],["SERV","Serve Robotics Inc.",32,764,0],["SES","SES AI Corporation Class A",7,705,0],["SETH","SETH",1,0,0],["SETM","SETM",1,0,0],["SEV","Aptera Motors Corp. Class B",37,141,0],["SEVN","Seven Hills Realty Trust",30,137,0],["SEZL","Sezzle Inc.",36,2510,0],["SF","Stifel Financial Corporation",60,12974,0],["SF/PB","SF/PB",1,0,0],["SF/PC","SF/PC",1,0,0],["SF/PD","SF/PD",1,0,0],["SFB","Stifel Financial Corporation 5.20% Senior Notes due 2047",60,2161,0],["SFBC","Sound Financial Bancorp Inc.",84,111,0],["SFBS","ServisFirst Bancshares Inc.",26,3968,0],["SFD","Smithfield Foods Inc.",62,8955,0],["SFGV","SFGV",1,0,0],["SFHG","Samfine Creation Holdings Group Limited Class A",109,17,0],["SFIX","Stitch Fix Inc. Class A",57,701,0],["SFL","SFL Corporation Ltd",98,1078,0],["SFLO","SFLO",1,0,0],["SFLR","SFLR",1,0,0],["SFM","Sprouts Farmers Market Inc.",67,7948,0],["SFNC","Simmons First National Corporation Class A",26,2789,0],["SFST","Southern First Bancshares Inc.",26,438,0],["SFTX","SFTX",1,0,0],["SFWL","Shengfeng Development Limited Class A",63,82,0],["SFY","SFY",1,0,0],["SFYF","SFYF",1,0,0],["SFYX","SFYX",1,0,0],["SG","Sweetgreen Inc. Class A",68,811,0],["SGA","Saga Communications Inc. Class A",83,73,0],["SGBX","Safe & Green Holdings Corp.",130,14,0],["SGC","Superior Group of Companies Inc.",86,156,0],["SGDJ","SGDJ",1,0,0],["SGDM","SGDM",1,0,0],["SGHC","Super Group (SGHC) Limited",45,6012,0],["SGHT","Sight Sciences Inc.",31,447,0],["SGI","Somnigroup International Inc.",73,18864,0],["SGLC","SGLC",1,0,0],["SGLY","Singularity Future Technology Ltd.",105,4,0],["SGML","Sigma Lithium Corporation",10,1358,0],["SGMO","Sangamo Therapeutics Inc.",13,150,0],["SGMT","Sagimet Biosciences Inc. Series A",8,204,0],["SGN","Signing Day Sports Inc.",15,5,0],["SGOL","SGOL",1,0,0],["SGOV","SGOV",1,0,0],["SGRP","SPAR Group Inc.",36,19,0],["SGRT","SGRT",1,0,0],["SGRY","Surgery Partners Inc.",126,2031,0],["SGU","Star Group L.P.",66,386,0],["SGVT","SGVT",1,0,0],["SH","SH",1,0,0],["SHAK","Shake Shack Inc. Class A",68,3659,0],["SHBI","Shore Bancshares Inc",26,619,0],["SHC","Sotera Health Company",137,4878,0],["SHCO","Soho House & Co Inc. Class A",47,1748,0],["SHE","SHE",1,0,0],["SHEL","Shell PLC",59,209270,0],["SHEN","Shenandoah Telecommunications Co",33,615,0],["SHFS","SHF Holdings Inc. Class A",44,4,0],["SHG","Shinhan Financial Group Co Ltd",26,26839,0],["SHIM","Shimmick Corporation",21,98,0],["SHIP","Seanergy Maritime Holdings Corp.",98,196,0],["SHLD","SHLD",1,0,0],["SHLS","Shoals Technologies Group Inc. Class A",6,1500,0],["SHM","SHM",1,0,0],["SHMD","SCHMID Group N.V. Class A",7,218,0],["SHNY","SHNY",1,0,0],["SHO","Sunstone Hotel Investors Inc. Sunstone Hotel Investors Inc.",47,1738,0],["SHO/PH","SHO/PH",1,0,0],["SHO/PI","SHO/PI",1,0,0],["SHOC","SHOC",1,0,0],["SHOO","Steven Madden Ltd.",114,3128,0],["SHOP","Shopify Inc. Class A Subordinate Voting Shares",25,220658,0],["SHPD","SHPD",1,0,0],["SHPH","Shuttle Pharmaceuticals Holdings Inc.",8,3,0],["SHPP","SHPP",1,0,0],["SHPU","SHPU",1,0,0],["SHRT","SHRT",1,0,0],["SHRY","SHRY",1,0,0],["SHV","SHV",1,0,0],["SHW","Sherwin-Williams Company (The)",130,79539,0],["SHY","SHY",1,0,0],["SHYG","SHYG",1,0,0],["SHYL","SHYL",1,0,0],["SI","Shoulder Innovations Inc.",31,316,0],["SIBN","SI-BONE Inc.",31,884,0],["SID","Companhia Siderurgica Nacional S.A.",27,2162,0],["SIDU","Sidus Space Inc. Class A",33,41,0],["SIEB","Siebert Financial Corp.",60,164,0],["SIF","SIFCO Industries Inc.",50,41,0],["SIFI","SIFI",1,0,0],["SIFY","Sify Technologies Limited",16,822,0],["SIG","Signet Jewelers Limited",94,3390,0],["SIGA","SIGA Technologies Inc.",8,449,0],["SIGI","Selective Insurance Group Inc.",22,5106,0],["SIGIP","Selective Insurance Group Inc.",22,1020,0],["SIHY","SIHY",1,0,0],["SII","Sprott Inc.",44,2495,0],["SIJ","SIJ",1,0,0],["SIL","SIL",1,0,0],["SILA","Sila Realty Trust Inc.",30,1278,0],["SILC","Silicom Ltd",51,77,0],["SILJ","SILJ",1,0,0],["SILO","Silo Pharma Inc.",86,6,0],["SIM","Grupo Simec S.A.B. de C.V.",27,3995,0],["SIMA","SIM Acquisition Corp. I Class A",7,0,0],["SIMO","Silicon Motion Technology Corporation",6,3016,0],["SIMS","SIMS",1,0,0],["SINT","SiNtx Technologies Inc.",31,15,0],["SIO","SIO",1,0,0],["SION","Sionna Therapeutics Inc.",8,1891,0],["SIOO","SIOO",1,0,0],["SIRI","SiriusXM Holdings Inc.",83,6990,0],["SITC","SITE Centers Corp.",30,330,0],["SITE","SiteOne Landscape Supply Inc.",108,5726,0],["SITM","SiTime Corporation",6,9569,0],["SIVR","SIVR",1,0,0],["SIXA","SIXA",1,0,0],["SIXD","SIXD",1,0,0],["SIXF","SIXF",1,0,0],["SIXG","SIXG",1,0,0],["SIXH","SIXH",1,0,0],["SIXJ","SIXJ",1,0,0],["SIXL","SIXL",1,0,0],["SIXO","SIXO",1,0,0],["SIXP","SIXP",1,0,0],["SIXS","SIXS",1,0,0],["SIXZ","SIXZ",1,0,0],["SIZE","SIZE",1,0,0],["SJ","Scienjoy Holding Corporation Class A",15,26,0],["SJB","SJB",1,0,0],["SJCP","SJCP",1,0,0],["SJLD","SJLD",1,0,0],["SJM","The J.M. Smucker Company",17,10530,0],["SJNK","SJNK",1,0,0],["SJT","San Juan Basin Royalty Trust",59,253,0],["SKBL","Skyline Builders Group Holding Limited Class A",82,75,0],["SKE","Skeena Resources Limited",104,2859,0],["SKF","SKF",1,0,0],["SKIL","Skillsoft Corp. Class A",25,68,0],["SKIN","The Beauty Health Company Class A",31,195,0],["SKK","SKK Holdings Limited",128,5,0],["SKLZ","Skillz Inc. Class A",15,73,0],["SKM","SK Telecom Co. Ltd.",33,7595,0],["SKOR","SKOR",1,0,0],["SKRE","SKRE",1,0,0],["SKT","Tanger Inc.",30,3944,0],["SKWD","Skyward Specialty Insurance Group Inc.",22,2070,0],["SKY","Champion Homes Inc.",121,4862,0],["SKYE","Skye Bioscience Inc.",8,30,0],["SKYH","Sky Harbour Group Corporation Class A",36,650,0],["SKYQ","Sky Quarry Inc.",122,7,0],["SKYT","SkyWater Technology Inc.",6,804,0],["SKYU","SKYU",1,0,0],["SKYW","SkyWest Inc.",4,4175,0],["SKYX","SKYX Platforms Corp.",91,250,0],["SKYY","SKYY",1,0,0],["SLAB","Silicon Laboratories Inc.",6,4436,0],["SLAI","SOLAI Limited",15,11,0],["SLB","SLB Limited",20,56889,0],["SLDB","Solid Biosciences Inc.",13,463,0],["SLDE","Slide Insurance Holdings Inc.",22,2327,0],["SLDP","Solid Power Inc. Class A",7,896,0],["SLDR","SLDR",1,0,0],["SLE","Super League Enterprise Inc.",45,36,0],["SLF","Sun Life Financial Inc.",5,34304,0],["SLG","SL Green Realty Corp",30,3149,0],["SLG/PI","SLG/PI",1,0,0],["SLGB","Smart Logistics Global Limited",105,46,0],["SLGL","Sol-Gel Technologies Ltd.",8,117,0],["SLGN","Silgan Holdings Inc.",125,4317,0],["SLI","Standard Lithium Ltd.",34,1218,0],["SLJY","SLJY",1,0,0],["SLM","SLM Corporation",44,5553,0],["SLMBP","SLM Corporation Floating Rate Non-Cumulative",44,15277,0],["SLMT","Brera Holdings PLC Class B",45,188,0],["SLN","Silence Therapeutics Plc American Depository Share",8,298,0],["SLND","Southland Holdings Inc.",21,206,0],["SLNG","Stabilis Solutions Inc.",140,87,0],["SLNH","Soluna Holdings Inc.",15,147,0],["SLNHP","Soluna Holdings Inc 9.0% Series A Cumulative Perpetual",15,863,0],["SLNO","Soleno Therapeutics Inc.",77,2570,0],["SLNZ","SLNZ",1,0,0],["SLON","SLON",1,0,0],["SLP","Simulations Plus Inc.",15,378,0],["SLQD","SLQD",1,0,0],["SLQT","SelectQuote Inc.",28,234,0],["SLRC","SLR Investment Corp.",123,835,0],["SLRX","Salarius Pharmaceuticals Inc.",8,4,0],["SLS","SELLAS Life Sciences Group Inc.",8,336,0],["SLSN","Solesence Inc.",90,144,0],["SLSR","Solaris Resources Inc.",1,1334,0],["SLTY","SLTY",1,0,0],["SLV","SLV",1,0,0],["SLVM","Sylvamo Corporation",138,1964,0],["SLVO","SLVO",1,0,0],["SLVR","SLVR",1,0,0],["SLX","SLX",1,0,0],["SLXN","Silexion Therapeutics Corp",13,8,0],["SLYG","SLYG",1,0,0],["SLYV","SLYV",1,0,0],["SM","SM Energy Company",59,2140,0],["SMA","SmartStop Self Storage REIT Inc.",30,1737,0],["SMAP","SMAP",1,0,0],["SMBC","Southern Missouri Bancorp Inc.",43,691,0],["SMBK","SmartFinancial Inc.",26,659,0],["SMBS","SMBS",1,0,0],["SMC","Summit Midstream Corporation",107,498,0],["SMCC","SMCC",1,0,0],["SMCF","SMCF",1,0,0],["SMCI","Super Micro Computer Inc.",9,18572,0],["SMCL","SMCL",1,0,0],["SMCO","SMCO",1,0,0],["SMCX","SMCX",1,0,0],["SMCY","SMCY",1,0,0],["SMCZ","SMCZ",1,0,0],["SMDD","SMDD",1,0,0],["SMDX","SMDX",1,0,0],["SMFG","Sumitomo Mitsui Financial Group Inc Unsponsored",75,124755,0],["SMG","Scotts Miracle-Gro Company (The)",85,3402,0],["SMH","SMH",1,0,0],["SMHB","SMHB",1,0,0],["SMHI","SEACOR Marine Holdings Inc.",98,175,0],["SMHX","SMHX",1,0,0],["SMID","Smith-Midland Corporation",38,187,0],["SMIG","SMIG",1,0,0],["SMIZ","SMIZ",1,0,0],["SMJF","SMJ International Holdings Inc. Class A",130,191,0],["SMLF","SMLF",1,0,0],["SMLL","SMLL",1,0,0],["SMLR","Semler Scientific Inc.",77,272,0],["SMLV","SMLV",1,0,0],["SMMT","Summit Therapeutics Inc.",8,13266,0],["SMMU","SMMU",1,0,0],["SMN","SMN",1,0,0],["SMOG","SMOG",1,0,0],["SMOM","SMOM",1,0,0],["SMOX","SMOX",1,0,0],["SMP","Standard Motor Products Inc.",42,838,0],["SMPL","The Simply Good Foods Company",17,1961,0],["SMR","NuScale Power Corporation Class A",55,4865,0],["SMRI","SMRI",1,0,0],["SMRT","SmartRent Inc. Class A",15,395,0],["SMSI","Smith Micro Software Inc.",25,17,0],["SMST","SMST",1,0,0],["SMTC","Semtech Corporation",6,6753,0],["SMTH","SMTH",1,0,0],["SMTI","Sanara MedTech Inc.",32,216,0],["SMTK","SmartKem Inc.",6,9,0],["SMWB","Similarweb Ltd.",16,578,0],["SMX","SMX (Security Matters) Public Limited Company",7,3824,0],["SMXT","Solarmax Technology Inc.",82,44,0],["SMYY","SMYY",1,0,0],["SN","SharkNinja Inc.",133,16176,0],["SNA","Snap-On Incorporated",7,18011,0],["SNAG","SNAG",1,0,0],["SNAL","Snail Inc. Class A",25,37,0],["SNAP","Snap Inc. Class A",16,13016,0],["SNBR","Sleep Number Corporation",73,192,0],["SNCR","Synchronoss Technologies Inc.",15,97,0],["SNCY","Sun Country Airlines Holdings Inc.",4,770,0],["SND","Smart Sand Inc.",74,148,0],["SNDA","Sonida Senior Living Inc.",126,618,0],["SNDK","Sandisk Corporation",76,34823,0],["SNDL","SNDL Inc.",18,494,0],["SNDR","Schneider National Inc.",63,4735,0],["SNDX","Syndax Pharmaceuticals Inc.",8,1805,0],["SNES","SenesTech Inc.",85,12,0],["SNEX","StoneX Group Inc.",60,5000,0],["SNFCA","Security National Financial Corporation Class A",44,240,0],["SNGX","Soligenix Inc.",8,14,0],["SNN","Smith & Nephew SNATS Inc.",32,13944,0],["SNOA","Sonoma Pharmaceuticals Inc.",8,6,0],["SNOW","Snowflake Inc.",25,76126,0],["SNOY","SNOY",1,0,0],["SNPE","SNPE",1,0,0],["SNPS","Synopsys Inc.",25,86137,0],["SNSE","Sensei Biotherapeutics Inc.",8,11,0],["SNSR","SNSR",1,0,0],["SNT","Senstar Technologies Corporation",33,91,0],["SNTG","Sentage Holdings Inc. Class A",44,6,0],["SNTH","SNTH",1,0,0],["SNTI","Senti Biosciences Inc.",13,32,0],["SNV","Synovus Financial Corp.",26,7307,0],["SNV/PD","SNV/PD",1,0,0],["SNV/PE","SNV/PE",1,0,0],["SNWV","SANUWAVE Health Inc.",31,277,0],["SNX","TD SYNNEX Corporation",100,12552,0],["SNY","Sanofi ADS",8,118307,0],["SNYR","Synergy CHC Corp.",112,17,0],["SO","Southern Company (The)",41,93902,0],["SOAR","Volato Group Inc. Class A",87,8,0],["SOBO","South Bow Corporation",107,5689,0],["SOBR","SOBR Safe Inc.",124,2,0],["SOC","Sable Offshore Corp.",59,1128,0],["SOCA","Solarius Capital Acquisition Corp. Class A",1,0,0],["SOCAU","Solarius Capital Acquisition Corp.",2,0,0],["SOCL","SOCL",1,0,0],["SOEZ","SOEZ",1,0,0],["SOFI","SoFi Technologies Inc.",44,34298,0],["SOFR","SOFR",1,0,0],["SOFX","SOFX",1,0,0],["SOGP","Sound Group Inc.",16,66,0],["SOHO","Sotherly Hotels Inc.",30,44,0],["SOHOB","Sotherly Hotels Inc. 8.0% Series B Cumulative Redeemable Perpetual",30,350,0],["SOHON","Sotherly Hotels Inc. 8.25% Series D Cumulative Redeemable Perpetual",30,311,0],["SOHOO","Sotherly Hotels Inc. 7.875% Series C Cumulative Redeemable Perpetual",30,357,0],["SOHU","Sohu.com Limited",15,450,0],["SOJC","Southern Company (The) Series 2017B 5.25% Junior Subordinated Notes due December 1 2077",41,23959,0],["SOJD","Southern Company (The) Series 2020A 4.95% Junior Subordinated Notes due January 30 2080",41,22331,0],["SOJE","Southern Company (The) Series 2020C 4.20% Junior Subordinated Notes due October 15 2060",10,19647,0],["SOJF","Southern Company (The) Series 2025A 6.50% Junior Subordinated Notes due March 15 2085",10,0,0],["SOLC","Canary Marinade Solana ETF Shares of Beneficial Interest",1,2,0],["SOLR","SOLR",1,0,0],["SOLS","Solstice Advanced Materials Inc.",50,7992,0],["SOLT","SOLT",1,0,0],["SOLV","Solventum Corporation",31,14152,0],["SOLZ","SOLZ",1,0,0],["SOMN","Southern Company (The) 2025 Series A Corporate",10,53789,0],["SON","Sonoco Products Company",125,4272,0],["SONM","Sonim Technologies Inc.",33,6,0],["SONO","Sonos Inc.",133,2217,0],["SONY","Sony Group Corporation",133,153035,0],["SOPA","Society Pass Incorporated",36,9,0],["SOPH","SOPHiA GENETICS SA",13,308,0],["SOR","Source Capital Inc. Cmn Shs of BI",11,395,0],["SORA","AsiaStrategy",66,84,0],["SOS","SOS Limited Class A",44,15,0],["SOTK","Sono-Tek Corporation",7,60,0],["SOUL","Soulpower Acquisition Corporation Class A",109,0,0],["SOUL.U","SOUL.U",1,0,0],["SOUN","SoundHound AI Inc Class A",25,4629,0],["SOUX","SOUX",1,0,0],["SOVF","SOVF",1,0,0],["SOWG","Sow Good Inc.",17,6,0],["SOXL","SOXL",1,0,0],["SOXQ","SOXQ",1,0,0],["SOXS","SOXS",1,0,0],["SOXX","SOXX",1,0,0],["SOXY","SOXY",1,0,0],["SOYB","SOYB",1,0,0],["SPAB","SPAB",1,0,0],["SPAI","Safe Pro Group Inc.",32,87,0],["SPAM","SPAM",1,0,0],["SPAQ","SPAQ",1,0,0],["SPB","Spectrum Brands Holdings Inc.",7,1396,0],["SPBC","SPBC",1,0,0],["SPBO","SPBO",1,0,0],["SPBW","SPBW",1,0,0],["SPBX","SPBX",1,0,0],["SPC","SPC",1,0,0],["SPCB","SuperCom Ltd.",6,21,0],["SPCE","Virgin Galactic Holdings Inc.",87,221,0],["SPCT","SPCT",1,0,0],["SPCX","SPCX",1,0,0],["SPCY","SPCY",1,0,0],["SPD","SPD",1,0,0],["SPDG","SPDG",1,0,0],["SPDN","SPDN",1,0,0],["SPDV","SPDV",1,0,0],["SPDW","SPDW",1,0,0],["SPE","Special Opportunities Fund Inc",123,0,0],["SPE/PC","SPE/PC",1,0,0],["SPEG","Silver Pegasus Acquisition Corp Class A",1,0,0],["SPEGU","Silver Pegasus Acquisition Corp Unit",1,0,0],["SPEM","SPEM",1,0,0],["SPEU","SPEU",1,0,0],["SPFF","SPFF",1,0,0],["SPFI","South Plains Financial Inc.",26,654,0],["SPG","Simon Property Group Inc.",30,60374,0],["SPG/PJ","SPG/PJ",1,0,0],["SPGI","S&P Global Inc.",44,155215,0],["SPGM","SPGM",1,0,0],["SPGP","SPGP",1,0,0],["SPH","Suburban Propane Partners L.P.",66,1227,0],["SPHB","SPHB",1,0,0],["SPHD","SPHD",1,0,0],["SPHL","Springview Holdings Ltd Class A",121,35,0],["SPHQ","SPHQ",1,0,0],["SPHR","Sphere Entertainment Co. Class A",45,3293,0],["SPHY","SPHY",1,0,0],["SPIB","SPIB",1,0,0],["SPIP","SPIP",1,0,0],["SPIR","Spire Global Inc. Class A",33,273,0],["SPIT","SPIT",1,0,0],["SPKL","Spark I Acquisition Corp. Class A",1,0,0],["SPLB","SPLB",1,0,0],["SPLV","SPLV",1,0,0],["SPMA","Sound Point Meridian Capital Inc. 8.00% Series A",1,0,0],["SPMB","SPMB",1,0,0],["SPMC","Sound Point Meridian Capital Inc.",1,0,0],["SPMD","SPMD",1,0,0],["SPME","Sound Point Meridian Capital Inc. 7.875% Series B",1,0,0],["SPMO","SPMO",1,0,0],["SPNT","SiriusPoint Ltd.",22,2582,0],["SPNT/PB","SPNT/PB",1,0,0],["SPOG","SPOG",1,0,0],["SPOK","Spok Holdings Inc.",33,266,0],["SPOT","Spotify Technology S.A.",83,118670,0],["SPPL","SIMPPLE LTD.",12,16,0],["SPPP","SPPP",1,0,0],["SPRB","Spruce Biosciences Inc.",8,84,0],["SPRC","SciSparc Ltd.",8,5,0],["SPRE","SPRE",1,0,0],["SPRO","Spero Therapeutics Inc.",8,131,0],["SPRU","Spruce Power Holding Corporation Class A",42,92,0],["SPRX","SPRX",1,0,0],["SPRY","ARS Pharmaceuticals Inc.",8,1037,0],["SPSB","SPSB",1,0,0],["SPSC","SPS Commerce Inc.",25,3415,0],["SPSK","SPSK",1,0,0],["SPSM","SPSM",1,0,0],["SPT","Sprout Social Inc Class A",25,672,0],["SPTB","SPTB",1,0,0],["SPTE","SPTE",1,0,0],["SPTI","SPTI",1,0,0],["SPTL","SPTL",1,0,0],["SPTM","SPTM",1,0,0],["SPTS","SPTS",1,0,0],["SPTU","SPTU",1,0,0],["SPUC","SPUC",1,0,0],["SPUS","SPUS",1,0,0],["SPUT","SPUT",1,0,0],["SPUU","SPUU",1,0,0],["SPVM","SPVM",1,0,0],["SPVU","SPVU",1,0,0],["SPWH","Sportsman\'s Warehouse Holdings Inc.",66,53,0],["SPWO","SPWO",1,0,0],["SPWR","SunPower Inc.",6,145,0],["SPXC","SPX Technologies Inc.",7,10125,0],["SPXD","SPXD",1,0,0],["SPXE","SPXE",1,0,0],["SPXL","SPXL",1,0,0],["SPXN","SPXN",1,0,0],["SPXS","SPXS",1,0,0],["SPXT","SPXT",1,0,0],["SPXU","SPXU",1,0,0],["SPXV","SPXV",1,0,0],["SPXX","Nuveen S&P 500 Dynamic Overwrite Fund",81,0,0],["SPY","SPY",1,0,0],["SPYC","SPYC",1,0,0],["SPYD","SPYD",1,0,0],["SPYG","SPYG",1,0,0],["SPYM","SPYM",1,0,0],["SPYQ","SPYQ",1,0,0],["SPYT","SPYT",1,0,0],["SPYU","SPYU",1,0,0],["SPYV","SPYV",1,0,0],["SPYX","SPYX",1,0,0],["SQFT","Presidio Property Trust Inc. Class A",30,5,0],["SQFTP","Presidio Property Trust Inc. 9.375% Series D Cumulative Redeemable Perpetual",30,22,0],["SQLV","SQLV",1,0,0],["SQM","Sociedad Quimica y Minera S.A.",74,19640,0],["SQNS","Sequans Communications S.A.",6,72,0],["SQQQ","SQQQ",1,0,0],["SR","Spire Inc.",140,4874,0],["SR/PA","SR/PA",1,0,0],["SRAD","Sportradar Group AG Class A",16,6846,0],["SRBK","SR Bancorp Inc.",43,145,0],["SRCE","1st Source Corporation",26,1600,0],["SRE","DBA Sempra",107,56744,0],["SREA","DBA Sempra 5.750% Junior Subordinated Notes due 2079",107,14138,0],["SRET","SRET",1,0,0],["SRFM","Surf Air Mobility Inc.",87,116,0],["SRG","Seritage Growth Properties Class A",36,190,0],["SRG/PA","SRG/PA",1,0,0],["SRHQ","SRHQ",1,0,0],["SRHR","SRHR",1,0,0],["SRI","Stoneridge Inc.",42,162,0],["SRL","Scully Royalty Ltd.",75,109,0],["SRLN","SRLN",1,0,0],["SROI","SROI",1,0,0],["SRPT","Sarepta Therapeutics Inc.",8,2205,0],["SRRK","Scholar Rock Holding Corporation",13,4478,0],["SRS","SRS",1,0,0],["SRTA","Strata Critical Medical Inc. Class A",87,443,0],["SRTS","Sensus Healthcare Inc.",31,63,0],["SRTY","SRTY",1,0,0],["SRV","NXG Cushing Midstream Energy Fund",116,0,0],["SRVR","SRVR",1,0,0],["SRXH","SRX Health Solutions Inc.",46,68,0],["SRZN","Surrozen Inc.",13,187,0],["SSB","SouthState Bank Corporation",26,9768,0],["SSBI","Summit State Bank",26,78,0],["SSD","Simpson Manufacturing Company Inc.",7,6918,0],["SSEA","Starry Sea Acquisition Corp\\tOrdinary Shares",1,0,0],["SSEAU","Starry Sea Acquisition Corp Unit",2,0,0],["SSFI","SSFI",1,0,0],["SSG","SSG",1,0,0],["SSII","SS Innovations International Inc.",31,1108,0],["SSKN","Strata Skin Sciences Inc.",31,7,0],["SSL","Sasol Ltd.",59,4013,0],["SSM","Sono Group N.V.",1,0,0],["SSNC","SS&C Technologies Holdings Inc.",25,21413,0],["SSO","SSO",1,0,0],["SSP","E.W. Scripps Company (The) Class A",83,417,0],["SSPY","SSPY",1,0,0],["SSRM","SSR Mining Inc.",104,4659,0],["SSSS","SuRo Capital Corp.",44,238,0],["SSSSL","SuRo Capital Corp. 6.00% Notes due 2026",44,595,0],["SST","System1 Inc. Class A",16,45,0],["SSTI","SoundThinking Inc.",25,100,0],["SSTK","Shutterstock Inc.",15,650,0],["SSUS","SSUS",1,0,0],["SSXU","SSXU",1,0,0],["SSYS","Stratasys Ltd.",53,642,0],["ST","Sensata Technologies Holding plc",7,4937,0],["STAA","STAAR Surgical Company",111,1251,0],["STAG","Stag Industrial Inc.",30,6956,0],["STAI","ScanTech AI Systems Inc.",39,12,0],["STAK","STAK Inc. Class A",88,5,0],["STAX","STAX",1,0,0],["STBA","S&T Bancorp Inc.",26,1586,0],["STC","Stewart Information Services Corporation",28,2143,0],["STCE","STCE",1,0,0],["STE","STERIS plc (Ireland)",32,24963,0],["STEC","Santech Holdings Limited",11,77,0],["STEL","Stellar Bancorp Inc.",26,1620,0],["STEM","Stem Inc. Class A",7,140,0],["STEP","StepStone Group Inc. Class A",11,7519,0],["STEW","SRH Total Return Fund Inc.",11,0,0],["STEX","Streamex Corp.",77,667,0],["STFS","Star Fashion Culture Holdings Limited Class A",58,3,0],["STG","Sunlands Technology Group",3,82,0],["STGW","Stagwell Inc. Class A",58,1306,0],["STHH","STHH",1,0,0],["STHO","Star Holdings Shares of Beneficial Interest",36,98,0],["STI","Solidion Technology Inc.",7,53,0],["STIM","Neuronetics Inc.",31,96,0],["STIP","STIP",1,0,0],["STK","Columbia Seligman Premium Technology Growth Fund Inc",11,0,0],["STKE","Sol Strategies Inc.",1,43,0],["STKH","Steakholder Foods Ltd.",17,1,0],["STKL","SunOpta Inc.",48,439,0],["STKS","The ONE Group Hospitality Inc.",68,58,0],["STLA","Stellantis N.V.",37,33241,0],["STLD","Steel Dynamics Inc.",27,25451,0],["STM","STMicroelectronics N.V.",6,23191,0],["STN","Stantec Inc",21,10745,0],["STNC","STNC",1,0,0],["STNE","StoneCo Ltd. Class A",15,3883,0],["STNG","Scorpio Tankers Inc.",98,2559,0],["STOK","Stoke Therapeutics Inc.",8,1825,0],["STPZ","STPZ",1,0,0],["STRA","Strategic Education Inc.",3,1889,0],["STRC","Strategy Inc Variable Rate Series A Perpetual Stretch",25,28373,0],["STRD","Strategy Inc 10.00% Series A Perpetual Stride",25,22273,0],["STRF","Strategy Inc 10.00% Series A Perpetual Strife",25,30957,0],["STRK","Strategy Inc 8.00% Series A Perpetual Strike",25,23735,0],["STRL","Sterling Infrastructure Inc.",21,9479,0],["STRN","STRN",1,0,0],["STRO","Sutro Biopharma Inc.",13,85,0],["STRR","Star Equity Holdings Inc.",19,38,0],["STRRP","Star Equity Holdings Inc. 10% Series A Cumulative Perpetual",1,32,0],["STRS","Stratus Properties Inc.",121,201,0],["STRT","STRATTEC SECURITY CORPORATION",42,336,0],["STRV","STRV",1,0,0],["STRW","Strawberry Fields REIT Inc.",30,175,0],["STRZ","Starz Entertainment Corp.",89,191,0],["STSM","STSM",1,0,0],["STSS","Sharps Technology Inc.",31,63,0],["STT","State Street Corporation",26,35892,0],["STT/PG","STT/PG",1,0,0],["STTK","Shattuck Labs Inc.",8,199,0],["STUB","StubHub Holdings Inc. Class A",45,4758,0],["STVN","Stevanato Group S.p.A.",31,6217,0],["STWD","STARWOOD PROPERTY TRUST INC. Starwood Property Trust Inc.",30,6829,0],["STX","Seagate Technology Holdings PLC",76,63290,0],["STXD","STXD",1,0,0],["STXE","STXE",1,0,0],["STXG","STXG",1,0,0],["STXI","STXI",1,0,0],["STXK","STXK",1,0,0],["STXM","STXM",1,0,0],["STXS","Stereotaxis Inc.",77,218,0],["STXT","STXT",1,0,0],["STXV","STXV",1,0,0],["STZ","Constellation Brands Inc.",46,23629,0],["SU","Suncor Energy Inc.",106,51354,0],["SUB","SUB",1,0,0],["SUGP","SU Group Holdings Limited",12,40,0],["SUI","Sun Communities Inc.",30,15179,0],["SUIG","Sui Group Holdings Limited",116,164,0],["SUN","Sunoco LP Common",106,10663,0],["SUNC","SunocoCorp LLC Common",106,2517,0],["SUNE","SUNation Energy Inc.",33,4,0],["SUNS","Sunrise Realty Trust Inc.",30,135,0],["SUPL","SUPL",1,0,0],["SUPN","Supernus Pharmaceuticals Inc.",8,2952,0],["SUPP","SUPP",1,0,0],["SUPV","Grupo Supervielle S.A.",75,1088,0],["SUPX","SuperX AI Technology Limited",1,438,0],["SURE","SURE",1,0,0],["SURG","SurgePays Inc.",58,34,0],["SURI","SURI",1,0,0],["SUSA","SUSA",1,0,0],["SUSB","SUSB",1,0,0],["SUSC","SUSC",1,0,0],["SUSL","SUSL",1,0,0],["SUUN","PowerBank Corporation",129,60,0],["SUZ","Suzano S.A.",138,11971,0],["SVAC","Spring Valley Acquisition Corp. III Class A",2,0,0],["SVACU","Spring Valley Acquisition Corp. III Unit",2,0,0],["SVC","Service Properties Trust",30,321,0],["SVCC","Stellar V Capital Corp. Class A",1,0,0],["SVCO","Silvaco Group Inc.",25,130,0],["SVM","Silvercorp Metals Inc.",104,1906,0],["SVOL","SVOL",1,0,0],["SVRA","Savara Inc.",8,1231,0],["SVRE","SaverOne 2014 Ltd.",15,2,0],["SVRN","OceanPal Inc.",98,118,0],["SVV","Savers Value Village Inc.",66,1423,0],["SW","Smurfit WestRock plc",125,19901,0],["SWAG","Stran & Company Inc.",58,33,0],["SWAN","SWAN",1,0,0],["SWBI","Smith & Wesson Brands Inc.",78,461,0],["SWIM","Latham Group Inc.",64,734,0],["SWK","Stanley Black & Decker Inc.",7,11268,0],["SWKH","SWK Holdings Corporation",146,210,0],["SWKHL","SWK Holdings Corporation 9.00% Senior Notes due 2027",1,307,0],["SWKS","Skyworks Solutions Inc.",6,9697,0],["SWP","SWP",1,0,0],["SWVL","Swvl Holdings Corp Class A",36,19,0],["SWX","Southwest Gas Holdings Inc.",59,5820,0],["SWZ","Total Return Securities Fund",116,0,0],["SXC","SunCoke Energy Inc.",27,607,0],["SXI","Standex International Corporation",7,2726,0],["SXQG","SXQG",1,0,0],["SXT","Sensient Technologies Corporation",34,4110,0],["SXTC","China SXT Pharmaceuticals Inc.",8,187,0],["SXTP","60 Degrees Pharmaceuticals Inc.",8,3,0],["SY","So-Young International Inc. American Depository Shares",15,290,0],["SYBT","Stock Yards Bancorp Inc.",26,1985,0],["SYBX","Synlogic Inc.",8,14,0],["SYF","Synchrony Financial",44,30499,0],["SYF/PA","SYF/PA",1,0,0],["SYF/PB","SYF/PB",1,0,0],["SYFI","SYFI",1,0,0],["SYK","Stryker Corporation",31,135837,0],["SYM","Symbotic Inc. Class A",7,35301,0],["SYNA","Synaptics Incorporated",6,2890,0],["SYNX","Silynxcom Ltd.",133,4,0],["SYPR","Sypris Solutions Inc.",7,52,0],["SYRE","Spyre Therapeutics Inc.",8,2592,0],["SYY","Sysco Corporation",103,35670,0],["SYZ","SYZ",1,0,0],["SZK","SZK",1,0,0],["SZNE","SZNE",1,0,0],["SZZL","Sizzle Acquisition Corp. II Class A",2,0,0],["T","AT&T Inc.",33,171210,0],["T/PA","T/PA",1,0,0],["T/PC","T/PC",1,0,0],["TABD","TABD",1,0,0],["TAC","TransAlta Corporation",41,3728,0],["TACH","Titan Acquisition Corp. Class A",1,0,0],["TACHU","TACHU",1,0,0],["TACK","TACK",1,0,0],["TACN","TACN",1,0,0],["TACO","Berto Acquisition Corp.",2,369,0],["TACOU","Berto Acquisition Corp. Unit",2,0,0],["TACT","TransAct Technologies Incorporated",53,42,0],["TACU","TACU",1,0,0],["TAFI","TAFI",1,0,0],["TAFL","TAFL",1,0,0],["TAFM","TAFM",1,0,0],["TAGG","TAGG",1,0,0],["TAGS","TAGS",1,0,0],["TAK","Takeda Pharmaceutical Company Limited",8,46895,0],["TAL","TAL Education Group",3,6588,0],["TALK","Talkspace Inc.",35,588,0],["TALO","Talos Energy Inc.",59,1858,0],["TALV","TALV",1,0,0],["TAN","TAN",1,0,0],["TANH","Tantech Holdings Ltd.",34,1,0],["TAOP","Taoping Inc.",25,2,0],["TAOX","Tao Synergies Inc.",8,36,0],["TAP","Molson Coors Beverage Company Class B",46,8957,0],["TAP.A","TAP.A",1,0,0],["TARA","Protara Therapeutics Inc. ",13,272,0],["TARK","TARK",1,0,0],["TARS","Tarsus Pharmaceuticals Inc.",13,3455,0],["TASK","TaskUs Inc. Class A",15,1038,0],["TATT","TAT Technologies Ltd.",50,438,0],["TAVI","Tavia Acquisition Corp.",2,0,0],["TAVIU","Tavia Acquisition Corp. Unit",2,0,0],["TAX","TAX",1,0,0],["TAXE","TAXE",1,0,0],["TAXF","TAXF",1,0,0],["TAXI","TAXI",1,0,0],["TAXM","TAXM",1,0,0],["TAXS","TAXS",1,0,0],["TAXT","TAXT",1,0,0],["TAXX","TAXX",1,0,0],["TAYD","Taylor Devices Inc.",7,179,0],["TBB","AT&T Inc. 5.350% Global Notes due 2066",33,158810,0],["TBBB","BBB Foods Inc. Class A",67,3869,0],["TBBK","The Bancorp Inc",26,3025,0],["TBCH","Turtle Beach Corporation",33,265,0],["TBF","TBF",1,0,0],["TBFC","TBFC",1,0,0],["TBFG","TBFG",1,0,0],["TBG","TBG",1,0,0],["TBH","Brag House Holdings Inc.",45,12,0],["TBHC","The Brand House Collective Inc.",66,27,0],["TBI","TrueBlue Inc.",19,142,0],["TBIL","TBIL",1,0,0],["TBLA","Taboola.com Ltd.",16,1156,0],["TBLD","Thornburg Income Builder Opportunities Trust",11,637,0],["TBLL","TBLL",1,0,0],["TBLU","TBLU",1,0,0],["TBMC","Trailblazer Merger Corporation I Class A",2,0,0],["TBN","Tamboran Resources Corporation",59,512,0],["TBPH","Theravance Biopharma Inc.",8,952,0],["TBRG","TruBridge Inc.",15,336,0],["TBT","TBT",1,0,0],["TBUX","TBUX",1,0,0],["TBX","TBX",1,0,0],["TBXU","TBXU",1,0,0],["TC","Token Cat Limited",36,20,0],["TCAF","TCAF",1,0,0],["TCAI","TCAI",1,0,0],["TCAL","TCAL",1,0,0],["TCBI","Texas Capital Bancshares Inc.",26,4226,0],["TCBIO","Texas Capital Bancshares Inc.",26,945,0],["TCBK","TriCo Bancshares",26,1617,0],["TCBS","Texas Community Bancshares Inc.",43,48,0],["TCBX","Third Coast Bancshares Inc.",43,561,0],["TCGL","TechCreate Group Ltd. Class A",15,102,0],["TCHI","TCHI",1,0,0],["TCHP","TCHP",1,0,0],["TCI","Transcontinental Realty Investors Inc.",30,502,0],["TCMD","Tactile Systems Technology Inc.",31,646,0],["TCOM","Trip.com Group Limited",36,47179,0],["TCPA","TransCanada PipeLines Limited 6.250% Junior Subordinated Notes due 2085",1,0,0],["TCPB","TCPB",1,0,0],["TCPC","BlackRock TCP Capital Corp.",123,459,0],["TCRT","Alaunos Therapeutics Inc.",8,8,0],["TCRX","TScan Therapeutics Inc.",13,51,0],["TCV","TCV",1,0,0],["TCX","Tucows Inc. Class A",15,261,0],["TD","Toronto Dominion Bank (The)",75,158463,0],["TDAC","Translational Development Acquisition Corp.",1,0,0],["TDAY","USA TODAY Co. Inc.",124,808,0],["TDC","Teradata Corporation",25,2862,0],["TDF","Templeton Dragon Fund Inc.",123,0,0],["TDG","Transdigm Group Incorporated",21,71909,0],["TDI","TDI",1,0,0],["TDIC","Dreamland Limited Class A",3,7,0],["TDIV","TDIV",1,0,0],["TDOC","Teladoc Health Inc.",35,1283,0],["TDS","Telephone and Data Systems Inc.",33,4456,0],["TDS/PU","TDS/PU",1,0,0],["TDS/PV","TDS/PV",1,0,0],["TDSB","TDSB",1,0,0],["TDSC","TDSC",1,0,0],["TDTF","TDTF",1,0,0],["TDTH","Trident Digital Tech Holdings Ltd American Depository Shares",36,30,0],["TDTT","TDTT",1,0,0],["TDUP","ThredUp Inc. Class A",57,936,0],["TDVG","TDVG",1,0,0],["TDW","Tidewater Inc.",98,2496,0],["TDWD","Tailwind 2.0 Acquisition Corp. Class A",2,0,0],["TDWDU","Tailwind 2.0 Acquisition Corp. Unit",1,0,0],["TDY","Teledyne Technologies Incorporated",7,23945,0],["TE","T1 Energy Inc.",7,1662,0],["TEAD","Teads Holding Co.",16,71,0],["TEAM","Atlassian Corporation Class A",25,42379,0],["TEC","TEC",1,0,0],["TECB","TECB",1,0,0],["TECH","Bio-Techne Corp",13,9079,0],["TECK","Teck Resources Ltd",74,21842,0],["TECL","TECL",1,0,0],["TECS","TECS",1,0,0],["TECTP","Tectonic Financial Inc. 9.00% Fixed-to-Floating Rate Series B Non-Cumulative Perpetual",26,76,0],["TECX","Tectonic Therapeutic Inc.",13,366,0],["TEF","Telefonica SA",33,22340,0],["TEI","Templeton Emerging Markets Income Fund Inc.",116,0,0],["TEK","TEK",1,0,0],["TEKX","TEKX",1,0,0],["TEKY","TEKY",1,0,0],["TEL","TE Connectivity plc",76,67658,0],["TELA","TELA Bio Inc.",31,46,0],["TELO","Telomir Pharmaceuticals Inc.",8,48,0],["TEM","Tempus AI Inc. Class A",16,11468,0],["TEN","Tsakos Energy Navigation Ltd",98,664,0],["TEN/PE","TEN/PE",1,0,0],["TEN/PF","TEN/PF",1,0,0],["TENB","Tenable Holdings Inc.",25,2959,0],["TENX","Tenax Therapeutics Inc.",8,82,0],["TEO","Telecom Argentina SA",33,4876,0],["TEQI","TEQI",1,0,0],["TER","Teradyne Inc.",39,30567,0],["TERG","TERG",1,0,0],["TERN","Terns Pharmaceuticals Inc.",8,4140,0],["TESL","TESL",1,0,0],["TEVA","Teva Pharmaceutical Industries Limited",8,34820,0],["TEX","Terex Corporation",72,3539,0],["TEXN","TEXN",1,0,0],["TEXU","TEXU",1,0,0],["TFC","Truist Financial Corporation",26,64065,0],["TFC/PI","TFC/PI",1,0,0],["TFC/PO","TFC/PO",1,0,0],["TFC/PR","TFC/PR",1,0,0],["TFI","TFI",1,0,0],["TFII","TFI International Inc.",63,8601,0],["TFIN","Triumph Financial Inc.",26,1475,0],["TFIN/P","TFIN/P",1,0,0],["TFLO","TFLO",1,0,0],["TFLR","TFLR",1,0,0],["TFNS","TFNS",1,0,0],["TFPM","Triple Flag Precious Metals Corp.",104,7114,0],["TFPN","TFPN",1,0,0],["TFSA","Terra Income Fund 6 LLC 7.00% Notes due 2026",1,210,0],["TFSL","TFS Financial Corporation",84,4014,0],["TFX","Teleflex Incorporated",31,5387,0],["TG","Tredegar Corporation",55,263,0],["TGB","Taseko Mines Ltd.",104,1982,0],["TGE","The Generation Essentials Group Class A",124,53,0],["TGEN","Tecogen Inc.",7,150,0],["TGHL","The GrowHub Limited Class A",15,10,0],["TGL","Treasure Global Inc.",36,11,0],["TGLB","TGLB",1,0,0],["TGLS","Tecnoglass Inc.",76,2352,0],["TGNA","TEGNA Inc",83,3110,0],["TGRT","TGRT",1,0,0],["TGRW","TGRW",1,0,0],["TGS","Transportadora de Gas del Sur SA TGS",107,4747,0],["TGT","Target Corporation",113,44380,0],["TGTX","TG Therapeutics Inc.",8,4918,0],["TH","Target Hospitality Corp.",47,807,0],["THAR","Tharimmune Inc.",8,436,0],["THC","Tenet Healthcare Corporation",126,17254,0],["THCH","TH International Limited",68,71,0],["THD","THD",1,0,0],["THEQ","THEQ",1,0,0],["THFF","First Financial Corporation",26,759,0],["THG","Hanover Insurance Group Inc",22,6575,0],["THH","TryHard Holdings Limited",45,826,0],["THIR","THIR",1,0,0],["THLV","THLV",1,0,0],["THM","International Tower Hill Mines Ltd.",10,428,0],["THMZ","THMZ",1,0,0],["THNQ","THNQ",1,0,0],["THNR","THNR",1,0,0],["THO","Thor Industries Inc.",121,5602,0],["THQ","abrdn Healthcare Opportunities Fund Shares of Beneficial Interest",116,0,0],["THR","Thermon Group Holdings Inc.",7,1268,0],["THRM","Gentherm Inc",42,1133,0],["THRO","THRO",1,0,0],["THRV","THRV",1,0,0],["THRY","Thryv Holdings Inc.",58,266,0],["THS","Treehouse Foods Inc.",17,1192,0],["THTA","THTA",1,0,0],["THW","abrdn World Healthcare Fund Shares of Beneficial Interest",116,0,0],["THY","THY",1,0,0],["THYF","THYF",1,0,0],["THYM","THYM",1,0,0],["TIC","TIC Solutions Inc.",36,2252,0],["TIER","TIER",1,0,0],["TIGO","Millicom International Cellular S.A.",33,9247,0],["TIGR","UP Fintech Holding Ltd American Depositary Share representing fifteen Class A",60,1675,0],["TII","Titan Mining Corporation",1,231,0],["TIIV","TIIV",1,0,0],["TIL","Instil Bio Inc.",13,76,0],["TILE","Interface Inc.",73,1631,0],["TILL","TILL",1,0,0],["TIMB","TIM S.A.",33,9983,0],["TIME","TIME",1,0,0],["TINS","TINS",1,0,0],["TINT","TINT",1,0,0],["TINY","TINY",1,0,0],["TIP","TIP",1,0,0],["TIPA","TIPA",1,0,0],["TIPB","TIPB",1,0,0],["TIPC","TIPC",1,0,0],["TIPD","TIPD",1,0,0],["TIPT","Tiptree Inc.",22,683,0],["TIPX","TIPX",1,0,0],["TIPZ","TIPZ",1,0,0],["TIRX","TIAN RUIXIANG Holdings Ltd Class A",28,11,0],["TISI","Team Inc.",3,65,0],["TITN","Titan Machinery Inc.",66,372,0],["TIVC","Tivic Health Systems Inc.",77,3,0],["TJGC","TJGC Group Limited",58,14,0],["TJX","TJX Companies Inc. (The)",120,171678,0],["TK","Teekay Corporation Ltd.",98,766,0],["TKC","Turkcell Iletisim Hizmetleri AS",33,5192,0],["TKLF","Tokyo Lifestyle Co. Ltd.",66,12,0],["TKNO","Alpha Teknova Inc.",24,249,0],["TKO","TKO Group Holdings Inc. Class A",45,41638,0],["TKR","Timken Company (The)",55,5939,0],["TLCI","TLCI",1,0,0],["TLF","Tandy Leather Factory Inc.",86,22,0],["TLH","TLH",1,0,0],["TLIH","Ten-League International Holdings Limited",1,12,0],["TLK","PT Telekomunikasi Indonesia Tbk",33,20684,0],["TLN","Talen Energy Corporation",41,17007,0],["TLNC","Talon Capital Corp. Class A",1,0,0],["TLNCU","Talon Capital Corp.",2,0,0],["TLPH","Talphera Inc.",8,51,0],["TLRY","Tilray Brands Inc.",18,1296,0],["TLS","Telos Corporation",15,399,0],["TLSA","Tiziana Life Sciences Ltd.",8,169,0],["TLSI","TriSalus Life Sciences Inc.",23,371,0],["TLT","TLT",1,0,0],["TLTD","TLTD",1,0,0],["TLTE","TLTE",1,0,0],["TLX","Telix Pharmaceuticals Limited",8,2611,0],["TLYS","Tilly\'s Inc.",120,56,0],["TM","Toyota Motor Corporation",37,286267,0],["TMB","TMB",1,0,0],["TMC","TMC the metals company Inc.",10,3262,0],["TMCI","Treace Medical Concepts Inc.",31,164,0],["TMDE","TMD Energy Limited",80,15,0],["TMDX","TransMedics Group Inc.",77,4363,0],["TME","Tencent Music Entertainment Group",83,27555,0],["TMED","TMED",1,0,0],["TMET","TMET",1,0,0],["TMF","TMF",1,0,0],["TMH","TMH",1,0,0],["TMHC","Taylor Morrison Home Corporation",121,5843,0],["TMNL","TMNL",1,0,0],["TMNS","TMNS",1,0,0],["TMO","Thermo Fisher Scientific Inc",7,213338,0],["TMP","Tompkins Financial Corporation",26,1085,0],["TMQ","Trilogy Metals Inc.",104,764,0],["TMSF","TMSF",1,0,0],["TMSL","TMSL",1,0,0],["TMUS","T-Mobile US Inc.",33,220044,0],["TMUSI","T-Mobile US Inc. 5.500% Senior Notes due June 2070",33,0,0],["TMUSL","T-Mobile US Inc. 6.250% Senior Notes due 2069",33,0,0],["TMUSZ","T-Mobile US Inc. 5.500% Senior Notes due March 2070",33,0,0],["TMV","TMV",1,0,0],["TMVE","TMVE",1,0,0],["TNA","TNA",1,0,0],["TNC","Tennant Company",7,1352,0],["TNDM","Tandem Diabetes Care Inc.",31,1496,0],["TNET","TriNet Group Inc.",36,2799,0],["TNGX","Tango Therapeutics Inc.",8,1147,0],["TNGY","TNGY",1,0,0],["TNK","Teekay Tankers Ltd.",98,1863,0],["TNL","Travel Leisure Co. Common Stock",47,4635,0],["TNMG","TNL Mediagene",58,4,0],["TNON","Tenon Medical Inc.",31,18,0],["TNUK","TNUK",1,0,0],["TNXP","Tonix Pharmaceuticals Holding Corp.",8,201,0],["TNYA","Tenaya Therapeutics Inc.",13,150,0],["TOAK","TOAK",1,0,0],["TOGA","TOGA",1,0,0],["TOI","The Oncology Institute Inc.",35,344,0],["TOK","TOK",1,0,0],["TOL","Toll Brothers Inc.",121,13473,0],["TOLZ","TOLZ",1,0,0],["TOMZ","TOMI Environmental Solutions Inc.",34,19,0],["TONX","TON Strategy Company",3,144,0],["TOON","Kartoon Studios Inc.",89,51,0],["TOP","TOP Financial Group Limited Class A",60,39,0],["TOPC","TOPC",1,0,0],["TOPP","Toppoint Holdings Inc.",63,17,0],["TOPS","TOP Ships Inc.",98,23,0],["TOPT","TOPT",1,0,0],["TORO","Toro Corp.",98,106,0],["TOST","Toast Inc. Class A",15,21297,0],["TOT","TOT",1,0,0],["TOTL","TOTL",1,0,0],["TOTR","TOTR",1,0,0],["TOUR","Tuniu Corporation",87,79,0],["TOUS","TOUS",1,0,0],["TOV","TOV",1,0,0],["TOVX","Theriva Biologics Inc.",8,10,0],["TOWN","TowneBank",26,2606,0],["TOYO","TOYO Co. Ltd",69,291,0],["TPB","Turning Point Brands Inc.",152,2083,0],["TPC","Tutor Perini Corporation",136,3691,0],["TPCS","TechPrecision Corporation",55,46,0],["TPET","Trio Petroleum Corp.",59,6,0],["TPG","TPG Inc. Class A",11,24438,0],["TPGXL","TPG Operating Group II L.P. 6.950% Fixed-Rate Junior Subordinated Notes due 2064",1,9048,0],["TPH","Tri Pointe Homes Inc.",121,2757,0],["TPHD","TPHD",1,0,0],["TPIF","TPIF",1,0,0],["TPL","Texas Pacific Land Corporation",59,20655,0],["TPLC","TPLC",1,0,0],["TPLS","TPLS",1,0,0],["TPOR","TPOR",1,0,0],["TPR","Tapestry Inc.",86,25667,0],["TPSC","TPSC",1,0,0],["TPST","Tempest Therapeutics Inc.",8,15,0],["TPTA","Terra Property Trust Inc. 6.00% Notes due 2026",30,577,0],["TPVG","TriplePoint Venture Growth BDC Corp.",3,250,0],["TPYP","TPYP",1,0,0],["TPZ","TPZ",1,0,0],["TQQQ","TQQQ",1,0,0],["TQQY","TQQY",1,0,0],["TR","Tootsie Roll Industries Inc.",93,2755,0],["TRAK","ReposiTrak Inc.",15,238,0],["TRAW","Traws Pharma Inc.",8,10,0],["TRBF","TRBF",1,0,0],["TRC","Tejon Ranch Co",36,424,0],["TRDA","Entrada Therapeutics Inc.",8,420,0],["TREE","LendingTree Inc.",44,716,0],["TREX","Trex Company Inc.",56,3789,0],["TRFK","TRFK",1,0,0],["TRFM","TRFM",1,0,0],["TRGP","Targa Resources Inc.",107,38409,0],["TRI","Thomson Reuters Corporation",109,58555,0],["TRIB","Trinity Biotech plc",24,17,0],["TRIL","TRIL",1,0,0],["TRIN","Trinity Capital Inc.",44,1141,0],["TRINI","Trinity Capital Inc. 7.875% Notes Due 2029",44,1780,0],["TRINZ","Trinity Capital Inc. 7.875% Notes due 2029",44,1770,0],["TRIP","TripAdvisor Inc.",16,1622,0],["TRMB","Trimble Inc.",7,19243,0],["TRMD","TORM plc Class A",98,1910,0],["TRMK","Trustmark Corporation",26,2450,0],["TRN","Trinity Industries Inc.",117,2280,0],["TRND","TRND",1,0,0],["TRNO","Terreno Realty Corporation",36,6274,0],["TRNR","Interactive Strength Inc.",133,4,0],["TRNS","Transcat Inc.",39,556,0],["TRON","Tron Inc.",61,383,0],["TROO","TROOPS Inc.",146,215,0],["TROW","T. Rowe Price Group Inc.",60,22540,0],["TROX","Tronox Holdings plc",34,691,0],["TRP","TC Energy Corporation",107,56599,0],["TRS","TriMas Corporation",32,1428,0],["TRSG","Tungray Technologies Inc Class A",7,19,0],["TRST","TrustCo Bank Corp NY",26,798,0],["TRT","Trio-Tech International",7,45,0],["TRTN/PA","TRTN/PA",1,0,0],["TRTN/PB","TRTN/PB",1,0,0],["TRTN/PC","TRTN/PC",1,0,0],["TRTN/PD","TRTN/PD",1,0,0],["TRTN/PE","TRTN/PE",1,0,0],["TRTN/PF","TRTN/PF",1,0,0],["TRTX","TPG RE Finance Trust Inc.",30,717,0],["TRTX/PC","TRTX/PC",1,0,0],["TRU","TransUnion",44,16913,0],["TRUD","TRUD",1,0,0],["TRUE","TrueCar Inc.",16,190,0],["TRUG","TruGolf Holdings Inc. Class A",61,2,0],["TRUP","Trupanion Inc.",23,1642,0],["TRUT","TRUT",1,0,0],["TRV","The Travelers Companies Inc.",22,65340,0],["TRVG","trivago N.V.",15,204,0],["TRVI","Trevi Therapeutics Inc.",8,1668,0],["TRX","TRX Gold Corporation",104,259,0],["TS","Tenaris S.A.",27,20471,0],["TSAT","Telesat Corporation Class A",55,1026,0],["TSBK","Timberland Bancorp Inc.",43,287,0],["TSCO","Tractor Supply Company",130,27160,0],["TSCV","TSCV",1,0,0],["TSDD","TSDD",1,0,0],["TSE","Trinseo PLC",34,18,0],["TSEC","TSEC",1,0,0],["TSEL","TSEL",1,0,0],["TSEM","Tower Semiconductor Ltd.",6,13317,0],["TSHA","Taysha Gene Therapies Inc.",13,1504,0],["TSI","TCW Strategic Income Fund Inc.",11,0,0],["TSL","TSL",1,0,0],["TSLA","Tesla Inc.",37,1600384,0],["TSLG","TSLG",1,0,0],["TSLI","TSLI",1,0,0],["TSLL","TSLL",1,0,0],["TSLQ","TSLQ",1,0,0],["TSLR","TSLR",1,0,0],["TSLS","TSLS",1,0,0],["TSLX","Sixth Street Specialty Lending Inc.",11,2040,0],["TSLY","TSLY",1,0,0],["TSM","Taiwan Semiconductor Manufacturing Company Ltd.",6,1498653,0],["TSME","TSME",1,0,0],["TSMG","TSMG",1,0,0],["TSMU","TSMU",1,0,0],["TSMX","TSMX",1,0,0],["TSMY","TSMY",1,0,0],["TSMZ","TSMZ",1,0,0],["TSN","Tyson Foods Inc.",62,20643,0],["TSPA","TSPA",1,0,0],["TSPY","TSPY",1,0,0],["TSQ","Townsquare Media Inc. Class A",83,87,0],["TSSI","TSS Inc.",19,218,0],["TSXD","TSXD",1,0,0],["TSXU","TSXU",1,0,0],["TSYY","TSYY",1,0,0],["TT","Trane Technologies plc",42,86443,0],["TTAM","Titan America SA",74,3140,0],["TTAN","ServiceTitan Inc. Class A",25,10174,0],["TTC","Toro Company (The)",153,7604,0],["TTD","The Trade Desk Inc. Class A",16,18019,0],["TTE","TotalEnergies SE",59,143348,0],["TTEC","TTEC Holdings Inc.",19,178,0],["TTEK","Tetra Tech Inc.",21,8986,0],["TTEQ","TTEQ",1,0,0],["TTGT","TechTarget Inc.",33,401,0],["TTI","Tetra Technologies Inc.",59,1206,0],["TTMI","TTM Technologies Inc.",39,7272,0],["TTOP","TTOP",1,0,0],["TTRX","Turn Therapeutics Inc.",8,88,0],["TTSH","Tile Shop Holdings Inc.",73,186,0],["TTT","TTT",1,0,0],["TTWO","Take-Two Interactive Software Inc.",45,45714,0],["TTXD","TTXD",1,0,0],["TTXU","TTXU",1,0,0],["TU","Telus Corporation",33,19520,0],["TUA","TUA",1,0,0],["TUG","TUG",1,0,0],["TUGN","TUGN",1,0,0],["TUR","TUR",1,0,0],["TURB","Turbo Energy S.A.",7,10,0],["TURF","TURF",1,0,0],["TUSB","TUSB",1,0,0],["TUSK","Mammoth Energy Services Inc.",20,89,0],["TUYA","Tuya Inc.",25,1384,0],["TV","Grupo Televisa S.A.B.",83,5577,0],["TVA","Texas Ventures Acquisition III Corp Class A",1,0,0],["TVACU","TVACU",1,0,0],["TVAI","Thayer Ventures Acquisition Corporation II Class A",1,0,0],["TVAIU","Thayer Ventures Acquisition Corporation II Unit",2,0,0],["TVAL","TVAL",1,0,0],["TVC","Tennessee Valley Authority",41,0,0],["TVE","Tennessee Valley Authority",41,0,0],["TVGN","Tevogen Bio Holdings Inc.",13,75,0],["TVRD","Tvardi Therapeutics Inc.",8,37,0],["TVTX","Travere Therapeutics Inc.",8,3088,0],["TW","Tradeweb Markets Inc. Class A",60,24717,0],["TWAV","TaoWeave Inc.",16,7,0],["TWFG","TWFG Inc. Class A",28,1607,0],["TWG","Top Wealth Group Holding Limited Class A",17,6,0],["TWI","Titan International Inc. (DE)",27,502,0],["TWIN","Twin Disc Incorporated",7,223,0],["TWLO","Twilio Inc. Class A",25,21490,0],["TWLVU","Twelve Seas Investment Company III",2,0,0],["TWM","TWM",1,0,0],["TWN","Taiwan Fund Inc. (The)",81,0,0],["TWNP","Twin Hospitality Group Inc. Class A",68,46,0],["TWO","Two Harbors Investment Corp",30,1188,0],["TWO/PA","TWO/PA",1,0,0],["TWO/PB","TWO/PB",1,0,0],["TWO/PC","TWO/PC",1,0,0],["TWOD","Two Harbors Investments Corp 9.375% Senior Notes due 2030",30,0,0],["TWST","Twist Bioscience Corporation",13,1988,0],["TX","Ternium S.A. Ternium S.A.",27,7462,0],["TXBC","TXBC",1,0,0],["TXG","10x Genomics Inc. Class A",71,2031,0],["TXMD","TherapeuticsMD Inc.",8,20,0],["TXN","Texas Instruments Incorporated",6,160181,0],["TXNM","TXNM Energy Inc.",41,6399,0],["TXO","TXO Partners L.P. Common",59,585,0],["TXRH","Texas Roadhouse Inc.",68,11626,0],["TXS","TXS",1,0,0],["TXT","Textron Inc.",50,15765,0],["TXUE","TXUE",1,0,0],["TXUG","TXUG",1,0,0],["TXXD","TXXD",1,0,0],["TXXI","TXXI",1,0,0],["TXXS","TXXS",1,0,0],["TY","Tri Continental Corporation",116,1773,0],["TY/P","TY/P",1,0,0],["TYD","TYD",1,0,0],["TYG","Tortoise Energy Infrastructure Corporation",11,486,0],["TYGO","Tigo Energy Inc.",6,113,0],["TYL","Tyler Technologies Inc.",25,19702,0],["TYLG","TYLG",1,0,0],["TYO","TYO",1,0,0],["TYRA","Tyra Biosciences Inc.",8,1362,0],["TZA","TZA",1,0,0],["TZOO","Travelzoo",58,78,0],["U","Unity Software Inc.",25,19864,0],["UA","Under Armour Inc. Class C",86,1831,0],["UAA","Under Armour Inc. Class A",86,1920,0],["UAE","UAE",1,0,0],["UAL","United Airlines Holdings Inc.",4,36903,0],["UAMY","United States Antimony Corporation",55,675,0],["UAN","CVR Partners LP Common",85,1009,0],["UAVS","AgEagle Aerial Systems Inc.",50,41,0],["UBCP","United Bancorp Inc.",26,82,0],["UBER","Uber Technologies Inc.",36,164793,0],["UBFO","United Security Bancshares",26,182,0],["UBND","UBND",1,0,0],["UBOT","UBOT",1,0,0],["UBR","UBR",1,0,0],["UBRL","UBRL",1,0,0],["UBS","UBS Group AG Registered",26,296337,0],["UBSI","United Bankshares Inc.",26,5608,0],["UBT","UBT",1,0,0],["UBXG","U-BX Technology Ltd. Class A",16,60,0],["UCAR","U Power Limited Class A",42,7,0],["UCB","United Community Banks Inc.",26,3921,0],["UCC","UCC",1,0,0],["UCIB","UCIB",1,0,0],["UCL","uCloudlink Group Inc.",33,73,0],["UCO","UCO",1,0,0],["UCON","UCON",1,0,0],["UCRD","UCRD",1,0,0],["UCTT","Ultra Clean Holdings Inc.",6,1162,0],["UCYB","UCYB",1,0,0],["UDI","UDI",1,0,0],["UDIV","UDIV",1,0,0],["UDMY","Udemy Inc.",3,874,0],["UDN","UDN",1,0,0],["UDOW","UDOW",1,0,0],["UDR","UDR Inc.",30,11782,0],["UE","Urban Edge Properties",36,2434,0],["UEC","Uranium Energy Corp.",52,5989,0],["UEIC","Universal Electronics Inc.",133,42,0],["UEVM","UEVM",1,0,0],["UFCS","United Fire Group Inc.",22,941,0],["UFG","Uni-Fuels Holdings Limited Class A",80,28,0],["UFI","Unifi Inc. New",115,61,0],["UFIV","UFIV",1,0,0],["UFO","UFO",1,0,0],["UFPI","UFP Industries Inc.",56,5431,0],["UFPT","UFP Technologies Inc.",31,1769,0],["UG","United-Guardian Inc.",90,28,0],["UGA","UGA",1,0,0],["UGE","UGE",1,0,0],["UGI","UGI Corporation",107,8174,0],["UGL","UGL",1,0,0],["UGP","Ultrapar Participacoes S.A. (New)",140,3982,0],["UGRO","urban-gro Inc.",32,5,0],["UHAL","U-Haul Holding Company",96,10127,0],["UHAL.B","UHAL.B",1,0,0],["UHG","United Homes Group Inc Class A",121,86,0],["UHS","Universal Health Services Inc.",126,14212,0],["UHT","Universal Health Realty Income Trust",30,575,0],["UI","Ubiquiti Inc.",49,34159,0],["UIS","Unisys Corporation New",15,200,0],["UITB","UITB",1,0,0],["UIVM","UIVM",1,0,0],["UJB","UJB",1,0,0],["UK","Ucommune International Ltd",36,2,0],["UL","Unilever PLC",90,145344,0],["ULBI","Ultralife Corporation",7,96,0],["ULCC","Frontier Group Holdings Inc.",4,1122,0],["ULE","ULE",1,0,0],["ULH","Universal Logistics Holdings Inc.",63,419,0],["ULS","UL Solutions Inc. Class A",139,15468,0],["ULST","ULST",1,0,0],["ULTA","Ulta Beauty Inc.",66,26523,0],["ULTI","ULTI",1,0,0],["ULTY","ULTY",1,0,0],["ULVM","ULVM",1,0,0],["ULY","Urgent.ly Inc.",15,4,0],["UMAC","Unusual Machines Inc.",49,363,0],["UMBF","UMB Financial Corporation",26,9035,0],["UMBFO","UMB Financial Corporation",26,2070,0],["UMC","United Microelectronics Corporation (NEW)",6,20348,0],["UMDD","UMDD",1,0,0],["UMH","UMH Properties Inc.",30,1352,0],["UMH/PD","UMH/PD",1,0,0],["UMI","UMI",1,0,0],["UMMA","UMMA",1,0,0],["UNB","Union Bankshares Inc.",26,109,0],["UNCY","Unicycive Therapeutics Inc.",8,119,0],["UNF","Unifirst Corporation",3,3083,0],["UNFI","United Natural Foods Inc.",103,2047,0],["UNG","UNG",1,0,0],["UNH","UnitedHealth Group Incorporated",23,296590,0],["UNHG","UNHG",1,0,0],["UNIT","Uniti Group Inc.",30,1702,0],["UNIY","UNIY",1,0,0],["UNL","UNL",1,0,0],["UNM","Unum Group",143,13259,0],["UNMA","Unum Group 6.250% Junior Subordinated Notes due 2058",143,3951,0],["UNP","Union Pacific Corporation",117,138936,0],["UNTY","Unity Bancorp Inc.",26,549,0],["UOKA","MDJM LTD Class A",36,3,0],["UONE","Urban One Inc. Class A",83,53,0],["UONEK","Urban One Inc. Class D",83,49,0],["UP","Wheels Up Experience Inc. Class A",87,477,0],["UPAR","UPAR",1,0,0],["UPB","Upstream Bio Inc.",8,1586,0],["UPBD","Upbound Group Inc.",12,1003,0],["UPC","Universe Pharmaceuticals Inc.",8,2,0],["UPGD","UPGD",1,0,0],["UPGR","UPGR",1,0,0],["UPLD","Upland Software Inc.",25,42,0],["UPRO","UPRO",1,0,0],["UPS","United Parcel Service Inc.",63,86467,0],["UPSG","UPSG",1,0,0],["UPST","Upstart Holdings Inc.",44,4630,0],["UPV","UPV",1,0,0],["UPW","UPW",1,0,0],["UPWK","Upwork Inc.",15,2691,0],["UPXI","Upexi Inc.",18,138,0],["URA","URA",1,0,0],["URAA","URAA",1,0,0],["URBN","Urban Outfitters Inc.",120,7294,0],["URE","URE",1,0,0],["URG","Ur Energy Inc",104,549,0],["URGN","UroGen Pharma Ltd.",8,1067,0],["URI","United Rentals Inc.",12,51694,0],["URNJ","URNJ",1,0,0],["URNM","URNM",1,0,0],["UROY","Uranium Royalty Corp.",60,529,0],["URSP","URSP",1,0,0],["URTH","URTH",1,0,0],["URTY","URTY",1,0,0],["USA","Liberty All-Star Equity Fund",116,0,0],["USAC","USA Compression Partners LP Common",107,2779,0],["USAF","USAF",1,0,0],["USAI","USAI",1,0,0],["USAR","USA Rare Earth Inc. Class A",10,1836,0],["USAS","Americas Gold and Silver Corporation",10,1513,0],["USAU","U.S. Gold Corp.",10,272,0],["USB","U.S. Bancorp",26,84188,0],["USB/PA","USB/PA",1,0,0],["USB/PH","USB/PH",1,0,0],["USB/PP","USB/PP",1,0,0],["USB/PQ","USB/PQ",1,0,0],["USB/PR","USB/PR",1,0,0],["USB/PS","USB/PS",1,0,0],["USBC","USBC Inc.",7,289,0],["USCA","USCA",1,0,0],["USCB","USCB Financial Holdings Inc. Class A",26,347,0],["USCI","USCI",1,0,0],["USCL","USCL",1,0,0],["USD","USD",1,0,0],["USDU","USDU",1,0,0],["USDX","USDX",1,0,0],["USE","USE",1,0,0],["USEA","United Maritime Corporation",98,17,0],["USEG","U.S. Energy Corp.",59,55,0],["USFD","US Foods Holding Corp.",103,17256,0],["USFI","USFI",1,0,0],["USFR","USFR",1,0,0],["USG","USG",1,0,0],["USGO","U.S. GoldMining Inc.",104,130,0],["USIG","USIG",1,0,0],["USIN","USIN",1,0,0],["USIO","Usio Inc.",60,38,0],["USL","USL",1,0,0],["USLM","United States Lime & Minerals Inc.",74,3653,0],["USMC","USMC",1,0,0],["USML","USML",1,0,0],["USNA","USANA Health Sciences Inc.",18,364,0],["USNG","USNG",1,0,0],["USNZ","USNZ",1,0,0],["USO","USO",1,0,0],["USOI","USOI",1,0,0],["USOY","USOY",1,0,0],["USPH","U.S. Physical Therapy Inc.",35,1184,0],["USPX","USPX",1,0,0],["USRD","USRD",1,0,0],["USRT","USRT",1,0,0],["USSE","USSE",1,0,0],["USSG","USSG",1,0,0],["USSH","USSH",1,0,0],["UST","UST",1,0,0],["USTB","USTB",1,0,0],["USVM","USVM",1,0,0],["USVN","USVN",1,0,0],["USXF","USXF",1,0,0],["UTEN","UTEN",1,0,0],["UTES","UTES",1,0,0],["UTF","Cohen & Steers Infrastructure Fund Inc",116,0,0],["UTG","Reaves Utility Income Fund",11,0,0],["UTHR","United Therapeutics Corporation",8,22266,0],["UTHY","UTHY",1,0,0],["UTI","Universal Technical Institute Inc",3,1431,0],["UTL","UNITIL Corporation",129,857,0],["UTMD","Utah Medical Products Inc.",31,181,0],["UTRE","UTRE",1,0,0],["UTSI","UTStarcom Holdings Corp.",33,23,0],["UTSL","UTSL",1,0,0],["UTWO","UTWO",1,0,0],["UTWY","UTWY",1,0,0],["UTZ","Utz Brands Inc Class A",17,1467,0],["UUP","UUP",1,0,0],["UUU","Universal Safety Products Inc.",76,12,0],["UUUU","Energy Fuels Inc",74,3576,0],["UVE","UNIVERSAL INSURANCE HOLDINGS INC",22,951,0],["UVSP","Univest Financial Corporation",26,971,0],["UVV","Universal Corporation",48,1342,0],["UWM","UWM",1,0,0],["UWMC","UWM Holdings Corporation Class A",44,7791,0],["UXI","UXI",1,0,0],["UXIN","Uxin Limited ADS",36,703,0],["UXRP","UXRP",1,0,0],["UYG","UYG",1,0,0],["UYLD","UYLD",1,0,0],["UYM","UYM",1,0,0],["UYSC","UY Scuti Acquisition Corp.",2,0,0],["UYSCU","UYSCU",1,0,0],["UZD","Array Digital Infrastructure Inc. 6.250% Senior Notes due 2069",33,1722,0],["UZE","Array Digital Infrastructure Inc. 5.500% Senior Notes due 2070",33,1540,0],["UZF","Array Digital Infrastructure Inc. 5.500% Senior Notes due 2070",33,1539,0],["V","Visa Inc.",36,672559,0],["VABK","Virginia National Bankshares Corporation",26,229,0],["VABS","VABS",1,0,0],["VAC","Marriott Vacations Worldwide Corporation",36,1999,0],["VACH","Voyager Acquisition Corp Class A",1,0,0],["VACHU","Voyager Acquisition Corp Unit",2,0,0],["VACI","Viking Acquisition Corp. I Class A",33,0,0],["VACI.U","VACI.U",1,0,0],["VAL","Valaris Limited",59,3445,0],["VALE","VALE S.A. ",10,54299,0],["VALG","VALG",1,0,0],["VALN","Valneva SE",13,656,0],["VALQ","VALQ",1,0,0],["VALU","Value Line Inc.",11,369,0],["VANI","Vivani Medical Inc.",77,101,0],["VATE","INNOVATE Corp.",55,71,0],["VAW","VAW",1,0,0],["VB","VB",1,0,0],["VBF","Invesco Bond Fund",81,0,0],["VBIL","VBIL",1,0,0],["VBIX","Viewbix Inc.",25,11,0],["VBK","VBK",1,0,0],["VBND","VBND",1,0,0],["VBNK","VersaBank",75,490,0],["VBR","VBR",1,0,0],["VC","Visteon Corporation",42,2725,0],["VCEL","Vericel Corporation",13,1823,0],["VCIC","Vine Hill Capital Investment Corp. Class A",1,0,0],["VCICU","Vine Hill Capital Investment Corp. Unit",2,0,0],["VCIG","VCI Global Limited",12,1,0],["VCIT","VCIT",1,0,0],["VCLN","VCLN",1,0,0],["VCLT","VCLT",1,0,0],["VCOB","VCOB",1,0,0],["VCR","VCR",1,0,0],["VCRB","VCRB",1,0,0],["VCSH","VCSH",1,0,0],["VCTR","Victory Capital Holdings Inc. Class A",11,4086,0],["VCV","Invesco California Value Municipal Income Trust",81,518,0],["VCYT","Veracyte Inc.",23,3393,0],["VDC","VDC",1,0,0],["VDE","VDE",1,0,0],["VDI","VDI",1,0,0],["VEA","VEA",1,0,0],["VECO","Veeco Instruments Inc.",7,1762,0],["VEEA","Veea Inc.",2,37,0],["VEEE","Twin Vee PowerCats Co.",98,4,0],["VEEV","Veeva Systems Inc. Class A",25,36470,0],["VEGA","VEGA",1,0,0],["VEGI","VEGI",1,0,0],["VEL","Velocity Financial Inc.",44,760,0],["VELO","Velo3D Inc.",7,226,0],["VEMY","VEMY",1,0,0],["VENU","Venu Holding Corporation",45,388,0],["VEON","VEON Ltd. ADS",33,3809,0],["VERA","Vera Therapeutics Inc. Class A",8,3587,0],["VERI","Veritone Inc.",15,460,0],["VERO","Venus Concept Inc.",31,4,0],["VERS","VERS",1,0,0],["VERU","Veru Inc.",8,37,0],["VERX","Vertex Inc. Class A",25,3194,0],["VET","Vermilion Energy Inc. Common (Canada)",59,1243,0],["VETZ","VETZ",1,0,0],["VEU","VEU",1,0,0],["VEXC","VEXC",1,0,0],["VFC","V.F. Corporation",118,7275,0],["VFF","Village Farms International Inc.",1,464,0],["VFH","VFH",1,0,0],["VFL","abrdn National Municipal Income Fund",123,0,0],["VFLO","VFLO",1,0,0],["VFS","VinFast Auto Ltd.",37,8022,0],["VG","Venture Global Inc. Class A",140,15546,0],["VGAS","Verde Clean Fuels Inc. Class A",34,116,0],["VGI","Virtus Global Multi-Sector Income Fund",11,0,0],["VGIT","VGIT",1,0,0],["VGK","VGK",1,0,0],["VGLT","VGLT",1,0,0],["VGM","Invesco Trust for Investment Grade Municipals",81,559,0],["VGSH","VGSH",1,0,0],["VGSR","VGSR",1,0,0],["VGT","VGT",1,0,0],["VGUS","VGUS",1,0,0],["VGVT","VGVT",1,0,0],["VGZ","Vista Gold Corp",104,265,0],["VHC","VirnetX Holding Corp",29,78,0],["VHCPU","Vine Hill Capital Investment Corp. II",2,0,0],["VHI","Valhi Inc.",34,336,0],["VHT","VHT",1,0,0],["VIA","Via Transportation Inc. Class A",25,2697,0],["VIASP","Via Renewables Inc. 8.75% Series A Fixed-to-Floating Rate Cumulative Redeemable Perpetual",129,188,0],["VIAV","Viavi Solutions Inc.",6,4022,0],["VICE","VICE",1,0,0],["VICI","VICI Properties Inc.",30,29606,0],["VICR","Vicor Corporation",7,4662,0],["VIDI","VIDI",1,0,0],["VIG","VIG",1,0,0],["VIGI","VIGI",1,0,0],["VIK","Viking Holdings Ltd",98,32455,0],["VINP","Vinci Compass Investments Ltd. Class A",11,815,0],["VIOG","VIOG",1,0,0],["VIOO","VIOO",1,0,0],["VIOT","Viomi Technology Co. Ltd",133,139,0],["VIOV","VIOV",1,0,0],["VIPS","Vipshop Holdings Limited",57,11344,0],["VIR","Vir Biotechnology Inc.",13,801,0],["VIRC","Virco Manufacturing Corporation",32,101,0],["VIRT","Virtu Financial Inc. Class A",60,5176,0],["VIS","VIS",1,0,0],["VIST","Vista Energy S.A.B. de C.V.",59,4420,0],["VITL","Vital Farms Inc.",17,1495,0],["VIV","Telefonica Brasil S.A.",33,19195,0],["VIVK","Vivakor Inc.",122,13,0],["VIVS","VivoSim Labs Inc.",13,5,0],["VIXI","VIXI",1,0,0],["VKI","Invesco Advantage Municipal Income Trust II",116,395,0],["VKQ","Invesco Municipal Trust",81,533,0],["VKTX","Viking Therapeutics Inc.",8,3978,0],["VLGEA","Village Super Market Inc. Class A",67,559,0],["VLLU","VLLU",1,0,0],["VLN","Valens Semiconductor Ltd.",6,158,0],["VLO","Valero Energy Corporation",106,49628,0],["VLRS","Controladora Vuela Compania de Aviacion S.A.B. de C.V.",4,1107,0],["VLT","Invesco High Income Trust II",81,0,0],["VLTO","Veralto Corp",39,24976,0],["VLU","VLU",1,0,0],["VLY","Valley National Bancorp",26,6703,0],["VLYPN","Valley National Bancorp 8.250% Fixed-Rate Reset Non-Cumulative Perpetual",26,14515,0],["VLYPO","Valley National Bancorp 5.50% Fixed-to-Floating Rate Non-Cumulative Perpetual",26,13974,0],["VLYPP","Valley National Bancorp 6.25% Fixed-to-Floating Rate Non-Cumulative Perpetual",26,14025,0],["VMAR","Vision Marine Technologies Inc.",98,5,0],["VMBS","VMBS",1,0,0],["VMC","Vulcan Materials Company (Holding Company)",74,38565,0],["VMD","Viemed Healthcare Inc.",137,282,0],["VMI","Valmont Industries Inc.",55,8108,0],["VMO","Invesco Municipal Opportunity Trust",81,646,0],["VMSB","VMSB",1,0,0],["VNAM","VNAM",1,0,0],["VNCE","Vince Holding Corp.",120,54,0],["VNDA","Vanda Pharmaceuticals Inc.",8,399,0],["VNET","VNET Group Inc.",16,2354,0],["VNIE","VNIE",1,0,0],["VNLA","VNLA",1,0,0],["VNME","Vendome Acquisition Corporation I Class A",2,0,0],["VNMEU","Vendome Acquisition Corporation I Unit",2,0,0],["VNO","Vornado Realty Trust",30,6409,0],["VNO/PL","VNO/PL",1,0,0],["VNO/PM","VNO/PM",1,0,0],["VNO/PN","VNO/PN",1,0,0],["VNO/PO","VNO/PO",1,0,0],["VNOM","Viper Energy Inc. Class A",59,13629,0],["VNQ","VNQ",1,0,0],["VNQI","VNQI",1,0,0],["VNRX","VolitionRX Limited",24,31,0],["VNSE","VNSE",1,0,0],["VNT","Vontier Corporation",7,5493,0],["VNTG","Vantage Corp Class A",105,29,0],["VO","VO",1,0,0],["VOC","VOC Energy Trust",59,48,0],["VOD","Vodafone Group Plc",33,30507,0],["VOE","VOE",1,0,0],["VOLT","VOLT",1,0,0],["VONE","VONE",1,0,0],["VONG","VONG",1,0,0],["VONV","VONV",1,0,0],["VOO","VOO",1,0,0],["VOOG","VOOG",1,0,0],["VOOV","VOOV",1,0,0],["VOR","Vor Biopharma Inc.",13,272,0],["VOT","VOT",1,0,0],["VOTE","VOTE",1,0,0],["VOX","VOX",1,0,0],["VOXR","Vox Royalty Corp.",104,354,0],["VOYA","Voya Financial Inc.",5,7165,0],["VOYA/PB","VOYA/PB",1,0,0],["VOYG","Voyager Technologies Inc. Class A",21,1605,0],["VPC","VPC",1,0,0],["VPG","Vishay Precision Group Inc.",39,515,0],["VPL","VPL",1,0,0],["VPLS","VPLS",1,0,0],["VPU","VPU",1,0,0],["VPV","Invesco Pennsylvania Value Municipal Income Trust",81,247,0],["VRA","Vera Bradley Inc.",86,66,0],["VRAI","VRAI",1,0,0],["VRAR","The Glimpse Group Inc.",15,20,0],["VRAX","Virax Biolabs Group Limited",24,2,0],["VRCA","Verrica Pharmaceuticals Inc.",8,125,0],["VRDN","Viridian Therapeutics Inc.",23,3047,0],["VRE","Veris Residential Inc.",30,1367,0],["VREX","Varex Imaging Corporation",7,512,0],["VRIG","VRIG",1,0,0],["VRM","Vroom Inc.",97,129,0],["VRME","VerifyMe Inc.",15,9,0],["VRNS","Varonis Systems Inc.",25,3940,0],["VRP","VRP",1,0,0],["VRRM","Verra Mobility Corporation Class A",87,3530,0],["VRSK","Verisk Analytics Inc.",12,30387,0],["VRSN","VeriSign Inc.",15,22622,0],["VRT","Vertiv Holdings LLC Class A",7,61105,0],["VRTL","VRTL",1,0,0],["VRTS","Virtus Investment Partners Inc.",11,1091,0],["VRTX","Vertex Pharmaceuticals Incorporated",8,115747,0],["VS","Versus Systems Inc.",15,6,0],["VSA","VisionSys AI Inc.",3,3,0],["VSAT","ViaSat Inc.",49,4573,0],["VSCO","Victorias Secret & Co.",120,4551,0],["VSDA","VSDA",1,0,0],["VSEC","VSE Corporation",21,3637,0],["VSEE","VSee Health Inc.",35,14,0],["VSH","Vishay Intertechnology Inc.",39,2016,0],["VSHY","VSHY",1,0,0],["VSLU","VSLU",1,0,0],["VSME","VS Media Holdings Limited Class A",109,1,0],["VSMV","VSMV",1,0,0],["VSNTV","Versant Media Group Inc. Class A",83,169820,0],["VSOL","VanEck Solana ETF Shares of Beneficial Interest",1,17,0],["VSS","VSS",1,0,0],["VST","Vistra Corp.",41,55239,0],["VSTA","Vasta Platform Limited Class A",3,399,0],["VSTD","Vestand Inc. Class A",68,3,0],["VSTL","VSTL",1,0,0],["VSTM","Verastem Inc.",8,518,0],["VSTS","Vestis Corporation",1,906,0],["VT","VT",1,0,0],["VTAK","Catheter Precision Inc.",31,3,0],["VTC","VTC",1,0,0],["VTEB","VTEB",1,0,0],["VTES","VTES",1,0,0],["VTEX","VTEX Class A",25,720,0],["VTG","VTG",1,0,0],["VTGN","Vistagen Therapeutics Inc.",8,31,0],["VTHR","VTHR",1,0,0],["VTI","VTI",1,0,0],["VTIP","VTIP",1,0,0],["VTMX","Corporacion Inmobiliaria Vesta S.A.B de C.V.",36,2718,0],["VTN","Invesco Trust for Investment Grade New York Municipals",116,224,0],["VTOL","Bristow Group Inc.",87,1052,0],["VTP","VTP",1,0,0],["VTR","Ventas Inc.",30,37156,0],["VTRS","Viatris Inc.",8,13741,0],["VTS","Vitesse Energy Inc.",59,750,0],["VTSI","VirTra Inc.",69,50,0],["VTV","VTV",1,0,0],["VTVT","vTv Therapeutics Inc. Class A",8,142,0],["VTWG","VTWG",1,0,0],["VTWO","VTWO",1,0,0],["VTWV","VTWV",1,0,0],["VTYX","Ventyx Biosciences Inc.",8,624,0],["VUG","VUG",1,0,0],["VUS","VUS",1,0,0],["VUSE","VUSE",1,0,0],["VUSI","VUSI",1,0,0],["VUZI","Vuzix Corporation",49,246,0],["VV","VV",1,0,0],["VVOS","Vivos Therapeutics Inc.",31,18,0],["VVPR","VivoPower International PLC",129,45,0],["VVR","Invesco Senior Income Trust",81,0,0],["VVV","Valvoline Inc.",34,3758,0],["VVX","V2X Inc.",12,1686,0],["VWAV","VisionWave Holdings Inc.",25,131,0],["VWO","VWO",1,0,0],["VWOB","VWOB",1,0,0],["VXF","VXF",1,0,0],["VXUS","VXUS",1,0,0],["VYGR","Voyager Therapeutics Inc.",13,316,0],["VYLD","VYLD",1,0,0],["VYM","VYM",1,0,0],["VYMI","VYMI",1,0,0],["VYNE","VYNE Therapeutics Inc.",8,19,0],["VYX","NCR Voyix Corporation",92,1436,0],["VZ","VZ",1,0,0],["VZLA","Vizsla Silver Corp.",104,1848,0],["W","Wayfair Inc. Class A",57,13255,0],["WAB","Westinghouse Air Brake Technologies Corporation",117,36951,0],["WABC","Westamerica Bancorporation",26,1246,0],["WABF","WABF",1,0,0],["WAFD","WaFd Inc.",26,2556,0],["WAFDP","WaFd Inc.",26,1304,0],["WAFU","Wah Fu Education Group Limited",3,7,0],["WAI","Top KingWin Ltd Class A",36,4,0],["WAL","Western Alliance Bancorporation",26,9504,0],["WAL/PA","WAL/PA",1,0,0],["WALD","Waldencast plc Class A",90,238,0],["WANT","WANT",1,0,0],["WAR","WAR",1,0,0],["WASH","Washington Trust Bancorp Inc.",26,581,0],["WAT","Waters Corporation",71,22506,0],["WATT","Energous Corporation",49,9,0],["WAVE","Eco Wave Power Global AB (publ)",41,293,0],["WAY","Waystar Holding Corp.",15,6283,0],["WB","Weibo Corporation American",16,2492,0],["WBD","Warner Bros. Discovery Inc. Series A",45,68813,0],["WBI","WaterBridge Infrastructure LLC Class A Shares Representing Limited Liability Company Interests",20,2504,0],["WBIF","WBIF",1,0,0],["WBIG","WBIG",1,0,0],["WBIL","WBIL",1,0,0],["WBIY","WBIY",1,0,0],["WBS","Webster Financial Corporation",26,10429,0],["WBS/PF","WBS/PF",1,0,0],["WBS/PG","WBS/PG",1,0,0],["WBTN","WEBTOON Entertainment Inc.",109,1684,0],["WBUY","WEBUY GLOBAL LTD. Class A",66,1,0],["WBX","Wallbox N.V. Class A",32,48,0],["WCAP","WCAP",1,0,0],["WCBR","WCBR",1,0,0],["WCC","WESCO International Inc.",33,12230,0],["WCEO","WCEO",1,0,0],["WCLD","WCLD",1,0,0],["WCME","WCME",1,0,0],["WCMI","WCMI",1,0,0],["WCN","Waste Connections Inc.",122,45123,0],["WCPB","WCPB",1,0,0],["WCT","Wellchange Holdings Company Limited Class A",25,33,0],["WD","Walker & Dunlop Inc",44,2054,0],["WDAF","WDAF",1,0,0],["WDAY","Workday Inc. Class A",15,57500,0],["WDC","Western Digital Corporation",76,61911,0],["WDEF","WDEF",1,0,0],["WDFC","WD-40 Company",34,2744,0],["WDGF","WDGF",1,0,0],["WDH","Waterdrop Inc.",28,705,0],["WDI","Western Asset Diversified Income Fund",81,0,0],["WDIV","WDIV",1,0,0],["WDS","Woodside Energy Group Limited",59,28291,0],["WDTE","WDTE",1,0,0],["WEA","Western Asset Bond Fund Share of Beneficial Interest",81,0,0],["WEAT","WEAT",1,0,0],["WEAV","Weave Communications Inc.",25,541,0],["WEBL","WEBL",1,0,0],["WEBS","WEBS",1,0,0],["WEC","WEC Energy Group Inc.",129,33811,0],["WEEI","WEEI",1,0,0],["WEEL","WEEL",1,0,0],["WELL","Welltower Inc.",30,127664,0],["WEN","Wendy\'s Company (The)",68,1595,0],["WENN","Wen Acquisition Corp Class A",1,0,0],["WENNU","Wen Acquisition Corp Unit",2,0,0],["WERN","Werner Enterprises Inc.",63,1812,0],["WES","Western Midstream Partners LP Common",107,15940,0],["WEST","Westrock Coffee Company",46,406,0],["WETH","Wetouch Technology Inc.",53,18,0],["WETO","Webus International Limited",147,20,0],["WEX","WEX Inc.",36,5174,0],["WEYS","Weyco Group Inc.",86,312,0],["WF","Woori Financial Group Inc.",75,14102,0],["WFC","Wells Fargo & Company",26,291966,0],["WFC/PA","WFC/PA",1,0,0],["WFC/PC","WFC/PC",1,0,0],["WFC/PD","WFC/PD",1,0,0],["WFC/PL","WFC/PL",1,0,0],["WFC/PY","WFC/PY",1,0,0],["WFC/PZ","WFC/PZ",1,0,0],["WFCF","Where Food Comes From Inc.",25,58,0],["WFF","WF Holding Limited",69,10,0],["WFG","West Fraser Timber Co. Ltd",56,4643,0],["WFRD","Weatherford International plc",88,5654,0],["WGMI","WGMI",1,0,0],["WGO","Winnebago Industries Inc.",121,1233,0],["WGRX","Wellgistics Health Inc.",112,44,0],["WGS","GeneDx Holdings Corp. Class A",100,4059,0],["WH","Wyndham Hotels & Resorts Inc.",47,5939,0],["WHD","Cactus Inc. Class A",88,3645,0],["WHF","WhiteHorse Finance Inc.",116,167,0],["WHFCL","WhiteHorse Finance Inc. 7.875% Notes due 2028",1,585,0],["WHG","Westwood Holdings Group Inc",11,178,0],["WHLR","Wheeler Real Estate Investment Trust Inc.",30,2,0],["WHLRD","Wheeler Real Estate Investment Trust Inc. Series D Cumulative",30,26,0],["WHLRL","Wheeler Real Estate Investment Trust Inc. 7.00% Senior Subordinated Convertible Notes Due 2031",30,62,0],["WHLRP","Wheeler Real Estate Investment Trust Inc. Class B",30,3,0],["WHR","Whirlpool Corporation",133,4131,0],["WHWK","Whitehawk Therapeutics Inc.",8,121,0],["WIA","Western Asset Inflation-Linked Income Fund",81,0,0],["WILC","G. Willi-Food International Ltd.",103,388,0],["WILD","WILD",1,0,0],["WIMI","WiMi Hologram Cloud Inc. Class B",25,14,0],["WINA","Winmark Corporation",66,1450,0],["WING","Wingstop Inc.",68,7202,0],["WINN","WINN",1,0,0],["WIP","WIP",1,0,0],["WISD","WISD",1,0,0],["WISE","WISE",1,0,0],["WIT","Wipro Limited",15,32045,0],["WIW","Western Asset Inflation-Linked Opportunities & Income Fund",116,0,0],["WIX","Wix.com Ltd.",16,5813,0],["WK","Workiva Inc. Class A",25,4935,0],["WKC","World Kinect Corporation",80,1310,0],["WKEY","WISeKey International Holding Ltd",15,69,0],["WKHS","Workhorse Group Inc.",37,12,0],["WKSP","Worksport Ltd.",42,19,0],["WLAC","Willow Lane Acquisition Corp. Class A",2,0,0],["WLACU","Willow Lane Acquisition Corp. Unit",2,0,0],["WLDN","Willdan Group Inc.",21,1643,0],["WLDS","Wearable Devices Ltd.",51,15,0],["WLFC","Willis Lease Finance Corporation",32,916,0],["WLK","Westlake Corporation",34,9299,0],["WLKP","Westlake Chemical Partners LP Common",34,673,0],["WLTG","WLTG",1,0,0],["WLTH","Wealthfront Corporation",44,1894,0],["WLY","John Wiley & Sons Inc.",145,1630,0],["WLYB","John Wiley & Sons Inc.",145,1826,0],["WM","Waste Management Inc.",122,87156,0],["WMB","Williams Companies Inc. (The)",107,71148,0],["WMG","Warner Music Group Corp. Class A",45,15333,0],["WMK","Weis Markets Inc.",67,1662,0],["WMS","Advanced Drainage Systems Inc.",125,11549,0],["WMSB","WMSB",1,0,0],["WMT","Walmart Inc.",113,911468,0],["WNC","Wabash National Corporation",72,364,0],["WNEB","Western New England Bancorp Inc.",84,272,0],["WNTR","WNTR",1,0,0],["WNW","Meiwu Technology Company Limited",57,25,0],["WOK","WORK Medical Technology Group LTD Class A",31,3,0],["WOLF","Wolfspeed Inc.",6,684,0],["WOMN","WOMN",1,0,0],["WOOD","WOOD",1,0,0],["WOOF","Petco Health and Wellness Company Inc. Class A",66,932,0],["WOR","Worthington Enterprises Inc.",27,2601,0],["WORX","SCWorx Corp.",45,3,0],["WOW","WideOpenWest Inc.",54,447,0],["WPC","W. P. Carey Inc. REIT",30,14161,0],["WPM","Wheaton Precious Metals Corp",104,54346,0],["WPP","WPP plc",58,4803,0],["WPRT","Westport Fuel Systems Inc",7,29,0],["WRAP","Wrap Technologies Inc.",78,118,0],["WRB","W.R. Berkley Corporation",22,26362,0],["WRB/PE","WRB/PE",1,0,0],["WRB/PF","WRB/PF",1,0,0],["WRB/PG","WRB/PG",1,0,0],["WRB/PH","WRB/PH",1,0,0],["WRBY","Warby Parker Inc. Class A",111,3224,0],["WRD","WeRide Inc.",15,2538,0],["WRLD","World Acceptance Corporation",44,719,0],["WRN","Western Copper and Gold Corporation",10,560,0],["WRND","WRND",1,0,0],["WS","Worthington Steel Inc.",27,1847,0],["WSBC","WesBanco Inc.",26,3342,0],["WSBCO","WesBanco Inc.",26,2462,0],["WSBF","Waterstone Financial Inc.",84,308,0],["WSBK","Winchester Bancorp Inc.",1,0,0],["WSC","WillScot Holdings Corporation Class A",131,3431,0],["WSFS","WSFS Financial Corporation",26,3139,0],["WSGE","WSGE",1,0,0],["WSHP","WeShop Holdings Limited Class A",66,3048,0],["WSM","Williams-Sonoma Inc.",73,22787,0],["WSML","WSML",1,0,0],["WSO","Watsco Inc.",7,14107,0],["WSO.B","WSO.B",1,0,0],["WSR","Whitestone REIT",30,694,0],["WST","West Pharmaceutical Services Inc.",31,19607,0],["WSTNU","Westin Acquisition Corp",1,0,0],["WT","WisdomTree Inc.",60,1750,0],["WTBA","West Bancorporation",26,393,0],["WTBN","WTBN",1,0,0],["WTF","Waton Financial Limited",60,171,0],["WTFC","Wintrust Financial Corporation",26,9531,0],["WTFCN","Wintrust Financial Corporation",26,1775,0],["WTG","Wintergreen Acquisition Corp.",2,0,0],["WTGUU","WTGUU",1,0,0],["WTI","W&T Offshore Inc.",59,250,0],["WTIB","WTIB",1,0,0],["WTID","WTID",1,0,0],["WTIP","WTIP",1,0,0],["WTIU","WTIU",1,0,0],["WTM","White Mountains Insurance Group Ltd.",22,5213,0],["WTMF","WTMF",1,0,0],["WTMU","WTMU",1,0,0],["WTMY","WTMY",1,0,0],["WTO","UTime Limited Class A",133,1,0],["WTPI","WTPI",1,0,0],["WTRE","WTRE",1,0,0],["WTRG","Essential Utilities Inc.",70,10733,0],["WTS","Watts Water Technologies Inc. Class A",55,9334,0],["WTTR","Select Water Solutions Inc. Class A",20,1272,0],["WTV","WTV",1,0,0],["WTW","Willis Towers Watson Public Limited Company",28,31842,0],["WU","Western Union Company (The)",36,3039,0],["WULF","TeraWulf Inc.",15,5242,0],["WVE","Wave Life Sciences Ltd.",8,2876,0],["WVVI","Willamette Valley Vineyards Inc.",46,14,0],["WVVIP","Willamette Valley Vineyards Inc. Series A Redeemable",46,15,0],["WW","WW International Inc. ",3,275,0],["WWD","Woodward Inc.",7,18318,0],["WWJD","WWJD",1,0,0],["WWR","Westwater Resources Inc.",10,103,0],["WWW","Wolverine World Wide Inc.",114,1500,0],["WXET","WXET",1,0,0],["WXM","WF International Limited",82,4,0],["WY","Weyerhaeuser Company",30,16926,0],["WYFI","WhiteFiber Inc.",44,640,0],["WYHG","Wing Yip Food Holdings Group Limited",93,38,0],["WYNN","Wynn Resorts Limited",47,13302,0],["WYY","WidePoint Corporation",15,61,0],["XAGG","XAGG",1,0,0],["XAIR","Beyond Air Inc.",31,7,0],["XAIX","XAIX",1,0,0],["XAR","XAR",1,0,0],["XB","XB",1,0,0],["XBB","XBB",1,0,0],["XBI","XBI",1,0,0],["XBIL","XBIL",1,0,0],["XBIO","Xenetic Biosciences Inc.",8,5,0],["XBIT","XBiotech Inc.",8,76,0],["XBP","XBP Global Holdings Inc.",36,76,0],["XBTY","XBTY",1,0,0],["XC","XC",1,0,0],["XCCC","XCCC",1,0,0],["XCEM","XCEM",1,0,0],["XCH","XCHG Limited American",39,73,0],["XCHG","XCHG",1,0,0],["XCLR","XCLR",1,0,0],["XCNY","XCNY",1,0,0],["XCOR","XCOR",1,0,0],["XCUR","Exicure Inc.",8,38,0],["XEL","Xcel Energy Inc.",129,42987,0],["XELB","Xcel Brands Inc.",29,6,0],["XELLL","Xcel Energy Inc. 6.25% Junior Subordinated Notes Series due 2085",129,0,0],["XENE","Xenon Pharmaceuticals Inc.",8,3408,0],["XERS","Xeris Biopharma Holdings Inc.",8,1218,0],["XES","XES",1,0,0],["XFIV","XFIV",1,0,0],["XFIX","XFIX",1,0,0],["XFLT","XAI Octagon Floating Rate & Alternative Income Trust",11,163,0],["XFLX","XFLX",1,0,0],["XFOR","X4 Pharmaceuticals Inc.",13,315,0],["XGN","Exagen Inc.",23,146,0],["XHB","XHB",1,0,0],["XHE","XHE",1,0,0],["XHG","XChange TEC.INC",36,1,0],["XHLD","TEN Holdings Inc.",36,5,0],["XHLF","XHLF",1,0,0],["XHR","Xenia Hotels & Resorts Inc.",47,1420,0],["XHS","XHS",1,0,0],["XHYC","XHYC",1,0,0],["XHYD","XHYD",1,0,0],["XHYE","XHYE",1,0,0],["XHYF","XHYF",1,0,0],["XHYH","XHYH",1,0,0],["XHYI","XHYI",1,0,0],["XHYT","XHYT",1,0,0],["XIDV","XIDV",1,0,0],["XIFR","XPLR Infrastructure LP Common",41,869,0],["XITK","XITK",1,0,0],["XLB","XLB",1,0,0],["XLBI","XLBI",1,0,0],["XLC","XLC",1,0,0],["XLCI","XLCI",1,0,0],["XLE","XLE",1,0,0],["XLEI","XLEI",1,0,0],["XLF","XLF",1,0,0],["XLFI","XLFI",1,0,0],["XLG","XLG",1,0,0],["XLI","XLI",1,0,0],["XLII","XLII",1,0,0],["XLK","XLK",1,0,0],["XLKI","XLKI",1,0,0],["XLO","Xilio Therapeutics Inc.",8,35,0],["XLP","XLP",1,0,0],["XLRE","XLRE",1,0,0],["XLRI","XLRI",1,0,0],["XLSI","XLSI",1,0,0],["XLSR","XLSR",1,0,0],["XLU","XLU",1,0,0],["XLUI","XLUI",1,0,0],["XLV","XLV",1,0,0],["XLVI","XLVI",1,0,0],["XLY","XLY",1,0,0],["XLYI","XLYI",1,0,0],["XMAG","XMAG",1,0,0],["XME","XME",1,0,0],["XMHQ","XMHQ",1,0,0],["XMLV","XMLV",1,0,0],["XMMO","XMMO",1,0,0],["XMTR","Xometry Inc. Class A",36,3152,0],["XMVM","XMVM",1,0,0],["XNAV","XNAV",1,0,0],["XNCR","Xencor Inc.",8,1110,0],["XNET","Xunlei Limited",25,2186,0],["XNTK","XNTK",1,0,0],["XOEF","XOEF",1,0,0],["XOM","Exxon Mobil Corporation",106,492101,0],["XOMA","XOMA Royalty Corporation",8,314,0],["XOMAO","XOMA Royalty Corporation",8,317,0],["XOMAP","XOMA Royalty Corporation 8.625% Series A Cumulative Perpetual",8,329,0],["XOMO","XOMO",1,0,0],["XOMX","XOMX",1,0,0],["XOMZ","XOMZ",1,0,0],["XONE","XONE",1,0,0],["XOP","XOP",1,0,0],["XOS","Xos Inc.",42,23,0],["XOVR","XOVR",1,0,0],["XP","XP Inc. Class A",60,8604,0],["XPAY","XPAY",1,0,0],["XPEL","XPEL Inc.",32,1412,0],["XPER","Xperi Inc.",25,271,0],["XPEV","XPeng Inc.",37,18871,0],["XPH","XPH",1,0,0],["XPL","Solitario Resources Corp.",104,61,0],["XPM","XPM",1,0,0],["XPND","XPND",1,0,0],["XPO","XPO Inc.",87,16260,0],["XPOF","Xponential Fitness Inc. Class A",45,377,0],["XPON","Expion360 Inc.",7,9,0],["XPP","XPP",1,0,0],["XPRO","Expro Group Holdings N.V.",20,1473,0],["XRAY","DENTSPLY SIRONA Inc.",31,2237,0],["XRLV","XRLV",1,0,0],["XRLX","XRLX",1,0,0],["XRMI","XRMI",1,0,0],["XRP","XRP",1,0,0],["XRPC","XRPC",1,0,0],["XRPI","XRPI",1,0,0],["XRPN","Armada Acquisition Corp. II Class A",2,0,0],["XRPNU","Armada Acquisition Corp. II",2,0,0],["XRPT","XRPT",1,0,0],["XRPZ","XRPZ",1,0,0],["XRT","XRT",1,0,0],["XRTX","XORTX Therapeutics Inc.",8,4,0],["XRX","Xerox Holdings Corporation",53,335,0],["XSD","XSD",1,0,0],["XSLV","XSLV",1,0,0],["XSMO","XSMO",1,0,0],["XSOE","XSOE",1,0,0],["XSVM","XSVM",1,0,0],["XSVN","XSVN",1,0,0],["XSW","XSW",1,0,0],["XT","XT",1,0,0],["XTEN","XTEN",1,0,0],["XTIA","XTI Aerospace Inc.",15,45,0],["XTKG","X3 Holdings Co. Ltd.",15,27,0],["XTL","XTL",1,0,0],["XTLB","XTL Biopharmaceuticals Ltd.",8,7,0],["XTN","XTN",1,0,0],["XTNT","Xtant Medical Holdings Inc.",13,108,0],["XTR","XTR",1,0,0],["XTRE","XTRE",1,0,0],["XTWO","XTWO",1,0,0],["XTWY","XTWY",1,0,0],["XUDV","XUDV",1,0,0],["XV","XV",1,0,0],["XWEL","XWELL Inc.",3,4,0],["XWIN","XMAX Inc.",73,254,0],["XXI","Twenty One Capital Inc. Class A",44,146,0],["XXII","22nd Century Group Inc.",18,7,0],["XXRP","XXRP",1,0,0],["XXV","XXV",1,0,0],["XYF","X Financial",44,270,0],["XYL","Xylem Inc.",148,33616,0],["XYLD","XYLD",1,0,0],["XYLG","XYLG",1,0,0],["XYZ","Block Inc. Class A",25,39699,0],["XYZG","XYZG",1,0,0],["XYZY","XYZY",1,0,0],["XZO","Exzeo Group Inc.",22,1881,0],["YAAS","Youxin Technology Ltd Class A",25,3,0],["YALA","Yalla Group Limited",16,1111,0],["YALL","YALL",1,0,0],["YANG","YANG",1,0,0],["YB","Yuanbao Inc.",28,912,0],["YBIT","YBIT",1,0,0],["YBMN","YBMN",1,0,0],["YBST","YBST",1,0,0],["YBTY","YBTY",1,0,0],["YCBD","cbdMD Inc.",90,13,0],["YCL","YCL",1,0,0],["YCS","YCS",1,0,0],["YCY","AA Mission Acquisition Corp. II Class A",1,0,0],["YCY.U","YCY.U",1,0,0],["YDDL","One and One Green Technologies. Inc Class A",32,324,0],["YDES","YD Bio Limited",23,871,0],["YDKG","Yueda Digital Holding Class A",58,5,0],["YEAR","YEAR",1,0,0],["YELP","Yelp Inc.",3,1925,0],["YETI","YETI Holdings Inc.",61,3468,0],["YEXT","Yext Inc.",15,1021,0],["YFFI","YFFI",1,0,0],["YFYA","YFYA",1,0,0],["YGLD","YGLD",1,0,0],["YHC","LQR House Inc.",46,13,0],["YHGJ","Yunhong Green CTI Ltd.",135,12,0],["YHNA","YHN Acquisition I Limited",1,0,0],["YI","111 Inc.",142,32,0],["YIBO","Planet Image International Limited Class A",7,55,0],["YINN","YINN",1,0,0],["YJ","Yunji Inc. American Depository Shares",66,7,0],["YLD","YLD",1,0,0],["YLDE","YLDE",1,0,0],["YLDW","YLDW",1,0,0],["YMAG","YMAG",1,0,0],["YMAT","J-Star Holding Co. Ltd. Class A",61,11,0],["YMAX","YMAX",1,0,0],["YMM","Full Truck Alliance Co. Ltd.",25,11609,0],["YMT","Yimutian Inc.",15,146,0],["YNOT","YNOT",1,0,0],["YOKE","YOKE",1,0,0],["YOLO","YOLO",1,0,0],["YORW","York Water Company (The)",70,476,0],["YOU","Clear Secure Inc. Class A",25,4924,0],["YOUL","Youlife Group Inc.",3,119,0],["YPF","YPF Sociedad Anonima",106,13978,0],["YQ","17 Education & Technology Group Inc.",3,36,0],["YQQQ","YQQQ",1,0,0],["YRD","Yiren Digital Ltd.",44,371,0],["YSG","Yatsen Holding Limited",90,407,0],["YSPY","YSPY",1,0,0],["YSXT","YSX Tech. Co. Ltd Class A",79,28,0],["YTRA","Yatra Online Inc.",87,105,0],["YUM","Yum! Brands Inc.",68,42689,0],["YUMC","Yum China Holdings Inc.",68,17496,0],["YXI","YXI",1,0,0],["YXT","YXT.COM GROUP HOLDING LIMITED American Depository Shares",25,45,0],["YYAI","AiRWA Inc.",61,20,0],["YYGH","YY Group Holding Limited Class A",19,8,0],["YYY","YYY",1,0,0],["Z","Zillow Group Inc. Class C",36,16692,0],["ZAP","ZAP",1,0,0],["ZBAI","ATIF Holdings Limited",19,84,0],["ZBAO","Zhibao Technology Inc. Class A",28,28,0],["ZBH","Zimmer Biomet Holdings Inc.",32,17664,0],["ZBIO","Zenas BioPharma Inc.",8,1941,0],["ZBRA","Zebra Technologies Corporation Class A",7,12749,0],["ZCMD","Zhongchao Inc. Class A",3,15,0],["ZD","Ziff Davis Inc.",33,1406,0],["ZDAI","DirectBooking Technology Co. Ltd.",136,7,0],["ZDGE","Zedge Inc. Class B",25,43,0],["ZENA","ZenaTech Inc.",25,94,0],["ZENV","Zenvia Inc. Class A",25,56,0],["ZEO","Zeo Energy Corporation Class A",7,56,0],["ZEPP","Zepp Health Corporation",9,399,0],["ZETA","Zeta Global Holdings Corp. Class A",25,4280,0],["ZEUS","Olympic Steel Inc.",55,489,0],["ZG","Zillow Group Inc. Class A",36,16452,0],["ZGM","Zenta Group Company Limited",19,29,0],["ZGN","Ermenegildo Zegna N.V.",86,2682,0],["ZH","Zhihu Inc.",36,311,0],["ZHDG","ZHDG",1,0,0],["ZIG","ZIG",1,0,0],["ZIM","ZIM Integrated Shipping Services Ltd.",98,2318,0],["ZION","Zions Bancorporation N.A.",26,8850,0],["ZIONP","Zions Bancorporation N.A.",26,3033,0],["ZIP","ZipRecruiter Inc. Class A",16,392,0],["ZIPP","ZIPP",1,0,0],["ZJK","ZJK Industrial Co. Ltd.",55,123,0],["ZJYL","JIN MEDICAL INTERNATIONAL LTD.",32,33,0],["ZK","ZEEKR Intelligent Technology Holding Limited",37,6795,0],["ZKH","ZKH Group Limited",130,515,0],["ZKIN","ZK International Group Co. Ltd",55,9,0],["ZLAB","Zai Lab Limited",8,1995,0],["ZM","Zoom Communications Inc. Class A",16,26596,0],["ZMUN","ZMUN",1,0,0],["ZNB","Zeta Network Group Class A",82,95,0],["ZNTL","Zentalis Pharmaceuticals Inc.",8,101,0],["ZONE","CleanCore Solutions Inc. Class B",7,60,0],["ZOOZ","ZOOZ Strategy Ltd.",7,65,0],["ZROZ","ZROZ",1,0,0],["ZS","Zscaler Inc.",15,37085,0],["ZSB","ZSB",1,0,0],["ZSC","ZSC",1,0,0],["ZSL","ZSL",1,0,0],["ZSPC","zSpace Inc.",25,13,0],["ZTAX","ZTAX",1,0,0],["ZTEK","Zentek Ltd.",34,79,0],["ZTEN","ZTEN",1,0,0],["ZTO","ZTO Express (Cayman) Inc.",63,17111,0],["ZTOP","ZTOP",1,0,0],["ZTR","Virtus Total Return Fund Inc.",11,0,0],["ZTRE","ZTRE",1,0,0],["ZTS","Zoetis Inc. Class A",8,53870,0],["ZTWO","ZTWO",1,0,0],["ZUMZ","Zumiez Inc.",120,486,0],["ZURA","Zura Bio Limited Class A",13,278,0],["ZVIA","Zevia PBC Class A",46,197,0],["ZVRA","Zevra Therapeutics Inc.",8,468,0],["ZWS","Zurn Elkay Water Solutions Corporation",7,7949,0],["ZYBT","Zhengye Biotechnology Holding Limited",8,88,0],["ZYME","Zymeworks Inc.",8,2038,0],["ZYXI","Zynex Inc.",77,9,0]]'),ph=[" Inc."," Inc"," Incorporated"," Corporation"," Corp."," Corp"," Company"," Limited"," Ltd."," Ltd"," LLC"," L.L.C."," PLC"," P.L.C."," LP"," L.P."," Class A"," Class B"," Class C"," Class D"," Class E"," Common Stock"," Common Shares"," Common Share"," Ordinary Shares"," Ordinary Share"," Capital Stock"," Depositary Shares"," Depositary Share"," American Depositary Shares"," American Depositary Share"," ADS"," Warrants"," Warrant"," Rights"," Preferred Stock"," Preferred Shares"," Units"," Public Company"," Publicly Traded"," S.A."," SA"," N.V."," NV"," AB"," AG"," AS"," ASA"];function hh(e){if(!e)return e;let t=e.trim();const n=[...ph].sort((e,t)=>t.length-e.length);for(const r of n){const e=new RegExp(r.replace(/\./g,"\\.")+".*$","i");if(e.test(t)){t=t.replace(e,"").trim();break}}return t=t.replace(/[,.]$/,"").trim(),t}const fh=Zr,mh=10,gh=/^\d{10}-\d{2}-\d{6}$/;class yh{companyName;emailAddress;_tickerToCikMapping=null;_initPromise=null;constructor(e,t){this.companyName=e,this.emailAddress=t}get userAgent(){return`${this.companyName} ${this.emailAddress}`}async init(){return this._initPromise||(this._initPromise=this._loadTickerToCikMapping()),this._initPromise}async _loadTickerToCikMapping(){this._tickerToCikMapping||(this._tickerToCikMapping=await async function(e){try{const e=await Promise.resolve().then(()=>Xi),t=(await Promise.resolve().then(()=>Xi)).join(__dirname,"../data","company_tickers.json"),n=await e.readFile(t,"utf-8"),r=JSON.parse(n),i={};if(Array.isArray(r))for(const a of r)if(a&&a.length>=3&&a[0]&&a[2]){const e=String(a[0]).padStart(mh,"0");i[a[2].toUpperCase()]=e}return i}catch(t){const n="https://www.sec.gov/files/company_tickers.json",r={},i=(await d.get(n,{headers:{"User-Agent":e}})).data;for(const e in i){const t=i[e];if(t.ticker&&t.cik_str){const e=String(t.cik_str).padStart(mh,"0");r[t.ticker.toUpperCase()]=e}}return r}}(this.userAgent))}async getFilingMetadatas(e,t={}){await this.init();const{includeAmends:n=!1}=t;if("string"==typeof e){const t=Ch.fromString(e,!1);t&&(e=t)}if(e instanceof Ch)return[await Sh({tickerOrCik:e.tickerOrCik,accessionNumber:e.accessionNumber,userAgent:this.userAgent,tickerToCikMapping:this._tickerToCikMapping,includeAmends:n})];if("string"==typeof e&&(e=Ih.fromString(e)),e instanceof Ih)return await async function(e){const{requested:t,userAgent:n,tickerToCikMapping:r,includeAmends:i}=e,a=Ah(t.tickerOrCik,r);let o;if(null===t.limit)o=Number.MAX_SAFE_INTEGER;else if(o=parseInt(String(t.limit)),o<1)throw new Error("Invalid amount. Please enter a number greater than 1.");return await bh({cik:a,userAgent:n,limit:o,tickerOrCik:t.tickerOrCik,formType:t.formType,includeAmends:i})}({requested:e,userAgent:this.userAgent,tickerToCikMapping:this._tickerToCikMapping,includeAmends:n});throw new Error(`Invalid input: ${e}`)}async downloadFiling({url:e}){return await async function(e,t){try{const n=await d.get(e,{headers:{"User-Agent":t},responseType:"arraybuffer"});return Buffer.from(n.data)}catch(n){throw new Error(`Failed to download filing from ${e}: ${n}`)}}(e,this.userAgent)}async getFilingHtml(e={}){let{query:t,ticker:n,form:r}=e;if(t&&(n||r))throw new Error("Error: Ticker or form should not be provided when query is specified.");if((n||r)&&t)throw new Error("Error: Query should not be provided when ticker or form is specified.");if((n||r)&&(t=`${n}/${r}`),!t)throw new Error("Error: Either query or ticker and form must be specified.");const i=await this.getFilingMetadatas(t);if(0===i.length)throw new Error(`Could not find filing for ${t}`);if(i.length>1)throw new Error(`Found multiple filings for ${t}. Use 'getFilingMetadatas()' and 'downloadFiling()' instead.`);return await this.downloadFiling({url:i[0].primaryDocUrl})}}class Ih{tickerOrCik;formType;limit;constructor(e,t,n=null){this.tickerOrCik=e,this.formType=t,this.limit=n}static fromString(e){const t=e.split("/");if(t.length<2)throw new Error(`Invalid query string format: ${e}`);const[n,r,i]=t,a=i?parseInt(i):null;return new Ih(n,r,a)}}class Ch{tickerOrCik;accessionNumber;constructor(e,t){this.tickerOrCik=e,this.accessionNumber=t}static fromString(e,t=!0){const n=e.split("/");if(2===n.length){const[e,t]=n;if(gh.test(t)||18===t.length)return new Ch(e,t)}if(t)throw new Error(`Invalid company and accession number format: ${e}`);return null}}function Ah(e,t){if(/^\d+$/.test(e))return e.padStart(mh,"0");const n=t[e.toUpperCase()];if(!n)throw new Error(`Could not find CIK for ticker: ${e}`);return n.padStart(mh,"0")}async function Sh(e){const{tickerOrCik:t,accessionNumber:n,userAgent:r,tickerToCikMapping:i,includeAmends:a}=e;let o=n;if(18===n.length&&(o=`${n.slice(0,10)}-${n.slice(10,12)}-${n.slice(12)}`),!gh.test(o))throw new Error(`Invalid Accession Number: ${n}`);const s=Ah(t,i),c=await bh({cik:s,userAgent:r,limit:1,accessionNumber:o,includeAmends:a});if(0===c.length)throw new Error(`Could not find filing for ${n}`);return c[0]}async function bh(e){const{cik:t,userAgent:n,limit:r,tickerOrCik:i,accessionNumber:a,formType:o,includeAmends:s=!1}=e,c="CIK{cik}.json".replace("{cik}",t),l="https://data.sec.gov/submissions/{submission}".replace("{submission}",c),u=(await d.get(l,{headers:{"User-Agent":n}})).data,p=u.filings.recent,h=[],f=p.accessionNumber||[],m=p.primaryDocument||[],g=p.filingDate||[],y=p.reportDate||[],I=p.form||[];for(let d=0;d<f.length&&h.length<r;d++){const e=f[d],n=m[d],r=g[d],i=y[d];let c=I[d];const l=c.endsWith("/A");if(c=l?c.slice(0,-2):c,o&&o!==c||a&&a!==e||l&&!s)continue;const p=e.replace(/-/g,""),C=`https://www.sec.gov/Archives/edgar/data/${parseInt(t)}/${p}/${n}`;h.push({primaryDocUrl:C,accessionNumber:e,tickers:(u.tickers||[]).map((e,t)=>({symbol:e,exchange:u.exchanges?.[t]||""})),companyName:u.name,filingDate:r,reportDate:i,primaryDocDescription:"",items:"",formType:c,cik:String(u.cik).padStart(mh,"0")})}return h}const Th="data/stock-names.json",vh="data/sectors-industries.json",_h={fields:["symbol","name","industryId","marketCap","cik"]},wh=["nasdaq","nyse","amex"],Eh=[" American Depositary Shares"," Depositary Shares"," Ordinary Shares"," Common Stock"," Common Shares"," Capital Stock"," Units"," Warrants"," Warrant"," Rights"," Preferred Stock"," Preferred Shares"," Depositary Share"," Ordinary Share"," Common Share"],Ph=e=>{let t=e;for(const n of Eh){const e=new RegExp(n+".*$","i");if(e.test(t)){t=t.replace(e,"");break}}return t};function Rh(e,t,n){if(t[e])return t[e];const r=Object.values(t),i=r.length>0?Math.max(...r)+1:1;return t[e]=i,n[i]=e,i}async function Lh(){const e={headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0","Content-Type":"application/json"}};try{console.log("Fetching symbols from TradingView...");const t=await fetch("https://scanner.tradingview.com/america/scan",e);if(!t.ok)throw new Error(`TradingView request failed. Status Code: ${t.status}`);const n=await t.json(),r=/* @__PURE__ */new Set;return n.data&&Array.isArray(n.data)&&n.data.forEach(e=>{if(e.s){const[t,n]=e.s.split(":");t&&n&&["NYSE","NASDAQ","AMEX"].includes(t.toUpperCase())&&r.add(n)}}),console.log(`Fetched ${r.size} symbols from TradingView (NYSE, NASDAQ, AMEX only)`),console.log(`Total count from TradingView: ${n.totalCount||0}`),r}catch(t){return console.error("Error fetching TradingView symbols:",t),/* @__PURE__ */new Set}}async function Nh(e){const t=`https://api.nasdaq.com/api/screener/stocks?tableonly=true&limit=25&offset=0&download=true&exchange=${e}`,n={headers:{"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0"}};try{const e=await fetch(t,n);if(!e.ok)throw new Error(`Request failed. Status Code: ${e.status}`);return await e.json()}catch(r){return console.error(`Error fetching ${e}:`,r),null}}async function Oh(){const e="data/company_tickers.json";try{if(console.log("Loading SEC CIK data from local file..."),!Wi.existsSync(e))return console.warn(`SEC data file not found: ${e}`),console.warn("Skipping CIK data. Download from: https://www.sec.gov/files/company_tickers.json"),{tickerToCik:/* @__PURE__ */new Map,secCompanies:/* @__PURE__ */new Map};const t=Wi.readFileSync(e,"utf-8"),n=JSON.parse(t),r=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;return Object.values(n).forEach(e=>{e.ticker&&e.cik_str&&(r.set(e.ticker,e.cik_str),i.set(e.ticker,{ticker:e.ticker,name:e.title,cik:e.cik_str}))}),console.log(`Loaded ${r.size} SEC tickers with CIK numbers from local file`),{tickerToCik:r,secCompanies:i}}catch(t){return console.error("Error loading SEC data:",t),{tickerToCik:/* @__PURE__ */new Map,secCompanies:/* @__PURE__ */new Map}}}!async function(){try{console.log("Fetching stock data..."),Wi.existsSync("data")||Wi.mkdirSync("data");const e=function(){if(Wi.existsSync(vh))try{const e=JSON.parse(Wi.readFileSync(vh,"utf-8"));console.log(`Loaded existing mappings: ${Object.keys(e.sectors||{}).length} sectors, ${Object.keys(e.industries||{}).length} industries`);const t={},n={};for(const[r,i]of Object.entries(e.sectors||{}))t[i]=r;for(const[r,i]of Object.entries(e.industries||{}))n[i]=r;return{sectors:e.sectors||{},industries:e.industries||{},sectorsReverse:t,industriesReverse:n,industryToSector:e.industryToSector||{}}}catch(e){console.warn("Error loading existing mappings, starting fresh:",e)}return{sectors:{},industries:{},sectorsReverse:{},industriesReverse:{},industryToSector:{}}}(),[t,n,r]=await Promise.all([Lh(),Promise.all(wh.map(Nh)),Oh()]),{tickerToCik:i,secCompanies:a}=r,o=[];n.forEach(e=>{e&&e.data&&e.data.rows&&o.push(...e.data.rows)}),console.log(`Fetched ${o.length} total rows from NASDAQ/NYSE/AMEX.`);const s=/* @__PURE__ */new Map;o.forEach(e=>{e.symbol&&s.set(e.symbol.trim(),e)});const c=/* @__PURE__ */new Map;t.forEach(t=>{if(!c.has(t)){const n=s.get(t),r=i.get(t)||0;if(n){const i=n.sector?String(n.sector).trim():"Unknown",a=n.industry?String(n.industry).trim():"Unknown",o=Rh(i,e.sectors,e.sectorsReverse),s=Rh(a,e.industries,e.industriesReverse);e.industryToSector[s]=o;const l=_h.fields.map(e=>"symbol"===e?t:"name"===e?Ph(n.name?n.name.trim():""):"industryId"===e?s:"marketCap"===e?(e=>{if(!e)return 0;const t=parseFloat(String(e).replace(/,/g,"").replace(/\$/g,""));return isNaN(t)?0:Math.round(t/1e6)})(n.marketCap):"cik"===e?r:n[e]);c.set(t,l)}else{const n=a.get(t),i=Rh("Unknown",e.sectors,e.sectorsReverse),o=Rh("Unknown",e.industries,e.industriesReverse);e.industryToSector[o]=i;const s=_h.fields.map(e=>"symbol"===e?t:"name"===e?n?Ph(n.name):t:"industryId"===e?o:"marketCap"===e?0:"cik"===e?r:0);c.set(t,s)}}}),console.log(`Total unique tickers from TradingView core index: ${c.size}`),console.log(`Tickers with NASDAQ data: ${Array.from(c.values()).filter(e=>0!==e[3]&&null!==e[3]).length}`),console.log(`Total sectors: ${Object.keys(e.sectors).length}`),console.log(`Total industries: ${Object.keys(e.industries).length}`),console.log(`Industry-to-Sector mappings: ${Object.keys(e.industryToSector).length}`),console.log(`Output fields: ${JSON.stringify(_h.fields)}`),Wi.writeFileSync(vh,JSON.stringify({sectors:e.sectors,industries:e.industries,industryToSector:e.industryToSector},null,2)),console.log(`Successfully wrote mappings to ${vh}`);const l=Array.from(c.values()).sort((e,t)=>{const n=String(e[0]||""),r=String(t[0]||"");return n.localeCompare(r)});Wi.writeFileSync(Th,JSON.stringify(l)),console.log(`Successfully wrote ${l.length} stocks to ${Th}`);const u={},d={sector:"Overall US Public Stocks",totalCompanies:0,totalMarketCap:0,industries:{},companies:[]};l.forEach(t=>{const n=t[0],r=t[1],i=t[2],a="number"==typeof t[3]?t[3]:0,o=e.industryToSector[i]||0,s=e.sectorsReverse[o]||"Unknown",c=e.industriesReverse[i]||"Unknown";u[s]||(u[s]={totalCompanies:0,totalMarketCap:0,industries:{},companies:[]}),u[s].totalCompanies++,u[s].totalMarketCap+=a,u[s].industries[c]||(u[s].industries[c]={name:c,totalCompanies:0,totalMarketCap:0,leader:{symbol:n,name:r,_marketCap:a}}),u[s].industries[c].totalCompanies++,u[s].industries[c].totalMarketCap+=a,a>u[s].industries[c].leader._marketCap&&(u[s].industries[c].leader={symbol:n,name:r,_marketCap:a}),d.totalCompanies++,d.totalMarketCap+=a,d.companies.push({symbol:n,name:r,marketCap:a})});const p=(e,t,n=!0)=>{e.companies.sort((e,t)=>t.marketCap-e.marketCap);const r=e.companies.slice(0,10);let i=[];n&&(i=Object.values(e.industries).sort((e,t)=>t.totalMarketCap-e.totalMarketCap).map(e=>{const{_marketCap:t,...n}=e.leader||{};return{...e,leader:n}}));const a={sector:t,totalCompanies:e.totalCompanies,totalMarketCap:e.totalMarketCap,top10Companies:r};return n&&(a.industries=i),a},h=Object.keys(u).map(e=>p(u[e],e,!0));h.sort((e,t)=>t.totalMarketCap-e.totalMarketCap),h.unshift(p(d,"Overall US Public Stocks",!1));const f="data/sector-info.json";Wi.writeFileSync(f,JSON.stringify(h,null,2)),console.log(`Successfully wrote to ${f}`)}catch(e){console.error("An error occurred:",e),process.exit(1)}}();const Bh=process.env.FINNHUB_API_KEY||"";function Mh(e){return"string"==typeof e?Math.floor(new Date(e).getTime()/1e3):Math.floor(e.getTime()/1e3)}async function Dh(e,t={}){const n=new URL(`https://finnhub.io/api/v1${e}`);n.searchParams.set("token",Bh);for(const[i,a]of Object.entries(t))n.searchParams.set(i,a);const r=await fetch(n.toString());if(!r.ok)throw new Error(`Finnhub API error: ${r.status} ${r.statusText}`);return r.json()}function Fh(e){return e.toISOString()}function kh(e){return e.toISOString().split("T")[0]}class Gh{async getHistoricalData(e){const{symbol:t,period1:n,period2:r,interval:i="1d"}=e;if(console.log(`[Historical] Fetching data for ${t}, interval: ${i}, period: ${n} to ${r}`),Bh)try{const e=function(e){return{"1m":"1","5m":"5","15m":"15","30m":"30","60m":"60","1h":"60","1d":"D","1wk":"W","1mo":"M",D:"D",W:"W",M:"M"}[e||"1d"]||"D"}(i),a=Mh(n),o=Mh(r);console.log(`[Finnhub] Requesting candles for ${t}, resolution: ${e}, from: ${a}, to: ${o}`);const s=await Dh("/stock/candle",{symbol:t.toUpperCase(),resolution:e,from:String(a),to:String(o)});if("no_data"===s.s)console.log(`[Finnhub] Returned no_data for ${t}, trying Alpaca...`);else{if(s.t&&s.t.length>0){const e=s.t.map((e,t)=>({date:new Date(1e3*e),open:s.o[t],high:s.h[t],low:s.l[t],close:s.c[t],volume:s.v[t]}));return console.log(`[Finnhub] Successfully fetched ${e.length} candles for ${t}`),{success:!0,symbol:t,source:"finnhub",data:{quotes:e,meta:{symbol:t,exchangeName:"US",regularMarketPrice:e.length>0?e[e.length-1].close:null}},meta:{symbol:t,regularMarketPrice:e.length>0?e[e.length-1].close:null}}}console.log(`[Finnhub] Returned empty data for ${t} (status: ${s.s}), trying Alpaca...`)}}catch(o){console.log(`[Finnhub] API failed for ${t}: ${o.message}, trying Alpaca...`)}else console.log("[Finnhub] API key not configured, skipping to Alpaca...");try{console.log(`[Alpaca] Attempting to fetch historical data for ${t}...`);const e=await this.getHistoricalDataFromAlpaca(t,n,r,i);if(e.success&&e.data?.quotes&&e.data.quotes.length>0)return console.log(`[Alpaca] Successfully fetched ${e.data.quotes.length} bars for ${t}`),{...e,source:"alpaca"};console.log(`[Alpaca] Returned no data for ${t}`)}catch(s){console.log(`[Alpaca] API fallback failed for ${t}: ${s.message}`)}const a=function(e){return{D:"1d",W:"1wk",M:"1mo","1d":"1d","1wk":"1wk","1mo":"1mo"}[e||"1d"]||null}(i);if(a)try{console.log(`[Yahoo] Attempting to fetch historical data for ${t}...`);const e=await Zr.getHistorical(t,{period1:n,period2:r,interval:a});if(e.success&&e.data&&e.data.length>0){const n=e.data.map(e=>({date:new Date(e.date),open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume}));return console.log(`[Yahoo] Successfully fetched ${n.length} bars for ${t}`),{success:!0,symbol:t,source:"yahoo",data:{quotes:n,meta:{symbol:t,exchangeName:"US",regularMarketPrice:n[n.length-1].close}},meta:{symbol:t,regularMarketPrice:n[n.length-1].close}}}console.log(`[Yahoo] Returned no data for ${t}`)}catch(c){console.log(`[Yahoo] API fallback failed for ${t}: ${c.message}`)}return console.error(`[Historical] Failed to fetch data for ${t} from Finnhub, Alpaca, and Yahoo Finance`),{success:!1,error:"Failed to fetch historical data from Finnhub, Alpaca, and Yahoo Finance."}}async getHistoricalDataFromAlpaca(e,t,n,r="1d"){const i=function(e){return{1:"1Min",5:"5Min",15:"15Min",30:"30Min",60:"1Hour","1m":"1Min","5m":"5Min","15m":"15Min","30m":"30Min","1h":"1Hour",D:"1Day",W:"1Week",M:"1Month","1d":"1Day","1wk":"1Week","1mo":"1Month"}[e]||"1Day"}(r),a="string"==typeof t?new Date(t):t,o="string"==typeof n?new Date(n):n;try{const t=await this.getHistoricalDataFromAlpacaHttp(e,a,o,i);if(t.success&&t.data?.quotes&&t.data.quotes.length>0)return console.log(`Alpaca HTTP API succeeded for ${e}: ${t.data.quotes.length} bars`),t;console.log(`Alpaca HTTP API returned no data for ${e}`)}catch(s){console.log(`Alpaca HTTP API failed for ${e}: ${s.message}`)}try{const t=lh();console.log(`Trying Alpaca SDK for ${e} from ${kh(a)} to ${kh(o)}`);const n=t.getBarsV2(e.toUpperCase(),{start:kh(a),end:kh(o),timeframe:i,feed:"iex"}),r=[];for await(const e of n){const t=e,n=t.Timestamp||t.t,i=t.OpenPrice??t.o,a=t.HighPrice??t.h,o=t.LowPrice??t.l,s=t.ClosePrice??t.c,c=t.Volume??t.v;n&&void 0!==i&&r.push({date:new Date(n),open:i,high:a,low:o,close:s,volume:c})}if(r.length>0)return console.log(`Alpaca SDK succeeded for ${e}: ${r.length} bars`),{success:!0,symbol:e,data:{quotes:r,meta:{symbol:e,exchangeName:"US",regularMarketPrice:r[r.length-1].close}},meta:{symbol:e,exchangeName:"US",regularMarketPrice:r[r.length-1].close}};console.log(`Alpaca SDK returned no data for ${e}`)}catch(c){console.log(`Alpaca SDK failed for ${e}: ${c.message}`)}return{success:!1,symbol:e,data:{quotes:[],meta:{symbol:e}}}}async getHistoricalDataFromAlpacaHttp(e,t,n,r){const{apiKey:i,secretKey:a}={apiKey:process.env.ALPACA_API_KEY||process.env.ALPACA_KEY_ID||process.env.APCA_API_KEY_ID||"",secretKey:process.env.ALPACA_SECRET||process.env.ALPACA_SECRET_KEY||process.env.APCA_API_SECRET_KEY||""};if(!i||!a)throw new Error("Alpaca API credentials not configured. Set ALPACA_API_KEY and ALPACA_SECRET environment variables.");const o=[];let s=null,c=0;const l=["iex","sip"];let u=null;for(const h of l){o.length=0,s=null,c=0;try{do{const l=new URL(`https://data.alpaca.markets/v2/stocks/${e.toUpperCase()}/bars`);l.searchParams.set("start",Fh(t)),l.searchParams.set("end",Fh(n)),l.searchParams.set("timeframe",r),l.searchParams.set("feed",h),l.searchParams.set("limit","10000"),l.searchParams.set("adjustment","split"),s&&l.searchParams.set("page_token",s),0===c&&console.log(`[Alpaca HTTP] Requesting ${e} with ${h} feed: ${l.toString().replace(/apikey=[^&]+/gi,"apikey=***")}`);const u=await fetch(l.toString(),{headers:{"APCA-API-KEY-ID":i,"APCA-API-SECRET-KEY":a,Accept:"application/json"}});if(!u.ok){const e=await u.text();if(403===u.status&&"sip"===h)throw console.log("[Alpaca HTTP] SIP feed not available (subscription required), trying IEX..."),new Error("SIP_NOT_AVAILABLE");throw console.error(`[Alpaca HTTP] Error response: ${u.status} ${u.statusText} - ${e}`),new Error(`Alpaca API error: ${u.status} ${u.statusText} - ${e}`)}const d=await u.json(),p=d.bars||[];Array.isArray(p)&&o.push(...p),s=d.next_page_token||null,c++,s&&console.log(`[Alpaca HTTP] Page ${c}: fetched ${p.length} bars, more pages available...`)}while(s&&c<50);if(o.length>0){console.log(`[Alpaca HTTP] Successfully fetched ${o.length} bars for ${e} using ${h} feed (${c} page(s))`);break}}catch(p){if("SIP_NOT_AVAILABLE"===p.message)continue;u=p,console.log(`[Alpaca HTTP] ${h} feed failed for ${e}: ${p.message}`)}}if(0===o.length){if(console.log(`[Alpaca HTTP] No data returned for ${e} from any feed`),u)throw u;return{success:!0,symbol:e,data:{quotes:[],meta:{symbol:e}},meta:{symbol:e}}}const d=o.map(e=>({date:new Date(e.t),open:e.o,high:e.h,low:e.l,close:e.c,volume:e.v}));return d.sort((e,t)=>e.date.getTime()-t.date.getTime()),{success:!0,symbol:e,data:{quotes:d,meta:{symbol:e,exchangeName:"US",regularMarketPrice:d.length>0?d[d.length-1].close:null}},meta:{symbol:e,exchangeName:"US",regularMarketPrice:d.length>0?d[d.length-1].close:null}}}async getQuote(e){const{symbol:t}=e;try{const[e,n,r]=await Promise.all([Dh("/quote",{symbol:t.toUpperCase()}),Dh("/stock/profile2",{symbol:t.toUpperCase()}).catch(()=>null),Dh("/stock/metric",{symbol:t.toUpperCase(),metric:"all"}).catch(()=>null)]),i={price:{regularMarketPrice:e.c,regularMarketChange:e.d,regularMarketChangePercent:e.dp,regularMarketDayHigh:e.h,regularMarketDayLow:e.l,regularMarketOpen:e.o,regularMarketPreviousClose:e.pc,regularMarketTime:new Date(1e3*e.t)},summaryDetail:{previousClose:e.pc,open:e.o,dayHigh:e.h,dayLow:e.l,regularMarketVolume:r?.metric?.["10DayAverageTradingVolume"]||null,fiftyTwoWeekHigh:r?.metric?.["52WeekHigh"]||null,fiftyTwoWeekLow:r?.metric?.["52WeekLow"]||null,trailingPE:r?.metric?.peBasicExclExtraTTM||null,dividendYield:r?.metric?.dividendYieldIndicatedAnnual?r.metric.dividendYieldIndicatedAnnual/100:null,beta:r?.metric?.beta||null},defaultKeyStatistics:{priceToBook:r?.metric?.pbAnnual||null,enterpriseValue:null,forwardPE:null,pegRatio:null,beta:r?.metric?.beta||null,sharesOutstanding:n?.shareOutstanding?1e6*n.shareOutstanding:null},financialData:{currentPrice:e.c,targetHighPrice:null,targetLowPrice:null,targetMeanPrice:null,targetMedianPrice:null,recommendationMean:null,recommendationKey:null,numberOfAnalystOpinions:null,totalCash:null,totalDebt:null,totalRevenue:null,returnOnEquity:r?.metric?.roeTTM?r.metric.roeTTM/100:null,returnOnAssets:r?.metric?.roaeTTM?r.metric.roaeTTM/100:null,profitMargins:r?.metric?.netProfitMarginTTM?r.metric.netProfitMarginTTM/100:null,operatingMargins:r?.metric?.operatingMarginTTM?r.metric.operatingMarginTTM/100:null,grossMargins:r?.metric?.grossMarginTTM?r.metric.grossMarginTTM/100:null,freeCashflow:null,operatingCashflow:null,revenueGrowth:r?.metric?.revenueGrowthTTMYoy?r.metric.revenueGrowthTTMYoy/100:null,earningsGrowth:r?.metric?.epsGrowthTTMYoy?r.metric.epsGrowthTTMYoy/100:null,currentRatio:r?.metric?.currentRatio||null,debtToEquity:r?.metric?.totalDebtToEquity||null},summaryProfile:n?{industry:n.finnhubIndustry,sector:n.finnhubIndustry,website:n.weburl,country:n.country,fullTimeEmployees:null,longBusinessSummary:null}:null};return n&&(i.price.currency=n.currency,i.price.longName=n.name,i.price.shortName=n.name,i.price.marketCap=n.marketCapitalization?1e6*n.marketCapitalization:null,i.price.exchange=n.exchange,i.summaryDetail.marketCap=n.marketCapitalization?1e6*n.marketCapitalization:null),{success:!0,symbol:t,data:i}}catch(n){return{success:!1,error:n.message||"Failed to fetch quote"}}}async search(e){try{return{success:!0,query:e,results:(await Dh("/search",{q:e})).result.map(e=>({symbol:e.symbol,shortname:e.description,exchange:e.type,quoteType:e.type}))}}catch(t){return{success:!1,error:t.message||"Failed to search"}}}async getPeers(e){try{const t=await Dh("/stock/peers",{symbol:e.toUpperCase()});return{success:!0,symbol:e,peers:t||[]}}catch(t){return{success:!1,error:t.message||"Failed to fetch peers"}}}async getRecommendations(e){try{const t=await Dh("/stock/recommendation",{symbol:e.toUpperCase()});return{success:!0,symbol:e,data:{recommendationTrend:{trend:t.map(e=>({period:e.period,strongBuy:e.strongBuy,buy:e.buy,hold:e.hold,sell:e.sell,strongSell:e.strongSell}))}}}}catch(t){return{success:!1,error:t.message||"Failed to fetch recommendations"}}}async getFinancials(e){try{const t=await Dh("/stock/metric",{symbol:e.toUpperCase(),metric:"all"});return{success:!0,symbol:e,data:{earnings:{earningsChart:{},financialsChart:{}},incomeStatementHistory:{},balanceSheetHistory:{},cashflowStatementHistory:{},metrics:t.metric,series:t.series}}}catch(t){return{success:!1,error:t.message||"Failed to fetch financials"}}}async getNews(e,t,n){try{const r=/* @__PURE__ */new Date,i=new Date(r.getTime()-6048e5),a=await Dh("/company-news",{symbol:e.toUpperCase(),from:t||i.toISOString().split("T")[0],to:n||r.toISOString().split("T")[0]});return{success:!0,symbol:e,news:a.map(e=>({title:e.headline,link:e.url,publisher:e.source,publishedAt:new Date(1e3*e.datetime),summary:e.summary,image:e.image,category:e.category,related:e.related}))}}catch(r){return{success:!1,error:r.message||"Failed to fetch news"}}}async getForexRate(e,t){try{const n=(await Dh("/forex/rates",{base:e.toUpperCase()})).quote[t.toUpperCase()];return{success:!0,baseCurrency:e,quoteCurrency:t,rate:n||null}}catch(n){return{success:!1,error:n.message||"Failed to fetch forex rate"}}}}const Hh=new Gh,xh=process.env.NEXT_PUBLIC_ALPACA_MCP_URL||"http://localhost:3001";class Uh{baseURL;apiKey;apiSecret;constructor(e){this.baseURL=e?.baseURL||xh,this.apiKey=e?.apiKey,this.apiSecret=e?.apiSecret}async callTool(e,t={}){const n=await fetch(`${this.baseURL}/mcp/call`,{method:"POST",headers:{"Content-Type":"application/json",...this.apiKey&&{"X-API-Key":this.apiKey},...this.apiSecret&&{"X-API-Secret":this.apiSecret}},body:JSON.stringify({tool:e,arguments:t})});if(!n.ok){const e=await n.json().catch(()=>({error:"Unknown error"}));throw new Error(e.error||`MCP call failed: ${n.statusText}`)}const r=await n.json();if(!r.success)throw new Error(r.error||"Tool call failed");return r.data}async getAccount(){return this.callTool("get_account",{})}async getPositions(){return this.callTool("get_all_positions",{})}async getPosition(e){return this.callTool("get_position",{symbol:e})}async getPortfolioHistory(e){return this.callTool("get_portfolio_history",e||{})}async placeOrder(e){return this.callTool("place_order",e)}async getOrders(e){return this.callTool("get_orders",e||{})}async getOrder(e){return this.callTool("get_order",{order_id:e})}async cancelOrder(e){return this.callTool("cancel_order",{order_id:e})}async closePosition(e,t){return this.callTool("close_position",{symbol:e,...t&&{qty:t}})}async closeAllPositions(){return this.callTool("close_all_positions",{})}async getQuote(e){return this.callTool("get_latest_quote",{symbol:e})}async getBars(e){return this.callTool("get_bars",e)}async getLatestBar(e){return this.callTool("get_latest_bar",{symbol:e})}async getSnapshot(e){return this.callTool("get_snapshot",{symbol:e})}async searchAssets(e){return this.callTool("search_assets",e||{})}async getOptionChain(e){return this.callTool("get_option_chain",e)}async placeOptionOrder(e){return this.callTool("place_option_order",e)}async getCryptoBars(e){return this.callTool("get_crypto_bars",e)}async getCryptoQuote(e){return this.callTool("get_latest_crypto_quote",{symbol:e})}async placeCryptoOrder(e){return this.callTool("place_crypto_order",e)}async getWatchlists(){return this.callTool("get_watchlists",{})}async createWatchlist(e,t){return this.callTool("create_watchlist",{name:e,symbols:t})}async addToWatchlist(e,t){return this.callTool("add_to_watchlist",{watchlist_id:e,symbol:t})}async deleteWatchlist(e){return this.callTool("delete_watchlist",{watchlist_id:e})}async getMarketCalendar(e){return this.callTool("get_market_calendar",e||{})}async getCorporateActions(e){return this.callTool("get_corporate_actions",e)}async chatWithAI(e){try{const t=await fetch("/api/alpaca/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:e})});if(!t.ok)throw new Error(`Chat API error: ${t.statusText}`);const n=await t.json();return{role:"assistant",content:n.content,timestamp:new Date(n.timestamp),suggestions:n.suggestions||[]}}catch(t){return console.error("Chat error:",t),{role:"assistant",content:`Sorry, I encountered an error: ${t.message}\n\nPlease try again or check your GROQ API key configuration.`,timestamp:/* @__PURE__ */new Date,suggestions:["What is a momentum trading strategy?","How do I set stop loss and take profit?","Explain technical indicators for trading"]}}}async generateStrategyFromDescription(e){return{name:"AI Generated Strategy",description:e,symbols:["AAPL","MSFT","GOOGL"],active:!1,rules:[{id:"1",type:"entry",condition:{indicator:"price",operator:"crosses_above",value:"sma_20",timeframe:"1D"},action:{type:"buy",orderType:"market"}},{id:"2",type:"exit",condition:{indicator:"price",operator:"crosses_below",value:"sma_20",timeframe:"1D"},action:{type:"sell",orderType:"market"}}],riskManagement:{maxPositionSize:10,stopLoss:5,takeProfit:15,maxDailyLoss:2,trailingStop:3},createdAt:/* @__PURE__ */(new Date).toISOString()}}}let Vh=null;function $h(){return Vh||(Vh=new Uh),Vh}const jh={get instance(){return $h()}};async function Wh(){return $h().getAccount()}async function Xh(e){return $h().placeOrder(e)}async function Kh(e){return $h().chatWithAI(e)}const Yh=new class{roundPrice(e){return null==e||isNaN(e)?null:Math.round(100*e)/100}async getCachedQuote(e){try{const n=await Fr.select().from(Cr).where(t(Cr.symbol,e.toUpperCase())).limit(1);if(0===n.length)return null;const r=n[0];return{symbol:r.symbol,price:r.price,change:r.change,changePercent:r.changePercent,open:r.open,high:r.high,low:r.low,previousClose:r.previousClose,volume:r.volume}}catch(n){return console.error(`[QuoteCache] Error reading cache for ${e}:`,n.message),null}}async saveQuoteToCache(e){try{const t={symbol:e.symbol.toUpperCase(),price:this.roundPrice(e.price)||0,change:this.roundPrice(e.change),changePercent:this.roundPrice(e.changePercent),open:this.roundPrice(e.open),high:this.roundPrice(e.high),low:this.roundPrice(e.low),previousClose:this.roundPrice(e.previousClose),volume:e.volume};await Fr.insert(Cr).values(t).onConflictDoUpdate({target:Cr.symbol,set:{price:t.price,change:t.change,changePercent:t.changePercent,open:t.open,high:t.high,low:t.low,previousClose:t.previousClose,volume:t.volume}})}catch(t){console.error(`[QuoteCache] Error saving quote for ${e.symbol}:`,t.message)}}async saveQuotesToCache(e){try{await Promise.all(e.map(e=>this.saveQuoteToCache(e)))}catch(t){console.error("[QuoteCache] Error saving quotes to cache:",t.message)}}async saveHistoricalQuotes(e,t){if(t&&0!==t.length)try{const r=/* @__PURE__ */new Date,i=e.toUpperCase(),a=t.filter(t=>!!(t.date&&t.open&&t.high&&t.low&&t.close)||(console.warn(`[QuoteCache] Skipping invalid quote for ${e} on ${t.date}`),!1)).map(e=>({id:`${i}-${e.date}`,symbol:i,date:e.date,open:this.roundPrice(e.open)||0,high:this.roundPrice(e.high)||0,low:this.roundPrice(e.low)||0,close:this.roundPrice(e.close)||0,volume:e.volume||null,adjustedClose:this.roundPrice(e.adjustedClose)||null,createdAt:r}));if(0===a.length)return;const o=50;for(let t=0;t<a.length;t+=o){const r=a.slice(t,t+o);for(const t of r)try{await Fr.insert(Sr).values(t).onConflictDoNothing()}catch(n){console.error(`[QuoteCache] Failed to insert historical quote for ${e} on ${t.date}:`,n.message||n)}}}catch(r){console.error(`[QuoteCache] Error saving historical quotes for ${e}:`,r.message||r,r.stack)}}async getCachedHistoricalQuotes(e,n,r){try{const i=e.toUpperCase();let a=Fr.select().from(Sr).where(t(Sr.symbol,i));let o=await a;return n&&(o=o.filter(e=>e.date>=n)),r&&(o=o.filter(e=>e.date<=r)),o.map(e=>({date:e.date,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume||void 0,adjustedClose:e.adjustedClose||void 0}))}catch(i){return console.error(`[QuoteCache] Error reading historical quotes for ${e}:`,i.message),[]}}async saveFundamentals(e,t){try{const n=/* @__PURE__ */new Date,r={symbol:e.toUpperCase(),peRatio:this.roundPrice(t.peRatio),eps:this.roundPrice(t.eps),dividendYield:this.roundPrice(t.dividendYield),beta:this.roundPrice(t.beta),fiftyTwoWeekHigh:this.roundPrice(t.fiftyTwoWeekHigh),fiftyTwoWeekLow:this.roundPrice(t.fiftyTwoWeekLow),fiftyDayAverage:this.roundPrice(t.fiftyDayAverage),twoHundredDayAverage:this.roundPrice(t.twoHundredDayAverage),sharesOutstanding:t.sharesOutstanding,bookValue:this.roundPrice(t.bookValue),priceToBook:this.roundPrice(t.priceToBook),trailingPE:this.roundPrice(t.trailingPE),forwardPE:this.roundPrice(t.forwardPE),lastFetched:n,createdAt:n,updatedAt:n};await Fr.insert(Ar).values(r).onConflictDoUpdate({target:Ar.symbol,set:{peRatio:r.peRatio,eps:r.eps,dividendYield:r.dividendYield,beta:r.beta,fiftyTwoWeekHigh:r.fiftyTwoWeekHigh,fiftyTwoWeekLow:r.fiftyTwoWeekLow,fiftyDayAverage:r.fiftyDayAverage,twoHundredDayAverage:r.twoHundredDayAverage,sharesOutstanding:r.sharesOutstanding,bookValue:r.bookValue,priceToBook:r.priceToBook,trailingPE:r.trailingPE,forwardPE:r.forwardPE,lastFetched:n,updatedAt:n}})}catch(n){console.error(`[QuoteCache] Error saving fundamentals for ${e}:`,n.message)}}async getCachedFundamentals(e){try{const n=await Fr.select().from(Ar).where(t(Ar.symbol,e.toUpperCase())).limit(1);if(0===n.length)return null;const r=n[0],i=/* @__PURE__ */new Date,a=new Date(r.lastFetched);return i.getTime()-a.getTime()>864e5?null:r}catch(n){return console.error(`[QuoteCache] Error reading fundamentals for ${e}:`,n.message),null}}async clearExpiredCache(){}};function qh(e,t,n){return Promise.race([e,new Promise((e,r)=>setTimeout(()=>r(new Error(n)),t))])}class Qh{async getQuote(e,t={}){const{useCache:n=!0,cacheTTL:r}=t;if(console.log(`[UnifiedQuote] Fetching quote for ${e} (useCache: ${n}${r?`, cacheTTL: ${r}ms`:""})`),n)try{const t=await Yh.getCachedQuote(e,r);if(t)return console.log(`[UnifiedQuote] ✓ Returning cached quote for ${e}`),{success:!0,data:t}}catch(i){console.log(`[UnifiedQuote] Cache check failed for ${e}: ${i.message}`)}else console.log(`[UnifiedQuote] Skipping cache for ${e} (live data requested)`);try{console.log(`[UnifiedQuote] Trying alpaca for ${e}...`);const t=$h(),n=await qh(t.getQuote(e),1e4,`alpaca timeout after 10s for ${e}`);if(n){const t=n,r={symbol:e,price:t.ap||t.bp||0,change:null,changePercent:null,open:null,high:null,low:null,previousClose:null,volume:t.as||t.bs||null,marketCap:null,currency:"USD",name:e,exchange:t.x||null,timestamp:t.t?new Date(t.t):/* @__PURE__ */new Date,source:"alpaca"};return console.log(`[UnifiedQuote] ✓ alpaca succeeded for ${e}`),await Yh.saveQuoteToCache(r),{success:!0,data:r}}}catch(i){console.log(`[UnifiedQuote] ✗ alpaca failed for ${e}: ${i.message}`)}try{console.log(`[UnifiedQuote] Trying yfinance for ${e}...`);const t=await qh(zr.getQuote(e),1e4,`yfinance timeout after 10s for ${e}`);if(t.success&&t.data){const n=t.data,r={symbol:e,price:n.regularMarketPrice||n.currentPrice||0,change:n.regularMarketChange||null,changePercent:n.regularMarketChangePercent||null,open:n.regularMarketOpen||n.open||null,high:n.regularMarketDayHigh||n.dayHigh||null,low:n.regularMarketDayLow||n.dayLow||null,previousClose:n.regularMarketPreviousClose||n.previousClose||null,volume:n.volume||null,marketCap:n.marketCap||null,currency:n.currency||"USD",name:n.longName||n.shortName||e,exchange:n.exchange||n.fullExchangeName||null,timestamp:n.regularMarketTime?new Date(n.regularMarketTime):/* @__PURE__ */new Date,source:"yfinance"};return console.log(`[UnifiedQuote] ✓ yfinance succeeded for ${e}`),await Yh.saveQuoteToCache(r),{success:!0,data:r}}}catch(i){console.log(`[UnifiedQuote] ✗ yfinance failed for ${e}: ${i.message}`)}return console.error(`[UnifiedQuote] All sources failed for ${e}`),{success:!1,error:`Failed to fetch quote for ${e} from all sources (alpaca, yfinance)`}}async getQuotes(e,t={}){const{useCache:n=!0,cacheTTL:r}=t;if(console.log(`[UnifiedQuotes] Fetching quotes for ${e.length} symbols (useCache: ${n}${r?`, cacheTTL: ${r}ms`:""})`),0===e.length)return{success:!1,error:"No symbols provided"};const i=[],a=[];if(n)try{for(const t of e){const e=await Yh.getCachedQuote(t,r);e?i.push(e):a.push(t)}if(console.log(`[UnifiedQuotes] Found ${i.length}/${e.length} quotes in cache`),0===a.length)return{success:!0,data:{quotes:i,source:"mixed",timestamp:/* @__PURE__ */new Date}}}catch(c){console.log(`[UnifiedQuotes] Cache check failed: ${c.message}`)}else console.log("[UnifiedQuotes] Skipping cache for all symbols (live data requested)"),a.push(...e);const o=a.length>0?a:e;console.log(`[UnifiedQuotes] Fetching ${o.length} symbols individually...`);const s=[...i];for(const l of o){const e=await this.getQuote(l,{useCache:n,cacheTTL:r});e.success&&e.data&&s.push(e.data)}return s.length>0?{success:!0,data:{quotes:s,source:"mixed",timestamp:/* @__PURE__ */new Date}}:(console.error("[UnifiedQuotes] Failed to fetch any quotes"),{success:!1,error:`Failed to fetch quotes for any of the ${e.length} symbols`})}async getHistoricalQuotes(e,t,n,r={}){const{forceRefreshRecent:i=!0}=r,a=e.toUpperCase(),o="string"==typeof t?t:t.toISOString().split("T")[0],s="string"==typeof n?n:n.toISOString().split("T")[0];console.log(`[UnifiedHistorical] Fetching historical data for ${a} from ${o} to ${s}`);let c=[];try{c=await Yh.getCachedHistoricalQuotes(a,o,s),console.log(`[UnifiedHistorical] Found ${c.length} cached quotes for ${a}`)}catch(I){console.log(`[UnifiedHistorical] Cache read failed: ${I.message}`)}const l=this.generateTradingDates(o,s);console.log(`[UnifiedHistorical] Expected ~${l.length} trading days in range`);const u=new Set(c.map(e=>e.date));let d=l.filter(e=>!u.has(e));if(i&&c.length>0){const e=new Date(/* @__PURE__ */new Date);e.setDate(e.getDate()-2);const t=e.toISOString().split("T")[0],n=l.filter(e=>e>=t);for(const r of n)d.includes(r)||d.push(r);c=c.filter(e=>e.date<t)}if(console.log(`[UnifiedHistorical] Missing ${d.length} dates to fetch`),0===d.length)return console.log(`[UnifiedHistorical] ✓ All data found in cache for ${a}`),{success:!0,symbol:a,data:{quotes:c.sort((e,t)=>e.date.localeCompare(t.date)),meta:{symbol:a,cachedCount:c.length,fetchedCount:0,source:"cache"}}};let p=[];d.sort();const h=d[0],f=d[d.length-1];try{console.log(`[UnifiedHistorical] Fetching from Alpaca: ${h} to ${f}...`);const e=$h(),t=await qh(e.getBars({symbol:a,timeframe:"1Day",start:h,end:f}),3e4,`Alpaca historical timeout after 30s for ${a}`);t&&Array.isArray(t)&&(p=t.map(e=>({date:e.t?e.t.split("T")[0]:new Date(e.Timestamp||e.t).toISOString().split("T")[0],open:e.o??e.OpenPrice??0,high:e.h??e.HighPrice??0,low:e.l??e.LowPrice??0,close:e.c??e.ClosePrice??0,volume:e.v??e.Volume??void 0})),console.log(`[UnifiedHistorical] ✓ Alpaca returned ${p.length} bars`),p.length>0&&(await Yh.saveHistoricalQuotes(a,p),console.log(`[UnifiedHistorical] Saved ${p.length} quotes to cache`)))}catch(I){console.log(`[UnifiedHistorical] ✗ Alpaca failed: ${I.message}`);try{console.log("[UnifiedHistorical] Trying finnhub fallback...");const e=await Hh.getHistoricalData({symbol:a,period1:h,period2:f,interval:"D"});e.success&&e.data?.quotes&&(p=e.data.quotes.map(e=>({date:e.date instanceof Date?e.date.toISOString().split("T")[0]:e.date,open:e.open,high:e.high,low:e.low,close:e.close,volume:e.volume})),console.log(`[UnifiedHistorical] ✓ Finnhub returned ${p.length} bars`),p.length>0&&await Yh.saveHistoricalQuotes(a,p))}catch(C){console.log(`[UnifiedHistorical] ✗ Finnhub fallback also failed: ${C.message}`)}}const m=[...c,...p],g=/* @__PURE__ */new Map;for(const A of m)g.set(A.date,A);const y=Array.from(g.values()).sort((e,t)=>e.date.localeCompare(t.date));return 0===y.length?{success:!1,symbol:a,error:`Failed to fetch historical data for ${a}`}:{success:!0,symbol:a,data:{quotes:y,meta:{symbol:a,cachedCount:c.length,fetchedCount:p.length,source:p.length>0?c.length>0?"mixed":"alpaca":"cache"}}}}generateTradingDates(e,t){const n=[],r=new Date(e),i=new Date(t),a=new Date(r);for(;a<=i;){const e=a.getDay();0!==e&&6!==e&&n.push(a.toISOString().split("T")[0]),a.setDate(a.getDate()+1)}return n}async getQuoteFromSource(e,t){console.log(`[UnifiedQuote] Fetching quote for ${e} from ${t}`);try{if("yfinance"===t){const t=await zr.getQuote(e);if(t.success&&t.data){const n=t.data;return{success:!0,data:{symbol:e,price:n.regularMarketPrice||n.currentPrice||0,change:n.regularMarketChange||null,changePercent:n.regularMarketChangePercent||null,open:n.regularMarketOpen||n.open||null,high:n.regularMarketDayHigh||n.dayHigh||null,low:n.regularMarketDayLow||n.dayLow||null,previousClose:n.regularMarketPreviousClose||n.previousClose||null,volume:n.volume||null,marketCap:n.marketCap||null,currency:n.currency||"USD",name:n.longName||n.shortName||e,exchange:n.exchange||n.fullExchangeName||null,timestamp:n.regularMarketTime?new Date(n.regularMarketTime):/* @__PURE__ */new Date,source:"yfinance"}}}}else if("finnhub"===t){const t=await Hh.getQuote({symbol:e});if(t.success&&t.data){const n=t.data;return{success:!0,data:{symbol:e,price:n.price?.regularMarketPrice||0,change:n.price?.regularMarketChange||null,changePercent:n.price?.regularMarketChangePercent||null,open:n.summaryDetail?.open||null,high:n.summaryDetail?.dayHigh||null,low:n.summaryDetail?.dayLow||null,previousClose:n.summaryDetail?.previousClose||null,volume:n.summaryDetail?.regularMarketVolume||null,marketCap:n.price?.marketCap||null,currency:n.price?.currency||"USD",name:n.price?.longName||n.price?.shortName||e,exchange:n.price?.exchange||null,timestamp:n.price?.regularMarketTime||/* @__PURE__ */new Date,source:"finnhub"}}}}else if("alpaca"===t){const t=$h(),n=await t.getQuote(e);if(n){const t=n;return{success:!0,data:{symbol:e,price:t.ap||t.bp||0,change:null,changePercent:null,open:null,high:null,low:null,previousClose:null,volume:t.as||t.bs||null,marketCap:null,currency:"USD",name:e,exchange:t.x||null,timestamp:t.t?new Date(t.t):/* @__PURE__ */new Date,source:"alpaca"}}}}}catch(n){return{success:!1,error:`Failed to fetch quote from ${t}: ${n.message}`}}return{success:!1,error:`No data returned from ${t}`}}}const Jh=new Qh;async function zh(e,t={}){return Jh.getQuotes(e,t)}async function Zh(e,t){return Jh.getQuoteFromSource(e,t)}async function ef(e,t,n,r={}){return Jh.getHistoricalQuotes(e,t,n,r)}const tf=["Overall","Politics","Sports","Crypto","Culture","Mentions","Weather","Economics","Tech","Finance"];function nf(){return[]}function rf(e){}async function af(e=50,t="volume24hr",n=0){try{const r=new URL(`${"https://gamma-api.polymarket.com"}/markets`);r.searchParams.set("closed","false"),r.searchParams.set("active","true"),r.searchParams.set("limit",String(e)),r.searchParams.set("offset",String(n)),r.searchParams.set("order",t),r.searchParams.set("ascending","false");const i=await p(r,{headers:{accept:"application/json"},cache:"no-store"});if(!i.ok)throw new Error(`Polymarket API returned ${i.status} ${i.statusText}`);return await i.json()}catch(r){throw console.error(`Error fetching markets (limit: ${e}, offset: ${n}):`,r.message),r}}async function of(e="volume24hr",t=1e3){try{const r=[];let i=0;const a=100;let o=!0,s=0;const c=3;for(;o;)try{const n=await af(a,e,i);if(!n||0===n.length){o=!1;break}r.push(...n),i+=n.length,s=0,(t>0&&r.length>=t||n.length<a)&&(o=!1)}catch(n){s++,console.error(`Error fetching markets batch at offset ${i} (attempt ${s}/${c}):`,n.message),s>=c?(console.error("Too many consecutive errors, stopping pagination"),o=!1):await new Promise(e=>setTimeout(e,1e3))}return t>0&&r.length>t?r.slice(0,t):r}catch(n){throw console.error("Fatal error in fetchAllMarkets:",n.message),n}}async function sf(e,t=100){if(!e||""===e.trim())return[];return((await cf({q:e,keep_closed_markets:0,limit_per_type:t,search_tags:!0,search_profiles:!1})).markets||[]).filter(e=>e.active&&!e.closed)}async function cf(e){const t=new URL("https://gamma-api.polymarket.com/public-search");t.searchParams.set("q",e.q),void 0!==e.cache&&t.searchParams.set("cache",String(e.cache)),e.events_status&&t.searchParams.set("events_status",e.events_status),void 0!==e.limit_per_type&&t.searchParams.set("limit_per_type",String(e.limit_per_type)),void 0!==e.page&&t.searchParams.set("page",String(e.page)),e.events_tag&&e.events_tag.forEach(e=>t.searchParams.append("events_tag",e)),void 0!==e.keep_closed_markets&&t.searchParams.set("keep_closed_markets",String(e.keep_closed_markets)),e.sort&&t.searchParams.set("sort",e.sort),void 0!==e.ascending&&t.searchParams.set("ascending",String(e.ascending)),void 0!==e.search_tags&&t.searchParams.set("search_tags",String(e.search_tags)),void 0!==e.search_profiles&&t.searchParams.set("search_profiles",String(e.search_profiles)),e.recurrence&&t.searchParams.set("recurrence",e.recurrence),e.exclude_tag_id&&e.exclude_tag_id.forEach(e=>t.searchParams.append("exclude_tag_id",String(e))),void 0!==e.optimized&&t.searchParams.set("optimized",String(e.optimized));const n=await p(t,{headers:{accept:"application/json"},cache:"no-store"});if(!n.ok)throw console.error(`Public search failed: ${n.status}`),new Error(`Public search failed: ${n.status}`);return await n.json()}async function lf(e={}){const{timePeriod:t="all",orderBy:n="VOL",limit:r=20,offset:i=0,category:a="Overall"}=e,o=new URL("https://data-api.polymarket.com/v1/leaderboard");o.searchParams.set("timePeriod",t),o.searchParams.set("orderBy",n),o.searchParams.set("limit",String(r)),o.searchParams.set("offset",String(i)),o.searchParams.set("category",a);const s=await p(o,{headers:{accept:"application/json"}});if(!s.ok)throw new Error(`leaderboard fetch failed: ${s.status}`);return await s.json()}async function uf(e=50){const t=await p("https://polymarketanalytics.com/api/traders-tag-performance",{method:"POST",headers:{accept:"*/*","content-type":"application/json"},body:JSON.stringify({tag:"Overall",sortColumn:"overall_gain",sortDirection:"DESC",minPnL:-4534159.552280787,maxPnL:3203232.91229432,minActivePositions:0,maxActivePositions:38642,minWinAmount:0,maxWinAmount:20316723.043360095,minLossAmount:-20494980.369057264,maxLossAmount:0,minWinRate:0,maxWinRate:100,minCurrentValue:0,maxCurrentValue:1e12,minTotalPositions:1,maxTotalPositions:56928})});if(!t.ok)throw new Error(`leaders fetch failed: ${t.status}`);const n=await t.json();let r=[];return Array.isArray(n)?(r=n,r.slice(0,e)):(console.error("Polymarket API returned non-array:",JSON.stringify(n)),[])}async function df(e){const t=await p("https://polymarketanalytics.com/api/traders-positions",{method:"POST",headers:{accept:"*/*","content-type":"application/json"},body:JSON.stringify({trader_id:e})});if(!t.ok)throw new Error(`positions fetch failed: ${t.status}`);return await t.json()}async function pf(e){const t=/* @__PURE__ */new Map;if(0===e.length)return t;try{const n=await p("https://polymarketanalytics.com/api/traders-tag-performance",{method:"POST",headers:{accept:"*/*","content-type":"application/json"},body:JSON.stringify({tag:"Overall",sortColumn:"overall_gain",sortDirection:"DESC",minPnL:-1e8,maxPnL:1e8,minActivePositions:0,maxActivePositions:1e5,minWinAmount:0,maxWinAmount:1e8,minLossAmount:-1e8,maxLossAmount:0,minWinRate:0,maxWinRate:100,minCurrentValue:0,maxCurrentValue:1e11,minTotalPositions:0,maxTotalPositions:1e5})});if(!n.ok)return console.error(`Trader profiles fetch failed: ${n.status}`),t;const r=await n.json(),i=Array.isArray(r)?r:[],a=new Set(e.map(e=>e.toLowerCase()));for(const e of i){const n=e.proxy_wallet||e.proxyWallet||e.address||"";a.has(n.toLowerCase())&&t.set(n.toLowerCase(),{address:n,userName:e.user_name||e.userName,profileImage:e.profile_image||e.profileImage,overallGain:e.overall_gain||e.overallGain||0,winRate:e.win_rate||e.winRate||0,totalProfit:e.win_amount||e.winAmount||0,totalLoss:e.loss_amount||e.lossAmount||0,totalPositions:e.total_positions||e.totalPositions||0,activePositions:e.active_positions||e.activePositions||0,currentValue:e.current_value||e.currentValue||0})}}catch(n){console.error("Error fetching trader profiles:",n)}return t}async function hf(e){const{user:t,limit:n=100,offset:r=0,market:i,type:a,start:o,end:s,sortBy:c="TIMESTAMP",sortDirection:l="DESC",side:u}=e,d=new URL("https://data-api.polymarket.com/activity");d.searchParams.set("user",t),d.searchParams.set("limit",String(Math.min(n,500))),d.searchParams.set("offset",String(Math.min(r,1e4))),d.searchParams.set("sortBy",c),d.searchParams.set("sortDirection",l),i&&i.length>0&&d.searchParams.set("market",i.join(",")),a&&a.length>0&&d.searchParams.set("type",a.join(",")),void 0!==o&&d.searchParams.set("start",String(o)),void 0!==s&&d.searchParams.set("end",String(s)),u&&d.searchParams.set("side",u);const h=await p(d,{headers:{accept:"application/json"}});if(!h.ok)throw new Error(`Activity fetch failed for ${t}: ${h.status}`);return await h.json()}async function ff(e,t={},n){const r=[];let i=0;for(;i<1e4;){const a=await hf({...t,user:e,limit:500,offset:i});if(0===a.length)break;if(r.push(...a),n?.(r.length,null),a.length<500)break;i+=500,await new Promise(e=>setTimeout(e,100))}return r}async function mf(e,t=20){if(!e)return console.error("No conditionId provided for holders fetch"),[];const n=new URL("https://data-api.polymarket.com/holders");n.searchParams.set("market",e),n.searchParams.set("limit",String(Math.min(t,20))),n.searchParams.set("minBalance","1");try{const e=await p(n.toString(),{headers:{accept:"application/json"},cache:"no-store"});if(!e.ok)return console.error(`Holders fetch failed: ${e.status}`),[];const t=await e.json();return Array.isArray(t)?t:[]}catch(r){return console.error("Error fetching market holders:",r),[]}}async function gf(e){const t=new URL(`https://gamma-api.polymarket.com/markets/${e}/order-book`),n=await p(t,{headers:{accept:"application/json"},cache:"no-store"});return n.ok?await n.json():(console.error(`Order book fetch failed for market ${e}: ${n.status}`),null)}async function yf(e){const t=new URL(`https://gamma-api.polymarket.com/markets/${e}`),n=await p(t,{headers:{accept:"application/json"},cache:"no-store"});return n.ok?await n.json():(console.error(`Market details fetch failed for market ${e}: ${n.status}`),null)}async function If(e){const t=await p("https://polymarketanalytics.com/api/market-summary",{method:"POST",headers:{accept:"*/*","accept-language":"en-US,en;q=0.9","content-type":"application/json"},body:JSON.stringify({eventId:e}),cache:"no-store"});if(!t.ok)throw console.error(`Market summary fetch failed: ${t.status}`),new Error(`Market summary API error: ${t.status}`);return await t.json()}async function Cf(e){const t=await p("https://polymarketanalytics.com/api/markets-dashboard",{method:"POST",headers:{accept:"*/*","accept-language":"en-US,en;q=0.9","content-type":"application/json"},body:JSON.stringify({eventId:e}),cache:"no-store"});if(!t.ok)throw console.error(`Markets dashboard fetch failed: ${t.status}`),new Error(`Dashboard API error: ${t.status}`);return await t.json()}async function Af(e){const{market:t,interval:n="1h",startTs:r,endTs:i,abs:a=!1}=e,o=new URL("https://clob.polymarket.com/prices-history");o.searchParams.set("market",t),o.searchParams.set("interval",n),o.searchParams.set("abs",String(a)),void 0!==r&&o.searchParams.set("startTs",String(r)),void 0!==i&&o.searchParams.set("endTs",String(i));const s=await p(o,{headers:{accept:"application/json"},cache:"no-store"});if(!s.ok){let e="";try{const t=await s.text();e=t?` - ${t}`:""}catch(c){}if(400===s.status)throw new Error(`Invalid token or price history not available for token ${t}${e}`);throw new Error(`Price history fetch failed for token ${t}: ${s.status}${e}`)}return await s.json()}function Sf(e){return{info:(t,n)=>{"string"==typeof t?console.log(`[${e}] INFO: ${t}`,n||""):console.log(`[${e}] INFO:`,n||"",t)},debug:(t,n)=>{"string"==typeof t?console.debug(`[${e}] DEBUG: ${t}`,n||""):console.debug(`[${e}] DEBUG:`,n||"",t)},warn:(t,n)=>{"string"==typeof t?console.warn(`[${e}] WARN: ${t}`,n||""):console.warn(`[${e}] WARN:`,n||"",t)},error:(t,n)=>{"string"==typeof t?console.error(`[${e}] ERROR: ${t}`,n||""):console.error(`[${e}] ERROR:`,n||"",t)}}}const bf=Sf("gamma"),Tf="https://gamma-api.polymarket.com";function vf(e,t,n,r){const i=t.toLowerCase();for(const o of n)if(i===o.toLowerCase())return{blocked:!0,reason:"category",matchedValue:o};const a=e.toLowerCase();for(const o of r)if(a.includes(o.toLowerCase()))return{blocked:!0,reason:"keyword",matchedValue:o};return{blocked:!1}}async function _f(e=[],t=[]){bf.debug("Fetching active events from Gamma API");const n=[];let r=0,i=!0;for(;i;){const a=(await d.get(`${Tf}/events`,{params:{active:!0,closed:!1,limit:100,offset:r},timeout:3e4})).data;if(a&&0!==a.length){for(const r of a){let i="Unknown";if(r.tags&&r.tags.length>0?i=r.tags[0]?.label||"Unknown":r.category&&(i=r.category),r.markets&&Array.isArray(r.markets))for(const a of r.markets){const o=vf(a.question,i,e,t);if(o.blocked){bf.debug({marketId:a.id,reason:o.reason,match:o.matchedValue},"Market blocked by filter");continue}const s=Rf(a,i,r.slug??"");s&&n.push(s)}}a.length<100?i=!1:r+=100,r>5e3&&(bf.warn("Reached safety limit of 5000 events, stopping pagination"),i=!1)}else i=!1}return bf.info({count:n.length},"Fetched active markets with prices"),n}async function wf(e){try{const t=Rf((await d.get(`${Tf}/markets/${e}`,{timeout:3e4})).data,"Unknown","");return t?.market??null}catch(t){if(d.isAxiosError(t)&&404===t.response?.status)return null;throw t}}async function Ef(){try{return 200===(await d.get(`${Tf}/events`,{params:{limit:1},timeout:5e3})).status}catch{return!1}}const Pf=5e4;function Rf(e,t,n){if(e.closed)return null;if((e.volumeNum??e.volume24hr??0)<Pf)return null;let r="",i="";if(e.clobTokenIds)try{const t=JSON.parse(e.clobTokenIds);r=t[0]??"",i=t[1]??""}catch{}let a=0,o=0;if(e.outcomePrices)try{const t=JSON.parse(e.outcomePrices);a=parseFloat(t[0]??"0")||0,o=parseFloat(t[1]??"0")||0}catch{}if(!r&&!i)return null;let s=null;e.endDate?s=new Date(e.endDate):e.endDateIso&&(s=new Date(e.endDateIso));return{market:{id:e.id,conditionId:e.conditionId??"",question:e.question,slug:e.slug??"",eventSlug:n,category:t,endDate:s,active:e.active??!0,volumeNum:e.volumeNum??e.volume24hr??0,tokenYes:r,tokenNo:i},yesPrice:a,noPrice:o}}const Lf={Politics:{Elections:["election","vote","ballot","primary","electoral","swing state","battleground","polling","voter","campaign"],Presidency:["president","presidential","white house","oval office","executive order","trump","biden","administration"],Legislature:["senate","congress","house","representative","senator","bill","legislation","legislative","congress","filibuster"],Cabinet:["cabinet","secretary of","attorney general","chief of staff","press secretary","advisor","nominee","confirmation"],Judicial:["supreme court","justice","judge","ruling","court decision","judicial","scotus"],"Foreign Policy":["foreign policy","international","embassy","diplomat","treaty","sanctions","nato","un","united nations"]},Sports:{Football:["nfl","super bowl","quarterback","touchdown","football","patriots","cowboys","chiefs"],Basketball:["nba","basketball","lebron","championship","finals","lakers","warriors","celtics"],Baseball:["mlb","baseball","world series","yankees","dodgers"],Soccer:["fifa","world cup","premier league","messi","ronaldo","soccer","uefa","champions league"],Hockey:["nhl","hockey","stanley cup"],Olympics:["olympics","olympic","gold medal","winter games","summer games"],Combat:["ufc","boxing","mma","fight","fighter","heavyweight"],Racing:["nascar","f1","formula 1","racing","grand prix"]},Crypto:{Bitcoin:["bitcoin","btc","satoshi"],Ethereum:["ethereum","eth","vitalik","erc","gas fees"],Altcoins:["solana","cardano","polygon","avalanche","polkadot","chainlink","altcoin"],DeFi:["defi","decentralized finance","lending","liquidity","yield","staking","aave","uniswap"],NFTs:["nft","non-fungible","opensea","bored ape","cryptopunk"],Memecoins:["doge","dogecoin","shib","shiba","pepe","memecoin"],Exchanges:["binance","coinbase","kraken","ftx","exchange"],Regulation:["sec","regulation","compliance","etf","custody"]},Culture:{Movies:["movie","film","box office","oscar","academy awards","director","actor","cinema"],Music:["music","album","song","grammy","billboard","artist","concert","tour","spotify"],TV:["netflix","tv show","series","streaming","emmy","hulu","disney+"],Social:["tiktok","instagram","youtube","twitter","influencer","viral","trending"],Gaming:["gaming","video game","esports","twitch","xbox","playstation"],Awards:["award","oscar","grammy","emmy","golden globe"]},Weather:{Temperature:["temperature","degrees","celsius","fahrenheit","heat","cold"],Storms:["hurricane","storm","tornado","cyclone","typhoon"],Precipitation:["rain","rainfall","snow","snowfall","precipitation"],Climate:["climate","global warming","el nino","la nina"]},Economics:{"Monetary Policy":["federal reserve","fed","interest rate","rate cut","rate hike","powell"],Inflation:["inflation","cpi","pce","prices","deflation"],Employment:["unemployment","jobs","employment","payroll","labor market"],Growth:["gdp","growth","recession","expansion","contraction"],Trade:["trade","tariff","export","import","trade war"]},Tech:{"Big Tech":["apple","google","microsoft","amazon","meta","facebook"],AI:["ai","artificial intelligence","chatgpt","openai","claude","llm","machine learning"],Semiconductors:["nvidia","amd","intel","chip","semiconductor","tsmc"],Space:["spacex","starship","rocket","satellite","space"],Automotive:["tesla","electric vehicle","ev","autonomous","self-driving"],Software:["software","saas","platform","app","application"]},Finance:{Stocks:["stock","equity","shares","nasdaq","s&p","dow","market cap","trading"],Banking:["bank","banking","goldman","jpmorgan","wells fargo"],IPO:["ipo","initial public offering","listing","debut"],Earnings:["earnings","revenue","profit","eps","quarterly results"],Markets:["bull market","bear market","correction","crash","rally"]}},Nf={Politics:["election","president","senate","congress","vote","democrat","republican","trump","biden","policy","government","political","politician","cabinet","white house","legislative","bill","law","supreme court"],Sports:["nfl","nba","mlb","nhl","fifa","olympics","championship","playoff","super bowl","world cup","champion","athlete","player","team","match","game","sports","tournament","soccer","basketball","football","baseball","hockey"],Crypto:["bitcoin","ethereum","btc","eth","crypto","blockchain","defi","nft","token","altcoin","cryptocurrency","binance","coinbase","solana","cardano","polygon","doge","shib","web3"],Culture:["entertainment","celebrity","movie","music","artist","album","box office","grammy","oscar","emmy","award","netflix","spotify","tiktok","instagram","youtube","influencer","viral","meme"],Weather:["hurricane","temperature","rainfall","snow","storm","climate","tornado","flood","drought","weather","forecast","celsius","fahrenheit"],Economics:["gdp","inflation","recession","unemployment","interest rate","federal reserve","fed","economy","economic","market","jobs","employment","cpi","pce"],Tech:["apple","google","microsoft","amazon","meta","tesla","nvidia","ai","artificial intelligence","chatgpt","openai","technology","software","hardware","chip","semiconductor","spacex","starship","rocket"],Finance:["stock","nasdaq","s&p","dow","ipo","earnings","revenue","profit","market cap","trading","shares","investor","wall street","banking","financial"]};function Of(e,t){for(const r of tf)if("Overall"!==r&&"Mentions"!==r&&e.some(e=>e.toLowerCase()===r.toLowerCase()))return r;const n=t.toLowerCase();for(const[r,i]of Object.entries(Nf))for(const e of i)if(n.includes(e.toLowerCase()))return r;for(const r of e){const e=r.toLowerCase();for(const[t,n]of Object.entries(Nf))for(const r of n)if(e.includes(r.toLowerCase()))return t}return"Overall"}function Bf(e,t,n=[]){const r=Lf[e];if(!r)return null;const i=t.toLowerCase(),a=n.map(e=>e.toLowerCase()),o={};for(const[s,c]of Object.entries(r)){let e=0;for(const t of c)i.includes(t.toLowerCase())&&(e+=2);for(const t of a)for(const n of c)t.includes(n.toLowerCase())&&(e+=1);e>0&&(o[s]=e)}if(Object.keys(o).length>0){return Object.entries(o).sort((e,t)=>t[1]-e[1])[0][0]}return null}function Mf(e){if(!e)return[];if(Array.isArray(e))return e;if("string"==typeof e)try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}return[]}function Df(e){if(null==e)return JSON.stringify([]);if("string"==typeof e)try{return JSON.parse(e),e}catch{return JSON.stringify([e])}return JSON.stringify(e)}async function Ff(e){const t=Date.now();let n=0,r=0;for(const a of e)try{const e=a.events&&a.events.length>0?a.events[0].slug:null,r=Mf(a.tags),i=Of(r,a.question),o=i?Bf(i,a.question,r):null;await Fr.insert(Jn).values({id:a.id,conditionId:a.conditionId||null,question:a.question,slug:a.slug,eventSlug:e,description:a.description||null,image:a.imageUrl||a.image||null,volume24hr:a.volume24hr||0,volumeTotal:a.volumeNum||a.volumeTotal||0,active:a.active??!0,closed:a.closed??!1,outcomes:Df(a.outcomes),outcomePrices:Df(a.outcomePrices),clobTokenIds:Df(a.clobTokenIds),tags:Df(a.tags),category:i,subcategory:o,endDate:a.endDate||null,groupItemTitle:a.groupItemTitle||null,enableOrderBook:a.enableOrderBook??!1,createdAt:new Date(t),updatedAt:new Date(t)}).onConflictDoUpdate({target:Jn.id,set:{conditionId:a.conditionId||null,question:a.question,eventSlug:e,description:a.description||null,image:a.imageUrl||a.image||null,volume24hr:a.volume24hr||0,volumeTotal:a.volumeNum||a.volumeTotal||0,active:a.active??!0,closed:a.closed??!1,outcomes:Df(a.outcomes),outcomePrices:Df(a.outcomePrices),clobTokenIds:Df(a.clobTokenIds),tags:Df(a.tags),category:i,subcategory:o,endDate:a.endDate||null,groupItemTitle:a.groupItemTitle||null,enableOrderBook:a.enableOrderBook??!1,updatedAt:new Date(t)}}),n++}catch(i){r++,console.error(`Failed to save market ${a.id} (${a.question}):`,i.message)}r>0&&console.log(`Saved ${n}/${e.length} markets (${r} failed)`)}async function kf(e={}){const{limit:i=50,offset:a=0,sortBy:o="volume24hr",category:s,activeOnly:c=!0}=e;let l=Fr.select().from(Jn);const u=[];c&&u.push(t(Jn.active,!0)),s&&"Overall"!==s&&"all"!==s&&u.push(t(Jn.category,s)),u.length>0&&(l=l.where(n(...u)));const d="volume24hr"===o?Jn.volume24hr:"volumeTotal"===o?Jn.volumeTotal:Jn.createdAt;l=l.orderBy(r(d)),l=l.limit(i).offset(a);return await l}async function Gf(e,i={}){const{limit:a=50,offset:o=0,sortBy:s="volume24hr",category:c,activeOnly:l=!0}=i;if(!e||""===e.trim())return[];let u=Fr.select().from(Jn);const d=[];l&&d.push(t(Jn.active,!0)),c&&"Overall"!==c&&"all"!==c&&d.push(t(Jn.category,c)),d.length>0&&(u=u.where(n(...d)));const p="volume24hr"===s?Jn.volume24hr:"volumeTotal"===s?Jn.volumeTotal:Jn.createdAt;u=u.orderBy(r(p));const h=await u,f=e.toLowerCase();return h.filter(e=>e.question.toLowerCase().includes(f)).slice(o,o+a)}async function Hf(){const e=await Fr.select().from(Jn).where(t(Jn.active,!0)).orderBy(r(Jn.volume24hr)).limit(100),n={};for(const t of e)try{const e=JSON.parse(t.tags||"[]");for(const r of e)n[r]||(n[r]=[]),n[r].push(t)}catch{}return n}async function xf(e){const t=Date.now();for(const n of e)await Fr.insert(Yn).values({trader:n.trader,userName:n.trader_name||null,overallGain:n.overall_gain||0,winRate:n.win_rate||0,activePositions:n.active_positions||0,totalPositions:n.total_positions||0,currentValue:n.current_value||0,winAmount:n.win_amount||0,lossAmount:n.loss_amount||0,updatedAt:new Date(t)}).onConflictDoUpdate({target:Yn.trader,set:{userName:n.trader_name||null,overallGain:n.overall_gain||0,winRate:n.win_rate||0,activePositions:n.active_positions||0,totalPositions:n.total_positions||0,currentValue:n.current_value||0,winAmount:n.win_amount||0,lossAmount:n.loss_amount||0,updatedAt:new Date(t)}})}async function Uf(e){const t=Date.now();for(const n of e)await Fr.insert(Yn).values({trader:n.proxyWallet,rank:parseInt(n.rank),userName:n.userName||null,xUsername:n.xUsername||null,verifiedBadge:n.verifiedBadge||!1,profileImage:n.profileImage||null,vol:n.vol||0,pnl:n.pnl||0,updatedAt:new Date(t)}).onConflictDoUpdate({target:Yn.trader,set:{rank:parseInt(n.rank),userName:n.userName||null,xUsername:n.xUsername||null,verifiedBadge:n.verifiedBadge||!1,profileImage:n.profileImage||null,vol:n.vol||0,pnl:n.pnl||0,updatedAt:new Date(t)}})}async function Vf(e="vol",t=50){const n="vol"===e?Yn.vol:"pnl"===e?Yn.pnl:Yn.overallGain;return await Fr.select().from(Yn).orderBy(r(n)).limit(t)}async function $f(e,t){const n=Date.now();for(const r of t){const t=JSON.stringify(r.tags||r.market_tags||[]),i=`${e}-${r.market_id||r.id||Math.random()}`;await Fr.insert(qn).values({id:i,traderId:e,marketId:r.market_id||r.id,marketTitle:r.market_title||r.title||"",cashPnl:r.cashPnl||r.cash_pnl||0,realizedPnl:r.realizedPnl||r.realized_pnl||0,tags:t,createdAt:new Date(n)}).onConflictDoUpdate({target:qn.id,set:{cashPnl:r.cashPnl||r.cash_pnl||0,realizedPnl:r.realizedPnl||r.realized_pnl||0,tags:t}})}}async function jf(e,n){const r=Date.now();if(await Fr.delete(zn).where(t(zn.marketId,e)),n&&n.bids&&n.asks){for(const t of n.bids||[]){const n=`${e}-buy-${t.price}-${Date.now()}-${Math.random()}`;await Fr.insert(zn).values({id:n,marketId:e,outcome:t.outcome||"Yes",price:t.price||0,size:t.size||0,side:"buy",totalValue:(t.price||0)*(t.size||0),createdAt:new Date(r)})}for(const t of n.asks||[]){const n=`${e}-sell-${t.price}-${Date.now()}-${Math.random()}`;await Fr.insert(zn).values({id:n,marketId:e,outcome:t.outcome||"Yes",price:t.price||0,size:t.size||0,side:"sell",totalValue:(t.price||0)*(t.size||0),createdAt:new Date(r)})}}}async function Wf(e,n){const r=Date.now();await Fr.delete(tr).where(t(tr.marketId,e));for(const[t,i]of n.entries()){const n=i.address||i.user||i.proxyWallet||"",a=`${e}-${n}-${Date.now()}-${t}`;await Fr.insert(tr).values({id:a,marketId:e,address:n,userName:i.userName||i.username||i.name||null,profileImage:i.profileImage||i.image||null,rank:t+1,outcome:i.outcome||i.side||null,balance:parseFloat(i.balance||i.shares||0),value:parseFloat(i.value||i.volume||i.usdValue||0),overallGain:i.overallGain||i.pnl||i.gain||null,winRate:i.winRate??null,totalProfit:i.totalProfit??null,totalLoss:i.totalLoss??null,totalPositions:i.totalPositions??null,updatedAt:new Date(r)})}}async function Xf(e){return await Fr.select().from(qn).where(t(qn.traderId,e))}async function Kf(e){return await Fr.select().from(zn).where(t(zn.marketId,e)).orderBy(r(zn.totalValue))}async function Yf(e,n=10){return await Fr.select().from(tr).where(t(tr.marketId,e)).orderBy(i(tr.rank)).limit(n)}async function qf(e,t){const n=Date.now(),r=`debate-${e}`;await Fr.insert(Zn).values({id:r,marketId:e,question:t.question,yesArguments:JSON.stringify(t.yesArguments),noArguments:JSON.stringify(t.noArguments),yesSummary:t.yesSummary,noSummary:t.noSummary,keyFactors:JSON.stringify(t.keyFactors),uncertainties:JSON.stringify(t.uncertainties),currentYesPrice:t.currentYesPrice,currentNoPrice:t.currentNoPrice,llmProvider:t.llmProvider||null,model:t.model||null,createdAt:new Date(n),updatedAt:new Date(n)}).onConflictDoUpdate({target:Zn.marketId,set:{question:t.question,yesArguments:JSON.stringify(t.yesArguments),noArguments:JSON.stringify(t.noArguments),yesSummary:t.yesSummary,noSummary:t.noSummary,keyFactors:JSON.stringify(t.keyFactors),uncertainties:JSON.stringify(t.uncertainties),currentYesPrice:t.currentYesPrice,currentNoPrice:t.currentNoPrice,llmProvider:t.llmProvider||null,model:t.model||null,updatedAt:new Date(n)}})}async function Qf(e){const n=await Fr.select().from(Zn).where(t(Zn.marketId,e)).limit(1);return n.length>0?n[0]:null}async function Jf(e,t,n="1h"){try{Date.now();if(!t.history||0===t.history.length)return void console.log(`No price history data to save for token ${e}`);for(const i of t.history)try{const t=`${e}-${i.t}-${n}`;await Fr.insert(er).values({id:t,tokenId:e,timestamp:i.t,price:i.p,interval:n,createdAt:/* @__PURE__ */new Date}).onConflictDoUpdate({target:er.id,set:{price:i.p}})}catch(r){console.error(`Failed to save price point for token ${e} at timestamp ${i.t}:`,r.message)}}catch(i){throw console.error(`Error saving price history for token ${e}:`,i.message),i}}async function zf(e,r={}){const{interval:a,startTimestamp:o,endTimestamp:s,limit:c}=r,l=[t(er.tokenId,e)];a&&l.push(t(er.interval,a));let u=Fr.select().from(er).where(n(...l)).orderBy(i(er.timestamp));c&&(u=u.limit(c));const d=await u;let p=d;return void 0===o&&void 0===s||(p=d.filter(e=>!(void 0!==o&&e.timestamp<o)&&!(void 0!==s&&e.timestamp>s))),p}async function Zf(e,t){const n=/* @__PURE__ */new Date;let r=0;for(const a of t){const t=`${a.transactionHash}-${a.outcomeIndex??0}`;try{await Fr.insert(nr).values({id:t,traderId:a.proxyWallet||e,transactionHash:a.transactionHash,conditionId:a.conditionId,marketTitle:a.title||null,marketSlug:a.slug||null,eventSlug:a.eventSlug||null,type:a.type,side:a.side||null,outcome:a.outcome||null,outcomeIndex:a.outcomeIndex??null,size:parseFloat(a.size)||0,usdcSize:parseFloat(a.usdcSize)||0,price:a.price?parseFloat(a.price):null,traderName:a.pseudonym||null,traderBio:a.bio||null,traderProfileImage:a.profileImage||null,timestamp:new Date(1e3*a.timestamp),syncedAt:n,createdAt:n}).onConflictDoUpdate({target:nr.id,set:{marketTitle:a.title||null,marketSlug:a.slug||null,eventSlug:a.eventSlug||null,traderName:a.pseudonym||null,traderBio:a.bio||null,traderProfileImage:a.profileImage||null,syncedAt:n}}),r++}catch(i){console.error(`Error saving trade ${t}:`,i)}}return r}async function em(e,t){const n=/* @__PURE__ */new Date;await Fr.insert(rr).values({traderId:e,syncStatus:t.syncStatus||"pending",lastSyncedTimestamp:t.lastSyncedTimestamp||null,totalTradesSynced:t.totalTradesSynced||0,errorMessage:t.errorMessage||null,lastSyncAttempt:n,createdAt:n,updatedAt:n}).onConflictDoUpdate({target:rr.traderId,set:{...t.syncStatus&&{syncStatus:t.syncStatus},...t.lastSyncedTimestamp&&{lastSyncedTimestamp:t.lastSyncedTimestamp},...void 0!==t.totalTradesSynced&&{totalTradesSynced:t.totalTradesSynced},...void 0!==t.errorMessage&&{errorMessage:t.errorMessage},lastSyncAttempt:n,updatedAt:n}})}async function tm(e){return(await Fr.select().from(rr).where(t(rr.traderId,e)).limit(1))[0]||null}async function nm(e=100){return(await Fr.select({traderId:rr.traderId}).from(rr).where(a`${rr.syncStatus} IN ('pending', 'error')`).limit(e)).map(e=>e.traderId)}async function rm(e,i={}){const{limit:a=100,offset:c=0,type:l,startDate:u,endDate:d}=i,p=[t(nr.traderId,e)];return l&&p.push(t(nr.type,l)),u&&p.push(o(nr.timestamp,u)),d&&p.push(s(nr.timestamp,d)),await Fr.select().from(nr).where(n(...p)).orderBy(r(nr.timestamp)).limit(a).offset(c)}async function im(e){return(await Fr.select({totalTrades:a`count(*)`,totalVolume:a`sum(${nr.usdcSize})`,buyCount:a`sum(case when ${nr.side} = 'BUY' then 1 else 0 end)`,sellCount:a`sum(case when ${nr.side} = 'SELL' then 1 else 0 end)`,firstTradeDate:a`min(${nr.timestamp})`,lastTradeDate:a`max(${nr.timestamp})`,uniqueMarkets:a`count(distinct ${nr.conditionId})`}).from(nr).where(t(nr.traderId,e)))[0]||null}async function am(e){const n=await Fr.select({timestamp:a`max(strftime('%s', ${nr.timestamp}))`}).from(nr).where(t(nr.traderId,e));return n[0]?.timestamp||null}async function om(){const e=await Fr.select({status:rr.syncStatus,count:a`count(*)`}).from(rr).groupBy(rr.syncStatus),t={pending:0,in_progress:0,completed:0,error:0,total:0};for(const n of e)t[n.status]=n.count,t.total+=n.count;return t}async function sm(e,t){try{const n=await zf(e,{interval:"1h"});if(!n||0===n.length)return{daily:null,weekly:null,monthly:null};const r=Math.floor(Date.now()/1e3),i=86400,a=7*i,o=30*i,s=[...n].sort((e,t)=>e.timestamp-t.timestamp),c=e=>{for(let t=s.length-1;t>=0;t--)if(s[t].timestamp<=e)return s[t].price;return null},l=c(r-i),u=c(r-a),d=c(r-o);return{daily:null!==l?100*(t-l):null,weekly:null!==u?100*(t-u):null,monthly:null!==d?100*(t-d):null}}catch(n){return console.error(`Error calculating price changes for token ${e}:`,n.message),{daily:null,weekly:null,monthly:null}}}async function cm(e){const t=Date.now();await Fr.delete(Qn);for(const n of e)await Fr.insert(Qn).values({tag:n.tag,pnl:n.pnl,updatedAt:new Date(t)})}async function lm(){return{best:await Fr.select().from(Qn).orderBy(r(Qn.pnl)).limit(20),worst:await Fr.select().from(Qn).orderBy(i(Qn.pnl)).limit(20)}}function um(e){const t=/* @__PURE__ */new Map;for(const r of e){const e=Number(r.cash_pnl||r.cashPnl||r.realized_pnl||r.realizedPnl||0);if(!e)continue;let n=r.tags||r.market_tags||[];if("string"==typeof n)try{n=JSON.parse(n)}catch{n=[]}for(const r of n){const n=t.get(r)||0;t.set(r,n+e)}}const n=Array.from(t.entries()).map(([e,t])=>({tag:e,pnl:t}));n.sort((e,t)=>t.pnl-e.pnl);return{best:n.slice(0,20),worst:[...n].sort((e,t)=>e.pnl-t.pnl).slice(0,20)}}async function dm(e,t){/* @__PURE__ */
14
- return new Map}const pm=Sf("greeks");function hm(e){return Math.exp(-.5*e*e)/Math.sqrt(2*Math.PI)}function fm(e){const t=Math.max(1e-4,Math.min(.9999,e)),n=[-39.69683028665376,220.9460984245205,-275.9285104469687,138.357751867269,-30.66479806614716,2.506628277459239],r=[-54.47609879822406,161.5858368580409,-155.6989798598866,66.80131188771972,-13.28068155288572],i=[-.007784894002430293,-.3223964580411365,-2.400758277161838,-2.549732539343734,4.374664141464968,2.938163982698783],a=[.007784695709041462,.3224671290700398,2.445134137142996,3.754408661907416],o=.02425;let s,c;return t<o?(s=Math.sqrt(-2*Math.log(t)),(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((a[0]*s+a[1])*s+a[2])*s+a[3])*s+1)):t<=.97575?(s=t-.5,c=s*s,(((((n[0]*c+n[1])*c+n[2])*c+n[3])*c+n[4])*c+n[5])*s/(((((r[0]*c+r[1])*c+r[2])*c+r[3])*c+r[4])*c+1)):(s=Math.sqrt(-2*Math.log(1-t)),-(((((i[0]*s+i[1])*s+i[2])*s+i[3])*s+i[4])*s+i[5])/((((a[0]*s+a[1])*s+a[2])*s+a[3])*s+1))}async function mm(e){const t={query:async(e,t)=>(console.log("Mock query executed:",e),{rows:[]})};try{const n=(await t.query("\n WITH daily_prices AS (\n SELECT\n DATE(timestamp) as date,\n AVG(price) as avg_price\n FROM price_snapshots\n WHERE token_id = $1\n AND timestamp >= NOW() - INTERVAL '7 days'\n GROUP BY DATE(timestamp)\n ORDER BY date\n ),\n returns AS (\n SELECT\n (avg_price - LAG(avg_price) OVER (ORDER BY date)) /\n NULLIF(LAG(avg_price) OVER (ORDER BY date), 0) as daily_return\n FROM daily_prices\n )\n SELECT\n COALESCE(STDDEV(daily_return), 0) as daily_vol,\n COUNT(*) as sample_count\n FROM returns\n WHERE daily_return IS NOT NULL\n ",[e])).rows[0],r=Number(n?.daily_vol)||0,i=Number(n?.sample_count)||0,a=r*Math.sqrt(365);return pm.debug({tokenId:e,dailyVol:r,annualizedVol:a,sampleCount:i},"Calculated historical volatility"),i<3?.5:Math.max(.1,Math.min(3,a))}catch(n){return pm.error({err:n,tokenId:e},"Failed to calculate volatility"),.5}}async function gm(e,t,n){const r=/* @__PURE__ */new Date,i=n?Math.max(0,(n.getTime()-r.getTime())/864e5):365,a=i/365,o=await mm(t),s=function(e,t,n){return t<=0||n<=0?0:-n*hm(fm(e))/(2*Math.sqrt(t))*100/365}(e,a,o),c=function(e,t){return t<=0?0:hm(fm(e))*Math.sqrt(t)}(e,a);var l;return{theta:s,vega:c,impliedVol:o,uncertainty:(l=e)*(1-l),daysToExpiry:i}}const ym={name:"greeks",async enrich(e){const{movement:t}=e;try{const n=await gm(t.priceAfter,t.tokenId,t.market.endDate);return pm.debug({marketId:t.marketId,theta:n.theta.toFixed(3),vega:n.vega.toFixed(3),impliedVol:(100*n.impliedVol).toFixed(1)},"Calculated Greeks"),{...e,enrichments:{...e.enrichments,greeks:n}}}catch(n){return pm.error({err:n,marketId:t.marketId},"Failed to calculate Greeks"),e}}},Im=Sf("detector");async function Cm(){const e=Date.now(),t=await async function(){return{minVolumeUsd:5e4,minDaysToResolution:2,cooldownMinutes:60,alertsPaused:!1,triggers:[{cents:5,minutes:30}],blocklistCategories:[],blocklistKeywords:[]}}();if(t.alertsPaused)return Im.debug("Alerts are paused, skipping detection"),[];const n=[].filter(e=>{if(e.volumeNum<t.minVolumeUsd)return!1;if(e.endDate){if(Math.ceil((e.endDate.getTime()-Date.now())/864e5)<t.minDaysToResolution)return!1}return!vf(e.question,e.category,t.blocklistCategories,t.blocklistKeywords).blocked});if(0===n.length)return[];n.map(e=>e.id);const r=await async function(){/* @__PURE__ */
15
- return new Set}(0,t.cooldownMinutes),i=n.filter(e=>!r.has(e.id));if(0===i.length)return[];const a=[];for(const c of i)c.tokenYes&&a.push(c.tokenYes),c.tokenNo&&a.push(c.tokenNo);const o=[];for(const c of t.triggers){const e=await dm(0,c.minutes);for(const t of i)if(!o.some(e=>e.marketId===t.id)){if(t.tokenYes){const n=e.get(t.tokenYes),r=Sm(t,t.tokenYes,"YES",n,c.cents,c.minutes);if(r){o.push(r);continue}}if(t.tokenNo){const n=e.get(t.tokenNo),r=Sm(t,t.tokenNo,"NO",n,c.cents,c.minutes);r&&o.push(r)}}}const s=Date.now()-e;return o.length>0?Im.info({count:o.length,durationMs:s},"Detected price movements"):Im.debug({marketsChecked:i.length,durationMs:s},"Detection complete, no movements"),o}async function Am(e){return Im.warn({marketId:e},"Market not found in cache"),[]}function Sm(e,t,n,r,i,a){if(!r||null===r.oldest||null===r.latest)return null;const o=100*(r.latest-r.oldest),s=o;return Math.abs(o)>=i?(Im.debug({marketId:e.id,side:n,changeCents:o.toFixed(1),windowMinutes:a,threshold:i},"Movement detected"),{marketId:e.id,market:e,tokenId:t,side:n,priceBefore:r.oldest,priceAfter:r.latest,changePercent:s,timeWindowMinutes:a,detectedAt:/* @__PURE__ */new Date}):null}function bm(e,t){return`${e>=0?"UP":"DOWN"}_${t}m`}async function Tm(e,t={}){const{interval:n="1h",startTs:r,endTs:i,abs:a=!1}=t,o=await Af({market:e,interval:n,startTs:r,endTs:i,abs:a});await Jf(e,o,n);return{pricePoints:o.history?.length||0}}async function vm(e=200,t=!0){try{console.log("Starting Polymarket markets sync...");try{await Fr.delete(Jn)}catch(n){console.error("Failed to clear existing markets:",n.message)}const r=await af(e,"volume24hr");await Ff(r),console.log(`Saved ${r.length} markets`);let i=0;if(t){console.log("Fetching price history for markets...");for(const e of r)if(e.clobTokenIds&&e.clobTokenIds.length>0)try{const t=e.clobTokenIds[0];if(!t||"string"!=typeof t||t.trim().length<10||!/^[a-zA-Z0-9_-]+$/.test(t)){console.log(`Skipping market ${e.id} - Invalid token ID: ${t}`);continue}i+=(await Tm(t,{interval:"1h"})).pricePoints}catch(n){n.message?.includes("400")||n.message?.includes("Invalid token")?console.log(`Skipping market ${e.id} - ${n.message}`):console.error(`Error syncing price history for market ${e.id}:`,n.message)}console.log(`Saved ${i} price data points across all markets`)}return{markets:r.length,pricePoints:i}}catch(n){throw console.error("Fatal error in syncMarkets:",n.message),n}}async function _m(e=0,t=!0){try{console.log("Starting Polymarket all markets sync...");try{await Fr.delete(Jn)}catch(n){console.error("Failed to clear existing markets:",n.message)}const r=await of("volume24hr",e);await Ff(r),console.log(`Saved ${r.length} markets`);let i=0;if(t){console.log("Fetching price history for markets...");for(const e of r)if(e.clobTokenIds&&e.clobTokenIds.length>0)try{const t=e.clobTokenIds[0];if(!t||"string"!=typeof t||t.trim().length<10||!/^[a-zA-Z0-9_-]+$/.test(t)){console.log(`Skipping market ${e.id} - Invalid token ID: ${t}`);continue}i+=(await Tm(t,{interval:"1h"})).pricePoints}catch(n){n.message?.includes("400")||n.message?.includes("Invalid token")?console.log(`Skipping market ${e.id} - ${n.message}`):console.error(`Error syncing price history for market ${e.id}:`,n.message)}console.log(`Saved ${i} price data points across all markets`)}return{markets:r.length,pricePoints:i}}catch(n){throw console.error("Fatal error in syncAllMarkets:",n.message),n}}async function wm(e=1e3,t=!0,n=!0){try{console.log(`Starting incremental Polymarket markets sync (max: ${e})...`);const r=await of("volume24hr",e);await Ff(r),console.log(`Synced ${r.length} markets (upsert)`);let i=0,a=0;if(t&&r.length>0){console.log("Fetching price history for markets...");const e=50;for(let t=0;t<r.length;t+=e){const n=r.slice(t,t+e);await Promise.allSettled(n.map(async e=>{if(e.clobTokenIds&&e.clobTokenIds.length>0)try{const t=e.clobTokenIds[0];if(!t||"string"!=typeof t||t.trim().length<10||!/^[a-zA-Z0-9_-]+$/.test(t))return;const n=await Tm(t,{interval:"1h"});i+=n.pricePoints,a++}catch(t){t.message?.includes("400")||t.message?.includes("Invalid token")||console.error(`Error syncing price history for market ${e.id}:`,t.message)}}));const o=Math.min(t+e,r.length);console.log(`Processed ${o}/${r.length} markets for price history`)}console.log(`Saved ${i} price data points across ${a} markets`)}let o=0,s=0;if(n&&r.length>0){console.log("Fetching top holders for markets...");const e=20;for(let t=0;t<r.length;t+=e){const n=r.slice(t,t+e);await Promise.allSettled(n.map(async e=>{try{let t=e.events&&e.events.length>0?e.events[0].id:null;if(!t){const n=await yf(e.id);n&&n.events&&n.events.length>0&&(t=n.events[0].id)}if(!t)return;const n=await Cf(t);n&&n.holders&&Array.isArray(n.holders)&&(await Wf(e.id,n.holders),o+=n.holders.length,s++)}catch(t){t.message?.includes("400")||t.message?.includes("404")||t.message?.includes("429")||console.error(`Error syncing holders for market ${e.id}:`,t.message)}}));const i=Math.min(t+e,r.length);console.log(`Processed ${i}/${r.length} markets for holders`),t+e<r.length&&await new Promise(e=>setTimeout(e,2e3))}console.log(`Saved ${o} holders across ${s} markets`)}return{markets:r.length,pricePoints:i,priceHistoryUpdates:a,holders:o,holderUpdates:s}}catch(r){throw console.error("Fatal error in syncMarketsIncremental:",r.message),r}}async function Em(e={}){console.log("Starting Polymarket leaderboard sync...");const t=await lf(e);return await Uf(t),console.log(`Saved ${t.length} leaderboard entries`),{leaders:t.length}}async function Pm(){console.log("Starting Polymarket sync...");const e=await uf(50);await xf(e),console.log(`Saved ${e.length} leaders`);const t=[];for(const r of e){const e=r.trader,n=await df(e);await $f(e,n),t.push(...n),console.log(`Saved positions for trader ${e}`)}const n=um(t);return await cm([...n.best,...n.worst]),console.log(`Saved ${n.best.length+n.worst.length} categories`),{leaders:e.length,positions:t.length}}async function Rm(e,t){let n=t;if(!n){const t=await yf(e);t&&t.events&&t.events.length>0&&(n=t.events[0].id)}if(!n)return console.warn(`Could not determine event ID for market ${e}, skipping holders sync.`),{holders:0};try{const t=await Cf(n);return t&&t.holders&&Array.isArray(t.holders)?(await Wf(e,t.holders),{holders:t.holders.length}):{holders:0}}catch(r){return console.error(`Error syncing holders for market ${e}:`,r),{holders:0}}}async function Lm(){console.log("Starting full Polymarket sync...");const e=await vm(),t=await Em({limit:100,orderBy:"VOL"}),n=await Pm();return{markets:e.markets,leaderboard:t.leaders,leaders:n.leaders,positions:n.positions}}async function Nm(e,t={}){const{timePeriod:n="all",orderBy:r="VOL"}=t,i=[];let a=0;for(;i.length<e;){const t=await lf({timePeriod:n,orderBy:r,limit:Math.min(100,e-i.length),offset:a});if(!Array.isArray(t)||0===t.length)break;i.push(...t),a+=100,await new Promise(e=>setTimeout(e,100))}return i.length>0&&await Uf(i),i.map(e=>e.trader||e.proxyWallet||e.proxy_wallet||e.address||e.user).filter(Boolean).slice(0,e)}async function Om(e,t={}){await em(e,{syncStatus:"in_progress"});try{let n=t.sinceTimestamp;if(!n){const t=await am(e);t&&(n=t+1)}const r=await ff(e,{type:["TRADE"],start:n},t.onProgress),i=await Zf(e,r),a=await tm(e),o=(a?.totalTradesSynced||0)+i;return await em(e,{syncStatus:"completed",totalTradesSynced:o,lastSyncedTimestamp:/* @__PURE__ */new Date,errorMessage:null}),i}catch(n){const t=n instanceof Error?n.message:String(n);throw await em(e,{syncStatus:"error",errorMessage:t}),n}}async function Bm(e={}){const{limit:t=1e3,timePeriod:n="all",orderBy:r="VOL",batchSize:i=10,batchDelay:a=1e3,traderDelay:o=200,sinceTimestamp:s,skipRecentlysynced:c=24,onProgress:l}=e,u=Date.now(),d={tradersProcessed:0,tradersSkipped:0,tradersFailed:0,totalTradesSynced:0,duration:0,errors:[]};console.log(`Starting trade history sync for top ${t} traders...`),l?.({currentTrader:0,totalTraders:t,currentTraderAddress:"",tradesFetched:0,status:"fetching_leaderboard"});const p=await Nm(t,{timePeriod:n,orderBy:r});if(console.log(`Fetched ${p.length} traders from leaderboard`),0===p.length)return console.warn("No traders found in leaderboard"),d.duration=Date.now()-u,d;const h=Date.now()-60*c*60*1e3;for(const m of p){await tm(m)||await em(m,{syncStatus:"pending"})}for(let m=0;m<p.length;m+=i){const e=p.slice(m,m+i);for(let t=0;t<e.length;t++){const n=e[t],r=m+t,i=await tm(n);if("completed"===i?.syncStatus&&i.lastSyncAttempt&&i.lastSyncAttempt.getTime()>h)console.log(`Skipping ${n} - synced within last ${c} hours`),d.tradersSkipped++;else{l?.({currentTrader:r+1,totalTraders:p.length,currentTraderAddress:n,tradesFetched:0,status:"syncing_trader"});try{console.log(`[${r+1}/${p.length}] Syncing trades for ${n}...`);const e=await Om(n,{sinceTimestamp:s,onProgress:e=>{l?.({currentTrader:r+1,totalTraders:p.length,currentTraderAddress:n,tradesFetched:e,status:"syncing_trader"})}});d.tradersProcessed++,d.totalTradesSynced+=e,console.log(` -> Synced ${e} trades for ${n}`)}catch(f){const e=f instanceof Error?f.message:String(f);console.error(` -> Error syncing ${n}: ${e}`),d.tradersFailed++,d.errors.push({traderId:n,error:e})}t<e.length-1&&await new Promise(e=>setTimeout(e,o))}}m+i<p.length&&(console.log(`Batch complete. Waiting ${a}ms before next batch...`),await new Promise(e=>setTimeout(e,a)))}return d.duration=Date.now()-u,l?.({currentTrader:p.length,totalTraders:p.length,currentTraderAddress:"",tradesFetched:d.totalTradesSynced,status:"completed"}),console.log(`\nTrade history sync completed in ${d.duration}ms`),console.log(` Traders processed: ${d.tradersProcessed}`),console.log(` Traders skipped: ${d.tradersSkipped}`),console.log(` Traders failed: ${d.tradersFailed}`),console.log(` Total trades synced: ${d.totalTradesSynced}`),d}async function Mm(e={}){const t=await om();return console.log("Current sync status:"),console.log(` Pending: ${t.pending}`),console.log(` In Progress: ${t.in_progress}`),console.log(` Completed: ${t.completed}`),console.log(` Error: ${t.error}`),Bm({...e,limit:e.limit||t.pending+t.error+t.in_progress,skipRecentlysynced:0})}async function Dm(){return om()}const Fm=Wi.join(process.cwd(),"lib/algo-stategies/algo-strategies.json");async function km(e=1,t=""){const n=t?`&sort=${t}`:"",r=1===e?`https://www.tradingview.com/scripts/?component-data-only=1&script_type=strategies${n}`:`https://www.tradingview.com/scripts/page-${e}/?component-data-only=1&script_type=strategies${n}`,i=(await d.get(r,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9",Accept:"application/json"}})).data;return(i?.data?.ideas?.data?.items||[]).map(e=>{const t=e.user?.username||null,n=e.chart_url||`https://www.tradingview.com/script/${e.image_url}/`,r=e.likes_count||0;e.comments_count;const i=e.image_url||null;return e.symbol&&(e.symbol.short_name,e.symbol.exchange,e.symbol.logo_urls&&e.symbol.logo_urls[0]),{url:n.split("script/")[1].replace(/\/$/,""),name:e.name||null,description:e.description||null,image_url:i,author:t,likes:r,type:e.script_type||null}})}async function Gm(e,t){if(t[e.url]&&t[e.url].source)return console.log(`Using cached data for ${e.url}`),t[e.url];try{const n=`https://www.tradingview.com/script/${e.url}`,r=await d.get(n,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9"}}),i=r.data.match(/"script_id_part"\s*:\s*"([^"]+)"(?:[^}]+?"version_maj"\s*:\s*(\d+))?/);if(!i)return console.log(`No script_id_part found for ${e.url}`),e;const a=i[1],o=i[2]?Number(i[2]):3,s=`https://pine-facade.tradingview.com/pine-facade/get/${encodeURIComponent(a)}/${o}?no_4xx=true`;console.log(`Fetching pine-facade for ${e.url} -> ${a} (version_maj=${o})`);const c=(await d.get(s,{headers:{"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0 Safari/537.36","Accept-Language":"en-US,en;q=0.9"}})).data;let{created:l,updated:u,source:p}=c;l=new Date(l).toISOString().split("T")[0],u=new Date(u).toISOString().split("T")[0];const h={...e,updated:u,source:p};return t[e.url]=h,console.log(`Enriched ${e.url}`),h}catch(n){return console.log(`Error enriching ${e.url}: ${n.message}`),e}}(async function(){const e=function(){if(!Wi.existsSync(Fm))return{};try{const e=JSON.parse(Wi.readFileSync(Fm,"utf8")),t={};return Array.isArray(e)&&e.forEach(e=>{e.url&&(t[e.url]=e)}),t}catch{return{}}}(),t=process.argv.slice(2),n=t.find(e=>e.startsWith("--sort=")),r=n?n.split("=")[1]:"",i="recent"===r?"recent_extended":r,a=t.find(e=>e.startsWith("--pages=")),o=a?parseInt(a.split("=")[1],10):1,s=Array.from({length:o},(e,t)=>t+1),c=[];console.log(`Fetching TradingView scripts${i?` (sorted by: ${i})`:""}...`);for(const d of s){console.log(`Fetching page ${d}...`);const e=await km(d,i);c.push(...e)}console.log(`\nEnriching ${c.length} scripts with Pine Script source code...\n`);const l=[];for(const d of c){const t=await Gm(d,e);l.push(t),e[t.url]=t}Wi.writeFileSync(Fm,JSON.stringify(l,null,2),"utf8"),console.log(`\nDone! Total items: ${l.length}`),console.log(`Output saved to: ${Fm}`);const u=l.filter(e=>e.source).length;console.log(`Scripts with source code: ${u}/${l.length}`)})().catch(e=>{console.error(e),process.exit(1)});const Hm={reset:[0,"000000"],black:[30,"1f2937"],red:[31,"dc2626"],green:[32,"2d6a4f"],yellow:[33,"92400e"],blue:[34,"1a56db"],magenta:[35,"6d28d9"],cyan:[36,"0e7490"],white:[37,"374151"],gray:[90,"6b7280"],brightRed:[91,"ef4444"],brightGreen:[92,"059669"],brightYellow:[93,"d97706"],brightBlue:[94,"3b82f6"],brightMagenta:[95,"8b5cf6"],brightCyan:[96,"06b6d4"],brightWhite:[97,"f9fafb"],bgBlack:[40,"111827"],bgRed:[41,"fca5a5"],bgGreen:[42,"a7f3d0"],bgYellow:[43,"fde68a"],bgBlue:[44,"bfdbfe"],bgMagenta:[45,"ddd6fe"],bgCyan:[46,"a5f3fc"],bgWhite:[47,"f9fafb"],bgGray:[100,"d1d5db"],bgBrightRed:[101,"fee2e2"],bgBrightGreen:[102,"d1fae5"],bgBrightYellow:[103,"fef3c7"],bgBrightBlue:[104,"dbeafe"],bgBrightMagenta:[105,"ede9fe"],bgBrightCyan:[106,"cffafe"],bgBrightWhite:[107,"ffffff"]};function xm(e="ansi"){const t={};for(const[n,[r,i]]of Object.entries(Hm))t[n]="html"===e?"reset"===n?"</span>":`<span style="color:#${i}">`:"["+r+"m";return t}function Um(e,t="ansi"){const n=xm(t);return"string"==typeof e?n.yellow:"number"==typeof e?n.cyan:"boolean"==typeof e?n.magenta:"function"==typeof e?n.red:null===e?n.gray:Array.isArray(e)?n.blue:"object"==typeof e?n.green:n.white}function Vm(e){return"string"==typeof e?'""':"number"==typeof e?"number":"boolean"==typeof e?"bool":"function"==typeof e?"function":null===e?"null":Array.isArray(e)?e.length?"["+Vm(e[0])+"]":"[]":"object"==typeof e?"{...}":typeof e}function $m(e,t=0,n="ansi"){const r=xm(n),i="html"===n,a=" ".repeat(t);if("object"!=typeof e||null===e)return Um(e,n)+Vm(e)+r.reset;if(Array.isArray(e)){if(i){let i=[];return e.length&&(i=e.every(t=>typeof t==typeof e[0])?[$m(e[0],t+1,n)]:e.map(e=>$m(e,t+1,n))),`<details open><summary style="cursor:pointer;display:inline">${r.blue}[${r.reset}&thinsp;${e.length} × ${Vm(e[0]??void 0)}&thinsp;${r.blue}]${r.reset}</summary>${i.map(e=>`<div style="margin-left:1.5em">${e}</div>`).join("")}</details>`}let o=r.blue+"["+r.reset;return e.length&&(o+="\n"),e.every(t=>typeof t==typeof e[0])?o+=a+" "+$m(e[0],t+1,n)+",\n":e.forEach((r,i)=>{o+=a+" "+$m(r,t+1,n),i<e.length-1&&(o+=","),o+="\n"}),o+=a+r.blue+"]"+r.reset,o}const o=Object.keys(e);if(i){const i=o.slice(0,4).join(", ")+(o.length>4?"…":"");return`<details open><summary style="cursor:pointer">${r.green}{${r.reset}&nbsp;${i}&nbsp;${r.green}}${r.reset}</summary>${o.map(i=>{const a=e[i],o=Um(a,n);return"object"==typeof a&&null!==a?`<div style="margin-left:1.5em">${o}${i}${r.reset}: ${$m(a,t+1,n)}</div>`:`<div style="margin-left:1.5em">${o}${i}: ${Vm(a)}${r.reset}</div>`}).join("")}</details>`}let s=r.green+"{"+r.reset;return o.length&&(s+="\n"),o.forEach((i,c)=>{const l=e[i],u=Um(l,n);s+=a+" ",s+="object"==typeof l&&null!==l?u+i+r.reset+": "+$m(l,t+1,n):u+i+": "+Vm(l)+r.reset,c<o.length-1&&(s+=","),s+="\n"}),s+=a+r.green+"}"+r.reset,s}function jm(e="",t={}){let{color:n,style:r="color:rgb(54, 165, 220); font-size: 10pt;",hideInProduction:i,startSpinner:a=!1,stopSpinner:o=!1}=t;const s=xm();void 0===i&&(i="undefined"!=typeof window&&window?.location.hostname.includes("localhost")),"object"==typeof e&&(e=$m(e)+"\n\n"+JSON.stringify(e,null,2)),Array.isArray(n)&&1==n.length&&(n=n[0]),n&&"undefined"!=typeof process&&("string"==typeof e&&e.includes("%c")&&Array.isArray(n)?e=e.replace(/%c/g,(e,t)=>s[n[t]]||""):n&&"string"==typeof n&&(e=(s[n]||"")+e+s.reset));var c=0;return a?globalThis.interval=setInterval(()=>{process.stdout.write((Array.isArray(n)?s[n[0]]:s[n]||"")+"\r"+"⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏".split("")[c=++c%10]+" "+e+s.reset)},50):o?(clearInterval(globalThis.interval),process.stdout.write("\r"+(e||" ")+" ".repeat("string"==typeof e?e.length+20:40)+"\n")):"string"==typeof r?(1==r.split(" ").length||n?r=`color: ${n||r}; font-size: 11pt;`:r.match(/^#[0-9a-fA-F]{6}$/)&&(r=`color: ${r}; font-size: 11pt;`),i?console.debug((r?"%c":"")+(e||""),r):console.log((r?"%c":"")+(e||""),r)):"object"==typeof r&&console.log(e,...r),!0}function Wm(e){if("undefined"==typeof document)return;let t,n=document.getElementById("alert-overlay");if(!n){n=document.body.appendChild(document.createElement("div")),n.id="alert-overlay",n.setAttribute("style","position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,0.5);display:flex;align-items:center;justify-content:center"),n.innerHTML='<div id="alert-box" style="background:#fff;padding:1.5em 2em;border-radius:8px;box-shadow:0 2px 16px #0003;min-width:320px;max-width:90vw;max-height:80vh;position:relative;display:flex;flex-direction:column;">\n <button id="close-alert" style="position:absolute;top:12px;right:20px;font-size:1.5em;background:none;border:none;cursor:pointer;color:black;">&times;</button>\n <div id="alert-list" style="overflow:auto;flex:1;font-family:monospace;font-size:13px;"></div>\n </div>',n.addEventListener("click",e=>e.target==n&&n.remove());const e=document.getElementById("close-alert");e&&(e.onclick=()=>n.remove())}t=document.getElementById("alert-list"),t.innerHTML+=`<div style="border-bottom:1px solid #e5e7eb;margin:0.5em 0;padding-bottom:0.5em">${e}</div>`}function Xm(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function Km(e){const{extract:t}=await(import("./archiver-web.es-BFiwoAqn.js")),n=await t({archiveBuffer:e}),r={};for(const i of n)r[i.path]=i.content;return r}async function Ym(e,t){const{parseHTML:n}=await(import("./index-CLlAnStL-C554ZmGF.js")),{document:r}=n(e);if(!t||!0===t)return r;const i=r.querySelector(t);return i?i.innerHTML??i.textContent:null}const qm=(Jm=async function(e,t,n,r,i,a,o,s){const c="undefined"!=typeof window?window.grab:globalThis.grab,l=c?.mock?.[t],u=JSON.stringify(i);if(l&&(!l.method||l.method===r.method)&&(!l.params||u===JSON.stringify(l.params)))return await(e=>new Promise(t=>setTimeout(t,1e3*e||0)))(l.delay||0),"function"==typeof l.response?l.response(i):l.response;const d=await fetch(e+t+n,r).catch(e=>{throw new Error(e.message)});if(!d.ok)throw new Error(`HTTP error: ${d.status} ${d.statusText}`);if(a)return await a(d.body),null;const p=d.headers.get("content-type")??"",h=!1!==o&&(p.includes("application/zip")||p.includes("application/x-zip")),f=!1!==s&&("string"==typeof s||p.includes("text/html"));if(h){const e=await d.arrayBuffer().catch(e=>{throw new Error("Error reading zip: "+e)});return{data:await Km(e)}}if(f){const e=await d.text().catch(e=>{throw new Error("Error reading html: "+e)});return{data:await Ym(e,"string"!=typeof s||s)}}return await(p.includes("application/json")?d.json():p.includes("application/pdf")||p.includes("application/octet-stream")?d.blob():p?d.text():d.json()).catch(e=>{throw new Error("Error parsing response: "+e)})},async function e(t,n){const r=(i=n,{..."undefined"!=typeof window?window?.grab?.defaults:globalThis?.grab?.defaults||{},...i});var i;let{headers:a,response:o,method:s=(r.post?"POST":r.put?"PUT":r.patch?"PATCH":"GET"),cache:c,timeout:l=30,baseURL:u="undefined"!=typeof process&&process.env.SERVER_API_URL||"/api/",cancelOngoingIfNew:d,cancelNewIfOngoing:p,rateLimit:h,debug:f,infiniteScroll:m,logger:g=jm,onRequest:y,onResponse:I,onError:C,onStream:A,unzip:S,dom:b,body:T,post:v,put:_,patch:w,...E}=r;const P=((e,t)=>{let n=e=>t?.startsWith(e)||!1,r=e,i=t;return t?.startsWith("http:")||t?.startsWith("https:")?r="":n("/")||r.endsWith("/")?n("/")&&r.endsWith("/")&&(i=t.slice(1)):i="/"+t,{baseURL:r,path:i}})(u,t);u=P.baseURL,t=P.path;const R=/* @__PURE__ */function(e){const t="function"==typeof e?e:null;return{response:!e||t?{}:e,resFunction:t}}(o);let L=R.response,N=R.resFunction;const O="undefined"!=typeof window?window.grab:globalThis.grab,B=O?.log||[];N?L=N({...L,isLoading:!0}):"object"==typeof L&&(L.isLoading=!0);try{const i=await async function(e,t,n,r){const{debounce:i=0,repeat:a=0,repeatEvery:o=null,setDefaults:s=!1}=n;if(i>0){const a=await(async(e,t)=>{let n;return async function(...r){clearTimeout(n),n=setTimeout(async()=>{clearTimeout(n),await e(...r)},t)}})(async()=>{await r(e,{...t,debounce:0})},1e3*i);return await a(),n.response||{}}if(a>1){for(let n=0;n<a;n++)await r(e,{...t,repeat:0});return n.response||{}}if(o)return setInterval(async()=>{await r(e,{...t,repeat:0,repeatEvery:null})},1e3*o),n.response||{};if(s){const e="undefined"!=typeof window?window.grab:globalThis.grab;return e&&(e.defaults={...t,setDefaults:void 0}),n.response||{}}return null}(t,n||{},r,e);if(i)return i;!function(e,t,n,r){if("undefined"==typeof window)return;const{regrabOnStale:i,regrabOnFocus:a,regrabOnNetwork:o,cache:s,cacheForTime:c=60}=n,l=async()=>await r(e,{...t,cache:!1});i&&s&&setTimeout(l,1e3*c),o&&window.addEventListener("online",l),a&&(window.addEventListener("focus",l),document.addEventListener("visibilitychange",async()=>{"visible"===document.visibilityState&&await l()}))}(t,n||{},r,e);let{params:o,priorRequest:C,response:v,paramsAsText:_}=function(e,t,n,r,i,a){const{cache:o,cacheForTime:s,infiniteScroll:c}=n,[l,u]=c||[],d=JSON.stringify(l?{...t,[l]:void 0}:t);let p=a.find(t=>t.request===d&&t.path===e);if(l){let e=(p?.currentPage||0)+1||t?.[l]||1;p?p.currentPage=e:(r[u]=[],e=1),t={...t,[l]:e}}else{for(let e of Object.keys(r))r[e]=void 0;if(o&&p?.response&&(!s||p.lastFetchTime>Date.now()-1e3*s)){for(let e of Object.keys(p.response))r[e]=p.response[e];i&&(r=i(r))}}return{params:t,priorRequest:p,response:r,paramsAsText:d}}(t,E,r,L,N,B);if(E=o,L=v,function(e,t,n,r,i){if("undefined"==typeof window||!n?.length)return;const[a,,o]=n;if(void 0===o)return;let s="string"==typeof o?document.querySelector(o):o;s?(window.scrollListener&&"function"==typeof s.removeEventListener&&s.removeEventListener("scroll",window.scrollListener),window.scrollListener=n=>{const s=n.target;localStorage.setItem("scroll",JSON.stringify([s.scrollTop,s.scrollLeft,o])),s.scrollHeight-s.scrollTop<=s.clientHeight+200&&i(e,{...t,cache:!1,[a]:(r?.currentPage||0)+1})},s.addEventListener("scroll",window.scrollListener)):jm("paginateDOM not found",{color:"red"})}(t,n,m,C,e),h>0&&C?.lastFetchTime>Date.now()-1e3*h)throw new Error(`Fetch rate limit exceeded for ${t}. Wait ${h}s between requests.`);if(C?.controller)if(d)C.controller.abort();else if(p)return{isLoading:!0};const w=new AbortController;let P=w.signal;d||"function"!=typeof AbortSignal.timeout||(P=AbortSignal.timeout(1e3*l)),B.unshift({path:t,request:_,lastFetchTime:Date.now(),controller:w});let{fetchParams:R,paramsGETRequest:O}=function(e,t,n,r,i,a){const o=["POST","PUT","PATCH"].includes(e),s={method:e,headers:{"Content-Type":"application/json",Accept:"application/json",...t},body:n||(o?JSON.stringify(r):null),redirect:"follow",cache:i?"force-cache":"no-store",signal:a};let c="";return o||(c=(Object.keys(r).length?"?":"")+new URLSearchParams(r).toString()),{fetchParams:s,paramsGETRequest:c}}(s,a,T,E,!!c,P);if("function"==typeof y){const e=y(t,L,E,R);Array.isArray(e)&&([t,L,E,R]=e)}const M=/* @__PURE__ */new Date,D=await Jm(u,t,O,R,E,A,S,b);if(N?L=N({...L,isLoading:void 0}):"object"==typeof L&&delete L.isLoading,"function"==typeof I){const e=I(t,L,E,R);Array.isArray(e)&&([t,L,E,R]=e)}const F=((Number(/* @__PURE__ */new Date)-Number(M))/1e3).toFixed(1);f&&g(`Path:${u+t+O}\n${JSON.stringify(n,null,2)}\nTime: ${F}s\nResponse: ${$m(D)}`);const[,k]=m||[];return L=function(e,t,n,r){if("object"==typeof e&&null!==e){for(let n of Object.keys(e))t[n]=r===n&&Array.isArray(t[n])?[...t[n],...e[n]]:e[n];t.data=e}else n?t=n({data:e,...e}):"object"==typeof t&&(t.data=e);return t}(D,L,N,k),B[0]&&(B[0].response=L),N&&(L=N(L)),L}catch(M){if("function"==typeof C&&C(M.message,u+t,E),r.retryAttempts&&r.retryAttempts>0)return await e(t,{...n,retryAttempts:--r.retryAttempts});!M.message.includes("signal")&&f&&(g(`Error: ${M.message}\nPath:${u+t}\n`,{color:"red"}),"undefined"!=typeof document&&Wm(M.message)),L=L||{},L.error=M.message;const i="function"==typeof o?o:null;return i?(L.data=i({isLoading:void 0,error:M.message}),L=L.data):delete L.isLoading,L}}),Qm=qm;var Jm;Qm.instance=(e={})=>(t,n={})=>qm(t,{...e,...n}),Qm.log=[],Qm.mock={},Qm.defaults={},"undefined"!=typeof window?(window.log=jm,window.grab=Qm,"undefined"!=typeof document&&document.addEventListener("keydown",e=>{const t=window.grab;if(t&&t.log&&"i"===e.key&&e.ctrlKey&&e.altKey){let e="";for(const n of t.log){const t=new Date(n.lastFetchTime).toLocaleString(),r=$m(n.request,0,"html"),i=$m(n.response,0,"html"),a=Xm(JSON.stringify(n.response,null,2));e+=`\n <details open style="margin-bottom:0.75em">\n <summary style="cursor:pointer;font-weight:bold;padding:4px 0;list-style:none;display:flex;justify-content:space-between">\n <span style="color:#1a56db">${Xm(n.path)}</span>\n <span style="color:#6b7280;font-weight:normal;margin-left:1em">${t}</span>\n </summary>\n <div style="padding-left:1em;margin-top:0.5em">\n <details style="margin-bottom:0.4em">\n <summary style="cursor:pointer;color:#6b7280;font-size:0.9em">Request</summary>\n <div style="padding:0.4em 0 0 1em">${r}</div>\n </details>\n <details open style="margin-bottom:0.4em">\n <summary style="cursor:pointer;color:#6b7280;font-size:0.9em">Response (structure)</summary>\n <div style="padding:0.4em 0 0 1em">${i}</div>\n </details>\n <details style="margin-bottom:0.4em">\n <summary style="cursor:pointer;color:#6b7280;font-size:0.9em">Response (data)</summary>\n <pre style="margin:0.4em 0 0 1em;padding:0.5em;background:#f9fafb;border:1px solid #e5e7eb;border-radius:4px;overflow:auto;max-height:300px;font-size:12px">${a}</pre>\n </details>\n </div>\n </details>`}Wm(e||"<em>No requests logged yet.</em>")}}),document.addEventListener("DOMContentLoaded",()=>{try{const e=localStorage.getItem("scroll");if(!e)return;const[t,n,r]=JSON.parse(e);if(!t||!r)return;const i=document.querySelector(r);i&&(i.scrollTop=t,i.scrollLeft=n)}catch(e){console.warn("Failed to restore scroll position",e)}})):"undefined"!=typeof globalThis&&(globalThis.log=jm,globalThis.grab=Qm);const zm="./data/leaders.json";const Zm=new class{api;constructor(){this.api=Qm.instance({baseURL:"https://db.nvstly.com/api",post:!0,compress:!1})}getTraderRankings=async(e="1mo",t=100)=>{try{const n=await this.api("/market/ranks",{time:e,engines:["stocks"],limit:t});if(console.log(`NVSTLY API Response: Fetched ${n?.data?.data?.length||0} traders`),!n?.data?.data)return console.error("Invalid response from NVSTLY API:",n),[];const r=n.data.data.map(e=>({id:e.id,name:e.name,rank:e.rank,rep:e.rep,trades:e.trades,winRate:Math.floor(e.winRate),totalGain:Math.floor(e.totalGain),avgReturn:Math.floor(e.avgReturn)}));return console.log(`Successfully parsed ${r.length} traders from NVSTLY API`),r}catch(n){return console.error("Error fetching trader rankings:",n),[]}};getTraderTrades=async(e,t="1mo")=>{try{const n=await this.api("/accounts/trades",{id:e,filter:{frame:t,engines:["options","stocks","crypto","forex"]}});return n?.data?.data?n.data.data.map(e=>({symbol:e.symbol,type:"short"==e.type?"short":e.closed?"sell":"buy",time:new Date(e.lastModified).toISOString(),price:Number(e.price.toFixed(2)),...("short"==e.type||e.closed)&&{previousPrice:Number(e.previousEntryPrice.toFixed(2))},...e.closed&&{gain:Math.floor(e.gain)}})):(console.warn(`No trades data for trader ${e}`),[])}catch(n){return console.error(`Error fetching trades for trader ${e}:`,n),[]}}};async function eg(){console.log("Starting NVSTLY sync - fetching all available leaders...");const e=await Zm.getTraderRankings("1mo",100);if(!e||0===e.length)return console.log("Warning: No traders found from NVSTLY API"),[];console.log(`Found ${e.length} NVSTLY traders to process`);for(let r=0;r<e.length;r++){const i=e[r],a=i.id;console.log(`Processing trader ${r+1}/${e.length}: ${i.name} (Rank #${i.rank})`);try{const n=await Zm.getTraderTrades(a);e[r].orders=n,console.log(` ✓ Fetched ${n.length} trades for ${i.name}`),await Fr.insert(ir).values({id:i.id,name:i.name,rank:i.rank,rep:i.rep,trades:i.trades,winRate:i.winRate,totalGain:i.totalGain,avgReturn:i.avgReturn,broker:i.broker||null,updatedAt:/* @__PURE__ */new Date}).onConflictDoUpdate({target:ir.id,set:{name:i.name,rank:i.rank,rep:i.rep,trades:i.trades,winRate:i.winRate,totalGain:i.totalGain,avgReturn:i.avgReturn,broker:i.broker||null,updatedAt:/* @__PURE__ */new Date}}),await Fr.delete(ar).where(t(ar.traderId,i.id)),n.length>0&&await Fr.insert(ar).values(n.map((e,t)=>({id:`${i.id}-${e.symbol}-${e.time}-${t}`,traderId:i.id,symbol:e.symbol,type:e.type,price:e.price,previousPrice:e.previousPrice||null,gain:e.gain||null,time:new Date(e.time),createdAt:/* @__PURE__ */new Date}))),console.log(` ✓ Saved ${i.name} to database`)}catch(n){console.error(` ✗ Error processing trader ${i.name}:`,n),e[r].orders=[]}r<e.length-1&&await new Promise(e=>setTimeout(e,1e3))}try{await Wi.writeFile(zm,JSON.stringify(e,null,2)),console.log(`✓ Saved ${e.length} traders to ${zm}`)}catch(n){console.error("Error saving to JSON file:",n)}return console.log(`\n✓ Successfully synced ${e.length} NVSTLY traders to database`),e}async function tg(){const e=await fetch("https://www.zulutrade.com/zulutrade-gateway/api/providers/performance/topTraders/75932/search?flavorId=1&accessingFlavorId=1",{headers:{accept:"application/json, text/plain, */*","accept-language":"en-US,en;q=0.9","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"}});if(!e.ok)throw new Error(`Zulu fetch failed: ${e.status}`);return(await e.json()).result||[]}async function ng(e){const t=await fetch(`https://www.zulutrade.com/zulutrade-gateway/v2/api/providers/${e}/thi/init?accessingFlavorId=1&flavor=global`,{headers:{accept:"application/json","accept-language":"en-US,en;q=0.9","content-type":"application/json","sec-fetch-dest":"empty","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"}});if(!t.ok)throw new Error(`Zulu trader detail fetch failed: ${t.status}`);return await t.json()}async function rg(e){const t=Date.now();for(const n of e){const e=n.trader,r=e.profile,i=e.overallStats,a=i.timeframeStats||{},o=Object.values(a)[0]||{};await Fr.insert(or).values({providerId:e.providerId,name:r.name,strategyDesc:r.strategyDesc||null,countryCode:r.countryIsoCode,countryName:r.countryName,brokerName:r.brokerName,balance:i.balance||0,equity:i.equity||0,followers:i.followers||0,liveFollowers:i.liveFollowers||0,roiAnnualized:i.roiAnnualized||0,roiProfit:i.roiProfit||0,zuluRank:i.zuluRank||0,bestTrade:i.bestTrade||0,worstTrade:i.worstTrade||0,profitableTrades:i.profitableTrades||0,losingTrades:i.losingTrades||0,avgDrawdown:i.avgDrawdown||0,maxDrawdown:i.overallDrawDownInMoney||0,maxDrawdownPercent:o.maxDrawDownPercent||0,leverage:r.leverage||0,isEa:e.badges?.ea?1:0,currencies:i.providerCurrencies||"",weeks:i.weeks||0,demo:r.demo?1:0,avgTradeSeconds:o.avgTradeSeconds||0,avgPnlPerTrade:o.avgPnlPerTrade||0,winRate:o.winTrades||0,totalTrades:o.trades||0,pageVisits:r.pageVisits||0,includedInWatchlist:i.includedInWatchlist||0,registrationDate:r.registrationDate?new Date(r.registrationDate):null,lastOpenTradeDate:i.lastOpenTradeDate?new Date(i.lastOpenTradeDate):null,updatedAt:new Date(t)}).onConflictDoUpdate({target:or.providerId,set:{name:r.name,strategyDesc:r.strategyDesc||null,countryCode:r.countryIsoCode,countryName:r.countryName,brokerName:r.brokerName,balance:i.balance||0,equity:i.equity||0,followers:i.followers||0,liveFollowers:i.liveFollowers||0,roiAnnualized:i.roiAnnualized||0,roiProfit:i.roiProfit||0,zuluRank:i.zuluRank||0,bestTrade:i.bestTrade||0,worstTrade:i.worstTrade||0,profitableTrades:i.profitableTrades||0,losingTrades:i.losingTrades||0,avgDrawdown:i.avgDrawdown||0,maxDrawdown:i.overallDrawDownInMoney||0,maxDrawdownPercent:o.maxDrawDownPercent||0,leverage:r.leverage||0,isEa:e.badges?.ea?1:0,currencies:i.providerCurrencies||"",weeks:i.weeks||0,demo:r.demo?1:0,avgTradeSeconds:o.avgTradeSeconds||0,avgPnlPerTrade:o.avgPnlPerTrade||0,winRate:o.winTrades||0,totalTrades:o.trades||0,pageVisits:r.pageVisits||0,includedInWatchlist:i.includedInWatchlist||0,registrationDate:r.registrationDate?new Date(r.registrationDate):null,lastOpenTradeDate:i.lastOpenTradeDate?new Date(i.lastOpenTradeDate):null,updatedAt:new Date(t)}}),e.currencyStats&&e.currencyStats.length>0&&await ig(e.providerId,e.currencyStats)}}async function ig(e,t){const n=Date.now();for(const r of t){const t=`${e}-${r.currencyName}`;await Fr.insert(sr).values({id:t,providerId:e,currencyName:r.currencyName,totalCount:r.totalCurrencyCount||0,winCount:r.currencyWinCount||0,winPercent:r.currencyWinPercent||0,totalBuyCount:r.totalCurrencyBuyCount||0,totalSellCount:r.totalCurrencySellCount||0,pips:r.pips||0,createdAt:new Date(n)}).onConflictDoUpdate({target:sr.id,set:{totalCount:r.totalCurrencyCount||0,winCount:r.currencyWinCount||0,winPercent:r.currencyWinPercent||0,totalBuyCount:r.totalCurrencyBuyCount||0,totalSellCount:r.totalCurrencySellCount||0,pips:r.pips||0}})}}async function ag(e=50){return await Fr.select().from(or).orderBy(r(or.roiAnnualized)).limit(e)}async function og(e){const n=await Fr.select().from(or).where(t(or.providerId,e)).limit(1);if(0===n.length)return null;const r=await Fr.select().from(sr).where(t(sr.providerId,e));return{...n[0],currencyStats:r}}async function sg(e=50){return await Fr.select().from(or).orderBy(i(or.zuluRank)).limit(e)}async function cg(e){let n=Fr.select().from(or);return e.minRoi&&(n=n.where(a`${or.roiAnnualized} >= ${e.minRoi}`)),e.minWinRate&&(n=n.where(a`${or.winRate} >= ${e.minWinRate}`)),e.maxDrawdown&&(n=n.where(a`${or.maxDrawdownPercent} <= ${e.maxDrawdown}`)),void 0!==e.isEa&&(n=n.where(t(or.isEa,e.isEa?1:0))),await n.orderBy(r(or.roiAnnualized)).limit(e.limit||50)}async function lg(){console.log("Starting Zulu sync...");const e=await tg();return await rg(e),console.log(`Saved ${e.length} Zulu traders`),{traders:e.length}}async function ug(e){console.log(`Syncing details for ${e.length} traders...`);const t=[];for(const r of e)try{const e=await ng(r);t.push(e),await new Promise(e=>setTimeout(e,500))}catch(n){console.error(`Failed to fetch trader ${r}:`,n.message)}return t.length>0&&await rg(t.map(e=>({trader:e.trader.stats}))),console.log(`Saved ${t.length} trader details`),{details:t.length}}class dg extends Error{response;request;options;constructor(e,t,n){const r=`${e.status||0===e.status?e.status:""} ${e.statusText??""}`.trim();super(`Request failed with ${r?`status code ${r}`:"an unknown error"}: ${t.method} ${t.url}`),this.name="HTTPError",this.response=e,this.request=t,this.options=n}}class pg extends Error{name="NonError";value;constructor(e){let t="Non-error value was thrown";try{"string"==typeof e?t=e:e&&"object"==typeof e&&"message"in e&&"string"==typeof e.message&&(t=e.message)}catch{}super(t),this.value=e}}class hg extends Error{name="ForceRetryError";customDelay;code;customRequest;constructor(e){const t=e?.cause?e.cause instanceof Error?e.cause:new pg(e.cause):void 0;super(e?.code?`Forced retry: ${e.code}`:"Forced retry",t?{cause:t}:void 0),this.customDelay=e?.delay,this.code=e?.code,this.customRequest=e?.request}}const fg=(()=>{let e=!1,t=!1;const n="function"==typeof globalThis.ReadableStream,r="function"==typeof globalThis.Request;if(n&&r)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&"unsupported BodyInit type"===i.message)return!1;throw i}return e&&!t})(),mg="function"==typeof globalThis.AbortController,gg="function"==typeof globalThis.AbortSignal&&"function"==typeof globalThis.AbortSignal.any,yg="function"==typeof globalThis.ReadableStream,Ig="function"==typeof globalThis.FormData,Cg=["get","post","put","patch","head","delete"],Ag={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Sg=2147483647,bg=(new TextEncoder).encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Tg=/* @__PURE__ */Symbol("stop");class vg{options;constructor(e){this.options=e}}const _g=e=>new vg(e),wg={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},Eg={next:!0},Pg={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0},Rg=(e,t,n)=>{let r,i=0;return e.pipeThrough(new TransformStream({transform(e,a){if(a.enqueue(e),r){i+=r.byteLength;let e=0===t?0:i/t;e>=1&&(e=1-Number.EPSILON),n?.({percent:e,totalBytes:Math.max(t,i),transferredBytes:i},r)}r=e},flush(){r&&(i+=r.byteLength,n?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},r))}}))},Lg=(e,t,n)=>{if(!e.body)return e;const r=(e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(const[n,r]of e)t+=bg,t+=(new TextEncoder).encode(`Content-Disposition: form-data; name="${n}"`).length,t+="string"==typeof r?(new TextEncoder).encode(r).length:r.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if("string"==typeof e)return(new TextEncoder).encode(e).length;if(e instanceof URLSearchParams)return(new TextEncoder).encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if("object"==typeof e&&null!==e)try{const t=JSON.stringify(e);return(new TextEncoder).encode(t).length}catch{return 0}return 0})(n??e.body);return new Request(e,{duplex:"half",body:Rg(e.body,r,t)})},Ng=e=>null!==e&&"object"==typeof e,Og=(...e)=>{for(const t of e)if((!Ng(t)||Array.isArray(t))&&void 0!==t)throw new TypeError("The `options` argument must be an object");return kg({},...e)},Bg=(e={},t={})=>{const n=new globalThis.Headers(e),r=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(const[a,o]of i.entries())r&&"undefined"===o||void 0===o?n.delete(a):n.set(a,o);return n};function Mg(e,t,n){return Object.hasOwn(t,n)&&void 0===t[n]?[]:kg(e[n]??[],t[n]??[])}const Dg=(e={},t={})=>({beforeRequest:Mg(e,t,"beforeRequest"),beforeRetry:Mg(e,t,"beforeRetry"),afterResponse:Mg(e,t,"afterResponse"),beforeError:Mg(e,t,"beforeError")}),Fg=(e,t)=>{const n=new URLSearchParams;for(const r of[e,t])if(void 0!==r)if(r instanceof URLSearchParams)for(const[e,t]of r.entries())n.append(e,t);else if(Array.isArray(r))for(const e of r){if(!Array.isArray(e)||2!==e.length)throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");n.append(String(e[0]),String(e[1]))}else if(Ng(r))for(const[e,t]of Object.entries(r))void 0!==t&&n.append(e,String(t));else{const e=new URLSearchParams(r);for(const[t,r]of e.entries())n.append(t,r)}return n},kg=(...e)=>{let t,n={},r={},i={};const a=[];for(const o of e)if(Array.isArray(o))Array.isArray(n)||(n=[]),n=[...n,...o];else if(Ng(o)){for(let[e,r]of Object.entries(o))if("signal"===e&&r instanceof globalThis.AbortSignal)a.push(r);else if("context"!==e)"searchParams"!==e?(Ng(r)&&e in n&&(r=kg(n[e],r)),n={...n,[e]:r}):t=null==r?void 0:void 0===t?r:Fg(t,r);else{if(null!=r&&(!Ng(r)||Array.isArray(r)))throw new TypeError("The `context` option must be an object");n={...n,context:null==r?{}:{...n.context,...r}}}Ng(o.hooks)&&(i=Dg(i,o.hooks),n.hooks=i),Ng(o.headers)&&(r=Bg(r,o.headers),n.headers=r)}return void 0!==t&&(n.searchParams=t),a.length>0&&(1===a.length?n.signal=a[0]:n.signal=gg?AbortSignal.any(a):a.at(-1)),n},Gg=e=>Cg.includes(e)?e.toUpperCase():e,Hg={limit:2,methods:["get","put","head","delete","options","trace"],statusCodes:[408,413,429,500,502,503,504],afterStatusCodes:[413,429,503],maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3,jitter:void 0,retryOnTimeout:!1},xg=(e={})=>{if("number"==typeof e)return{...Hg,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.methods&&=e.methods.map(e=>e.toLowerCase()),e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");const t=Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e));return{...Hg,...t}};class Ug extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}}class Vg{static create(e,t){const n=new Vg(e,t),r=n.#e(async()=>{if("number"==typeof n.#t.timeout&&n.#t.timeout>Sg)throw new RangeError("The `timeout` option cannot be greater than 2147483647");await Promise.resolve();let e=await n.#n();for(const r of n.#t.hooks.afterResponse){const i=n.#r(e.clone());let a;try{a=await r(n.request,n.#i(),i,{retryCount:n.#a})}catch(t){throw n.#o(i),n.#o(e),t}if(a instanceof vg)throw n.#o(i),n.#o(e),new hg(a.options);const o=a instanceof globalThis.Response?a:e;i!==o&&n.#o(i),e!==o&&n.#o(e),e=o}if(n.#r(e),!e.ok&&("function"==typeof n.#t.throwHttpErrors?n.#t.throwHttpErrors(e.status):n.#t.throwHttpErrors)){let t=new dg(e,n.request,n.#i());for(const e of n.#t.hooks.beforeError)t=await e(t,{retryCount:n.#a});throw t}if(n.#t.onDownloadProgress){if("function"!=typeof n.#t.onDownloadProgress)throw new TypeError("The `onDownloadProgress` option must be a function");if(!yg)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");const t=e.clone();return n.#o(e),((e,t)=>{if(!e.body)return e;if(204===e.status)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});const n=Math.max(0,Number(e.headers.get("content-length"))||0);return new Response(Rg(e.body,n,t),{status:e.status,statusText:e.statusText,headers:e.headers})})(t,n.#t.onDownloadProgress)}return e}).finally(()=>{const e=n.#s;n.#c(e?.body??void 0),n.#c(n.request.body??void 0)});for(const[i,a]of Object.entries(Ag))"bytes"===i&&"function"!=typeof globalThis.Response?.prototype?.bytes||(r[i]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||a);const e=await r;if("json"===i){if(204===e.status)return"";const n=await e.text();return""===n?"":t.parseJson?t.parseJson(n):JSON.parse(n)}return e[i]()});return r}static#l(e){return!e||"object"!=typeof e||Array.isArray(e)||e instanceof URLSearchParams?e:Object.fromEntries(Object.entries(e).filter(([,e])=>void 0!==e))}request;#u;#a=0;#d;#t;#s;#p;#h;constructor(e,t={}){if(this.#d=e,this.#t={...t,headers:Bg(this.#d.headers,t.headers),hooks:Dg({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},t.hooks),method:Gg(t.method??this.#d.method??"GET"),prefixUrl:String(t.prefixUrl||""),retry:xg(t.retry),throwHttpErrors:t.throwHttpErrors??!0,timeout:t.timeout??1e4,fetch:t.fetch??globalThis.fetch.bind(globalThis),context:t.context??{}},"string"!=typeof this.#d&&!(this.#d instanceof URL||this.#d instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this.#t.prefixUrl&&"string"==typeof this.#d){if(this.#d.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this.#t.prefixUrl.endsWith("/")||(this.#t.prefixUrl+="/"),this.#d=this.#t.prefixUrl+this.#d}mg&&gg&&(this.#p=this.#t.signal??this.#d.signal,this.#u=new globalThis.AbortController,this.#t.signal=this.#p?AbortSignal.any([this.#p,this.#u.signal]):this.#u.signal),fg&&(this.#t.duplex="half"),void 0!==this.#t.json&&(this.#t.body=this.#t.stringifyJson?.(this.#t.json)??JSON.stringify(this.#t.json),this.#t.headers.set("content-type",this.#t.headers.get("content-type")??"application/json"));const n=t.headers&&new globalThis.Headers(t.headers).has("content-type");if(this.#d instanceof globalThis.Request&&(Ig&&this.#t.body instanceof globalThis.FormData||this.#t.body instanceof URLSearchParams)&&!n&&this.#t.headers.delete("content-type"),this.request=new globalThis.Request(this.#d,this.#t),void 0!==(r=this.#t.searchParams)&&(Array.isArray(r)?r.length>0:r instanceof URLSearchParams?r.size>0:"object"==typeof r?Object.keys(r).length>0:"string"==typeof r?r.trim().length>0:Boolean(r))){const e="?"+("string"==typeof this.#t.searchParams?this.#t.searchParams.replace(/^\?/,""):new URLSearchParams(Vg.#l(this.#t.searchParams)).toString()),t=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,e);this.request=new globalThis.Request(t,this.#t)}var r;if(this.#t.onUploadProgress){if("function"!=typeof this.#t.onUploadProgress)throw new TypeError("The `onUploadProgress` option must be a function");if(!fg)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request=this.#f(this.request,this.#t.body??void 0)}}#m(){const e=this.#t.retry.delay(this.#a);let t=e;!0===this.#t.retry.jitter?t=Math.random()*e:"function"==typeof this.#t.retry.jitter&&(t=this.#t.retry.jitter(e),(!Number.isFinite(t)||t<0)&&(t=e));const n=this.#t.retry.backoffLimit??Number.POSITIVE_INFINITY;return Math.min(n,t)}async#g(e){if(this.#a++,this.#a>this.#t.retry.limit)throw e;const t=e instanceof Error?e:new pg(e);if(t instanceof hg)return t.customDelay??this.#m();if(!this.#t.retry.methods.includes(this.request.method.toLowerCase()))throw e;if(void 0!==this.#t.retry.shouldRetry){const n=await this.#t.retry.shouldRetry({error:t,retryCount:this.#a});if(!1===n)throw e;if(!0===n)return this.#m()}if(function(e){return e instanceof Ug||e?.name===Ug.name}(e)&&!this.#t.retry.retryOnTimeout)throw e;if(function(e){return e instanceof dg||e?.name===dg.name}(e)){if(!this.#t.retry.statusCodes.includes(e.response.status))throw e;const t=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Retry-After")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(t&&this.#t.retry.afterStatusCodes.includes(e.response.status)){let e=1e3*Number(t);Number.isNaN(e)?e=Date.parse(t)-Date.now():e>=Date.parse("2024-01-01")&&(e-=Date.now());const n=this.#t.retry.maxRetryAfter??e;return e<n?e:n}if(413===e.response.status)throw e}return this.#m()}#r(e){return this.#t.parseJson&&(e.json=async()=>this.#t.parseJson(await e.text())),e}#c(e){e&&e.cancel().catch(()=>{})}#o(e){this.#c(e.body??void 0)}async#e(e){try{return await e()}catch(t){const n=Math.min(await this.#g(t),Sg);if(this.#a<1)throw t;if(await async function(e,{signal:t}){return new Promise((n,r)=>{function i(){clearTimeout(a),r(t.reason)}t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));const a=setTimeout(()=>{t?.removeEventListener("abort",i),n()},e)})}(n,this.#p?{signal:this.#p}:{}),t instanceof hg&&t.customRequest){const e=this.#t.signal?new globalThis.Request(t.customRequest,{signal:this.#t.signal}):new globalThis.Request(t.customRequest);this.#y(e)}for(const e of this.#t.hooks.beforeRetry){const n=await e({request:this.request,options:this.#i(),error:t,retryCount:this.#a});if(n instanceof globalThis.Request){this.#y(n);break}if(n instanceof globalThis.Response)return n;if(n===Tg)return}return this.#e(e)}}async#n(){this.#u?.signal.aborted&&(this.#u=new globalThis.AbortController,this.#t.signal=this.#p?AbortSignal.any([this.#p,this.#u.signal]):this.#u.signal,this.request=new globalThis.Request(this.request,{signal:this.#t.signal}));for(const t of this.#t.hooks.beforeRequest){const e=await t(this.request,this.#i(),{retryCount:this.#a});if(e instanceof Response)return e;if(e instanceof globalThis.Request){this.#y(e);break}}const e=((e,t)=>{const n={};for(const r in t)Object.hasOwn(t,r)&&(r in Pg||r in wg||r in e&&!(r in Eg)||(n[r]=t[r]));return n})(this.request,this.#t);return this.#s=this.request,this.request=this.#s.clone(),!1===this.#t.timeout?this.#t.fetch(this.#s,e):async function(e,t,n,r){return new Promise((i,a)=>{const o=setTimeout(()=>{n&&n.abort(),a(new Ug(e))},r.timeout);r.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}(this.#s,e,this.#u,this.#t)}#i(){if(!this.#h){const{hooks:e,...t}=this.#t;this.#h=Object.freeze(t)}return this.#h}#y(e){this.#h=void 0,this.request=this.#f(e)}#f(e,t){return this.#t.onUploadProgress&&e.body?Lg(e,this.#t.onUploadProgress,t??this.#t.body??void 0):e}}const $g=e=>{const t=(t,n)=>Vg.create(t,Og(e,n));for(const n of Cg)t[n]=(t,r)=>Vg.create(t,Og(e,r,{method:n}));return t.create=e=>$g(Og(e)),t.extend=t=>("function"==typeof t&&(t=t(e??{})),$g(Og(e,t))),t.stop=Tg,t.retry=_g,t},jg=$g();function Wg(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>null!=e))}var Xg;(Xg||(Xg={})).API_BASE_URL="https://api.tavily.com";var Kg=class{ky;apiKey;apiBaseUrl;constructor({apiKey:e=process.env.TAVILY_API_KEY,apiBaseUrl:t=Xg.API_BASE_URL,ky:n=jg}={}){if(!e)throw new Error('TavilyClient missing required "apiKey" (defaults to "TAVILY_API_KEY")');this.apiKey=e,this.apiBaseUrl=t,this.ky=n.extend({prefixUrl:this.apiBaseUrl})}async search(e){const t="string"==typeof e?{query:e}:e,n=await this.ky.post("search",{json:{...t,api_key:this.apiKey}}).json();return Wg({...n,results:n.results?.map(Wg)})}};const Yg={"llama3-70b-8192":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"qwen-qwq-32b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama-3.1-8b-instant":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:131072,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama-guard-3-8b":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"deepseek-r1-distill-llama-70b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama3-8b-8192":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"mistral-saba-24b":{maxInputTokens:32768,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"llama-3.3-70b-versatile":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:32768,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"gemma2-9b-it":{maxInputTokens:8192,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"moonshotai/kimi-k2-instruct":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"moonshotai/kimi-k2-instruct-0905":{maxInputTokens:262144,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"qwen/qwen3-32b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:16384,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!1},"meta-llama/llama-4-scout-17b-16e-instruct":{maxInputTokens:131072,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"meta-llama/llama-guard-4-12b":{maxInputTokens:131072,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:1024,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!1,structuredOutput:!1},"meta-llama/llama-4-maverick-17b-128e-instruct":{maxInputTokens:131072,imageInputs:!0,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:8192,reasoningOutput:!1,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"openai/gpt-oss-120b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0},"openai/gpt-oss-20b":{maxInputTokens:131072,imageInputs:!1,audioInputs:!1,pdfInputs:!1,videoInputs:!1,maxOutputTokens:65536,reasoningOutput:!0,imageOutputs:!1,audioOutputs:!1,videoOutputs:!1,toolCalling:!0,structuredOutput:!0}};function qg(e){if(!e||"object"!=typeof e)return e;if("null"===e.type)return e;if(Array.isArray(e.type)&&e.type.includes("null"))return e;if(Array.isArray(e.enum)){const t=e.enum.includes(null)?e.enum:[...e.enum,null],n=Array.isArray(e.type)?e.type.filter(e=>"null"!==e):"string"==typeof e.type?[e.type]:["string"],r=Array.from(/* @__PURE__ */new Set([...n,"null"]));return{...e,type:r,enum:t}}if(Array.isArray(e.anyOf)){if(e.anyOf.some(e=>"null"===e?.type||Array.isArray(e?.type)&&e.type.includes("null")))return e;const t=e.anyOf.map(e=>e?.type).filter(e=>e&&"string"==typeof e);if(t.length===e.anyOf.length){const{anyOf:n,...r}=e;return{...r,type:[...t,"null"]}}return{...e,anyOf:[...e.anyOf,{type:"null"}]}}return"string"==typeof e.type?{...e,type:[e.type,"null"]}:Array.isArray(e.type)?{...e,type:Array.from(/* @__PURE__ */new Set([...e.type,"null"]))}:e.properties?{...e,type:["object","null"]}:e}function Qg(e,t=!0){if(!e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>Qg(e,!1));const n={...e};for(const r of["anyOf","oneOf","allOf"])Array.isArray(n[r])&&(n[r]=n[r].map(e=>Qg(e,!1)));if(n.items&&(n.items=Qg(n.items,!1)),n.$defs){n.$defs={...n.$defs};for(const e of Object.keys(n.$defs))n.$defs[e]=Qg(n.$defs[e],!1)}if(("object"===n.type||Array.isArray(n.type)&&n.type.includes("object")||n.properties)&&n.properties&&"object"==typeof n.properties){n.additionalProperties=!1;const e=Object.keys(n.properties),t=new Set(Array.isArray(n.required)?n.required:[]);n.properties={...n.properties};for(const r of e)n.properties[r]=Qg(n.properties[r],!1),t.has(r)||(n.properties[r]=qg(n.properties[r]));n.required=e}if(t){if(Array.isArray(n.anyOf)){const e=n.anyOf.find(e=>"object"===e?.type||e?.properties);if(e)return{...Qg(e,!0),type:"object"};throw new Error("Groq strict mode requires the root schema to be an object type, but the schema has anyOf/oneOf with no object variant.")}if(n.oneOf)throw new Error("Groq strict mode does not support oneOf at the root schema level.");if(n.not)throw new Error("Groq strict mode does not support 'not' at the root schema level.");n.properties&&(n.type="object")}return n}const Jg=["jsonSchema","functionCalling","jsonMode"];Object.defineProperty;function zg(e,t,n){function r(n,r){var i;Object.defineProperty(n,"_zod",{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=/* @__PURE__ */new Set),n._zod.traits.add(e),t(n,r);for(const e in o.prototype)e in n||Object.defineProperty(n,e,{value:o.prototype[e].bind(n)});n._zod.constr=o,n._zod.def=r}const i=n?.Parent??Object;class a extends i{}function o(e){var t;const i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(const n of i._zod.deferred)n();return i}return Object.defineProperty(a,"name",{value:e}),Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class Zg extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ey={};function ty(e){return ey}function ny(e,t){return"bigint"==typeof t?t.toString():t}const ry=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function iy(e,t,n){const r=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(r._zod.parent=e),r}function ay(e,t=0){for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function oy(e){return"string"==typeof e?e:e?.message}function sy(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const i=oy(e.inst?._zod.def?.error?.(e))??oy(t?.error?.(e))??oy(n.customError?.(e))??oy(n.localeError?.(e))??"Invalid input";r.message=i}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}const cy=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get:()=>JSON.stringify(t,ny,2),enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ly=zg("$ZodError",cy),uy=zg("$ZodError",cy,{Parent:Error}),dy=e=>async(t,n,r,i)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(i?.Err??e)(o.issues.map(e=>sy(e,a,ty())));throw ry(t,i?.callee),t}return o.value},py=/* @__PURE__ */dy(uy),hy=e=>(t,n,r)=>{const i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Zg;return a.issues.length?{success:!1,error:new(e??ly)(a.issues.map(e=>sy(e,i,ty())))}:{success:!0,data:a.value}},fy=/* @__PURE__ */hy(uy),my=e=>async(t,n,r)=>{const i=r?Object.assign(r,{async:!0}):{async:!0};let a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>sy(e,i,ty())))}:{success:!0,data:a.value}},gy=/* @__PURE__ */my(uy),yy={major:4,minor:0,patch:0},Iy=/* @__PURE__ */zg("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=yy;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const t of i._zod.onattach)t(e);if(0===r.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let r,i=ay(e);for(const a of t){if(a._zod.def.when){if(!a._zod.def.when(e))continue}else if(i)continue;const t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new Zg;if(r||o instanceof Promise)r=(r??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(i||(i=ay(e,t)))});else{if(e.issues.length===t)continue;i||(i=ay(e,t))}}return r?r.then(()=>e):e};e._zod.run=(n,i)=>{const a=e._zod.parse(n,i);if(a instanceof Promise){if(!1===i.async)throw new Zg;return a.then(e=>t(e,r,i))}return t(a,r,i)}}e["~standard"]={validate:t=>{try{const n=fy(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return gy(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}}),Cy=/* @__PURE__ */zg("$ZodNever",(e,t)=>{Iy.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});class Ay{constructor(){this._map=/* @__PURE__ */new Map,this._idmap=/* @__PURE__ */new Map}add(e,...t){const n=t[0];if(this._map.set(e,n),n&&"object"==typeof n&&"id"in n){if(this._idmap.has(n.id))throw new Error(`ID ${n.id} already exists in the registry`);this._idmap.set(n.id,e)}return this}clear(){return this._map=/* @__PURE__ */new Map,this._idmap=/* @__PURE__ */new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};return delete n.id,{...n,...this._map.get(e)}}return this._map.get(e)}has(e){return this._map.has(e)}}function Sy(){return new Ay}const by=/* @__PURE__ */Sy();class Ty{constructor(e){this.counter=0,this.metadataRegistry=e?.metadata??by,this.target=e?.target??"draft-2020-12",this.unrepresentable=e?.unrepresentable??"throw",this.override=e?.override??(()=>{}),this.io=e?.io??"output",this.seen=/* @__PURE__ */new Map}process(e,t={path:[],schemaPath:[]}){var n;const r=e._zod.def,i={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},a=this.seen.get(e);if(a){a.count++;return t.schemaPath.includes(e)&&(a.cycle=t.path),a.schema}const o={schema:{},count:1,cycle:void 0,path:t.path};this.seen.set(e,o);const s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{const n={...t,schemaPath:[...t.schemaPath,e],path:t.path},a=e._zod.parent;if(a)o.ref=a,this.process(a,n),this.seen.get(a).isParent=!0;else{const t=o.schema;switch(r.type){case"string":{const n=t;n.type="string";const{minimum:r,maximum:a,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if("number"==typeof r&&(n.minLength=r),"number"==typeof a&&(n.maxLength=a),s&&(n.format=i[s]??s,""===n.format&&delete n.format),l&&(n.contentEncoding=l),c&&c.size>0){const e=[...c];1===e.length?n.pattern=e[0].source:e.length>1&&(o.schema.allOf=[...e.map(e=>({..."draft-7"===this.target?{type:"string"}:{},pattern:e.source}))])}break}case"number":{const n=t,{minimum:r,maximum:i,format:a,multipleOf:o,exclusiveMaximum:s,exclusiveMinimum:c}=e._zod.bag;"string"==typeof a&&a.includes("int")?n.type="integer":n.type="number","number"==typeof c&&(n.exclusiveMinimum=c),"number"==typeof r&&(n.minimum=r,"number"==typeof c&&(c>=r?delete n.minimum:delete n.exclusiveMinimum)),"number"==typeof s&&(n.exclusiveMaximum=s),"number"==typeof i&&(n.maximum=i,"number"==typeof s&&(s<=i?delete n.maximum:delete n.exclusiveMaximum)),"number"==typeof o&&(n.multipleOf=o);break}case"boolean":t.type="boolean";break;case"bigint":if("throw"===this.unrepresentable)throw new Error("BigInt cannot be represented in JSON Schema");break;case"symbol":if("throw"===this.unrepresentable)throw new Error("Symbols cannot be represented in JSON Schema");break;case"null":t.type="null";break;case"any":case"unknown":break;case"undefined":if("throw"===this.unrepresentable)throw new Error("Undefined cannot be represented in JSON Schema");break;case"void":if("throw"===this.unrepresentable)throw new Error("Void cannot be represented in JSON Schema");break;case"never":t.not={};break;case"date":if("throw"===this.unrepresentable)throw new Error("Date cannot be represented in JSON Schema");break;case"array":{const i=t,{minimum:a,maximum:o}=e._zod.bag;"number"==typeof a&&(i.minItems=a),"number"==typeof o&&(i.maxItems=o),i.type="array",i.items=this.process(r.element,{...n,path:[...n.path,"items"]});break}case"object":{const e=t;e.type="object",e.properties={};const i=r.shape;for(const t in i)e.properties[t]=this.process(i[t],{...n,path:[...n.path,"properties",t]});const a=new Set(Object.keys(i)),o=new Set([...a].filter(e=>{const t=r.shape[e]._zod;return"input"===this.io?void 0===t.optin:void 0===t.optout}));o.size>0&&(e.required=Array.from(o)),"never"===r.catchall?._zod.def.type?e.additionalProperties=!1:r.catchall?r.catchall&&(e.additionalProperties=this.process(r.catchall,{...n,path:[...n.path,"additionalProperties"]})):"output"===this.io&&(e.additionalProperties=!1);break}case"union":t.anyOf=r.options.map((e,t)=>this.process(e,{...n,path:[...n.path,"anyOf",t]}));break;case"intersection":{const e=t,i=this.process(r.left,{...n,path:[...n.path,"allOf",0]}),a=this.process(r.right,{...n,path:[...n.path,"allOf",1]}),o=e=>"allOf"in e&&1===Object.keys(e).length,s=[...o(i)?i.allOf:[i],...o(a)?a.allOf:[a]];e.allOf=s;break}case"tuple":{const i=t;i.type="array";const a=r.items.map((e,t)=>this.process(e,{...n,path:[...n.path,"prefixItems",t]}));if("draft-2020-12"===this.target?i.prefixItems=a:i.items=a,r.rest){const e=this.process(r.rest,{...n,path:[...n.path,"items"]});"draft-2020-12"===this.target?i.items=e:i.additionalItems=e}r.rest&&(i.items=this.process(r.rest,{...n,path:[...n.path,"items"]}));const{minimum:o,maximum:s}=e._zod.bag;"number"==typeof o&&(i.minItems=o),"number"==typeof s&&(i.maxItems=s);break}case"record":{const e=t;e.type="object",e.propertyNames=this.process(r.keyType,{...n,path:[...n.path,"propertyNames"]}),e.additionalProperties=this.process(r.valueType,{...n,path:[...n.path,"additionalProperties"]});break}case"map":if("throw"===this.unrepresentable)throw new Error("Map cannot be represented in JSON Schema");break;case"set":if("throw"===this.unrepresentable)throw new Error("Set cannot be represented in JSON Schema");break;case"enum":{const e=t,n=function(e){const t=Object.values(e).filter(e=>"number"==typeof e);return Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t)}(r.entries);n.every(e=>"number"==typeof e)&&(e.type="number"),n.every(e=>"string"==typeof e)&&(e.type="string"),e.enum=n;break}case"literal":{const e=t,n=[];for(const t of r.values)if(void 0===t){if("throw"===this.unrepresentable)throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if("bigint"==typeof t){if("throw"===this.unrepresentable)throw new Error("BigInt literals cannot be represented in JSON Schema");n.push(Number(t))}else n.push(t);if(0===n.length);else if(1===n.length){const t=n[0];e.type=null===t?"null":typeof t,e.const=t}else n.every(e=>"number"==typeof e)&&(e.type="number"),n.every(e=>"string"==typeof e)&&(e.type="string"),n.every(e=>"boolean"==typeof e)&&(e.type="string"),n.every(e=>null===e)&&(e.type="null"),e.enum=n;break}case"file":{const n=t,r={type:"string",format:"binary",contentEncoding:"binary"},{minimum:i,maximum:a,mime:o}=e._zod.bag;void 0!==i&&(r.minLength=i),void 0!==a&&(r.maxLength=a),o?1===o.length?(r.contentMediaType=o[0],Object.assign(n,r)):n.anyOf=o.map(e=>({...r,contentMediaType:e})):Object.assign(n,r);break}case"transform":if("throw"===this.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema");break;case"nullable":{const e=this.process(r.innerType,n);t.anyOf=[e,{type:"null"}];break}case"nonoptional":case"promise":case"optional":this.process(r.innerType,n),o.ref=r.innerType;break;case"success":t.type="boolean";break;case"default":this.process(r.innerType,n),o.ref=r.innerType,t.default=JSON.parse(JSON.stringify(r.defaultValue));break;case"prefault":this.process(r.innerType,n),o.ref=r.innerType,"input"===this.io&&(t._prefault=JSON.parse(JSON.stringify(r.defaultValue)));break;case"catch":{let e;this.process(r.innerType,n),o.ref=r.innerType;try{e=r.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}t.default=e;break}case"nan":if("throw"===this.unrepresentable)throw new Error("NaN cannot be represented in JSON Schema");break;case"template_literal":{const n=t,r=e._zod.pattern;if(!r)throw new Error("Pattern not found in template literal");n.type="string",n.pattern=r.source;break}case"pipe":{const e="input"===this.io?"transform"===r.in._zod.def.type?r.out:r.in:r.out;this.process(e,n),o.ref=e;break}case"readonly":this.process(r.innerType,n),o.ref=r.innerType,t.readOnly=!0;break;case"lazy":{const t=e._zod.innerType;this.process(t,n),o.ref=t;break}case"custom":if("throw"===this.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")}}}const c=this.metadataRegistry.get(e);c&&Object.assign(o.schema,c),"input"===this.io&&_y(e)&&(delete o.schema.examples,delete o.schema.default),"input"===this.io&&o.schema._prefault&&((n=o.schema).default??(n.default=o.schema._prefault)),delete o.schema._prefault;return this.seen.get(e).schema}emit(e,t){const n={cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0},r=this.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=e=>{const t="draft-2020-12"===this.target?"$defs":"definitions";if(n.external){const r=n.external.registry.get(e[0])?.id,i=n.external.uri??(e=>e);if(r)return{ref:i(r)};const a=e[1].defId??e[1].schema.id??"schema"+this.counter++;return e[1].defId=a,{defId:a,ref:`${i("__shared")}#/${t}/${a}`}}if(e[1]===r)return{ref:"#"};const i=`#/${t}/`,a=e[1].schema.id??"__schema"+this.counter++;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;const t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);const a=t.schema;for(const i in a)delete a[i];a.$ref=n};if("throw"===n.cycles)for(const u of this.seen.entries()){const e=u[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of this.seen.entries()){const t=u[1];if(e===u[0]){a(u);continue}if(n.external){const t=n.external.registry.get(u[0])?.id;if(e!==u[0]&&t){a(u);continue}}const r=this.metadataRegistry.get(u[0])?.id;r?a(u):(t.cycle||t.count>1&&"ref"===n.reused)&&a(u)}const o=(e,t)=>{const n=this.seen.get(e),r=n.def??n.schema,i={...r};if(null===n.ref)return;const a=n.ref;if(n.ref=null,a){o(a,t);const e=this.seen.get(a).schema;e.$ref&&"draft-7"===t.target?(r.allOf=r.allOf??[],r.allOf.push(e)):(Object.assign(r,e),Object.assign(r,i))}n.isParent||this.override({zodSchema:e,jsonSchema:r,path:n.path??[]})};for(const u of[...this.seen.entries()].reverse())o(u[0],{target:this.target});const s={};if("draft-2020-12"===this.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-7"===this.target?s.$schema="http://json-schema.org/draft-07/schema#":console.warn(`Invalid target: ${this.target}`),n.external?.uri){const t=n.external.registry.get(e)?.id;if(!t)throw new Error("Schema is missing an `id` property");s.$id=n.external.uri(t)}Object.assign(s,r.def);const c=n.external?.defs??{};for(const u of this.seen.entries()){const e=u[1];e.def&&e.defId&&(c[e.defId]=e.def)}n.external||Object.keys(c).length>0&&("draft-2020-12"===this.target?s.$defs=c:s.definitions=c);try{return JSON.parse(JSON.stringify(s))}catch(l){throw new Error("Error converting schema to JSON.")}}}function vy(e,t){if(e instanceof Ay){const n=new Ty(t),r={};for(const t of e._idmap.entries()){const[e,r]=t;n.process(r)}const i={},a={registry:e,uri:t?.uri,defs:r};for(const o of e._idmap.entries()){const[e,r]=o;i[e]=n.emit(r,{...t,external:a})}if(Object.keys(r).length>0){const e="draft-2020-12"===n.target?"$defs":"definitions";i.__shared={[e]:r}}return{schemas:i}}const n=new Ty(t);return n.process(e),n.emit(e,t)}function _y(e,t){const n=t??{seen:/* @__PURE__ */new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;switch(r.type){case"string":case"number":case"bigint":case"boolean":case"date":case"symbol":case"undefined":case"null":case"any":case"unknown":case"never":case"void":case"literal":case"enum":case"nan":case"file":case"template_literal":case"custom":case"success":case"catch":return!1;case"array":return _y(r.element,n);case"object":for(const e in r.shape)if(_y(r.shape[e],n))return!0;return!1;case"union":for(const e of r.options)if(_y(e,n))return!0;return!1;case"intersection":return _y(r.left,n)||_y(r.right,n);case"tuple":for(const e of r.items)if(_y(e,n))return!0;return!(!r.rest||!_y(r.rest,n));case"record":case"map":return _y(r.keyType,n)||_y(r.valueType,n);case"set":return _y(r.valueType,n);case"promise":case"optional":case"nonoptional":case"nullable":case"readonly":case"default":case"prefault":return _y(r.innerType,n);case"lazy":return _y(r.getter(),n);case"transform":return!0;case"pipe":return _y(r.in,n)||_y(r.out,n)}throw new Error(`Unknown schema type: ${r.type}`)}function wy(e){if("object"!=typeof e||null===e)return!1;if(!("_zod"in e))return!1;const t=e._zod;return"object"==typeof t&&null!==t&&"def"in t}function Ey(e){if("object"!=typeof e||null===e)return!1;if(!("_def"in e)||"_zod"in e)return!1;const t=e._def;return"object"==typeof t&&null!=t&&"typeName"in t}function Py(e){return!!e&&("object"==typeof e&&(!Array.isArray(e)&&!(!wy(e)&&!Ey(e))))}async function Ry(e,t){if(wy(e))return await py(e,t);if(Ey(e))return await e.parseAsync(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}function Ly(e){return wy(e)?by.get(e)?.description:Ey(e)||"description"in e&&"string"==typeof e.description?e.description:void 0}function Ny(e){return!!wy(e)&&("object"==typeof e&&null!==e&&"_zod"in e&&"object"==typeof e._zod&&null!==e._zod&&"def"in e._zod&&"object"==typeof e._zod.def&&null!==e._zod.def&&"type"in e._zod.def&&"object"===e._zod.def.type)}function Oy(e){return!!wy(e)&&("object"==typeof e&&null!==e&&"_zod"in e&&"object"==typeof e._zod&&null!==e._zod&&"def"in e._zod&&"object"==typeof e._zod.def&&null!==e._zod.def&&"type"in e._zod.def&&"array"===e._zod.def.type)}function By(e,t=!1){if("object"==typeof(n=e)&&null!==n&&"_def"in n&&"object"==typeof n._def&&null!==n._def&&"typeName"in n._def&&"ZodObject"===n._def.typeName)return e.strict();var n,r;if(Ny(e)){const n=e._zod.def.shape;if(t)for(const[r,o]of Object.entries(e._zod.def.shape)){if(Ny(o))n[r]=By(o,t);else if(Oy(o)){let e=o._zod.def.element;Ny(e)&&(e=By(e,t)),n[r]=iy(o,{...o._zod.def,element:e})}else n[r]=o;const e=by.get(o);e&&by.add(n[r],e)}const i=iy(e,{...e._zod.def,shape:n,catchall:(r=Cy,new r({type:"never"}))}),a=by.get(e);return a&&by.add(i,a),i}throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject")}function My(e,t,n){const r=n.get(e);if(void 0!==r)return r;if(Ey(e))return function(e){return Ey(e)&&"typeName"in e._def&&"ZodEffects"===e._def.typeName}(e)?My(e._def.schema,t,n):e;if(wy(e)){let r=e;if(function(e){return wy(e)&&"pipe"===e._zod.def.type}(e)&&(r=My(e._zod.def.in,t,n)),t)if(Ny(r)){const e={};for(const[i,a]of Object.entries(r._zod.def.shape))e[i]=My(a,t,n);r=iy(r,{...r._zod.def,shape:e})}else if(Oy(r)){const e=My(r._zod.def.element,t,n);r=iy(r,{...r._zod.def,element:e})}else if(wy(i=r)&&"object"==typeof i&&null!==i&&"_zod"in i&&"object"==typeof i._zod&&null!==i._zod&&"def"in i._zod&&"object"==typeof i._zod.def&&null!==i._zod.def&&"type"in i._zod.def&&"optional"===i._zod.def.type){const e=My(r._zod.def.innerType,t,n);r=iy(r,{...r._zod.def,innerType:e})}else if(function(e){return!!wy(e)&&"object"==typeof e&&null!==e&&"_zod"in e&&"object"==typeof e._zod&&null!==e._zod&&"def"in e._zod&&"object"==typeof e._zod.def&&null!==e._zod.def&&"type"in e._zod.def&&"nullable"===e._zod.def.type}(r)){const e=My(r._zod.def.innerType,t,n);r=iy(r,{...r._zod.def,innerType:e})}const a=by.get(e);return a&&by.add(r,a),n.set(e,r),r}var i;throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}const Dy=/* @__PURE__ */Symbol("Let zodToJsonSchema decide on which parser to use"),Fy={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},ky=e=>{const t=(e=>({...Fy,...e}))(e),n=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,flags:{hasReferencedOpenAiAnyType:!1},currentPath:n,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,n])=>[n._def,{def:n._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}},Gy=(e,t)=>{let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];n++);return[(e.length-n).toString(),...t.slice(n)].join("/")};function Hy(e){if("openAi"!==e.target)return{};const t=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:"relative"===e.$refStrategy?Gy(t,e.currentPath):t.join("/")}}function xy(e,t,n,r){r?.errorMessages&&n&&(e.errorMessage={...e.errorMessage,[t]:n})}function Uy(e,t,n,r,i){e[t]=n,xy(e,t,r,i)}var Vy,$y,jy;($y=Vy||(Vy={})).assertEqual=e=>{},$y.assertIs=function(e){},$y.assertNever=function(e){throw new Error},$y.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},$y.getValidEnumValues=e=>{const t=$y.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),n={};for(const r of t)n[r]=e[r];return $y.objectValues(n)},$y.objectValues=e=>$y.objectKeys(e).map(function(t){return e[t]}),$y.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},$y.find=(e,t)=>{for(const n of e)if(t(n))return n},$y.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&Number.isFinite(e)&&Math.floor(e)===e,$y.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},$y.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(jy||(jy={})).mergeShapes=(e,t)=>({...e,...t});const Wy=Vy.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Xy=e=>{switch(typeof e){case"undefined":return Wy.undefined;case"string":return Wy.string;case"number":return Number.isNaN(e)?Wy.nan:Wy.number;case"boolean":return Wy.boolean;case"function":return Wy.function;case"bigint":return Wy.bigint;case"symbol":return Wy.symbol;case"object":return Array.isArray(e)?Wy.array:null===e?Wy.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?Wy.promise:"undefined"!=typeof Map&&e instanceof Map?Wy.map:"undefined"!=typeof Set&&e instanceof Set?Wy.set:"undefined"!=typeof Date&&e instanceof Date?Wy.date:Wy.object;default:return Wy.unknown}},Ky=Vy.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Yy extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(r);else if("invalid_return_type"===i.code)r(i.returnTypeError);else if("invalid_arguments"===i.code)r(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){const n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof Yy))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Vy.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},n=[];for(const r of this.issues)if(r.path.length>0){const n=r.path[0];t[n]=t[n]||[],t[n].push(e(r))}else n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}Yy.create=e=>new Yy(e);const qy=(e,t)=>{let n;switch(e.code){case Ky.invalid_type:n=e.received===Wy.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case Ky.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Vy.jsonStringifyReplacer)}`;break;case Ky.unrecognized_keys:n=`Unrecognized key(s) in object: ${Vy.joinValues(e.keys,", ")}`;break;case Ky.invalid_union:n="Invalid input";break;case Ky.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Vy.joinValues(e.options)}`;break;case Ky.invalid_enum_value:n=`Invalid enum value. Expected ${Vy.joinValues(e.options)}, received '${e.received}'`;break;case Ky.invalid_arguments:n="Invalid function arguments";break;case Ky.invalid_return_type:n="Invalid function return type";break;case Ky.invalid_date:n="Invalid date";break;case Ky.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Vy.assertNever(e.validation):n="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case Ky.too_small:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type||"bigint"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case Ky.too_big:n="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case Ky.custom:n="Invalid input";break;case Ky.invalid_intersection_types:n="Intersection results could not be merged";break;case Ky.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Ky.not_finite:n="Number must be finite";break;default:n=t.defaultError,Vy.assertNever(e)}return{message:n}};let Qy=qy;function Jy(e,t){const n=Qy,r=(e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(void 0!==i.message)return{...i,path:a,message:i.message};let s="";const c=r.filter(e=>!!e).slice().reverse();for(const l of c)s=l(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}})({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===qy?void 0:qy].filter(e=>!!e)});e.common.issues.push(r)}class zy{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if("aborted"===r.status)return Zy;"dirty"===r.status&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const e=await r.key,t=await r.value;n.push({key:e,value:t})}return zy.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:t,value:i}=r;if("aborted"===t.status)return Zy;if("aborted"===i.status)return Zy;"dirty"===t.status&&e.dirty(),"dirty"===i.status&&e.dirty(),"__proto__"===t.value||void 0===i.value&&!r.alwaysSet||(n[t.value]=i.value)}return{status:e.value,value:n}}}const Zy=Object.freeze({status:"aborted"}),eI=e=>({status:"dirty",value:e}),tI=e=>({status:"valid",value:e}),nI=e=>"aborted"===e.status,rI=e=>"dirty"===e.status,iI=e=>"valid"===e.status,aI=e=>"undefined"!=typeof Promise&&e instanceof Promise;var oI,sI;(sI=oI||(oI={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},sI.toString=e=>"string"==typeof e?e:e?.message;class cI{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const lI=(e,t)=>{if(iI(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new Yy(e.common.issues);return this._error=t,this._error}}};function uI(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:i};return{errorMap:(t,i)=>{const{message:a}=e;return"invalid_enum_value"===t.code?{message:a??i.defaultError}:void 0===i.data?{message:a??r??i.defaultError}:"invalid_type"!==t.code?{message:i.defaultError}:{message:a??n??i.defaultError}},description:i}}class dI{get description(){return this._def.description}_getType(e){return Xy(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Xy(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new zy,ctx:{common:e.parent.common,data:e.data,parsedType:Xy(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(aI(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xy(e)},r=this._parseSync({data:e,path:n.path,parent:n});return lI(n,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xy(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return iI(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>iI(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Xy(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(aI(r)?r:Promise.resolve(r));return lI(n,i)}refine(e,t){const n=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,r)=>{const i=e(t),a=()=>r.addIssue({code:Ky.custom,...n(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then(e=>!!e||(a(),!1)):!!i||(a(),!1)})}refinement(e,t){return this._refinement((n,r)=>!!e(n)||(r.addIssue("function"==typeof t?t(n,r):t),!1))}_refinement(e){return new lC({schema:this,typeName:IC.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return uC.create(this,this._def)}nullable(){return dC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return YI.create(this)}promise(){return cC.create(this,this._def)}or(e){return JI.create([this,e],this._def)}and(e){return ZI.create(this,e,this._def)}transform(e){return new lC({...uI(this._def),schema:this,typeName:IC.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new pC({...uI(this._def),innerType:this,defaultValue:t,typeName:IC.ZodDefault})}brand(){return new mC({typeName:IC.ZodBranded,type:this,...uI(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new hC({...uI(this._def),innerType:this,catchValue:t,typeName:IC.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return gC.create(this,e)}readonly(){return yC.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pI=/^c[^\s-]{8,}$/i,hI=/^[0-9a-z]+$/,fI=/^[0-9A-HJKMNP-TV-Z]{26}$/i,mI=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,gI=/^[a-z0-9_-]{21}$/i,yI=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,II=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,CI=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let AI;const SI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bI=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,TI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,vI=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,_I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,wI=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,EI="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",PI=new RegExp(`^${EI}$`);function RI(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`);return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e.precision?"+":"?"}`}function LI(e){return new RegExp(`^${RI(e)}$`)}function NI(e){let t=`${EI}T${RI(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function OI(e,t){return!("v4"!==t&&t||!SI.test(e))||!("v6"!==t&&t||!TI.test(e))}function BI(e,t){if(!yI.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),i=JSON.parse(atob(r));return"object"==typeof i&&null!==i&&((!("typ"in i)||"JWT"===i?.typ)&&(!!i.alg&&(!t||i.alg===t)))}catch{return!1}}function MI(e,t){return!("v4"!==t&&t||!bI.test(e))||!("v6"!==t&&t||!vI.test(e))}class DI extends dI{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==Wy.string){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.string,received:t.parsedType}),Zy}const t=new zy;let n;for(const r of this._def.checks)if("min"===r.kind)e.data.length<r.value&&(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("max"===r.kind)e.data.length>r.value&&(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if("length"===r.kind){const i=e.data.length>r.value,a=e.data.length<r.value;(i||a)&&(n=this._getOrReturnCtx(e,n),i?Jy(n,{code:Ky.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):a&&Jy(n,{code:Ky.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if("email"===r.kind)CI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"email",code:Ky.invalid_string,message:r.message}),t.dirty());else if("emoji"===r.kind)AI||(AI=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),AI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"emoji",code:Ky.invalid_string,message:r.message}),t.dirty());else if("uuid"===r.kind)mI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"uuid",code:Ky.invalid_string,message:r.message}),t.dirty());else if("nanoid"===r.kind)gI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"nanoid",code:Ky.invalid_string,message:r.message}),t.dirty());else if("cuid"===r.kind)pI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"cuid",code:Ky.invalid_string,message:r.message}),t.dirty());else if("cuid2"===r.kind)hI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"cuid2",code:Ky.invalid_string,message:r.message}),t.dirty());else if("ulid"===r.kind)fI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"ulid",code:Ky.invalid_string,message:r.message}),t.dirty());else if("url"===r.kind)try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),Jy(n,{validation:"url",code:Ky.invalid_string,message:r.message}),t.dirty()}else if("regex"===r.kind){r.regex.lastIndex=0;r.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"regex",code:Ky.invalid_string,message:r.message}),t.dirty())}else if("trim"===r.kind)e.data=e.data.trim();else if("includes"===r.kind)e.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty());else if("toLowerCase"===r.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===r.kind)e.data=e.data.toUpperCase();else if("startsWith"===r.kind)e.data.startsWith(r.value)||(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty());else if("endsWith"===r.kind)e.data.endsWith(r.value)||(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty());else if("datetime"===r.kind){NI(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.invalid_string,validation:"datetime",message:r.message}),t.dirty())}else if("date"===r.kind){PI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.invalid_string,validation:"date",message:r.message}),t.dirty())}else if("time"===r.kind){LI(r).test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.invalid_string,validation:"time",message:r.message}),t.dirty())}else"duration"===r.kind?II.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"duration",code:Ky.invalid_string,message:r.message}),t.dirty()):"ip"===r.kind?OI(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"ip",code:Ky.invalid_string,message:r.message}),t.dirty()):"jwt"===r.kind?BI(e.data,r.alg)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"jwt",code:Ky.invalid_string,message:r.message}),t.dirty()):"cidr"===r.kind?MI(e.data,r.version)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"cidr",code:Ky.invalid_string,message:r.message}),t.dirty()):"base64"===r.kind?_I.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"base64",code:Ky.invalid_string,message:r.message}),t.dirty()):"base64url"===r.kind?wI.test(e.data)||(n=this._getOrReturnCtx(e,n),Jy(n,{validation:"base64url",code:Ky.invalid_string,message:r.message}),t.dirty()):Vy.assertNever(r);return{status:t.value,value:e.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:Ky.invalid_string,...oI.errToObj(n)})}_addCheck(e){return new DI({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...oI.errToObj(e)})}url(e){return this._addCheck({kind:"url",...oI.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...oI.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...oI.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...oI.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...oI.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...oI.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...oI.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...oI.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...oI.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...oI.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...oI.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...oI.errToObj(e)})}datetime(e){return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===e?.precision?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...oI.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===e?.precision?null:e?.precision,...oI.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...oI.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...oI.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...oI.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...oI.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...oI.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...oI.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...oI.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...oI.errToObj(t)})}nonempty(e){return this.min(1,oI.errToObj(e))}trim(){return new DI({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new DI({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new DI({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isDate(){return!!this._def.checks.find(e=>"date"===e.kind)}get isTime(){return!!this._def.checks.find(e=>"time"===e.kind)}get isDuration(){return!!this._def.checks.find(e=>"duration"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isNANOID(){return!!this._def.checks.find(e=>"nanoid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get isCIDR(){return!!this._def.checks.find(e=>"cidr"===e.kind)}get isBase64(){return!!this._def.checks.find(e=>"base64"===e.kind)}get isBase64url(){return!!this._def.checks.find(e=>"base64url"===e.kind)}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function FI(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(".",""))%Number.parseInt(t.toFixed(i).replace(".",""))/10**i}DI.create=e=>new DI({checks:[],typeName:IC.ZodString,coerce:e?.coerce??!1,...uI(e)});class kI extends dI{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==Wy.number){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.number,received:t.parsedType}),Zy}let t;const n=new zy;for(const r of this._def.checks)if("int"===r.kind)Vy.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty());else if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty())}else"multipleOf"===r.kind?0!==FI(e.data,r.value)&&(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):"finite"===r.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.not_finite,message:r.message}),n.dirty()):Vy.assertNever(r);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,oI.toString(t))}gt(e,t){return this.setLimit("min",e,!1,oI.toString(t))}lte(e,t){return this.setLimit("max",e,!0,oI.toString(t))}lt(e,t){return this.setLimit("max",e,!1,oI.toString(t))}setLimit(e,t,n,r){return new kI({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:oI.toString(r)}]})}_addCheck(e){return new kI({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:oI.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:oI.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:oI.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:oI.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:oI.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:oI.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:oI.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:oI.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:oI.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&Vy.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}kI.create=e=>new kI({checks:[],typeName:IC.ZodNumber,coerce:e?.coerce||!1,...uI(e)});class GI extends dI{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Wy.bigint)return this._getInvalidInput(e);let t;const n=new zy;for(const r of this._def.checks)if("min"===r.kind){(r.inclusive?e.data<r.value:e.data<=r.value)&&(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else if("max"===r.kind){(r.inclusive?e.data>r.value:e.data>=r.value)&&(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty())}else"multipleOf"===r.kind?e.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Jy(t,{code:Ky.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):Vy.assertNever(r);return{status:n.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.bigint,received:t.parsedType}),Zy}gte(e,t){return this.setLimit("min",e,!0,oI.toString(t))}gt(e,t){return this.setLimit("min",e,!1,oI.toString(t))}lte(e,t){return this.setLimit("max",e,!0,oI.toString(t))}lt(e,t){return this.setLimit("max",e,!1,oI.toString(t))}setLimit(e,t,n,r){return new GI({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:oI.toString(r)}]})}_addCheck(e){return new GI({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:oI.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:oI.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:oI.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:oI.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:oI.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}GI.create=e=>new GI({checks:[],typeName:IC.ZodBigInt,coerce:e?.coerce??!1,...uI(e)});class HI extends dI{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==Wy.boolean){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.boolean,received:t.parsedType}),Zy}return tI(e.data)}}HI.create=e=>new HI({typeName:IC.ZodBoolean,coerce:e?.coerce||!1,...uI(e)});class xI extends dI{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==Wy.date){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.date,received:t.parsedType}),Zy}if(Number.isNaN(e.data.getTime())){return Jy(this._getOrReturnCtx(e),{code:Ky.invalid_date}),Zy}const t=new zy;let n;for(const r of this._def.checks)"min"===r.kind?e.data.getTime()<r.value&&(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):"max"===r.kind?e.data.getTime()>r.value&&(n=this._getOrReturnCtx(e,n),Jy(n,{code:Ky.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):Vy.assertNever(r);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new xI({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:oI.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:oI.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}xI.create=e=>new xI({checks:[],coerce:e?.coerce||!1,typeName:IC.ZodDate,...uI(e)});class UI extends dI{_parse(e){if(this._getType(e)!==Wy.symbol){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.symbol,received:t.parsedType}),Zy}return tI(e.data)}}UI.create=e=>new UI({typeName:IC.ZodSymbol,...uI(e)});class VI extends dI{_parse(e){if(this._getType(e)!==Wy.undefined){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.undefined,received:t.parsedType}),Zy}return tI(e.data)}}VI.create=e=>new VI({typeName:IC.ZodUndefined,...uI(e)});class $I extends dI{_parse(e){if(this._getType(e)!==Wy.null){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.null,received:t.parsedType}),Zy}return tI(e.data)}}$I.create=e=>new $I({typeName:IC.ZodNull,...uI(e)});class jI extends dI{constructor(){super(...arguments),this._any=!0}_parse(e){return tI(e.data)}}jI.create=e=>new jI({typeName:IC.ZodAny,...uI(e)});class WI extends dI{constructor(){super(...arguments),this._unknown=!0}_parse(e){return tI(e.data)}}WI.create=e=>new WI({typeName:IC.ZodUnknown,...uI(e)});class XI extends dI{_parse(e){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.never,received:t.parsedType}),Zy}}XI.create=e=>new XI({typeName:IC.ZodNever,...uI(e)});class KI extends dI{_parse(e){if(this._getType(e)!==Wy.undefined){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.void,received:t.parsedType}),Zy}return tI(e.data)}}KI.create=e=>new KI({typeName:IC.ZodVoid,...uI(e)});class YI extends dI{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==Wy.array)return Jy(t,{code:Ky.invalid_type,expected:Wy.array,received:t.parsedType}),Zy;if(null!==r.exactLength){const e=t.data.length>r.exactLength.value,i=t.data.length<r.exactLength.value;(e||i)&&(Jy(t,{code:e?Ky.too_big:Ky.too_small,minimum:i?r.exactLength.value:void 0,maximum:e?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(null!==r.minLength&&t.data.length<r.minLength.value&&(Jy(t,{code:Ky.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),null!==r.maxLength&&t.data.length>r.maxLength.value&&(Jy(t,{code:Ky.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>r.type._parseAsync(new cI(t,e,t.path,n)))).then(e=>zy.mergeArray(n,e));const i=[...t.data].map((e,n)=>r.type._parseSync(new cI(t,e,t.path,n)));return zy.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new YI({...this._def,minLength:{value:e,message:oI.toString(t)}})}max(e,t){return new YI({...this._def,maxLength:{value:e,message:oI.toString(t)}})}length(e,t){return new YI({...this._def,exactLength:{value:e,message:oI.toString(t)}})}nonempty(e){return this.min(1,e)}}function qI(e){if(e instanceof QI){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=uC.create(qI(r))}return new QI({...e._def,shape:()=>t})}return e instanceof YI?new YI({...e._def,type:qI(e.element)}):e instanceof uC?uC.create(qI(e.unwrap())):e instanceof dC?dC.create(qI(e.unwrap())):e instanceof eC?eC.create(e.items.map(e=>qI(e))):e}YI.create=(e,t)=>new YI({type:e,minLength:null,maxLength:null,exactLength:null,typeName:IC.ZodArray,...uI(t)});class QI extends dI{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=Vy.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==Wy.object){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.object,received:t.parsedType}),Zy}const{status:t,ctx:n}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),a=[];if(!(this._def.catchall instanceof XI&&"strip"===this._def.unknownKeys))for(const s in n.data)i.includes(s)||a.push(s);const o=[];for(const s of i){const e=r[s],t=n.data[s];o.push({key:{status:"valid",value:s},value:e._parse(new cI(n,t,n.path,s)),alwaysSet:s in n.data})}if(this._def.catchall instanceof XI){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of a)o.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)a.length>0&&(Jy(n,{code:Ky.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const r=n.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new cI(n,r,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const e=[];for(const t of o){const n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>zy.mergeObjectSync(t,e)):zy.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return oI.errToObj,new QI({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{const r=this._def.errorMap?.(t,n).message??n.defaultError;return"unrecognized_keys"===t.code?{message:oI.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new QI({...this._def,unknownKeys:"strip"})}passthrough(){return new QI({...this._def,unknownKeys:"passthrough"})}extend(e){return new QI({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new QI({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:IC.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new QI({...this._def,catchall:e})}pick(e){const t={};for(const n of Vy.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new QI({...this._def,shape:()=>t})}omit(e){const t={};for(const n of Vy.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new QI({...this._def,shape:()=>t})}deepPartial(){return qI(this)}partial(e){const t={};for(const n of Vy.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new QI({...this._def,shape:()=>t})}required(e){const t={};for(const n of Vy.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let e=this.shape[n];for(;e instanceof uC;)e=e._def.innerType;t[n]=e}return new QI({...this._def,shape:()=>t})}keyof(){return aC(Vy.objectKeys(this.shape))}}QI.create=(e,t)=>new QI({shape:()=>e,unknownKeys:"strip",catchall:XI.create(),typeName:IC.ZodObject,...uI(t)}),QI.strictCreate=(e,t)=>new QI({shape:()=>e,unknownKeys:"strict",catchall:XI.create(),typeName:IC.ZodObject,...uI(t)}),QI.lazycreate=(e,t)=>new QI({shape:e,unknownKeys:"strip",catchall:XI.create(),typeName:IC.ZodObject,...uI(t)});class JI extends dI{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map(async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const n=e.map(e=>new Yy(e.ctx.common.issues));return Jy(t,{code:Ky.invalid_union,unionErrors:n}),Zy});{let e;const r=[];for(const a of n){const n={...t,common:{...t.common,issues:[]},parent:null},i=a._parseSync({data:t.data,path:t.path,parent:n});if("valid"===i.status)return i;"dirty"!==i.status||e||(e={result:i,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const i=r.map(e=>new Yy(e));return Jy(t,{code:Ky.invalid_union,unionErrors:i}),Zy}}get options(){return this._def.options}}function zI(e,t){const n=Xy(e),r=Xy(t);if(e===t)return{valid:!0,data:e};if(n===Wy.object&&r===Wy.object){const n=Vy.objectKeys(t),r=Vy.objectKeys(e).filter(e=>-1!==n.indexOf(e)),i={...e,...t};for(const a of r){const n=zI(e[a],t[a]);if(!n.valid)return{valid:!1};i[a]=n.data}return{valid:!0,data:i}}if(n===Wy.array&&r===Wy.array){if(e.length!==t.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=zI(e[r],t[r]);if(!i.valid)return{valid:!1};n.push(i.data)}return{valid:!0,data:n}}return n===Wy.date&&r===Wy.date&&+e===+t?{valid:!0,data:e}:{valid:!1}}JI.create=(e,t)=>new JI({options:e,typeName:IC.ZodUnion,...uI(t)});class ZI extends dI{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(nI(e)||nI(r))return Zy;const i=zI(e.value,r.value);return i.valid?((rI(e)||rI(r))&&t.dirty(),{status:t.value,value:i.data}):(Jy(n,{code:Ky.invalid_intersection_types}),Zy)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZI.create=(e,t,n)=>new ZI({left:e,right:t,typeName:IC.ZodIntersection,...uI(n)});class eC extends dI{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wy.array)return Jy(n,{code:Ky.invalid_type,expected:Wy.array,received:n.parsedType}),Zy;if(n.data.length<this._def.items.length)return Jy(n,{code:Ky.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Zy;!this._def.rest&&n.data.length>this._def.items.length&&(Jy(n,{code:Ky.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((e,t)=>{const r=this._def.items[t]||this._def.rest;return r?r._parse(new cI(n,e,n.path,t)):null}).filter(e=>!!e);return n.common.async?Promise.all(r).then(e=>zy.mergeArray(t,e)):zy.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new eC({...this._def,rest:e})}}eC.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new eC({items:e,typeName:IC.ZodTuple,rest:null,...uI(t)})};class tC extends dI{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wy.map)return Jy(n,{code:Ky.invalid_type,expected:Wy.map,received:n.parsedType}),Zy;const r=this._def.keyType,i=this._def.valueType,a=[...n.data.entries()].map(([e,t],a)=>({key:r._parse(new cI(n,e,n.path,[a,"key"])),value:i._parse(new cI(n,t,n.path,[a,"value"]))}));if(n.common.async){const e=/* @__PURE__ */new Map;return Promise.resolve().then(async()=>{for(const n of a){const r=await n.key,i=await n.value;if("aborted"===r.status||"aborted"===i.status)return Zy;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}{const e=/* @__PURE__ */new Map;for(const n of a){const r=n.key,i=n.value;if("aborted"===r.status||"aborted"===i.status)return Zy;"dirty"!==r.status&&"dirty"!==i.status||t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}}tC.create=(e,t,n)=>new tC({valueType:t,keyType:e,typeName:IC.ZodMap,...uI(n)});class nC extends dI{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==Wy.set)return Jy(n,{code:Ky.invalid_type,expected:Wy.set,received:n.parsedType}),Zy;const r=this._def;null!==r.minSize&&n.data.size<r.minSize.value&&(Jy(n,{code:Ky.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),null!==r.maxSize&&n.data.size>r.maxSize.value&&(Jy(n,{code:Ky.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function a(e){const n=/* @__PURE__ */new Set;for(const r of e){if("aborted"===r.status)return Zy;"dirty"===r.status&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}const o=[...n.data.values()].map((e,t)=>i._parse(new cI(n,e,n.path,t)));return n.common.async?Promise.all(o).then(e=>a(e)):a(o)}min(e,t){return new nC({...this._def,minSize:{value:e,message:oI.toString(t)}})}max(e,t){return new nC({...this._def,maxSize:{value:e,message:oI.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}nC.create=(e,t)=>new nC({valueType:e,minSize:null,maxSize:null,typeName:IC.ZodSet,...uI(t)});class rC extends dI{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}rC.create=(e,t)=>new rC({getter:e,typeName:IC.ZodLazy,...uI(t)});class iC extends dI{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Jy(t,{received:t.data,code:Ky.invalid_literal,expected:this._def.value}),Zy}return{status:"valid",value:e.data}}get value(){return this._def.value}}function aC(e,t){return new oC({values:e,typeName:IC.ZodEnum,...uI(t)})}iC.create=(e,t)=>new iC({value:e,typeName:IC.ZodLiteral,...uI(t)});class oC extends dI{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),n=this._def.values;return Jy(t,{expected:Vy.joinValues(n),received:t.parsedType,code:Ky.invalid_type}),Zy}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return Jy(t,{received:t.data,code:Ky.invalid_enum_value,options:n}),Zy}return tI(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return oC.create(e,{...this._def,...t})}exclude(e,t=this._def){return oC.create(this.options.filter(t=>!e.includes(t)),{...this._def,...t})}}oC.create=aC;class sC extends dI{_parse(e){const t=Vy.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==Wy.string&&n.parsedType!==Wy.number){const e=Vy.objectValues(t);return Jy(n,{expected:Vy.joinValues(e),received:n.parsedType,code:Ky.invalid_type}),Zy}if(this._cache||(this._cache=new Set(Vy.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const e=Vy.objectValues(t);return Jy(n,{received:n.data,code:Ky.invalid_enum_value,options:e}),Zy}return tI(e.data)}get enum(){return this._def.values}}sC.create=(e,t)=>new sC({values:e,typeName:IC.ZodNativeEnum,...uI(t)});class cC extends dI{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==Wy.promise&&!1===t.common.async)return Jy(t,{code:Ky.invalid_type,expected:Wy.promise,received:t.parsedType}),Zy;const n=t.parsedType===Wy.promise?t.data:Promise.resolve(t.data);return tI(n.then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}cC.create=(e,t)=>new cC({type:e,typeName:IC.ZodPromise,...uI(t)});class lC extends dI{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===IC.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:e=>{Jy(n,e),e.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),"preprocess"===r.type){const e=r.transform(n.data,i);if(n.common.async)return Promise.resolve(e).then(async e=>{if("aborted"===t.value)return Zy;const r=await this._def.schema._parseAsync({data:e,path:n.path,parent:n});return"aborted"===r.status?Zy:"dirty"===r.status||"dirty"===t.value?eI(r.value):r});{if("aborted"===t.value)return Zy;const r=this._def.schema._parseSync({data:e,path:n.path,parent:n});return"aborted"===r.status?Zy:"dirty"===r.status||"dirty"===t.value?eI(r.value):r}}if("refinement"===r.type){const e=e=>{const t=r.refinement(e,i);if(n.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===n.common.async){const r=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===r.status?Zy:("dirty"===r.status&&t.dirty(),e(r.value),{status:t.value,value:r.value})}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(n=>"aborted"===n.status?Zy:("dirty"===n.status&&t.dirty(),e(n.value).then(()=>({status:t.value,value:n.value}))))}if("transform"===r.type){if(!1===n.common.async){const e=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!iI(e))return Zy;const a=r.transform(e.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(e=>iI(e)?Promise.resolve(r.transform(e.value,i)).then(e=>({status:t.value,value:e})):Zy)}Vy.assertNever(r)}}lC.create=(e,t,n)=>new lC({schema:e,typeName:IC.ZodEffects,effect:t,...uI(n)}),lC.createWithPreprocess=(e,t,n)=>new lC({schema:t,effect:{type:"preprocess",transform:e},typeName:IC.ZodEffects,...uI(n)});class uC extends dI{_parse(e){return this._getType(e)===Wy.undefined?tI(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}uC.create=(e,t)=>new uC({innerType:e,typeName:IC.ZodOptional,...uI(t)});class dC extends dI{_parse(e){return this._getType(e)===Wy.null?tI(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}dC.create=(e,t)=>new dC({innerType:e,typeName:IC.ZodNullable,...uI(t)});class pC extends dI{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===Wy.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}pC.create=(e,t)=>new pC({innerType:e,typeName:IC.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...uI(t)});class hC extends dI{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return aI(r)?r.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new Yy(n.common.issues)},input:n.data})})):{status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new Yy(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}hC.create=(e,t)=>new hC({innerType:e,typeName:IC.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...uI(t)});class fC extends dI{_parse(e){if(this._getType(e)!==Wy.nan){const t=this._getOrReturnCtx(e);return Jy(t,{code:Ky.invalid_type,expected:Wy.nan,received:t.parsedType}),Zy}return{status:"valid",value:e.data}}}fC.create=e=>new fC({typeName:IC.ZodNaN,...uI(e)});class mC extends dI{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class gC extends dI{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Zy:"dirty"===e.status?(t.dirty(),eI(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?Zy:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new gC({in:e,out:t,typeName:IC.ZodPipeline})}}class yC extends dI{_parse(e){const t=this._def.innerType._parse(e),n=e=>(iI(e)&&(e.value=Object.freeze(e.value)),e);return aI(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}}var IC,CC;yC.create=(e,t)=>new yC({innerType:e,typeName:IC.ZodReadonly,...uI(t)}),(CC=IC||(IC={})).ZodString="ZodString",CC.ZodNumber="ZodNumber",CC.ZodNaN="ZodNaN",CC.ZodBigInt="ZodBigInt",CC.ZodBoolean="ZodBoolean",CC.ZodDate="ZodDate",CC.ZodSymbol="ZodSymbol",CC.ZodUndefined="ZodUndefined",CC.ZodNull="ZodNull",CC.ZodAny="ZodAny",CC.ZodUnknown="ZodUnknown",CC.ZodNever="ZodNever",CC.ZodVoid="ZodVoid",CC.ZodArray="ZodArray",CC.ZodObject="ZodObject",CC.ZodUnion="ZodUnion",CC.ZodDiscriminatedUnion="ZodDiscriminatedUnion",CC.ZodIntersection="ZodIntersection",CC.ZodTuple="ZodTuple",CC.ZodRecord="ZodRecord",CC.ZodMap="ZodMap",CC.ZodSet="ZodSet",CC.ZodFunction="ZodFunction",CC.ZodLazy="ZodLazy",CC.ZodLiteral="ZodLiteral",CC.ZodEnum="ZodEnum",CC.ZodEffects="ZodEffects",CC.ZodNativeEnum="ZodNativeEnum",CC.ZodOptional="ZodOptional",CC.ZodNullable="ZodNullable",CC.ZodDefault="ZodDefault",CC.ZodCatch="ZodCatch",CC.ZodPromise="ZodPromise",CC.ZodBranded="ZodBranded",CC.ZodPipeline="ZodPipeline",CC.ZodReadonly="ZodReadonly";const AC=DI.create,SC=jI.create;XI.create,YI.create;const bC=QI.create;function TC(e,t){return QC(e.type._def,t)}JI.create,ZI.create,eC.create,oC.create,cC.create,uC.create,dC.create;function vC(e,t,n){const r=n??t.dateStrategy;if(Array.isArray(r))return{anyOf:r.map(n=>vC(e,t,n))};switch(r){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return _C(e,t)}}const _C=(e,t)=>{const n={type:"integer",format:"unix-time"};if("openApi3"===t.target)return n;for(const r of e.checks)switch(r.kind){case"min":Uy(n,"minimum",r.value,r.message,t);break;case"max":Uy(n,"maximum",r.value,r.message,t)}return n};let wC;const EC=/^[cC][^\s-]{8,}$/,PC=/^[0-9a-z]+$/,RC=/^[0-9A-HJKMNP-TV-Z]{26}$/,LC=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,NC=()=>(void 0===wC&&(wC=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),wC),OC=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,BC=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,MC=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,DC=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,FC=/^[a-zA-Z0-9_-]{21}$/,kC=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function GC(e,t){const n={type:"string"};if(e.checks)for(const r of e.checks)switch(r.kind){case"min":Uy(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t);break;case"max":Uy(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"email":switch(t.emailStrategy){case"format:email":UC(n,"email",r.message,t);break;case"format:idn-email":UC(n,"idn-email",r.message,t);break;case"pattern:zod":VC(n,LC,r.message,t)}break;case"url":UC(n,"uri",r.message,t);break;case"uuid":UC(n,"uuid",r.message,t);break;case"regex":VC(n,r.regex,r.message,t);break;case"cuid":VC(n,EC,r.message,t);break;case"cuid2":VC(n,PC,r.message,t);break;case"startsWith":VC(n,RegExp(`^${HC(r.value,t)}`),r.message,t);break;case"endsWith":VC(n,RegExp(`${HC(r.value,t)}$`),r.message,t);break;case"datetime":UC(n,"date-time",r.message,t);break;case"date":UC(n,"date",r.message,t);break;case"time":UC(n,"time",r.message,t);break;case"duration":UC(n,"duration",r.message,t);break;case"length":Uy(n,"minLength","number"==typeof n.minLength?Math.max(n.minLength,r.value):r.value,r.message,t),Uy(n,"maxLength","number"==typeof n.maxLength?Math.min(n.maxLength,r.value):r.value,r.message,t);break;case"includes":VC(n,RegExp(HC(r.value,t)),r.message,t);break;case"ip":"v6"!==r.version&&UC(n,"ipv4",r.message,t),"v4"!==r.version&&UC(n,"ipv6",r.message,t);break;case"base64url":VC(n,DC,r.message,t);break;case"jwt":VC(n,kC,r.message,t);break;case"cidr":"v6"!==r.version&&VC(n,OC,r.message,t),"v4"!==r.version&&VC(n,BC,r.message,t);break;case"emoji":VC(n,NC(),r.message,t);break;case"ulid":VC(n,RC,r.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":UC(n,"binary",r.message,t);break;case"contentEncoding:base64":Uy(n,"contentEncoding","base64",r.message,t);break;case"pattern:zod":VC(n,MC,r.message,t)}break;case"nanoid":VC(n,FC,r.message,t)}return n}function HC(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let n=0;n<e.length;n++)xC.has(e[n])||(t+="\\"),t+=e[n];return t}(e):e}const xC=/* @__PURE__ */new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function UC(e,t,n,r){e.format||e.anyOf?.some(e=>e.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&r.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.anyOf.push({format:t,...n&&r.errorMessages&&{errorMessage:{format:n}}})):Uy(e,"format",t,n,r)}function VC(e,t,n,r){e.pattern||e.allOf?.some(e=>e.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&r.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,0===Object.keys(e.errorMessage).length&&delete e.errorMessage)),e.allOf.push({pattern:$C(t,r),...n&&r.errorMessages&&{errorMessage:{pattern:n}}})):Uy(e,"pattern",$C(t,r),n,r)}function $C(e,t){if(!t.applyRegexFlags||!e.flags)return e.source;const n=e.flags.includes("i"),r=e.flags.includes("m"),i=e.flags.includes("s"),a=n?e.source.toLowerCase():e.source;let o="",s=!1,c=!1,l=!1;for(let u=0;u<a.length;u++)if(s)o+=a[u],s=!1;else{if(n)if(c){if(a[u].match(/[a-z]/)){l?(o+=a[u],o+=`${a[u-2]}-${a[u]}`.toUpperCase(),l=!1):"-"===a[u+1]&&a[u+2]?.match(/[a-z]/)?(o+=a[u],l=!0):o+=`${a[u]}${a[u].toUpperCase()}`;continue}}else if(a[u].match(/[a-z]/)){o+=`[${a[u]}${a[u].toUpperCase()}]`;continue}if(r){if("^"===a[u]){o+="(^|(?<=[\r\n]))";continue}if("$"===a[u]){o+="($|(?=[\r\n]))";continue}}i&&"."===a[u]?o+=c?`${a[u]}\r\n`:`[${a[u]}\r\n]`:(o+=a[u],"\\"===a[u]?s=!0:c&&"]"===a[u]?c=!1:c||"["!==a[u]||(c=!0))}try{new RegExp(o)}catch{return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return o}function jC(e,t){if("openAi"===t.target&&console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."),"openApi3"===t.target&&e.keyType?._def.typeName===IC.ZodEnum)return{type:"object",required:e.keyType._def.values,properties:e.keyType._def.values.reduce((n,r)=>({...n,[r]:QC(e.valueType._def,{...t,currentPath:[...t.currentPath,"properties",r]})??Hy(t)}),{}),additionalProperties:t.rejectedAdditionalProperties};const n={type:"object",additionalProperties:QC(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]})??t.allowedAdditionalProperties};if("openApi3"===t.target)return n;if(e.keyType?._def.typeName===IC.ZodString&&e.keyType._def.checks?.length){const{type:r,...i}=GC(e.keyType._def,t);return{...n,propertyNames:i}}if(e.keyType?._def.typeName===IC.ZodEnum)return{...n,propertyNames:{enum:e.keyType._def.values}};if(e.keyType?._def.typeName===IC.ZodBranded&&e.keyType._def.type._def.typeName===IC.ZodString&&e.keyType._def.type._def.checks?.length){const{type:r,...i}=TC(e.keyType._def,t);return{...n,propertyNames:i}}return n}const WC={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};const XC=(e,t)=>{const n=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,n)=>QC(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${n}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return n.length?{anyOf:n}:void 0};function KC(e,t){const n="openAi"===t.target,r={type:"object",properties:{}},i=[],a=e.shape();for(const s in a){let e=a[s];if(void 0===e||void 0===e._def)continue;let o=YC(e);o&&n&&("ZodOptional"===e._def.typeName&&(e=e._def.innerType),e.isNullable()||(e=e.nullable()),o=!1);const c=QC(e._def,{...t,currentPath:[...t.currentPath,"properties",s],propertyPath:[...t.currentPath,"properties",s]});void 0!==c&&(r.properties[s]=c,o||i.push(s))}i.length&&(r.required=i);const o=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return QC(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==o&&(r.additionalProperties=o),r}function YC(e){try{return e.isOptional()}catch{return!0}}const qC=(e,t,n)=>{switch(t){case IC.ZodString:return GC(e,n);case IC.ZodNumber:return function(e,t){const n={type:"number"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"int":n.type="integer",xy(n,"type",r.message,t);break;case"min":"jsonSchema7"===t.target?r.inclusive?Uy(n,"minimum",r.value,r.message,t):Uy(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Uy(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Uy(n,"maximum",r.value,r.message,t):Uy(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Uy(n,"maximum",r.value,r.message,t));break;case"multipleOf":Uy(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case IC.ZodObject:return KC(e,n);case IC.ZodBigInt:return function(e,t){const n={type:"integer",format:"int64"};if(!e.checks)return n;for(const r of e.checks)switch(r.kind){case"min":"jsonSchema7"===t.target?r.inclusive?Uy(n,"minimum",r.value,r.message,t):Uy(n,"exclusiveMinimum",r.value,r.message,t):(r.inclusive||(n.exclusiveMinimum=!0),Uy(n,"minimum",r.value,r.message,t));break;case"max":"jsonSchema7"===t.target?r.inclusive?Uy(n,"maximum",r.value,r.message,t):Uy(n,"exclusiveMaximum",r.value,r.message,t):(r.inclusive||(n.exclusiveMaximum=!0),Uy(n,"maximum",r.value,r.message,t));break;case"multipleOf":Uy(n,"multipleOf",r.value,r.message,t)}return n}(e,n);case IC.ZodBoolean:return{type:"boolean"};case IC.ZodDate:return vC(e,n);case IC.ZodUndefined:return function(e){return{not:Hy(e)}}(n);case IC.ZodNull:return function(e){return"openApi3"===e.target?{enum:["null"],nullable:!0}:{type:"null"}}(n);case IC.ZodArray:return function(e,t){const n={type:"array"};return e.type?._def&&e.type?._def?.typeName!==IC.ZodAny&&(n.items=QC(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&Uy(n,"minItems",e.minLength.value,e.minLength.message,t),e.maxLength&&Uy(n,"maxItems",e.maxLength.value,e.maxLength.message,t),e.exactLength&&(Uy(n,"minItems",e.exactLength.value,e.exactLength.message,t),Uy(n,"maxItems",e.exactLength.value,e.exactLength.message,t)),n}(e,n);case IC.ZodUnion:case IC.ZodDiscriminatedUnion:return function(e,t){if("openApi3"===t.target)return XC(e,t);const n=e.options instanceof Map?Array.from(e.options.values()):e.options;if(n.every(e=>e._def.typeName in WC&&(!e._def.checks||!e._def.checks.length))){const e=n.reduce((e,t)=>{const n=WC[t._def.typeName];return n&&!e.includes(n)?[...e,n]:e},[]);return{type:e.length>1?e:e[0]}}if(n.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=n.reduce((e,t)=>{const n=typeof t._def.value;switch(n){case"string":case"number":case"boolean":return[...e,n];case"bigint":return[...e,"integer"];case"object":return null===t._def.value?[...e,"null"]:e;default:return e}},[]);if(e.length===n.length){const t=e.filter((e,t,n)=>n.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:n.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(n.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:n.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return XC(e,t)}(e,n);case IC.ZodIntersection:return function(e,t){const n=[QC(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),QC(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e);let r="jsonSchema2019-09"===t.target?{unevaluatedProperties:!1}:void 0;const i=[];return n.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:n,...r}=e;t=r}else r=void 0;i.push(t)}else i.push(...e.allOf),void 0===e.unevaluatedProperties&&(r=void 0);var t}),i.length?{allOf:i,...r}:void 0}(e,n);case IC.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,n)=>QC(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:QC(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,n)=>QC(e._def,{...t,currentPath:[...t.currentPath,"items",`${n}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,n);case IC.ZodRecord:return jC(e,n);case IC.ZodLiteral:return function(e,t){const n=typeof e.value;return"bigint"!==n&&"number"!==n&&"boolean"!==n&&"string"!==n?{type:Array.isArray(e.value)?"array":"object"}:"openApi3"===t.target?{type:"bigint"===n?"integer":n,enum:[e.value]}:{type:"bigint"===n?"integer":n,const:e.value}}(e,n);case IC.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case IC.ZodNativeEnum:return function(e){const t=e.values,n=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),r=Array.from(new Set(n.map(e=>typeof e)));return{type:1===r.length?"string"===r[0]?"string":"number":["string","number"],enum:n}}(e);case IC.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return"openApi3"===t.target?{type:WC[e.innerType._def.typeName],nullable:!0}:{type:[WC[e.innerType._def.typeName],"null"]};if("openApi3"===t.target){const n=QC(e.innerType._def,{...t,currentPath:[...t.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}const n=QC(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return n&&{anyOf:[n,{type:"null"}]}}(e,n);case IC.ZodOptional:return((e,t)=>{if(t.currentPath.toString()===t.propertyPath?.toString())return QC(e.innerType._def,t);const n=QC(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:Hy(t)},n]}:Hy(t)})(e,n);case IC.ZodMap:return function(e,t){return"record"===t.mapStrategy?jC(e,t):{type:"array",maxItems:125,items:{type:"array",items:[QC(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||Hy(t),QC(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||Hy(t)],minItems:2,maxItems:2}}}(e,n);case IC.ZodSet:return function(e,t){const n={type:"array",uniqueItems:!0,items:QC(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&Uy(n,"minItems",e.minSize.value,e.minSize.message,t),e.maxSize&&Uy(n,"maxItems",e.maxSize.value,e.maxSize.message,t),n}(e,n);case IC.ZodLazy:return()=>e.getter()._def;case IC.ZodPromise:return function(e,t){return QC(e.type._def,t)}(e,n);case IC.ZodNaN:case IC.ZodNever:return function(e){return"openAi"===e.target?void 0:{not:Hy({...e,currentPath:[...e.currentPath,"not"]})}}(n);case IC.ZodEffects:return function(e,t){return"input"===t.effectStrategy?QC(e.schema._def,t):Hy(t)}(e,n);case IC.ZodAny:return Hy(n);case IC.ZodUnknown:return function(e){return Hy(e)}(n);case IC.ZodDefault:return function(e,t){return{...QC(e.innerType._def,t),default:e.defaultValue()}}(e,n);case IC.ZodBranded:return TC(e,n);case IC.ZodReadonly:case IC.ZodCatch:return((e,t)=>QC(e.innerType._def,t))(e,n);case IC.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return QC(e.in._def,t);if("output"===t.pipeStrategy)return QC(e.out._def,t);const n=QC(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[n,QC(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",n?"1":"0"]})].filter(e=>void 0!==e)}})(e,n);case IC.ZodFunction:case IC.ZodVoid:case IC.ZodSymbol:default:return}};function QC(e,t,n=!1){const r=t.seen.get(e);if(t.override){const i=t.override?.(e,t,r,n);if(i!==Dy)return i}if(r&&!n){const e=JC(r,t);if(void 0!==e)return e}const i={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,i);const a=qC(e,e.typeName,t),o="function"==typeof a?QC(a(),t):a;if(o&&zC(e,t,o),t.postProcess){const n=t.postProcess(o,e,t);return i.jsonSchema=o,n}return i.jsonSchema=o,o}const JC=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:Gy(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,n)=>t.currentPath[n]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),Hy(t)):"seen"===t.$refStrategy?Hy(t):void 0}},zC=(e,t,n)=>(e.description&&(n.description=e.description,t.markdownDescription&&(n.markdownDescription=e.description)),n);function ZC(e){return("object"==typeof e||"function"==typeof e)&&null!==e&&"~standard"in e&&"object"==typeof e["~standard"]&&null!==e["~standard"]&&"jsonSchema"in e["~standard"]}function eA(e){return function(e){return("object"==typeof e||"function"==typeof e)&&null!==e&&"~standard"in e&&"object"==typeof e["~standard"]&&null!==e["~standard"]&&"validate"in e["~standard"]}(e)&&ZC(e)}function tA(e,t){const n=typeof e;if(n!==typeof t)return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!tA(e[r],t[r]))return!1;return!0}if("object"===n){if(!e||!t)return e===t;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n)if(!tA(e[i],t[i]))return!1;return!0}return e===t}const nA=/* @__PURE__ */new WeakMap;function rA(e,t){const n=null!=e&&"object"==typeof e;if(n){const t=nA.get(e);if(t)return t}let r;if(ZC(e)&&!wy(e))r=e["~standard"].jsonSchema.input({target:"draft-07"});else if(wy(e)){const n=function(e,t=!1){return My(e,t,/* @__PURE__ */new WeakMap)}(e,!0);if(Ny(n)){r=vy(By(n,!0),t)}else r=vy(e,t)}else r=Ey(e)?((e,t)=>{const n=ky(t);let r;const i=t?.name,a=QC(e._def,n,!1)??Hy(n);n.flags.hasReferencedOpenAiAnyType&&(r||(r={}),r[n.openAiAnyTypeName]||(r[n.openAiAnyTypeName]={type:["string","number","integer","boolean","array","null"],items:{$ref:"relative"===n.$refStrategy?"1":[...n.basePath,n.definitionPath,n.openAiAnyTypeName].join("/")}}));const o=void 0===i?r?{...a,[n.definitionPath]:r}:a:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,i].join("/"),[n.definitionPath]:{...r,[i]:a}};return"jsonSchema7"===n.target?o.$schema="http://json-schema.org/draft-07/schema#":"jsonSchema2019-09"!==n.target&&"openAi"!==n.target||(o.$schema="https://json-schema.org/draft/2019-09/schema#"),"openAi"===n.target&&("anyOf"in o||"oneOf"in o||"allOf"in o||"type"in o&&Array.isArray(o.type))&&console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."),o})(e):e;return n&&null!=r&&"object"==typeof r&&nA.set(e,r),r}const iA=/([A-Z]+)([A-Z][a-z0-9]+)/g,aA=/([a-z0-9])([A-Z])/g,oA=/[-_\s]+/g;function sA(e,t){return t?.[e]||function(e){return e.replace(iA,"$1_$2").replace(aA,"$1_$2").replace(oA,"_").toLowerCase()}(e)}const cA="__lc_escaped__";function lA(e,t=/* @__PURE__ */new WeakSet){if(null!==e&&"object"==typeof e&&!Array.isArray(e)){if(t.has(e))return function(e){let t;return t=null!==e&&"object"==typeof e?"lc_id"in e&&Array.isArray(e.lc_id)?e.lc_id:[e.constructor?.name??"Object"]:[typeof e],{lc:1,type:"not_implemented",id:t}}(e);if(null!==(n=e)&&"object"==typeof n&&"lc_serializable"in n&&"function"==typeof n.toJSON)return e;t.add(e);const r=e;if(function(e){return"lc"in e||1===Object.keys(e).length&&"__lc_escaped__"in e}(r))return t.delete(e),function(e){return{[cA]:e}}(r);const i={};for(const[e,n]of Object.entries(r))i[e]=lA(n,t);return t.delete(e),i}var n;return Array.isArray(e)?e.map(e=>lA(e,t)):e}function uA(e){return Array.isArray(e)?[...e]:{...e}}function dA(e){const t=Object.getPrototypeOf(e);return"function"!=typeof e.lc_name||"function"==typeof t.lc_name&&e.lc_name()===t.lc_name()?e.name:e.lc_name()}var pA=class e{lc_serializable=!1;lc_kwargs;static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,dA(this.constructor)]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}constructor(e,...t){void 0!==this.lc_serializable_keys?this.lc_kwargs=Object.fromEntries(Object.entries(e||{}).filter(([e])=>this.lc_serializable_keys?.includes(e))):this.lc_kwargs=e??{}}toJSON(){if(!this.lc_serializable)return this.toJSONNotImplemented();if(this.lc_kwargs instanceof e||"object"!=typeof this.lc_kwargs||Array.isArray(this.lc_kwargs))return this.toJSONNotImplemented();const t={},n={},r=Object.keys(this.lc_kwargs).reduce((e,t)=>(e[t]=t in this?this[t]:this.lc_kwargs[t],e),{});for(let e=Object.getPrototypeOf(this);e;e=Object.getPrototypeOf(e))Object.assign(t,Reflect.get(e,"lc_aliases",this)),Object.assign(n,Reflect.get(e,"lc_secrets",this)),Object.assign(r,Reflect.get(e,"lc_attributes",this));Object.keys(n).forEach(e=>{let t=this,n=r;const[i,...a]=e.split(".").reverse();for(const r of a.reverse()){if(!(r in t)||void 0===t[r])return;r in n&&void 0!==n[r]||("object"==typeof t[r]&&null!=t[r]?n[r]={}:Array.isArray(t[r])&&(n[r]=[])),t=t[r],n=n[r]}i in t&&void 0!==t[i]&&(n[i]=n[i]||t[i])});const i={},a=/* @__PURE__ */new WeakSet;a.add(this);for(const[e,s]of Object.entries(r))i[e]=lA(s,a);const o=function(e,t,n){const r={};for(const i in e)Object.hasOwn(e,i)&&(r[t(i,n)]=e[i]);return r}(Object.keys(n).length?function(e,t){const n=uA(e);for(const[r,i]of Object.entries(t)){const[e,...t]=r.split(".").reverse();let a=n;for(const n of t.reverse()){if(void 0===a[n])break;a[n]=uA(a[n]),a=a[n]}void 0!==a[e]&&(a[e]={lc:1,type:"secret",id:[i]})}return n}(i,n):i,sA,t);return{lc:1,type:"constructor",id:this.lc_id,kwargs:o}}toJSONNotImplemented(){return{lc:1,type:"not_implemented",id:this.lc_id}}};function hA(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type&&"source_type"in e&&("url"===e.source_type||"base64"===e.source_type||"text"===e.source_type||"id"===e.source_type)}function fA(e){return hA(e)&&"url"===e.source_type&&"url"in e&&"string"==typeof e.url}function mA(e){return hA(e)&&"base64"===e.source_type&&"data"in e&&"string"==typeof e.data}function gA(e){if(hA(e)){if("url"===e.source_type)return{type:"image_url",image_url:{url:e.url}};if("base64"===e.source_type){if(!e.mime_type)throw new Error("mime_type key is required for base64 data.");return{type:"image_url",image_url:{url:`data:${e.mime_type};base64,${e.data}`}}}}throw new Error("Unsupported source type. Only 'url' and 'base64' are supported.")}function yA({dataUrl:e,asTypedArray:t=!1}){const n=e.match(/^data:(\w+\/\w+);base64,([A-Za-z0-9+/]+=*)$/);let r;if(n){r=n[1].toLowerCase();return{mime_type:r,data:t?Uint8Array.from(atob(n[2]),e=>e.charCodeAt(0)):n[2]}}}function IA(e,t){return CA(e)&&e.type===t}function CA(e){return"object"==typeof e&&null!==e}function AA(e){return Array.isArray(e)}function SA(e){return"string"==typeof e}function bA(e){return"number"==typeof e}function TA(e){return e instanceof Uint8Array}function vA(e){try{return JSON.parse(e)}catch{return}}const _A=e=>e();function wA(e){if("char_location"===e.type&&SA(e.document_title)&&bA(e.start_char_index)&&bA(e.end_char_index)&&SA(e.cited_text)){const{document_title:t,start_char_index:n,end_char_index:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"char",title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if("page_location"===e.type&&SA(e.document_title)&&bA(e.start_page_number)&&bA(e.end_page_number)&&SA(e.cited_text)){const{document_title:t,start_page_number:n,end_page_number:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"page",title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if("content_block_location"===e.type&&SA(e.document_title)&&bA(e.start_block_index)&&bA(e.end_block_index)&&SA(e.cited_text)){const{document_title:t,start_block_index:n,end_block_index:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"block",title:t??void 0,startIndex:n,endIndex:r,citedText:i}}if("web_search_result_location"===e.type&&SA(e.url)&&SA(e.title)&&SA(e.encrypted_index)&&SA(e.cited_text)){const{url:t,title:n,encrypted_index:r,cited_text:i,...a}=e;return{...a,type:"citation",source:"url",url:t,title:n,startIndex:Number(r),endIndex:Number(r),citedText:i}}if("search_result_location"===e.type&&SA(e.source)&&SA(e.title)&&bA(e.start_block_index)&&bA(e.end_block_index)&&SA(e.cited_text)){const{source:t,title:n,start_block_index:r,end_block_index:i,cited_text:a,...o}=e;return{...o,type:"citation",source:"search",url:t,title:n??void 0,startIndex:r,endIndex:i,citedText:a}}}function EA(e){if(IA(e,"document")&&CA(e.source)&&"type"in e.source){if("base64"===e.source.type&&SA(e.source.media_type)&&SA(e.source.data))return{type:"file",mimeType:e.source.media_type,data:e.source.data};if("url"===e.source.type&&SA(e.source.url))return{type:"file",url:e.source.url};if("file"===e.source.type&&SA(e.source.file_id))return{type:"file",fileId:e.source.file_id};if("text"===e.source.type&&SA(e.source.data))return{type:"file",mimeType:String(e.source.media_type??"text/plain"),data:e.source.data}}else if(IA(e,"image")&&CA(e.source)&&"type"in e.source){if("base64"===e.source.type&&SA(e.source.media_type)&&SA(e.source.data))return{type:"image",mimeType:e.source.media_type,data:e.source.data};if("url"===e.source.type&&SA(e.source.url))return{type:"image",url:e.source.url};if("file"===e.source.type&&SA(e.source.file_id))return{type:"image",fileId:e.source.file_id}}}function PA(e){return Array.from(function*(){for(const t of e){const e=EA(t);e?yield e:yield t}}())}function RA(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const n of t){if(IA(n,"text")&&SA(n.text)){const{text:e,citations:t,...r}=n;if(AA(t)&&t.length){const n=t.reduce((e,t)=>{const n=wA(t);return n?[...e,n]:e},[]);yield{...r,type:"text",text:e,annotations:n};continue}yield{...r,type:"text",text:e};continue}if(IA(n,"thinking")&&SA(n.thinking)){const{thinking:e,signature:t,...r}=n;yield{...r,type:"reasoning",reasoning:e,signature:t};continue}if(IA(n,"redacted_thinking"))yield{type:"non_standard",value:n};else if(IA(n,"tool_use")&&SA(n.name)&&SA(n.id))yield{type:"tool_call",id:n.id,name:n.name,args:n.input};else{if(IA(n,"input_json_delta")){if(NA(e)&&e.tool_call_chunks?.length){const t=e.tool_call_chunks[0];yield{type:"tool_call_chunk",id:t.id,name:t.name,args:t.args,index:t.index};continue}}else if(IA(n,"server_tool_use")&&SA(n.name)&&SA(n.id)){const{name:e,id:t}=n;if("web_search"===e){yield{id:t,type:"server_tool_call",name:"web_search",args:{query:_A(()=>{if("string"==typeof n.input)return n.input;if(CA(n.input)&&SA(n.input.query))return n.input.query;if(SA(n.partial_json)){const e=vA(n.partial_json);if(e?.query)return e.query}return""})}};continue}if("code_execution"===n.name){yield{id:t,type:"server_tool_call",name:"code_execution",args:{code:_A(()=>{if("string"==typeof n.input)return n.input;if(CA(n.input)&&SA(n.input.code))return n.input.code;if(SA(n.partial_json)){const e=vA(n.partial_json);if(e?.code)return e.code}return""})}};continue}}else{if(IA(n,"web_search_tool_result")&&SA(n.tool_use_id)&&AA(n.content)){const{content:e,tool_use_id:t}=n;yield{type:"server_tool_call_result",name:"web_search",toolCallId:t,status:"success",output:{urls:e.reduce((e,t)=>IA(t,"web_search_result")?[...e,t.url]:e,[])}};continue}if(IA(n,"code_execution_tool_result")&&SA(n.tool_use_id)&&CA(n.content)){yield{type:"server_tool_call_result",name:"code_execution",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}if(IA(n,"mcp_tool_use")){yield{id:n.id,type:"server_tool_call",name:"mcp_tool_use",args:n.input};continue}if(IA(n,"mcp_tool_result")&&SA(n.tool_use_id)&&CA(n.content)){yield{type:"server_tool_call_result",name:"mcp_tool_use",toolCallId:n.tool_use_id,status:"success",output:n.content};continue}if(IA(n,"container_upload")){yield{type:"server_tool_call",name:"container_upload",args:n.input};continue}if(IA(n,"search_result")){yield{id:n.id,type:"non_standard",value:n};continue}if(IA(n,"tool_result")){yield{id:n.id,type:"non_standard",value:n};continue}{const e=EA(n);if(e){yield e;continue}}}yield{type:"non_standard",value:n}}}}())}const LA={translateContent:RA,translateContentChunk:RA};function NA(e){return"function"==typeof e?._getType&&"function"==typeof e.concat&&"ai"===e._getType()}function OA(e){return fA(e)?{type:e.type,mimeType:e.mime_type,url:e.url,metadata:e.metadata}:mA(e)?{type:e.type,mimeType:e.mime_type??"application/octet-stream",data:e.data,metadata:e.metadata}:hA(t=e)&&"id"===t.source_type&&"id"in t&&"string"==typeof t.id?{type:e.type,mimeType:e.mime_type,fileId:e.id,metadata:e.metadata}:e;var t}function BA(e){return e.map(OA)}function MA(e){return!(!IA(e,"image_url")||!CA(e.image_url))||(!(!IA(e,"input_audio")||!CA(e.input_audio))||!(!IA(e,"file")||!CA(e.file)))}function DA(e){if(IA(e,"image_url")&&CA(e.image_url)&&SA(e.image_url.url)){const t=yA({dataUrl:e.image_url.url});return t?{type:"image",mimeType:t.mime_type,data:t.data}:{type:"image",url:e.image_url.url}}if(IA(e,"input_audio")&&CA(e.input_audio)&&SA(e.input_audio.data)&&SA(e.input_audio.format))return{type:"audio",data:e.input_audio.data,mimeType:`audio/${e.input_audio.format}`};if(IA(e,"file")&&CA(e.file)&&SA(e.file.data)){const t=yA({dataUrl:e.file.data});if(t)return{type:"file",data:t.data,mimeType:t.mime_type};if(SA(e.file.file_id))return{type:"file",fileId:e.file.file_id}}return e}function FA(e){const t=[];for(const n of e)MA(n)?t.push(DA(n)):t.push(n);return t}function kA(e){if("url_citation"===e.type){const{url:t,title:n,start_index:r,end_index:i}=e;return{type:"citation",url:t,title:n,startIndex:r,endIndex:i}}if("file_citation"===e.type){const{file_id:t,filename:n,index:r}=e;return{type:"citation",title:n,startIndex:r,endIndex:r,fileId:t}}return e}function GA(e){return Array.from(function*(){CA(e.additional_kwargs?.reasoning)&&AA(e.additional_kwargs.reasoning.summary)&&(yield{type:"reasoning",reasoning:e.additional_kwargs.reasoning.summary.reduce((e,t)=>CA(t)&&SA(t.text)?`${e}${t.text}`:e,"")});const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const e of t)if(IA(e,"text")){const{text:t,annotations:n,phase:r,extras:i,...a}=e,o=CA(i)?{...i}:{};SA(r)&&(o.phase=r);const s=Object.keys(o).length>0?{extras:o}:{};Array.isArray(n)?yield{...a,...s,type:"text",text:String(t),annotations:n.map(kA)}:yield{...a,...s,type:"text",text:String(t)}}for(const n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args};if(CA(e.additional_kwargs)&&AA(e.additional_kwargs.tool_outputs))for(const n of e.additional_kwargs.tool_outputs){if(IA(n,"web_search_call")){const e={};if(CA(n.action)&&SA(n.action.query)&&(e.query=n.action.query),yield{id:n.id,type:"server_tool_call",name:"web_search",args:e},"completed"===n.status||"failed"===n.status){const e={};CA(n.action)&&(e.action=n.action),yield{type:"server_tool_call_result",toolCallId:SA(n.id)?n.id:"",status:"completed"===n.status?"success":"error",output:e}}continue}if(IA(n,"file_search_call"))yield{id:n.id,type:"server_tool_call",name:"file_search",args:{queries:AA(n.queries)?n.queries:[]}},"completed"!==n.status&&"failed"!==n.status||(yield{type:"server_tool_call_result",toolCallId:SA(n.id)?n.id:"",status:"completed"===n.status?"success":"error",output:AA(n.results)?{results:n.results}:{}});else if(IA(n,"computer_call"))yield{type:"non_standard",value:n};else if(IA(n,"code_interpreter_call")){if(SA(n.code)&&(yield{id:n.id,type:"server_tool_call",name:"code_interpreter",args:{code:n.code}}),AA(n.outputs)){const e=_A(()=>{if("in_progress"!==n.status){if("completed"===n.status)return 0;if("incomplete"===n.status)return 127;if("interpreting"!==n.status)return"failed"===n.status?1:void 0}});for(const t of n.outputs)if(IA(t,"logs")){yield{type:"server_tool_call_result",toolCallId:n.id??"",status:"success",output:{type:"code_interpreter_output",returnCode:e??0,stderr:[0,void 0].includes(e)?void 0:String(t.logs),stdout:[0,void 0].includes(e)?String(t.logs):void 0}};continue}}}else if(IA(n,"mcp_call"))yield{id:n.id,type:"server_tool_call",name:"mcp_call",args:n.input};else if(IA(n,"mcp_list_tools"))yield{id:n.id,type:"server_tool_call",name:"mcp_list_tools",args:n.input};else if(IA(n,"mcp_approval_request"))yield{type:"non_standard",value:n};else{if(IA(n,"tool_search_call")){const e={};CA(n.arguments)&&Object.assign(e,n.arguments);const t={};SA(n.execution)&&(t.execution=n.execution),SA(n.status)&&(t.status=n.status),SA(n.call_id)&&(t.call_id=n.call_id),yield{id:SA(n.id)?n.id:"",type:"server_tool_call",name:"tool_search",args:e,...Object.keys(t).length>0?{extras:t}:{}};continue}if(IA(n,"tool_search_output")){const e={name:"tool_search"};SA(n.execution)&&(e.execution=n.execution),yield{type:"server_tool_call_result",toolCallId:SA(n.id)?n.id:"",status:"completed"===n.status?"success":"failed"===n.status?"error":"success",output:{tools:AA(n.tools)?n.tools:[]},extras:e};continue}IA(n,"image_generation_call")?(SA(n.result)&&(yield{type:"image",mimeType:"image/png",data:n.result,id:SA(n.id)?n.id:void 0,metadata:{status:SA(n.status)?n.status:void 0}}),yield{type:"non_standard",value:n}):CA(n)&&(yield{type:"non_standard",value:n})}}}())}const HA={translateContent:e=>"string"==typeof e.content?function(e){const t=[];"string"==typeof e.content?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...FA(e.content));for(const n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}(e):GA(e),translateContentChunk:e=>"string"==typeof e.content?function(e){const t=[];"string"==typeof e.content?e.content.length>0&&t.push({type:"text",text:e.content}):t.push(...FA(e.content));for(const n of e.tool_calls??[])t.push({type:"tool_call",id:n.id,name:n.name,args:n.args});return t}(e):function(e){return Array.from(function*(){yield*GA(e);for(const t of e.tool_call_chunks??[])yield{type:"tool_call_chunk",id:t.id,name:t.name,args:t.args}}())}(e)};function xA(e,t="pretty"){return"pretty"===t?function(e){const t=[],n=` ${e.type.charAt(0).toUpperCase()+e.type.slice(1)} Message `,r=Math.floor((80-n.length)/2),i="=".repeat(r),a=n.length%2==0?i:`${i}=`;if(t.push(`${i}${n}${a}`),"ai"===e.type){const n=e;if(n.tool_calls&&n.tool_calls.length>0){t.push("Tool Calls:");for(const e of n.tool_calls){t.push(` ${e.name} (${e.id})`),t.push(` Call ID: ${e.id}`),t.push(" Args:");for(const[n,r]of Object.entries(e.args))t.push(` ${n}: ${"object"==typeof r?JSON.stringify(r):r}`)}}}if("tool"===e.type){const n=e;n.name&&t.push(`Name: ${n.name}`)}"string"==typeof e.content&&e.content.trim()&&(t.length>1&&t.push(""),t.push(e.content));return t.join("\n")}(e):JSON.stringify(e)}const UA=/* @__PURE__ */Symbol.for("langchain.message");function VA(e){return Array.isArray(e)?e:"string"==typeof e?""===e?[]:[{type:"text",text:e}]:null==e?[]:[e]}function $A(e,t){if("string"==typeof e)return""===e?t:"string"==typeof t?e+t:Array.isArray(t)&&0===t.length?e:Array.isArray(t)&&t.some(e=>hA(e))?[{type:"text",source_type:"text",text:e},...t]:[{type:"text",text:e},...t];if(Array.isArray(t)){const n=VA(e);return JA(n,t)??[...n,...t]}return""===t?e:Array.isArray(e)&&e.some(e=>hA(e))?[...e,{type:"file",source_type:"text",text:t}]:[...VA(e),{type:"text",text:t}]}var jA=class extends pA{lc_namespace=["langchain_core","messages"];lc_serializable=!0;get lc_aliases(){return{additional_kwargs:"additional_kwargs",response_metadata:"response_metadata"}}[UA]=!0;id;name;content;additional_kwargs;response_metadata;_getType(){return this.type}getType(){return this._getType()}constructor(e){const t="string"==typeof e||Array.isArray(e)?{content:e}:e;t.additional_kwargs||(t.additional_kwargs={}),t.response_metadata||(t.response_metadata={}),super(t),this.name=t.name,void 0===t.content&&void 0!==t.contentBlocks?(this.content=t.contentBlocks,this.response_metadata={output_version:"v1",...t.response_metadata}):void 0!==t.content?(this.content=t.content??[],this.response_metadata=t.response_metadata):(this.content=[],this.response_metadata=t.response_metadata),this.additional_kwargs=t.additional_kwargs,this.id=t.id}get text(){return this.contentBlocks.filter(e=>"text"===e.type).reduce((e,t)=>e+(t.text??""),"")}get contentBlocks(){const e="string"==typeof this.content?[{type:"text",text:this.content}]:this.content;return[BA,FA,PA].reduce((e,t)=>t(e),e)}toDict(){return{type:this.getType(),data:this.toJSON().kwargs}}static lc_name(){return"BaseMessage"}get _printableFields(){return{id:this.id,content:this.content,name:this.name,additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata}}static isInstance(e){return"object"==typeof e&&null!==e&&UA in e&&!0===e[UA]&&("object"==typeof(t=e)&&null!==t&&"type"in t&&"content"in t&&("string"==typeof t.content||Array.isArray(t.content)));var t}static[Symbol.hasInstance](e){return this.isInstance(e)}_updateId(e){this.id=e,this.lc_kwargs.id=e}get[Symbol.toStringTag](){return this.constructor.lc_name()}[/* @__PURE__ */Symbol.for("nodejs.util.inspect.custom")](e){if(null===e)return this;const t=(n=this._printableFields,r=Math.max(4,e),JSON.stringify(function e(t,n){if("object"!=typeof t||null==t)return t;if(n>=r)return Array.isArray(t)?"[Array]":"[Object]";if(Array.isArray(t))return t.map(t=>e(t,n+1));const i={};for(const r of Object.keys(t))i[r]=e(t[r],n+1);return i}(n,0),null,2));var n,r;return`${this.constructor.lc_name()} ${t}`}toFormattedString(e="pretty"){return xA(this,e)}};const WA=["index","created","timestamp"];function XA(e,t,n){const r=WA;if(null==e&&null==t)return;if(null==e||null==t)return e??t;const i={...e};for(const[a,o]of Object.entries(t))if(null==i[a])i[a]=o;else{if(null==o)continue;if(typeof i[a]!=typeof o||Array.isArray(i[a])!==Array.isArray(o))throw new Error(`field[${a}] already exists in the message chunk, but with a different type.`);if("string"==typeof i[a]){if("type"===a)continue;if(["id","name","output_version","model_provider"].includes(a))o&&(i[a]=o);else{if(r.includes(a))continue;i[a]+=o}}else if("number"==typeof i[a]){if(r.includes(a))continue;i[a]=i[a]+o}else if("object"!=typeof i[a]||Array.isArray(i[a]))if(Array.isArray(i[a]))i[a]=JA(i[a],o);else{if(i[a]===o)continue;console.warn(`field[${a}] already exists in this message chunk and value has unsupported type.`)}else i[a]=XA(i[a],o)}return i}function KA(e){return"object"==typeof e&&null!==e&&("index"in e&&("number"==typeof(t=e.index)||"string"==typeof t));var t}function YA(e){if("object"!=typeof e||null===e)return!1;if(!("id"in e))return!1;const t=e.id;return null!=t&&""!==t}function qA(e){return e.endsWith("_delta")?e.slice(0,-6):e}function QA(e,t){const n=KA(t),r=YA(t);return n||r?e.findIndex(e=>{const i=KA(e),a=YA(e);return n&&i?e.index===t.index&&(s=t,("object"!=typeof(o=e)||null===o||"object"!=typeof s||null===s||!("type"in o)||!("type"in s)||"string"!=typeof o.type||"string"!=typeof s.type||qA(o.type)===qA(s.type))&&(!a||!r||e.id===t.id)):!(n||i||!r||!a)&&e.id===t.id;var o,s}):-1}function JA(e,t,n){if(null!=e||null!=t){if(null==e||null==t)return e||t;{const n=[...e];for(const e of t){const t=QA(n,e);if(-1!==t)n[t]=XA(n[t],e);else{if("object"==typeof e&&null!==e&&"text"in e&&""===e.text)continue;n.push(e)}}return n}}}function zA(e,t,n){if(null!=e||null!=t){if(null==e||null==t)return e??t;if(typeof e!=typeof t)throw new Error(`Cannot merge objects of different types.\nLeft ${typeof e}\nRight ${typeof t}`);if("string"==typeof e&&"string"==typeof t)return e+t;if(Array.isArray(e)&&Array.isArray(t))return JA(e,t);if("object"==typeof e&&"object"==typeof t)return XA(e,t);if(e===t)return e;throw new Error(`Can not merge objects of different types.\nLeft ${e}\nRight ${t}`)}}var ZA=class e extends jA{static isInstance(t){if(!super.isInstance(t))return!1;let n=Object.getPrototypeOf(t);for(;null!==n;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1}static[Symbol.hasInstance](e){return this.isInstance(e)}};function eS(e){return"function"==typeof e?._getType}function tS(e){return ZA.isInstance(e)}function nS(e){switch(e){case"csv":return"text/csv";case"doc":case"docx":return"application/vnd.openxmlformats-officedocument.wordprocessingml.document";case"html":return"text/html";case"md":return"text/markdown";case"pdf":return"application/pdf";case"txt":return"text/plain";case"xls":return"application/vnd.ms-excel";case"xlsx":return"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";case"gif":return"image/gif";case"jpeg":case"jpg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp";case"flv":return"video/flv";case"mkv":return"video/mkv";case"mov":return"video/mov";case"mp4":return"video/mp4";case"mpeg":return"video/mpeg";case"mpg":return"video/mpg";case"three_gp":return"video/three_gp";case"webm":return"video/webm";case"wmv":return"video/wmv";default:return"application/octet-stream"}}function rS(e){if(CA(e.document)&&CA(e.document.source)){const t=nS(CA(e.document)&&SA(e.document.format)?e.document.format:"");if(CA(e.document.source)){if(CA(e.document.source.s3Location)&&SA(e.document.source.s3Location.uri))return{type:"file",mimeType:t,fileId:e.document.source.s3Location.uri};if(TA(e.document.source.bytes))return{type:"file",mimeType:t,data:e.document.source.bytes};if(SA(e.document.source.text))return{type:"file",mimeType:t,data:Buffer.from(e.document.source.text).toString("base64")};if(AA(e.document.source.content))return{type:"file",mimeType:t,data:e.document.source.content.reduce((e,t)=>CA(t)&&SA(t.text)?e+t.text:e,"")}}}return{type:"non_standard",value:e}}function iS(e){if(IA(e,"image")&&CA(e.image)){const t=nS(CA(e.image)&&SA(e.image.format)?e.image.format:"");if(CA(e.image.source)){if(CA(e.image.source.s3Location)&&SA(e.image.source.s3Location.uri))return{type:"image",mimeType:t,fileId:e.image.source.s3Location.uri};if(TA(e.image.source.bytes))return{type:"image",mimeType:t,data:e.image.source.bytes}}}return{type:"non_standard",value:e}}function aS(e){if(IA(e,"video")&&CA(e.video)){const t=nS(CA(e.video)&&SA(e.video.format)?e.video.format:"");if(CA(e.video.source)){if(CA(e.video.source.s3Location)&&SA(e.video.source.s3Location.uri))return{type:"video",mimeType:t,fileId:e.video.source.s3Location.uri};if(TA(e.video.source.bytes))return{type:"video",mimeType:t,data:e.video.source.bytes}}}return{type:"non_standard",value:e}}function oS(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const e of t)IA(e,"reasoning")&&SA(e.reasoning)?yield{...e,type:"reasoning",reasoning:e.reasoning}:IA(e,"cache_point")?yield{type:"non_standard",value:e}:IA(e,"citations_content")&&CA(e.citationsContent)?yield{type:"text",text:AA(e.citationsContent.content)?e.citationsContent.content.reduce((e,t)=>CA(t)&&SA(t.text)?e+t.text:e,""):"",annotations:AA(e.citationsContent.citations)?e.citationsContent.citations.reduce((e,t)=>{if(CA(t)){const n=AA(t.sourceContent)?t.sourceContent.reduce((e,t)=>CA(t)&&SA(t.text)?e+t.text:e,""):"",r=_A(()=>{if(CA(t.location)){const e=t.location.documentChar||t.location.documentPage||t.location.documentChunk;if(CA(e))return{source:bA(e.documentIndex)?e.documentIndex.toString():void 0,startIndex:bA(e.start)?e.start:void 0,endIndex:bA(e.end)?e.end:void 0}}return{}});e.push({type:"citation",citedText:n,...r})}return e},[]):[]}:IA(e,"document")&&CA(e.document)?yield rS(e):IA(e,"guard_content")?yield{type:"non_standard",value:e}:IA(e,"image")&&CA(e.image)?yield iS(e):IA(e,"reasoning_content")&&CA(e.reasoningText)&&SA(e.reasoningText.text)?yield{type:"reasoning",reasoning:e.reasoningText.text,...SA(e.reasoningText.signature)?{signature:e.reasoningText.signature}:{}}:IA(e,"reasoning_content")&&SA(e.reasoningText)?yield{type:"reasoning",reasoning:e.reasoningText}:IA(e,"text")&&SA(e.text)?yield{type:"text",text:e.text}:IA(e,"tool_result")?yield{type:"non_standard",value:e}:IA(e,"tool_call")||(IA(e,"video")&&CA(e.video)?yield aS(e):yield{type:"non_standard",value:e})}())}const sS={translateContent:oS,translateContentChunk:oS};function cS(e){const t=[],n=e.additional_kwargs?.reasoning_content;if(SA(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const r of e.content)"object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&SA(r.text)&&t.push({type:"text",text:r.text});for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const lS={translateContent:cS,translateContentChunk:cS};function uS(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const n of t)IA(n,"text")&&SA(n.text)?yield{type:"text",text:n.text}:IA(n,"thinking")&&SA(n.thinking)?yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}}:IA(n,"inlineData")&&CA(n.inlineData)&&SA(n.inlineData.mimeType)&&SA(n.inlineData.data)?yield{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:IA(n,"functionCall")&&CA(n.functionCall)&&SA(n.functionCall.name)&&CA(n.functionCall.args)?yield{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:IA(n,"functionResponse")?yield{type:"non_standard",value:n}:IA(n,"fileData")&&CA(n.fileData)&&SA(n.fileData.mimeType)&&SA(n.fileData.fileUri)?yield{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:(IA(n,"executableCode")||IA(n,"codeExecutionResult"),yield{type:"non_standard",value:n})}())}const dS={translateContent:uS,translateContentChunk:uS};function pS(e){return Array.from(function*(){const t="string"==typeof e.content?[{type:"text",text:e.content}]:e.content;for(const n of t){if(IA(n,"reasoning")&&SA(n.reasoning)){const r=_A(()=>{const r=t.indexOf(n);if(AA(e.additional_kwargs?.signatures)&&r>=0)return e.additional_kwargs.signatures.at(r)});SA(r)?yield{type:"reasoning",reasoning:n.reasoning,signature:r}:yield{type:"reasoning",reasoning:n.reasoning};continue}if(IA(n,"thinking")&&SA(n.thinking))yield{type:"reasoning",reasoning:n.thinking,...n.signature?{signature:n.signature}:{}};else if(IA(n,"text")&&SA(n.text)){if(""===n.text)continue;yield{type:"text",text:n.text}}else if(IA(n,"image_url")){if(SA(n.image_url))if(n.image_url.startsWith("data:")){const e=n.image_url.match(/^data:([^;]+);base64,(.+)$/);e?yield{type:"image",data:e[2],mimeType:e[1]}:yield{type:"image",url:n.image_url}}else yield{type:"image",url:n.image_url}}else IA(n,"media")&&SA(n.mimeType)&&SA(n.data)?yield{type:"file",mimeType:n.mimeType,data:n.data}:yield{type:"non_standard",value:n}}for(const n of e.tool_calls??[])yield{type:"tool_call",id:n.id,name:n.name,args:n.args}}())}const hS={translateContent:pS,translateContentChunk:pS};function fS(e){const t=[],n=e.additional_kwargs?.reasoning;if(SA(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content){let n=e.content;const r=n.match(/<think>([\s\S]*?)<\/think>/);if(r){const e=r[1].trim();e.length>0&&t.push({type:"reasoning",reasoning:e}),n=n.replace(/<think>[\s\S]*?<\/think>/,"").trim()}n.length>0&&t.push({type:"text",text:n})}else for(const r of e.content)if("object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&SA(r.text)){let e=r.text;const n=e.match(/<think>([\s\S]*?)<\/think>/);if(n){const r=n[1].trim();r.length>0&&t.push({type:"reasoning",reasoning:r}),e=e.replace(/<think>[\s\S]*?<\/think>/,"").trim()}e.length>0&&t.push({type:"text",text:e})}for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const mS={translateContent:fS,translateContentChunk:fS};function gS(e){const t=[],n=e.additional_kwargs?.reasoning_content;if(SA(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const r of e.content)"object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&SA(r.text)&&t.push({type:"text",text:r.text});for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const yS={translateContent:gS,translateContentChunk:gS};function IS(e){const t=[],n=e.additional_kwargs?.reasoning_details;let r=!1;if(Array.isArray(n)&&n.length>0)for(const i of n){if(null==i||"object"!=typeof i)continue;const e=i.type;if("reasoning.summary"===e){const e=i.summary;SA(e)&&e.length>0&&(t.push({type:"reasoning",reasoning:e}),r=!0)}else if("reasoning.text"===e){const e=i.text;SA(e)&&e.length>0&&(t.push({type:"reasoning",reasoning:e}),r=!0)}}if(!r){const n=e.additional_kwargs?.reasoning_content;SA(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n})}if("string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const i of e.content)"object"==typeof i&&"type"in i&&"text"===i.type&&"text"in i&&SA(i.text)&&t.push({type:"text",text:i.text});for(const i of e.tool_calls??[])t.push({type:"tool_call",id:i.id,name:i.name,args:i.args});return t}const CS={translateContent:IS,translateContentChunk:IS};function AS(e){const t=[];if(CA(e.additional_kwargs?.reasoning)){const n=e.additional_kwargs.reasoning;if(AA(n.summary)){const e=n.summary.reduce((e,t)=>CA(t)&&SA(t.text)?`${e}${t.text}`:e,"");e.length>0&&t.push({type:"reasoning",reasoning:e})}}const n=e.additional_kwargs?.reasoning_content;if(SA(n)&&n.length>0&&t.push({type:"reasoning",reasoning:n}),"string"==typeof e.content)e.content.length>0&&t.push({type:"text",text:e.content});else for(const r of e.content)"object"==typeof r&&"type"in r&&"text"===r.type&&"text"in r&&SA(r.text)&&t.push({type:"text",text:r.text});for(const r of e.tool_calls??[])t.push({type:"tool_call",id:r.id,name:r.name,args:r.args});return t}const SS={translateContent:AS,translateContentChunk:AS};function bS(e){return Array.from(function*(){const t=_A(()=>{if("string"==typeof e.content)return e.additional_kwargs.originalTextContentBlock?[{...e.additional_kwargs.originalTextContentBlock,type:"text"}]:[{type:"text",text:e.content}];{const t=e.additional_kwargs?.originalTextContentBlock;if(t?.thoughtSignature&&!e.content.some(e=>"thoughtSignature"in e)){const n=[...e.content];for(let e=n.length-1;e>=0;e--){const r=n[e];if("text"===r.type&&!r.thought)return r.thoughtSignature=t.thoughtSignature,n}}return e.content}});for(const n of t){const t=_A(()=>IA(n,"text")&&SA(n.text)?{type:"text",text:n.text}:IA(n,"inlineData")&&CA(n.inlineData)&&SA(n.inlineData.mimeType)&&SA(n.inlineData.data)?{type:"file",mimeType:n.inlineData.mimeType,data:n.inlineData.data}:IA(n,"functionCall")&&CA(n.functionCall)&&SA(n.functionCall.name)&&CA(n.functionCall.args)?{type:"tool_call",id:e.id,name:n.functionCall.name,args:n.functionCall.args}:IA(n,"functionResponse")?{type:"non_standard",value:n}:IA(n,"fileData")&&CA(n.fileData)&&SA(n.fileData.mimeType)&&SA(n.fileData.fileUri)?{type:"file",mimeType:n.fileData.mimeType,fileId:n.fileData.fileUri}:(IA(n,"executableCode")||IA(n,"codeExecutionResult"),{type:"non_standard",value:n})),r=_A(()=>"thought"in n&&n.thought?{type:"reasoning",reasoning:"text"===t.type?t.text:"",reasoningContentBlock:t}:t),i={thought:n.thought,thoughtSignature:n.thoughtSignature,partMetadata:n.partMetadata,...r};for(const e in i)void 0===i[e]&&delete i[e];yield i}}())}const TS={translateContent:bS,translateContentChunk:bS};function vS(e){return globalThis.lc_block_translators_registry.get(e)}function _S(e,t){const n={};return void 0===e?.audio&&void 0===t?.audio||(n.audio=(e?.audio??0)+(t?.audio??0)),void 0===e?.image&&void 0===t?.image||(n.image=(e?.image??0)+(t?.image??0)),void 0===e?.video&&void 0===t?.video||(n.video=(e?.video??0)+(t?.video??0)),void 0===e?.document&&void 0===t?.document||(n.document=(e?.document??0)+(t?.document??0)),void 0===e?.text&&void 0===t?.text||(n.text=(e?.text??0)+(t?.text??0)),n}function wS(e,t){const n={..._S(e,t)};return void 0===e?.cache_read&&void 0===t?.cache_read||(n.cache_read=(e?.cache_read??0)+(t?.cache_read??0)),void 0===e?.cache_creation&&void 0===t?.cache_creation||(n.cache_creation=(e?.cache_creation??0)+(t?.cache_creation??0)),n}function ES(e,t){const n={..._S(e,t)};return void 0===e?.reasoning&&void 0===t?.reasoning||(n.reasoning=(e?.reasoning??0)+(t?.reasoning??0)),n}function PS(e,t){return{input_tokens:(e?.input_tokens??0)+(t?.input_tokens??0),output_tokens:(e?.output_tokens??0)+(t?.output_tokens??0),total_tokens:(e?.total_tokens??0)+(t?.total_tokens??0),input_token_details:wS(e?.input_token_details,t?.input_token_details),output_token_details:ES(e?.output_token_details,t?.output_token_details)}}globalThis.lc_block_translators_registry??=/* @__PURE__ */new Map([["anthropic",LA],["bedrock-converse",sS],["deepseek",lS],["google",TS],["google-genai",dS],["google-vertexai",hS],["groq",mS],["ollama",yS],["openai",HA],["openrouter",CS],["xai",SS]]);var RS=class extends jA{static lc_name(){return"ToolMessage"}get lc_aliases(){return{tool_call_id:"tool_call_id"}}lc_direct_tool_output=!0;type="tool";status;tool_call_id;metadata;artifact;constructor(e,t,n){const r="string"==typeof e||Array.isArray(e)?{content:e,name:n,tool_call_id:t}:e;super(r),this.tool_call_id=r.tool_call_id,this.artifact=r.artifact,this.status=r.status,this.metadata=r.metadata}static isInstance(e){return super.isInstance(e)&&"tool"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}},LS=class extends ZA{type="tool";tool_call_id;status;artifact;constructor(e){super(e),this.tool_call_id=e.tool_call_id,this.artifact=e.artifact,this.status=e.status}static lc_name(){return"ToolMessageChunk"}concat(e){return new(0,this.constructor)({content:$A(this.content,e.content),additional_kwargs:XA(this.additional_kwargs,e.additional_kwargs),response_metadata:XA(this.response_metadata,e.response_metadata),artifact:zA(this.artifact,e.artifact),tool_call_id:this.tool_call_id,id:this.id??e.id,status:(t=this.status,n=e.status,"error"===t||"error"===n?"error":"success")});var t,n}static isInstance(e){return super.isInstance(e)&&"tool"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,tool_call_id:this.tool_call_id,artifact:this.artifact}}};const NS=function e(t){const n=Symbol.for(t);return{brand(e,r){const i=r?/* @__PURE__ */Symbol.for(`${t}.${r}`):n;class a extends e{[i]=!0;constructor(...e){super(...e)}static isInstance(e){return"object"==typeof e&&null!==e&&i in e&&!0===e[i]}static[Symbol.hasInstance](e){return this.isInstance(e)}}return Object.defineProperty(a,"name",{value:e.name}),a},sub:n=>e(`${t}.${n}`),isInstance:e=>"object"==typeof e&&null!==e&&n in e&&!0===e[n]}}("langchain");function OS(e,t){return e.lc_error_code=t,e.message=`${e.message}\n\nTroubleshooting URL: https://docs.langchain.com/oss/javascript/langchain/errors/${t}/\n`,e}const BS=NS.sub("error"),MS=/* @__PURE__ */Symbol.for("langchain.errors.retryable");function DS(e,t){if("object"!=typeof e||null===e)return e;try{Object.defineProperty(e,MS,{value:t,configurable:!0})}catch{}return e}var FS=class extends(BS.brand(Error)){name="LangChainError";constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}},kS=class extends(BS.brand(FS,"model-abort")){name="ModelAbortError";partialOutput;constructor(e,t){super(e),this.partialOutput=t,DS(this,!1)}};function GS(e){return!(!e||"object"!=typeof e||!("type"in e)||"tool_call"!==e.type)}BS.brand(FS,"context-overflow");var HS=class extends Error{output;constructor(e,t){super(e),this.output=t}};function xS(e,t=VS){const n=(e=e.trim()).indexOf("```");if(-1===n)return t(e);let r=e.substring(n+3);r.startsWith("json\n")?r=r.substring(5):r.startsWith("json")?r=r.substring(4):r.startsWith("\n")&&(r=r.substring(1));const i=r.indexOf("```");let a=r;return-1!==i&&(a=r.substring(0,i)),t(a.trim())}function US(e){try{return JSON.parse(e)}catch{}const t=e.trim();if(0===t.length)throw new Error("Unexpected end of JSON input");let n=0;function r(){for(;n<t.length&&/\s/.test(t[n]);)n+=1}function i(){if('"'!==t[n])throw new Error(`Expected '"' at position ${n}, got '${t[n]}'`);n+=1;let e="",r=!1;for(;n<t.length;){const i=t[n];if(r){if("n"===i)e+="\n";else if("t"===i)e+="\t";else if("r"===i)e+="\r";else if("\\"===i)e+="\\";else if('"'===i)e+='"';else if("b"===i)e+="\b";else if("f"===i)e+="\f";else if("/"===i)e+="/";else{if("u"!==i)throw new Error(`Invalid escape sequence '\\${i}' at position ${n}`);{const r=t.substring(n+1,n+5);if(!/^[0-9A-Fa-f]{0,4}$/.test(r))throw new Error(`Invalid unicode escape sequence '\\u${r}' at position ${n}`);4===r.length?e+=String.fromCharCode(Number.parseInt(r,16)):e+=`u${r}`,n+=r.length}}r=!1}else if("\\"===i)r=!0;else{if('"'===i)return n+=1,e;e+=i}n+=1}return r&&(e+="\\"),e}function a(){if(r(),n>=t.length)throw new Error(`Unexpected end of input at position ${n}`);const e=t[n];if("{"===e)return function(){if("{"!==t[n])throw new Error(`Expected '{' at position ${n}, got '${t[n]}'`);const e={};if(n+=1,r(),n>=t.length)return e;if("}"===t[n])return n+=1,e;for(;n<t.length;){if(r(),n>=t.length)return e;const o=i();if(r(),n>=t.length)return e;if(":"!==t[n])throw new Error(`Expected ':' at position ${n}, got '${t[n]}'`);if(n+=1,r(),n>=t.length)return e;if(e[o]=a(),r(),n>=t.length)return e;if("}"===t[n])return n+=1,e;if(","!==t[n])throw new Error(`Expected ',' or '}' at position ${n}, got '${t[n]}'`);n+=1}return e}();if("["===e)return function(){if("["!==t[n])throw new Error(`Expected '[' at position ${n}, got '${t[n]}'`);const e=[];if(n+=1,r(),n>=t.length)return e;if("]"===t[n])return n+=1,e;for(;n<t.length;){if(r(),n>=t.length)return e;if(e.push(a()),r(),n>=t.length)return e;if("]"===t[n])return n+=1,e;if(","!==t[n])throw new Error(`Expected ',' or ']' at position ${n}, got '${t[n]}'`);n+=1}return e}();if('"'===e)return i();if("null".startsWith(t.substring(n,n+4)))return n+=Math.min(4,t.length-n),null;if("true".startsWith(t.substring(n,n+4)))return n+=Math.min(4,t.length-n),!0;if("false".startsWith(t.substring(n,n+5)))return n+=Math.min(5,t.length-n),!1;if("-"===e||e>="0"&&e<="9")return function(){const e=n;let r="";if("-"===t[n]&&(r+="-",n+=1),n<t.length&&"0"===t[n]&&(r+="0",n+=1,t[n]>="0"&&t[n]<="9"))throw new Error(`Invalid number at position ${e}`);if(n<t.length&&t[n]>="1"&&t[n]<="9")for(;n<t.length&&t[n]>="0"&&t[n]<="9";)r+=t[n],n+=1;if(n<t.length&&"."===t[n])for(r+=".",n+=1;n<t.length&&t[n]>="0"&&t[n]<="9";)r+=t[n],n+=1;if(n<t.length&&("e"===t[n]||"E"===t[n]))for(r+=t[n],n+=1,n<t.length&&("+"===t[n]||"-"===t[n])&&(r+=t[n],n+=1);n<t.length&&t[n]>="0"&&t[n]<="9";)r+=t[n],n+=1;if("-"===r)return-0;const i=Number.parseFloat(r);if(Number.isNaN(i))throw n=e,new Error(`Invalid number '${r}' at position ${e}`);return i}();throw new Error(`Unexpected character '${e}' at position ${n}`)}const o=a();if(r(),n<t.length)throw new Error(`Unexpected character '${t[n]}' at position ${n}`);return o}function VS(e){try{return void 0===e?null:US(e)}catch{return null}}var $S=class e extends jA{static lc_name(){return"ChatMessage"}type="generic";role;static _chatMessageClass(){return e}constructor(e,t){("string"==typeof e||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}static isInstance(e){return super.isInstance(e)&&"generic"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,role:this.role}}},jS=class extends ZA{static lc_name(){return"ChatMessageChunk"}type="generic";role;constructor(e,t){("string"==typeof e||Array.isArray(e))&&(e={content:e,role:t}),super(e),this.role=e.role}concat(e){return new(0,this.constructor)({content:$A(this.content,e.content),additional_kwargs:XA(this.additional_kwargs,e.additional_kwargs),response_metadata:XA(this.response_metadata,e.response_metadata),role:this.role,id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"generic"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}get _printableFields(){return{...super._printableFields,role:this.role}}},WS=class extends ZA{static lc_name(){return"FunctionMessageChunk"}type="function";concat(e){return new(0,this.constructor)({content:$A(this.content,e.content),additional_kwargs:XA(this.additional_kwargs,e.additional_kwargs),response_metadata:XA(this.response_metadata,e.response_metadata),name:this.name??"",id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"function"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},XS=class extends jA{static lc_name(){return"HumanMessage"}type="human";constructor(e){super(e)}static isInstance(e){return super.isInstance(e)&&"human"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},KS=class extends ZA{static lc_name(){return"HumanMessageChunk"}type="human";constructor(e){super(e)}concat(e){return new(0,this.constructor)({content:$A(this.content,e.content),additional_kwargs:XA(this.additional_kwargs,e.additional_kwargs),response_metadata:XA(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"human"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},YS=class extends jA{type="remove";id;constructor(e){super({...e,content:[]}),this.id=e.id}get _printableFields(){return{...super._printableFields,id:this.id}}static isInstance(e){return super.isInstance(e)&&"remove"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},qS=class e extends jA{static lc_name(){return"SystemMessage"}type="system";constructor(e){super(e)}concat(t){if("string"==typeof t)return new e({content:$A(this.content,t),additional_kwargs:this.additional_kwargs,response_metadata:this.response_metadata,id:this.id,name:this.name});if(e.isInstance(t))return new e({content:$A(this.content,t.content),additional_kwargs:{...this.additional_kwargs,...t.additional_kwargs},response_metadata:{...this.response_metadata,...t.response_metadata},id:this.id??t.id,name:this.name??t.name});throw new Error("Unexpected chunk type for system message")}static isInstance(e){return super.isInstance(e)&&"system"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}},QS=class extends ZA{static lc_name(){return"SystemMessageChunk"}type="system";constructor(e){super(e)}concat(e){return new(0,this.constructor)({content:$A(this.content,e.content),additional_kwargs:XA(this.additional_kwargs,e.additional_kwargs),response_metadata:XA(this.response_metadata,e.response_metadata),id:this.id??e.id})}static isInstance(e){return super.isInstance(e)&&"system"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}};function JS(e){return!0===e.isCustomTool}function zS(e){return GS(e)?e:"string"==typeof e.id&&"function"===e.type&&"object"==typeof e.function&&null!==e.function&&"arguments"in e.function&&"string"==typeof e.function.arguments&&"name"in e.function&&"string"==typeof e.function.name?{id:e.id,args:JSON.parse(e.function.arguments),name:e.function.name,type:"tool_call"}:e}function ZS(e){let t,n;if("object"==typeof(r=e)&&null!=r&&1===r.lc&&Array.isArray(r.id)&&null!=r.kwargs&&"object"==typeof r.kwargs){const r=e.id.at(-1);t="HumanMessage"===r||"HumanMessageChunk"===r?"user":"AIMessage"===r||"AIMessageChunk"===r?"assistant":"SystemMessage"===r||"SystemMessageChunk"===r?"system":"FunctionMessage"===r||"FunctionMessageChunk"===r?"function":"ToolMessage"===r||"ToolMessageChunk"===r?"tool":"unknown",n=e.kwargs}else{const{type:r,...i}=e;t=r,n=i}var r;if("human"===t||"user"===t)return new XS(n);if("ai"===t||"assistant"===t){const{tool_calls:e,...t}=n;if(!Array.isArray(e))return new ab(n);const r=e.map(zS);return new ab({...t,tool_calls:r})}if("system"===t)return new qS(n);if("developer"===t)return new qS({...n,additional_kwargs:{...n.additional_kwargs,__openai_role__:"developer"}});if("tool"===t&&"tool_call_id"in n)return new RS({...n,content:n.content,tool_call_id:n.tool_call_id,name:n.name});if("remove"===t&&"id"in n&&"string"==typeof n.id)return new YS({...n,id:n.id});throw OS(/* @__PURE__ */new Error(`Unable to coerce message from array: only human, AI, system, developer, or tool message coercion is currently supported.\n\nReceived: ${JSON.stringify(e,null,2)}`),"MESSAGE_COERCION_FAILURE")}function eb(e){if("string"==typeof e)return new XS(e);if(eS(e))return e;if(Array.isArray(e)){const[t,n]=e;return ZS({type:t,content:n})}if("string"==typeof e.role){const{role:t,...n}=e;return ZS({...n,type:t})}return ZS(e)}function tb(e){if("string"==typeof e)return e;switch(e.type){case"text":return e.text??"";case"text-plain":return e.text??"[text-plain file]";case"image":case"image_url":return"[image]";case"audio":case"input_audio":return"[audio]";case"video":return"[video]";case"file":return"[file]";case"reasoning":case"tool_call":case"tool_call_chunk":case"invalid_tool_call":case"server_tool_call":case"server_tool_call_chunk":case"server_tool_call_result":case"non_standard":return"";default:return e.type?`[${e.type}]`:""}}function nb(e,t="Human",n="AI"){const r=[];for(const i of e){let e;if("human"===i.type)e=t;else if("ai"===i.type)e=n;else if("system"===i.type)e="System";else if("tool"===i.type)e="Tool";else{if("generic"!==i.type)throw new Error(`Got unsupported message type: ${i.type}`);e=i.role}let a=`${e}: ${i.name?`${i.name}, `:""}${"string"==typeof i.content?i.content:Array.isArray(i.content)?i.content.map(tb).filter(Boolean).join(""):""}`;if("ai"===i.type){const e=i;e.tool_calls&&e.tool_calls.length>0?a+=JSON.stringify(e.tool_calls):e.additional_kwargs&&"function_call"in e.additional_kwargs&&(a+=JSON.stringify(e.additional_kwargs.function_call))}r.push(a)}return r.join("\n")}function rb(e){const t=e._getType();if("human"===t)return new KS({...e});if("ai"===t){let t={...e};return"tool_calls"in t&&(t={...t,tool_call_chunks:t.tool_calls?.map(e=>({...e,type:"tool_call_chunk",index:void 0,args:JSON.stringify(e.args)}))}),new cb({...t})}if("system"===t)return new QS({...e});if("function"===t)return new WS({...e});if($S.isInstance(e))return new jS({...e});throw new Error("Unknown message type.")}function ib(e){return"string"==typeof e?e.length>0?[{type:"text",text:e}]:[]:Array.isArray(e)?e:null==e?[]:[e]}var ab=class extends jA{type="ai";tool_calls=[];invalid_tool_calls=[];usage_metadata;get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",usage_metadata:"usage_metadata"}}constructor(e){let t;if("string"==typeof e||Array.isArray(e))t={content:e,tool_calls:[],invalid_tool_calls:[],additional_kwargs:{}};else{t=e;const n=t.additional_kwargs?.tool_calls,r=t.tool_calls;null!=n&&n.length>0&&(void 0===r||0===r.length)&&console.warn(["New LangChain packages are available that more efficiently handle","tool calling.\n\nPlease upgrade your packages to versions that set","message tool calls. e.g., `pnpm install @langchain/anthropic`,","pnpm install @langchain/openai`, etc."].join(" "));try{if(null!=n&&void 0===r){const[e,r]=function(e){const t=[],n=[];for(const r of e)if(r.function){const e=r.function.name;try{const n=JSON.parse(r.function.arguments);t.push({name:e||"",args:n||{},id:r.id})}catch{n.push({name:e,args:r.function.arguments,id:r.id,error:"Malformed args."})}}return[t,n]}(n);t.tool_calls=e??[],t.invalid_tool_calls=r??[]}else t.tool_calls=t.tool_calls??[],t.invalid_tool_calls=t.invalid_tool_calls??[]}catch{t.tool_calls=[],t.invalid_tool_calls=[]}if(void 0!==t.response_metadata&&"output_version"in t.response_metadata&&"v1"===t.response_metadata.output_version&&void 0!==t.content&&(t.contentBlocks=ib(t.content),t.content=void 0),void 0!==t.contentBlocks){if(Array.isArray(t.contentBlocks)||(t.contentBlocks=ib(t.contentBlocks)),t.tool_calls){const e=t.tool_calls.filter(e=>!t.contentBlocks?.some(t=>"tool_call"===t.type&&t.id===e.id&&t.name===e.name));t.contentBlocks.push(...e.map(e=>({type:"tool_call",id:e.id,name:e.name,args:e.args})))}const e=t.contentBlocks.filter(e=>"tool_call"===e.type).filter(e=>!t.tool_calls?.some(t=>t.id===e.id&&t.name===e.name));e.length>0&&(t.tool_calls=[...t.tool_calls??[],...e.map(e=>({type:"tool_call",id:e.id,name:e.name,args:e.args}))])}}super(t),"string"!=typeof t&&(this.tool_calls=t.tool_calls??this.tool_calls,this.invalid_tool_calls=t.invalid_tool_calls??this.invalid_tool_calls),this.usage_metadata=t.usage_metadata}static lc_name(){return"AIMessage"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&"v1"===this.response_metadata.output_version)return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&"string"==typeof this.response_metadata.model_provider){const e=vS(this.response_metadata.model_provider);if(e)return e.translateContent(this)}const e=super.contentBlocks;if(this.tool_calls){const t=this.tool_calls.filter(t=>!e.some(e=>e.id===t.id&&e.name===t.name));e.push(...t.map(e=>({type:"tool_call",id:e.id,name:e.name,args:e.args})))}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}static isInstance(e){return super.isInstance(e)&&"ai"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}};function ob(e){return"ai"===e._getType()}function sb(e){return"ai"===e._getType()}var cb=class extends ZA{type="ai";tool_calls=[];invalid_tool_calls=[];tool_call_chunks=[];usage_metadata;constructor(e){let t;if("string"==typeof e||Array.isArray(e))t={content:e,tool_calls:[],invalid_tool_calls:[],tool_call_chunks:[]};else if(void 0===e.tool_call_chunks||0===e.tool_call_chunks.length)t={...e,tool_calls:e.tool_calls??[],invalid_tool_calls:[],tool_call_chunks:[],usage_metadata:void 0!==e.usage_metadata?e.usage_metadata:void 0};else{const n=function(e){const t=e.reduce((e,t)=>{const n=e.findIndex(([e])=>"id"in t&&t.id&&"index"in t&&void 0!==t.index?t.id===e.id&&t.index===e.index:"id"in t&&t.id?t.id===e.id:"index"in t&&void 0!==t.index&&t.index===e.index);return-1!==n?e[n].push(t):e.push([t]),e},[]),n=[],r=[];for(const i of t){let e=null;const t=i.some(JS),a=i[0]?.name??"",o=i.map(e=>e.args||"").join(""),s=t?o:o.trim(),c=s.length?s:"{}",l=i.find(e=>e.id)?.id??i[0]?.id;if(t&&l)n.push({name:a,args:{input:s},id:l,type:"tool_call"});else try{if(e=VS(c),!l||null===e||"object"!=typeof e||Array.isArray(e))throw new Error("Malformed tool call chunk args.");n.push({name:a,args:e,id:l,type:"tool_call"})}catch{r.push({name:a,args:c,id:l,error:"Malformed args.",type:"invalid_tool_call"})}}return{tool_call_chunks:e,tool_calls:n,invalid_tool_calls:r}}(e.tool_call_chunks??[]);t={...e,tool_call_chunks:n.tool_call_chunks,tool_calls:n.tool_calls,invalid_tool_calls:n.invalid_tool_calls,usage_metadata:void 0!==e.usage_metadata?e.usage_metadata:void 0}}super(t),this.tool_call_chunks=t.tool_call_chunks??this.tool_call_chunks,this.tool_calls=t.tool_calls??this.tool_calls,this.invalid_tool_calls=t.invalid_tool_calls??this.invalid_tool_calls,this.usage_metadata=t.usage_metadata}get lc_aliases(){return{...super.lc_aliases,tool_calls:"tool_calls",invalid_tool_calls:"invalid_tool_calls",tool_call_chunks:"tool_call_chunks",usage_metadata:"usage_metadata"}}static lc_name(){return"AIMessageChunk"}get contentBlocks(){if(this.response_metadata&&"output_version"in this.response_metadata&&"v1"===this.response_metadata.output_version)return this.content;if(this.response_metadata&&"model_provider"in this.response_metadata&&"string"==typeof this.response_metadata.model_provider){const e=vS(this.response_metadata.model_provider);if(e)return e.translateContent(this)}const e=super.contentBlocks;if(this.tool_calls&&"string"!=typeof this.content){const t=this.content.filter(e=>"tool_call"===e.type).map(e=>e.id);for(const n of this.tool_calls)n.id&&!t.includes(n.id)&&e.push({...n,type:"tool_call",id:n.id,name:n.name,args:n.args})}return e}get _printableFields(){return{...super._printableFields,tool_calls:this.tool_calls,tool_call_chunks:this.tool_call_chunks,invalid_tool_calls:this.invalid_tool_calls,usage_metadata:this.usage_metadata}}concat(e){const t={content:$A(this.content,e.content),additional_kwargs:XA(this.additional_kwargs,e.additional_kwargs),response_metadata:(n=this.response_metadata,r=e.response_metadata,XA(n,r)??{}),tool_call_chunks:[],tool_calls:[],id:this.id??e.id};var n,r;if(void 0!==this.tool_call_chunks||void 0!==e.tool_call_chunks){const n=JA(this.tool_call_chunks,e.tool_call_chunks);void 0!==n&&n.length>0&&(t.tool_call_chunks=n)}if(void 0!==this.tool_calls||void 0!==e.tool_calls){const n=JA(this.tool_calls,e.tool_calls);void 0!==n&&n.length>0&&(t.tool_calls=n)}void 0===this.usage_metadata&&void 0===e.usage_metadata||(t.usage_metadata=PS(this.usage_metadata,e.usage_metadata));return new(0,this.constructor)(t)}static isInstance(e){return super.isInstance(e)&&"ai"===e.type}static[Symbol.hasInstance](e){return this.isInstance(e)}};const lb={wav:"audio/wav",mp3:"audio/mpeg",flac:"audio/flac",opus:"audio/opus",aac:"audio/aac",pcm16:"audio/pcm"},ub={png:"image/png",jpeg:"image/jpeg",jpg:"image/jpeg",webp:"image/webp",gif:"image/gif"};function db(e){let t=0;for(const n of e.keys())n>=t&&(t=n+1);return t}function pb(e){const t=e.additional_kwargs;return null!=t&&"object"==typeof t?t:{}}function hb(e){const t=pb(e).tool_outputs;if(!Array.isArray(t))return[];const n=[];for(const r of t){if(null==r||"object"!=typeof r)continue;const e=r;if("image_generation_call"!==e.type)continue;const t="string"==typeof e.result?e.result:void 0,i="string"==typeof e.url?e.url:void 0;if(null==t&&null==i)continue;const a="string"==typeof e.output_format?e.output_format.toLowerCase():void 0,o=(null!=a?ub[a]:void 0)??"image/png";n.push({type:"image",..."string"==typeof e.id?{id:e.id}:{},...null!=i?{url:i}:{},...null!=t?{data:t}:{},mimeType:o})}return n}function fb(e){const t=pb(e).audio;if(null==t||"object"!=typeof t)return;const n=t,r="string"==typeof n.data?n.data:void 0,i="string"==typeof n.url?n.url:void 0,a="string"==typeof n.transcript?n.transcript:void 0;if(null==r&&null==i&&null==a)return;const o="string"==typeof n.mime_type?n.mime_type:"string"==typeof n.mimeType?n.mimeType:void 0,s="string"==typeof n.format?n.format.toLowerCase():void 0,c=o??(null!=s?lb[s]:void 0)??(null!=r?"audio/wav":"audio/pcm");return{..."string"==typeof n.id?{id:n.id}:{},...null!=r?{data:r}:{},...null!=i?{url:i}:{},...null!=a?{transcript:a}:{},mimeType:c}}function mb(e,t){switch(t.type){case"text-delta":return"text"===e.type?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return"thinking"===e.type?{...e,thinking:(e.thinking??"")+t.reasoning}:"reasoning"===e.type?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function gb(e){if("text"===e.type)return{type:"text-delta",text:e.text};if("reasoning"===e.type)return{type:"reasoning-delta",reasoning:e.reasoning};if("thinking"===e.type&&"string"==typeof e.thinking)return{type:"reasoning-delta",reasoning:e.thinking};if("string"==typeof e.data)return{type:"data-delta",data:e.data,encoding:"base64"};if("string"==typeof e.type)return{type:"block-delta",fields:{...e}};throw new Error(`Unsupported content block delta: ${JSON.stringify(e)}`)}function yb(e){if("tool_call_chunk"===e.type){const t=e;let n;try{n=JSON.parse(t.args??"{}")}catch{return{type:"invalid_tool_call",id:t.id,name:t.name,args:t.args,error:"Failed to parse tool call arguments as JSON"}}return{type:"tool_call",id:t.id,name:t.name,args:n}}return e}function Ib(e){const t=e.reasoning_content??e.reasoning;return"string"==typeof t&&t.length>0?t:void 0}function Cb(e){return{input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0}}function Ab(e){switch(e){case"stop":default:return"stop";case"length":case"max_tokens":return"length";case"tool_calls":case"function_call":return"tool_use";case"content_filter":return"content_filter"}}function Sb(e){const t={...null!=e.prompt_tokens_details?.audio_tokens&&{audio:e.prompt_tokens_details.audio_tokens},...null!=e.prompt_tokens_details?.cached_tokens&&{cache_read:e.prompt_tokens_details.cached_tokens}},n={...null!=e.completion_tokens_details?.audio_tokens&&{audio:e.completion_tokens_details.audio_tokens},...null!=e.completion_tokens_details?.reasoning_tokens&&{reasoning:e.completion_tokens_details.reasoning_tokens}};return{input_tokens:e.prompt_tokens??0,output_tokens:e.completion_tokens??0,total_tokens:e.total_tokens??0,...Object.keys(t).length>0&&{input_token_details:t},...Object.keys(n).length>0&&{output_token_details:n}}}function bb(e,t){return{model_provider:"openai",model_name:e.model,system_fingerprint:e.system_fingerprint,service_tier:e.service_tier,finish_reason:t.finish_reason,...e.usage?{usage:e.usage}:{}}}const Tb=()=>"undefined"!=typeof Deno,vb=()=>{let e;return e="undefined"!=typeof window&&void 0!==window.document?"browser":"undefined"==typeof process||void 0===process.versions||void 0===process.versions.node||Tb()?"object"==typeof globalThis&&globalThis.constructor&&"DedicatedWorkerGlobalScope"===globalThis.constructor.name?"webworker":"undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&navigator.userAgent.includes("jsdom")?"jsdom":Tb()?"deno":"other":"node",e};let _b;function wb(e){try{return"undefined"!=typeof process?process.env?.[e]:Tb()?Deno?.env.get(e):void 0}catch{return}}var Eb=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;const Pb=[];for(let eM=0;eM<256;++eM)Pb.push((eM+256).toString(16).slice(1));function Rb(e,t=0){return(Pb[e[t+0]]+Pb[e[t+1]]+Pb[e[t+2]]+Pb[e[t+3]]+"-"+Pb[e[t+4]]+Pb[e[t+5]]+"-"+Pb[e[t+6]]+Pb[e[t+7]]+"-"+Pb[e[t+8]]+Pb[e[t+9]]+"-"+Pb[e[t+10]]+Pb[e[t+11]]+Pb[e[t+12]]+Pb[e[t+13]]+Pb[e[t+14]]+Pb[e[t+15]]).toLowerCase()}const Lb=/* @__PURE__ */new Uint8Array(16);function Nb(){return crypto.getRandomValues(Lb)}const Ob={};function Bb(e,t,n,r,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else r=/* @__PURE__ */new Uint8Array(16),i=0;return t??=Date.now(),n??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=255&t,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|3&e[10],r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}const Mb=function(e,t,n){return t||e||!crypto.randomUUID?function(e,t,n){e=e||{};const r=e.random??e.rng?.()??Nb();if(r.length<16)throw new Error("Random bytes length must be >= 16");if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){if((n=n||0)<0||n+16>t.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return Rb(r)}(e,t,n):crypto.randomUUID()},Db=function(e,t,n){let r;if(e)r=Bb(e.random??e.rng?.()??Nb(),e.msecs,e.seq,t,n);else{const e=Date.now(),i=Nb();!function(e,t,n){e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++)}(Ob,e,i),r=Bb(i,Ob.msecs,Ob.seq,t,n)}return t??Rb(r)},Fb=function(e){return"string"==typeof e&&Eb.test(e)};var kb=class{};function Gb(e){return"lc_prefer_streaming"in e&&e.lc_prefer_streaming}function Hb(e){return"lc_prefer_chat_model_stream_events"in e&&e.lc_prefer_chat_model_stream_events}var xb=class extends kb{lc_serializable=!1;get lc_namespace(){return["langchain_core","callbacks",this.name]}get lc_secrets(){}get lc_attributes(){}get lc_aliases(){}get lc_serializable_keys(){}static lc_name(){return this.name}get lc_id(){return[...this.lc_namespace,dA(this.constructor)]}lc_kwargs;ignoreLLM=!1;ignoreChain=!1;ignoreAgent=!1;ignoreRetriever=!1;ignoreCustomEvent=!1;raiseError=!1;awaitHandlers="false"===wb("LANGCHAIN_CALLBACKS_BACKGROUND");constructor(e){super(),this.lc_kwargs=e||{},e&&(this.ignoreLLM=e.ignoreLLM??this.ignoreLLM,this.ignoreChain=e.ignoreChain??this.ignoreChain,this.ignoreAgent=e.ignoreAgent??this.ignoreAgent,this.ignoreRetriever=e.ignoreRetriever??this.ignoreRetriever,this.ignoreCustomEvent=e.ignoreCustomEvent??this.ignoreCustomEvent,this.raiseError=e.raiseError??this.raiseError,this.awaitHandlers=this.raiseError||(e._awaitHandler??this.awaitHandlers))}copy(){return new this.constructor(this)}toJSON(){return pA.prototype.toJSON.call(this)}toJSONNotImplemented(){return pA.prototype.toJSONNotImplemented.call(this)}static fromMethods(e){return new class extends xb{name=Db();constructor(){super(),Object.assign(this,e)}}}};const Ub=e=>{const t=e;return void 0!==t&&"function"==typeof t.copy&&"string"==typeof t.name&&"boolean"==typeof t.awaitHandlers},Vb=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function $b(e){if(!function(e){return"string"==typeof e&&Vb.test(e)}(e))throw TypeError("Invalid UUID");let t;return Uint8Array.of((t=parseInt(e.slice(0,8),16))>>>24,t>>>16&255,t>>>8&255,255&t,(t=parseInt(e.slice(9,13),16))>>>8,255&t,(t=parseInt(e.slice(14,18),16))>>>8,255&t,(t=parseInt(e.slice(19,23),16))>>>8,255&t,(t=parseInt(e.slice(24,36),16))/1099511627776&255,t/4294967296&255,t>>>24&255,t>>>16&255,t>>>8&255,255&t)}const jb=[];for(let eM=0;eM<256;++eM)jb.push((eM+256).toString(16).slice(1));function Wb(e,t=0){return(jb[e[t+0]]+jb[e[t+1]]+jb[e[t+2]]+jb[e[t+3]]+"-"+jb[e[t+4]]+jb[e[t+5]]+"-"+jb[e[t+6]]+jb[e[t+7]]+"-"+jb[e[t+8]]+jb[e[t+9]]+"-"+jb[e[t+10]]+jb[e[t+11]]+jb[e[t+12]]+jb[e[t+13]]+jb[e[t+14]]+jb[e[t+15]]).toLowerCase()}const Xb=new Uint8Array(16);function Kb(){return crypto.getRandomValues(Xb)}function Yb(e,t,n){return crypto.randomUUID?crypto.randomUUID():function(e){e=e||{};const t=e.random??e.rng?.()??Kb();if(t.length<16)throw new Error("Random bytes length must be >= 16");return t[6]=15&t[6]|64,t[8]=63&t[8]|128,Wb(t)}(e)}function qb(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function Qb(e,t){return e<<t|e>>>32-t}function Jb(e){const t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(e.length+1);r.set(e),r[e.length]=128;const i=(e=r).length/4+2,a=Math.ceil(i/16),o=new Array(a);for(let s=0;s<a;++s){const t=new Uint32Array(16);for(let n=0;n<16;++n)t[n]=e[64*s+4*n]<<24|e[64*s+4*n+1]<<16|e[64*s+4*n+2]<<8|e[64*s+4*n+3];o[s]=t}o[a-1][14]=8*(e.length-1)/2**32,o[a-1][14]=Math.floor(o[a-1][14]),o[a-1][15]=8*(e.length-1)&4294967295;for(let s=0;s<a;++s){const e=new Uint32Array(80);for(let t=0;t<16;++t)e[t]=o[s][t];for(let t=16;t<80;++t)e[t]=Qb(e[t-3]^e[t-8]^e[t-14]^e[t-16],1);let r=n[0],i=n[1],a=n[2],c=n[3],l=n[4];for(let n=0;n<80;++n){const o=Math.floor(n/20),s=Qb(r,5)+qb(o,i,a,c)+l+t[o]+e[n]>>>0;l=c,c=a,a=Qb(i,30)>>>0,i=r,r=s}n[0]=n[0]+r>>>0,n[1]=n[1]+i>>>0,n[2]=n[2]+a>>>0,n[3]=n[3]+c>>>0,n[4]=n[4]+l>>>0}return Uint8Array.of(n[0]>>24,n[0]>>16,n[0]>>8,n[0],n[1]>>24,n[1]>>16,n[1]>>8,n[1],n[2]>>24,n[2]>>16,n[2]>>8,n[2],n[3]>>24,n[3]>>16,n[3]>>8,n[3],n[4]>>24,n[4]>>16,n[4]>>8,n[4])}function zb(e,t,n,r,i,a){const o="string"==typeof n?function(e){e=unescape(encodeURIComponent(e));const t=new Uint8Array(e.length);for(let n=0;n<e.length;++n)t[n]=e.charCodeAt(n);return t}(n):n,s="string"==typeof r?$b(r):r;if("string"==typeof r&&(r=$b(r)),16!==r?.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+o.length);if(c.set(s),c.set(o,s.length),c=t(c),c[6]=15&c[6]|e,c[8]=63&c[8]|128,i){if(a??=0,a<0||a+16>i.length)throw new RangeError(`UUID byte range ${a}:${a+15} is out of buffer bounds`);for(let e=0;e<16;++e)i[a+e]=c[e];return i}return Wb(c)}function Zb(e,t,n,r){return zb(80,Jb,e,t,n,r)}Zb.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Zb.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";const eT={};function tT(e,t,n){let r;if(e)r=nT(e.random??e.rng?.()??Kb(),e.msecs,e.seq,t,n);else{const e=Date.now(),i=Kb();!function(e,t,n){e.msecs??=-1/0,e.seq??=0,t>e.msecs?(e.seq=n[6]<<23|n[7]<<16|n[8]<<8|n[9],e.msecs=t):(e.seq=e.seq+1|0,0===e.seq&&e.msecs++)}(eT,e,i),r=nT(i,eT.msecs,eT.seq,t,n)}return t??Wb(r)}function nT(e,t,n,r,i=0){if(e.length<16)throw new Error("Random bytes length must be >= 16");if(r){if(i<0||i+16>r.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`)}else r=new Uint8Array(16),i=0;return t??=Date.now(),n??=127*e[6]<<24|e[7]<<16|e[8]<<8|e[9],r[i++]=t/1099511627776&255,r[i++]=t/4294967296&255,r[i++]=t/16777216&255,r[i++]=t/65536&255,r[i++]=t/256&255,r[i++]=255&t,r[i++]=112|n>>>28&15,r[i++]=n>>>20&255,r[i++]=128|n>>>14&63,r[i++]=n>>>6&255,r[i++]=n<<2&255|3&e[10],r[i++]=e[11],r[i++]=e[12],r[i++]=e[13],r[i++]=e[14],r[i++]=e[15],r}const rT="gen_ai.request.model",iT="gen_ai.usage.input_tokens",aT="gen_ai.usage.output_tokens",oT="gen_ai.usage.total_tokens",sT="langsmith.span.tags",cT="langsmith.usage_metadata",lT=(...e)=>fetch(...e),uT=/* @__PURE__ */Symbol.for("ls:fetch_implementation"),dT=e=>async(...t)=>{if(e||"true"===Vv("DEBUG")){const[e,n]=t;console.log(`→ ${n?.method||"GET"} ${e}`)}const n=await(globalThis[uT]??lT)(...t);return(e||"true"===Vv("DEBUG"))&&console.log(`← ${n.status} ${n.statusText} ${n.url}`),n},pT=()=>Vv("PROJECT")??Uv("LANGCHAIN_SESSION")??"default",hT={};function fT(e,t){const n=t?.code??e;hT[n]||(hT[n]=!0,t?.type&&"undefined"!=typeof process&&"function"==typeof process.emitWarning?process.emitWarning(e,{type:t.type,code:t.code}):t?.type&&t?.code?console.warn(`${t.type} [${t.code}]: ${e}`):console.warn(e))}const mT=e=>BigInt(e),gT=mT("0x9E3779B1"),yT=mT("0x85EBCA77"),IT=mT("0xC2B2AE3D"),CT=mT("0x9E3779B185EBCA87"),AT=mT("0xC2B2AE3D27D4EB4F"),ST=mT("0x165667B19E3779F9"),bT=mT("0x85EBCA77C2B2AE63"),TT=mT("0x27D4EB2F165667C5"),vT=mT("0x165667919E3779F9"),_T=mT("0x9FB21C651E98DF25");const wT=function(e){const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.substring(n,n+2),16);return t}("b8fe6c3923a44bbe7c01812cf721ad1cded46de9839097db7240a4a4b7b3671fcb79e64eccc0e578825ad07dccff7221b8084674f743248ee03590e6813a264c3c2852bb91c300cb88d0658b1b532ea371644897a20df94e3819ef46a9deacd8a8fa763fe39c343ff9dcbbc7c70b4f1d8a51e04bcdb45931c89f7ec9d9787364eac5ac8334d3ebc3c581a0fffa1363eb170ddd51b7f0da49d316552629d4689e2b16be587d47a1fc8ff8b8d17ad031ce45cb3a8f95160428afd7fbcabb4b407e"),ET=(mT(1)<<mT(128))-mT(1),PT=(mT(1)<<mT(64))-mT(1),RT=(mT(1)<<mT(32))-mT(1),LT=64;function NT(e,t=0){return new Uint8Array(e.buffer,e.byteOffset+t,e.length-t)}function OT(e,t=0){return new DataView(e.buffer,e.byteOffset+t).getBigUint64(0,!0)}function BT(e,t=0){return new DataView(e.buffer,e.byteOffset+t).getUint32(0,!0)}function MT(e,t=0){return e[t]}const DT=(e,t)=>(e&RT)*(t&RT)&PT,FT=e=>{if(!e)throw new Error("Assert failed")};function kT(e,t,n){for(let r=0;r<8;r++){const i=OT(t,8*r),a=i^OT(n,8*r);e[1^r]+=i,e[r]+=DT(a,a>>mT(32))}return e}function GT(e,t,n,r){for(let i=0;i<r;i++)kT(e,NT(t,i*LT),NT(n,8*i));return e}function HT(e,t){for(let n=0;n<8;n++){const r=OT(t,8*n);let i=e[n];i=qT(i,mT(47)),i^=r,i*=gT,e[n]=i&PT}return e}function xT(e,t){return $T(e[0]^OT(t,0),e[1]^OT(t,8))}function UT(e,t,n){let r=n;return r+=xT(e.slice(0),NT(t,0)),r+=xT(e.slice(2),NT(t,16)),r+=xT(e.slice(4),NT(t,32)),r+=xT(e.slice(6),NT(t,48)),XT(r&PT)}function VT(e,t,n){let r=new BigUint64Array([IT,CT,AT,ST,bT,yT,TT,gT]);FT(e.length>128),r=function(e,t,n,r,i){const a=Math.floor((n.byteLength-LT)/8),o=LT*a,s=Math.floor((t.byteLength-1)/o);for(let c=0;c<s;c++)e=i(e=GT(e,NT(t,c*o),n,a),NT(n,n.byteLength-LT));{const i=Math.floor((t.byteLength-1-o*s)/LT);e=r(e=GT(e,NT(t,s*o),n,i),NT(t,t.byteLength-LT),NT(n,n.byteLength-LT-7))}return e}(r,e,t,kT,HT),FT(8*r.length==64);{const n=UT(r,NT(t,11),mT(e.byteLength)*CT&PT);return UT(r,NT(t,t.byteLength-LT-11),~(mT(e.byteLength)*AT)&PT)<<mT(64)|n}}function $T(e,t){const n=e*t&ET;return n&PT^n>>mT(64)}function jT(e,t,n){return $T((OT(e,0)^OT(t,0)+n)&PT,(OT(e,8)^OT(t,8)-n)&PT)}function WT(e,t,n,r,i){let a=e&PT,o=e>>mT(64)&PT;return a+=jT(t,r,i),a^=OT(n,0)+OT(n,8),a&=PT,o+=jT(n,NT(r,16),i),o^=OT(t,0)+OT(t,8),o&=PT,o<<mT(64)|a}function XT(e){return e^=e>>mT(37),e*=vT,e&=PT,e^=e>>mT(32)}function KT(e){return e^=e>>mT(33),e*=AT,e&=PT,e^=e>>mT(29),e*=ST,e&=PT,e^=e>>mT(32)}function YT(e,t,n){const r=e.byteLength;FT(r>0&&r<=3);const i=mT(MT(e,r-1))|mT(r<<8)|mT(MT(e,0)<<16)|mT(MT(e,r>>1)<<24),a=(i^(mT(BT(t,0))^mT(BT(t,4)))+n)&PT,o=(mT(BT(t,8))^mT(BT(t,12)))-n;var s;return(KT((function(e,t){return(e<<t|e>>mT(32)-t)&RT}(((s=((s=i)&mT(65535))<<mT(16)|(s&mT(4294901760))>>mT(16))&mT(16711935))<<mT(8)|(s&mT(4278255360))>>mT(8),mT(13))^o)&PT)&PT)<<mT(64)|KT(a)}function qT(e,t){return e^e>>t}function QT(e,t,n){const r=e.byteLength;FT(r>=9&&r<=16);{const a=(OT(t,32)^OT(t,40))+n&PT,o=(OT(t,48)^OT(t,56))-n&PT,s=OT(e);let c=OT(e,r-8),l=(s^c^a)*CT;const u=(l&PT)+(mT(r-1)<<mT(54));l=l&(ET^PT)|u,c^=o,l+=c+(c&RT)*(yT-mT(1))<<mT(64),l&=ET,l^=((i=l>>mT(64))&mT(255))<<mT(56)|(i&mT(65280))<<mT(40)|(i&mT(16711680))<<mT(24)|(i&mT(4278190080))<<mT(8)|(i&mT(0xff00000000))>>mT(8)|(i&mT(0xff0000000000))>>mT(24)|(i&mT(0xff000000000000))>>mT(40)|(i&mT(0xff00000000000000))>>mT(56);let d=(l&PT)*AT;return d+=(l>>mT(64))*AT<<mT(64),d&=ET,XT(d&PT)|XT(d>>mT(64))<<mT(64)}var i}function JT(e,t){const n=e.byteLength;return FT(n<=16),n>8?QT(e,wT,t):n>=4?function(e,t,n){const r=e.byteLength;FT(r>=4&&r<=8);{const i=BT(e,0),a=BT(e,r-4);let o=((mT(i)|mT(a)<<mT(32))^(OT(t,16)^OT(t,24))+n&PT)*(CT+(mT(r)<<mT(2)))&ET;return o+=(o&PT)<<mT(65),o&=ET,o^=o>>mT(67),qT(qT(o&PT,mT(35))*_T&PT,mT(28))|XT(o>>mT(64))<<mT(64)}}(e,wT,t):n>0?YT(e,wT,t):KT(t^OT(wT,64)^OT(wT,72))|KT(t^OT(wT,80)^OT(wT,88))<<mT(64)}function zT(e){return~e+mT(1)&PT}function ZT(e,t=mT(0)){const n=e.byteLength;return n<=16?JT(e,t):n<=128?function(e,t,n){let r=mT(e.byteLength)*CT&PT,i=mT(e.byteLength-1)/mT(32);for(;i>=0;){const a=Number(i);r=WT(r,NT(e,16*a),NT(e,e.byteLength-16*(a+1)),NT(t,32*a),n),i--}let a=r+(r>>mT(64))&PT;a=XT(a);let o=(r&PT)*CT+(r>>mT(64))*bT+(mT(e.byteLength)-n&PT)*AT;return o&=PT,o=zT(XT(o)),a|o<<mT(64)}(e,wT,t):n<=240?function(e,t,n){let r=mT(e.byteLength)*CT&PT;for(let o=32;o<160;o+=32)r=WT(r,NT(e,o-32),NT(e,o-16),NT(t,o-32),n);r=XT(r&PT)|XT(r>>mT(64))<<mT(64);for(let o=160;o<=e.byteLength;o+=32)r=WT(r,NT(e,o-32),NT(e,o-16),NT(t,3+o-160),n);r=WT(r,NT(e,e.byteLength-16),NT(e,e.byteLength-32),NT(t,103),zT(n));let i=r+(r>>mT(64))&PT;i=XT(i);let a=(r&PT)*CT+(r>>mT(64))*bT+(mT(e.byteLength)-n&PT)*AT;return a&=PT,a=zT(XT(a)),i|a<<mT(64)}(e,wT,t):VT(e,wT)}const ev=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tv(e,t){if(!ev.test(e)){throw new Error(void 0!==t?`Invalid UUID for ${t}: ${e}`:`Invalid UUID: ${e}`)}return e}const nv=new TextEncoder;function rv(e){return function(e){const t=new Uint8Array(16),n=new DataView(t.buffer),r=e&PT,i=e>>mT(64);return n.setBigUint64(0,i,!1),n.setBigUint64(8,r,!1),t}(ZT(nv.encode(e)))}function iv(e,t){const n=rv(`${e}:${t}`),r=new Uint8Array(16);if(7===function(e){if(!ev.test(e))return null;const t=e[14];return parseInt(t,16)}(e)){const t=function(e){const t=e.replace(/-/g,""),n=new Uint8Array(16);for(let r=0;r<16;r++)n[r]=parseInt(t.slice(2*r,2*r+2),16);return n}(e);r.set(t.slice(0,6),0)}else r.set(n.slice(10,16),0);return r[6]=112|15&n[0],r[7]=n[1],r[8]=128|63&n[2],r.set(n.slice(3,10),9),function(e){const t=Array.from(e).map(e=>e.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}(r)}const av=/* @__PURE__ */Symbol.for("ls:tracing_async_local_storage"),ov=new class{getStore(){}run(e,t){return t()}};const sv=new class{getInstance(){return globalThis[av]??ov}initializeGlobalInstance(e){void 0===globalThis[av]&&(globalThis[av]=e)}};function cv(e){return"function"==typeof e&&"langsmith:traceable"in e}const lv=(...e)=>e.join("/"),uv=e=>e.split("/").slice(0,-1).join("/");async function dv(e){}async function pv(e,t){}async function hv(e){return{size:0}}async function fv(e){}async function mv(e){}function gv(e,t){if(null===t)return!1;return Date.now()-e.createdAt>1e3*t}const yv=new class{constructor(e={}){Object.defineProperty(this,"cache",{enumerable:!0,configurable:!0,writable:!0,value:/* @__PURE__ */new Map}),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ttlSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshIntervalSeconds",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"refreshTimer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_metrics",{enumerable:!0,configurable:!0,writable:!0,value:{hits:0,misses:0,refreshes:0,refreshErrors:0}}),this.configure(e)}get metrics(){return{...this._metrics}}get totalRequests(){return this._metrics.hits+this._metrics.misses}get hitRate(){const e=this.totalRequests;return e>0?this._metrics.hits/e:0}resetMetrics(){this._metrics={hits:0,misses:0,refreshes:0,refreshErrors:0}}get(e,t){if(0===this.maxSize)return;const n=this.cache.get(e);if(n)return this.cache.delete(e),this.cache.set(e,{...n,refreshFunc:t}),this._metrics.hits+=1,n.value;this._metrics.misses+=1}set(e,t,n){if(0===this.maxSize)return;if(void 0===this.refreshTimer&&this.startRefreshLoop(),!this.cache.has(e)&&this.cache.size>=this.maxSize){const e=this.cache.keys().next().value;void 0!==e&&this.cache.delete(e)}const r={value:t,createdAt:Date.now(),refreshFunc:n};this.cache.delete(e),this.cache.set(e,r)}invalidate(e){this.cache.delete(e)}clear(){this.cache.clear()}get size(){return this.cache.size}stop(){this.refreshTimer&&(clearInterval(this.refreshTimer),this.refreshTimer=void 0)}dump(e){const t={};for(const[r,i]of this.cache.entries())t[r]=i.value;uv(e);try{JSON.stringify({entries:t},null,2)}catch(n){throw n}}load(e){return 0}startRefreshLoop(){this.stop(),null!==this.ttlSeconds&&(this.refreshTimer=setInterval(()=>{this.refreshStaleEntries().catch(e=>{console.warn("Unexpected error in cache refresh loop:",e)})},1e3*this.refreshIntervalSeconds),this.refreshTimer.unref&&this.refreshTimer.unref())}getStaleEntries(){const e=[];for(const[t,n]of this.cache.entries())gv(n,this.ttlSeconds)&&e.push([t,n]);return e}async refreshStaleEntries(){const e=this.getStaleEntries();if(0!==e.length)for(const[n,r]of e)if(void 0!==r.refreshFunc)try{const e=await r.refreshFunc();this.set(n,e,r.refreshFunc),this._metrics.refreshes+=1}catch(t){this._metrics.refreshErrors+=1,console.warn(`Failed to refresh cache entry ${n}:`,t)}}configure(e){this.stop(),this.refreshIntervalSeconds=e.refreshIntervalSeconds??60,this.maxSize=e.maxSize??100,this.ttlSeconds=e.ttlSeconds??300}};const Iv=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e){try{if("[object Error]"===Object.prototype.toString.call(e)){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)};class Cv extends Error{}let Av=class e extends Cv{constructor(t,n,r,i){super(`${e.makeMessage(t,n,r)}`),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.status=t,this.headers=i,this.error=n}static makeMessage(e,t,n){const r=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(t,n,r,i){if(!t||!i)return new bv({message:r,cause:Iv(n)});const a=n;return 400===t?new vv(t,a,r,i):401===t?new _v(t,a,r,i):403===t?new wv(t,a,r,i):404===t?new Ev(t,a,r,i):409===t?new Pv(t,a,r,i):422===t?new Rv(t,a,r,i):429===t?new Lv(t,a,r,i):t>=500?new Nv(t,a,r,i):new e(t,a,r,i)}},Sv=class extends Av{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}},bv=class extends Av{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}},Tv=class extends bv{constructor({message:e}={}){super({message:e??"Request timed out."})}},vv=class extends Av{},_v=class extends Av{},wv=class extends Av{},Ev=class extends Av{},Pv=class extends Av{},Rv=class extends Av{},Lv=class extends Av{},Nv=class extends Av{};const Ov="0.10.2";let Bv;const Mv=()=>void 0!==globalThis.Deno,Dv=()=>Bv||(Bv="undefined"!=typeof Bun?"bun":"undefined"!=typeof window&&void 0!==window.document?"browser":"undefined"==typeof process||void 0===process.versions||void 0===process.versions.node||Mv()?"object"==typeof globalThis&&globalThis.constructor&&"DedicatedWorkerGlobalScope"===globalThis.constructor.name?"webworker":"undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&navigator.userAgent.includes("jsdom")?"jsdom":Mv()?"deno":"other":"node",Bv);let Fv;function kv(){if(void 0===Fv){const e=Dv(),t=function(){if(void 0!==$v)return $v;const e=["VERCEL_GIT_COMMIT_SHA","NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA","COMMIT_REF","RENDER_GIT_COMMIT","CI_COMMIT_SHA","CIRCLE_SHA1","CF_PAGES_COMMIT_SHA","REACT_APP_GIT_SHA","SOURCE_VERSION","GITHUB_SHA","TRAVIS_COMMIT","GIT_COMMIT","BUILD_VCS_NUMBER","bamboo_planRepository_revision","Build.SourceVersion","BITBUCKET_COMMIT","DRONE_COMMIT_SHA","SEMAPHORE_GIT_SHA","BUILDKITE_COMMIT"],t={};for(const n of e){const e=Uv(n);void 0!==e&&(t[n]=e)}return $v=t,t}();Fv={library:"langsmith",runtime:e,sdk:"langsmith-js",sdk_version:Ov,...t}}return Fv}const Gv=["key","secret","token","password","passwd","pwd","credential","email"];function Hv(e){const t=e.toLowerCase();return Gv.some(e=>t.includes(e))}function xv(){const e=function(){const e={};try{if("undefined"!=typeof process&&process.env)for(const[t,n]of Object.entries(process.env))(t.startsWith("LANGCHAIN_")||t.startsWith("LANGSMITH_"))&&null!=n&&(Hv(t)&&"string"==typeof n?e[t]=n.slice(0,2)+"*".repeat(n.length-4)+n.slice(-2):e[t]=n)}catch(t){}return e}(),t={},n=["LANGCHAIN_API_KEY","LANGCHAIN_ENDPOINT","LANGCHAIN_TRACING_V2","LANGCHAIN_PROJECT","LANGCHAIN_SESSION","LANGSMITH_API_KEY","LANGSMITH_ENDPOINT","LANGSMITH_TRACING_V2","LANGSMITH_CONFIG_FILE","LANGSMITH_PROJECT","LANGSMITH_SESSION"];for(const[r,i]of Object.entries(e))"string"!=typeof i||n.includes(r)||Hv(r)||("LANGCHAIN_REVISION_ID"===r?t.revision_id=i:t[r]=i);return t}function Uv(e){try{return"undefined"!=typeof process?process.env?.[e]:void 0}catch(t){return}}function Vv(e){return Uv(`LANGSMITH_${e}`)||Uv(`LANGCHAIN_${e}`)}let $v;function jv(){return"true"===Uv("OTEL_ENABLED")||"true"===Vv("OTEL_ENABLED")}const Wv=/* @__PURE__ */new Set(["langsmith","otel"]);function Xv(e){if(void 0!==e)return e;const t=Vv("TRACING_MODE");if(void 0!==t&&""!==t){const e=t.toLowerCase();if(!Wv.has(e))throw new Error(`Invalid LANGSMITH_TRACING_MODE=${JSON.stringify(t)}. Must be one of: ${[...Wv].sort().join(", ")}`);return jv()&&console.warn("Both LANGSMITH_TRACING_MODE and the legacy OTEL_ENABLED / LANGSMITH_OTEL_ENABLED env vars are set. LANGSMITH_TRACING_MODE takes precedence."),e}return jv()?"otel":"langsmith"}class Kv{constructor(){Object.defineProperty(this,"hasWarned",{enumerable:!0,configurable:!0,writable:!0,value:!1})}startActiveSpan(e,...t){let n;if(this.hasWarned||"otel"!==Xv()||(console.warn('OTel tracing mode is active (via LANGSMITH_TRACING_MODE, OTEL_ENABLED, or LANGSMITH_OTEL_ENABLED), but the required OTEL instances have not been initialized. Please add:\n```\nimport { initializeOTEL } from "langsmith/experimental/otel/setup";\ninitializeOTEL();\n```\nat the beginning of your code.'),this.hasWarned=!0),1===t.length&&"function"==typeof t[0]?n=t[0]:2===t.length&&"function"==typeof t[1]?n=t[1]:3===t.length&&"function"==typeof t[2]&&(n=t[2]),"function"==typeof n)return n()}}const Yv=/* @__PURE__ */Symbol.for("ls:otel_trace"),qv=/* @__PURE__ */Symbol.for("ls:otel_context"),Qv=/* @__PURE__ */Symbol.for("ls:otel_get_default_otlp_tracer_provider"),Jv=new class{constructor(){Object.defineProperty(this,"mockTracer",{enumerable:!0,configurable:!0,writable:!0,value:new Kv})}getTracer(e,t){return this.mockTracer}getActiveSpan(){}setSpan(e,t){return e}getSpan(e){}setSpanContext(e,t){return e}getTracerProvider(){}setGlobalTracerProvider(e){return!1}},zv=new class{active(){return{}}with(e,t){return t()}};const Zv=new class{getTraceInstance(){return globalThis[Yv]??Jv}getContextInstance(){return globalThis[qv]??zv}initializeGlobalInstances(e){void 0===globalThis[Yv]&&(globalThis[Yv]=e.trace),void 0===globalThis[qv]&&(globalThis[qv]=e.context)}setDefaultOTLPTracerComponents(e){globalThis[Qv]=e}getDefaultOTLPTracerComponents(){return globalThis[Qv]??void 0}};function e_(){return Zv.getTraceInstance()}const t_={llm:"chat",tool:"execute_tool",retriever:"embeddings",embedding:"embeddings",prompt:"chat"};function n_(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e}class r_{constructor(){Object.defineProperty(this,"spans",{enumerable:!0,configurable:!0,writable:!0,value:/* @__PURE__ */new Map})}exportBatch(e,t){for(const r of e)try{if(!r.run)continue;if("post"===r.operation){const e=this.createSpanForRun(r,r.run,t.get(r.id));e&&!r.run.end_time&&this.spans.set(r.id,e)}else this.updateSpanForRun(r,r.run)}catch(n){console.error(`Error processing operation ${r.id}:`,n)}}createSpanForRun(e,t,n){const r=n&&e_().getSpan(n);if(r)try{return this.finishSpanSetup(r,t,e)}catch(i){return void console.error(`Failed to create span for run ${e.id}:`,i)}}finishSpanSetup(e,t,n){return this.setSpanAttributes(e,t,n),t.error?(e.setStatus({code:2}),e.recordException(new Error(t.error))):e.setStatus({code:1}),t.end_time&&e.end(new Date(t.end_time)),e}updateSpanForRun(e,t){try{const n=this.spans.get(e.id);if(!n)return void console.debug(`No span found for run ${e.id} during update`);this.setSpanAttributes(n,t,e),t.error?(n.setStatus({code:2}),n.recordException(new Error(t.error))):n.setStatus({code:1});const r=t.end_time;r&&(n.end(new Date(r)),this.spans.delete(e.id))}catch(n){console.error(`Failed to update span for run ${e.id}:`,n)}}extractModelName(e){if(e.extra?.metadata){const t=e.extra.metadata;if(t.ls_model_name)return t.ls_model_name;if(t.invocation_params){const e=t.invocation_params;if(e.model)return e.model;if(e.model_name)return e.model_name}}}setSpanAttributes(e,t,n){if("run_type"in t&&t.run_type){e.setAttribute("langsmith.span.kind",t.run_type);const n=(r=t.run_type||"chain",t_[r]||r);e.setAttribute("gen_ai.operation.name",n)}var r;"name"in t&&t.name&&e.setAttribute("langsmith.trace.name",t.name),"session_id"in t&&t.session_id&&e.setAttribute("langsmith.trace.session_id",t.session_id),"session_name"in t&&t.session_name&&e.setAttribute("langsmith.trace.session_name",t.session_name),this.setGenAiSystem(e,t);const i=this.extractModelName(t);i&&e.setAttribute(rT,i),t.extra?.metadata?.usage_metadata&&"object"==typeof t.extra.metadata.usage_metadata&&e.setAttribute(cT,JSON.stringify(t.extra.metadata.usage_metadata)),"prompt_tokens"in t&&"number"==typeof t.prompt_tokens&&e.setAttribute(iT,t.prompt_tokens),"completion_tokens"in t&&"number"==typeof t.completion_tokens&&e.setAttribute(aT,t.completion_tokens),"total_tokens"in t&&"number"==typeof t.total_tokens&&e.setAttribute(oT,t.total_tokens),this.setInvocationParameters(e,t);const a=t.extra?.metadata||{};for(const[s,c]of Object.entries(a))null!=c&&e.setAttribute(`langsmith.metadata.${s}`,n_(c)?String(c):JSON.stringify(c));const o=t.tags;if(o&&Array.isArray(o)?e.setAttribute(sT,o.join(", ")):o&&e.setAttribute(sT,String(o)),"serialized"in t&&"object"==typeof t.serialized){const n=t.serialized;n.name&&e.setAttribute("gen_ai.serialized.name",String(n.name)),n.signature&&e.setAttribute("gen_ai.serialized.signature",String(n.signature)),n.doc&&e.setAttribute("gen_ai.serialized.doc",String(n.doc))}this.setIOAttributes(e,n)}setGenAiSystem(e,t){let n="langchain";const r=this.extractModelName(t);if(r){const e=r.toLowerCase();e.includes("anthropic")||e.startsWith("claude")?n="anthropic":e.includes("bedrock")?n="aws.bedrock":e.includes("azure")&&e.includes("openai")?n="az.ai.openai":e.includes("azure")&&e.includes("inference")?n="az.ai.inference":e.includes("cohere")?n="cohere":e.includes("deepseek")?n="deepseek":e.includes("gemini")?n="gemini":e.includes("groq")?n="groq":e.includes("watson")||e.includes("ibm")?n="ibm.watsonx.ai":e.includes("mistral")?n="mistral_ai":e.includes("gpt")||e.includes("openai")?n="openai":e.includes("perplexity")||e.includes("sonar")?n="perplexity":e.includes("vertex")?n="vertex_ai":(e.includes("xai")||e.includes("grok"))&&(n="xai")}e.setAttribute("gen_ai.system",n)}setInvocationParameters(e,t){if(!t.extra?.metadata?.invocation_params)return;const n=t.extra.metadata.invocation_params;void 0!==n.max_tokens&&e.setAttribute("gen_ai.request.max_tokens",n.max_tokens),void 0!==n.temperature&&e.setAttribute("gen_ai.request.temperature",n.temperature),void 0!==n.top_p&&e.setAttribute("gen_ai.request.top_p",n.top_p),void 0!==n.frequency_penalty&&e.setAttribute("gen_ai.request.frequency_penalty",n.frequency_penalty),void 0!==n.presence_penalty&&e.setAttribute("gen_ai.request.presence_penalty",n.presence_penalty)}setIOAttributes(e,t){if(t.run.inputs)try{const n=t.run.inputs;"object"==typeof n&&null!==n&&(n.model&&Array.isArray(n.messages)&&e.setAttribute(rT,n.model),void 0!==n.stream&&e.setAttribute("langsmith.request.streaming",n.stream),n.extra_headers&&e.setAttribute("langsmith.request.headers",JSON.stringify(n.extra_headers)),n.extra_query&&e.setAttribute("gen_ai.request.extra_query",JSON.stringify(n.extra_query)),n.extra_body&&e.setAttribute("gen_ai.request.extra_body",JSON.stringify(n.extra_body))),e.setAttribute("gen_ai.prompt",JSON.stringify(n))}catch(n){console.debug(`Failed to process inputs for run ${t.id}`,n)}if(t.run.outputs)try{const n=t.run.outputs,r=this.getUnifiedRunTokens(n);if(r&&(e.setAttribute(iT,r[0]),e.setAttribute(aT,r[1]),e.setAttribute(oT,r[0]+r[1])),n&&"object"==typeof n){if(n.model&&e.setAttribute("gen_ai.response.model",String(n.model)),n.id&&e.setAttribute("gen_ai.response.id",n.id),n.choices&&Array.isArray(n.choices)){const t=n.choices.map(e=>e.finish_reason).filter(e=>e).map(String);t.length>0&&e.setAttribute("gen_ai.response.finish_reasons",t.join(", "))}if(n.service_tier&&e.setAttribute("gen_ai.response.service_tier",n.service_tier),n.system_fingerprint&&e.setAttribute("gen_ai.response.system_fingerprint",n.system_fingerprint),n.usage_metadata&&"object"==typeof n.usage_metadata){const t=n.usage_metadata;e.setAttribute(cT,JSON.stringify(t)),t.input_token_details&&e.setAttribute("gen_ai.usage.input_token_details",JSON.stringify(t.input_token_details)),t.output_token_details&&e.setAttribute("gen_ai.usage.output_token_details",JSON.stringify(t.output_token_details))}}e.setAttribute("gen_ai.completion",JSON.stringify(n))}catch(n){console.debug(`Failed to process outputs for run ${t.id}`,n)}}getUnifiedRunTokens(e){if(!e)return null;let t=this.extractUnifiedRunTokens(e.usage_metadata);if(t)return t;const n=Object.keys(e);for(const a of n){const n=e[a];if(n&&"object"==typeof n){if(t=this.extractUnifiedRunTokens(n.usage_metadata),t)return t;if(1===n.lc&&n.kwargs&&"object"==typeof n.kwargs&&(t=this.extractUnifiedRunTokens(n.kwargs.usage_metadata),t))return t}}const r=e.generations||[];if(!Array.isArray(r))return null;const i=Array.isArray(r[0])?r.flat():r;for(const a of i)if("object"==typeof a&&a.message&&"object"==typeof a.message&&a.message.kwargs&&"object"==typeof a.message.kwargs&&(t=this.extractUnifiedRunTokens(a.message.kwargs.usage_metadata),t))return t;return null}extractUnifiedRunTokens(e){return e&&"object"==typeof e?"number"!=typeof e.input_tokens||"number"!=typeof e.output_tokens?null:[e.input_tokens,e.output_tokens]:null}}const i_=Object.prototype.toString,a_=/* @__PURE__ */new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function o_(e){var t;if(!(e&&(t=e,"[object Error]"===i_.call(t))&&"TypeError"===e.name&&"string"==typeof e.message))return!1;const{message:n,stack:r}=e;return"Load failed"===n?void 0===r||"__sentry_captured__"in e:!!n.startsWith("error sending request for url")||a_.has(n)}function s_(e,t,{min:n=0,allowInfinity:r=!1}={}){if(void 0!==t){if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`Expected \`${e}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(t))throw new TypeError(`Expected \`${e}\` to be a finite number.`);if(t<n)throw new TypeError(`Expected \`${e}\` to be ≥ ${n}.`)}}let c_=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function l_(e,t){return Number.isFinite(t)?t-(performance.now()-e):t}async function u_({error:e,attemptNumber:t,retriesConsumed:n,startTime:r,options:i}){const a=e instanceof Error?e:new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(a instanceof c_)throw a.originalError;const o=Number.isFinite(i.retries)?Math.max(0,i.retries-n):i.retries,s=i.maxRetryTime??Number.POSITIVE_INFINITY,c=Object.freeze({error:a,attemptNumber:t,retriesLeft:o,retriesConsumed:n});if(await i.onFailedAttempt(c),l_(r,s)<=0)throw a;const l=await i.shouldConsumeRetry(c),u=l_(r,s);if(u<=0||o<=0)throw a;if(a instanceof TypeError&&!o_(a)){if(l)throw a;return i.signal?.throwIfAborted(),!1}if(!(await i.shouldRetry(c)))throw a;if(!l)return i.signal?.throwIfAborted(),!1;const d=function(e,t){const n=Math.max(1,e+1),r=t.randomize?Math.random()+1:1;let i=Math.round(r*t.minTimeout*t.factor**(n-1));return i=Math.min(i,t.maxTimeout),i}(n,i),p=Math.min(d,u);return p>0&&await new Promise((e,t)=>{const n=()=>{clearTimeout(r),i.signal?.removeEventListener("abort",n),t(i.signal.reason)},r=setTimeout(()=>{i.signal?.removeEventListener("abort",n),e()},p);i.unref&&r.unref?.(),i.signal?.addEventListener("abort",n,{once:!0})}),i.signal?.throwIfAborted(),!0}async function d_(e,t={}){if(function(e){if("number"==typeof e){if(e<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(e))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(void 0!==e)throw new TypeError("Expected `retries` to be a number or Infinity.")}((t={...t}).retries),Object.hasOwn(t,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");t.retries??=10,t.factor??=2,t.minTimeout??=1e3,t.maxTimeout??=Number.POSITIVE_INFINITY,t.maxRetryTime??=Number.POSITIVE_INFINITY,t.randomize??=!1,t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.shouldConsumeRetry??=()=>!0,s_("factor",t.factor,{min:0,allowInfinity:!1}),s_("minTimeout",t.minTimeout,{min:0,allowInfinity:!1}),s_("maxTimeout",t.maxTimeout,{min:0,allowInfinity:!0}),s_("maxRetryTime",t.maxRetryTime,{min:0,allowInfinity:!0}),t.factor>0||(t.factor=1),t.signal?.throwIfAborted();let n=0,r=0;const i=performance.now();for(;!Number.isFinite(t.retries)||r<=t.retries;){n++;try{t.signal?.throwIfAborted();const r=await e(n);return t.signal?.throwIfAborted(),r}catch(a){await u_({error:a,attemptNumber:n,retriesConsumed:r,startTime:i,options:t})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}var p_,h_={},f_={exports:{}};var m_,g_,y_,I_={exports:{}};function C_(){if(y_)return I_.exports;y_=1;const e=g_?m_:(g_=1,m_=(e,t)=>(t=t||(()=>{}),e.then(e=>new Promise(e=>{e(t())}).then(()=>e),e=>new Promise(e=>{e(t())}).then(()=>{throw e}))));class t extends Error{constructor(e){super(e),this.name="TimeoutError"}}const n=(n,r,i)=>new Promise((a,o)=>{if("number"!=typeof r||r<0)throw new TypeError("Expected `milliseconds` to be a positive number");if(r===1/0)return void a(n);const s=setTimeout(()=>{if("function"==typeof i){try{a(i())}catch(s){o(s)}return}const e=i instanceof Error?i:new t("string"==typeof i?i:`Promise timed out after ${r} milliseconds`);"function"==typeof n.cancel&&n.cancel(),o(e)},r);e(n.then(a,o),()=>{clearTimeout(s)})});return I_.exports=n,I_.exports.default=n,I_.exports.TimeoutError=t,I_.exports}var A_,S_,b_,T_={},v_={};function __(){if(S_)return T_;S_=1,Object.defineProperty(T_,"__esModule",{value:!0});const e=(A_||(A_=1,Object.defineProperty(v_,"__esModule",{value:!0}),v_.default=function(e,t,n){let r=0,i=e.length;for(;i>0;){const a=i/2|0;let o=r+a;n(e[o],t)<=0?(r=++o,i-=a+1):i=a}return r}),v_);return T_.default=class{constructor(){this._queue=[]}enqueue(t,n){const r={priority:(n=Object.assign({priority:0},n)).priority,run:t};if(this.size&&this._queue[this.size-1].priority>=n.priority)return void this._queue.push(r);const i=e.default(this._queue,r,(e,t)=>t.priority-e.priority);this._queue.splice(i,0,r)}dequeue(){const e=this._queue.shift();return null==e?void 0:e.run}filter(e){return this._queue.filter(t=>t.priority===e.priority).map(e=>e.run)}get size(){return this._queue.length}},T_}const w_=/* @__PURE__ */xi(function(){if(b_)return h_;b_=1,Object.defineProperty(h_,"__esModule",{value:!0});const e=(p_||(p_=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function a(e,t,r,a,o){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,a||e,o),c=n?n+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=/* @__PURE__ */Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,a=r.length,o=new Array(a);i<a;i++)o[i]=r[i].fn;return o},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,a,o){var s=n?n+e:e;if(!this._events[s])return!1;var c,l,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,i),!0;case 5:return u.fn.call(u.context,t,r,i,a),!0;case 6:return u.fn.call(u.context,t,r,i,a,o),!0}for(l=1,c=new Array(d-1);l<d;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var p,h=u.length;for(l=0;l<h;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),d){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,r);break;case 4:u[l].fn.call(u[l].context,t,r,i);break;default:if(!c)for(p=1,c=new Array(d-1);p<d;p++)c[p-1]=arguments[p];u[l].fn.apply(u[l].context,c)}}return!0},s.prototype.on=function(e,t,n){return a(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return a(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var a=n?n+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||o(this,a);else{for(var c=0,l=[],u=s.length;c<u;c++)(s[c].fn!==t||i&&!s[c].once||r&&s[c].context!==r)&&l.push(s[c]);l.length?this._events[a]=1===l.length?l[0]:l:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&o(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(f_)),f_.exports),t=C_(),n=__(),r=()=>{},i=new t.TimeoutError;return h_.default=class extends e{constructor(e){var t,i,a,o;if(super(),this._intervalCount=0,this._intervalEnd=0,this._pendingCount=0,this._resolveEmpty=r,this._resolveIdle=r,!("number"==typeof(e=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:n.default},e)).intervalCap&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${null!==(i=null===(t=e.intervalCap)||void 0===t?void 0:t.toString())&&void 0!==i?i:""}\` (${typeof e.intervalCap})`);if(void 0===e.interval||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${null!==(o=null===(a=e.interval)||void 0===a?void 0:a.toString())&&void 0!==o?o:""}\` (${typeof e.interval})`);this._carryoverConcurrencyCount=e.carryoverConcurrencyCount,this._isIntervalIgnored=e.intervalCap===1/0||0===e.interval,this._intervalCap=e.intervalCap,this._interval=e.interval,this._queue=new e.queueClass,this._queueClass=e.queueClass,this.concurrency=e.concurrency,this._timeout=e.timeout,this._throwOnTimeout=!0===e.throwOnTimeout,this._isPaused=!1===e.autoStart}get _doesIntervalAllowAnother(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}get _doesConcurrentAllowAnother(){return this._pendingCount<this._concurrency}_next(){this._pendingCount--,this._tryToStartAnother(),this.emit("next")}_resolvePromises(){this._resolveEmpty(),this._resolveEmpty=r,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=r,this.emit("idle"))}_onResumeInterval(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}_isIntervalPaused(){const e=Date.now();if(void 0===this._intervalId){const t=this._intervalEnd-e;if(!(t<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout(()=>{this._onResumeInterval()},t)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}_tryToStartAnother(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){const e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){const t=this._queue.dequeue();return!!t&&(this.emit("active"),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}_initializeIntervalIfNeeded(){this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval(()=>{this._onInterval()},this._interval),this._intervalEnd=Date.now()+this._interval)}_onInterval(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}_processQueue(){for(;this._tryToStartAnother(););}get concurrency(){return this._concurrency}set concurrency(e){if(!("number"==typeof e&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this._concurrency=e,this._processQueue()}async add(e,n={}){return new Promise((r,a)=>{this._queue.enqueue(async()=>{this._pendingCount++,this._intervalCount++;try{const o=void 0===this._timeout&&void 0===n.timeout?e():t.default(Promise.resolve(e()),void 0===n.timeout?this._timeout:n.timeout,()=>{(void 0===n.throwOnTimeout?this._throwOnTimeout:n.throwOnTimeout)&&a(i)});r(await o)}catch(o){a(o)}this._next()},n),this._tryToStartAnother(),this.emit("add")})}async addAll(e,t){return Promise.all(e.map(async e=>this.add(e,t)))}start(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}pause(){this._isPaused=!0}clear(){this._queue=new this._queueClass}async onEmpty(){if(0!==this._queue.size)return new Promise(e=>{const t=this._resolveEmpty;this._resolveEmpty=()=>{t(),e()}})}async onIdle(){if(0!==this._pendingCount||0!==this._queue.size)return new Promise(e=>{const t=this._resolveIdle;this._resolveIdle=()=>{t(),e()}})}get size(){return this._queue.size}sizeBy(e){return this._queue.filter(e).length}get pending(){return this._pendingCount}get isPaused(){return this._isPaused}get timeout(){return this._timeout}set timeout(e){this._timeout=e}},h_}()),E_="default"in w_?w_.default:w_,P_=[408,425,429,500,502,503,504];let R_=class{constructor(e){Object.defineProperty(this,"maxConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxQueueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onFailedResponseHook",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"queueSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.maxQueueSizeBytes=e.maxQueueSizeBytes,this.queue=new E_({concurrency:this.maxConcurrency}),this.onFailedResponseHook=e?.onFailedResponseHook}call(e,...t){return this.callWithOptions({},e,...t)}callWithOptions(e,t,...n){const r=e.sizeBytes??0;if(void 0!==this.maxQueueSizeBytes&&r>0&&this.queueSizeBytes+r>this.maxQueueSizeBytes)return Promise.reject(new Error(`Queue size limit (${this.maxQueueSizeBytes} bytes) exceeded. Current queue size: ${this.queueSizeBytes} bytes, attempted addition: ${r} bytes.`));r>0&&(this.queueSizeBytes+=r);const i=this.onFailedResponseHook;let a=this.queue.add(()=>d_(()=>t(...n).catch(e=>{throw e instanceof Error?e:new Error(e)}),{async onFailedAttempt({error:e}){if("object"!=typeof e||null==e)throw e;const t="message"in e&&"string"==typeof e.message?e.message:void 0;if(t?.startsWith("Cancel")||t?.startsWith("TimeoutError")||t?.startsWith("AbortError"))throw e;if("name"in e&&"TimeoutError"===e.name)throw e;if("code"in e&&"ECONNABORTED"===e.code)throw e;const n="response"in e?e.response:void 0;if(i){if(await i(n))return}const r=n?.status??("status"in e?e.status:void 0);if(null!=r&&("number"==typeof r||"string"==typeof r)&&!P_.includes(+r))throw e},retries:this.maxRetries,randomize:!0}),{throwOnTimeout:!0});return r>0&&(a=a.finally(()=>{this.queueSizeBytes-=r})),e.signal?Promise.race([a,new Promise((t,n)=>{e.signal?.addEventListener("abort",()=>{n(new Error("AbortError"))})})]):a}};function L_(e){return"function"==typeof e?._getType}function N_(e){const t={type:e._getType(),data:{content:e.content}};return e?.additional_kwargs&&Object.keys(e.additional_kwargs).length>0&&(t.data.additional_kwargs={...e.additional_kwargs}),t}let O_=function(){const{crypto:e}=globalThis;if(e?.randomUUID)return O_=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^n()&15>>+e/4).toString(16))};const B_=/^[a-z][a-z0-9+.-]*:/i;let M_=e=>(M_=Array.isArray,M_(e)),D_=M_;function F_(e){return"object"!=typeof e?{}:e??{}}function k_(e){if(!e)return!0;for(const t in e)return!1;return!0}const G_="0.0.1";const H_=()=>{const e="undefined"!=typeof Deno&&null!=Deno.build?"deno":"undefined"!=typeof EdgeRuntime?"edge":"[object process]"===Object.prototype.toString.call(void 0!==globalThis.process?globalThis.process:0)?"node":"unknown";if("deno"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G_,"X-Stainless-OS":U_(Deno.build.os),"X-Stainless-Arch":x_(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("undefined"!=typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G_,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if("node"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G_,"X-Stainless-OS":U_(globalThis.process.platform??"unknown"),"X-Stainless-Arch":x_(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const t=function(){if("undefined"==typeof navigator||!navigator)return null;const e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:n}of e){const e=n.exec(navigator.userAgent);if(e){return{browser:t,version:`${e[1]||0}.${e[2]||0}.${e[3]||0}`}}}return null}();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G_,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":G_,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};const x_=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",U_=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown";let V_;function $_(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return function(...e){const t=globalThis.ReadableStream;if(void 0===t)throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}({start(){},async pull(e){const{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await(t.return?.())}})}const j_=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)}),W_="RFC3986",X_=e=>String(e),K_={RFC1738:e=>String(e).replace(/%20/g,"+"),RFC3986:X_};let Y_=(e,t)=>(Y_=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),Y_(e,t));const q_=/* @__PURE__ */(()=>{const e=[];for(let t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e})(),Q_=1024;function J_(e,t){if(M_(e)){const n=[];for(let r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)}const z_={brackets:e=>String(e)+"[]",comma:"comma",indices:(e,t)=>String(e)+"["+t+"]",repeat:e=>String(e)},Z_=function(e,t){Array.prototype.push.apply(e,M_(t)?t:[t])};let ew;const tw={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:(e,t,n,r,i)=>{if(0===e.length)return e;let a=e;if("symbol"==typeof e?a=Symbol.prototype.toString.call(e):"string"!=typeof e&&(a=String(e)),"iso-8859-1"===n)return escape(a).replace(/%u[0-9a-f]{4}/gi,function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"});let o="";for(let s=0;s<a.length;s+=Q_){const e=a.length>=Q_?a.slice(s,s+Q_):a,t=[];for(let n=0;n<e.length;++n){let r=e.charCodeAt(n);45===r||46===r||95===r||126===r||r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122||"RFC1738"===i&&(40===r||41===r)?t[t.length]=e.charAt(n):r<128?t[t.length]=q_[r]:r<2048?t[t.length]=q_[192|r>>6]+q_[128|63&r]:r<55296||r>=57344?t[t.length]=q_[224|r>>12]+q_[128|r>>6&63]+q_[128|63&r]:(n+=1,r=65536+((1023&r)<<10|1023&e.charCodeAt(n)),t[t.length]=q_[240|r>>18]+q_[128|r>>12&63]+q_[128|r>>6&63]+q_[128|63&r])}o+=t.join("")}return o},encodeValuesOnly:!1,format:W_,formatter:X_,indices:!1,serializeDate:e=>(ew??=Function.prototype.call.bind(Date.prototype.toISOString))(e),skipNulls:!1,strictNullHandling:!1};const nw={};function rw(e,t,n,r,i,a,o,s,c,l,u,d,p,h,f,m,g,y){let I=e,C=y,A=0,S=!1;for(;void 0!==(C=C.get(nw))&&!S;){const t=C.get(e);if(A+=1,void 0!==t){if(t===A)throw new RangeError("Cyclic object value");S=!0}void 0===C.get(nw)&&(A=0)}if("function"==typeof l?I=l(t,I):I instanceof Date?I=p?.(I):"comma"===n&&M_(I)&&(I=J_(I,function(e){return e instanceof Date?p?.(e):e})),null===I){if(a)return c&&!m?c(t,tw.encoder,g,"key",h):t;I=""}if("string"==typeof(b=I)||"number"==typeof b||"boolean"==typeof b||"symbol"==typeof b||"bigint"==typeof b||function(e){return!(!e||"object"!=typeof e||!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e)))}(I)){if(c){const e=m?t:c(t,tw.encoder,g,"key",h);return[f?.(e)+"="+f?.(c(I,tw.encoder,g,"value",h))]}return[f?.(t)+"="+f?.(String(I))]}var b;const T=[];if(void 0===I)return T;let v;if("comma"===n&&M_(I))m&&c&&(I=J_(I,c)),v=[{value:I.length>0?I.join(",")||null:void 0}];else if(M_(l))v=l;else{const e=Object.keys(I);v=u?e.sort(u):e}const _=s?String(t).replace(/\./g,"%2E"):String(t),w=r&&M_(I)&&1===I.length?_+"[]":_;if(i&&M_(I)&&0===I.length)return w+"[]";for(let E=0;E<v.length;++E){const t=v[E],C="object"==typeof t&&void 0!==t.value?t.value:I[t];if(o&&null===C)continue;const S=d&&s?t.replace(/\./g,"%2E"):t,b=M_(I)?"function"==typeof n?n(w,S):w:w+(d?"."+S:"["+S+"]");y.set(e,A);const _=/* @__PURE__ */new WeakMap;_.set(nw,y),Z_(T,rw(C,b,n,r,i,a,o,s,"comma"===n&&m&&M_(I)?null:c,l,u,d,p,h,f,m,g,_))}return T}function iw(e,t={}){let n=e;const r=function(e=tw){if(void 0!==e.allowEmptyArrays&&"boolean"!=typeof e.allowEmptyArrays)throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(void 0!==e.encodeDotInKeys&&"boolean"!=typeof e.encodeDotInKeys)throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");const t=e.charset||tw.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let n=W_;if(void 0!==e.format){if(!Y_(K_,e.format))throw new TypeError("Unknown format option provided.");n=e.format}const r=K_[n];let i,a=tw.filter;if(("function"==typeof e.filter||M_(e.filter))&&(a=e.filter),i=e.arrayFormat&&e.arrayFormat in z_?e.arrayFormat:"indices"in e?e.indices?"indices":"repeat":tw.arrayFormat,"commaRoundTrip"in e&&"boolean"!=typeof e.commaRoundTrip)throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const o=void 0===e.allowDots?1==!!e.encodeDotInKeys||tw.allowDots:!!e.allowDots;return{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:tw.addQueryPrefix,allowDots:o,allowEmptyArrays:"boolean"==typeof e.allowEmptyArrays?!!e.allowEmptyArrays:tw.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:tw.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:void 0===e.delimiter?tw.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:tw.encode,encodeDotInKeys:"boolean"==typeof e.encodeDotInKeys?e.encodeDotInKeys:tw.encodeDotInKeys,encoder:"function"==typeof e.encoder?e.encoder:tw.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:tw.encodeValuesOnly,filter:a,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:tw.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:tw.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:tw.strictNullHandling}}(t);let i,a;"function"==typeof r.filter?(a=r.filter,n=a("",n)):M_(r.filter)&&(a=r.filter,i=a);const o=[];if("object"!=typeof n||null===n)return"";const s=z_[r.arrayFormat],c="comma"===s&&r.commaRoundTrip;i||(i=Object.keys(n)),r.sort&&i.sort(r.sort);const l=/* @__PURE__ */new WeakMap;for(let p=0;p<i.length;++p){const e=i[p];r.skipNulls&&null===n[e]||Z_(o,rw(n[e],e,s,c,r.allowEmptyArrays,r.strictNullHandling,r.skipNulls,r.encodeDotInKeys,r.encode?r.encoder:null,r.filter,r.sort,r.allowDots,r.serializeDate,r.format,r.formatter,r.encodeValuesOnly,r.charset,l))}const u=o.join(r.delimiter);let d=!0===r.addQueryPrefix?"?":"";return r.charsetSentinel&&("iso-8859-1"===r.charset?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),u.length>0?d+u:""}const aw={off:0,error:200,warn:300,info:400,debug:500},ow=(e,t,n)=>{var r,i;if(e)return r=aw,i=e,Object.prototype.hasOwnProperty.call(r,i)?e:void dw(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(aw))}`)};function sw(){}function cw(e,t,n){return!t||aw[e]>aw[n]?sw:t[e].bind(t)}const lw={error:sw,warn:sw,info:sw,debug:sw};let uw=/* @__PURE__ */new WeakMap;function dw(e){const t=e.logger,n=e.logLevel??"off";if(!t)return lw;const r=uw.get(t);if(r&&r[0]===n)return r[1];const i={error:cw("error",t,n),warn:cw("warn",t,n),info:cw("info",t,n),debug:cw("debug",t,n)};return uw.set(t,[n,i]),i}const pw=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,"authorization"===e.toLowerCase()||"api-key"===e.toLowerCase()||"x-api-key"===e.toLowerCase()||"cookie"===e.toLowerCase()||"set-cookie"===e.toLowerCase()||"x-tenant-id"===e.toLowerCase()?"***":t]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);async function hw(e,t){const{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(204===n.status)return null;if(t.options.__binaryResponse)return n;const e=n.headers.get("content-type"),r=e?.split(";")[0]?.trim();if(r?.includes("application/json")||r?.endsWith("+json")){if("0"===n.headers.get("content-length"))return;return await n.json()}return await n.text()})();return dw(e).debug(`[${r}] response parsed`,pw({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}var fw,mw=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};let gw=class e extends Promise{constructor(e,t,n=hw){super(e=>{e(null)}),Object.defineProperty(this,"responsePromise",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"parseResponse",{enumerable:!0,configurable:!0,writable:!0,value:n}),Object.defineProperty(this,"parsedPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),fw.set(this,void 0),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,fw,e,"f")}_thenUnwrap(t){return new e(mw(this,fw,"f"),this.responsePromise,async(e,n)=>t(await this.parseResponse(e,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(mw(this,fw,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}};fw=/* @__PURE__ */new WeakMap;var yw;class Iw{constructor(e,t,n,r){yw.set(this,void 0),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"response",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,yw,e,"f"),this.options=r,this.response=t,this.body=n}hasNextPage(){return!!this.getPaginatedItems().length&&null!=this.nextPageRequestOptions()}async getNextPage(){const e=this.nextPageRequestOptions();if(!e)throw new Cv("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}(this,yw,"f").requestAPIList(this.constructor,e)}async*iterPages(){let e=this;for(yield e;e.hasNextPage();)e=await e.getNextPage(),yield e}async*[(yw=/* @__PURE__ */new WeakMap,Symbol.asyncIterator)](){for await(const e of this.iterPages())for(const t of e.getPaginatedItems())yield t}}class Cw extends gw{constructor(e,t,n){super(e,t,async(e,t)=>new n(e,t.response,await hw(e,t),t.options))}async*[Symbol.asyncIterator](){const e=await(this);for await(const t of e)yield t}}class Aw extends Iw{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n||[]}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=(this.options.query.offset??0)+this.getPaginatedItems().length;return{...this.options,query:{...F_(this.options.query),offset:e}}}}class Sw extends Iw{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n||[]}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=(this.options.query.offset??0)+this.getPaginatedItems().length;return{...this.options,query:{...F_(this.options.query),offset:e}}}}class bw extends Iw{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"evaluators",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"total",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.evaluators=n.evaluators||[],this.total=n.total||0}getPaginatedItems(){return this.evaluators??[]}nextPageRequestOptions(){const e=(this.options.query.offset??0)+this.getPaginatedItems().length;return{...this.options,query:{...F_(this.options.query),offset:e}}}}class Tw extends Iw{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"next_cursor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n.items||[],this.next_cursor=n.next_cursor||""}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=this.next_cursor;return e?{...this.options,body:{...F_(this.options.body),cursor:e}}:null}}class vw extends Iw{constructor(e,t,n,r){super(e,t,n,r),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"next_cursor",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.items=n.items||[],this.next_cursor=n.next_cursor||""}getPaginatedItems(){return this.items??[]}nextPageRequestOptions(){const e=this.next_cursor;return e?{...this.options,query:{...F_(this.options.query),cursor:e}}:null}}const _w=()=>{if("undefined"==typeof File){const{process:e}=globalThis,t="string"==typeof e?.versions?.node&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function ww(e,t,n){return _w(),new File(e,t??"unknown_file",n)}const Ew=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer;async function Pw(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(Ew(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else{if(!(e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator])(e)){const t=e?.constructor?.name;throw new Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:""}${function(e){if("object"!=typeof e||null===e)return"";const t=Object.getOwnPropertyNames(e);return`; props: [${t.map(e=>`"${e}"`).join(", ")}]`}(e)}`)}for await(const n of e)t.push(...await Pw(n))}return t}let Rw=class{constructor(e){Object.defineProperty(this,"_client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._client=e}};function Lw(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}const Nw=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.create(null)),Ow=(e=Lw)=>function(t,...n){if(1===t.length)return t[0];let r=!1;const i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);const s=n[o];let c=(r?encodeURIComponent:e)(""+s);return o!==n.length&&(null==s||"object"==typeof s&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??Nw)??Nw)?.toString)&&(c=s+"",i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?"":c)},""),o=a.split(/[?#]/,1)[0],s=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let c;for(;null!==(c=s.exec(o));)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0;const t=i.reduce((t,n)=>{const r=" ".repeat(n.start-e),i="^".repeat(n.length);return e=n.start+n.length,t+r+i},"");throw new Cv(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join("\n")}\n${a}\n${t}`)}return a},Bw=/* @__PURE__ */Ow(Lw);class Mw extends Rw{create(e,t,n){const{extend_trace_retention:r,...i}=t;return this._client.post(Bw`/api/v1/platform/annotation-queues/${e}/items`,{query:{extend_trace_retention:r},body:i,...n})}update(e,t,n){const{queue_id:r,...i}=t;return this._client.patch(Bw`/api/v1/platform/annotation-queues/${r}/items/${e}`,{body:i,...n})}list(e,t,n){return this._client.getAPIList(Bw`/api/v1/platform/annotation-queues/${e}/items`,vw,{query:t,...n})}createStatus(e,t,n){return this._client.post(Bw`/api/v1/platform/annotation-queues/items/${e}/status`,{body:t,...n})}deleteAll(e,t,n){return this._client.post(Bw`/api/v1/platform/annotation-queues/${e}/items/delete`,{body:t,...n})}retrieveCount(e,t,n){return this._client.get(Bw`/api/v1/platform/annotation-queues/${e}/items/count`,{query:t,...n})}retrievePlacement(e,t,n){const{queue_id:r}=t;return this._client.get(Bw`/api/v1/platform/annotation-queues/${r}/items/${e}/placement`,n)}}let Dw=class extends Rw{create(e,t,n){const{body:r,extend_trace_retention:i}=t;return this._client.post(Bw`/api/v1/annotation-queues/${e}/runs`,{query:{extend_trace_retention:i},body:r,...n})}update(e,t,n){const{queue_id:r,...i}=t;return this._client.patch(Bw`/api/v1/annotation-queues/${r}/runs/${e}`,{body:i,...n})}list(e,t={},n){return this._client.get(Bw`/api/v1/annotation-queues/${e}/runs`,{query:t,...n})}createByKey(e,t,n){const{body:r,extend_trace_retention:i}=t;return this._client.post(Bw`/api/v1/annotation-queues/${e}/runs/by-key`,{query:{extend_trace_retention:i},body:r,...n})}deleteAll(e,t,n){return this._client.post(Bw`/api/v1/annotation-queues/${e}/runs/delete`,{body:t,...n})}deleteQueue(e,t,n){const{queue_id:r}=t;return this._client.delete(Bw`/api/v1/annotation-queues/${r}/runs/${e}`,n)}};class Fw extends Rw{constructor(){super(...arguments),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:new Dw(this._client)}),Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:new Mw(this._client)})}retrieve(e,t){return this._client.get(Bw`/api/v1/annotation-queues/${e}`,t)}update(e,t,n){return this._client.patch(Bw`/api/v1/annotation-queues/${e}`,{body:t,...n})}delete(e,t){return this._client.delete(Bw`/api/v1/annotation-queues/${e}`,t)}annotationQueues(e,t){return this._client.post("/api/v1/annotation-queues",{body:e,...t})}createRunStatus(e,t,n){return this._client.post(Bw`/api/v1/annotation-queues/status/${e}`,{body:t,...n})}export(e,t,n){return this._client.post(Bw`/api/v1/annotation-queues/${e}/export`,{body:t,...n})}populate(e,t){return this._client.post("/api/v1/annotation-queues/populate",{body:e,...t})}retrieveAnnotationQueues(e={},t){return this._client.getAPIList("/api/v1/annotation-queues",Aw,{query:e,...t})}retrieveQueues(e,t){return this._client.get(Bw`/api/v1/annotation-queues/${e}/queues`,t)}retrieveRun(e,t,n){const{queue_id:r,...i}=t;return this._client.get(Bw`/api/v1/annotation-queues/${r}/run/${e}`,{query:i,...n})}retrieveSize(e,t={},n){return this._client.get(Bw`/api/v1/annotation-queues/${e}/size`,{query:t,...n})}retrieveTotalArchived(e,t={},n){return this._client.get(Bw`/api/v1/annotation-queues/${e}/total_archived`,{query:t,...n})}retrieveTotalSize(e,t){return this._client.get(Bw`/api/v1/annotation-queues/${e}/total_size`,t)}}Fw.Runs=Dw,Fw.Items=Mw;class kw extends Rw{query(e,t,n){return this._client.getAPIList(Bw`/api/v2/datasets/${e}/experiment-runs`,Tw,{body:t,method:"post",...n})}}class Gw extends Rw{constructor(){super(...arguments),Object.defineProperty(this,"experimentRuns",{enumerable:!0,configurable:!0,writable:!0,value:new kw(this._client)})}}Gw.ExperimentRuns=kw;class Hw extends Rw{list(e){return this._client.get("/api/v1/info",e)}}class xw extends Rw{retrieve(e,t){return this._client.get(Bw`/api/v1/platform/issues/${e}`,t)}list(e={},t){return this._client.getAPIList("/api/v1/platform/issues",Sw,{query:e,...t})}}const Uw=/* @__PURE__ */Symbol("brand.privateNullableHeaders");function*Vw(e){if(!e)return;if(Uw in e){const{values:t,nulls:n}=e;yield*t.entries();for(const e of n)yield[e,null];return}let t,n=!1;e instanceof Headers?t=e.entries():D_(e)?t=e:(n=!0,t=Object.entries(e??{}));for(let r of t){const e=r[0];if("string"!=typeof e)throw new TypeError("expected header name to be a string");const t=D_(r[1])?r[1]:[r[1]];let i=!1;for(const r of t)void 0!==r&&(n&&!i&&(i=!0,yield[e,null]),yield[e,r])}}const $w=e=>{const t=new Headers,n=/* @__PURE__ */new Set;for(const r of e){const e=/* @__PURE__ */new Set;for(const[i,a]of Vw(r)){const r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),null===a?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[Uw]:!0,values:t,nulls:n}};class jw extends Rw{create(e,t){return this._client.post("/api/v1/platform/evaluators",{body:e,...t})}retrieve(e,t){return this._client.get(Bw`/api/v1/platform/evaluators/${e}`,t)}update(e,t,n){return this._client.patch(Bw`/api/v1/platform/evaluators/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList("/api/v1/platform/evaluators",bw,{query:e,...t})}delete(e,t={},n){const{delete_run_rules:r}=t??{};return this._client.delete(Bw`/api/v1/platform/evaluators/${e}`,{query:{delete_run_rules:r},...n,headers:$w([{Accept:"*/*"},n?.headers])})}bulkDelete(e,t){const{evaluator_ids:n,delete_run_rules:r}=e;return this._client.delete("/api/v1/platform/evaluators",{query:{evaluator_ids:n,delete_run_rules:r},...t})}spend(e,t){return this._client.get("/api/v1/platform/evaluators/spend",{query:e,...t})}}let Ww=class extends Rw{retrieve(e,t,n){const{share_token:r,Accept:i,...a}=t;return this._client.get(Bw`/api/v2/public/${r}/run/${e}`,{query:a,...n,headers:$w([{...null!=i?{Accept:i}:void 0},n?.headers])})}query(e,t,n){const{Accept:r,...i}=t;return this._client.post(Bw`/api/v2/public/${e}/runs/query`,{body:i,...n,headers:$w([{...null!=r?{Accept:r}:void 0},n?.headers])})}};class Xw extends Rw{constructor(){super(...arguments),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:new Ww(this._client)})}}Xw.Runs=Ww;class Kw extends Rw{create(e,t,n){return this._client.post(Bw`/api/v2/runs/${e}/share`,{body:t,...n})}delete(e,t,n){return this._client.delete(Bw`/api/v2/runs/${e}/share`,{body:t,...n,headers:$w([{Accept:"*/*"},n?.headers])})}}class Yw extends Rw{constructor(){super(...arguments),Object.defineProperty(this,"share",{enumerable:!0,configurable:!0,writable:!0,value:new Kw(this._client)}),Object.defineProperty(this,"retrieve",{enumerable:!0,configurable:!0,writable:!0,value:this.retrieveV2}),Object.defineProperty(this,"query",{enumerable:!0,configurable:!0,writable:!0,value:this.queryV2})}getURL(e,t,n){return this._client.get(Bw`/api/v2/runs/${e}/url`,{query:t,...n})}queryV2(e,t){const{Accept:n,...r}=e;return this._client.getAPIList("/api/v2/runs/query",Tw,{body:r,method:"post",...t,headers:$w([{...null!=n?{Accept:n}:void 0},t?.headers])})}retrieveV2(e,t,n){const{Accept:r,...i}=t;return this._client.get(Bw`/api/v2/runs/${e}`,{query:i,...n,headers:$w([{...null!=r?{Accept:r}:void 0},n?.headers])})}}Yw.Share=Kw;class qw extends Rw{create(e,t){return this._client.post("/api/v2/sandboxes/boxes",{body:e,...t})}retrieve(e,t){return this._client.get(Bw`/api/v2/sandboxes/boxes/${e}`,t)}update(e,t,n){return this._client.patch(Bw`/api/v2/sandboxes/boxes/${e}`,{body:t,...n})}list(e={},t){return this._client.getAPIList("/api/v2/sandboxes/boxes",vw,{query:e,...t})}delete(e,t){return this._client.delete(Bw`/api/v2/sandboxes/boxes/${e}`,{...t,headers:$w([{Accept:"*/*"},t?.headers])})}createSnapshot(e,t,n){return this._client.post(Bw`/api/v2/sandboxes/boxes/${e}/snapshot`,{body:t,...n})}generateDownloadURL(e,t,n){return this._client.post(Bw`/api/v2/sandboxes/boxes/${e}/download-url`,{body:t,...n})}generateServiceURL(e,t,n){return this._client.post(Bw`/api/v2/sandboxes/boxes/${e}/service-url`,{body:t,...n})}getStatus(e,t){return this._client.get(Bw`/api/v2/sandboxes/boxes/${e}/status`,t)}start(e,t){return this._client.post(Bw`/api/v2/sandboxes/boxes/${e}/start`,t)}stop(e,t){return this._client.post(Bw`/api/v2/sandboxes/boxes/${e}/stop`,{...t,headers:$w([{Accept:"*/*"},t?.headers])})}}class Qw extends Rw{create(e,t){return this._client.post("/api/v2/sandboxes/registries",{body:e,...t})}retrieve(e,t){return this._client.get(Bw`/api/v2/sandboxes/registries/${e}`,t)}update(e,t,n){return this._client.patch(Bw`/api/v2/sandboxes/registries/${e}`,{body:t,...n})}list(e={},t){return this._client.get("/api/v2/sandboxes/registries",{query:e,...t})}delete(e,t){return this._client.delete(Bw`/api/v2/sandboxes/registries/${e}`,{...t,headers:$w([{Accept:"*/*"},t?.headers])})}}class Jw extends Rw{create(e,t){return this._client.post("/api/v2/sandboxes/snapshots",{body:e,...t})}retrieve(e,t){return this._client.get(Bw`/api/v2/sandboxes/snapshots/${e}`,t)}list(e={},t){return this._client.getAPIList("/api/v2/sandboxes/snapshots",vw,{query:e,...t})}delete(e,t){return this._client.delete(Bw`/api/v2/sandboxes/snapshots/${e}`,{...t,headers:$w([{Accept:"*/*"},t?.headers])})}retrieveByName(e,t){return this._client.get(Bw`/api/v2/sandboxes/snapshots-by-name/${e}`,t)}}class zw extends Rw{constructor(){super(...arguments),Object.defineProperty(this,"boxes",{enumerable:!0,configurable:!0,writable:!0,value:new qw(this._client)}),Object.defineProperty(this,"registries",{enumerable:!0,configurable:!0,writable:!0,value:new Qw(this._client)}),Object.defineProperty(this,"snapshots",{enumerable:!0,configurable:!0,writable:!0,value:new Jw(this._client)})}}zw.Boxes=qw,zw.Registries=Qw,zw.Snapshots=Jw;class Zw extends Rw{listTraces(e,t,n){return this._client.getAPIList(Bw`/api/v2/threads/${e}/traces`,vw,{query:t,...n})}query(e,t){return this._client.getAPIList("/api/v2/threads/query",Tw,{body:e,method:"post",...t})}stats(e,t,n){return this._client.get(Bw`/api/v2/threads/${e}/stats`,{query:t,...n})}}class eE extends Rw{listRuns(e,t,n){const{Accept:r,...i}=t;return this._client.get(Bw`/api/v2/traces/${e}/runs`,{query:i,...n,headers:$w([{...null!=r?{Accept:r}:void 0},n?.headers])})}query(e,t){return this._client.getAPIList("/api/v2/traces/query",Tw,{body:e,method:"post",...t})}}const tE=e=>void 0!==globalThis.process?globalThis.process.env?.[e]?.trim()||void 0:void 0!==globalThis.Deno&&globalThis.Deno.env?.get?.(e)?.trim()||void 0;var nE,rE,iE,aE,oE=function(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)};class sE{constructor({baseURL:e=tE("LANGCHAIN_BASE_URL"),apiKey:t=tE("LANGSMITH_API_KEY")??null,tenantID:n=tE("LANGSMITH_TENANT_ID")??null,...r}={}){nE.add(this),Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tenantID",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"maxRetries",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logger",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"logLevel",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetch",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),iE.set(this,void 0),Object.defineProperty(this,"idempotencyHeader",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_options",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"datasets",{enumerable:!0,configurable:!0,writable:!0,value:new Gw(this)}),Object.defineProperty(this,"runs",{enumerable:!0,configurable:!0,writable:!0,value:new Yw(this)}),Object.defineProperty(this,"threads",{enumerable:!0,configurable:!0,writable:!0,value:new Zw(this)}),Object.defineProperty(this,"traces",{enumerable:!0,configurable:!0,writable:!0,value:new eE(this)}),Object.defineProperty(this,"onlineEvaluators",{enumerable:!0,configurable:!0,writable:!0,value:new jw(this)}),Object.defineProperty(this,"public",{enumerable:!0,configurable:!0,writable:!0,value:new Xw(this)}),Object.defineProperty(this,"annotationQueues",{enumerable:!0,configurable:!0,writable:!0,value:new Fw(this)}),Object.defineProperty(this,"info",{enumerable:!0,configurable:!0,writable:!0,value:new Hw(this)}),Object.defineProperty(this,"issues",{enumerable:!0,configurable:!0,writable:!0,value:new xw(this)}),Object.defineProperty(this,"sandboxes",{enumerable:!0,configurable:!0,writable:!0,value:new zw(this)});const i={apiKey:t,tenantID:n,...r,baseURL:e||"https://api.smith.langchain.com/"};this.baseURL=i.baseURL,this.timeout=i.timeout??rE.DEFAULT_TIMEOUT,this.logger=i.logger??console;const a="warn";this.logLevel=a,this.logLevel=ow(i.logLevel,"ClientOptions.logLevel",this)??ow(tE("LANGCHAIN_LOG"),"process.env['LANGCHAIN_LOG']",this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??function(){if("undefined"!=typeof fetch)return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Langsmith({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}(),function(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===r?i.call(e,n):i?i.value=n:t.set(e,n)}(this,iE,j_,"f");const o=tE("LANGCHAIN_CUSTOM_HEADERS");if(o){const e={};for(const t of o.split("\n")){const n=t.indexOf(":");n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}i.defaultHeaders={...e,...i.defaultHeaders}}this._options=i,this.apiKey=t,this.tenantID=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,tenantID:this.tenantID,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(this.apiKey&&e.get("x-api-key")||t.has("x-api-key")||this.tenantID&&e.get("x-tenant-id")||t.has("x-tenant-id")))throw new Error('Could not resolve authentication method. Expected either apiKey or tenantID to be set. Or for one of the "X-API-Key" or "X-Tenant-Id" headers to be explicitly omitted')}async authHeaders(e){return $w([await this.apiKeyAuth(e),await this.tenantIDAuth(e)])}async apiKeyAuth(e){if(null!=this.apiKey)return $w([{"X-API-Key":this.apiKey}])}async tenantIDAuth(e){if(null!=this.tenantID)return $w([{"X-Tenant-Id":this.tenantID}])}stringifyQuery(e){return function(e){return iw(e,{arrayFormat:"repeat"})}(e)}getUserAgent(){return`${this.constructor.name}/JS ${G_}`}defaultIdempotencyKey(){return`stainless-node-retry-${O_()}`}makeStatusError(e,t,n,r){return Av.generate(e,t,n,r)}buildURL(e,t,n){const r=!oE(this,nE,"m",aE).call(this)&&n||this.baseURL,i=(e=>B_.test(e))(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return k_(a)&&k_(o)||(t={...o,...a,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new gw(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){const r=await e,i=r.maxRetries??this.maxRetries;null==t&&(t=i),await this.prepareOptions(r);const{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});const c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=void 0===n?"":`, retryOf: ${n}`,u=Date.now();if(dw(this).debug(`[${c}] sending request`,pw({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new Sv;const d=new AbortController,p=await this.fetchWithTimeout(o,a,s,d).catch(Iv),h=Date.now();if(p instanceof globalThis.Error){const e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new Sv;const i="object"==typeof(f=p)&&null!==f&&("name"in f&&"AbortError"===f.name||"message"in f&&String(f.message).includes("FetchRequestCanceledException"))||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(t)return dw(this).info(`[${c}] connection ${i?"timed out":"failed"} - ${e}`),dw(this).debug(`[${c}] connection ${i?"timed out":"failed"} (${e})`,pw({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),this.retryRequest(r,t,n??c);if(dw(this).info(`[${c}] connection ${i?"timed out":"failed"} - error; no more retries left`),dw(this).debug(`[${c}] connection ${i?"timed out":"failed"} (error; no more retries left)`,pw({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),i)throw new Tv;throw new bv({cause:p})}var f;const m=`[${c}${l}] ${a.method} ${o} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-u}ms`;if(!p.ok){const e=await this.shouldRetry(p);if(t&&e){const e=`retrying, ${t} attempts remaining`;return await async function(e){if(null===e||"object"!=typeof e)return;if(e[Symbol.asyncIterator])return void(await(e[Symbol.asyncIterator]().return?.()));const t=e.getReader(),n=t.cancel();t.releaseLock(),await n}(p.body),dw(this).info(`${m} - ${e}`),dw(this).debug(`[${c}] response error (${e})`,pw({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),this.retryRequest(r,t,n??c,p.headers)}const i=e?"error; no more retries left":"error; not retryable";dw(this).info(`${m} - ${i}`);const a=await p.text().catch(e=>Iv(e).message),o=(e=>{try{return JSON.parse(e)}catch(f){return}})(a),s=o?void 0:a;dw(this).debug(`[${c}] response error (${i})`,pw({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:s,durationMs:Date.now()-u}));throw this.makeStatusError(p.status,o,s,p.headers)}return dw(this).info(m),dw(this).debug(`[${c}] response start`,pw({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),{response:p,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&"then"in n?n.then(t=>({method:"get",path:e,...t})):{method:"get",path:e,...n})}requestAPIList(e,t){const n=this.makeRequest(t,null,void 0);return new Cw(this,n,e)}async fetchWithTimeout(e,t,n,r){const{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener("abort",s,{once:!0});const c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||"object"==typeof o.body&&null!==o.body&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){const t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||(409===e.status||(429===e.status||e.status>=500)))}async retryRequest(e,t,n,r){let i;const a=r?.get("retry-after-ms");if(a){const e=parseFloat(a);Number.isNaN(e)||(i=e)}const o=r?.get("retry-after");if(o&&!i){const e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}if(void 0===i){const n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}var s;return await(s=i,new Promise(e=>setTimeout(e,s))),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){const n=t-e;return Math.min(.5*Math.pow(2,n),16)*(1-.25*Math.random())*1e3}async buildRequest(e,{retryCount:t=0}={}){const n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);"timeout"in n&&((e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new Cv(`${e} must be an integer`);if(t<0)throw new Cv(`${e} must be a positive integer`)})("timeout",n.timeout),n.timeout=n.timeout??this.timeout;const{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&"get"!==t&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);const a=$w([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...V_??=H_()},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};const n=$w([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||"string"==typeof e&&n.values.has("content-type")||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:"object"==typeof e&&(Symbol.asyncIterator in e||Symbol.iterator in e&&"next"in e&&"function"==typeof e.next)?{bodyHeaders:void 0,body:$_(e)}:"object"==typeof e&&"application/x-www-form-urlencoded"===n.values.get("content-type")?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(e)}:oE(this,iE,"f").call(this,{body:e,headers:n})}}rE=sE,iE=/* @__PURE__ */new WeakMap,nE=/* @__PURE__ */new WeakSet,aE=function(){return"https://api.smith.langchain.com/"!==this.baseURL},Object.defineProperty(sE,"Langsmith",{enumerable:!0,configurable:!0,writable:!0,value:rE}),Object.defineProperty(sE,"DEFAULT_TIMEOUT",{enumerable:!0,configurable:!0,writable:!0,value:9e4}),Object.defineProperty(sE,"LangsmithError",{enumerable:!0,configurable:!0,writable:!0,value:Cv}),Object.defineProperty(sE,"APIError",{enumerable:!0,configurable:!0,writable:!0,value:Av}),Object.defineProperty(sE,"APIConnectionError",{enumerable:!0,configurable:!0,writable:!0,value:bv}),Object.defineProperty(sE,"APIConnectionTimeoutError",{enumerable:!0,configurable:!0,writable:!0,value:Tv}),Object.defineProperty(sE,"APIUserAbortError",{enumerable:!0,configurable:!0,writable:!0,value:Sv}),Object.defineProperty(sE,"NotFoundError",{enumerable:!0,configurable:!0,writable:!0,value:Ev}),Object.defineProperty(sE,"ConflictError",{enumerable:!0,configurable:!0,writable:!0,value:Pv}),Object.defineProperty(sE,"RateLimitError",{enumerable:!0,configurable:!0,writable:!0,value:Lv}),Object.defineProperty(sE,"BadRequestError",{enumerable:!0,configurable:!0,writable:!0,value:vv}),Object.defineProperty(sE,"AuthenticationError",{enumerable:!0,configurable:!0,writable:!0,value:_v}),Object.defineProperty(sE,"InternalServerError",{enumerable:!0,configurable:!0,writable:!0,value:Nv}),Object.defineProperty(sE,"PermissionDeniedError",{enumerable:!0,configurable:!0,writable:!0,value:wv}),Object.defineProperty(sE,"UnprocessableEntityError",{enumerable:!0,configurable:!0,writable:!0,value:Rv}),Object.defineProperty(sE,"toFile",{enumerable:!0,configurable:!0,writable:!0,value:async function(e,t,n){if(_w(),(e=>null!=e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.lastModified&&Ew(e))(e=await e))return e instanceof File?e:ww([await e.arrayBuffer()],e.name);if((e=>null!=e&&"object"==typeof e&&"string"==typeof e.url&&"function"==typeof e.blob)(e)){const r=await e.blob();return t||=new URL(e.url).pathname.split(/[\\/]/).pop(),ww(await Pw(r),t,n)}const r=await Pw(e);if(t||=function(e){return("object"==typeof e&&null!==e&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}(e),!n?.type){const e=r.find(e=>"object"==typeof e&&"type"in e&&e.type);"string"==typeof e&&(n={...n,type:e})}return ww(r,t,n)}}),sE.Datasets=Gw,sE.Runs=Yw,sE.Threads=Zw,sE.Traces=eE,sE.OnlineEvaluators=jw,sE.Public=Xw,sE.AnnotationQueues=Fw,sE.Info=Hw,sE.Issues=xw,sE.Sandboxes=zw;const cE=1000000n,lE=new TextEncoder,uE="clickhouse_only",dE="smithdb_only",pE="dual";function hE(e){return`Invalid prompt identifier format: "${e}". Expected one of:\n - "prompt-name" (for private prompts)\n - "owner/prompt-name" (for prompts with explicit owner)\n - "prompt-name:commit-hash" (with commit reference)\n - "owner/prompt-name:commit-hash" (with owner and commit)`}class fE extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithConflictError",this.status=409}}class mE extends Error{constructor(e){super(e),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="LangSmithNotFoundError",this.status=404}}function gE(e){return null!=e&&"object"==typeof e&&"name"in e&&"LangSmithNotFoundError"===e?.name}async function yE(e,t,n){let r;if(e.ok)return void(n&&(r=await e.text()));if(403===e.status)try{const t=await e.json(),n=t?.error;"org_scoped_key_requires_workspace"===n&&(r="This API key is org-scoped and requires workspace specification. Please provide 'workspaceId' parameter, or set LANGSMITH_WORKSPACE_ID environment variable.")}catch(o){const t=new Error(`${e.status} ${e.statusText}`);throw t.status=e?.status,t}if(void 0===r)try{r=await e.text()}catch(o){r=""}const i=`Failed to ${t}. Received status [${e.status}]: ${e.statusText}. Message: ${r}`;if(404===e.status)throw new mE(i);if(409===e.status)throw new fE(i);const a=new Error(i);throw a.status=e.status,a}const IE="ERR_CONFLICTING_ENDPOINTS";class CE extends Error{constructor(){super("You cannot provide both LANGSMITH_ENDPOINT / LANGCHAIN_ENDPOINT and LANGSMITH_RUNS_ENDPOINTS."),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:IE}),this.name="ConflictingEndpointsError"}}function AE(e){if(!e||e.split("/").length>2||e.startsWith("/")||e.endsWith("/")||e.split(":").length>2)throw new Error(hE(e));const[t,n]=e.split(":"),r=n||"latest";if(t.includes("/")){const[n,i]=t.split("/",2);if(!n||!i)throw new Error(hE(e));return[n,i,r]}if(!t)throw new Error(hE(e));return["-",t,r]}const SE="created_at";function bE(e){return new Promise(t=>setTimeout(t,e))}function TE(e){return"object"==typeof e&&null!==e&&"EEXIST"===e.code}function vE(e){try{return(lv(e,SE),"").split("\n")}catch{return}}async function _E(e){const t=function(e){const t=vE(e);if(t&&t[0]&&t[0].trim()){const e=Date.parse(t[0].trim());if(!Number.isNaN(e))return e}}(e);return!(void 0===t||Date.now()-t<=1e4)&&(await mv(),!0)}async function wE(e,t){const n=`${e}.oauth.lock.lock`;uv(n)&&await dv();const r=globalThis.crypto.randomUUID();for(;;){try{await fv()}catch(i){if(!TE(i))throw i;if(!(await _E(n))){if(Date.now()>=t)throw new Error("timed out acquiring OAuth refresh lock");await bE(Math.min(10,Math.max(0,t-Date.now())))}continue}try{await pv(lv(n,SE),/* @__PURE__ */(new Date).toISOString())}catch(i){throw await mv(),i}break}return{async release(){(function(e){const t=vE(e);if(t&&t.length>=2&&t[1].trim())return t[1].trim()})(n)===r&&await mv()}}}const EE="https://api.smith.langchain.com",PE="/.well-known/oauth-authorization-server";function RE(){(function(){const e=Dv();return"browser"===e||"webworker"===e})()||function(){const e=Uv("LANGSMITH_CONFIG_FILE");if(e)return e;const t=Uv("HOME")??Uv("USERPROFILE");t&&lv(t,".langsmith","config.json")}()}function LE(e){return null!=e&&""!==e.trim()}function NE(e){return e?.trim().replace(/^["']|["']$/g,"")}function OE(e){const t=e.oauth;if(!t?.refresh_token)return!1;if(!t.access_token)return!0;if(!t.expires_at)return!1;const n=Date.parse(t.expires_at);return!Number.isNaN(n)&&n<=Date.now()+6e4}function BE(e){let t=e;for(;t.endsWith("/");)t=t.slice(0,-1);const n="/api/v1";return t.endsWith(n)?t.slice(0,-7):t}function ME(e){const t=`${e}${PE}`;let n;try{const t=new URL(e);n=`${t.origin}${PE}${"/"===t.pathname?"":t.pathname}`}catch{return[t]}return n===t?[n]:[n,t]}async function DE(e,t,n){let r,i;try{r=await n(e,{method:"GET",headers:{Accept:"application/json"},signal:AbortSignal.timeout(5e3)})}catch{return}if(r.ok){try{i=await r.json()}catch{return}return i&&"object"==typeof i&&function(e,t){const{issuer:n}=e;if("string"!=typeof n||n.replace(/\/+$/,"")!==t.replace(/\/+$/,""))return!1;let r;try{r=new URL(n)}catch{return!1}for(const i of[e.device_authorization_endpoint,e.token_endpoint]){if("string"!=typeof i||!i)return!1;try{const e=new URL(i);if(e.protocol!==r.protocol||e.host!==r.host)return!1}catch{return!1}}return!0}(i,t)?i:void 0}}async function FE(e,t){for(const n of function(e){const t=BE(e),n=t.endsWith("/api")?t.slice(0,-4):t,r=[];for(const i of[t,`${n}/api`,n])i&&"/api"!==i&&!r.includes(i)&&r.push(i);return r}(e))for(const e of ME(n)){const r=await DE(e,n,t);if(r)return r.token_endpoint}return`${BE(e)}/oauth/token`}function kE(e){return e.reason??new Error("The operation was aborted.")}class GE{constructor(e){Object.defineProperty(this,"state",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"refreshPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"managedAuthorizationValue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.rememberProfileAuthHeader(this.currentAuthHeader())}currentAuthHeader(){const e=function(e){const t=NE(e.oauth?.access_token);if(t)return{name:"Authorization",value:`Bearer ${t}`};if(NE(e.oauth?.refresh_token))return;return HE(e)}(this.state.profile);return this.rememberProfileAuthHeader(e),e}async getAuthHeader(e,t){OE(this.state.profile)&&(this.refreshPromise||(this.refreshPromise=this.refreshOAuthToken(e).finally(()=>{this.refreshPromise=void 0})),await async function(e,t){if(!t)return e;if(t.aborted)throw kE(t);let n;const r=new Promise((e,r)=>{const i=()=>{r(kE(t))};t.addEventListener("abort",i,{once:!0}),n=()=>{t.removeEventListener("abort",i)}});try{return await Promise.race([e,r])}finally{n?.()}}(this.refreshPromise,t));const n=HE(this.state.profile);return this.rememberProfileAuthHeader(n),n}isProfileAuthorizationHeader(e){return e===this.managedAuthorizationValue}reloadProfile(){try{const e=JSON.parse((this.state.configPath,"")),t=e.profiles?.[this.state.profileName];if(!t)return;return this.state.config=e,this.state.profile=t,t}catch{return}}async refreshOAuthToken(e){const t=this.state.profile.oauth?.refresh_token;if(!t)return;const n=NE(this.state.profile.api_url)??EE,r=Date.now()+1e4;let i;try{i=await wE(this.state.configPath,r);if(this.reloadProfile()&&!OE(this.state.profile))return;const a=new URLSearchParams({grant_type:"refresh_token",client_id:"langsmith-cli",refresh_token:this.state.profile.oauth?.refresh_token??t}),o=await FE(n,e),s=await e(o,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a.toString(),signal:AbortSignal.timeout(Math.max(0,r-Date.now()))});if(!s.ok)return;const c=await s.json();if(!c.access_token)return;!function(e,t){e.oauth??={},t.access_token&&(e.oauth.access_token=t.access_token),t.refresh_token&&(e.oauth.refresh_token=t.refresh_token),"number"==typeof t.expires_in&&t.expires_in>0&&(e.oauth.expires_at=new Date(Date.now()+1e3*t.expires_in).toISOString())}(this.state.profile,c),this.state.config.profiles??={},this.state.config.profiles[this.state.profileName]=this.state.profile,await pv(this.state.configPath,JSON.stringify(this.state.config,null,2))}catch{return}finally{await(i?.release())}}rememberProfileAuthHeader(e){this.managedAuthorizationValue="Authorization"===e?.name?e.value:void 0}}function HE(e){const t=NE(e.oauth?.access_token);if(t)return{name:"Authorization",value:`Bearer ${t}`};const n=NE(e.api_key);return n?{name:"x-api-key",value:n}:void 0}var xE="[...]",UE={result:"[Circular]"},VE=[],$E=[];const jE=new TextEncoder;function WE(e){return jE.encode(e)}function XE(e){if(e&&"object"==typeof e&&null!==e){if(e instanceof Map)return Object.fromEntries(e);if(e instanceof Set)return Array.from(e);if(e instanceof Date)return e.toISOString();if(e instanceof RegExp)return e.toString();if(e instanceof Error)return{name:e.name,message:e.message}}else if("bigint"==typeof e)return e.toString();return e}function KE(e,t,n,r,i){try{return WE(JSON.stringify(e,function(e,t){return XE(t)},r))}catch(a){if(!a.message?.includes("Converting circular structure to JSON"))return console.warn("[WARNING]: LangSmith received unserializable value."+(t?`\nContext: ${t}`:"")),WE("[Unserializable]");let s;"true"!==Vv("SUPPRESS_CIRCULAR_JSON_WARNINGS")&&console.warn("[WARNING]: LangSmith received circular JSON. This will decrease tracer performance. "+(t?`\nContext: ${t}`:"")),void 0===i&&(i={depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}),qE(e,"",0,[],void 0,0,i);try{s=0===$E.length?JSON.stringify(e,n,r):JSON.stringify(e,function(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if($E.length>0)for(var r=0;r<$E.length;r++){var i=$E[r];if(i[1]===t&&i[0]===n){n=i[2],$E.splice(r,1);break}}return e.call(this,t,n)}}(n),r)}catch(o){return WE("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==VE.length;){const e=VE.pop();4===e.length?Object.defineProperty(e[0],e[1],e[3]):e[0][e[1]]=e[2]}}return WE(s)}}function YE(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),VE.push([r,n,t,i])):$E.push([t,n,e]):(r[n]=e,VE.push([r,n,t]))}function qE(e,t,n,r,i,a,o){var s;if(a+=1,"object"==typeof e&&null!==e){for(s=0;s<r.length;s++)if(r[s]===e)return void YE(UE,e,t,i);if(void 0!==o.depthLimit&&a>o.depthLimit)return void YE(xE,e,t,i);if(void 0!==o.edgesLimit&&n+1>o.edgesLimit)return void YE(xE,e,t,i);if(r.push(e),Array.isArray(e))for(s=0;s<e.length;s++)qE(e[s],s,s,r,e,a,o);else{e=XE(e);var c=Object.keys(e);for(s=0;s<c.length;s++){var l=c[s];qE(e[l],l,s,r,e,a,o)}}r.pop()}}class QE{constructor(){Object.defineProperty(this,"worker",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"nextId",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"pending",{enumerable:!0,configurable:!0,writable:!0,value:/* @__PURE__ */new Map}),Object.defineProperty(this,"disabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"startPromise",{enumerable:!0,configurable:!0,writable:!0,value:null})}async ensureStarted(){if(this.disabled)return!1;if(null!==this.worker)return!0;if(null!==this.startPromise)return this.startPromise;this.startPromise=this._start();try{return await this.startPromise}finally{this.startPromise=null}}async _start(){return this.disabled=!0,!1}async serialize(e){if(!(await this.ensureStarted()))return null;const t=this.nextId++;return new Promise((n,r)=>{this.pending.set(t,{resolve:n,reject:r});try{this.worker.postMessage({id:t,op:"serialize",payload:e})}catch(i){this.pending.delete(t),r(i)}})}async terminate(){this.worker&&(await this.worker.terminate(),this.worker=null);for(const[,e]of this.pending)e.reject(new Error("worker terminated"));this.pending.clear()}}let JE=null;function zE(e){return"string"==typeof e&&e.length>0&&!e.includes("Z")&&!e.includes("+")&&!e.includes("-",10)?e+"Z":e}function ZE(e){return{...e,start_time:zE(e.start_time),end_time:zE(e.end_time)}}function eP(e,t,n){if(n)return e;const r=kv(),i=t??xv(),a=e.extra??{},o=a.metadata;return e.extra={...a,runtime:{...r,...a?.runtime},metadata:{...i,...i.revision_id||"revision_id"in e&&e.revision_id?{revision_id:("revision_id"in e?e.revision_id:void 0)??i.revision_id}:{},...o}},e}function tP(e){if(void 0!==e)return e.trim().replace(/^"(.*)"$/,"$1").replace(/^'(.*)'$/,"$1")}const nP=async e=>{if(429===e?.status){const t=1e3*parseInt(e.headers.get("retry-after")??"10",10);if(t>0)return await new Promise(e=>setTimeout(e,t)),!0}return!1};function rP(e){return"number"==typeof e?Number(e.toFixed(4)):e}const iP=1073741824;function aP(e,t){new Headers({[e]:t})}function oP(e){for(const[t,n]of Object.entries(e??{}))aP(t,n)}function sP(e){if(!e)return{};const t=e instanceof Headers?[...e.entries()]:Array.isArray(e)?e.map(([e,t])=>[e,t]):Object.entries(e),n={},r=/* @__PURE__ */new Map;for(const[i,a]of t){aP(i,a);const e=i.toLowerCase(),t=r.get(e);void 0===t?(r.set(e,i),n[i]=a):n[t]=a}return n}class cP{constructor(e){Object.defineProperty(this,"items",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"sizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"maxSizeBytes",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSizeBytes=e??iP}peek(){return this.items[0]}push(e){let t;const n=new Promise(e=>{t=e}),r=function(e){try{let t=function(e){const t=c(e);return t>s&&(s=t),t+2},n=function(e){return 0===e?2:2+4*e},r=function(e){return void 0===e||"function"==typeof e||"symbol"==typeof e},i=function(e){return void 0===e||"function"==typeof e||"symbol"==typeof e?4:a(e)},a=function(e){if(null===e)return 4;if(void 0===e)return 0;const s=typeof e;if("boolean"===s)return 5;if("number"===s)return Number.isFinite(e)?e.toString().length:4;if("bigint"===s)return e.toString().length+2;if("string"===s)return t(e);if("function"===s||"symbol"===s)return 0;const l=e;if(l instanceof Date)return 26;if(l instanceof RegExp)return c(l.toString())+2;if(l instanceof Error){const e=l.name??"",t=l.message??"";return 22+c(e)+c(t)}if("undefined"!=typeof Buffer&&l instanceof Buffer)return 28+n(l.byteLength);if(ArrayBuffer.isView(l))return l instanceof DataView?2:2+(l.length??0)*(l instanceof Float32Array||l instanceof Float64Array?30:12);if(l instanceof ArrayBuffer)return 2;if(o.has(l))return 24;if("function"==typeof l.toJSON){let e;try{e=l.toJSON("")}catch{return 16}o.add(l);const t=a(e);return o.delete(l),t}let u;if(o.add(l),Array.isArray(l)){u=2;const e=l.length;for(let t=0;t<e;t++)u+=i(l[t]),t<e-1&&(u+=1)}else if(l instanceof Map){u=2;let e=0;for(const[t,n]of l){if(r(n))continue;e>0&&(u+=1);const i="string"==typeof t?t:String(t);u+=c(i)+3,u+=a(n),e++}}else if(l instanceof Set){u=2;let e=0;for(const t of l)e>0&&(u+=1),u+=i(t),e++}else{u=2;let e=0;const t=Object.keys(l);for(let n=0;n<t.length;n++){const i=t[n],o=l[i];r(o)||(e>0&&(u+=1),u+=c(i)+3,u+=a(o),e++)}}return o.delete(l),u};const o=/* @__PURE__ */new Set;let s=0;const c="undefined"!=typeof Buffer&&"function"==typeof Buffer.byteLength?e=>Buffer.byteLength(e,"utf8"):e=>e.length;return{size:a(e),maxStringLen:s}}catch{return{size:KE(e).length,maxStringLen:0}}}(e.item).size;return this.sizeBytes+r>this.maxSizeBytes&&this.items.length>0?(console.warn(`AutoBatchQueue size limit (${this.maxSizeBytes} bytes) exceeded. Dropping run with id: ${e.item.id}. Current queue size: ${this.sizeBytes} bytes, attempted addition: ${r} bytes.`),t(),n):(this.items.push({action:e.action,payload:e.item,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,workspaceId:e.workspaceId,itemPromiseResolve:t,itemPromise:n,size:r}),this.sizeBytes+=r,n)}pop({upToSizeBytes:e,upToSize:t}){if(e<1)throw new Error("Number of bytes to pop off may not be less than 1.");const n=[];let r=0;for(;r+(this.peek()?.size??0)<e&&this.items.length>0&&n.length<t;){const e=this.items.shift();e&&(n.push(e),r+=e.size,this.sizeBytes-=e.size)}if(0===n.length&&this.items.length>0){const e=this.items.shift();n.push(e),r+=e.size,this.sizeBytes-=e.size}return[n.map(e=>({action:e.action,item:e.payload,otelContext:e.otelContext,apiKey:e.apiKey,apiUrl:e.apiUrl,workspaceId:e.workspaceId,size:e.size})),()=>n.forEach(e=>e.itemPromiseResolve())]}}class lP{get tracingMode(){return this._tracingMode}get _fetch(){const e=this.fetchImplementation||dT(this.debug);return async(t,n)=>{let r;const i=this.getProfileManagedAuthorizationHeader(n);return void 0!==this.apiKey?r={name:"x-api-key",value:`${this.apiKey}`}:this.hasExplicitAuthHeader(n,i)||(r=await(this.profileAuth?.getAuthHeader(e,n?.signal))),e(t,this.applyCurrentAuthHeaders(n,r,i))}}getProfileManagedAuthorizationHeader(e){if(!e?.headers||!this.profileAuth)return;const t=new Headers(e.headers).get("Authorization");return LE(t)&&this.profileAuth.isProfileAuthorizationHeader(t??"")?t??void 0:void 0}isProfileManagedAuthorizationHeader(e,t){return e===t||!0===this.profileAuth?.isProfileAuthorizationHeader(e)}hasExplicitAuthHeader(e,t){if(!e?.headers)return!1;const n=new Headers(e.headers);if(LE(n.get("x-api-key")))return!0;const r=n.get("Authorization");return!!LE(r)&&!this.isProfileManagedAuthorizationHeader(r??"",t)}applyCurrentAuthHeaders(e,t,n){if(!t)return e;const r=e=>{if(void 0!==this.apiKey&&"x-api-key"===t.name)return e.delete("Authorization"),e.has("x-api-key")||e.set("x-api-key",t.value),e;if("Authorization"===t.name){if(LE(e.get("x-api-key")))return e;const r=e.get("Authorization");return LE(r)&&!this.isProfileManagedAuthorizationHeader(r??"",n)||e.set("Authorization",t.value),e}const r=e.get("Authorization");return LE(r)&&!this.isProfileManagedAuthorizationHeader(r??"",n)||(LE(r)&&e.delete("Authorization"),e.has("x-api-key")||e.set("x-api-key",t.value)),e};if(!e)return{headers:{[t.name]:t.value}};if(e.headers instanceof Headers)return{...e,headers:r(new Headers(e.headers))};if(Array.isArray(e.headers))return{...e,headers:r(new Headers(e.headers))};const i={...e.headers??{}},a=e=>Object.keys(i).find(t=>t.toLowerCase()===e),o=e=>{const t=a(e);return t?i[t]:void 0},s=LE(o("x-api-key")),c=o("authorization"),l=LE(c)&&!this.isProfileManagedAuthorizationHeader(c??"",n);if(void 0!==this.apiKey&&"x-api-key"===t.name){const n=a("authorization");return n&&delete i[n],s||(i["x-api-key"]=t.value),{...e,headers:i}}if("Authorization"===t.name){if(!s&&!l){const e=a("authorization");e&&"Authorization"!==e&&delete i[e],i.Authorization=t.value}return{...e,headers:i}}if(!l){const e=a("authorization");e&&delete i[e],s||(i["x-api-key"]=t.value)}return{...e,headers:i}}_trackDrain(e){this._pendingDrains.add(e),e.finally(()=>{this._pendingDrains.delete(e)})}async _serializeBody(e,t){if(this.manualFlushMode)return KE(e,t);if(!function(e,t=65536,n=2048){if(null===e||"object"!=typeof e)return"string"==typeof e&&e.length>=t;const r=[e],i=/* @__PURE__ */new Set;let a=0;for(;r.length>0;){if(a++>=n)return!1;const e=r.pop();if(null==e)continue;const o=typeof e;if("string"===o){if(e.length>=t)return!0;continue}if("object"!==o)continue;const s=e;if(i.has(s))continue;if(i.add(s),s instanceof Date||s instanceof RegExp||s instanceof Error||s instanceof ArrayBuffer||ArrayBuffer.isView(s))continue;if(Array.isArray(s)){for(let e=s.length-1;e>=0;e--)r.push(s[e]);continue}if(s instanceof Map){for(const[,e]of s)r.push(e);continue}if(s instanceof Set){for(const e of s)r.push(e);continue}const c=Object.keys(s);for(let t=c.length-1;t>=0;t--)r.push(s[c[t]])}return!1}(e))return KE(e,t);if(void 0===this._serializeWorker&&(this._serializeWorker=(null===JE&&(JE=new QE),JE)),null===this._serializeWorker)return KE(e,t);try{const n=await this._serializeWorker.serialize(e);return null===n?(this._serializeWorker=null,KE(e,t)):n}catch{return KE(e,t)}}constructor(e={}){Object.defineProperty(this,"apiKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"apiUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"webUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"workspaceId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"caller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchIngestCaller",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"timeout_ms",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tenantId",{enumerable:!0,configurable:!0,writable:!0,value:null}),Object.defineProperty(this,"hideInputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideOutputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"hideMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"anonymizer",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"omitTracedRuntimeInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingSampleRate",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTracing",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"autoBatchQueue",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"autoBatchAggregationDelayMs",{enumerable:!0,configurable:!0,writable:!0,value:250}),Object.defineProperty(this,"batchSizeBytesLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"batchSizeLimit",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"fetchOptions",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_fetchOptionsHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_openAPIClient",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_openAPIClientSignature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"settings",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"blockOnRootRunFinalization",{enumerable:!0,configurable:!0,writable:!0,value:"false"===Uv("LANGSMITH_TRACING_BACKGROUND")}),Object.defineProperty(this,"traceBatchConcurrency",{enumerable:!0,configurable:!0,writable:!0,value:5}),Object.defineProperty(this,"_serverInfo",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_getServerInfoPromise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_stainlessVersionsChecked",{enumerable:!0,configurable:!0,writable:!0,value:/* @__PURE__ */new Set}),Object.defineProperty(this,"manualFlushMode",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_serializeWorker",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pendingDrains",{enumerable:!0,configurable:!0,writable:!0,value:/* @__PURE__ */new Set}),Object.defineProperty(this,"langSmithToOTELTranslator",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_tracingMode",{enumerable:!0,configurable:!0,writable:!0,value:"langsmith"}),Object.defineProperty(this,"fetchImplementation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cachedLSEnvVarsForMetadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_promptCache",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"profileAuth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"multipartStreamingDisabled",{enumerable:!0,configurable:!0,writable:!0,value:"true"===Vv("DISABLE_MULTIPART_STREAMING")}),Object.defineProperty(this,"_multipartDisabled",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_runCompressionDisabled",{enumerable:!0,configurable:!0,writable:!0,value:"true"===Vv("DISABLE_RUN_COMPRESSION")}),Object.defineProperty(this,"failedTracesDir",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"failedTracesMaxBytes",{enumerable:!0,configurable:!0,writable:!0,value:104857600}),Object.defineProperty(this,"_customHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"debug",{enumerable:!0,configurable:!0,writable:!0,value:"true"===Uv("LANGSMITH_DEBUG")});const t=lP.getDefaultClientConfig();this.tracingSampleRate=(e=>{const t=e?.toString()??Vv("TRACING_SAMPLING_RATE");if(void 0===t)return;const n=parseFloat(t);if(n<0||n>1)throw new Error(`LANGSMITH_TRACING_SAMPLING_RATE must be between 0 and 1 if set. Got: ${n}`);return n})(e.tracingSamplingRate),this.apiUrl=tP(e.apiUrl??t.apiUrl)??"",this.apiUrl.endsWith("/")&&(this.apiUrl=this.apiUrl.slice(0,-1));const n=tP(e.apiKey??t.apiKey);if(this.apiKey=LE(n)?n:void 0,this.profileAuth=void 0!==this.apiKey?void 0:t.profileAuth,this.webUrl=tP(e.webUrl??t.webUrl),this.webUrl?.endsWith("/")&&(this.webUrl=this.webUrl.slice(0,-1)),this.workspaceId=tP(e.workspaceId??t.workspaceId),this.timeout_ms=e.timeout_ms??9e4,this.caller=new R_({...e.callerOptions??{},maxRetries:4,debug:e.debug??this.debug}),this.traceBatchConcurrency=e.traceBatchConcurrency??this.traceBatchConcurrency,this.traceBatchConcurrency<1)throw new Error("Trace batch concurrency must be positive.");this.debug=e.debug??this.debug,this.fetchImplementation=e.fetchImplementation,this.failedTracesDir=Vv("FAILED_TRACES_DIR")||void 0;const r=Vv("FAILED_TRACES_MAX_MB");if(r){const e=parseInt(r,10);Number.isFinite(e)&&e>0&&(this.failedTracesMaxBytes=1024*e*1024)}const i=e.maxIngestMemoryBytes??iP;this.batchIngestCaller=new R_({maxRetries:4,maxConcurrency:this.traceBatchConcurrency,maxQueueSizeBytes:i,...e.callerOptions??{},onFailedResponseHook:nP,debug:e.debug??this.debug}),this.hideInputs=e.hideInputs??e.anonymizer??t.hideInputs,this.hideOutputs=e.hideOutputs??e.anonymizer??t.hideOutputs,this.hideMetadata=e.hideMetadata??e.anonymizer??t.hideMetadata,this.anonymizer=e.anonymizer,this.omitTracedRuntimeInfo=e.omitTracedRuntimeInfo??!1,this.autoBatchTracing=e.autoBatchTracing??this.autoBatchTracing,this.autoBatchQueue=new cP(i),this.blockOnRootRunFinalization=e.blockOnRootRunFinalization??this.blockOnRootRunFinalization,this.batchSizeBytesLimit=e.batchSizeBytesLimit,this.batchSizeLimit=e.batchSizeLimit;const{headers:a,...o}=e.fetchOptions||{};this.fetchOptions=o,this._fetchOptionsHeaders=sP(a),oP(e.headers),this._customHeaders=e.headers??{},this.manualFlushMode=e.manualFlushMode??this.manualFlushMode,this._tracingMode=Xv(e.tracingMode),"otel"===this._tracingMode&&(this.langSmithToOTELTranslator=new r_),this.cachedLSEnvVarsForMetadata=xv(),void 0!==e.cache&&e.disablePromptCache&&fT("Both 'cache' and 'disablePromptCache' were provided. The 'cache' parameter is deprecated and will be removed in a future version. Using 'cache' parameter value."),void 0!==e.cache?(fT("The 'cache' parameter is deprecated and will be removed in a future version. Use 'configureGlobalPromptCache()' to configure the global cache, or 'disablePromptCache: true' to disable caching for this client."),!1===e.cache?this._promptCache=void 0:!0===e.cache?this._promptCache=yv:this._promptCache=e.cache):e.disablePromptCache||(this._promptCache=yv)}static getDefaultClientConfig(){const e=function(){const e=RE(),t=e?.profile;if(!e||!t)return{};const n=NE(t.api_key),r=NE(t.oauth?.access_token),i=NE(t.oauth?.refresh_token);return{apiUrl:t.api_url,apiKey:n,workspaceId:t.workspace_id,oauthAccessToken:r,oauthRefreshToken:i,profileAuth:n||r||i?new GE(e):void 0}}(),t=Vv("API_KEY"),n=Vv("ENDPOINT"),r=Vv("WORKSPACE_ID"),i=LE(t),a=n??e.apiUrl??EE,o=r??e.workspaceId;return{apiUrl:a,apiKey:t,webUrl:void 0,hideInputs:"true"===Vv("HIDE_INPUTS"),hideOutputs:"true"===Vv("HIDE_OUTPUTS"),hideMetadata:"true"===Vv("HIDE_METADATA"),workspaceId:o,oauthAccessToken:i?void 0:e.oauthAccessToken,oauthRefreshToken:i?void 0:e.oauthRefreshToken,profileAuth:i?void 0:e.profileAuth}}getHostUrl(){return this.webUrl?this.webUrl:(e=>{const t=e.replace("http://","").replace("https://","").split("/")[0].split(":")[0];return"localhost"===t||"127.0.0.1"===t||"::1"===t})(this.apiUrl)?(this.webUrl="http://localhost:3000",this.webUrl):this.apiUrl.endsWith("/api/v1")?(this.webUrl=this.apiUrl.replace("/api/v1",""),this.webUrl):this.apiUrl.includes("/api")&&!this.apiUrl.split(".",1)[0].endsWith("api")?(this.webUrl=this.apiUrl.replace("/api",""),this.webUrl):this.apiUrl.split(".",1)[0].includes("dev")?(this.webUrl="https://dev.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("eu")?(this.webUrl="https://eu.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("aws")?(this.webUrl="https://aws.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("apac")?(this.webUrl="https://apac.smith.langchain.com",this.webUrl):this.apiUrl.split(".",1)[0].includes("beta")?(this.webUrl="https://beta.smith.langchain.com",this.webUrl):(this.webUrl="https://smith.langchain.com",this.webUrl)}get _sdkControlledHeaders(){const e=/* @__PURE__ */new Set;if(void 0!==this.apiKey)e.add("x-api-key");else{const t=this.profileAuth?.currentAuthHeader();t&&e.add(t.name.toLowerCase())}return this.workspaceId&&e.add("x-tenant-id"),e}get _callerHeaders(){return function(e,t,n){const r={...e},i=new Map(Object.keys(r).map(e=>[e.toLowerCase(),e]));for(const[a,o]of Object.entries(t)){const e=a.toLowerCase();r[i.get(e)??a]=o}for(const a of Object.keys(r))n.has(a.toLowerCase())&&delete r[a];return r}(sP(this._customHeaders),this._fetchOptionsHeaders,this._sdkControlledHeaders)}get _mergedHeaders(){const e={"User-Agent":`langsmith-js/${Ov}`,...this._callerHeaders};if(void 0!==this.apiKey)e["x-api-key"]=`${this.apiKey}`;else{const t=this.profileAuth?.currentAuthHeader();t&&(e[t.name]=t.value)}return this.workspaceId&&(e["x-tenant-id"]=this.workspaceId),e}get _openAPIClientOptions(){const e={...this._callerHeaders};Object.keys(e).some(e=>"user-agent"===e.toLowerCase())||(e["User-Agent"]=`langsmith-js/${Ov}`);const t=Object.keys(e).find(e=>"x-api-key"===e.toLowerCase());let n=this.apiKey;return void 0===n&&void 0!==t&&(n=e[t]??void 0,delete e[t]),void 0===n&&void 0===this.workspaceId&&(e["X-API-Key"]=null),{apiKey:n,defaultHeaders:Object.keys(e).length>0?e:void 0}}get headers(){return this._customHeaders}set headers(e){oP(e),this._customHeaders=e??{}}_getOpenAPIBaseUrl(){const e=this.apiUrl.replace(/\/$/,"");for(const t of["/api/v1","/api"])if(e.endsWith(t))return e.slice(0,-t.length);return e}get openAPIClient(){const e=this._openAPIClientOptions,t=JSON.stringify([e.apiKey,e.defaultHeaders]);return void 0!==this._openAPIClient&&this._openAPIClientSignature===t||(this._openAPIClientSignature=t,this._openAPIClient=this._newOpenAPIClient(e)),this._openAPIClient}_newOpenAPIClient(e=this._openAPIClientOptions){const{method:t,body:n,signal:r,...i}=this.fetchOptions;return new sE({apiKey:e.apiKey,tenantID:this.workspaceId,baseURL:this._getOpenAPIBaseUrl(),timeout:this.timeout_ms,fetch:this._fetch,fetchOptions:i,defaultHeaders:e.defaultHeaders})}_getPlatformEndpointPath(e){return"/v1"!==this.apiUrl.slice(-3)&&"/v1/"!==this.apiUrl.slice(-4)?`/v1/platform/${e}`:`/platform/${e}`}get evaluators(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.onlineEvaluators}get runs(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.runs}get sandboxes(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.sandboxes}get datasets(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.datasets}get annotationQueues(){return this._checkStainlessVersion("0.16.14"),this.openAPIClient.annotationQueues}get threads(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.threads}get traces(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.traces}get public(){return this._checkStainlessVersion("0.16.0"),this.openAPIClient.public}async processInputs(e){return!1===this.hideInputs?e:!0===this.hideInputs?{}:"function"==typeof this.hideInputs?this.hideInputs(e):e}async processOutputs(e){return!1===this.hideOutputs?e:!0===this.hideOutputs?{}:"function"==typeof this.hideOutputs?this.hideOutputs(e):e}async processMetadata(e){return!1===this.hideMetadata?e:!0===this.hideMetadata?{}:"function"==typeof this.hideMetadata?this.hideMetadata(e):e}async processError(e){if(null==this.anonymizer)return e;const t=await this.anonymizer({error:e});return"string"==typeof t?.error?t.error:e}_filterNewTokenEvents(e){return e&&0!==e.length?e.map(e=>{if("new_token"===e.name){const{kwargs:t,...n}=e;return n}return e}):e}async prepareRunCreateOrUpdateInputs(e){const t={...e};return void 0!==t.inputs&&(t.inputs=await this.processInputs(t.inputs)),void 0!==t.outputs&&(t.outputs=await this.processOutputs(t.outputs)),void 0!==t.error&&(t.error=await this.processError(t.error)),null!=t.extra&&"metadata"in t.extra&&(t.extra={...t.extra,metadata:await this.processMetadata(t.extra.metadata)}),void 0!==t.events&&(t.events=this._filterNewTokenEvents(t.events)),t}async _getResponse(e,t){const n=t?.toString()??"",r=`${this.apiUrl}${e}?${n}`;return await this.caller.call(async()=>{const t=await this._fetch(r,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,`fetch ${e}`),t})}async _get(e,t){return(await this._getResponse(e,t)).json()}async*_getPaginated(e,t=new URLSearchParams,n){let r=Number(t.get("offset"))||0;const i=Number(t.get("limit"))||100;for(;;){t.set("offset",String(r)),t.set("limit",String(i));const a=`${this.apiUrl}${e}?${t}`,o=await this.caller.call(async()=>{const t=await this._fetch(a,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,`fetch ${e}`),t}),s=n?n(await o.json()):await o.json();if(0===s.length)break;if(yield s,s.length<i)break;r+=s.length}}async*_getCursorPaginatedList(e,t=null,n="POST",r="runs"){const i=t?{...t}:{};for(;;){const t=JSON.stringify(i),a=await this.caller.call(async()=>{const r=await this._fetch(`${this.apiUrl}${e}`,{method:n,headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:t});return await yE(r,`fetch ${e}`),r}),o=await a.json();if(!o)break;if(!o[r])break;yield o[r];const s=o.cursors;if(!s)break;if(!s.next)break;i.cursor=s.next}}_shouldSample(e){return((e,t)=>{if(void 0===t||t>=1)return!0;if(t<=0)return!1;if(null==e)return!0;const n=ZT(lE.encode(e.toLowerCase()))%cE;return Number(n)/Number(cE)<t})(e,this.tracingSampleRate)}_filterForSampling(e){return e.filter(e=>this._shouldSample(e.trace_id??e.dotted_order?.split(".",1)[0].split("Z")[1]??e.id))}async _getBatchSizeLimitBytes(){const e=await this._ensureServerInfo();return this.batchSizeBytesLimit??e?.batch_ingest_config?.size_limit_bytes??25165824}async _getBatchSizeLimit(){const e=await this._ensureServerInfo();return this.batchSizeLimit??e?.batch_ingest_config?.size_limit??100}async _getDatasetExamplesMultiPartSupport(){const e=await this._ensureServerInfo();return e.instance_flags?.dataset_examples_multipart_enabled??!1}drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:t}){const n=[];for(;this.autoBatchQueue.items.length>0;){const[r,i]=this.autoBatchQueue.pop({upToSizeBytes:e,upToSize:t});if(!r.length){i();break}const a=r.reduce((e,t)=>{const n=t.apiUrl??this.apiUrl,r=t.apiKey??this.apiKey,i=t.workspaceId??this.workspaceId,a=t.apiKey===this.apiKey&&t.apiUrl===this.apiUrl&&t.workspaceId===this.workspaceId?"default":`${n}|${r}|${i??""}`;return e[a]||(e[a]=[]),e[a].push(t),e},{}),o=[];for(const[e,t]of Object.entries(a)){const n="default"===e,r=n?[]:e.split("|"),i=r[2],a=this._processBatch(t,{apiUrl:n?void 0:r[0],apiKey:n?void 0:r[1],workspaceId:n||!i?void 0:i});o.push(a)}const s=Promise.all(o).finally(i);n.push(s)}return Promise.all(n)}static async _writeTraceToFallbackDir(e,t,n,r,i){try{const a="string"==typeof t?Buffer.from(t,"utf8"):Buffer.from(t),o=(JSON.stringify({version:1,endpoint:r,headers:n,body_base64:a.toString("base64")}),`trace_${Date.now()}_${Yb().slice(0,8)}.json`),s=lv(e,o);if(lP._fallbackDirsCreated.has(e)||(await dv(),lP._fallbackDirsCreated.add(e)),void 0!==i&&i>0)try{const t=(await async function(){return[]}()).filter(e=>e.startsWith("trace_")&&e.endsWith(".json"));let n=0;for(const r of t){const{size:t}=await hv(lv(e,r));n+=t}if(n>=i)return void console.warn(`Could not write trace to fallback dir ${e} as it's already over size limit (${n} bytes >= ${i} bytes). Increase LANGSMITH_FAILED_TRACES_MAX_MB if possible.`)}catch{}await pv(),console.warn(`LangSmith trace upload failed; data saved to ${s} for later replay.`)}catch(a){console.error(`LangSmith tracing error: could not write trace to fallback dir ${e}:`,a)}}async _processBatch(e,t){if(!e.length)return;const n=e.reduce((e,t)=>e+(t.size??0),0);try{if(void 0!==this.langSmithToOTELTranslator){for(const t of e)t.item=await this._maskRunMetadata(t.item);this._sendBatchToOTELTranslator(e)}else{const i={runCreates:e.filter(e=>"create"===e.action).map(e=>e.item),runUpdates:e.filter(e=>"update"===e.action).map(e=>e.item)},a=await this._ensureServerInfo();if(!this._multipartDisabled&&(a?.batch_ingest_config?.use_multipart_endpoint??!0)){const e=!this._runCompressionDisabled&&a?.instance_flags?.gzip_body_enabled;try{await this.multipartIngestRuns(i,{...t,useGzip:e,sizeBytes:n})}catch(r){if(!gE(r))throw r;this._multipartDisabled=!0,await this.batchIngestRuns(i,{...t,sizeBytes:n})}}else await this.batchIngestRuns(i,{...t,sizeBytes:n})}}catch(r){console.error("Error exporting batch:",r)}}_sendBatchToOTELTranslator(e){if(void 0!==this.langSmithToOTELTranslator){const t=/* @__PURE__ */new Map,n=[];for(const r of e)r.item.id&&r.otelContext&&(t.set(r.item.id,r.otelContext),"create"===r.action?n.push({operation:"post",id:r.item.id,trace_id:r.item.trace_id??r.item.id,run:r.item}):n.push({operation:"patch",id:r.item.id,trace_id:r.item.trace_id??r.item.id,run:r.item}));this.langSmithToOTELTranslator.exportBatch(n,t)}}async _maskRunMetadata(e){return null==e.extra?.metadata?e:{...e,extra:{...e.extra,metadata:await this.processMetadata(e.extra.metadata)}}}async _mergeRuntimeEnvAndMaskMetadata(e){const t=eP(e,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);return this.omitTracedRuntimeInfo?t:this._maskRunMetadata(t)}async processRunOperation(e){clearTimeout(this.autoBatchTimeout),this.autoBatchTimeout=void 0,e.item=eP(e.item,this.cachedLSEnvVarsForMetadata,this.omitTracedRuntimeInfo);const t=this.autoBatchQueue.push(e);if(this.manualFlushMode)return t;const n=await this._getBatchSizeLimitBytes(),r=await this._getBatchSizeLimit();return(this.autoBatchQueue.sizeBytes>n||this.autoBatchQueue.items.length>r)&&this._trackDrain(this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:r})),this.autoBatchQueue.items.length>0&&(this.autoBatchTimeout=setTimeout(()=>{this.autoBatchTimeout=void 0,this._trackDrain(this.drainAutoBatchQueue({batchSizeLimitBytes:n,batchSizeLimit:r}))},this.autoBatchAggregationDelayMs)),t}async _getServerInfo(){const e=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/info`,{method:"GET",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(1e4),...this.fetchOptions});return await yE(e,"get server info"),e}),t=await e.json();return this.debug&&console.log("\n=== LangSmith Server Configuration ===\n"+JSON.stringify(t,null,2)+"\n"),t}_checkStainlessVersion(e){this._stainlessVersionsChecked.has(e)||(this._stainlessVersionsChecked.add(e),this._ensureServerInfo().then(t=>{!function(e,t){if(!e)return;const n=e=>e.split(".").map(e=>parseInt(e,10)),[r,i,a]=n(e),[o,s,c]=n(t);isNaN(r)||isNaN(i)||isNaN(a)||isNaN(o)||isNaN(s)||isNaN(c)?console.warn(`[LANGSMITH]: Could not parse backend version ${JSON.stringify(e)} for compatibility check.`):(r<o||r===o&&i<s||r===o&&i===s&&a<c)&&console.warn(`[LANGSMITH]: Backend version ${JSON.stringify(e)} is older than the minimum version required by this SDK (${JSON.stringify(t)}). Some features may not work as expected. See https://docs.langchain.com/langsmith/smithdb-sdk-migration`)}(t?.version,e)}).catch(()=>{}))}async _ensureServerInfo(){return void 0===this._getServerInfoPromise&&(this._getServerInfoPromise=(async()=>{if(void 0===this._serverInfo)try{this._serverInfo=await this._getServerInfo()}catch(e){console.warn(`[LANGSMITH]: Failed to fetch info on supported operations. Falling back to batch operations and default limits. Info: ${e.status??"Unspecified status code"} ${e.message}`)}return this._serverInfo??{}})()),this._getServerInfoPromise.then(e=>(void 0===this._serverInfo&&(this._getServerInfoPromise=void 0),e))}async _supportsSDBQuery(){const e=await this._ensureServerInfo();return!0===e.instance_flags?.sdb_query_enabled}async _checkFeedbackSessionId(){const e="https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#feedback-create";if(function(e){const t=e??{},n=Boolean(t.ch_query_enabled??!0),r=Boolean(t.sdb_query_enabled??!1);return!n&&r?dE:n&&r?pE:uE}((await this._ensureServerInfo()).instance_flags)===dE)throw new Error(`sessionId must be provided when creating feedback for a run: this deployment cannot locate the run without it. See ${e}`);fT(`Creating feedback for a run without sessionId is deprecated and will stop working in a future release. See ${e}`)}async _getSettings(){return this.settings||(this.settings=this._get("/settings")),await this.settings}async flush(){const e=await this._getBatchSizeLimitBytes(),t=await this._getBatchSizeLimit();await this.drainAutoBatchQueue({batchSizeLimitBytes:e,batchSizeLimit:t})}_cloneCurrentOTELContext(){const e=e_(),t=Zv.getContextInstance();if(void 0!==this.langSmithToOTELTranslator){const n=e.getActiveSpan();if(n)return e.setSpan(t.active(),n)}}async createRun(e,t){if(!this._filterForSampling([e]).length)return;const n={...this._mergedHeaders,"Content-Type":"application/json"},r=e.project_name;delete e.project_name;const i=await this.prepareRunCreateOrUpdateInputs({session_name:r,...e,start_time:e.start_time??Date.now()});if(this.autoBatchTracing&&void 0!==i.trace_id&&void 0!==i.dotted_order){const e=this._cloneCurrentOTELContext();return void this.processRunOperation({action:"create",item:i,otelContext:e,apiKey:t?.apiKey,apiUrl:t?.apiUrl,workspaceId:t?.workspaceId}).catch(console.error)}const a=await this._mergeRuntimeEnvAndMaskMetadata(i);void 0!==t?.apiKey&&(n["x-api-key"]=t.apiKey),void 0!==t?.workspaceId&&(n["x-tenant-id"]=t.workspaceId);const o=KE(a,`Creating run with id: ${a.id}`);await this.caller.call(async()=>{const e=await this._fetch(`${t?.apiUrl??this.apiUrl}/runs`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await yE(e,"create run",!0),e})}async batchIngestRuns({runCreates:e,runUpdates:t},n){if(void 0===e&&void 0===t)return;let r=await Promise.all(e?.map(e=>this.prepareRunCreateOrUpdateInputs(e))??[]),i=await Promise.all(t?.map(e=>this.prepareRunCreateOrUpdateInputs(e))??[]);if(r.length>0&&i.length>0){const e=r.reduce((e,t)=>t.id?(e[t.id]=t,e):e,{}),t=[];for(const n of i)void 0!==n.id&&e[n.id]?e[n.id]={...e[n.id],...n}:t.push(n);r=Object.values(e),i=t}const a={post:r,patch:i};if(!a.post.length&&!a.patch.length)return;const o={post:[],patch:[]};for(const s of["post","patch"]){const e=s,t=a[e].reverse();let n=t.pop();for(;void 0!==n;)o[e].push(n),n=t.pop()}if(o.post.length>0||o.patch.length>0){const e=o.post.map(e=>e.id).concat(o.patch.map(e=>e.id)).join(",");await this._postBatchIngestRuns(await this._serializeBody(o,`Ingesting runs with ids: ${e}`),n)}}async _postBatchIngestRuns(e,t){const n={...this._mergedHeaders,"Content-Type":"application/json",Accept:"application/json"};void 0!==t?.apiKey&&(n["x-api-key"]=t.apiKey),void 0!==t?.workspaceId&&(n["x-tenant-id"]=t.workspaceId),await this.batchIngestCaller.callWithOptions({sizeBytes:t?.sizeBytes},async()=>{const r=await this._fetch(`${t?.apiUrl??this.apiUrl}/runs/batch`,{method:"POST",headers:n,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:e});return await yE(r,"batch create run",!0),r})}async multipartIngestRuns({runCreates:e,runUpdates:t},n){if(void 0===e&&void 0===t)return;const r={};let i=[];for(const c of e??[]){const e=await this.prepareRunCreateOrUpdateInputs(c);void 0!==e.id&&void 0!==e.attachments&&(r[e.id]=e.attachments),delete e.attachments,i.push(e)}let a=[];for(const c of t??[])a.push(await this.prepareRunCreateOrUpdateInputs(c));if(void 0!==i.find(e=>void 0===e.trace_id||void 0===e.dotted_order))throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when creating a run');if(void 0!==a.find(e=>void 0===e.trace_id||void 0===e.dotted_order))throw new Error('Multipart ingest requires "trace_id" and "dotted_order" to be set when updating a run');if(i.length>0&&a.length>0){const e=i.reduce((e,t)=>t.id?(e[t.id]=t,e):e,{}),t=[];for(const n of a)void 0!==n.id&&e[n.id]?e[n.id]={...e[n.id],...n}:t.push(n);i=Object.values(e),a=t}if(0===i.length&&0===a.length)return;const o=[],s=[];for(const[c,l]of[["post",i],["patch",a]])for(const e of l){const{inputs:t,outputs:n,events:i,extra:a,error:l,serialized:u,attachments:d,...p}=e,h={inputs:t,outputs:n,events:i,extra:a,error:l,serialized:u},f=await this._serializeBody(p,`Serializing for multipart ingestion of run with id: ${p.id}`);s.push({name:`${c}.${p.id}`,payload:new Blob([f],{type:`application/json; length=${f.length}`})});for(const[e,r]of Object.entries(h)){if(void 0===r)continue;const t=await this._serializeBody(r,`Serializing ${e} for multipart ingestion of run with id: ${p.id}`);s.push({name:`${c}.${p.id}.${e}`,payload:new Blob([t],{type:`application/json; length=${t.length}`})})}if(void 0!==p.id){const e=r[p.id];if(e){delete r[p.id];for(const[t,n]of Object.entries(e)){let e,r;Array.isArray(n)?[e,r]=n:(e=n.mimeType,r=n.data),t.includes(".")?console.warn(`Skipping attachment '${t}' for run ${p.id}: Invalid attachment name. Attachment names must not contain periods ('.'). Please rename the attachment and try again.`):s.push({name:`attachment.${p.id}.${t}`,payload:new Blob([r],{type:`${e}; length=${r.byteLength}`})})}}}o.push(`trace=${p.trace_id},id=${p.id}`)}await this._sendMultipartRequest(s,o.join("; "),n)}async _createNodeFetchBody(e,t){const n=[];for(const i of e)n.push(new Blob([`--${t}\r\n`])),n.push(new Blob([`Content-Disposition: form-data; name="${i.name}"\r\n`,`Content-Type: ${i.payload.type}\r\n\r\n`])),n.push(i.payload),n.push(new Blob(["\r\n"]));n.push(new Blob([`--${t}--\r\n`]));const r=new Blob(n);return await r.arrayBuffer()}async _createMultipartStream(e,t){const n=new TextEncoder;return new ReadableStream({async start(r){const i=async e=>{"string"==typeof e?r.enqueue(n.encode(e)):r.enqueue(e)};for(const n of e){await i(`--${t}\r\n`),await i(`Content-Disposition: form-data; name="${n.name}"\r\n`),await i(`Content-Type: ${n.payload.type}\r\n\r\n`);const e=n.payload.stream().getReader();try{let t;for(;!(t=await e.read()).done;)r.enqueue(t.value)}finally{e.releaseLock()}await i("\r\n")}await i(`--${t}--\r\n`),r.close()}})}async _sendMultipartRequest(e,t,n){const r="----LangSmithFormBoundary"+Math.random().toString(36).slice(2),i=()=>this._createNodeFetchBody(e,r),a=()=>this._createMultipartStream(e,r),o=async e=>this.batchIngestCaller.callWithOptions({sizeBytes:n?.sizeBytes},async()=>{const t=await e(),i={...this._mergedHeaders,"Content-Type":`multipart/form-data; boundary=${r}`};void 0!==n?.apiKey&&(i["x-api-key"]=n.apiKey),void 0!==n?.workspaceId&&(i["x-tenant-id"]=n.workspaceId);let a=t;n?.useGzip&&"object"==typeof t&&"pipeThrough"in t&&(a=t.pipeThrough(new CompressionStream("gzip")),i["Content-Encoding"]="gzip");const o=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/multipart`,{method:"POST",headers:i,body:a,duplex:"half",signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(o,"Failed to send multipart request",!0),o});try{let e,r=!1;void 0===globalThis[uT]&&!this.multipartStreamingDisabled&&"bun"!==Dv()?(r=!0,e=await o(a)):e=await o(i),this.multipartStreamingDisabled&&!r||422!==e.status||(n?.apiUrl??this.apiUrl)===EE||(console.warn(`Streaming multipart upload to ${n?.apiUrl??this.apiUrl}/runs/multipart failed. This usually means the host does not support chunked uploads. Retrying with a buffered upload for operation "${t}".`),this.multipartStreamingDisabled=!0,e=await o(i))}catch(s){if(gE(s))throw s;if(console.warn(`${s.message.trim()}\n\nContext: ${t}`),this.failedTracesDir){const t=await this._createNodeFetchBody(e,r).catch(()=>null);t&&await lP._writeTraceToFallbackDir(this.failedTracesDir,t,{"Content-Type":`multipart/form-data; boundary=${r}`},"runs/multipart",this.failedTracesMaxBytes)}}}async updateRun(e,t,n){tv(e),t.inputs&&(t.inputs=await this.processInputs(t.inputs)),t.outputs&&(t.outputs=await this.processOutputs(t.outputs)),t.error&&(t.error=await this.processError(t.error)),null!=t.extra&&"metadata"in t.extra&&(t.extra={...t.extra,metadata:await this.processMetadata(t.extra.metadata)}),t.events&&(t.events=this._filterNewTokenEvents(t.events));const r={...t,id:e};if(!this._filterForSampling([r]).length)return;if(this.autoBatchTracing&&void 0!==r.trace_id&&void 0!==r.dotted_order){const e=this._cloneCurrentOTELContext();return void 0!==t.end_time&&void 0===r.parent_run_id&&this.blockOnRootRunFinalization&&!this.manualFlushMode?void(await this.processRunOperation({action:"update",item:r,otelContext:e,apiKey:n?.apiKey,apiUrl:n?.apiUrl,workspaceId:n?.workspaceId}).catch(console.error)):void this.processRunOperation({action:"update",item:r,otelContext:e,apiKey:n?.apiKey,apiUrl:n?.apiUrl,workspaceId:n?.workspaceId}).catch(console.error)}const i={...this._mergedHeaders,"Content-Type":"application/json"};void 0!==n?.apiKey&&(i["x-api-key"]=n.apiKey),void 0!==n?.workspaceId&&(i["x-tenant-id"]=n.workspaceId);const a=KE(t,`Serializing payload to update run with id: ${e}`);await this.caller.call(async()=>{const t=await this._fetch(`${n?.apiUrl??this.apiUrl}/runs/${e}`,{method:"PATCH",headers:i,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await yE(t,"update run",!0),t})}async readRun(e,{loadChildRuns:t}={loadChildRuns:!1}){return fT("readRun() is deprecated and will be removed after Jan 31, 2027. Use client.runs.retrieve() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-runs#runs-retrieve for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_READ_RUN"}),this._readRun(e,{loadChildRuns:t})}async _readRun(e,{loadChildRuns:t}={loadChildRuns:!1}){tv(e);let n=ZE(await this._get(`/runs/${e}`));return t&&(n=await this._loadChildRuns(n)),n}async getRunUrl({runId:e,run:t,projectOpts:n}){if(fT("getRunUrl() is deprecated and will be removed after Jan 31, 2027. Use client.runs.getURL() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-runs#runs-get-url for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_GET_RUN_URL"}),void 0!==t){let e;if(t.session_id)e=t.session_id;else if(n?.projectName)e=(await this.readProject({projectName:n?.projectName})).id;else if(n?.projectId)e=n?.projectId;else{e=(await this.readProject({projectName:Vv("PROJECT")||"default"})).id}const r=await this._getTenantId();return`${this.getHostUrl()}/o/${r}/projects/p/${e}/r/${t.id}?poll=true`}if(void 0!==e){const t=await this._readRun(e);if(!t.app_path)throw new Error(`Run ${e} has no app_path`);return`${this.getHostUrl()}${t.app_path}`}throw new Error("Must provide either runId or run")}async _loadChildRuns(e){const t=await async function(e){const t=[];for await(const n of e)t.push(n);return t}(this._listRuns({isRoot:!1,projectId:e.session_id,traceId:e.trace_id})),n={},r={};t.sort((e,t)=>(e?.dotted_order??"").localeCompare(t?.dotted_order??""));for(const i of t){if(null===i.parent_run_id||void 0===i.parent_run_id)throw new Error(`Child run ${i.id} has no parent`);i.dotted_order?.startsWith(e.dotted_order??"")&&i.id!==e.id&&(i.parent_run_id in n||(n[i.parent_run_id]=[]),n[i.parent_run_id].push(i),r[i.id]=i)}e.child_runs=n[e.id]||[];for(const i in n)i!==e.id&&(r[i].child_runs=n[i]);return e}async*listRuns(e){fT("listRuns() is deprecated and will be removed after Jan 31, 2027. Use client.runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-query-runs#runs-query for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_LIST_RUNS"}),yield*this._listRuns(e)}async*_listRuns(e){const{projectId:t,projectName:n,parentRunId:r,traceId:i,referenceExampleId:a,startTime:o,executionOrder:s,isRoot:c,runType:l,error:u,id:d,query:p,filter:h,traceFilter:f,treeFilter:m,limit:g,select:y,order:I}=e;let C=[];if(t&&(C=Array.isArray(t)?t:[t]),n){const e=Array.isArray(n)?n:[n],t=await Promise.all(e.map(e=>this.readProject({projectName:e}).then(e=>e.id)));C.push(...t)}const A={session:C.length?C:null,run_type:l,reference_example:a,query:p,filter:h,trace_filter:f,tree_filter:m,execution_order:s,parent_run:r,start_time:o?o.toISOString():null,error:u,id:d,limit:g,trace:i,select:y||["app_path","completion_cost","completion_tokens","dotted_order","end_time","error","events","extra","feedback_stats","first_token_time","id","inputs","name","outputs","parent_run_id","parent_run_ids","prompt_cost","prompt_tokens","reference_example_id","run_type","session_id","start_time","status","tags","total_cost","total_tokens","trace_id"],is_root:c,order:I};A.select.includes("child_run_ids")&&fT("Deprecated: 'child_run_ids' in the listRuns select parameter is deprecated and will be removed in a future version.");let S=0;for await(const b of this._getCursorPaginatedList("/runs/query",A)){const e=b.map(ZE);if(g){if(S>=g)break;if(e.length+S>g){const t=e.slice(0,g-S);yield*t;break}S+=e.length,yield*e}else yield*e}}async*listGroupRuns(e){const{projectId:t,projectName:n,groupBy:r,filter:i,startTime:a,endTime:o,limit:s,offset:c}=e,l={session_id:t||(await this.readProject({projectName:n})).id,group_by:r,filter:i,start_time:a?a.toISOString():null,end_time:o?o.toISOString():null,limit:Number(s)||100};let u=Number(c)||0;const d="/runs/group",p=`${this.apiUrl}${d}`;for(;;){const e={...l,offset:u},t=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t)),n=JSON.stringify(t),r=await this.caller.call(async()=>{const e=await this._fetch(p,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await yE(e,`Failed to fetch ${d}`),e}),i=await r.json(),{groups:a,total:o}=i;if(0===a.length)break;for(const s of a)yield s;if(u+=a.length,u>=o)break}}async*readThread(e){fT("readThread() is deprecated and will be removed after Jan 31, 2027. Use client.threads.listTraces() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-threads#threads-list-traces for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_READ_THREAD"});const{threadId:t,projectId:n,projectName:r,isRoot:i=!0,limit:a,filter:o,order:s="asc"}=e;if(!n&&!r)throw new Error("threadId requires projectId or projectName");const c=`eq(thread_id, ${JSON.stringify(t)})`,l=o?`and(${c}, ${o})`:c;yield*this._listRuns({projectId:n??void 0,projectName:r??void 0,isRoot:i,limit:a,filter:l,order:s})}async listThreads(e){fT("listThreads() is deprecated and will be removed after Jan 31, 2027. Use client.threads.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-threads#threads-query for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_LIST_THREADS"});const{projectId:t,projectName:n,limit:r,offset:i=0,filter:a,startTime:o,isRoot:s=!0}=e;if(!t&&!n)throw new Error("Either projectId or projectName must be provided");if(t&&n)throw new Error("Provide exactly one of projectId or projectName");const c={session:[t??(await this.readProject({projectName:n})).id],is_root:s,limit:100,order:"desc",select:["id","name","status","start_time","end_time","thread_id","trace_id","run_type","error","tags","session_id","parent_run_id","total_tokens","total_cost","dotted_order","reference_example_id","feedback_stats","app_path","completion_cost","completion_tokens","prompt_cost","prompt_tokens","first_token_time"],start_time:(o??new Date(Date.now()-864e5)).toISOString()};null!=a&&(c.filter=a);const l=/* @__PURE__ */new Map;for await(const p of this._getCursorPaginatedList("/runs/query",c))for(const e of p){const t=ZE(e),n=t.thread_id;if(n){const e=l.get(n)??[];e.push(t),l.set(n,e)}}const u=[];for(const[p,h]of l.entries()){h.sort((e,t)=>{const n=e,r=t,i=n.start_time??"",a=r.start_time??"";if(i!==a)return i.localeCompare(a);const o=n.dotted_order??"",s=r.dotted_order??"";return o.localeCompare(s)});const e=[...h.map(e=>e.start_time).filter(Boolean)].sort(),t=e.length?e[0]:"",n=e.length?e[e.length-1]:"";u.push({thread_id:p,runs:h,count:h.length,filter:"",total_tokens:0,total_cost:null,min_start_time:t,max_start_time:n,latency_p50:0,latency_p99:0,feedback_stats:null,first_inputs:"",last_outputs:"",last_error:null})}u.sort((e,t)=>{const n=e.max_start_time??"";return(t.max_start_time??"").localeCompare(n)});const d=i>0?u.slice(i):u;return void 0!==r?d.slice(0,r):d}async getRunStats({id:e,trace:t,parentRun:n,runType:r,projectNames:i,projectIds:a,referenceExampleIds:o,startTime:s,endTime:c,error:l,query:u,filter:d,traceFilter:p,treeFilter:h,isRoot:f,dataSourceType:m}){let g=a||[];if(i&&(g=[...a||[],...await Promise.all(i.map(e=>this.readProject({projectName:e}).then(e=>e.id)))]),0===g.length)throw new Error("At least one of projectNames or projectIds must be provided.");const y={id:e,trace:t,parent_run:n,run_type:r,session:g,reference_example:o,start_time:s,end_time:c,error:l,query:u,filter:d,trace_filter:p,tree_filter:h,is_root:f,data_source_type:m},I=Object.fromEntries(Object.entries(y).filter(([e,t])=>void 0!==t)),C=JSON.stringify(I),A=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/runs/stats`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:C});return await yE(e,"get run stats"),e});return await A.json()}async shareRun(e,{shareId:t}={}){fT("shareRun() is deprecated and will be removed after Jan 31, 2027. Use client.runs.share.create() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_SHARE_RUN"});const n={run_id:e,share_token:t||Yb()};tv(e);const r=JSON.stringify(n),i=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"PUT",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:r});return await yE(t,"share run"),t}),a=await i.json();if(null===a||!("share_token"in a))throw new Error("Invalid response from server");return`${this.getHostUrl()}/public/${a.share_token}/r`}async unshareRun(e){fT("unshareRun() is deprecated and will be removed after Jan 31, 2027. Use client.runs.share.delete() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_UNSHARE_RUN"}),tv(e),await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"unshare run",!0),t})}async readRunSharedLink(e){fT('readRunSharedLink() is deprecated and will be removed after Jan 31, 2027. Use client.runs.retrieve({ selects: ["SHARE_URL"] }) instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.',{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_READ_RUN_SHARED_LINK"}),tv(e);const t=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/runs/${e}/share`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"read run shared link"),t}),n=await t.json();if(null!==n&&"share_token"in n)return`${this.getHostUrl()}/public/${n.share_token}/r`}async listSharedRuns(e,{runIds:t}={}){fT("listSharedRuns() is deprecated and will be removed after Jan 31, 2027. Use client.public.runs.query() instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#share-and-read-public-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_LIST_SHARED_RUNS"});const n=new URLSearchParams({share_token:e});if(void 0!==t)for(const i of t)n.append("id",i);tv(e);const r=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/public/${e}/runs${n}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"list shared runs"),t});return(await r.json()).map(ZE)}async readDatasetSharedSchema(e,t){if(!e&&!t)throw new Error("Either datasetId or datasetName must be given");if(!e){const n=await this.readDataset({datasetName:t});e=n.id}tv(e);const n=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"read dataset shared schema"),t}),r=await n.json();return r.url=`${this.getHostUrl()}/public/${r.share_token}/d`,r}async shareDataset(e,t){if(!e&&!t)throw new Error("Either datasetId or datasetName must be given");if(!e){const n=await this.readDataset({datasetName:t});e=n.id}const n={dataset_id:e};tv(e);const r=JSON.stringify(n),i=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"PUT",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:r});return await yE(t,"share dataset"),t}),a=await i.json();return a.url=`${this.getHostUrl()}/public/${a.share_token}/d`,a}async unshareDataset(e){tv(e),await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/datasets/${e}/share`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"unshare dataset",!0),t})}async readSharedDataset(e){tv(e);const t=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/public/${e}/datasets`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"read shared dataset"),t});return await t.json()}async listSharedExamples(e,t){const n={};t?.exampleIds&&(n.id=t.exampleIds);const r=new URLSearchParams;Object.entries(n).forEach(([e,t])=>{Array.isArray(t)?t.forEach(t=>r.append(e,t)):r.append(e,t)});const i=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/public/${e}/examples?${r.toString()}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"list shared examples"),t}),a=await i.json();if(!i.ok){if("detail"in a)throw new Error(`Failed to list shared examples.\nStatus: ${i.status}\nMessage: ${Array.isArray(a.detail)?a.detail.join("\n"):"Unspecified error"}`);throw new Error(`Failed to list shared examples: ${i.status} ${i.statusText}`)}return a.map(e=>({...e,_hostUrl:this.getHostUrl()}))}async createProject({projectName:e,description:t=null,metadata:n=null,upsert:r=!1,projectExtra:i=null,referenceDatasetId:a=null,numExamples:o=null,numRepetitions:s=null,evaluatorKeys:c=null,tagValueIds:l=null}){const u=r?"?upsert=true":"",d=`${this.apiUrl}/sessions${u}`,p=i||{};n&&(p.metadata=n);const h={name:e,extra:p,description:t};null!==a&&(h.reference_dataset_id=a),null!=o&&(h.num_examples=o),null!=s&&(h.num_repetitions=s),null!=c&&c.length>0&&(h.evaluator_keys=c),null!==l&&(h.tag_value_ids=l);const f=JSON.stringify(h),m=await this.caller.call(async()=>{const e=await this._fetch(d,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:f});return await yE(e,"create project"),e});return await m.json()}async updateProject(e,{name:t=null,description:n=null,metadata:r=null,projectExtra:i=null,endTime:a=null}){const o=`${this.apiUrl}/sessions/${e}`;let s=i;r&&(s={...s||{},metadata:r});const c=JSON.stringify({name:t,extra:s,description:n,end_time:a?new Date(a).toISOString():null}),l=await this.caller.call(async()=>{const e=await this._fetch(o,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await yE(e,"update project"),e});return await l.json()}async hasProject({projectId:e,projectName:t}){let n="/sessions";const r=new URLSearchParams;if(void 0!==e&&void 0!==t)throw new Error("Must provide either projectName or projectId, not both");if(void 0!==e)tv(e),n+=`/${e}`;else{if(void 0===t)throw new Error("Must provide projectName or projectId");r.append("name",t)}const i=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${n}?${r}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"has project"),e});try{const e=await i.json();return!!i.ok&&(!Array.isArray(e)||e.length>0)}catch(a){return!1}}async readProject({projectId:e,projectName:t,includeStats:n}){let r="/sessions";const i=new URLSearchParams;if(void 0!==e&&void 0!==t)throw new Error("Must provide either projectName or projectId, not both");if(void 0!==e)tv(e),r+=`/${e}`;else{if(void 0===t)throw new Error("Must provide projectName or projectId");i.append("name",t)}void 0!==n&&i.append("include_stats",n.toString());const a=await this._get(r,i);let o;if(Array.isArray(a)){if(0===a.length)throw new Error(`Project[id=${e}, name=${t}] not found`);o=a[0]}else o=a;return o}async getProjectUrl({projectId:e,projectName:t}){if(void 0===e&&void 0===t)throw new Error("Must provide either projectName or projectId");const n=await this.readProject({projectId:e,projectName:t}),r=await this._getTenantId();return`${this.getHostUrl()}/o/${r}/projects/p/${n.id}`}async getDatasetUrl({datasetId:e,datasetName:t}){if(void 0===e&&void 0===t)throw new Error("Must provide either datasetName or datasetId");const n=await this.readDataset({datasetId:e,datasetName:t}),r=await this._getTenantId();return`${this.getHostUrl()}/o/${r}/datasets/${n.id}`}async _getTenantId(){if(null!==this._tenantId)return this._tenantId;const e=new URLSearchParams({limit:"1"});for await(const t of this._getPaginated("/sessions",e))return this._tenantId=t[0].tenant_id,t[0].tenant_id;throw new Error("No projects found to resolve tenant.")}async*listProjects({projectIds:e,name:t,nameContains:n,referenceDatasetId:r,referenceDatasetName:i,includeStats:a,datasetVersion:o,referenceFree:s,metadata:c}={}){const l=new URLSearchParams;if(void 0!==e)for(const u of e)l.append("id",u);if(void 0!==t&&l.append("name",t),void 0!==n&&l.append("name_contains",n),void 0!==r)l.append("reference_dataset",r);else if(void 0!==i){const e=await this.readDataset({datasetName:i});l.append("reference_dataset",e.id)}void 0!==a&&l.append("include_stats",a.toString()),void 0!==o&&l.append("dataset_version",o),void 0!==s&&l.append("reference_free",s.toString()),void 0!==c&&l.append("metadata",JSON.stringify(c));for await(const u of this._getPaginated("/sessions",l))yield*u}async deleteProject({projectId:e,projectName:t}){let n;if(void 0===e&&void 0===t)throw new Error("Must provide projectName or projectId");if(void 0!==e&&void 0!==t)throw new Error("Must provide either projectName or projectId, not both");n=void 0===e?(await this.readProject({projectName:t})).id:e,tv(n),await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/sessions/${n}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,`delete session ${n} (${t})`,!0),e})}async uploadCsv({csvFile:e,fileName:t,inputKeys:n,outputKeys:r,description:i,dataType:a,name:o}){const s=`${this.apiUrl}/datasets/upload`,c=new FormData,l=new Blob([e],{type:"text/csv"});c.append("file",l,t),n.forEach(e=>{c.append("input_keys",e)}),r.forEach(e=>{c.append("output_keys",e)}),i&&c.append("description",i),a&&c.append("data_type",a),o&&c.append("name",o);const u=await this.caller.call(async()=>{const e=await this._fetch(s,{method:"POST",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await yE(e,"upload CSV"),e});return await u.json()}async createDataset(e,{description:t,dataType:n,inputsSchema:r,outputsSchema:i,metadata:a,tagValueIds:o}={}){const s={name:e,description:t,extra:{source:"sdk",...a?{metadata:a}:{}}};n&&(s.data_type=n),r&&(s.inputs_schema_definition=r),i&&(s.outputs_schema_definition=i),void 0!==o&&(s.tag_value_ids=o);const c=JSON.stringify(s),l=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await yE(e,"create dataset"),e});return await l.json()}async readDataset({datasetId:e,datasetName:t}){let n="/datasets";const r=new URLSearchParams({limit:"1"});if(e&&t)throw new Error("Must provide either datasetName or datasetId, not both");if(e)tv(e),n+=`/${e}`;else{if(!t)throw new Error("Must provide datasetName or datasetId");r.append("name",t)}const i=await this._get(n,r);let a;if(Array.isArray(i)){if(0===i.length)throw new Error(`Dataset[id=${e}, name=${t}] not found`);a=i[0]}else a=i;return a}async hasDataset({datasetId:e,datasetName:t}){try{return await this.readDataset({datasetId:e,datasetName:t}),!0}catch(n){if(n instanceof Error&&n.message.toLocaleLowerCase().includes("not found"))return!1;throw n}}async diffDatasetVersions({datasetId:e,datasetName:t,fromVersion:n,toVersion:r}){let i=e;if(void 0===i&&void 0===t)throw new Error("Must provide either datasetName or datasetId");if(void 0!==i&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===i){i=(await this.readDataset({datasetName:t})).id}const a=new URLSearchParams({from_version:"string"==typeof n?n:n.toISOString(),to_version:"string"==typeof r?r:r.toISOString()});return await this._get(`/datasets/${i}/versions/diff`,a)}async readDatasetOpenaiFinetuning({datasetId:e,datasetName:t}){if(void 0!==e);else{if(void 0===t)throw new Error("Must provide either datasetName or datasetId");e=(await this.readDataset({datasetName:t})).id}const n=await this._getResponse(`/datasets/${e}/openai_ft`);return(await n.text()).trim().split("\n").map(e=>JSON.parse(e))}async*listDatasets({limit:e=100,offset:t=0,datasetIds:n,datasetName:r,datasetNameContains:i,metadata:a}={}){const o=new URLSearchParams({limit:e.toString(),offset:t.toString()});if(void 0!==n)for(const s of n)o.append("id",s);void 0!==r&&o.append("name",r),void 0!==i&&o.append("name_contains",i),void 0!==a&&o.append("metadata",JSON.stringify(a));for await(const s of this._getPaginated("/datasets",o))yield*s}async updateDataset(e){const{datasetId:t,datasetName:n,...r}=e;if(!t&&!n)throw new Error("Must provide either datasetName or datasetId");const i=t??(await this.readDataset({datasetName:n})).id;tv(i);const a=JSON.stringify(r),o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${i}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await yE(e,"update dataset"),e});return await o.json()}async updateDatasetTag(e){const{datasetId:t,datasetName:n,asOf:r,tag:i}=e;if(!t&&!n)throw new Error("Must provide either datasetName or datasetId");const a=t??(await this.readDataset({datasetName:n})).id;tv(a);const o=JSON.stringify({as_of:"string"==typeof r?r:r.toISOString(),tag:i});await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${a}/tags`,{method:"PUT",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await yE(e,"update dataset tags",!0),e})}async deleteDataset({datasetId:e,datasetName:t}){let n="/datasets",r=e;if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0!==t){r=(await this.readDataset({datasetName:t})).id}if(void 0===r)throw new Error("Must provide datasetName or datasetId");tv(r),n+=`/${r}`,await this.caller.call(async()=>{const e=await this._fetch(this.apiUrl+n,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,`delete ${n}`,!0),e})}async createExample(e,t,n){if(uP(e)&&(void 0!==t||void 0!==n))throw new Error("Cannot provide outputs or options when using ExampleCreate object");let r=t?n?.datasetId:e.dataset_id;const i=t?n?.datasetName:e.dataset_name;if(void 0===r&&void 0===i)throw new Error("Must provide either datasetName or datasetId");if(void 0!==r&&void 0!==i)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===r){r=(await this.readDataset({datasetName:i})).id}const a=(t?n?.createdAt:e.created_at)||/* @__PURE__ */new Date;let o;o=uP(e)?e:{inputs:e,outputs:t,created_at:a?.toISOString(),id:n?.exampleId,metadata:n?.metadata,split:n?.split,source_run_id:n?.sourceRunId,use_source_run_io:n?.useSourceRunIO,use_source_run_attachments:n?.useSourceRunAttachments,attachments:n?.attachments};const s=await this._uploadExamplesMultipart(r,[o]);return await this.readExample(s.example_ids?.[0]??Yb())}async createExamples(e){if(Array.isArray(e)){if(0===e.length)return[];const t=e;let n=t[0].dataset_id;const r=t[0].dataset_name;if(void 0===n&&void 0===r)throw new Error("Must provide either datasetName or datasetId");if(void 0!==n&&void 0!==r)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===n){n=(await this.readDataset({datasetName:r})).id}const i=await this._uploadExamplesMultipart(n,t);return await Promise.all(i.example_ids.map(e=>this.readExample(e)))}const{inputs:t,outputs:n,metadata:r,splits:i,sourceRunIds:a,useSourceRunIOs:o,useSourceRunAttachments:s,attachments:c,exampleIds:l,datasetId:u,datasetName:d}=e;if(void 0===t)throw new Error("Must provide inputs when using legacy parameters");let p=u;const h=d;if(void 0===p&&void 0===h)throw new Error("Must provide either datasetName or datasetId");if(void 0!==p&&void 0!==h)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===p){const e=await this.readDataset({datasetName:h});p=e.id}const f=t.map((e,t)=>({dataset_id:p,inputs:e,outputs:n?.[t],metadata:r?.[t],split:i?.[t],id:l?.[t],attachments:c?.[t],source_run_id:a?.[t],use_source_run_io:o?.[t],use_source_run_attachments:s?.[t]})),m=await this._uploadExamplesMultipart(p,f);return await Promise.all(m.example_ids.map(e=>this.readExample(e)))}async createLLMExample(e,t,n){return this.createExample({input:e},{output:t},n)}async createChatExample(e,t,n){const r=e.map(e=>L_(e)?N_(e):e),i=L_(t)?N_(t):t;return this.createExample({input:r},{output:i},n)}async readExample(e){tv(e);const t=`/examples/${e}`,n=await this._get(t),{attachment_urls:r,...i}=n,a=i;return r&&(a.attachments=Object.entries(r).reduce((e,[t,n])=>(e[t.slice(11)]={presigned_url:n.presigned_url,mime_type:n.mime_type},e),{})),a}async*listExamples({datasetId:e,datasetName:t,exampleIds:n,asOf:r,splits:i,inlineS3Urls:a,metadata:o,limit:s,offset:c,filter:l,includeAttachments:u}={}){let d;if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0!==e)d=e;else{if(void 0===t)throw new Error("Must provide a datasetName or datasetId");d=(await this.readDataset({datasetName:t})).id}const p=new URLSearchParams({dataset:d}),h=r?"string"==typeof r?r:r?.toISOString():void 0;h&&p.append("as_of",h);const f=a??!0;if(p.append("inline_s3_urls",f.toString()),void 0!==n)for(const g of n)p.append("id",g);if(void 0!==i)for(const g of i)p.append("splits",g);if(void 0!==o){const e=JSON.stringify(o);p.append("metadata",e)}void 0!==s&&p.append("limit",s.toString()),void 0!==c&&p.append("offset",c.toString()),void 0!==l&&p.append("filter",l),!0===u&&["attachment_urls","outputs","metadata"].forEach(e=>p.append("select",e));let m=0;for await(const g of this._getPaginated("/examples",p)){for(const e of g){const{attachment_urls:t,...n}=e,r=n;t&&(r.attachments=Object.entries(t).reduce((e,[t,n])=>(e[t.slice(11)]={presigned_url:n.presigned_url,mime_type:n.mime_type||void 0},e),{})),yield r,m++}if(void 0!==s&&m>=s)break}}async deleteExample(e){tv(e);const t=`/examples/${e}`;await this.caller.call(async()=>{const e=await this._fetch(this.apiUrl+t,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,`delete ${t}`,!0),e})}async deleteExamples(e,t){if(e.forEach(e=>tv(e)),t?.hardDelete){const t=this._getPlatformEndpointPath("datasets/examples/delete");await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}${t}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},body:JSON.stringify({example_ids:e,hard_delete:!0}),signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(n,"hard delete examples",!0),n})}else{const t=new URLSearchParams;e.forEach(e=>t.append("example_ids",e)),await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/examples?${t.toString()}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"delete examples",!0),e})}}async updateExample(e,t){let n,r,i;if(n=t?e:e.id,tv(n),r=t?{id:n,...t}:e,void 0!==r.dataset_id)i=r.dataset_id;else{i=(await this.readExample(n)).dataset_id}return this._updateExamplesMultipart(i,[r])}async updateExamples(e){let t;if(void 0===e[0].dataset_id){t=(await this.readExample(e[0].id)).dataset_id}else t=e[0].dataset_id;return this._updateExamplesMultipart(t,e)}async readDatasetVersion({datasetId:e,datasetName:t,asOf:n,tag:r}){let i;if(e)i=e;else{const e=await this.readDataset({datasetName:t});i=e.id}if(tv(i),n&&r||!n&&!r)throw new Error("Exactly one of asOf and tag must be specified.");const a=new URLSearchParams;void 0!==n&&a.append("as_of","string"==typeof n?n:n.toISOString()),void 0!==r&&a.append("tag",r);const o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${i}/version?${a.toString()}`,{method:"GET",headers:{...this._mergedHeaders},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"read dataset version"),e});return await o.json()}async listDatasetSplits({datasetId:e,datasetName:t,asOf:n}){let r;if(void 0===e&&void 0===t)throw new Error("Must provide dataset name or ID");if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===e){r=(await this.readDataset({datasetName:t})).id}else r=e;tv(r);const i=new URLSearchParams,a=n?"string"==typeof n?n:n?.toISOString():void 0;a&&i.append("as_of",a);return await this._get(`/datasets/${r}/splits`,i)}async updateDatasetSplits({datasetId:e,datasetName:t,splitName:n,exampleIds:r,remove:i=!1}){let a;if(void 0===e&&void 0===t)throw new Error("Must provide dataset name or ID");if(void 0!==e&&void 0!==t)throw new Error("Must provide either datasetName or datasetId, not both");if(void 0===e){const e=await this.readDataset({datasetName:t});a=e.id}else a=e;tv(a);const o={split_name:n,examples:r.map(e=>(tv(e),e)),remove:i},s=JSON.stringify(o);await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/${a}/splits`,{method:"PUT",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await yE(e,"update dataset splits",!0),e})}async createFeedback(e,t,n){const{runId:r=null,key:i,score:a,value:o,correction:s,comment:c,sourceInfo:l,feedbackSourceType:u="api",sourceRunId:d,feedbackId:p,feedbackConfig:h,projectId:f,traceId:m,comparativeExperimentId:g,sessionId:y,startTime:I,extendTraceRetention:C}="object"==typeof e&&null!==e?e:{runId:e,key:t,...n};if(!r&&!f)throw new Error("One of runId or projectId must be provided");if(r&&f)throw new Error("Only one of runId or projectId can be provided");r&&void 0===y&&await this._checkFeedbackSessionId();const A={type:u??"api",metadata:l??{}};void 0===d||void 0===A?.metadata||A.metadata.__run||(A.metadata.__run={run_id:d}),void 0!==A?.metadata&&void 0!==A.metadata.__run?.run_id&&tv(A.metadata.__run.run_id);const S={id:p??tT(),run_id:r,trace_id:m,key:i,score:rP(a),value:o,correction:s,comment:c,feedback_source:A,comparative_experiment_id:g,feedbackConfig:h,session_id:y??f,start_time:I,extend_trace_retention:C},b=m??r;if(null!=b&&!this._shouldSample(b))return S;const T=JSON.stringify(S),v=`${this.apiUrl}/feedback`;return await this.caller.call(async()=>{const e=await this._fetch(v,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:T});return await yE(e,"create feedback",!0),e}),S}async updateFeedback(e,{score:t,value:n,correction:r,comment:i}){const a={};null!=t&&(a.score=rP(t)),null!=n&&(a.value=n),null!=r&&(a.correction=r),null!=i&&(a.comment=i),tv(e);const o=JSON.stringify(a);await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/feedback/${e}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:o});return await yE(t,"update feedback",!0),t})}async readFeedback(e){tv(e);const t=`/feedback/${e}`;return await this._get(t)}async deleteFeedback(e){tv(e);const t=`/feedback/${e}`;await this.caller.call(async()=>{const e=await this._fetch(this.apiUrl+t,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,`delete ${t}`,!0),e})}async*listFeedback({runIds:e,feedbackKeys:t,feedbackSourceTypes:n}={}){const r=new URLSearchParams;if(e)for(const i of e)tv(i),r.append("run",i);if(t)for(const i of t)r.append("key",i);if(n)for(const i of n)r.append("source",i);for await(const i of this._getPaginated("/feedback",r))yield*i}async createPresignedFeedbackToken(e,t,{expiration:n,feedbackConfig:r}={}){const i={run_id:e,feedback_key:t,feedback_config:r};n?"string"==typeof n?i.expires_at=n:(n?.hours||n?.minutes||n?.days)&&(i.expires_in=n):i.expires_in={hours:3};const a=JSON.stringify(i),o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback/tokens`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await yE(e,"create presigned feedback token"),e});return await o.json()}async createComparativeExperiment({name:e,experimentIds:t,referenceDatasetId:n,createdAt:r,description:i,metadata:a,id:o}){if(0===t.length)throw new Error("At least one experiment is required");if(n||(n=(await this.readProject({projectId:t[0]})).reference_dataset_id),null==!n)throw new Error("A reference dataset is required");const s={id:o,name:e,experiment_ids:t,reference_dataset_id:n,description:i,created_at:(r??/* @__PURE__ */new Date)?.toISOString(),extra:{}};a&&(s.extra.metadata=a);const c=JSON.stringify(s);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/datasets/comparative`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await yE(e,"create comparative experiment"),e})).json()}async*listPresignedFeedbackTokens(e){tv(e);const t=new URLSearchParams({run_id:e});for await(const n of this._getPaginated("/feedback/tokens",t))yield*n}_selectEvalResults(e){let t;return t="results"in e?e.results:Array.isArray(e)?e:[e],t}async _logEvaluationFeedback(e,t,n,r){const i=this._selectEvalResults(e),a=[];for(const o of i){let e=n||{};o.evaluatorInfo&&(e={...o.evaluatorInfo,...e});let i=null;o.targetRunId?i=o.targetRunId:t&&(i=t.id),a.push(await this.createFeedback(i,o.key,{score:o.score,value:o.value,comment:o.comment,correction:o.correction,sourceInfo:e,sourceRunId:o.sourceRunId,feedbackConfig:o.feedbackConfig,feedbackSourceType:"model",sessionId:t?.session_id??r,startTime:t?.start_time,traceId:i===t?.id?t?.trace_id:void 0}))}return[i,a]}async logEvaluationFeedback(e,t,n,r){if(null!=e&&"object"==typeof e&&"evaluatorResponse"in e){const[t]=await this._logEvaluationFeedback(e.evaluatorResponse,e.run,e.sourceInfo,e.projectId);return t}const[i]=await this._logEvaluationFeedback(e,t,n,r);return i}async createFeedbackConfig(e){const{feedbackKey:t,feedbackConfig:n,isLowerScoreBetter:r=!1}=e,i={feedback_key:t,feedback_config:n,is_lower_score_better:r};return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await yE(e,"create feedback config"),e})).json()}async*listFeedbackConfigs(e={}){const{feedbackKeys:t,nameContains:n,limit:r}=e,i=new URLSearchParams;t&&t.forEach(e=>{i.append("key",e)}),n&&i.append("name_contains",n),i.append("limit",(void 0!==r?Math.min(r,100):100).toString());let a=0;for await(const o of this._getPaginated("/feedback-configs",i))if(yield*o,a+=o.length,void 0!==r&&a>=r)break}async updateFeedbackConfig(e,t={}){const{feedbackConfig:n,isLowerScoreBetter:r}=t,i={feedback_key:e};void 0!==n&&(i.feedback_config=n),void 0!==r&&(i.is_lower_score_better=r);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback-configs`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(i)});return await yE(e,"update feedback config"),e})).json()}async deleteFeedbackConfig(e){const t=new URLSearchParams({feedback_key:e});await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/feedback-configs?${t}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"delete feedback config",!0),e})}async*listAnnotationQueues(e={}){const{queueIds:t,name:n,nameContains:r,limit:i}=e,a=new URLSearchParams;t&&t.forEach((e,t)=>{tv(e,`queueIds[${t}]`),a.append("ids",e)}),n&&a.append("name",n),r&&a.append("name_contains",r),a.append("limit",(void 0!==i?Math.min(i,100):100).toString());let o=0;for await(const s of this._getPaginated("/annotation-queues",a))if(yield*s,o++,void 0!==i&&o>=i)break}async createAnnotationQueue(e){const{name:t,description:n,queueId:r,rubricInstructions:i,rubricItems:a}=e,o={name:t,description:n,id:r||Yb(),rubric_instructions:i,rubric_items:a},s=JSON.stringify(Object.fromEntries(Object.entries(o).filter(([e,t])=>void 0!==t)));return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/annotation-queues`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await yE(e,"create annotation queue"),e})).json()}async readAnnotationQueue(e){return(await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${tv(e,"queueId")}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"read annotation queue"),t})).json()}async updateAnnotationQueue(e,t){const{name:n,description:r,rubricInstructions:i,rubricItems:a}=t,o={};void 0!==n&&(o.name=n),void 0!==r&&(o.description=r),void 0!==i&&(o.rubric_instructions=i),void 0!==a&&(o.rubric_items=a);const s=JSON.stringify(o);await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${tv(e,"queueId")}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await yE(t,"update annotation queue",!0),t})}async deleteAnnotationQueue(e){await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${tv(e,"queueId")}`,{method:"DELETE",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"delete annotation queue",!0),t})}async addRunsToAnnotationQueue(e,t){const n=`${this.apiUrl}/annotation-queues/${tv(e,"queueId")}/runs`;let r,i;t.every(e=>"string"==typeof e)?(fT("Passing run IDs as strings to addRunsToAnnotationQueue() is deprecated and will be removed after Jan 31, 2027. Use RunKey[] instead. See https://docs.langchain.com/langsmith/smithdb-sdk-migration-feedback#annotation-queues-add-runs for the migration guide.",{type:"DeprecationWarning",code:"LANGSMITH_DEPRECATED_ADD_RUNS_STRING_IDS"}),r=n,i=JSON.stringify(t.map((e,t)=>tv(e,`runs[${t}]`).toString()))):(r=`${n}/by-key`,i=JSON.stringify(t.map((e,t)=>{const n={run_id:tv(e.runId,`runs[${t}].runId`).toString(),session_id:tv(e.sessionId,`runs[${t}].sessionId`).toString(),start_time:"string"==typeof e.startTime?e.startTime:new Date(e.startTime).toISOString()};return null!=e.sourceProposedExampleId&&(n.source_proposed_example_id=tv(e.sourceProposedExampleId,`runs[${t}].sourceProposedExampleId`).toString()),n}))),await this.caller.call(async()=>{const e=await this._fetch(r,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:i});return await yE(e,"add runs to annotation queue",!0),e})}async getRunFromAnnotationQueue(e,t){const n=`/annotation-queues/${tv(e,"queueId")}/run`,r=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${n}/${t}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"get run from annotation queue"),e});return ZE(await r.json())}async*listRunsFromAnnotationQueue(e,t={}){const{status:n,limit:r}=t,i=new URLSearchParams,a=void 0!==r&&Number.isFinite(r)?Math.min(r,100):100;n&&i.append("status",n),i.append("limit",a.toString());let o=0;const s=`/annotation-queues/${tv(e,"queueId")}/runs`;for await(const c of this._getPaginated(s,i))for(const e of c)if(yield ZE(e),o++,o>=a)return}async deleteRunFromAnnotationQueue(e,t){await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}/annotation-queues/${tv(e,"queueId")}/runs/${tv(t,"queueRunId")}`,{method:"DELETE",headers:{...this._mergedHeaders,Accept:"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(n,"delete run from annotation queue",!0),n})}async getSizeFromAnnotationQueue(e){return(await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/annotation-queues/${tv(e,"queueId")}/size`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"get size from annotation queue"),t})).json()}async _currentTenantIsOwner(e){const t=await this._getSettings();return"-"==e||t.tenant_handle===e}async _ownerConflictError(e,t){const n=await this._getSettings();return new Error(`Cannot ${e} for another tenant.\n\n Current tenant: ${n.tenant_handle}\n\n Requested tenant: ${t}`)}async _getLatestCommitHash(e){const t=await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}/commits/${e}/?limit=1&offset=0`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(t,"get latest commit hash"),t}),n=await t.json();if(0!==n.commits.length)return n.commits[0].commit_hash}async _createCommitTags(e,t,n){const r="string"==typeof n?[n]:n;await Promise.all(r.map(async n=>this.caller.call(async()=>{const r=await this._fetch(`${this.apiUrl}/repos/${e}/tags`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify({tag_name:n,commit_id:t})});return await yE(r,"create commit tag"),r})))}async _likeOrUnlikePrompt(e,t){const[n,r,i]=AE(e),a=JSON.stringify({like:t});return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/likes/${n}/${r}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await yE(e,(t?"like":"unlike")+" prompt"),e})).json()}async _getPromptUrl(e){const[t,n,r]=AE(e);if(await this._currentTenantIsOwner(t)){const e=await this._getSettings();return"latest"!==r?`${this.getHostUrl()}/prompts/${n}/${r.substring(0,8)}?organizationId=${e.id}`:`${this.getHostUrl()}/prompts/${n}?organizationId=${e.id}`}return"latest"!==r?`${this.getHostUrl()}/hub/${t}/${n}/${r.substring(0,8)}`:`${this.getHostUrl()}/hub/${t}/${n}`}async promptExists(e){return!!(await this.getPrompt(e))}async likePrompt(e){return this._likeOrUnlikePrompt(e,!0)}async unlikePrompt(e){return this._likeOrUnlikePrompt(e,!1)}async*listCommits(e){const[t,n,r]=AE(e);for await(const i of this._getPaginated(`/commits/${t}/${n}/`,new URLSearchParams,e=>e.commits))yield*i}async*listPrompts(e){const t=new URLSearchParams;t.append("sort_field",e?.sortField??"updated_at"),t.append("sort_direction","desc"),t.append("is_archived",(!!e?.isArchived).toString()),void 0!==e?.isPublic&&t.append("is_public",e.isPublic.toString()),e?.query&&t.append("query",e.query);for await(const n of this._getPaginated("/repos",t,e=>e.repos))yield*n}async getPrompt(e){const[t,n,r]=AE(e),i=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/${t}/${n}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return 404===e?.status?null:(await yE(e,"get prompt"),e)}),a=await(i?.json());return a?.repo?a.repo:null}async createPrompt(e,t){const n=await this._getSettings();if(t?.isPublic&&!n.tenant_handle)throw new Error("Cannot create a public prompt without first\n\n creating a LangChain Hub handle.\n You can add a handle by creating a public prompt at:\n\n https://smith.langchain.com/prompts");const[r,i,a]=AE(e);if(!(await this._currentTenantIsOwner(r)))throw await this._ownerConflictError("create a prompt",r);const o={repo_handle:i,...t?.description&&{description:t.description},...t?.readme&&{readme:t.readme},...t?.tags&&{tags:t.tags},is_public:!!t?.isPublic},s=JSON.stringify(o),c=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:s});return await yE(e,"create prompt"),e}),{repo:l}=await c.json();return l}async createCommit(e,t,n){if(!(await this.promptExists(e)))throw new Error("Prompt does not exist, you must create it first.");const[r,i,a]=AE(e),o="latest"!==n?.parentCommitHash&&n?.parentCommitHash?n?.parentCommitHash:await this._getLatestCommitHash(`${r}/${i}`),s={manifest:JSON.parse(JSON.stringify(t)),parent_commit:o,...void 0!==n?.description&&{description:n.description}},c=JSON.stringify(s),l=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/commits/${r}/${i}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:c});return await yE(e,"create commit"),e}),u=await l.json(),d=u.commit??u;return n?.tags&&await this._createCommitTags(`${r}/${i}`,d.id,n.tags),this._getPromptUrl(`${r}/${i}${d.commit_hash?`:${d.commit_hash}`:""}`)}async updateExamplesMultipart(e,t=[]){return this._updateExamplesMultipart(e,t)}async _updateExamplesMultipart(e,t=[]){if(!(await this._getDatasetExamplesMultiPartSupport()))throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");const n=new FormData;for(const i of t){const e=i.id,t=KE({...i.metadata&&{metadata:i.metadata},...i.split&&{split:i.split}},`Serializing body for example with id: ${e}`),r=new Blob([t],{type:"application/json"});if(n.append(e,r),i.inputs){const t=KE(i.inputs,`Serializing inputs for example with id: ${e}`),r=new Blob([t],{type:"application/json"});n.append(`${e}.inputs`,r)}if(i.outputs){const t=KE(i.outputs,`Serializing outputs whle updating example with id: ${e}`),r=new Blob([t],{type:"application/json"});n.append(`${e}.outputs`,r)}if(i.attachments)for(const[a,o]of Object.entries(i.attachments)){let t,r;Array.isArray(o)?[t,r]=o:(t=o.mimeType,r=o.data);const i=new Blob([r],{type:`${t}; length=${r.byteLength}`});n.append(`${e}.attachment.${a}`,i)}if(i.attachments_operations){const t=KE(i.attachments_operations,`Serializing attachments while updating example with id: ${e}`),r=new Blob([t],{type:"application/json"});n.append(`${e}.attachments_operations`,r)}}const r=e??t[0]?.dataset_id;return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${r}/examples`)}`,{method:"PATCH",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await yE(e,"update examples"),e})).json()}async uploadExamplesMultipart(e,t=[]){return this._uploadExamplesMultipart(e,t)}async _uploadExamplesMultipart(e,t=[]){if(!(await this._getDatasetExamplesMultiPartSupport()))throw new Error("Your LangSmith deployment does not allow using the multipart examples endpoint, please upgrade your deployment to the latest version.");const n=new FormData;for(const r of t){const e=(r.id??Yb()).toString(),t=KE({created_at:r.created_at,...r.metadata&&{metadata:r.metadata},...r.split&&{split:r.split},...r.source_run_id&&{source_run_id:r.source_run_id},...r.use_source_run_io&&{use_source_run_io:r.use_source_run_io},...r.use_source_run_attachments&&{use_source_run_attachments:r.use_source_run_attachments}},`Serializing body for uploaded example with id: ${e}`),i=new Blob([t],{type:"application/json"});if(n.append(e,i),r.inputs){const t=KE(r.inputs,`Serializing inputs for uploaded example with id: ${e}`),i=new Blob([t],{type:"application/json"});n.append(`${e}.inputs`,i)}if(r.outputs){const t=KE(r.outputs,`Serializing outputs for uploaded example with id: ${e}`),i=new Blob([t],{type:"application/json"});n.append(`${e}.outputs`,i)}if(r.attachments)for(const[a,o]of Object.entries(r.attachments)){let t,r;Array.isArray(o)?[t,r]=o:(t=o.mimeType,r=o.data);const i=new Blob([r],{type:`${t}; length=${r.byteLength}`});n.append(`${e}.attachment.${a}`,i)}}return(await this.caller.call(async()=>{const t=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`datasets/${e}/examples`)}`,{method:"POST",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:n});return await yE(t,"upload examples"),t})).json()}async updatePrompt(e,t){if(!(await this.promptExists(e)))throw new Error("Prompt does not exist, you must create it first.");const[n,r]=AE(e);if(!(await this._currentTenantIsOwner(n)))throw await this._ownerConflictError("update a prompt",n);const i={};if(void 0!==t?.description&&(i.description=t.description),void 0!==t?.readme&&(i.readme=t.readme),void 0!==t?.tags&&(i.tags=t.tags),void 0!==t?.isPublic&&(i.is_public=t.isPublic),void 0!==t?.isArchived&&(i.is_archived=t.isArchived),0===Object.keys(i).length)throw new Error("No valid update options provided");const a=JSON.stringify(i);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/${n}/${r}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:a});return await yE(e,"update prompt"),e})).json()}async deletePrompt(e){if(!(await this.promptExists(e)))throw new Error("Prompt does not exist, you must create it first.");const[t,n,r]=AE(e);if(!(await this._currentTenantIsOwner(t)))throw await this._ownerConflictError("delete a prompt",t);return(await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/${t}/${n}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"delete prompt"),e})).json()}_getPromptCacheKey(e,t){return`${e}${t?":with_model":""}`}async _fetchPromptFromApi(e,t){const[n,r,i]=AE(e),a=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/commits/${n}/${r}/${i}${t?.includeModel?"?include_model=true":""}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"pull prompt commit"),e}),o=await a.json();return{owner:n,repo:r,commit_hash:o.commit_hash,manifest:o.manifest,examples:o.examples,hub_model_config:o.model_config,hub_model_provider:o.model_provider}}async pullPromptCommit(e,t){!function(e,t){const[n]=AE(e);if("-"!==n&&!t)throw new Error("Pulling a public prompt by owner/name is disabled by default because prompts may contain untrusted serialized LangChain objects. If you trust this prompt, set `dangerouslyPullPublicPrompt: true` to acknowledge the risk.")}(e,t?.dangerouslyPullPublicPrompt);const n=this._fetchPromptFromApi.bind(this,e,t);if(!t?.skipCache&&this._promptCache){const r=this._getPromptCacheKey(e,t?.includeModel),i=this._promptCache.get(r,n);if(i)return i;const a=await n();return this._promptCache.set(r,a,n),a}return this._fetchPromptFromApi(e,t)}async _pullPrompt(e,t){const n=await this.pullPromptCommit(e,{includeModel:t?.includeModel,skipCache:t?.skipCache,dangerouslyPullPublicPrompt:t?.dangerouslyPullPublicPrompt});return JSON.stringify(n.manifest)}async pushPrompt(e,t){if(await this.promptExists(e)?t&&["description","readme","tags","isPublic"].some(e=>void 0!==t[e])&&await this.updatePrompt(e,{description:t?.description,readme:t?.readme,tags:t?.tags,isPublic:t?.isPublic}):await this.createPrompt(e,{description:t?.description,readme:t?.readme,tags:t?.tags,isPublic:t?.isPublic}),!t?.object)return await this._getPromptUrl(e);return await this.createCommit(e,t?.object,{parentCommitHash:t?.parentCommitHash,tags:t?.commitTags,description:t?.commitDescription})}async agentExists(e){const[t,n]=AE(e);return this._repoExists(t,n)}async skillExists(e){const[t,n]=AE(e);return this._repoExists(t,n)}async pullAgent(e,t){return await this._pullDirectory(e,"agent",t?.version)}async pullSkill(e,t){return await this._pullDirectory(e,"skill",t?.version)}async pushAgent(e,t){return this._pushDirectory(e,"agent",t)}async pushSkill(e,t){return this._pushDirectory(e,"skill",t)}async deleteAgent(e){return this._deleteDirectory(e)}async deleteSkill(e){return this._deleteDirectory(e)}async*listAgents(e){yield*this._listReposByType("agent",e)}async*listSkills(e){yield*this._listReposByType("skill",e)}async*_listReposByType(e,t){const n=new URLSearchParams;n.append("repo_type",e),n.append("is_archived",(!!t?.isArchived).toString()),void 0!==t?.isPublic&&n.append("is_public",t.isPublic.toString()),t?.query&&n.append("query",t.query);for await(const r of this._getPaginated("/repos",n,e=>e.repos))yield*r}async _pullDirectory(e,t,n){const[r,i,a]=AE(e),o=n??("latest"!==a?a:void 0),s=new URL(`${this.apiUrl}${this._getPlatformEndpointPath(`hub/repos/${r}/${i}/directories`)}`);s.searchParams.set("repo_type",t),o&&s.searchParams.set("commit",o);const c=await this.caller.call(async()=>{const e=await this._fetch(s.toString(),{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"pull directory"),e});return await c.json()}async _pushDirectory(e,t,n){if(void 0!==n.parentCommit&&(n.parentCommit.length<8||n.parentCommit.length>64))throw new Error("parent_commit must be 8-64 characters");const[r,i]=AE(e);if(!(await this._currentTenantIsOwner(r)))throw await this._ownerConflictError(`push ${t}`,r);if(await this._repoExists(r,i))void 0===n.description&&void 0===n.readme&&void 0===n.tags&&void 0===n.isPublic||await this._updateRepoMetadata(r,i,n);else{const e=/^[a-z][a-z0-9-_]*$/;if(!e.test(i))throw new Error(`Invalid repo_handle ${JSON.stringify(i)}: must match ${e}`);await this._createRepo(i,t,n)}const a={files:n.files};n.parentCommit&&(a.parent_commit=n.parentCommit);const o=await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`hub/repos/${r}/${i}/directories/commits`)}`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(a)});return await yE(e,`push ${t}`),e}),s=(await o.json()).commit.commit_hash,c=await this._getSettings(),l=new URLSearchParams({organizationId:c.id});return`${this.getHostUrl()}/context/${i}/${s.slice(0,8)}?${l.toString()}`}async _deleteDirectory(e){const[t,n]=AE(e);if(!(await this._currentTenantIsOwner(t)))throw await this._ownerConflictError("delete",t);await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}${this._getPlatformEndpointPath(`hub/repos/${t}/${n}/directories`)}`,{method:"DELETE",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(e,"delete directory"),e})}async _repoExists(e,t){try{return await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}/repos/${e}/${t}`,{method:"GET",headers:this._mergedHeaders,signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions});return await yE(n,"check repo exists"),n}),!0}catch(n){if(gE(n))return!1;throw n}}async _createRepo(e,t,n){const r={repo_handle:e,repo_type:t,is_public:!!n.isPublic};void 0!==n.description&&(r.description=n.description),void 0!==n.readme&&(r.readme=n.readme),void 0!==n.tags&&(r.tags=n.tags);try{await this.caller.call(async()=>{const e=await this._fetch(`${this.apiUrl}/repos/`,{method:"POST",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(r)});return await yE(e,`create ${t}`),e})}catch(a){if(null!=(i=a)&&"object"==typeof i&&"name"in i&&"LangSmithConflictError"===i?.name)return;throw a}var i}async _updateRepoMetadata(e,t,n){const r={};void 0!==n.description&&(r.description=n.description),void 0!==n.readme&&(r.readme=n.readme),void 0!==n.tags&&(r.tags=n.tags),void 0!==n.isPublic&&(r.is_public=n.isPublic),0!==Object.keys(r).length&&await this.caller.call(async()=>{const n=await this._fetch(`${this.apiUrl}/repos/${e}/${t}`,{method:"PATCH",headers:{...this._mergedHeaders,"Content-Type":"application/json"},signal:AbortSignal.timeout(this.timeout_ms),...this.fetchOptions,body:JSON.stringify(r)});return await yE(n,"update repo metadata"),n})}async clonePublicDataset(e,t={}){const{sourceApiUrl:n=this.apiUrl,datasetName:r}=t,[i,a]=this.parseTokenOrUrl(e,n),o=new lP({apiUrl:i,apiKey:"placeholder"}),s=await o.readSharedDataset(a),c=r||s.name;try{if(await this.hasDataset({datasetId:c}))return void console.log(`Dataset ${c} already exists in your tenant. Skipping.`)}catch(d){}const l=await o.listSharedExamples(a),u=await this.createDataset(c,{description:s.description,dataType:s.data_type||"kv",inputsSchema:s.inputs_schema_definition??void 0,outputsSchema:s.outputs_schema_definition??void 0});try{await this.createExamples({inputs:l.map(e=>e.inputs),outputs:l.flatMap(e=>e.outputs?[e.outputs]:[]),datasetId:u.id})}catch(p){throw console.error(`An error occurred while creating dataset ${c}. You should delete it manually.`),p}}parseTokenOrUrl(e,t,n=2,r="dataset"){try{return tv(e),[t,e]}catch(i){}try{const i=new URL(e).pathname.split("/").filter(e=>""!==e);if(i.length>=n){return[t,i[i.length-n]]}throw new Error(`Invalid public ${r} URL: ${e}`)}catch(a){throw new Error(`Invalid public ${r} URL or token: ${e}`)}}cleanup(){this._promptCache&&this._promptCache.stop()}async awaitPendingTraceBatches(){if(this.manualFlushMode)return console.warn("[WARNING]: When tracing in manual flush mode, you must call `await client.flush()` manually to submit trace batches."),Promise.resolve();for(await new Promise(e=>setTimeout(e,1));this._pendingDrains.size>0;)await Promise.all([...this._pendingDrains]);await Promise.all([...this.autoBatchQueue.items.map(({itemPromise:e})=>e),this.batchIngestCaller.queue.onIdle()]),void 0!==this.langSmithToOTELTranslator&&await(Zv.getDefaultOTLPTracerComponents()?.DEFAULT_LANGSMITH_SPAN_PROCESSOR?.forceFlush())}toString(){const e=[`apiUrl=${JSON.stringify(this.apiUrl)}`];return void 0!==this.webUrl&&e.push(`webUrl=${JSON.stringify(this.webUrl)}`),void 0!==this.workspaceId&&e.push(`workspaceId=${JSON.stringify(this.workspaceId)}`),`[LangSmithClient ${e.join(" ")}]`}[/* @__PURE__ */Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}function uP(e){return"dataset_id"in e||"dataset_name"in e}Object.defineProperty(lP,"_fallbackDirsCreated",{enumerable:!0,configurable:!0,writable:!0,value:/* @__PURE__ */new Set});const dP=/* @__PURE__ */Symbol.for("lc:context_variables"),pP=/* @__PURE__ */Symbol.for("langsmith:replica_trace_roots");function hP(e,t){if(dP in e){return e[dP][t]}}function fP(e){return Zb(Object.keys(e).sort().map(t=>`${t}:${e[t]??""}`).join("|"),"6ba7b810-9dad-11d1-80b4-00c04fd430c8")}function mP(e,t=1){const n=t.toFixed(0).slice(0,3).padStart(3,"0");return`${new Date(e).toISOString().slice(0,-1)}${n}Z`}function gP(e,t,n=1){const r=mP(e,n);return{dottedOrder:(i=r,i.replace(/[-:.]/g,"")+t),microsecondPrecisionDatestring:r};var i}const yP=/* @__PURE__ */new Set(["projectName","primary","updates","reroot"]);function IP(e){const t={};for(const n of Object.keys(e))"primary"===n&&"boolean"!=typeof e[n]||yP.has(n)&&(t[n]=e[n]);return t}class CP{constructor(e,t,n,r){Object.defineProperty(this,"metadata",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.metadata=e,this.tags=t,this.project_name=n,this.replicas=r}static fromHeader(e){const t=e.split(",");let n,r,i={},a=[];for(const o of t){const[e,t]=o.split("="),s=decodeURIComponent(t);if("langsmith-metadata"===e)i=JSON.parse(s);else if("langsmith-tags"===e)a=s.split(",");else if("langsmith-project"===e)n=s;else if("langsmith-replicas"===e){r=JSON.parse(s).map(e=>Array.isArray(e)?e:IP(e))}}return new CP(i,a,n,r)}toHeader(){const e=[];return this.metadata&&Object.keys(this.metadata).length>0&&e.push(`langsmith-metadata=${encodeURIComponent(JSON.stringify(this.metadata))}`),this.tags&&this.tags.length>0&&e.push(`langsmith-tags=${encodeURIComponent(this.tags.join(","))}`),this.project_name&&e.push(`langsmith-project=${encodeURIComponent(this.project_name)}`),e.join(",")}}class AP{constructor(e){if(Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"run_type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"project_name",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"parent_run_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_runs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"end_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extra",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tags",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"error",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"serialized",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"inputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"outputs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reference_example_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"events",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"trace_id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"dotted_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"tracingEnabled",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"child_execution_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"attachments",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"replicas",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"distributedParentId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_serialized_start_time",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_awaitInputsOnPost",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),null!=(t=e)&&"function"==typeof t.createChild&&"function"==typeof t.postRun)return void Object.assign(this,{...e});var t;const n=AP.getDefaultConfig(),{metadata:r,...i}=e,a=i.client??AP.getSharedClient(),o={...r,...i?.extra?.metadata};var s;if(i.extra={...i.extra,metadata:o},"id"in i&&null==i.id&&delete i.id,Object.assign(this,{...n,...i,client:a}),this.execution_order??=1,this.child_execution_order??=1,this.dotted_order||(this._serialized_start_time=mP(this.start_time,this.execution_order)),this.id||(this.id=tT({msecs:"string"==typeof(s=this._serialized_start_time??this.start_time)?Date.parse(s):s,seq:0})),this.trace_id||(this.parent_run?this.trace_id=this.parent_run.trace_id??this.id:this.trace_id=this.id),this.replicas=function(e){const t=e?e.map(e=>Array.isArray(e)?{projectName:e[0],updates:e[1]}:e):function(){const e=Uv("LANGSMITH_RUNS_ENDPOINTS");if(!e)return[];try{const t=JSON.parse(e);if(Array.isArray(t)){const e=[];for(const n of t)"object"==typeof n&&null!==n?"string"==typeof n.api_url?"string"==typeof n.api_key?void 0===n.project_name||null===n.project_name||"string"==typeof n.project_name?void 0===n.primary||"boolean"==typeof n.primary?e.push({apiUrl:n.api_url.replace(/\/$/,""),apiKey:n.api_key,projectName:n.project_name??void 0,primary:n.primary??void 0}):console.warn("Invalid primary type in LANGSMITH_RUNS_ENDPOINTS: expected boolean, got "+typeof n.primary):console.warn("Invalid project_name type in LANGSMITH_RUNS_ENDPOINTS: expected string, got "+typeof n.project_name):console.warn("Invalid api_key type in LANGSMITH_RUNS_ENDPOINTS: expected string, got "+typeof n.api_key):console.warn("Invalid api_url type in LANGSMITH_RUNS_ENDPOINTS: expected string, got "+typeof n.api_url):console.warn("Invalid item type in LANGSMITH_RUNS_ENDPOINTS: expected object, got "+typeof n);return e}if("object"==typeof t&&null!==t){!function(e){if(Object.keys(e).length>0&&Vv("ENDPOINT"))throw new CE}(t);const e=[];for(const[n,r]of Object.entries(t)){const t=n.replace(/\/$/,"");"string"==typeof r?e.push({apiUrl:t,apiKey:r}):console.warn(`Invalid value type in LANGSMITH_RUNS_ENDPOINTS for URL ${n}: expected string, got ${typeof r}`)}return e}return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey, got "+typeof t),[]}catch(n){if("object"==typeof(t=n)&&null!==t&&t.code===IE)throw n;return console.warn("Invalid LANGSMITH_RUNS_ENDPOINTS – must be valid JSON array of objects with api_url and api_key properties, or object mapping url->apiKey"),[]}var t}();if(t.filter(e=>!0===e.primary).length>1)throw new Error("Only one replica can be marked as primary.");return t}(this.replicas),!this.dotted_order){const{dottedOrder:e}=gP(this.start_time,this.id,this.execution_order);this.parent_run?this.dotted_order=this.parent_run.dotted_order+"."+e:this.dotted_order=e}}set metadata(e){this.extra={...this.extra,metadata:{...this.extra?.metadata,...e}}}get metadata(){return this.extra?.metadata}static getDefaultConfig(){const e=Date.now();return{run_type:"chain",project_name:pT(),child_runs:[],api_url:Uv("LANGCHAIN_ENDPOINT")??"http://localhost:1984",api_key:Uv("LANGCHAIN_API_KEY"),caller_options:{},start_time:e,serialized:{},inputs:{},extra:{}}}static getSharedClient(){return AP.sharedClient||(AP.sharedClient=new lP),AP.sharedClient}createChild(e){const t=this.child_execution_order+1,n=this.replicas?.map(e=>{const{reroot:t,...n}=e;return n}),r=e.replicas??n,i=new AP({...e,parent_run:this,project_name:this.project_name,replicas:r,client:this.client,tracingEnabled:this.tracingEnabled,execution_order:t,child_execution_order:t}),a=this.extra?.metadata??{},o=i.extra?.metadata??{};Object.keys(a).length>0&&(i.extra={...i.extra,metadata:{...a,...o}}),dP in this&&(i[dP]=this[dP]);const s=/* @__PURE__ */Symbol.for("lc:child_config"),c=e.extra?.[s]??this.extra[s];if(function(e){const t=e?.callbacks;return null!=e&&"object"==typeof t&&(bP(t?.handlers)||bP(t))}(c)){const e={...c},t="object"==typeof(l=e.callbacks)&&null!=l&&Array.isArray(l.handlers)?e.callbacks.copy?.():void 0;t&&(Object.assign(t,{_parentRunId:i.id}),t.handlers?.find(SP)?.updateFromRunTree?.(i),e.callbacks=t),i.extra[s]=e}var l;const u=/* @__PURE__ */new Set;let d=this;for(;null!=d&&!u.has(d.id);)u.add(d.id),d.child_execution_order=Math.max(d.child_execution_order,t),d=d.parent_run;return this.child_runs.push(i),i}async end(e,t,n=Date.now(),r){this.outputs=this.outputs??e,this.error=this.error??t,this.end_time=this.end_time??n,r&&Object.keys(r).length>0&&(this.extra=this.extra?{...this.extra,metadata:{...this.extra.metadata,...r}}:{metadata:r})}_convertToCreate(e,t,n=!0){const r=e.extra??{};if(void 0===r?.runtime?.library&&(r.runtime||(r.runtime={}),t))for(const[o,s]of Object.entries(t))r.runtime[o]||(r.runtime[o]=s);const i=e.parent_run?.id??e.parent_run_id;let a;return a=n?[]:e.child_runs.map(e=>this._convertToCreate(e,t,n)),{id:e.id,name:e.name,start_time:e._serialized_start_time??e.start_time,end_time:e.end_time,run_type:e.run_type,reference_example_id:e.reference_example_id,extra:r,serialized:e.serialized,error:e.error,inputs:e.inputs,outputs:e.outputs,session_name:e.project_name,child_runs:a,parent_run_id:i,trace_id:e.trace_id,dotted_order:e.dotted_order,tags:e.tags,attachments:e.attachments,events:e.events}}_sliceParentId(e,t){if(t.dotted_order){const n=t.dotted_order.split(".");let r=null;for(let t=0;t<n.length;t++){if(n[t].slice(-36)===e){r=t;break}}if(null!==r){const e=n.slice(r+1);t.dotted_order=e.join("."),e.length>0?t.trace_id=e[0].slice(-36):t.trace_id=t.id}}t.parent_run_id===e&&(t.parent_run_id=void 0)}_setReplicaTraceRoot(e,t){const n=hP(this,pP)??{};n[e]=t,function(e,t,n){const r=dP in e?e[dP]:{};r[t]=n,e[dP]=r}(this,pP,n);for(const r of this.child_runs)r._setReplicaTraceRoot(e,t)}_remapForProject(e){const{projectName:t,primary:n,runtimeEnv:r,excludeChildRuns:i=!0,reroot:a=!1,distributedParentId:o,apiUrl:s,apiKey:c,workspaceId:l}=e,u=this._convertToCreate(this,r,i);if(void 0===n&&t===this.project_name)return{...u,session_name:t};if(a){if(o)this._sliceParentId(o,u);else if(u.parent_run_id=void 0,u.dotted_order){const e=u.dotted_order.split(".");e.length>0&&(u.dotted_order=e[e.length-1],u.trace_id=u.id)}const e=fP({projectName:t,apiUrl:s,apiKey:c,workspaceId:l});this._setReplicaTraceRoot(e,u.id)}let d;if(!a){if(d=(hP(this,pP)??{})[fP({projectName:t,apiUrl:s,apiKey:c,workspaceId:l})],d&&(u.trace_id=d,u.dotted_order)){const e=u.dotted_order.split(".");let t=null;for(let n=0;n<e.length;n++){if(e[n].slice(-36)===d){t=n;break}}if(null!==t){const n=e.slice(t);u.dotted_order=n.join(".")}}}if(n)return{...u,session_name:t};const p=iv(u.id,t);let h,f,m;if(h=u.trace_id?iv(u.trace_id,t):p,u.parent_run_id&&(f=iv(u.parent_run_id,t)),u.dotted_order){m=u.dotted_order.split(".").map(e=>{const n=iv(e.slice(-36),t);return e.slice(0,-36)+n}).join(".")}return{...u,id:p,trace_id:h,parent_run_id:f,dotted_order:m,session_name:t}}async postRun(e=!0){this._awaitInputsOnPost&&(this.inputs=await this.inputs);try{const t=kv();if(this.replicas&&this.replicas.length>0)for(const{projectName:e,primary:n,apiKey:r,apiUrl:i,workspaceId:a,reroot:o,client:s}of this.replicas){const c=this._remapForProject({projectName:e??this.project_name,primary:n,runtimeEnv:t,excludeChildRuns:!0,reroot:o,distributedParentId:this.distributedParentId,apiUrl:i,apiKey:r,workspaceId:a}),l=s??this.client;await l.createRun(c,{apiKey:r,apiUrl:i,workspaceId:a})}else{const n=this._convertToCreate(this,t,e);await this.client.createRun(n)}if(!e){fT("Posting with excludeChildRuns=false is deprecated and will be removed in a future version.");for(const e of this.child_runs)await e.postRun(!1)}this.child_runs=[]}catch(t){console.error(`Error in postRun for run ${this.id}:`,t)}}async patchRun(e){const t=e?.excludeInputs??function(){const e=Vv("EXCLUDE_INPUTS_ON_PATCH");return void 0===e||"true"===e.toLowerCase()||"1"===e}();if(this.replicas&&this.replicas.length>0)for(const{projectName:r,primary:i,apiKey:a,apiUrl:o,workspaceId:s,updates:c,reroot:l,client:u}of this.replicas){const e=this._remapForProject({projectName:r??this.project_name,primary:i,runtimeEnv:void 0,excludeChildRuns:!0,reroot:l,distributedParentId:this.distributedParentId,apiUrl:o,apiKey:a,workspaceId:s}),n={id:e.id,name:e.name,run_type:e.run_type,start_time:e.start_time,outputs:e.outputs,error:e.error,parent_run_id:e.parent_run_id,session_name:e.session_name,reference_example_id:e.reference_example_id,end_time:e.end_time,dotted_order:e.dotted_order,trace_id:e.trace_id,events:e.events,tags:e.tags,extra:e.extra,attachments:this.attachments,...c};t||(n.inputs=e.inputs);const d=u??this.client;await d.updateRun(e.id,n,{apiKey:a,apiUrl:o,workspaceId:s})}else try{const e={name:this.name,run_type:this.run_type,start_time:this._serialized_start_time??this.start_time,end_time:this.end_time,error:this.error,outputs:this.outputs,parent_run_id:this.parent_run?.id??this.parent_run_id,reference_example_id:this.reference_example_id,extra:this.extra,events:this.events,dotted_order:this.dotted_order,trace_id:this.trace_id,tags:this.tags,attachments:this.attachments,session_name:this.project_name};t||(e.inputs=this.inputs),await this.client.updateRun(this.id,e)}catch(n){console.error(`Error in patchRun for run ${this.id}`,n)}this.child_runs=[]}toJSON(){return this._convertToCreate(this,void 0,!1)}addEvent(e){this.events||(this.events=[]),"string"==typeof e?this.events.push({name:"event",time:/* @__PURE__ */(new Date).toISOString(),message:e}):this.events.push({...e,time:e.time??/* @__PURE__ */(new Date).toISOString()})}static fromRunnableConfig(e,t){const n=e?.callbacks;let r,i,a,o=!!["TRACING_V2","TRACING"].find(e=>"true"===Vv(e));if(n){const e=n?.getParentRunId?.()??"",t=n?.handlers?.find(e=>"langchain_tracer"==e?.name);r=t?.getRun?.(e),i=t?.projectName,a=t?.client,o=o||!!t}if(!r)return new AP({...t,client:a,tracingEnabled:o,project_name:i});return new AP({name:r.name,id:r.id,trace_id:r.trace_id,dotted_order:r.dotted_order,client:a,tracingEnabled:o,project_name:i,tags:[...new Set((r?.tags??[]).concat(e?.tags??[]))],extra:{metadata:{...r?.extra?.metadata,...e?.metadata}}}).createChild(t)}static fromDottedOrder(e){return this.fromHeaders({"langsmith-trace":e})}static fromHeaders(e,t){const n="get"in e&&"function"==typeof e.get?{"langsmith-trace":e.get("langsmith-trace"),baggage:e.get("baggage")}:e,r=n["langsmith-trace"];if(!r||"string"!=typeof r)return;const i=r.trim(),a=i.split(".").map(e=>{const[t,n]=e.split("Z");return{strTime:t,time:Date.parse(t+"Z"),uuid:n}}),o=a[0].uuid,s={...t,name:t?.name??"parent",run_type:t?.run_type??"chain",start_time:t?.start_time??Date.now(),id:a.at(-1)?.uuid,trace_id:o,dotted_order:i};if(n.baggage&&"string"==typeof n.baggage){const e=CP.fromHeader(n.baggage);s.metadata=e.metadata,s.tags=e.tags,s.project_name=e.project_name,s.replicas=e.replicas}const c=new AP(s);return c.distributedParentId=c.id,c}toHeaders(e){const t={"langsmith-trace":this.dotted_order,baggage:new CP(this.extra?.metadata,this.tags,this.project_name,this.replicas).toHeader()};if(e)for(const[n,r]of Object.entries(t))e.set(n,r);return t}}function SP(e){return"object"==typeof e&&null!=e&&"string"==typeof e.name&&"langchain_tracer"===e.name}function bP(e){return Array.isArray(e)&&e.some(e=>SP(e))}Object.defineProperty(AP,"sharedClient",{enumerable:!0,configurable:!0,writable:!0,value:null});function TP(e,t){if(e)return new AP({...e,start_time:e._serialized_start_time??e.start_time,parent_run:TP(t),child_runs:e.child_runs.map(e=>TP(e)).filter(e=>void 0!==e),extra:{...e.extra,runtime:(void 0===_b&&(_b={library:"langchain-js",runtime:vb()}),_b)},tracingEnabled:!1})}function vP(e,t){return e&&!Array.isArray(e)&&"object"==typeof e?e:{[t]:e}}function _P(e){return"function"==typeof e._addRunToRunMap}var wP=class extends xb{runMap=/* @__PURE__ */new Map;runTreeMap=/* @__PURE__ */new Map;usesRunTreeMap=!1;constructor(e){super(...arguments)}copy(){return this}getRunById(e){if(void 0!==e)return this.usesRunTreeMap?(e=>{if(e)return e.events=e.events??[],e.child_runs=e.child_runs??[],e})(this.runTreeMap.get(e)):this.runMap.get(e)}stringifyError(e){return e instanceof Error?e.message+(e?.stack?`\n\n${e.stack}`:""):"string"==typeof e?e:`${e}`}_addChildRun(e,t){e.child_runs.push(t)}_addRunToRunMap(e){const{dottedOrder:t,microsecondPrecisionDatestring:n}=gP(new Date(e.start_time).getTime(),e.id,e.execution_order),r={...e},i=this.getRunById(r.parent_run_id);if(void 0!==r.parent_run_id?i?(this._addChildRun(i,r),i.child_execution_order=Math.max(i.child_execution_order,r.child_execution_order),r.trace_id=i.trace_id,void 0!==i.dotted_order&&(r.dotted_order=[i.dotted_order,t].join("."),r._serialized_start_time=n)):r.parent_run_id=void 0:(r.trace_id=r.id,r.dotted_order=t,r._serialized_start_time=n),this.usesRunTreeMap){const e=TP(r,i);void 0!==e&&this.runTreeMap.set(r.id,e)}else this.runMap.set(r.id,r);return r}async _endTrace(e){const t=void 0!==e.parent_run_id&&this.getRunById(e.parent_run_id);t?t.child_execution_order=Math.max(t.child_execution_order,e.child_execution_order):await this.persistRun(e),await(this.onRunUpdate?.(e)),this.usesRunTreeMap?this.runTreeMap.delete(e.id):this.runMap.delete(e.id)}_getExecutionOrder(e){const t=void 0!==e&&this.getRunById(e);return t?t.child_execution_order+1:1}_createRunForLLMStart(e,t,n,r,i,a,o,s){const c=this._getExecutionOrder(r),l=Date.now(),u=o?{...i,metadata:o}:i,d={id:n,name:s??e.id[e.id.length-1],parent_run_id:r,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{prompts:t},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:u??{},tags:a||[]};return this._addRunToRunMap(d)}async handleLLMStart(e,t,n,r,i,a,o,s){const c=this.getRunById(n)??this._createRunForLLMStart(e,t,n,r,i,a,o,s);return await(this.onRunCreate?.(c)),await(this.onLLMStart?.(c)),c}_createRunForChatModelStart(e,t,n,r,i,a,o,s){const c=this._getExecutionOrder(r),l=Date.now(),u=o?{...i,metadata:o}:i,d={id:n,name:s??e.id[e.id.length-1],parent_run_id:r,start_time:l,serialized:e,events:[{name:"start",time:new Date(l).toISOString()}],inputs:{messages:t},execution_order:c,child_runs:[],child_execution_order:c,run_type:"llm",extra:u??{},tags:a||[]};return this._addRunToRunMap(d)}async handleChatModelStart(e,t,n,r,i,a,o,s){const c=this.getRunById(n)??this._createRunForChatModelStart(e,t,n,r,i,a,o,s);return await(this.onRunCreate?.(c)),await(this.onLLMStart?.(c)),c}async handleLLMEnd(e,t,n,r,i){const a=this.getRunById(t);if(!a||"llm"!==a?.run_type)throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.outputs=e,a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await(this.onLLMEnd?.(a)),await this._endTrace(a),a}async handleLLMError(e,t,n,r,i){const a=this.getRunById(t);if(!a||"llm"!==a?.run_type)throw new Error("No LLM run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),a.extra={...a.extra,...i},await(this.onLLMError?.(a)),await this._endTrace(a),a}_createRunForChainStart(e,t,n,r,i,a,o,s,c){const l=this._getExecutionOrder(r),u=Date.now(),d={id:n,name:s??e.id[e.id.length-1],parent_run_id:r,start_time:u,serialized:e,events:[{name:"start",time:new Date(u).toISOString()}],inputs:t,execution_order:l,child_execution_order:l,run_type:o??"chain",child_runs:[],extra:a?{...c,metadata:a}:{...c},tags:i||[]};return this._addRunToRunMap(d)}async handleChainStart(e,t,n,r,i,a,o,s){const c=this.getRunById(n)??this._createRunForChainStart(e,t,n,r,i,a,o,s);return await(this.onRunCreate?.(c)),await(this.onChainStart?.(c)),c}async handleChainEnd(e,t,n,r,i){const a=this.getRunById(t);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.outputs=vP(e,"output"),a.events.push({name:"end",time:new Date(a.end_time).toISOString()}),void 0!==i?.inputs&&(a.inputs=vP(i.inputs,"input")),await(this.onChainEnd?.(a)),await this._endTrace(a),a}async handleChainError(e,t,n,r,i){const a=this.getRunById(t);if(!a)throw new Error("No chain run to end.");return a.end_time=Date.now(),a.error=this.stringifyError(e),a.events.push({name:"error",time:new Date(a.end_time).toISOString()}),void 0!==i?.inputs&&(a.inputs=vP(i.inputs,"input")),await(this.onChainError?.(a)),await this._endTrace(a),a}_createRunForToolStart(e,t,n,r,i,a,o){const s=this._getExecutionOrder(r),c=Date.now(),l={id:n,name:o??e.id[e.id.length-1],parent_run_id:r,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{input:t},execution_order:s,child_execution_order:s,run_type:"tool",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(l)}async handleToolStart(e,t,n,r,i,a,o){const s=this.getRunById(n)??this._createRunForToolStart(e,t,n,r,i,a,o);return await(this.onRunCreate?.(s)),await(this.onToolStart?.(s)),s}async handleToolEnd(e,t){const n=this.getRunById(t);if(!n||"tool"!==n?.run_type)throw new Error("No tool run to end");return n.end_time=Date.now(),n.outputs={output:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await(this.onToolEnd?.(n)),await this._endTrace(n),n}async handleToolError(e,t){const n=this.getRunById(t);if(!n||"tool"!==n?.run_type)throw new Error("No tool run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await(this.onToolError?.(n)),await this._endTrace(n),n}async handleAgentAction(e,t){const n=this.getRunById(t);if(!n||"chain"!==n?.run_type)return;const r=n;r.actions=r.actions||[],r.actions.push(e),r.events.push({name:"agent_action",time:/* @__PURE__ */(new Date).toISOString(),kwargs:{action:e}}),await(this.onAgentAction?.(n))}async handleAgentEnd(e,t){const n=this.getRunById(t);n&&"chain"===n?.run_type&&(n.events.push({name:"agent_end",time:/* @__PURE__ */(new Date).toISOString(),kwargs:{action:e}}),await(this.onAgentEnd?.(n)))}_createRunForRetrieverStart(e,t,n,r,i,a,o){const s=this._getExecutionOrder(r),c=Date.now(),l={id:n,name:o??e.id[e.id.length-1],parent_run_id:r,start_time:c,serialized:e,events:[{name:"start",time:new Date(c).toISOString()}],inputs:{query:t},execution_order:s,child_execution_order:s,run_type:"retriever",child_runs:[],extra:a?{metadata:a}:{},tags:i||[]};return this._addRunToRunMap(l)}async handleRetrieverStart(e,t,n,r,i,a,o){const s=this.getRunById(n)??this._createRunForRetrieverStart(e,t,n,r,i,a,o);return await(this.onRunCreate?.(s)),await(this.onRetrieverStart?.(s)),s}async handleRetrieverEnd(e,t){const n=this.getRunById(t);if(!n||"retriever"!==n?.run_type)throw new Error("No retriever run to end");return n.end_time=Date.now(),n.outputs={documents:e},n.events.push({name:"end",time:new Date(n.end_time).toISOString()}),await(this.onRetrieverEnd?.(n)),await this._endTrace(n),n}async handleRetrieverError(e,t){const n=this.getRunById(t);if(!n||"retriever"!==n?.run_type)throw new Error("No retriever run to end");return n.end_time=Date.now(),n.error=this.stringifyError(e),n.events.push({name:"error",time:new Date(n.end_time).toISOString()}),await(this.onRetrieverError?.(n)),await this._endTrace(n),n}async handleText(e,t){const n=this.getRunById(t);n&&"chain"===n?.run_type&&(n.events.push({name:"text",time:/* @__PURE__ */(new Date).toISOString(),kwargs:{text:e}}),await(this.onText?.(n)))}async handleLLMNewToken(e,t,n,r,i,a){const o=this.getRunById(n);if(!o||"llm"!==o?.run_type)throw new Error('Invalid "runId" provided to "handleLLMNewToken" callback.');return o.events.push({name:"new_token",time:/* @__PURE__ */(new Date).toISOString(),kwargs:{token:e,idx:t,chunk:a?.chunk}}),await(this.onLLMNewToken?.(o,e,{chunk:a?.chunk})),o}};const EP={bold:{open:"",close:""},color:{grey:{open:"",close:""},green:{open:"",close:""},cyan:{open:"",close:""},red:{open:"",close:""},blue:{open:"",close:""}}};function PP(e,t){return`${e.open}${t}${e.close}`}function RP(e,t){try{return JSON.stringify(e,null,2)}catch{return t}}function LP(e){return"string"==typeof e?e.trim():null==e?e:RP(e,e.toString())}function NP(e){if(!e.end_time)return"";const t=e.end_time-e.start_time;return t<1e3?`${t}ms`:`${(t/1e3).toFixed(2)}s`}const{color:OP}=EP;var BP=class extends wP{name="console_callback_handler";persistRun(e){return Promise.resolve()}getParents(e){const t=[];let n=e;for(;n.parent_run_id;){const e=this.runMap.get(n.parent_run_id);if(!e)break;t.push(e),n=e}return t}getBreadcrumbs(e){const t=[...this.getParents(e).reverse(),e].map((e,t,n)=>{const r=`${e.execution_order}:${e.run_type}:${e.name}`;return t===n.length-1?PP(EP.bold,r):r}).join(" > ");return PP(OP.grey,t)}onChainStart(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.green,"[chain/start]")} [${t}] Entering Chain run with input: ${RP(e.inputs,"[inputs]")}`)}onChainEnd(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.cyan,"[chain/end]")} [${t}] [${NP(e)}] Exiting Chain run with output: ${RP(e.outputs,"[outputs]")}`)}onChainError(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.red,"[chain/error]")} [${t}] [${NP(e)}] Chain run errored with error: ${RP(e.error,"[error]")}`)}onLLMStart(e){const t=this.getBreadcrumbs(e),n="prompts"in e.inputs?{prompts:e.inputs.prompts.map(e=>e.trim())}:e.inputs;console.log(`${PP(OP.green,"[llm/start]")} [${t}] Entering LLM run with input: ${RP(n,"[inputs]")}`)}onLLMEnd(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.cyan,"[llm/end]")} [${t}] [${NP(e)}] Exiting LLM run with output: ${RP(e.outputs,"[response]")}`)}onLLMError(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.red,"[llm/error]")} [${t}] [${NP(e)}] LLM run errored with error: ${RP(e.error,"[error]")}`)}onToolStart(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.green,"[tool/start]")} [${t}] Entering Tool run with input: "${LP(e.inputs.input)}"`)}onToolEnd(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.cyan,"[tool/end]")} [${t}] [${NP(e)}] Exiting Tool run with output: "${LP(e.outputs?.output)}"`)}onToolError(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.red,"[tool/error]")} [${t}] [${NP(e)}] Tool run errored with error: ${RP(e.error,"[error]")}`)}onRetrieverStart(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.green,"[retriever/start]")} [${t}] Entering Retriever run with input: ${RP(e.inputs,"[inputs]")}`)}onRetrieverEnd(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.cyan,"[retriever/end]")} [${t}] [${NP(e)}] Exiting Retriever run with output: ${RP(e.outputs,"[outputs]")}`)}onRetrieverError(e){const t=this.getBreadcrumbs(e);console.log(`${PP(OP.red,"[retriever/error]")} [${t}] [${NP(e)}] Retriever run errored with error: ${RP(e.error,"[error]")}`)}onAgentAction(e){const t=e,n=this.getBreadcrumbs(e);console.log(`${PP(OP.blue,"[agent/action]")} [${n}] Agent selected action: ${RP(t.actions[t.actions.length-1],"[action]")}`)}};let MP;const DP=/* @__PURE__ */new Set(["ls_agent_type"]);var FP=class e extends wP{fields;name="langchain_tracer";projectName;exampleId;client;replicas;usesRunTreeMap=!0;tracingMetadata;tracingTags=[];constructor(t={}){super(t),this.fields=t;const{exampleId:n,projectName:r,client:i,replicas:a,metadata:o,tags:s}=t;this.projectName=r??pT(),this.replicas=a,this.exampleId=n,this.client=i??(()=>{if(void 0===MP){const e="false"===wb("LANGCHAIN_CALLBACKS_BACKGROUND")?{blockOnRootRunFinalization:!0}:{};MP=new lP(e)}return MP})(),this.tracingMetadata=o?{...o}:void 0,this.tracingTags=s??[];const c=e.getTraceableRunTree();c&&this.updateFromRunTree(c)}async persistRun(e){}async onRunCreate(e){kP(this,e),e.extra?.lc_defers_inputs||await(this.getRunTreeWithTracingConfig(e.id)?.postRun())}async onRunUpdate(e){kP(this,e);const t=this.getRunTreeWithTracingConfig(e.id);e.extra?.lc_defers_inputs?await(t?.postRun()):await(t?.patchRun())}onLLMEnd(e){const t=e.outputs;if(t?.generations){const n=function(e){let t;for(const n of e)for(const e of n)ab.isInstance(e.message)&&void 0!==e.message.usage_metadata&&(t=PS(t,e.message.usage_metadata));return t}(t.generations);if(void 0!==n){e.extra=e.extra??{};const t=e.extra.metadata??{};t.usage_metadata=n,e.extra.metadata=t}}}copyWithTracingConfig({metadata:t,tags:n}){let r;if(void 0===t)r=this.tracingMetadata?{...this.tracingMetadata}:void 0;else if(void 0===this.tracingMetadata)r={...t};else{r={...this.tracingMetadata};for(const[e,n]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,e)&&!DP.has(e)||(r[e]=n)}const i=n?Array.from(/* @__PURE__ */new Set([...this.tracingTags,...n])):[...this.tracingTags],a=new e({...this.fields,metadata:r,tags:i});return a.runMap=this.runMap,a.runTreeMap=this.runTreeMap,a}_getRunStoreKey(){return this.runTreeMap}getRun(e){return this.runTreeMap.get(e)}updateFromRunTree(e){this.runTreeMap.set(e.id,e);let t=e;const n=/* @__PURE__ */new Set;for(;t.parent_run&&!n.has(t.id)&&(n.add(t.id),t.parent_run);)t=t.parent_run;n.clear();const r=[t];for(;r.length>0;){const e=r.shift();e&&!n.has(e.id)&&(n.add(e.id),this.runTreeMap.set(e.id,e),e.child_runs&&r.push(...e.child_runs))}this.client=e.client??this.client,this.replicas=e.replicas??this.replicas,this.projectName=e.project_name??this.projectName,this.exampleId=e.reference_example_id??this.exampleId,this.fields={...this.fields,client:this.client,replicas:this.replicas,projectName:this.projectName,exampleId:this.exampleId}}getRunTreeWithTracingConfig(e){const t=this.runTreeMap.get(e);if(t)return new AP({...t,client:this.client,project_name:this.projectName,replicas:this.replicas,reference_example_id:this.exampleId,tracingEnabled:!0})}static getTraceableRunTree(){try{return function(e=!1){const t=sv.getInstance().getStore();if(!e&&void 0===t)throw new Error("Could not get the current run tree.\n\nPlease make sure you are calling this method within a traceable function and that tracing is enabled.");return t}(!0)}catch{return}}static[Symbol.hasInstance](e){if("object"!=typeof e||null===e)return!1;const t=e;return"name"in t&&"langchain_tracer"===t.name&&"copyWithTracingConfig"in t&&"function"==typeof t.copyWithTracingConfig&&"getRunTreeWithTracingConfig"in t&&"function"==typeof t.getRunTreeWithTracingConfig}};function kP(e,t){if(e.tracingMetadata){t.extra??={};const n=t.extra.metadata??{};let r=!1;for(const[t,i]of Object.entries(e.tracingMetadata))Object.prototype.hasOwnProperty.call(n,t)&&!DP.has(t)||n[t]!==i&&(n[t]=i,r=!0);r&&(t.extra.metadata=n)}e.tracingTags.length>0&&(t.tags=Array.from(/* @__PURE__ */new Set([...t.tags??[],...e.tracingTags])))}const GP=/* @__PURE__ */Symbol.for("ls:tracing_async_local_storage"),HP=/* @__PURE__ */Symbol.for("lc:context_variables"),xP=()=>globalThis[GP];let UP;function VP(){return void 0===UP&&(UP=new("default"in w_?w_.default:w_)({autoStart:!0,concurrency:1})),UP}async function $P(e,t){if(!0===t){const t=xP();void 0!==t?await t.run(void 0,async()=>e()):await e()}else UP=VP(),UP.add(async()=>{const t=xP();void 0!==t?await t.run(void 0,async()=>e()):await e()})}function jP(e){const t=xP();if(void 0!==t)return t.getStore()?.[HP]?.[e]}const WP=/* @__PURE__ */Symbol("lc:configure_hooks");function XP(e){return e._getRunStoreKey?.()??e}var KP=class{setHandler(e){return this.setHandlers([e])}},YP=class{runId;handlers;inheritableHandlers;tags;inheritableTags;metadata;inheritableMetadata;_parentRunId;constructor(e,t,n,r,i,a,o,s){this.runId=e,this.handlers=t,this.inheritableHandlers=n,this.tags=r,this.inheritableTags=i,this.metadata=a,this.inheritableMetadata=o,this._parentRunId=s}get parentRunId(){return this._parentRunId}async handleText(e){await Promise.all(this.handlers.map(t=>$P(async()=>{try{await(t.handleText?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleText: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleCustomEvent(e,t,n,r,i){await Promise.all(this.handlers.map(n=>$P(async()=>{try{await(n.handleCustomEvent?.(e,t,this.runId,this.tags,this.metadata))}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleCustomEvent: ${r}`),n.raiseError)throw r}},n.awaitHandlers)))}},qP=class extends YP{getChild(e){const t=new ZP(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleRetrieverEnd(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreRetriever)try{await(t.handleRetrieverEnd?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleRetriever`),t.raiseError)throw n}},t.awaitHandlers)))}async handleRetrieverError(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreRetriever)try{await(t.handleRetrieverError?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleRetrieverError: ${n}`),t.raiseError)throw e}},t.awaitHandlers)))}},QP=class extends YP{async handleLLMNewToken(e,t,n,r,i,a){await Promise.all(this.handlers.map(n=>$P(async()=>{if(!n.ignoreLLM)try{await(n.handleLLMNewToken?.(e,t??{prompt:0,completion:0},this.runId,this._parentRunId,this.tags,a))}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleLLMNewToken: ${r}`),n.raiseError)throw r}},n.awaitHandlers)))}async handleChatModelStreamEvent(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreLLM)try{await(t.handleChatModelStreamEvent?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChatModelStreamEvent: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleLLMError(e,t,n,r,i){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreLLM)try{await(t.handleLLMError?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleLLMError: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleLLMEnd(e,t,n,r,i){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreLLM)try{await(t.handleLLMEnd?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleLLMEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}},JP=class extends YP{getChild(e){const t=new ZP(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleChainError(e,t,n,r,i){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreChain)try{await(t.handleChainError?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChainError: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleChainEnd(e,t,n,r,i){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreChain)try{await(t.handleChainEnd?.(e,this.runId,this._parentRunId,this.tags,i))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleChainEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleAgentAction(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreAgent)try{await(t.handleAgentAction?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleAgentAction: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleAgentEnd(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreAgent)try{await(t.handleAgentEnd?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleAgentEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}},zP=class extends YP{getChild(e){const t=new ZP(this.runId);return t.setHandlers(this.inheritableHandlers),t.addTags(this.inheritableTags),t.addMetadata(this.inheritableMetadata),e&&t.addTags([e],!1),t}async handleToolError(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreAgent)try{await(t.handleToolError?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleToolError: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}async handleToolEvent(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreAgent)try{await(t.handleToolEvent?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if(t.raiseError)throw n}},t.awaitHandlers)))}async handleToolEnd(e){await Promise.all(this.handlers.map(t=>$P(async()=>{if(!t.ignoreAgent)try{await(t.handleToolEnd?.(e,this.runId,this._parentRunId,this.tags))}catch(n){if((t.raiseError?console.error:console.warn)(`Error in handler ${t.constructor.name}, handleToolEnd: ${n}`),t.raiseError)throw n}},t.awaitHandlers)))}},ZP=class e extends KP{handlers=[];inheritableHandlers=[];tags=[];inheritableTags=[];metadata={};inheritableMetadata={};name="callback_manager";_parentRunId;constructor(e,t){super(),this.handlers=t?.handlers??this.handlers,this.inheritableHandlers=t?.inheritableHandlers??this.inheritableHandlers,this.tags=t?.tags??this.tags,this.inheritableTags=t?.inheritableTags??this.inheritableTags,this.metadata=t?.metadata??this.metadata,this.inheritableMetadata=t?.inheritableMetadata??this.inheritableMetadata,this._parentRunId=e}getParentRunId(){return this._parentRunId}async handleLLMStart(e,t,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0){return Promise.all(t.map(async(t,r)=>{const a=0===r&&n?n:Db();return await Promise.all(this.handlers.map(n=>{if(!n.ignoreLLM)return _P(n)&&n._createRunForLLMStart(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s),$P(async()=>{try{await(n.handleLLMStart?.(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s))}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleLLMStart: ${r}`),n.raiseError)throw r}},n.awaitHandlers)})),new QP(a,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChatModelStart(e,t,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,s=void 0){return Promise.all(t.map(async(t,r)=>{const a=0===r&&n?n:Db();return await Promise.all(this.handlers.map(n=>{if(!n.ignoreLLM)return _P(n)&&n._createRunForChatModelStart(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s),$P(async()=>{try{if(n.handleChatModelStart)await(n.handleChatModelStart?.(e,[t],a,this._parentRunId,i,this.tags,this.metadata,s));else if(n.handleLLMStart){const r=nb(t);await(n.handleLLMStart?.(e,[r],a,this._parentRunId,i,this.tags,this.metadata,s))}}catch(r){if((n.raiseError?console.error:console.warn)(`Error in handler ${n.constructor.name}, handleLLMStart: ${r}`),n.raiseError)throw r}},n.awaitHandlers)})),new QP(a,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}))}async handleChainStart(e,t,n=Db(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0,c=void 0){return await Promise.all(this.handlers.map(i=>{if(!i.ignoreChain)return _P(i)&&i._createRunForChainStart(e,t,n,this._parentRunId,this.tags,this.metadata,r,o,c),$P(async()=>{try{await(i.handleChainStart?.(e,t,n,this._parentRunId,this.tags,this.metadata,r,o,c))}catch(a){if((i.raiseError?console.error:console.warn)(`Error in handler ${i.constructor.name}, handleChainStart: ${a}`),i.raiseError)throw a}},i.awaitHandlers)})),new JP(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleToolStart(e,t,n=Db(),r=void 0,i=void 0,a=void 0,o=void 0,s=void 0){return await Promise.all(this.handlers.map(r=>{if(!r.ignoreAgent)return _P(r)&&r._createRunForToolStart(e,t,n,this._parentRunId,this.tags,this.metadata,o),$P(async()=>{try{await(r.handleToolStart?.(e,t,n,this._parentRunId,this.tags,this.metadata,o,s))}catch(i){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleToolStart: ${i}`),r.raiseError)throw i}},r.awaitHandlers)})),new zP(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleRetrieverStart(e,t,n=Db(),r=void 0,i=void 0,a=void 0,o=void 0){return await Promise.all(this.handlers.map(r=>{if(!r.ignoreRetriever)return _P(r)&&r._createRunForRetrieverStart(e,t,n,this._parentRunId,this.tags,this.metadata,o),$P(async()=>{try{await(r.handleRetrieverStart?.(e,t,n,this._parentRunId,this.tags,this.metadata,o))}catch(i){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleRetrieverStart: ${i}`),r.raiseError)throw i}},r.awaitHandlers)})),new qP(n,this.handlers,this.inheritableHandlers,this.tags,this.inheritableTags,this.metadata,this.inheritableMetadata,this._parentRunId)}async handleCustomEvent(e,t,n,r,i){await Promise.all(this.handlers.map(r=>$P(async()=>{if(!r.ignoreCustomEvent)try{await(r.handleCustomEvent?.(e,t,n,this.tags,this.metadata))}catch(i){if((r.raiseError?console.error:console.warn)(`Error in handler ${r.constructor.name}, handleCustomEvent: ${i}`),r.raiseError)throw i}},r.awaitHandlers)))}addHandler(e,t=!0){this.handlers.push(e),t&&this.inheritableHandlers.push(e)}removeHandler(e){this.handlers=this.handlers.filter(t=>t!==e),this.inheritableHandlers=this.inheritableHandlers.filter(t=>t!==e)}setHandlers(e,t=!0){this.handlers=[],this.inheritableHandlers=[];for(const n of e)this.addHandler(n,t)}addTags(e,t=!0){this.removeTags(e),this.tags.push(...e),t&&this.inheritableTags.push(...e)}removeTags(e){this.tags=this.tags.filter(t=>!e.includes(t)),this.inheritableTags=this.inheritableTags.filter(t=>!e.includes(t))}addMetadata(e,t=!0){this.metadata={...this.metadata,...e},t&&(this.inheritableMetadata={...this.inheritableMetadata,...e})}removeMetadata(e){for(const t of Object.keys(e))delete this.metadata[t],delete this.inheritableMetadata[t]}copy(t=[],n=!0){const r=new e(this._parentRunId);for(const e of this.handlers){const t=this.inheritableHandlers.includes(e);r.addHandler(e,t)}for(const e of this.tags){const t=this.inheritableTags.includes(e);r.addTags([e],t)}for(const e of Object.keys(this.metadata)){const t=Object.keys(this.inheritableMetadata).includes(e);r.addMetadata({[e]:this.metadata[e]},t)}for(const e of t)r.handlers.filter(e=>"console_callback_handler"===e.name).some(t=>t.name===e.name)||r.addHandler(e,n);return r}static fromHandlers(e){const t=new this;return t.addHandler(new class extends xb{name=Db();constructor(){super(),Object.assign(this,e)}}),t}static configure(e,t,n,r,i,a,o){return this._configureSync(e,t,n,r,i,a,o)}static _configureSync(t,n,r,i,a,o,s){let c;(t||n)&&(Array.isArray(t)||!t?(c=new e,c.setHandlers(t?.map(eR)??[],!0)):c=t,c=c.copy(Array.isArray(n)?n.map(eR):n?.handlers,!1));const l="true"===wb("LANGCHAIN_VERBOSE")||s?.verbose,u=FP.getTraceableRunTree(),d=u?.tracingEnabled??!!["LANGSMITH_TRACING_V2","LANGCHAIN_TRACING_V2","LANGSMITH_TRACING","LANGCHAIN_TRACING"].find(e=>"true"===wb(e));if(!1===u?.tracingEnabled&&c){const e=c.handlers.filter(e=>"langchain_tracer"===e.name);for(const t of e)c.removeHandler(t)}const p=d||(wb("LANGCHAIN_TRACING")??!1);if(l||p){if(c||(c=new e),l&&!c.handlers.some(e=>e.name===BP.prototype.name)){const e=new BP;c.addHandler(e,!0)}if(p&&!c.handlers.some(e=>"langchain_tracer"===e.name)&&d){const e=new FP;c.addHandler(e,!0)}d&&u&&void 0===c._parentRunId&&(c._parentRunId=u.id,c.handlers.find(e=>"langchain_tracer"===e.name)?.updateFromRunTree(u))}for(const{contextVar:m,inheritable:g=!0,handlerClass:y,envVar:I}of jP(WP)||[]){const t=I&&"true"===wb(I)&&y;let n;const r=void 0!==m?jP(m):void 0;r&&Ub(r)?n=r:t&&(n=new y({})),void 0!==n&&(c||(c=new e),c.handlers.some(e=>e.name===n.name)||c.addHandler(n,g))}(r||i)&&c&&(c.addTags(r??[]),c.addTags(i??[],!1)),(a||o)&&c&&(c.addMetadata(a??{}),c.addMetadata(o??{},!1));const h=s?.tracerInheritableMetadata,f=s?.tracerInheritableTags;if(c&&(h||f)){const e=/* @__PURE__ */new Map,t=t=>{if(!(t instanceof FP))return t;const n=e.get(t);if(void 0!==n)return n;const r=t.copyWithTracingConfig({metadata:h,tags:f});return e.set(t,r),r};c.handlers=c.handlers.map(t),c.inheritableHandlers=c.inheritableHandlers.map(t)}if(c){const e=function(e,t){const n=new Set(t),r=/* @__PURE__ */new Map,i=[],a=e=>{const t=XP(e),a=n.has(e),o=r.get(t);if(void 0===o)return r.set(t,{index:i.length,tracer:e,hasInheritable:a}),void i.push(e);var s,c;a&&!o.hasInheritable?(o.tracer=e,o.hasInheritable=!0):!a&&o.hasInheritable||(o.tracer=(s=o.tracer)===(c=e)?s:s.copyWithTracingConfig({metadata:c.tracingMetadata,tags:c.tracingTags})),i[o.index]=o.tracer};for(const s of e)s instanceof FP?a(s):i.push(s);for(const s of t)s instanceof FP&&!r.has(XP(s))&&a(s);const o=/* @__PURE__ */new Set;return{handlers:i,inheritableHandlers:t.flatMap(e=>{if(!(e instanceof FP))return[e];const t=XP(e);return o.has(t)?[]:(o.add(t),[r.get(t)?.tracer??e])})}}(c.handlers,c.inheritableHandlers);c.handlers=e.handlers,c.inheritableHandlers=e.inheritableHandlers}return c}};function eR(e){return"name"in e?e:xb.fromMethods(e)}const tR=new class{getStore(){}run(e,t){return t()}enterWith(e){}},nR=/* @__PURE__ */Symbol.for("lc:child_config");const rR=new class{getInstance(){return xP()??tR}getRunnableConfig(){return this.getInstance().getStore()?.extra?.[nR]}runWithConfig(e,t,n){const r=ZP._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata),i=this.getInstance(),a=i.getStore(),o=r?.getParentRunId(),s=r?.handlers?.find(e=>"langchain_tracer"===e?.name);let c;return s&&o?c=s.getRunTreeWithTracingConfig(o):n||(c=new AP({name:"<runnable_lambda>",tracingEnabled:!1})),c&&(c.extra={...c.extra,[nR]:e}),void 0!==a&&void 0!==a[HP]&&(void 0===c&&(c={}),c[HP]=a[HP]),i.run(c,t)}initializeGlobalInstance(e){void 0===xP()&&(e=>{globalThis[GP]=e})(e)}},iR=/* @__PURE__ */new Set(["api_key"]),aR=/* @__PURE__ */new Set(["string","number","boolean"]);function oR(e){const t=e.configurable??{},n=e.metadata??{},r={};for(const[i,a]of Object.entries(t))i.startsWith("__")||Object.prototype.hasOwnProperty.call(n,i)||iR.has(i)||!aR.has(typeof a)||(r[i]=a);return Object.keys(r).length>0?r:void 0}async function sR(e){return ZP._configureSync(e?.callbacks,void 0,e?.tags,void 0,e?.metadata,void 0,{tracerInheritableMetadata:e?oR(e):void 0})}function cR(...e){const t={};for(const n of e.filter(e=>!!e))for(const e of Object.keys(n))if("metadata"===e)t[e]={...t[e],...n[e]};else if("tags"===e){const r=t[e]??[];t[e]=[...new Set(r.concat(n[e]??[]))]}else if("configurable"===e)t[e]={...t[e],...n[e]};else if("timeout"===e)void 0===t.timeout?t.timeout=n.timeout:void 0!==n.timeout&&(t.timeout=Math.min(t.timeout,n.timeout));else if("signal"===e)void 0===t.signal?t.signal=n.signal:void 0!==n.signal&&("any"in AbortSignal?t.signal=AbortSignal.any([t.signal,n.signal]):t.signal=n.signal);else if("callbacks"===e){const e=t.callbacks,r=n.callbacks;if(Array.isArray(r))if(e)if(Array.isArray(e))t.callbacks=e.concat(r);else{const n=e.copy();for(const e of r)n.addHandler(eR(e),!0);t.callbacks=n}else t.callbacks=r;else if(r)if(e)if(Array.isArray(e)){const n=r.copy();for(const t of e)n.addHandler(eR(t),!0);t.callbacks=n}else t.callbacks=new ZP(r._parentRunId,{handlers:e.handlers.concat(r.handlers),inheritableHandlers:e.inheritableHandlers.concat(r.inheritableHandlers),tags:Array.from(new Set(e.tags.concat(r.tags))),inheritableTags:Array.from(new Set(e.inheritableTags.concat(r.inheritableTags))),metadata:{...e.metadata,...r.metadata}});else t.callbacks=r}else{const r=e;t[r]=n[r]??t[r]}return t}function lR(e){const t=rR.getRunnableConfig();let n={tags:[],metadata:{},recursionLimit:25,runId:void 0};if(t){const{runId:e,runName:r,...i}=t;n=Object.entries(i).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),n)}if(e&&(n=Object.entries(e).reduce((e,[t,n])=>(void 0!==n&&(e[t]=n),e),n)),n?.configurable&&"string"==typeof n.configurable.model&&void 0===n.metadata?.model&&(n.metadata||(n.metadata={}),n.metadata.model=n.configurable.model),void 0!==n.timeout){if(n.timeout<=0)throw new Error("Timeout must be a positive number");const e=n.timeout,t=AbortSignal.timeout(e);n.metadata||(n.metadata={}),void 0===n.metadata.timeoutMs&&(n.metadata.timeoutMs=e),void 0!==n.signal?"any"in AbortSignal&&(n.signal=AbortSignal.any([n.signal,t])):n.signal=t,delete n.timeout}return n}function uR(e={},{callbacks:t,maxConcurrency:n,recursionLimit:r,runName:i,configurable:a,runId:o}={}){const s=lR(e);return void 0!==t&&(delete s.runName,s.callbacks=t),void 0!==r&&(s.recursionLimit=r),void 0!==n&&(s.maxConcurrency=n),void 0!==i&&(s.runName=i),void 0!==a&&(s.configurable={...s.configurable,...a}),void 0!==o&&delete s.runId,s}function dR(e){if(e)return{configurable:e.configurable,recursionLimit:e.recursionLimit,callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,maxConcurrency:e.maxConcurrency,timeout:e.timeout,signal:e.signal,store:e.store}}async function pR(e,t){if(void 0===t)return e;let n;return Promise.race([e.catch(e=>{if(!t?.aborted)throw e}),new Promise((e,r)=>{n=()=>{r(hR(t))},t.addEventListener("abort",n,{once:!0}),t.aborted&&r(hR(t))})]).finally(()=>t.removeEventListener("abort",n))}function hR(e){return e?.reason instanceof Error?e.reason:"string"==typeof e?.reason?new Error(e.reason):/* @__PURE__ */new Error("Aborted")}var fR=class e extends ReadableStream{reader;ensureReader(){this.reader||(this.reader=this.getReader())}async next(){this.ensureReader();try{const e=await this.reader.read();return e.done?(this.reader.releaseLock(),{done:!0,value:void 0}):{done:!1,value:e.value}}catch(e){throw this.reader.releaseLock(),e}}async return(){if(this.ensureReader(),this.locked){const e=this.reader.cancel();this.reader.releaseLock(),await e}return{done:!0,value:void 0}}async throw(e){if(this.ensureReader(),this.locked){const e=this.reader.cancel();this.reader.releaseLock(),await e}throw e}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}static fromReadableStream(t){const n=t.getReader();return new e({start:e=>function t(){return n.read().then(({done:n,value:r})=>{if(!n)return e.enqueue(r),t();e.close()})}(),cancel(){n.releaseLock()}})}static fromAsyncGenerator(t){return new e({async pull(e){const{value:n,done:r}=await t.next();r&&e.close(),e.enqueue(n)},async cancel(e){await t.return(e)}})}};function mR(e,t=2){const n=Array.from({length:t},()=>[]);return n.map(async function*(t){for(;;)if(0===t.length){const t=await e.next();for(const e of n)e.push(t)}else{if(t[0].done)return;yield t.shift().value}})}function gR(e,t){if(Array.isArray(e)&&Array.isArray(t))return e.concat(t);if("string"==typeof e&&"string"==typeof t)return e+t;if("number"==typeof e&&"number"==typeof t)return e+t;if("concat"in e&&"function"==typeof e.concat)return e.concat(t);if("object"==typeof e&&"object"==typeof t){const n={...e};for(const[e,r]of Object.entries(t))e in n&&!Array.isArray(n[e])?n[e]=gR(n[e],r):n[e]=r;return n}throw new Error(`Cannot concat ${typeof e} and ${typeof t}`)}var yR=class{generator;setup;config;signal;firstResult;firstResultUsed=!1;constructor(e){this.generator=e.generator,this.config=e.config,this.signal=e.signal??this.config?.signal,this.setup=new Promise((t,n)=>{rR.runWithConfig(dR(e.config),async()=>{this.firstResult=this.signal?pR(e.generator.next(),this.signal):e.generator.next(),e.startSetup?this.firstResult.then(e.startSetup).then(t,n):this.firstResult.then(e=>t(void 0),n)},!0)})}async next(...e){return this.signal?.throwIfAborted(),this.firstResultUsed?rR.runWithConfig(dR(this.config),this.signal?async()=>pR(this.generator.next(...e),this.signal):async()=>this.generator.next(...e),!0):(this.firstResultUsed=!0,this.firstResult)}async return(e){return this.generator.return(e)}async throw(e){return this.generator.throw(e)}[Symbol.asyncIterator](){return this}async[Symbol.asyncDispose](){await this.return()}};const IR="__run";var CR=class e{text;generationInfo;constructor(e){this.text=e.text,this.generationInfo=e.generationInfo}concat(t){return new e({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo}})}},AR=class e extends CR{message;constructor(e){super(e),this.message=e.message}concat(t){return new e({text:this.text+t.text,generationInfo:{...this.generationInfo,...t.generationInfo},message:this.message.concat(t.message)})}};const SR=Object.prototype.hasOwnProperty;function bR(e,t){return SR.call(e,t)}function TR(e){if(Array.isArray(e)){const t=new Array(e.length);for(let e=0;e<t.length;e++)t[e]=""+e;return t}if(Object.keys)return Object.keys(e);let t=[];for(let n in e)bR(e,n)&&t.push(n);return t}function vR(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}function _R(e){let t=0;const n=e.length;let r;for(;t<n;){if(r=e.charCodeAt(t),!(r>=48&&r<=57))return!1;t++}return!0}function wR(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function ER(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function PR(e){if(void 0===e)return!0;if(e)if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(PR(e[n]))return!0}else if("object"==typeof e){const n=TR(e),r=n.length;for(var t=0;t<r;t++)if(PR(e[n[t]]))return!0}return!1}function RR(e,t){const n=[e];for(const r in t){const e="object"==typeof t[r]?JSON.stringify(t[r],null,2):t[r];void 0!==e&&n.push(`${r}: ${e}`)}return n.join("\n")}var LR=class extends Error{name;index;operation;tree;constructor(e,t,n,r,i){super(RR(e,{name:t,index:n,operation:r,tree:i})),this.name=t,this.index=n,this.operation=r,this.tree=i,Object.setPrototypeOf(this,new.target.prototype),this.message=RR(e,{name:t,index:n,operation:r,tree:i})}};const NR=LR,OR={add:function(e,t,n){if("__proto__"===t||"constructor"===t)throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){if("__proto__"===t||"constructor"===t)throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){if("__proto__"===t||"constructor"===t)throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor` prop is banned for security reasons");var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){let r=MR(n,this.path);r&&(r=vR(r));const i=DR(n,{op:"remove",path:this.from}).removed;return DR(n,{op:"add",path:this.path,value:i}),{newDocument:n,removed:r}},copy:function(e,t,n){const r=MR(n,this.from);return DR(n,{op:"add",path:this.path,value:vR(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:HR(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}};var BR={add:function(e,t,n){return _R(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:OR.move,copy:OR.copy,test:OR.test,_get:OR._get};function MR(e,t){if(""==t)return e;var n={op:"_get",path:t};return DR(e,n),n.value}function DR(e,t,n=!1,r=!0,i=!0,a=0){if(n&&("function"==typeof n?n(t,0,e,t.path):kR(t,0)),""===t.path){let r={newDocument:e};if("add"===t.op)return r.newDocument=t.value,r;if("replace"===t.op)return r.newDocument=t.value,r.removed=e,r;if("move"===t.op||"copy"===t.op)return r.newDocument=MR(e,t.from),"move"===t.op&&(r.removed=e),r;if("test"===t.op){if(r.test=HR(e,t.value),!1===r.test)throw new NR("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return r.newDocument=e,r}if("remove"===t.op)return r.removed=e,r.newDocument=null,r;if("_get"===t.op)return t.value=e,r;if(n)throw new NR("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",a,t,e);return r}{r||(e=vR(e));const o=(t.path||"").split("/");let s,c,l,u=e,d=1,p=o.length;for(l="function"==typeof n?n:kR;;){if(c=o[d],c&&-1!=c.indexOf("~")&&(c=ER(c)),i&&("__proto__"==c||"prototype"==c&&d>0&&"constructor"==o[d-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(n&&void 0===s&&(void 0===u[c]?s=o.slice(0,d).join("/"):d==p-1&&(s=t.path),void 0!==s&&l(t,0,e,s)),d++,Array.isArray(u)){if("-"===c)c=u.length;else{if(n&&!_R(c))throw new NR("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",a,t,e);_R(c)&&(c=~~c)}if(d>=p){if(n&&"add"===t.op&&c>u.length)throw new NR("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",a,t,e);const r=BR[t.op].call(t,u,c,e);if(!1===r.test)throw new NR("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return r}}else if(d>=p){const n=OR[t.op].call(t,u,c,e);if(!1===n.test)throw new NR("Test operation failed","TEST_OPERATION_FAILED",a,t,e);return n}if(u=u[c],n&&d<p&&(!u||"object"!=typeof u))throw new NR("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",a,t,e)}}}function FR(e,t,n,r=!0,i=!0){if(n&&!Array.isArray(t))throw new NR("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(e=vR(e));const a=new Array(t.length);for(let o=0,s=t.length;o<s;o++)a[o]=DR(e,t[o],n,!0,i,o),e=a[o].newDocument;return a.newDocument=e,a}function kR(e,t,n,r){if("object"!=typeof e||null===e||Array.isArray(e))throw new NR("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,n);if(!OR[e.op])throw new NR("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,n);if("string"!=typeof e.path)throw new NR("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,n);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new NR('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,n);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new NR("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new NR("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,n);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&PR(e.value))throw new NR("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,n);if(n)if("add"==e.op){var i=e.path.split("/").length,a=r.split("/").length;if(i!==a+1&&i!==a)throw new NR("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,n)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==r)throw new NR("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,n)}else if("move"===e.op||"copy"===e.op){var o=GR([{op:"_get",path:e.from,value:void 0}],n);if(o&&"OPERATION_PATH_UNRESOLVABLE"===o.name)throw new NR("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,n)}}function GR(e,t,n){try{if(!Array.isArray(e))throw new NR("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)FR(vR(t),vR(e),n||!0);else{n=n||kR;for(var r=0;r<e.length;r++)n(e[r],r,t,void 0)}}catch(i){if(i instanceof NR)return i;throw i}}function HR(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var n,r,i,a=Array.isArray(e),o=Array.isArray(t);if(a&&o){if((r=e.length)!=t.length)return!1;for(n=r;0!==n--;)if(!HR(e[n],t[n]))return!1;return!0}if(a!=o)return!1;var s=Object.keys(e);if((r=s.length)!==Object.keys(t).length)return!1;for(n=r;0!==n--;)if(!t.hasOwnProperty(s[n]))return!1;for(n=r;0!==n--;)if(!HR(e[i=s[n]],t[i]))return!1;return!0}return e!=e&&t!=t}function xR(e,t,n,r,i){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var a=TR(t),o=TR(e),s=!1,c=o.length-1;c>=0;c--){var l=e[d=o[c]];if(!bR(t,d)||void 0===t[d]&&void 0!==l&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(i&&n.push({op:"test",path:r+"/"+wR(d),value:vR(l)}),n.push({op:"remove",path:r+"/"+wR(d)}),s=!0):(i&&n.push({op:"test",path:r,value:e}),n.push({op:"replace",path:r,value:t}));else{var u=t[d];"object"==typeof l&&null!=l&&"object"==typeof u&&null!=u&&Array.isArray(l)===Array.isArray(u)?xR(l,u,n,r+"/"+wR(d),i):l!==u&&(i&&n.push({op:"test",path:r+"/"+wR(d),value:vR(l)}),n.push({op:"replace",path:r+"/"+wR(d),value:vR(u)}))}}if(s||a.length!=o.length)for(c=0;c<a.length;c++){var d;bR(e,d=a[c])||void 0===t[d]||n.push({op:"add",path:r+"/"+wR(d),value:vR(t[d])})}}}function UR(e,t,n=!1){var r=[];return xR(e,t,r,"",n),r}var VR=class{ops;constructor(e){this.ops=e.ops??[]}concat(e){const t=this.ops.concat(e.ops),n=FR({},t);return new $R({ops:t,state:n[n.length-1].newDocument})}},$R=class e extends VR{state;constructor(e){super(e),this.state=e.state}concat(t){const n=this.ops.concat(t.ops),r=FR(this.state,t.ops);return new e({ops:n,state:r[r.length-1].newDocument})}static fromRunLogPatch(t){const n=FR({},t.ops);return new e({ops:t.ops,state:n[n.length-1].newDocument})}};const jR=e=>"log_stream_tracer"===e.name;async function WR(e,t){if("original"===t)throw new Error("Do not assign inputs with original schema drop the key for now. When inputs are added to streamLog they should be added with standardized schema for streaming events.");const{inputs:n}=e;return["retriever","llm","prompt"].includes(e.run_type)?n:1!==Object.keys(n).length||""!==n?.input?n.input:void 0}async function XR(e,t){const{outputs:n}=e;return"original"===t||["retriever","llm","prompt"].includes(e.run_type)?n:void 0!==n&&1===Object.keys(n).length&&void 0!==n?.output?n.output:n}var KR=class extends wP{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;_schemaFormat="original";rootId;keyMapByRunId={};counterMapByRunName={};transformStream;writer;receiveStream;name="log_stream_tracer";lc_prefer_streaming=!0;constructor(e){super({_awaitHandler:!0,...e}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this._schemaFormat=e?._schemaFormat??this._schemaFormat,this.transformStream=new TransformStream,this.writer=this.transformStream.writable.getWriter(),this.receiveStream=fR.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){if(e.id===this.rootId)return!1;const t=e.tags??[];let n=void 0===this.includeNames&&void 0===this.includeTags&&void 0===this.includeTypes;return void 0!==this.includeNames&&(n=n||this.includeNames.includes(e.name)),void 0!==this.includeTypes&&(n=n||this.includeTypes.includes(e.run_type)),void 0!==this.includeTags&&(n=n||void 0!==t.find(e=>this.includeTags?.includes(e))),void 0!==this.excludeNames&&(n=n&&!this.excludeNames.includes(e.name)),void 0!==this.excludeTypes&&(n=n&&!this.excludeTypes.includes(e.run_type)),void 0!==this.excludeTags&&(n=n&&t.every(e=>!this.excludeTags?.includes(e))),n}async*tapOutputIterable(e,t){for await(const n of t){if(e!==this.rootId){const t=this.keyMapByRunId[e];t&&await this.writer.write(new VR({ops:[{op:"add",path:`/logs/${t}/streamed_output/-`,value:n}]}))}yield n}}async onRunCreate(e){if(void 0===this.rootId&&(this.rootId=e.id,await this.writer.write(new VR({ops:[{op:"replace",path:"",value:{id:e.id,name:e.name,type:e.run_type,streamed_output:[],final_output:void 0,logs:{}}}]}))),!this._includeRun(e))return;void 0===this.counterMapByRunName[e.name]&&(this.counterMapByRunName[e.name]=0),this.counterMapByRunName[e.name]+=1;const t=this.counterMapByRunName[e.name];this.keyMapByRunId[e.id]=1===t?e.name:`${e.name}:${t}`;const n={id:e.id,name:e.name,type:e.run_type,tags:e.tags??[],metadata:e.extra?.metadata??{},start_time:new Date(e.start_time).toISOString(),streamed_output:[],streamed_output_str:[],final_output:void 0,end_time:void 0};"streaming_events"===this._schemaFormat&&(n.inputs=await WR(e,this._schemaFormat)),await this.writer.write(new VR({ops:[{op:"add",path:`/logs/${this.keyMapByRunId[e.id]}`,value:n}]}))}async onRunUpdate(e){try{const t=this.keyMapByRunId[e.id];if(void 0===t)return;const n=[];"streaming_events"===this._schemaFormat&&n.push({op:"replace",path:`/logs/${t}/inputs`,value:await WR(e,this._schemaFormat)}),n.push({op:"add",path:`/logs/${t}/final_output`,value:await XR(e,this._schemaFormat)}),void 0!==e.end_time&&n.push({op:"add",path:`/logs/${t}/end_time`,value:new Date(e.end_time).toISOString()});const r=new VR({ops:n});await this.writer.write(r)}finally{if(e.id===this.rootId){const t=new VR({ops:[{op:"replace",path:"/final_output",value:await XR(e,this._schemaFormat)}]});await this.writer.write(t),this.autoClose&&await this.writer.close()}}}async onLLMNewToken(e,t,n){const r=this.keyMapByRunId[e.id];if(void 0===r)return;let i;var a;void 0!==e.inputs.messages?(a=n?.chunk,i=void 0!==a&&void 0!==a.message?n?.chunk:new cb({id:`run-${e.id}`,content:t})):i=t;const o=new VR({ops:[{op:"add",path:`/logs/${r}/streamed_output_str/-`,value:t},{op:"add",path:`/logs/${r}/streamed_output/-`,value:i}]});await this.writer.write(o)}};function YR({name:e,serialized:t}){return void 0!==e?e:void 0!==t?.name?t.name:void 0!==t?.id&&Array.isArray(t?.id)?t.id[t.id.length-1]:"Unnamed"}const qR=e=>"event_stream_tracer"===e.name;var QR=class extends wP{autoClose=!0;includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;runInfoMap=/* @__PURE__ */new Map;tappedPromises=/* @__PURE__ */new Map;transformStream;writer;receiveStream;readableStreamClosed=!1;name="event_stream_tracer";lc_prefer_streaming=!0;constructor(e){super({_awaitHandler:!0,...e}),this.autoClose=e?.autoClose??!0,this.includeNames=e?.includeNames,this.includeTypes=e?.includeTypes,this.includeTags=e?.includeTags,this.excludeNames=e?.excludeNames,this.excludeTypes=e?.excludeTypes,this.excludeTags=e?.excludeTags,this.transformStream=new TransformStream({flush:()=>{this.readableStreamClosed=!0}}),this.writer=this.transformStream.writable.getWriter(),this.receiveStream=fR.fromReadableStream(this.transformStream.readable)}[Symbol.asyncIterator](){return this.receiveStream}async persistRun(e){}_includeRun(e){const t=e.tags??[];let n=void 0===this.includeNames&&void 0===this.includeTags&&void 0===this.includeTypes;return void 0!==this.includeNames&&(n=n||this.includeNames.includes(e.name)),void 0!==this.includeTypes&&(n=n||this.includeTypes.includes(e.runType)),void 0!==this.includeTags&&(n=n||void 0!==t.find(e=>this.includeTags?.includes(e))),void 0!==this.excludeNames&&(n=n&&!this.excludeNames.includes(e.name)),void 0!==this.excludeTypes&&(n=n&&!this.excludeTypes.includes(e.runType)),void 0!==this.excludeTags&&(n=n&&t.every(e=>!this.excludeTags?.includes(e))),n}async*tapOutputIterable(e,t){const n=await t.next();if(n.done)return;const r=this.runInfoMap.get(e);if(void 0===r)return void(yield n.value);function i(e,t){return"llm"===e&&"string"==typeof t?new CR({text:t}):t}let a=this.tappedPromises.get(e);if(void 0===a){let o;a=new Promise(e=>{o=e}),this.tappedPromises.set(e,a);try{const a={event:`on_${r.runType}_stream`,run_id:e,name:r.name,tags:r.tags,metadata:r.metadata,data:{}};await this.send({...a,data:{chunk:i(r.runType,n.value)}},r),yield n.value;for await(const e of t)"tool"!==r.runType&&"retriever"!==r.runType&&await this.send({...a,data:{chunk:i(r.runType,e)}},r),yield e}finally{o?.()}}else{yield n.value;for await(const e of t)yield e}}async send(e,t){this.readableStreamClosed||this._includeRun(t)&&await this.writer.write(e)}async sendEndEvent(e,t){const n=this.tappedPromises.get(e.run_id);void 0!==n?n.then(()=>{this.send(e,t)}):await this.send(e,t)}async onLLMStart(e){const t=YR(e),n=void 0!==e.inputs.messages?"chat_model":"llm",r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:n,inputs:e.inputs};this.runInfoMap.set(e.id,r);const i=`on_${n}_start`;await this.send({event:i,data:{input:e.inputs},name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},r)}async onLLMNewToken(e,t,n){const r=this.runInfoMap.get(e.id);let i,a;if(void 0===r)throw new Error(`onLLMNewToken: Run ID ${e.id} not found in run map.`);if(1!==this.runInfoMap.size){if("chat_model"===r.runType)a="on_chat_model_stream",i=void 0===n?.chunk?new cb({content:t,id:`run-${e.id}`}):n.chunk.message;else{if("llm"!==r.runType)throw new Error(`Unexpected run type ${r.runType}`);a="on_llm_stream",i=void 0===n?.chunk?new CR({text:t}):n.chunk}await this.send({event:a,data:{chunk:i},run_id:e.id,name:r.name,tags:r.tags,metadata:r.metadata},r)}}async onLLMEnd(e){const t=this.runInfoMap.get(e.id);let n;if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onLLMEnd: Run ID ${e.id} not found in run map.`);const r=e.outputs?.generations;let i;if("chat_model"===t.runType){for(const e of r??[]){if(void 0!==i)break;i=e[0]?.message}n="on_chat_model_end"}else{if("llm"!==t.runType)throw new Error(`onLLMEnd: Unexpected run type: ${t.runType}`);i={generations:r?.map(e=>e.map(e=>({text:e.text,generationInfo:e.generationInfo}))),llmOutput:e.outputs?.llmOutput??{}},n="on_llm_end"}await this.sendEndEvent({event:n,data:{output:i,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onChainStart(e){const t=YR(e),n=e.run_type??"chain",r={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:e.run_type};let i={};""===e.inputs.input&&1===Object.keys(e.inputs).length?(i={},r.inputs={}):void 0!==e.inputs.input?(i.input=e.inputs.input,r.inputs=e.inputs.input):(i.input=e.inputs,r.inputs=e.inputs),this.runInfoMap.set(e.id,r),await this.send({event:`on_${n}_start`,data:i,name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},r)}async onChainEnd(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onChainEnd: Run ID ${e.id} not found in run map.`);const n=`on_${e.run_type}_end`,r=e.inputs??t.inputs??{},i={output:e.outputs?.output??e.outputs,input:r};r.input&&1===Object.keys(r).length&&(i.input=r.input,t.inputs=r.input),await this.sendEndEvent({event:n,data:i,run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata??{}},t)}async onToolStart(e){const t=YR(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:"tool",inputs:e.inputs??{}};this.runInfoMap.set(e.id,n),await this.send({event:"on_tool_start",data:{input:e.inputs??{}},name:t,run_id:e.id,tags:e.tags??[],metadata:e.extra?.metadata??{}},n)}async onToolEnd(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(void 0===t.inputs)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);const n=void 0===e.outputs?.output?e.outputs:e.outputs.output;await this.sendEndEvent({event:"on_tool_end",data:{output:n,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onToolError(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onToolEnd: Run ID ${e.id} not found in run map.`);if(void 0===t.inputs)throw new Error(`onToolEnd: Run ID ${e.id} is a tool call, and is expected to have traced inputs.`);await this.sendEndEvent({event:"on_tool_error",data:{input:t.inputs,error:e.error},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async onRetrieverStart(e){const t=YR(e),n={tags:e.tags??[],metadata:e.extra?.metadata??{},name:t,runType:"retriever",inputs:{query:e.inputs.query}};this.runInfoMap.set(e.id,n),await this.send({event:"on_retriever_start",data:{input:{query:e.inputs.query}},name:t,tags:e.tags??[],run_id:e.id,metadata:e.extra?.metadata??{}},n)}async onRetrieverEnd(e){const t=this.runInfoMap.get(e.id);if(this.runInfoMap.delete(e.id),void 0===t)throw new Error(`onRetrieverEnd: Run ID ${e.id} not found in run map.`);await this.sendEndEvent({event:"on_retriever_end",data:{output:e.outputs?.documents??e.outputs,input:t.inputs},run_id:e.id,name:t.name,tags:t.tags,metadata:t.metadata},t)}async handleCustomEvent(e,t,n){const r=this.runInfoMap.get(n);if(void 0===r)throw new Error(`handleCustomEvent: Run ID ${n} not found in run map.`);await this.send({event:"on_custom_event",run_id:n,name:e,tags:r.tags,metadata:r.metadata,data:t},r)}async finish(){const e=[...this.tappedPromises.values()];Promise.all(e).finally(()=>{this.writer.close()})}};const JR=Object.prototype.toString,zR=/* @__PURE__ */new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed","fetch failed","terminated"," A network error occurred.","Network connection lost"]);function ZR(e){if(!e||(t=e,"[object Error]"!==JR.call(t))||"TypeError"!==e.name||"string"!=typeof e.message)return!1;var t;const{message:n,stack:r}=e;return"Load failed"===n?void 0===r||"__sentry_captured__"in e:!!n.startsWith("error sending request for url")||zR.has(n)}function eL(e,t,{min:n=0,allowInfinity:r=!1}={}){if(void 0!==t){if("number"!=typeof t||Number.isNaN(t))throw new TypeError(`Expected \`${e}\` to be a number${r?" or Infinity":""}.`);if(!r&&!Number.isFinite(t))throw new TypeError(`Expected \`${e}\` to be a finite number.`);if(t<n)throw new TypeError(`Expected \`${e}\` to be ≥ ${n}.`)}}var tL=class extends Error{constructor(e){super(),e instanceof Error?(this.originalError=e,({message:e}=e)):(this.originalError=new Error(e),this.originalError.stack=this.stack),this.name="AbortError",this.message=e}};function nL(e,t){return Number.isFinite(t)?t-(performance.now()-e):t}async function rL({error:e,attemptNumber:t,retriesConsumed:n,startTime:r,options:i}){const a=e instanceof Error?e:/* @__PURE__ */new TypeError(`Non-error was thrown: "${e}". You should only throw errors.`);if(a instanceof tL)throw a.originalError;const o=Number.isFinite(i.retries)?Math.max(0,i.retries-n):i.retries,s=i.maxRetryTime??Number.POSITIVE_INFINITY,c=Object.freeze({error:a,attemptNumber:t,retriesLeft:o,retriesConsumed:n});if(await i.onFailedAttempt(c),nL(r,s)<=0)throw a;const l=await i.shouldConsumeRetry(c),u=nL(r,s);if(u<=0||o<=0)throw a;if(a instanceof TypeError&&!ZR(a)){if(l)throw a;return i.signal?.throwIfAborted(),!1}if(!(await i.shouldRetry(c)))throw a;if(!l)return i.signal?.throwIfAborted(),!1;let d=function(e,t){const n=Math.max(1,e+1),r=t.randomize?Math.random()+1:1;let i=Math.round(r*t.minTimeout*t.factor**(n-1));return i=Math.min(i,t.maxTimeout),i}(n,i);const p="number"==typeof a.retryAfterMs&&a.retryAfterMs>=0?a.retryAfterMs:void 0;void 0!==p&&(d=Math.max(d,p));const h=Math.min(d,u);return h>0&&await new Promise((e,t)=>{const n=()=>{clearTimeout(r),i.signal?.removeEventListener("abort",n),t(i.signal.reason)},r=setTimeout(()=>{i.signal?.removeEventListener("abort",n),e()},h);i.unref&&r.unref?.(),i.signal?.addEventListener("abort",n,{once:!0})}),i.signal?.throwIfAborted(),!0}async function iL(e,t={}){if(function(e){if("number"==typeof e){if(e<0)throw new TypeError("Expected `retries` to be a non-negative number.");if(Number.isNaN(e))throw new TypeError("Expected `retries` to be a valid number or Infinity, got NaN.")}else if(void 0!==e)throw new TypeError("Expected `retries` to be a number or Infinity.")}((t={...t}).retries),Object.hasOwn(t,"forever"))throw new Error("The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.");t.retries??=10,t.factor??=2,t.minTimeout??=1e3,t.maxTimeout??=Number.POSITIVE_INFINITY,t.maxRetryTime??=Number.POSITIVE_INFINITY,t.randomize??=!1,t.onFailedAttempt??=()=>{},t.shouldRetry??=()=>!0,t.shouldConsumeRetry??=()=>!0,eL("factor",t.factor,{min:0,allowInfinity:!1}),eL("minTimeout",t.minTimeout,{min:0,allowInfinity:!1}),eL("maxTimeout",t.maxTimeout,{min:0,allowInfinity:!0}),eL("maxRetryTime",t.maxRetryTime,{min:0,allowInfinity:!0}),t.factor>0||(t.factor=1),t.signal?.throwIfAborted();let n=0,r=0;const i=performance.now();for(;!Number.isFinite(t.retries)||r<=t.retries;){n++;try{t.signal?.throwIfAborted();const r=await e(n);return t.signal?.throwIfAborted(),r}catch(a){await rL({error:a,attemptNumber:n,retriesConsumed:r,startTime:i,options:t})&&r++}}throw new Error("Retry attempts exhausted without throwing an error.")}const aL=[400,401,402,403,404,405,406,407,409,413],oL=[/insufficient[_ -]?quota/i,/exceeded (?:your|the current|the available).+quota/i,/usage quota/i,/quota (?:has been )?exhausted/i,/billing/i,/credit balance/i,/out of credits/i,/will reset at/i],sL=/(?:try again in|retry after)\s+(\d+(?:\.\d+)?)\s*(milliseconds?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h)\b/i;function cL(e){return"object"==typeof e&&null!==e&&"response"in e&&"object"==typeof e.response&&null!==e.response&&"status"in e.response&&"number"==typeof e.response.status?e.response.status:void 0}function lL(e){if("object"==typeof e&&null!==e)return"status"in e&&"number"==typeof e.status?e.status:"statusCode"in e&&"number"==typeof e.statusCode?e.statusCode:void 0}function uL(e){return"object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:void 0}function dL(e){if("object"==typeof e&&null!==e)return"code"in e&&"string"==typeof e.code?e.code:"error"in e&&"object"==typeof e.error&&null!==e.error&&"code"in e.error&&"string"==typeof e.error.code?e.error.code:void 0}function pL(e,t){if(e instanceof Error)return e;const n=new Error(t);return"object"==typeof e&&null!==e&&Object.assign(n,e),n}function hL(e,t){if("object"!=typeof e||null===e)return;const n=e;n.rateLimitType=t.action,n.rateLimitReason=t.reason,void 0!==t.retryAfterMs&&(n.retryAfterMs=t.retryAfterMs)}function fL(e){if(429!==(cL(e)??lL(e)))return;if("insufficient_quota"===dL(e))return{action:"stop",reason:"insufficient_quota"};const t=uL(e);if(t&&oL.some(e=>e.test(t)))return{action:"stop",reason:"quota_message"};const n=function(e){if(null==e)return;const t=e.trim();if(!t)return;const n=Number(t);if(!Number.isNaN(n)&&n>=0)return 1e3*n;const r=Date.parse(t);if(!Number.isNaN(r)){const e=r-Date.now();return e>0?e:0}}(function(e){return e?.headers?"function"==typeof e.headers.get?e.headers.get("retry-after"):e.headers["retry-after"]??e.headers["Retry-After"]:e?.response?.headers?"function"==typeof e.response.headers.get?e.response.headers.get("retry-after"):e.response.headers["retry-after"]??e.response.headers["Retry-After"]:void 0}(e))??function(e){if(null==e)return;const t=sL.exec(e);if(!t)return;const n=Number(t[1]),r=t[2]?.toLowerCase();return!Number.isNaN(n)&&r?"ms"===r||r.startsWith("millisecond")?n:"m"===r||r.startsWith("min")?6e4*n:"h"===r||r.startsWith("hr")||r.startsWith("hour")?36e5*n:1e3*n:void 0}(t);return void 0!==n?n<=6e4?{action:"wait",retryAfterMs:n,reason:"retry_after_hint"}:{action:"capacity",retryAfterMs:n,reason:"retry_after_too_large"}:{action:"capacity",reason:"headerless_429"}}const mL=e=>{if("object"!=typeof e||null===e)return;if(!1===function(e){if("object"==typeof e&&null!==e)return Object.getOwnPropertyDescriptor(e,MS)?.value}(e))throw e;if("message"in e&&"string"==typeof e.message&&(e.message.startsWith("Cancel")||e.message.startsWith("AbortError"))||"name"in e&&"string"==typeof e.name&&"AbortError"===e.name)throw DS(e,!1);if("code"in e&&"string"==typeof e.code&&"ECONNABORTED"===e.code)throw e;const t=cL(e)??lL(e);if(t&&aL.includes(+t))throw DS(e,!1);if("insufficient_quota"===dL(e)){const t=pL(e,uL(e)??"Insufficient quota");throw t.name="InsufficientQuotaError",hL(t,{action:"stop",reason:"insufficient_quota"}),DS(t,!1)}const n=fL(e);if(n){if("wait"===n.action)return hL(e,n),void DS(e,!0);const t=pL(e,uL(e)??"Rate limit exceeded");throw"Error"===t.name&&(t.name="stop"===n.action?"RateLimitQuotaExhaustedError":"RateLimitCapacityError"),hL(t,n),DS(t,"stop"!==n.action)}};var gL=class{maxConcurrency;maxRetries;onFailedAttempt;queue;constructor(e){this.maxConcurrency=e.maxConcurrency??1/0,this.maxRetries=e.maxRetries??6,this.onFailedAttempt=e.onFailedAttempt??mL;const t="default"in w_?w_.default:w_;this.queue=new t({concurrency:this.maxConcurrency})}async call(e,...t){return this.callWithRetries(this.maxRetries,e,t)}callWithRetries(e,t,n){return this.queue.add(()=>iL(()=>t(...n).catch(e=>{throw e instanceof Error?e:new Error(e)}),{onFailedAttempt:({error:e})=>this.onFailedAttempt?.(e),retries:e,randomize:!0}),{throwOnTimeout:!0})}callWithOptions(e,t,...n){const r=e.maxRetries??this.maxRetries;if(e.signal){let i;return Promise.race([this.callWithRetries(r,t,n),new Promise((t,n)=>{i=()=>{n(hR(e.signal))},e.signal?.addEventListener("abort",i,{once:!0})})]).finally(()=>{e.signal&&i&&e.signal.removeEventListener("abort",i)})}return this.callWithRetries(r,t,n)}fetch(...e){return this.call(()=>fetch(...e).then(e=>e.ok?e:Promise.reject(e)))}},yL=class extends wP{name="RootListenersTracer";rootId;config;argOnStart;argOnEnd;argOnError;constructor({config:e,onStart:t,onEnd:n,onError:r}){super({_awaitHandler:!0}),this.config=e,this.argOnStart=t,this.argOnEnd=n,this.argOnError=r}persistRun(e){return Promise.resolve()}async onRunCreate(e){this.rootId||(this.rootId=e.id,this.argOnStart&&await this.argOnStart(e,this.config))}async onRunUpdate(e){e.id===this.rootId&&(e.error?this.argOnError&&await this.argOnError(e,this.config):this.argOnEnd&&await this.argOnEnd(e,this.config))}};function IL(e){return!!e&&e.lc_runnable}var CL=class{includeNames;includeTypes;includeTags;excludeNames;excludeTypes;excludeTags;constructor(e){this.includeNames=e.includeNames,this.includeTypes=e.includeTypes,this.includeTags=e.includeTags,this.excludeNames=e.excludeNames,this.excludeTypes=e.excludeTypes,this.excludeTags=e.excludeTags}includeEvent(e,t){let n=void 0===this.includeNames&&void 0===this.includeTypes&&void 0===this.includeTags;const r=e.tags??[];return void 0!==this.includeNames&&(n=n||this.includeNames.includes(e.name)),void 0!==this.includeTypes&&(n=n||this.includeTypes.includes(t)),void 0!==this.includeTags&&(n=n||r.some(e=>this.includeTags?.includes(e))),void 0!==this.excludeNames&&(n=n&&!this.excludeNames.includes(e.name)),void 0!==this.excludeTypes&&(n=n&&!this.excludeTypes.includes(t)),void 0!==this.excludeTags&&(n=n&&r.every(e=>!this.excludeTags?.includes(e))),n}};function AL(e){return e.replace(/[^a-zA-Z-_0-9]/g,"_")}const SL=["*","_","`"];function bL(e,t,n){const{firstNode:r,lastNode:i,nodeColors:a,withStyles:o=!0,curveStyle:s="linear",wrapLabelNWords:c=9}=n??{};let l=o?`%%{init: {'flowchart': {'curve': '${s}'}}}%%\ngraph TD;\n`:"graph TD;\n";if(o){const t="default",n={[t]:"{0}({1})"};void 0!==r&&(n[r]="{0}([{1}]):::first"),void 0!==i&&(n[i]="{0}([{1}]):::last");for(const[r,i]of Object.entries(e)){const e=i.name.split(":").pop()??"";let a=SL.some(t=>e.startsWith(t)&&e.endsWith(t))?`<p>${e}</p>`:e;Object.keys(i.metadata??{}).length&&(a+=`<hr/><small><em>${Object.entries(i.metadata??{}).map(([e,t])=>`${e} = ${t}`).join("\n")}</em></small>`);const o=(n[r]??n[t]).replace("{0}",AL(r)).replace("{1}",a);l+=`\t${o}\n`}}const u={};for(const h of t){const e=h.source.split(":"),t=h.target.split(":"),n=e.filter((e,n)=>e===t[n]).join(":");u[n]||(u[n]=[]),u[n].push(h)}const d=/* @__PURE__ */new Set;function p(e,t){const n=1===e.length&&e[0].source===e[0].target;if(t&&!n){const e=t.split(":").pop();if(d.has(t))throw new Error(`Found duplicate subgraph '${e}' at '${t} -- this likely means that you're reusing a subgraph node with the same name. Please adjust your graph to have subgraph nodes with unique names.`);d.add(t),l+=`\tsubgraph ${e}\n`}const r=(i=Object.keys(u).filter(e=>e.startsWith(`${t}:`)&&e!==t&&e.split(":").length===t.split(":").length+1),[...i].sort((e,t)=>e.split(":").length-t.split(":").length));var i;for(const a of r)p(u[a],a);for(const a of e){const{source:e,target:t,data:n,conditional:r}=a;let i="";if(void 0!==n){let e=n;const t=e.split(" ");t.length>c&&(e=Array.from({length:Math.ceil(t.length/c)},(e,n)=>t.slice(n*c,(n+1)*c).join(" ")).join("&nbsp;<br>&nbsp;")),i=r?` -. &nbsp;${e}&nbsp; .-> `:` -- &nbsp;${e}&nbsp; --\x3e `}else i=r?" -.-> ":" --\x3e ";l+=`\t${AL(e)}${i}${AL(t)};\n`}t&&!n&&(l+="\tend\n")}p(u[""]??[],"");for(const h in u)h.includes(":")||""===h||p(u[h],h);return o&&(l+=function(e){let t="";for(const[n,r]of Object.entries(e))t+=`\tclassDef ${n} ${r};\n`;return t}(a??{})),l}async function TL(e,t){let n=t?.backgroundColor??"white";const r=t?.imageType??"png",i=btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"");void 0!==n&&(/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(n)||(n=`!${n}`));const a=`https://mermaid.ink/img/${i}?bgColor=${n}&type=${r}`,o=await fetch(a);if(!o.ok)throw new Error(["Failed to render the graph using the Mermaid.INK API.",`Status code: ${o.status}`,`Status text: ${o.statusText}`].join("\n"));return await o.blob()}function vL(e,t){if(void 0!==e&&!Fb(e))return e;if(!IL(t))return t.name??"UnknownSchema";try{let e=t.getName();return e=e.startsWith("Runnable")?e.slice(8):e,e}catch{return t.getName()}}function _L(e){return IL(e.data)?{type:"runnable",data:{id:e.data.lc_id,name:e.data.getName()}}:{type:"schema",data:{...rA(e.data.schema),title:e.data.name}}}var wL=class e{nodes={};edges=[];constructor(e){this.nodes=e?.nodes??this.nodes,this.edges=e?.edges??this.edges}toJSON(){const e={};return Object.values(this.nodes).forEach((t,n)=>{e[t.id]=Fb(t.id)?n:t.id}),{nodes:Object.values(this.nodes).map(t=>({id:e[t.id],..._L(t)})),edges:this.edges.map(t=>{const n={source:e[t.source],target:e[t.target]};return void 0!==t.data&&(n.data=t.data),void 0!==t.conditional&&(n.conditional=t.conditional),n})}}addNode(e,t,n){if(void 0!==t&&void 0!==this.nodes[t])throw new Error(`Node with id ${t} already exists`);const r=t??Mb(),i={id:r,data:e,name:vL(t,e),metadata:n};return this.nodes[r]=i,i}removeNode(e){delete this.nodes[e.id],this.edges=this.edges.filter(t=>t.source!==e.id&&t.target!==e.id)}addEdge(e,t,n,r){if(void 0===this.nodes[e.id])throw new Error(`Source node ${e.id} not in graph`);if(void 0===this.nodes[t.id])throw new Error(`Target node ${t.id} not in graph`);const i={source:e.id,target:t.id,data:n,conditional:r};return this.edges.push(i),i}firstNode(){return EL(this)}lastNode(){return PL(this)}extend(e,t=""){let n=t;Object.values(e.nodes).map(e=>e.id).every(Fb)&&(n="");const r=e=>n?`${n}:${e}`:e;Object.entries(e.nodes).forEach(([e,t])=>{this.nodes[r(e)]={...t,id:r(e)}});const i=e.edges.map(e=>({...e,source:r(e.source),target:r(e.target)}));this.edges=[...this.edges,...i];const a=e.firstNode(),o=e.lastNode();return[a?{id:r(a.id),data:a.data}:void 0,o?{id:r(o.id),data:o.data}:void 0]}trimFirstNode(){const e=this.firstNode();e&&EL(this,[e.id])&&this.removeNode(e)}trimLastNode(){const e=this.lastNode();e&&PL(this,[e.id])&&this.removeNode(e)}reid(){const t=Object.fromEntries(Object.values(this.nodes).map(e=>[e.id,e.name])),n=/* @__PURE__ */new Map;Object.values(t).forEach(e=>{n.set(e,(n.get(e)||0)+1)});const r=e=>{const r=t[e];return Fb(e)&&1===n.get(r)?r:e};return new e({nodes:Object.fromEntries(Object.entries(this.nodes).map(([e,t])=>[r(e),{...t,id:r(e)}])),edges:this.edges.map(e=>({...e,source:r(e.source),target:r(e.target)}))})}drawMermaid(e){const{withStyles:t,curveStyle:n,nodeColors:r={default:"fill:#f2f0ff,line-height:1.2",first:"fill-opacity:0",last:"fill:#bfb6fc"},wrapLabelNWords:i}=e??{},a=this.reid(),o=a.firstNode(),s=a.lastNode();return bL(a.nodes,a.edges,{firstNode:o?.id,lastNode:s?.id,withStyles:t,curveStyle:n,nodeColors:r,wrapLabelNWords:i})}async drawMermaidPng(e){return TL(this.drawMermaid(e),{backgroundColor:e?.backgroundColor})}};function EL(e,t=[]){const n=new Set(e.edges.filter(e=>!t.includes(e.source)).map(e=>e.target)),r=[];for(const i of Object.values(e.nodes))t.includes(i.id)||n.has(i.id)||r.push(i);return 1===r.length?r[0]:void 0}function PL(e,t=[]){const n=new Set(e.edges.filter(e=>!t.includes(e.target)).map(e=>e.source)),r=[];for(const i of Object.values(e.nodes))t.includes(i.id)||n.has(i.id)||r.push(i);return 1===r.length?r[0]:void 0}function RL(e){return"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.iterator]&&"function"==typeof e.next}function LL(e){return"object"==typeof e&&null!==e&&"function"==typeof e[Symbol.asyncIterator]}function*NL(e,t){for(;;){const{value:n,done:r}=rR.runWithConfig(dR(e),t.next.bind(t),!0);if(r)break;yield n}}async function*OL(e,t){const n=t[Symbol.asyncIterator]();for(;;){const{value:r,done:i}=await rR.runWithConfig(dR(e),n.next.bind(t),!0);if(i)break;yield r}}function BL(e,t){return!e||Array.isArray(e)||e instanceof Date||"object"!=typeof e?{[t]:e}:e}var ML=class extends pA{lc_runnable=!0;name;getName(e){const t=this.name??this.constructor.lc_name()??this.constructor.name;return e?`${t}${e}`:t}withRetry(e){return new FL({bound:this,kwargs:{},config:{},maxAttemptNumber:e?.stopAfterAttempt,...e})}withConfig(e){return new DL({bound:this,config:e,kwargs:{}})}withFallbacks(e){const t=Array.isArray(e)?e:e.fallbacks;return new UL({runnable:this,fallbacks:t})}_getOptionsList(e,t=0){if(Array.isArray(e)&&e.length!==t)throw new Error(`Passed "options" must be an array with the same length as the inputs, but got ${e.length} options for ${t} inputs`);if(Array.isArray(e))return e.map(lR);if(t>1&&!Array.isArray(e)&&e.runId){console.warn("Provided runId will be used only for the first element of the batch.");const n=Object.fromEntries(Object.entries(e).filter(([e])=>"runId"!==e));return Array.from({length:t},(t,r)=>lR(0===r?e:n))}return Array.from({length:t},()=>lR(e))}async batch(e,t,n){const r=this._getOptionsList(t??{},e.length),i=r[0]?.maxConcurrency??n?.maxConcurrency,a=new gL({maxConcurrency:i,onFailedAttempt:e=>{throw e}}),o=e.map((e,t)=>a.call(async()=>{try{return await this.invoke(e,r[t])}catch(i){if(n?.returnExceptions)return i;throw i}}));return Promise.all(o)}async*_streamIterator(e,t){yield this.invoke(e,t)}async stream(e,t){const n=lR(t),r=new yR({generator:this._streamIterator(e,n),config:n});return await r.setup,fR.fromAsyncGenerator(r)}_separateRunnableConfigFromCallOptions(e){let t;t=lR(void 0===e?e:{callbacks:e.callbacks,tags:e.tags,metadata:e.metadata,runName:e.runName,configurable:e.configurable,recursionLimit:e.recursionLimit,maxConcurrency:e.maxConcurrency,runId:e.runId,timeout:e.timeout,signal:e.signal});const n={...e};return delete n.callbacks,delete n.tags,delete n.metadata,delete n.runName,delete n.configurable,delete n.recursionLimit,delete n.maxConcurrency,delete n.runId,delete n.timeout,delete n.signal,[t,n]}async _callWithConfig(e,t,n){const r=lR(n),i=await((await sR(r))?.handleChainStart(this.toJSON(),BL(t,"input"),r.runId,r?.runType,void 0,void 0,r?.runName??this.getName()));let a;delete r.runId;try{const n=e.call(this,t,r,i);a=await pR(n,r.signal)}catch(o){throw await(i?.handleChainError(o)),o}return await(i?.handleChainEnd(BL(a,"output"))),a}async _batchWithConfig(e,t,n,r){const i=this._getOptionsList(n??{},t.length),a=await Promise.all(i.map(sR)),o=await Promise.all(a.map(async(e,n)=>{const r=await(e?.handleChainStart(this.toJSON(),BL(t[n],"input"),i[n].runId,i[n].runType,void 0,void 0,i[n].runName??this.getName()));return delete i[n].runId,r}));let s;try{const n=e.call(this,t,i,o,r);s=await pR(n,i?.[0]?.signal)}catch(c){throw await Promise.all(o.map(e=>e?.handleChainError(c))),c}return await Promise.all(o.map(e=>e?.handleChainEnd(BL(s,"output")))),s}_concatOutputChunks(e,t){return gR(e,t)}async*_transformStreamWithConfig(e,t,n){let r,i,a=!0,o=!0;const s=lR(n),c=await sR(s),l=this;let u;try{const n=await async function(e,t,n,r,...i){const a=new yR({generator:t,startSetup:n,signal:r}),o=await a.setup;return{output:e(a,o,...i),setup:o}}(t.bind(this),async function*(){for await(const t of e){if(a)if(void 0===r)r=t;else try{r=l._concatOutputChunks(r,t)}catch{r=void 0,a=!1}yield t}}(),async()=>c?.handleChainStart(this.toJSON(),{input:""},s.runId,s.runType,void 0,void 0,s.runName??this.getName(),void 0,{lc_defers_inputs:!0}),s.signal,s);delete s.runId,u=n.setup;const d=u?.handlers.find(qR);let p=n.output;void 0!==d&&void 0!==u&&(p=d.tapOutputIterable(u.runId,p));const h=u?.handlers.find(jR);void 0!==h&&void 0!==u&&(p=h.tapOutputIterable(u.runId,p));for await(const e of p)if(yield e,o)if(void 0===i)i=e;else try{i=this._concatOutputChunks(i,e)}catch{i=void 0,o=!1}}catch(d){throw await(u?.handleChainError(d,void 0,void 0,void 0,{inputs:BL(r,"input")})),d}await(u?.handleChainEnd(i??{},void 0,void 0,void 0,{inputs:BL(r,"input")}))}getGraph(e){const t=new wL,n=t.addNode({name:`${this.getName()}Input`,schema:SC()}),r=t.addNode(this),i=t.addNode({name:`${this.getName()}Output`,schema:SC()});return t.addEdge(n,r),t.addEdge(r,i),t}pipe(e){return new kL({first:this,last:VL(e)})}pick(e){return this.pipe(new jL(e))}assign(e){return this.pipe(new $L(new GL({steps:e})))}async*transform(e,t){let n;for await(const r of e)n=void 0===n?r:this._concatOutputChunks(n,r);yield*this._streamIterator(n,lR(t))}async*streamLog(e,t,n){const r=new KR({...n,autoClose:!1,_schemaFormat:"original"}),i=lR(t);yield*this._streamLog(e,r,i)}async*_streamLog(e,t,n){const{callbacks:r}=n;if(void 0===r)n.callbacks=[t];else if(Array.isArray(r))n.callbacks=r.concat([t]);else{const e=r.copy();e.addHandler(t,!0),n.callbacks=e}const i=this.stream(e,n);const a=async function(){try{const e=await i;for await(const n of e){const e=new VR({ops:[{op:"add",path:"/streamed_output/-",value:n}]});await t.writer.write(e)}}finally{await t.writer.close()}}();try{for await(const e of t)yield e}finally{await a}}streamEvents(e,t,n){let r;if("v1"===t.version)r=this._streamEventsV1(e,t,n);else{if("v2"!==t.version)throw new Error('Only versions "v1" and "v2" of the schema are currently supported.');r=this._streamEventsV2(e,t,n)}return"text/event-stream"===t.encoding?function(e){const t=new TextEncoder,n=new ReadableStream({async start(n){for await(const r of e)n.enqueue(t.encode(`event: data\ndata: ${JSON.stringify(r)}\n\n`));n.enqueue(t.encode("event: end\n\n")),n.close()}});return fR.fromReadableStream(n)}(r):fR.fromAsyncGenerator(r)}async*_streamEventsV2(e,t,n){const r=new QR({...n,autoClose:!1}),i=lR(t),a=i.runId??Db();i.runId=a;const o=i.callbacks;if(void 0===o)i.callbacks=[r];else if(Array.isArray(o))i.callbacks=o.concat(r);else{const e=o.copy();e.addHandler(r,!0),i.callbacks=e}const s=new AbortController,c=this;const l=async function(){let t;try{if(i.signal)if("any"in AbortSignal)t=AbortSignal.any([s.signal,i.signal]);else{const e=new AbortController;i.signal.addEventListener("abort",()=>e.abort(),{once:!0}),s.signal.addEventListener("abort",()=>e.abort(),{once:!0}),t=e.signal}else t=s.signal;const n=await c.stream(e,{...i,signal:t}),o=r.tapOutputIterable(a,n);for await(const e of o)if(s.signal.aborted)break}finally{await r.finish()}}();let u,d=!1;try{for await(const t of r)d?(t.run_id===u&&t.event.endsWith("_end")&&t.data?.input&&delete t.data.input,yield t):(t.data.input=e,d=!0,u=t.run_id,yield t)}finally{s.abort(),await l}}async*_streamEventsV1(e,t,n){let r,i=!1;const a=lR(t),o=a.tags??[],s=a.metadata??{},c=a.runName??this.getName(),l=new KR({...n,autoClose:!1,_schemaFormat:"streaming_events"}),u=new CL({...n}),d=this._streamLog(e,l,a);for await(const h of d){if(r=r?r.concat(h):$R.fromRunLogPatch(h),void 0===r.state)throw new Error('Internal error: "streamEvents" state is missing. Please open a bug report.');if(!i){i=!0;const t={...r.state},n={run_id:t.id,event:`on_${t.type}_start`,name:c,tags:o,metadata:s,data:{input:e}};u.includeEvent(n,t.type)&&(yield n)}const t=h.ops.filter(e=>e.path.startsWith("/logs/")).map(e=>e.path.split("/")[2]),n=[...new Set(t)];for(const e of n){let t,n={};const i=r.state.logs[e];if(t=void 0===i.end_time?i.streamed_output.length>0?"stream":"start":"end","start"===t)void 0!==i.inputs&&(n.input=i.inputs);else if("end"===t)void 0!==i.inputs&&(n.input=i.inputs),n.output=i.final_output;else if("stream"===t){const e=i.streamed_output.length;if(1!==e)throw new Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${i.name}"`);n={chunk:i.streamed_output[0]},i.streamed_output=[]}yield{event:`on_${i.type}_${t}`,name:i.name,run_id:i.id,tags:i.tags,metadata:i.metadata,data:n}}const{state:a}=r;if(a.streamed_output.length>0){const e=a.streamed_output.length;if(1!==e)throw new Error(`Expected exactly one chunk of streamed output, got ${e} instead. Encountered in: "${a.name}"`);const t={chunk:a.streamed_output[0]};a.streamed_output=[];const n={event:`on_${a.type}_stream`,run_id:a.id,tags:o,metadata:s,name:c,data:t};u.includeEvent(n,a.type)&&(yield n)}}const p=r?.state;if(void 0!==p){const e={event:`on_${p.type}_end`,name:c,run_id:p.id,tags:o,metadata:s,data:{output:p.final_output}};u.includeEvent(e,p.type)&&(yield e)}}static isRunnable(e){return IL(e)}withListeners({onStart:e,onEnd:t,onError:n}){return new DL({bound:this,config:{},configFactories:[r=>({callbacks:[new yL({config:r,onStart:e,onEnd:t,onError:n})]})]})}asTool(e){return function(e,t){const n=t.name??e.getName(),r=t.description??Ly(t.schema);return function(e){return!!Py(e)&&(Ey(e)?"ZodString"===e._def.typeName:!!wy(e)&&"string"===e._zod.def.type)}(t.schema)?new WL({name:n,description:r,schema:bC({input:AC()}).transform(e=>e.input),bound:e}):new WL({name:n,description:r,schema:t.schema,bound:e})}(this,e)}},DL=class e extends ML{static lc_name(){return"RunnableBinding"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;bound;config;kwargs;configFactories;constructor(e){super(e),this.bound=e.bound,this.kwargs=e.kwargs,this.config=e.config,this.configFactories=e.configFactories}getName(e){return this.bound.getName(e)}async _mergeConfig(...e){const t=cR(this.config,...e);return cR(t,...this.configFactories?await Promise.all(this.configFactories.map(async e=>await e(t))):[])}withConfig(e){return new this.constructor({bound:this.bound,kwargs:this.kwargs,config:{...this.config,...e}})}withRetry(e){return new FL({bound:this.bound,kwargs:this.kwargs,config:this.config,maxAttemptNumber:e?.stopAfterAttempt,...e})}async invoke(e,t){return this.bound.invoke(e,await this._mergeConfig(t,this.kwargs))}async batch(e,t,n){const r=Array.isArray(t)?await Promise.all(t.map(async e=>this._mergeConfig(lR(e),this.kwargs))):await this._mergeConfig(lR(t),this.kwargs);return this.bound.batch(e,r,n)}_concatOutputChunks(e,t){return this.bound._concatOutputChunks(e,t)}async*_streamIterator(e,t){yield*this.bound._streamIterator(e,await this._mergeConfig(lR(t),this.kwargs))}async stream(e,t){return this.bound.stream(e,await this._mergeConfig(lR(t),this.kwargs))}async*transform(e,t){yield*this.bound.transform(e,await this._mergeConfig(lR(t),this.kwargs))}streamEvents(e,t,n){const r=this;return fR.fromAsyncGenerator(async function*(){yield*r.bound.streamEvents(e,{...await r._mergeConfig(lR(t),r.kwargs),version:t.version},n)}())}static isRunnableBinding(e){return e.bound&&ML.isRunnable(e.bound)}withListeners({onStart:t,onEnd:n,onError:r}){return new e({bound:this.bound,kwargs:this.kwargs,config:this.config,configFactories:[e=>({callbacks:[new yL({config:e,onStart:t,onEnd:n,onError:r})]})]})}},FL=class extends DL{static lc_name(){return"RunnableRetry"}lc_namespace=["langchain_core","runnables"];maxAttemptNumber=3;onFailedAttempt=()=>{};constructor(e){super(e),this.maxAttemptNumber=e.maxAttemptNumber??this.maxAttemptNumber,this.onFailedAttempt=e.onFailedAttempt??this.onFailedAttempt}_patchConfigForRetry(e,t,n){const r=e>1?`retry:attempt:${e}`:void 0;return uR(t,{callbacks:n?.getChild(r)})}async _invoke(e,t,n){return iL(r=>super.invoke(e,this._patchConfigForRetry(r,t,n)),{onFailedAttempt:({error:t})=>this.onFailedAttempt(t,e),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async _batch(e,t,n,r){const i={};try{await iL(async a=>{const o=e.map((e,t)=>t).filter(e=>void 0===i[e.toString()]||i[e.toString()]instanceof Error),s=o.map(t=>e[t]),c=o.map(e=>this._patchConfigForRetry(a,t?.[e],n?.[e])),l=await super.batch(s,c,{...r,returnExceptions:!0});let u;for(let e=0;e<l.length;e+=1){const t=l[e],n=o[e];t instanceof Error&&void 0===u&&(u=t,u.input=s[e]),i[n.toString()]=t}if(u)throw u;return l},{onFailedAttempt:({error:e})=>this.onFailedAttempt(e,e.input),retries:Math.max(this.maxAttemptNumber-1,0),randomize:!0})}catch(a){if(!0!==r?.returnExceptions)throw a}return Object.keys(i).sort((e,t)=>parseInt(e,10)-parseInt(t,10)).map(e=>i[parseInt(e,10)])}async batch(e,t,n){return this._batchWithConfig(this._batch.bind(this),e,t,n)}},kL=class e extends ML{static lc_name(){return"RunnableSequence"}first;middle=[];last;omitSequenceTags=!1;lc_serializable=!0;lc_namespace=["langchain_core","runnables"];constructor(e){super(e),this.first=e.first,this.middle=e.middle??this.middle,this.last=e.last,this.name=e.name,this.omitSequenceTags=e.omitSequenceTags??this.omitSequenceTags}get steps(){return[this.first,...this.middle,this.last]}async invoke(e,t){const n=lR(t),r=await((await sR(n))?.handleChainStart(this.toJSON(),BL(e,"input"),n.runId,void 0,void 0,void 0,n?.runName));delete n.runId;let i,a=e;try{const e=[this.first,...this.middle];for(let t=0;t<e.length;t+=1){const i=e[t].invoke(a,uR(n,{callbacks:r?.getChild(this.omitSequenceTags?void 0:`seq:step:${t+1}`)}));a=await pR(i,n.signal)}if(n.signal?.aborted)throw hR(n.signal);i=await this.last.invoke(a,uR(n,{callbacks:r?.getChild(this.omitSequenceTags?void 0:`seq:step:${this.steps.length}`)}))}catch(o){throw await(r?.handleChainError(o)),o}return await(r?.handleChainEnd(BL(i,"output"))),i}async batch(e,t,n){const r=this._getOptionsList(t??{},e.length),i=await Promise.all(r.map(sR)),a=await Promise.all(i.map(async(t,n)=>{const i=await(t?.handleChainStart(this.toJSON(),BL(e[n],"input"),r[n].runId,void 0,void 0,void 0,r[n].runName));return delete r[n].runId,i}));let o=e;try{for(let e=0;e<this.steps.length;e+=1){const t=this.steps[e].batch(o,a.map((t,n)=>{const i=t?.getChild(this.omitSequenceTags?void 0:`seq:step:${e+1}`);return uR(r[n],{callbacks:i})}),n);o=await pR(t,r[0]?.signal)}}catch(s){throw await Promise.all(a.map(e=>e?.handleChainError(s))),s}return await Promise.all(a.map(e=>e?.handleChainEnd(BL(o,"output")))),o}_concatOutputChunks(e,t){return this.last._concatOutputChunks(e,t)}async*_streamIterator(e,t){const n=await sR(t),{runId:r,...i}=t??{},a=await(n?.handleChainStart(this.toJSON(),BL(e,"input"),r,void 0,void 0,void 0,i?.runName)),o=[this.first,...this.middle,this.last];let s,c=!0;try{let n=o[0].transform(async function*(){yield e}(),uR(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:"seq:step:1")}));for(let e=1;e<o.length;e+=1)n=await o[e].transform(n,uR(i,{callbacks:a?.getChild(this.omitSequenceTags?void 0:`seq:step:${e+1}`)}));for await(const e of n)if(t?.signal?.throwIfAborted(),yield e,c)if(void 0===s)s=e;else try{s=this._concatOutputChunks(s,e)}catch{s=void 0,c=!1}}catch(l){throw await(a?.handleChainError(l)),l}await(a?.handleChainEnd(BL(s,"output")))}getGraph(e){const t=new wL;let n=null;return this.steps.forEach((r,i)=>{const a=r.getGraph(e);0!==i&&a.trimFirstNode(),i!==this.steps.length-1&&a.trimLastNode(),t.extend(a);const o=a.firstNode();if(!o)throw new Error(`Runnable ${r} has no first node`);n&&t.addEdge(n,o),n=a.lastNode()}),t}pipe(t){return e.isRunnableSequence(t)?new e({first:this.first,middle:this.middle.concat([this.last,t.first,...t.middle]),last:t.last,name:this.name??t.name}):new e({first:this.first,middle:[...this.middle,this.last],last:VL(t),name:this.name})}static isRunnableSequence(e){return Array.isArray(e.middle)&&ML.isRunnable(e)}static from([t,...n],r){let i={};return"string"==typeof r?i.name=r:void 0!==r&&(i=r),new e({...i,first:VL(t),middle:n.slice(0,-1).map(VL),last:VL(n[n.length-1])})}},GL=class e extends ML{static lc_name(){return"RunnableMap"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;steps;getStepsKeys(){return Object.keys(this.steps)}constructor(e){super(e),this.steps={};for(const[t,n]of Object.entries(e.steps))this.steps[t]=VL(n)}static from(t){return new e({steps:t})}async invoke(e,t){const n=lR(t),r=await((await sR(n))?.handleChainStart(this.toJSON(),{input:e},n.runId,void 0,void 0,void 0,n?.runName));delete n.runId;const i={};try{const t=Object.entries(this.steps).map(async([t,a])=>{i[t]=await a.invoke(e,uR(n,{callbacks:r?.getChild(`map:key:${t}`)}))});await pR(Promise.all(t),n.signal)}catch(a){throw await(r?.handleChainError(a)),a}return await(r?.handleChainEnd(i)),i}async*_transform(e,t,n){const r={...this.steps},i=mR(e,Object.keys(r).length),a=new Map(Object.entries(r).map(([e,r],a)=>{const o=r.transform(i[a],uR(n,{callbacks:t?.getChild(`map:key:${e}`)}));return[e,o.next().then(t=>({key:e,gen:o,result:t}))]}));for(;a.size;){const e=Promise.race(a.values()),{key:t,result:r,gen:i}=await pR(e,n?.signal);a.delete(t),r.done||(yield{[t]:r.value},a.set(t,i.next().then(e=>({key:t,gen:i,result:e}))))}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=lR(t),r=new yR({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,fR.fromAsyncGenerator(r)}},HL=class e extends ML{lc_serializable=!1;lc_namespace=["langchain_core","runnables"];func;constructor(e){if(super(e),!cv(e.func))throw new Error("RunnableTraceable requires a function that is wrapped in traceable higher-order function");this.func=e.func}async invoke(e,t){const[n]=this._getOptionsList(t??{},1),r=await sR(n);return pR(this.func(uR(n,{callbacks:r}),e),n?.signal)}async*_streamIterator(e,t){const[n]=this._getOptionsList(t??{},1),r=await this.invoke(e,t);var i;if(LL(r))for await(const a of r)n?.signal?.throwIfAborted(),yield a;else if(null!=(i=r)&&"object"==typeof i&&"next"in i&&"function"==typeof i.next)for(;;){n?.signal?.throwIfAborted();const e=r.next();if(e.done)break;yield e.value}else yield r}static from(t){return new e({func:t})}};var xL=class e extends ML{static lc_name(){return"RunnableLambda"}lc_namespace=["langchain_core","runnables"];func;constructor(e){if(cv(e.func))return HL.from(e.func);super(e),function(e){if(cv(e))throw new Error("RunnableLambda requires a function that is not wrapped in traceable higher-order function. This shouldn't happen.")}(e.func),this.func=e.func}static from(t){return new e({func:t})}async _invoke(e,t,n){return new Promise((r,i)=>{const a=uR(t,{callbacks:n?.getChild(),recursionLimit:(t?.recursionLimit??25)-1});rR.runWithConfig(dR(a),async()=>{try{let n=await this.func(e,{...a});if(n&&ML.isRunnable(n)){if(0===t?.recursionLimit)throw new Error("Recursion limit reached.");n=await n.invoke(e,{...a,recursionLimit:(a.recursionLimit??25)-1})}else if(LL(n)){let e;for await(const r of OL(a,n))if(t?.signal?.throwIfAborted(),void 0===e)e=r;else try{e=this._concatOutputChunks(e,r)}catch{e=r}n=e}else if(RL(n)){let e;for(const r of NL(a,n))if(t?.signal?.throwIfAborted(),void 0===e)e=r;else try{e=this._concatOutputChunks(e,r)}catch{e=r}n=e}r(n)}catch(n){i(n)}})})}async invoke(e,t){return this._callWithConfig(this._invoke.bind(this),e,t)}async*_transform(e,t,n){let r;for await(const o of e)if(void 0===r)r=o;else try{r=this._concatOutputChunks(r,o)}catch{r=o}const i=uR(n,{callbacks:t?.getChild(),recursionLimit:(n?.recursionLimit??25)-1}),a=await new Promise((e,t)=>{rR.runWithConfig(dR(i),async()=>{try{e(await this.func(r,{...i,config:i}))}catch(n){t(n)}})});if(a&&ML.isRunnable(a)){if(0===n?.recursionLimit)throw new Error("Recursion limit reached.");const e=await a.stream(r,i);for await(const t of e)yield t}else if(LL(a))for await(const o of OL(i,a))n?.signal?.throwIfAborted(),yield o;else if(RL(a))for(const o of NL(i,a))n?.signal?.throwIfAborted(),yield o;else yield a}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=lR(t),r=new yR({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,fR.fromAsyncGenerator(r)}},UL=class extends ML{static lc_name(){return"RunnableWithFallbacks"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;runnable;fallbacks;constructor(e){super(e),this.runnable=e.runnable,this.fallbacks=e.fallbacks}*runnables(){yield this.runnable;for(const e of this.fallbacks)yield e}async invoke(e,t){const n=lR(t),r=await sR(n),{runId:i,...a}=n,o=await(r?.handleChainStart(this.toJSON(),BL(e,"input"),i,void 0,void 0,void 0,a?.runName)),s=uR(a,{callbacks:o?.getChild()});return await rR.runWithConfig(s,async()=>{let t;for(const i of this.runnables()){n?.signal?.throwIfAborted();try{const t=await i.invoke(e,s);return await(o?.handleChainEnd(BL(t,"output"))),t}catch(r){void 0===t&&(t=r)}}if(void 0===t)throw new Error("No error stored at end of fallback.");throw await(o?.handleChainError(t)),t})}async*_streamIterator(e,t){const n=lR(t),r=await sR(n),{runId:i,...a}=n,o=await(r?.handleChainStart(this.toJSON(),BL(e,"input"),i,void 0,void 0,void 0,a?.runName));let s,c,l;for(const d of this.runnables()){n?.signal?.throwIfAborted();const t=uR(a,{callbacks:o?.getChild()});try{c=OL(t,await d.stream(e,t));break}catch(u){void 0===s&&(s=u)}}if(void 0===c){const e=s??/* @__PURE__ */new Error("No error stored at end of fallback.");throw await(o?.handleChainError(e)),e}try{for await(const e of c){yield e;try{l=void 0===l?l:this._concatOutputChunks(l,e)}catch{l=void 0}}}catch(u){throw await(o?.handleChainError(u)),u}await(o?.handleChainEnd(BL(l,"output")))}async batch(e,t,n){if(n?.returnExceptions)throw new Error("Not implemented.");const r=this._getOptionsList(t??{},e.length),i=await Promise.all(r.map(e=>sR(e))),a=await Promise.all(i.map(async(t,n)=>{const i=await(t?.handleChainStart(this.toJSON(),BL(e[n],"input"),r[n].runId,void 0,void 0,void 0,r[n].runName));return delete r[n].runId,i}));let o;for(const c of this.runnables()){r[0].signal?.throwIfAborted();try{const t=await c.batch(e,a.map((e,t)=>uR(r[t],{callbacks:e?.getChild()})),n);return await Promise.all(a.map((e,n)=>e?.handleChainEnd(BL(t[n],"output")))),t}catch(s){void 0===o&&(o=s)}}if(!o)throw new Error("No error stored at end of fallbacks.");throw await Promise.all(a.map(e=>e?.handleChainError(o))),o}};function VL(e){if("function"==typeof e)return new xL({func:e});if(ML.isRunnable(e))return e;if(Array.isArray(e)||"object"!=typeof e)throw new Error("Expected a Runnable, function or object.\nInstead got an unsupported type.");{const t={};for(const[n,r]of Object.entries(e))t[n]=VL(r);return new GL({steps:t})}}var $L=class extends ML{static lc_name(){return"RunnableAssign"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;mapper;constructor(e){e instanceof GL&&(e={mapper:e}),super(e),this.mapper=e.mapper}async invoke(e,t){const n=await this.mapper.invoke(e,t);return{...e,...n}}async*_transform(e,t,n){const r=this.mapper.getStepsKeys(),[i,a]=mR(e),o=this.mapper.transform(a,uR(n,{callbacks:t?.getChild()})),s=o.next();for await(const c of i){if("object"!=typeof c||Array.isArray(c))throw new Error("RunnableAssign can only be used with objects as input, got "+typeof c);const e=Object.fromEntries(Object.entries(c).filter(([e])=>!r.includes(e)));Object.keys(e).length>0&&(yield e)}yield(await s).value;for await(const c of o)yield c}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=lR(t),r=new yR({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,fR.fromAsyncGenerator(r)}},jL=class extends ML{static lc_name(){return"RunnablePick"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;keys;constructor(e){("string"==typeof e||Array.isArray(e))&&(e={keys:e}),super(e),this.keys=e.keys}async _pick(e){if("string"==typeof this.keys)return e[this.keys];{const t=this.keys.map(t=>[t,e[t]]).filter(e=>void 0!==e[1]);return 0===t.length?void 0:Object.fromEntries(t)}}async invoke(e,t){return this._callWithConfig(this._pick.bind(this),e,t)}async*_transform(e){for await(const t of e){const e=await this._pick(t);void 0!==e&&(yield e)}}transform(e,t){return this._transformStreamWithConfig(e,this._transform.bind(this),t)}async stream(e,t){const n=lR(t),r=new yR({generator:this.transform(async function*(){yield e}(),n),config:n});return await r.setup,fR.fromAsyncGenerator(r)}},WL=class extends DL{name;description;schema;constructor(e){super({bound:kL.from([xL.from(async e=>{let t;if(GS(e))try{t=await Ry(this.schema,e.args)}catch{throw new HS("Received tool input did not match expected schema",JSON.stringify(e.args))}else t=e;return t}).withConfig({runName:`${e.name}:parse_input`}),e.bound]).withConfig({runName:e.name}),config:e.config??{}}),this.name=e.name,this.description=e.description,this.schema=e.schema}static lc_name(){return"RunnableToolLike"}};var XL="0123456789abcdef".split(""),KL=[-2147483648,8388608,32768,128],YL=[24,16,8,0],qL=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],QL=[];function JL(e,t){t?(QL[0]=QL[16]=QL[1]=QL[2]=QL[3]=QL[4]=QL[5]=QL[6]=QL[7]=QL[8]=QL[9]=QL[10]=QL[11]=QL[12]=QL[13]=QL[14]=QL[15]=0,this.blocks=QL):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}JL.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw new Error(ERROR);if(null===e)throw new Error(ERROR);if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw new Error(ERROR);t=!0}for(var r,i,a=0,o=e.length,s=this.blocks;a<o;){if(this.hashed&&(this.hashed=!1,s[0]=this.block,this.block=s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),t)for(i=this.start;a<o&&i<64;++a)s[i>>>2]|=e[a]<<YL[3&i++];else for(i=this.start;a<o&&i<64;++a)(r=e.charCodeAt(a))<128?s[i>>>2]|=r<<YL[3&i++]:r<2048?(s[i>>>2]|=(192|r>>>6)<<YL[3&i++],s[i>>>2]|=(128|63&r)<<YL[3&i++]):r<55296||r>=57344?(s[i>>>2]|=(224|r>>>12)<<YL[3&i++],s[i>>>2]|=(128|r>>>6&63)<<YL[3&i++],s[i>>>2]|=(128|63&r)<<YL[3&i++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++a)),s[i>>>2]|=(240|r>>>18)<<YL[3&i++],s[i>>>2]|=(128|r>>>12&63)<<YL[3&i++],s[i>>>2]|=(128|r>>>6&63)<<YL[3&i++],s[i>>>2]|=(128|63&r)<<YL[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.block=s[16],this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},JL.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=KL[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},JL.prototype.hash=function(){var e,t,n,r,i,a,o,s,c,l=this.h0,u=this.h1,d=this.h2,p=this.h3,h=this.h4,f=this.h5,m=this.h6,g=this.h7,y=this.blocks;for(e=16;e<64;++e)t=((i=y[e-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,n=((i=y[e-2])>>>17|i<<15)^(i>>>19|i<<13)^i>>>10,y[e]=y[e-16]+t+y[e-7]+n|0;for(c=u&d,e=0;e<64;e+=4)this.first?(this.is224?(a=300032,g=(i=y[0]-1413257819)-150054599|0,p=i+24177077|0):(a=704751109,g=(i=y[0]-210244248)-1521486534|0,p=i+143694565|0),this.first=!1):(t=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),r=(a=l&u)^l&d^c,g=p+(i=g+(n=(h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(h&f^~h&m)+qL[e]+y[e])|0,p=i+(t+r)|0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),r=(o=p&l)^p&u^a,m=d+(i=f+(n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7))+(m&g^~m&h)+qL[e+1]+y[e+1])|0,t=((d=i+(t+r)|0)>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),r=(s=d&p)^d&l^o,f=u+(i=h+(n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7))+(f&m^~f&g)+qL[e+2]+y[e+2])|0,t=((u=i+(t+r)|0)>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),r=(c=u&d)^u&p^s,h=l+(i=h+(n=(f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&m^~f&g)+qL[e+3]+y[e+3])|0,l=i+(t+r)|0,this.chromeBugWorkAround=!0;this.h0=this.h0+l|0,this.h1=this.h1+u|0,this.h2=this.h2+d|0,this.h3=this.h3+p|0,this.h4=this.h4+h|0,this.h5=this.h5+f|0,this.h6=this.h6+m|0,this.h7=this.h7+g|0},JL.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=XL[e>>>28&15]+XL[e>>>24&15]+XL[e>>>20&15]+XL[e>>>16&15]+XL[e>>>12&15]+XL[e>>>8&15]+XL[e>>>4&15]+XL[15&e]+XL[t>>>28&15]+XL[t>>>24&15]+XL[t>>>20&15]+XL[t>>>16&15]+XL[t>>>12&15]+XL[t>>>8&15]+XL[t>>>4&15]+XL[15&t]+XL[n>>>28&15]+XL[n>>>24&15]+XL[n>>>20&15]+XL[n>>>16&15]+XL[n>>>12&15]+XL[n>>>8&15]+XL[n>>>4&15]+XL[15&n]+XL[r>>>28&15]+XL[r>>>24&15]+XL[r>>>20&15]+XL[r>>>16&15]+XL[r>>>12&15]+XL[r>>>8&15]+XL[r>>>4&15]+XL[15&r]+XL[i>>>28&15]+XL[i>>>24&15]+XL[i>>>20&15]+XL[i>>>16&15]+XL[i>>>12&15]+XL[i>>>8&15]+XL[i>>>4&15]+XL[15&i]+XL[a>>>28&15]+XL[a>>>24&15]+XL[a>>>20&15]+XL[a>>>16&15]+XL[a>>>12&15]+XL[a>>>8&15]+XL[a>>>4&15]+XL[15&a]+XL[o>>>28&15]+XL[o>>>24&15]+XL[o>>>20&15]+XL[o>>>16&15]+XL[o>>>12&15]+XL[o>>>8&15]+XL[o>>>4&15]+XL[15&o];return this.is224||(c+=XL[s>>>28&15]+XL[s>>>24&15]+XL[s>>>20&15]+XL[s>>>16&15]+XL[s>>>12&15]+XL[s>>>8&15]+XL[s>>>4&15]+XL[15&s]),c},JL.prototype.toString=JL.prototype.hex,JL.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3,i=this.h4,a=this.h5,o=this.h6,s=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r,i>>>24&255,i>>>16&255,i>>>8&255,255&i,a>>>24&255,a>>>16&255,a>>>8&255,255&a,o>>>24&255,o>>>16&255,o>>>8&255,255&o];return this.is224||c.push(s>>>24&255,s>>>16&255,s>>>8&255,255&s),c},JL.prototype.array=JL.prototype.digest,JL.prototype.arrayBuffer=function(){this.finalize();var e=/* @__PURE__ */new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),e};const zL=(...e)=>((...e)=>new JL(!1,!0).update(e.join("")).hex())(e.join("_"));var ZL=class{keyEncoder=zL;makeDefaultKeyEncoder(e){this.keyEncoder=e}};const eN=/* @__PURE__ */new Map;var tN=class e extends ZL{cache;constructor(e){super(),this.cache=e??/* @__PURE__ */new Map}lookup(e,t){return Promise.resolve(this.cache.get(this.keyEncoder(e,t))??null)}async update(e,t,n){this.cache.set(this.keyEncoder(e,t),n)}static global(){return new e(eN)}},nN=class extends pA{},rN=class extends nN{static lc_name(){return"StringPromptValue"}lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;value;constructor(e){super({value:e}),this.value=e}toString(){return this.value}toChatMessages(){return[new XS(this.value)]}},iN=class extends nN{lc_namespace=["langchain_core","prompt_values"];lc_serializable=!0;static lc_name(){return"ChatPromptValue"}messages;constructor(e){Array.isArray(e)&&(e={messages:e}),super(e),this.messages=e.messages}toString(){return nb(this.messages)}toChatMessages(){return this.messages}};const aN=/* @__PURE__ */xi(dd());var oN=Object.defineProperty;function sN(e,t){return 1===e.length?[t.get(e.join(","))]:function(e,t){let n=Array.from({length:e.length},(e,t)=>({start:t,end:t+1}));for(;n.length>1;){let r=null;for(let i=0;i<n.length-1;i++){const a=e.slice(n[i].start,n[i+1].end),o=t.get(a.join(","));null!=o&&(null==r||o<r[0])&&(r=[o,i])}if(null==r)break;{const e=r[1];n[e]={start:n[e].start,end:n[e+1].end},n.splice(e+1,1)}}return n}(e,t).map(n=>t.get(e.slice(n.start,n.end).join(","))).filter(e=>null!=e)}var cN=class{specialTokens;inverseSpecialTokens;patStr;textEncoder=new TextEncoder;textDecoder=new TextDecoder("utf-8");rankMap=/* @__PURE__ */new Map;textMap=/* @__PURE__ */new Map;constructor(e,t){this.patStr=e.pat_str;const n=e.bpe_ranks.split("\n").filter(Boolean).reduce((e,t)=>{const[n,r,...i]=t.split(" "),a=Number.parseInt(r,10);return i.forEach((t,n)=>e[t]=a+n),e},{});for(const[r,i]of Object.entries(n)){const e=aN.toByteArray(r);this.rankMap.set(e.join(","),i),this.textMap.set(i,e)}this.specialTokens={...e.special_tokens,...t},this.inverseSpecialTokens=Object.entries(this.specialTokens).reduce((e,[t,n])=>(e[n]=this.textEncoder.encode(t),e),{})}encode(e,t=[],n="all"){const r=new RegExp(this.patStr,"ug"),i=cN.specialTokenRegex(Object.keys(this.specialTokens)),a=[],o=new Set("all"===t?Object.keys(this.specialTokens):t),s=new Set("all"===n?Object.keys(this.specialTokens).filter(e=>!o.has(e)):n);if(s.size>0){const t=cN.specialTokenRegex([...s]),n=e.match(t);if(null!=n)throw new Error(`The text contains a special token that is not allowed: ${n[0]}`)}let c=0;for(;;){let t=null,n=c;for(;i.lastIndex=n,t=i.exec(e),null!=t&&!o.has(t[0]);)n=t.index+1;const s=t?.index??e.length;for(const i of e.substring(c,s).matchAll(r)){const e=this.textEncoder.encode(i[0]),t=this.rankMap.get(e.join(","));null==t?a.push(...sN(e,this.rankMap)):a.push(t)}if(null==t)break;let l=this.specialTokens[t[0]];a.push(l),c=t.index+t[0].length}return a}decode(e){const t=[];let n=0;for(let a=0;a<e.length;++a){const r=e[a],i=this.textMap.get(r)??this.inverseSpecialTokens[r];null!=i&&(t.push(i),n+=i.length)}const r=new Uint8Array(n);let i=0;for(const a of t)r.set(a,i),i+=a.length;return this.textDecoder.decode(r)}},lN=cN;((e,t,n)=>{t in e?oN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n})(lN,"specialTokenRegex"+"",e=>new RegExp(e.map(e=>e.replace(/[\\^$*+?.()|[\]{}]/g,"\\$&")).join("|"),"g"));const uN={},dN=/* @__PURE__ */new gL({});async function pN(e){return async function(e){return e in uN||(uN[e]=dN.fetch(`https://tiktoken.pages.dev/js/${e}.json`).then(e=>e.json()).then(e=>new lN(e)).catch(t=>{throw delete uN[e],t})),await uN[e]}(function(e){switch(e){case"gpt2":return"gpt2";case"code-cushman-001":case"code-cushman-002":case"code-davinci-001":case"code-davinci-002":case"cushman-codex":case"davinci-codex":case"davinci-002":case"text-davinci-002":case"text-davinci-003":return"p50k_base";case"code-davinci-edit-001":case"text-davinci-edit-001":return"p50k_edit";case"ada":case"babbage":case"babbage-002":case"code-search-ada-code-001":case"code-search-babbage-code-001":case"curie":case"davinci":case"text-ada-001":case"text-babbage-001":case"text-curie-001":case"text-davinci-001":case"text-search-ada-doc-001":case"text-search-babbage-doc-001":case"text-search-curie-doc-001":case"text-search-davinci-doc-001":case"text-similarity-ada-001":case"text-similarity-babbage-001":case"text-similarity-curie-001":case"text-similarity-davinci-001":return"r50k_base";case"gpt-3.5-turbo-instruct-0914":case"gpt-3.5-turbo-instruct":case"gpt-3.5-turbo-16k-0613":case"gpt-3.5-turbo-16k":case"gpt-3.5-turbo-0613":case"gpt-3.5-turbo-0301":case"gpt-3.5-turbo":case"gpt-4-32k-0613":case"gpt-4-32k-0314":case"gpt-4-32k":case"gpt-4-0613":case"gpt-4-0314":case"gpt-4":case"gpt-3.5-turbo-1106":case"gpt-35-turbo":case"gpt-4-1106-preview":case"gpt-4-vision-preview":case"gpt-3.5-turbo-0125":case"gpt-4-turbo":case"gpt-4-turbo-2024-04-09":case"gpt-4-turbo-preview":case"gpt-4-0125-preview":case"text-embedding-ada-002":case"text-embedding-3-small":case"text-embedding-3-large":return"cl100k_base";case"gpt-4o":case"gpt-4o-2024-05-13":case"gpt-4o-2024-08-06":case"gpt-4o-2024-11-20":case"gpt-4o-mini-2024-07-18":case"gpt-4o-mini":case"gpt-4o-search-preview":case"gpt-4o-search-preview-2025-03-11":case"gpt-4o-mini-search-preview":case"gpt-4o-mini-search-preview-2025-03-11":case"gpt-4o-audio-preview":case"gpt-4o-audio-preview-2024-12-17":case"gpt-4o-audio-preview-2024-10-01":case"gpt-4o-mini-audio-preview":case"gpt-4o-mini-audio-preview-2024-12-17":case"o1":case"o1-2024-12-17":case"o1-mini":case"o1-mini-2024-09-12":case"o1-preview":case"o1-preview-2024-09-12":case"o1-pro":case"o1-pro-2025-03-19":case"o3":case"o3-2025-04-16":case"o3-mini":case"o3-mini-2025-01-31":case"o4-mini":case"o4-mini-2025-04-16":case"chatgpt-4o-latest":case"gpt-4o-realtime":case"gpt-4o-realtime-preview-2024-10-01":case"gpt-4o-realtime-preview-2024-12-17":case"gpt-4o-mini-realtime-preview":case"gpt-4o-mini-realtime-preview-2024-12-17":case"gpt-4.1":case"gpt-4.1-2025-04-14":case"gpt-4.1-mini":case"gpt-4.1-mini-2025-04-14":case"gpt-4.1-nano":case"gpt-4.1-nano-2025-04-14":case"gpt-4.5-preview":case"gpt-4.5-preview-2025-02-27":case"gpt-5":case"gpt-5-2025-08-07":case"gpt-5-nano":case"gpt-5-nano-2025-08-07":case"gpt-5-mini":case"gpt-5-mini-2025-08-07":case"gpt-5-chat-latest":return"o200k_base";default:throw new Error("Unknown model")}}(e))}var hN=class extends ML{verbose;callbacks;tags;metadata;get lc_attributes(){return{callbacks:void 0,verbose:void 0}}constructor(e){super(e),this.verbose=e.verbose??!1,this.callbacks=e.callbacks,this.tags=e.tags??[],this.metadata=e.metadata??{},this._addVersion("@langchain/core","1.2.10")}_addVersion(e,t){const n=this.metadata?.versions;this.metadata={...this.metadata,versions:{..."object"==typeof n&&null!==n?n:{},[e]:t}}}},fN=class extends hN{get callKeys(){return["stop","timeout","signal","tags","metadata","callbacks"]}caller;cache;constructor({callbacks:e,callbackManager:t,...n}){const{cache:r,...i}=n;super({callbacks:e??t,...i}),this.cache="object"==typeof r?r:r?tN.global():void 0,this.caller=new gL(n??{})}_encoding;async getNumTokens(e){let t;t="string"==typeof e?e:e.map(e=>"string"==typeof e?e:"text"===e.type&&"text"in e?e.text:"").join("");let n=Math.ceil(t.length/4);if(!this._encoding)try{this._encoding=await pN("modelName"in this?(r=this.modelName,r.startsWith("gpt-5")?"gpt-5":r.startsWith("gpt-3.5-turbo-16k")?"gpt-3.5-turbo-16k":r.startsWith("gpt-3.5-turbo-")?"gpt-3.5-turbo":r.startsWith("gpt-4-32k")?"gpt-4-32k":r.startsWith("gpt-4-")?"gpt-4":r.startsWith("gpt-4o")?"gpt-4o":r):"gpt2")}catch(i){console.warn("Failed to calculate number of tokens, falling back to approximate count",i)}var r;if(this._encoding)try{n=this._encoding.encode(t).length}catch(i){console.warn("Failed to calculate number of tokens, falling back to approximate count",i)}return n}static _convertInputToPromptValue(e){return"string"==typeof e?new rN(e):Array.isArray(e)?new iN(e.map(eb)):e}_identifyingParams(){return{}}_getSerializedCacheKeyParametersForCall({config:e,...t}){const n={...this._identifyingParams(),...t,_type:this._llmType(),_model:this._modelType()};return Object.entries(n).filter(([e,t])=>void 0!==t).map(([e,t])=>`${e}:${JSON.stringify(t)}`).sort().join(",")}serialize(){return{...this._identifyingParams(),_type:this._llmType(),_model:this._modelType()}}static async deserialize(e){throw new Error("Use .toJSON() instead")}get profile(){return{}}_filterInvocationParamsForTracing(e){const{tools:t,functions:n,messages:r,response_format:i,...a}=e;return a}};function mN(e){return new(0,e.constructor)({...e,content:e.contentBlocks,response_metadata:{...e.response_metadata,output_version:"v1"}})}var gN=class extends ML{static lc_name(){return"RunnablePassthrough"}lc_namespace=["langchain_core","runnables"];lc_serializable=!0;func;constructor(e){super(e),e&&(this.func=e.func)}async invoke(e,t){const n=lR(t);return this.func&&await this.func(e,n),this._callWithConfig(e=>Promise.resolve(e),e,n)}async*transform(e,t){const n=lR(t);let r,i=!0;for await(const a of this._transformStreamWithConfig(e,e=>e,n))if(yield a,i)if(void 0===r)r=a;else try{r=gR(r,a)}catch{r=void 0,i=!1}this.func&&void 0!==r&&await this.func(r,n)}static assign(e){return new $L(new GL({steps:e}))}},yN=class extends ML{parseResultWithPrompt(e,t,n){return this.parseResult(e,n)}_baseMessageToString(e){return"string"==typeof e.content?e.content:this._baseMessageContentToString(e.content)}_baseMessageContentToString(e){return JSON.stringify(e)}async invoke(e,t){return"string"==typeof e?this._callWithConfig(async(e,t)=>this.parseResult([{text:e}],t?.callbacks),e,{...t,runType:"parser"}):this._callWithConfig(async(e,t)=>this.parseResult([{message:e,text:this._baseMessageToString(e)}],t?.callbacks),e,{...t,runType:"parser"})}},IN=class extends yN{parseResult(e,t){return this.parse(e[0].text,t)}async parseWithPrompt(e,t,n){return this.parse(e,n)}_type(){throw new Error("_type not implemented")}},CN=class extends Error{llmOutput;observation;sendToLLM;constructor(e,t,n,r=!1){if(super(e),this.llmOutput=t,this.observation=n,this.sendToLLM=r,r&&(void 0===n||void 0===t))throw new Error("Arguments 'observation' & 'llmOutput' are required if 'sendToLlm' is true");OS(this,"OUTPUT_PARSING_FAILURE")}},AN=class extends IN{async*_transform(e){for await(const t of e)"string"==typeof t?yield this.parseResult([{text:t}]):yield this.parseResult([{message:t,text:this._baseMessageToString(t)}])}async*transform(e,t){yield*this._transformStreamWithConfig(e,this._transform.bind(this),{...t,runType:"parser"})}},SN=class extends AN{diff=!1;constructor(e){super(e),this.diff=e?.diff??this.diff}async*_transform(e){let t,n;for await(const r of e){if("string"!=typeof r&&"string"!=typeof r.content)throw new Error("Cannot handle non-string output.");let e;if(tS(r)){if("string"!=typeof r.content)throw new Error("Cannot handle non-string message output.");e=new AR({message:r,text:r.content})}else if(eS(r)){if("string"!=typeof r.content)throw new Error("Cannot handle non-string message output.");e=new AR({message:rb(r),text:r.content})}else e=new CR({text:r});n=void 0===n?e:n.concat(e);const i=await this.parsePartialResult([n]);null==i||tA(i,t)||(this.diff?yield this._diff(t,i):yield i,t=i)}}getFormatInstructions(){return""}},bN=class extends SN{static lc_name(){return"JsonOutputParser"}lc_namespace=["langchain_core","output_parsers"];lc_serializable=!0;_concatOutputChunks(e,t){return this.diff?super._concatOutputChunks(e,t):t}_diff(e,t){if(t)return e?UR(e,t):[{op:"replace",path:"",value:t}]}async parsePartialResult(e){return xS(e[0].text)}async parse(e){return xS(e,JSON.parse)}getFormatInstructions(){return""}_baseMessageToString(e){return e.text}},TN=class extends IN{static lc_name(){return"StandardSchemaOutputParser"}lc_namespace=["langchain","output_parsers","standard_schema"];schema;constructor(e){super(),this.schema=e}static fromSerializableSchema(e){return new this(e)}async parse(e){try{const t=xS(e,JSON.parse),n=await this.schema["~standard"].validate(t);if(n.issues)throw new Error(`Validation failed: ${JSON.stringify(n.issues)}`);return n.value}catch(t){throw new CN(`Failed to parse. Text: "${e}". Error: ${t}`,e)}}_baseMessageToString(e){return e.text}getFormatInstructions(){return""}},vN=class extends IN{schema;static lc_name(){return"StructuredOutputParser"}lc_namespace=["langchain","output_parsers","structured"];toJSON(){return this.toJSONNotImplemented()}constructor(e){super(e),this.schema=e}static fromZodSchema(e){return new this(e)}static fromNamesAndDescriptions(e){return new this(bC(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,AC().describe(t)]))))}getFormatInstructions(){return`You must format your output as a JSON value that adheres to a given "JSON Schema" instance.\n\n"JSON Schema" is a declarative language that allows you to annotate and validate JSON documents.\n\nFor example, the example "JSON Schema" instance {{"properties": {{"foo": {{"description": "a list of test words", "type": "array", "items": {{"type": "string"}}}}}}, "required": ["foo"]}}\nwould match an object with one required property, "foo". The "type" property specifies "foo" must be an "array", and the "description" property semantically describes it as "a list of test words". The items within "foo" must be strings.\nThus, the object {{"foo": ["bar", "baz"]}} is a well-formatted instance of this example "JSON Schema". The object {{"properties": {{"foo": ["bar", "baz"]}}}} is not well-formatted.\n\nYour output will be parsed and type-checked according to the provided schema instance, so make sure all fields in your output match the schema exactly and there are no trailing commas!\n\nHere is the JSON Schema instance your output must adhere to. Include the enclosing markdown codeblock:\n\`\`\`json\n${JSON.stringify(rA(this.schema))}\n\`\`\`\n`}async parse(e){try{const t=e.trim(),n=(t.match(/^```(?:json)?\s*([\s\S]*?)```/)?.[1]||t.match(/```json\s*([\s\S]*?)```/)?.[1]||t).replace(/"([^"\\]*(\\.[^"\\]*)*)"/g,(e,t)=>`"${t.replace(/\n/g,"\\n")}"`).replace(/\n/g,"");return await Ry(this.schema,JSON.parse(n))}catch(t){throw new CN(`Failed to parse. Text: "${e}". Error: ${t}`,e)}}_baseMessageToString(e){return e.text}};function _N(e,t){if(void 0===e.function)return;let n;if(t?.partial)try{n=VS(e.function.arguments??"{}")}catch{return}else try{n=JSON.parse(e.function.arguments)}catch(i){throw new CN([`Function "${e.function.name}" arguments:`,"",e.function.arguments,"","are not valid JSON.",`Error: ${i.message}`].join("\n"))}const r={name:e.function.name,args:n,type:"tool_call"};return t?.returnId&&(r.id=e.id),r}function wN(e){if(void 0===e.id)throw new Error('All OpenAI tool calls must have an "id" field.');return{id:e.id,type:"function",function:{name:e.name,arguments:JSON.stringify(e.args)}}}function EN(e,t){return{name:e.function?.name,args:e.function?.arguments,id:e.id,error:t,type:"invalid_tool_call"}}!function(){const e={parser:function(e,t){return new n(e,t)}};e.SAXParser=n,e.SAXStream=a,e.createStream=function(e,t){return new a(e,t)},e.MAX_BUFFER_LENGTH=65536;const t=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function n(r,i){if(!(this instanceof n))return new n(r,i);var a=this;!function(e){for(var n=0,r=t.length;n<r;n++)e[t[n]]=""}(a),a.q=a.c="",a.bufferCheckPosition=e.MAX_BUFFER_LENGTH,a.opt=i||{},a.opt.lowercase=a.opt.lowercase||a.opt.lowercasetags,a.looseCase=a.opt.lowercase?"toLowerCase":"toUpperCase",a.tags=[],a.closed=a.closedRoot=a.sawRoot=!1,a.tag=a.error=null,a.strict=!!r,a.noscript=!(!r&&!a.opt.noscript),a.state=T.BEGIN,a.strictEntities=a.opt.strictEntities,a.ENTITIES=a.strictEntities?Object.create(e.XML_ENTITIES):Object.create(e.ENTITIES),a.attribList=[],a.opt.xmlns&&(a.ns=Object.create(u)),a.trackPosition=!1!==a.opt.position,a.trackPosition&&(a.position=a.line=a.column=0),_(a,"onready")}e.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],Object.create||(Object.create=function(e){function t(){}return t.prototype=e,new t}),Object.keys||(Object.keys=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}),n.prototype={end:function(){L(this)},write:function(n){var r=this;if(this.error)throw this.error;if(r.closed)return R(r,"Cannot write after close. Assign an onready handler.");if(null===n)return L(r);"object"==typeof n&&(n=n.toString());var i=0,a="";for(;a=H(n,i++),r.c=a,a;)switch(r.trackPosition&&(r.position++,"\n"===a?(r.line++,r.column=0):r.column++),r.state){case T.BEGIN:if(r.state=T.BEGIN_WHITESPACE,"\ufeff"===a)continue;G(r,a);continue;case T.BEGIN_WHITESPACE:G(r,a);continue;case T.TEXT:if(r.sawRoot&&!r.closedRoot){for(var c=i-1;a&&"<"!==a&&"&"!==a;)(a=H(n,i++))&&r.trackPosition&&(r.position++,"\n"===a?(r.line++,r.column=0):r.column++);r.textNode+=n.substring(c,i-1)}"<"!==a||r.sawRoot&&r.closedRoot&&!r.strict?(m(a)||r.sawRoot&&!r.closedRoot||N(r,"Text data outside of root node."),"&"===a?r.state=T.TEXT_ENTITY:r.textNode+=a):(r.state=T.OPEN_WAKA,r.startTagPosition=r.position);continue;case T.SCRIPT:"<"===a?r.state=T.SCRIPT_ENDING:r.script+=a;continue;case T.SCRIPT_ENDING:"/"===a?r.state=T.CLOSE_TAG:(r.script+="<"+a,r.state=T.SCRIPT);continue;case T.OPEN_WAKA:if("!"===a)r.state=T.SGML_DECL,r.sgmlDecl="";else if(m(a));else if(I(d,a))r.state=T.OPEN_TAG,r.tagName=a;else if("/"===a)r.state=T.CLOSE_TAG,r.tagName="";else if("?"===a)r.state=T.PROC_INST,r.procInstName=r.procInstBody="";else{if(N(r,"Unencoded <"),r.startTagPosition+1<r.position){var l=r.position-r.startTagPosition;a=new Array(l).join(" ")+a}r.textNode+="<"+a,r.state=T.TEXT}continue;case T.SGML_DECL:(r.sgmlDecl+a).toUpperCase()===o?(w(r,"onopencdata"),r.state=T.CDATA,r.sgmlDecl="",r.cdata=""):r.sgmlDecl+a==="--"?(r.state=T.COMMENT,r.comment="",r.sgmlDecl=""):(r.sgmlDecl+a).toUpperCase()===s?(r.state=T.DOCTYPE,(r.doctype||r.sawRoot)&&N(r,"Inappropriately located doctype declaration"),r.doctype="",r.sgmlDecl=""):">"===a?(w(r,"onsgmldeclaration",r.sgmlDecl),r.sgmlDecl="",r.state=T.TEXT):g(a)?(r.state=T.SGML_DECL_QUOTED,r.sgmlDecl+=a):r.sgmlDecl+=a;continue;case T.SGML_DECL_QUOTED:a===r.q&&(r.state=T.SGML_DECL,r.q=""),r.sgmlDecl+=a;continue;case T.DOCTYPE:">"===a?(r.state=T.TEXT,w(r,"ondoctype",r.doctype),r.doctype=!0):(r.doctype+=a,"["===a?r.state=T.DOCTYPE_DTD:g(a)&&(r.state=T.DOCTYPE_QUOTED,r.q=a));continue;case T.DOCTYPE_QUOTED:r.doctype+=a,a===r.q&&(r.q="",r.state=T.DOCTYPE);continue;case T.DOCTYPE_DTD:r.doctype+=a,"]"===a?r.state=T.DOCTYPE:g(a)&&(r.state=T.DOCTYPE_DTD_QUOTED,r.q=a);continue;case T.DOCTYPE_DTD_QUOTED:r.doctype+=a,a===r.q&&(r.state=T.DOCTYPE_DTD,r.q="");continue;case T.COMMENT:"-"===a?r.state=T.COMMENT_ENDING:r.comment+=a;continue;case T.COMMENT_ENDING:"-"===a?(r.state=T.COMMENT_ENDED,r.comment=P(r.opt,r.comment),r.comment&&w(r,"oncomment",r.comment),r.comment=""):(r.comment+="-"+a,r.state=T.COMMENT);continue;case T.COMMENT_ENDED:">"!==a?(N(r,"Malformed comment"),r.comment+="--"+a,r.state=T.COMMENT):r.state=T.TEXT;continue;case T.CDATA:"]"===a?r.state=T.CDATA_ENDING:r.cdata+=a;continue;case T.CDATA_ENDING:"]"===a?r.state=T.CDATA_ENDING_2:(r.cdata+="]"+a,r.state=T.CDATA);continue;case T.CDATA_ENDING_2:">"===a?(r.cdata&&w(r,"oncdata",r.cdata),w(r,"onclosecdata"),r.cdata="",r.state=T.TEXT):"]"===a?r.cdata+="]":(r.cdata+="]]"+a,r.state=T.CDATA);continue;case T.PROC_INST:"?"===a?r.state=T.PROC_INST_ENDING:m(a)?r.state=T.PROC_INST_BODY:r.procInstName+=a;continue;case T.PROC_INST_BODY:if(!r.procInstBody&&m(a))continue;"?"===a?r.state=T.PROC_INST_ENDING:r.procInstBody+=a;continue;case T.PROC_INST_ENDING:">"===a?(w(r,"onprocessinginstruction",{name:r.procInstName,body:r.procInstBody}),r.procInstName=r.procInstBody="",r.state=T.TEXT):(r.procInstBody+="?"+a,r.state=T.PROC_INST_BODY);continue;case T.OPEN_TAG:I(p,a)?r.tagName+=a:(O(r),">"===a?D(r):"/"===a?r.state=T.OPEN_TAG_SLASH:(m(a)||N(r,"Invalid character in tag name"),r.state=T.ATTRIB));continue;case T.OPEN_TAG_SLASH:">"===a?(D(r,!0),F(r)):(N(r,"Forward-slash in opening tag not followed by >"),r.state=T.ATTRIB);continue;case T.ATTRIB:if(m(a))continue;">"===a?D(r):"/"===a?r.state=T.OPEN_TAG_SLASH:I(d,a)?(r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case T.ATTRIB_NAME:"="===a?r.state=T.ATTRIB_VALUE:">"===a?(N(r,"Attribute without value"),r.attribValue=r.attribName,M(r),D(r)):m(a)?r.state=T.ATTRIB_NAME_SAW_WHITE:I(p,a)?r.attribName+=a:N(r,"Invalid attribute name");continue;case T.ATTRIB_NAME_SAW_WHITE:if("="===a)r.state=T.ATTRIB_VALUE;else{if(m(a))continue;N(r,"Attribute without value"),r.tag.attributes[r.attribName]="",r.attribValue="",w(r,"onattribute",{name:r.attribName,value:""}),r.attribName="",">"===a?D(r):I(d,a)?(r.attribName=a,r.state=T.ATTRIB_NAME):(N(r,"Invalid attribute name"),r.state=T.ATTRIB)}continue;case T.ATTRIB_VALUE:if(m(a))continue;g(a)?(r.q=a,r.state=T.ATTRIB_VALUE_QUOTED):(N(r,"Unquoted attribute value"),r.state=T.ATTRIB_VALUE_UNQUOTED,r.attribValue=a);continue;case T.ATTRIB_VALUE_QUOTED:if(a!==r.q){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_Q:r.attribValue+=a;continue}M(r),r.q="",r.state=T.ATTRIB_VALUE_CLOSED;continue;case T.ATTRIB_VALUE_CLOSED:m(a)?r.state=T.ATTRIB:">"===a?D(r):"/"===a?r.state=T.OPEN_TAG_SLASH:I(d,a)?(N(r,"No whitespace between attributes"),r.attribName=a,r.attribValue="",r.state=T.ATTRIB_NAME):N(r,"Invalid attribute name");continue;case T.ATTRIB_VALUE_UNQUOTED:if(!y(a)){"&"===a?r.state=T.ATTRIB_VALUE_ENTITY_U:r.attribValue+=a;continue}M(r),">"===a?D(r):r.state=T.ATTRIB;continue;case T.CLOSE_TAG:if(r.tagName)">"===a?F(r):I(p,a)?r.tagName+=a:r.script?(r.script+="</"+r.tagName,r.tagName="",r.state=T.SCRIPT):(m(a)||N(r,"Invalid tagname in closing tag"),r.state=T.CLOSE_TAG_SAW_WHITE);else{if(m(a))continue;C(d,a)?r.script?(r.script+="</"+a,r.state=T.SCRIPT):N(r,"Invalid tagname in closing tag."):r.tagName=a}continue;case T.CLOSE_TAG_SAW_WHITE:if(m(a))continue;">"===a?F(r):N(r,"Invalid characters in closing tag");continue;case T.TEXT_ENTITY:case T.ATTRIB_VALUE_ENTITY_Q:case T.ATTRIB_VALUE_ENTITY_U:var u,A;switch(r.state){case T.TEXT_ENTITY:u=T.TEXT,A="textNode";break;case T.ATTRIB_VALUE_ENTITY_Q:u=T.ATTRIB_VALUE_QUOTED,A="attribValue";break;case T.ATTRIB_VALUE_ENTITY_U:u=T.ATTRIB_VALUE_UNQUOTED,A="attribValue"}if(";"===a)if(r.opt.unparsedEntities){var S=k(r);r.entity="",r.state=u,r.write(S)}else r[A]+=k(r),r.entity="",r.state=u;else I(r.entity.length?f:h,a)?r.entity+=a:(N(r,"Invalid character in entity name"),r[A]+="&"+r.entity+a,r.entity="",r.state=u);continue;default:throw new Error(r,"Unknown state: "+r.state)}r.position>=r.bufferCheckPosition&&function(n){for(var r=Math.max(e.MAX_BUFFER_LENGTH,10),i=0,a=0,o=t.length;a<o;a++){var s=n[t[a]].length;if(s>r)switch(t[a]){case"textNode":E(n);break;case"cdata":w(n,"oncdata",n.cdata),n.cdata="";break;case"script":w(n,"onscript",n.script),n.script="";break;default:R(n,"Max buffer length exceeded: "+t[a])}i=Math.max(i,s)}n.bufferCheckPosition=e.MAX_BUFFER_LENGTH-i+n.position}(r);return r},resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var e;E(e=this),""!==e.cdata&&(w(e,"oncdata",e.cdata),e.cdata=""),""!==e.script&&(w(e,"onscript",e.script),e.script="")}};var r=ReadableStream;r||(r=function(){});var i=e.EVENTS.filter(function(e){return"error"!==e&&"end"!==e});function a(e,t){if(!(this instanceof a))return new a(e,t);r.apply(this),this._parser=new n(e,t),this.writable=!0,this.readable=!0;var o=this;this._parser.onend=function(){o.emit("end")},this._parser.onerror=function(e){o.emit("error",e),o._parser.error=null},this._decoder=null,i.forEach(function(e){Object.defineProperty(o,"on"+e,{get:function(){return o._parser["on"+e]},set:function(t){if(!t)return o.removeAllListeners(e),o._parser["on"+e]=t,t;o.on(e,t)},enumerable:!0,configurable:!1})})}a.prototype=Object.create(r.prototype,{constructor:{value:a}}),a.prototype.write=function(e){return this._parser.write(e.toString()),this.emit("data",e),!0},a.prototype.end=function(e){return e&&e.length&&this.write(e),this._parser.end(),!0},a.prototype.on=function(e,t){var n=this;return n._parser["on"+e]||-1===i.indexOf(e)||(n._parser["on"+e]=function(){var t=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);t.splice(0,0,e),n.emit.apply(n,t)}),r.prototype.on.call(n,e,t)};var o="[CDATA[",s="DOCTYPE",c="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/2000/xmlns/",u={xml:c,xmlns:l},d=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,p=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,h=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,f=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function m(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function g(e){return'"'===e||"'"===e}function y(e){return">"===e||m(e)}function I(e,t){return e.test(t)}function C(e,t){return!I(e,t)}var A,S,b,T=0;for(var v in e.STATE={BEGIN:T++,BEGIN_WHITESPACE:T++,TEXT:T++,TEXT_ENTITY:T++,OPEN_WAKA:T++,SGML_DECL:T++,SGML_DECL_QUOTED:T++,DOCTYPE:T++,DOCTYPE_QUOTED:T++,DOCTYPE_DTD:T++,DOCTYPE_DTD_QUOTED:T++,COMMENT_STARTING:T++,COMMENT:T++,COMMENT_ENDING:T++,COMMENT_ENDED:T++,CDATA:T++,CDATA_ENDING:T++,CDATA_ENDING_2:T++,PROC_INST:T++,PROC_INST_BODY:T++,PROC_INST_ENDING:T++,OPEN_TAG:T++,OPEN_TAG_SLASH:T++,ATTRIB:T++,ATTRIB_NAME:T++,ATTRIB_NAME_SAW_WHITE:T++,ATTRIB_VALUE:T++,ATTRIB_VALUE_QUOTED:T++,ATTRIB_VALUE_CLOSED:T++,ATTRIB_VALUE_UNQUOTED:T++,ATTRIB_VALUE_ENTITY_Q:T++,ATTRIB_VALUE_ENTITY_U:T++,CLOSE_TAG:T++,CLOSE_TAG_SAW_WHITE:T++,SCRIPT:T++,SCRIPT_ENDING:T++},e.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},e.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},Object.keys(e.ENTITIES).forEach(function(t){var n=e.ENTITIES[t],r="number"==typeof n?String.fromCharCode(n):n;e.ENTITIES[t]=r}),e.STATE)e.STATE[e.STATE[v]]=v;function _(e,t,n){e[t]&&e[t](n)}function w(e,t,n){e.textNode&&E(e),_(e,t,n)}function E(e){e.textNode=P(e.opt,e.textNode),e.textNode&&_(e,"ontext",e.textNode),e.textNode=""}function P(e,t){return e.trim&&(t=t.trim()),e.normalize&&(t=t.replace(/\s+/g," ")),t}function R(e,t){return E(e),e.trackPosition&&(t+="\nLine: "+e.line+"\nColumn: "+e.column+"\nChar: "+e.c),t=new Error(t),e.error=t,_(e,"onerror",t),e}function L(e){return e.sawRoot&&!e.closedRoot&&N(e,"Unclosed root tag"),e.state!==T.BEGIN&&e.state!==T.BEGIN_WHITESPACE&&e.state!==T.TEXT&&R(e,"Unexpected end"),E(e),e.c="",e.closed=!0,_(e,"onend"),n.call(e,e.strict,e.opt),e}function N(e,t){if("object"!=typeof e||!(e instanceof n))throw new Error("bad call to strictFail");e.strict&&R(e,t)}function O(e){e.strict||(e.tagName=e.tagName[e.looseCase]());var t=e.tags[e.tags.length-1]||e,n=e.tag={name:e.tagName,attributes:{}};e.opt.xmlns&&(n.ns=t.ns),e.attribList.length=0,w(e,"onopentagstart",n)}function B(e,t){var n=e.indexOf(":")<0?["",e]:e.split(":"),r=n[0],i=n[1];return t&&"xmlns"===e&&(r="xmlns",i=""),{prefix:r,local:i}}function M(e){if(e.strict||(e.attribName=e.attribName[e.looseCase]()),-1!==e.attribList.indexOf(e.attribName)||e.tag.attributes.hasOwnProperty(e.attribName))e.attribName=e.attribValue="";else{if(e.opt.xmlns){var t=B(e.attribName,!0),n=t.prefix,r=t.local;if("xmlns"===n)if("xml"===r&&e.attribValue!==c)N(e,"xml: prefix must be bound to "+c+"\nActual: "+e.attribValue);else if("xmlns"===r&&e.attribValue!==l)N(e,"xmlns: prefix must be bound to "+l+"\nActual: "+e.attribValue);else{var i=e.tag,a=e.tags[e.tags.length-1]||e;i.ns===a.ns&&(i.ns=Object.create(a.ns)),i.ns[r]=e.attribValue}e.attribList.push([e.attribName,e.attribValue])}else e.tag.attributes[e.attribName]=e.attribValue,w(e,"onattribute",{name:e.attribName,value:e.attribValue});e.attribName=e.attribValue=""}}function D(e,t){if(e.opt.xmlns){var n=e.tag,r=B(e.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(N(e,"Unbound namespace prefix: "+JSON.stringify(e.tagName)),n.uri=r.prefix);var i=e.tags[e.tags.length-1]||e;n.ns&&i.ns!==n.ns&&Object.keys(n.ns).forEach(function(t){w(e,"onopennamespace",{prefix:t,uri:n.ns[t]})});for(var a=0,o=e.attribList.length;a<o;a++){var s=e.attribList[a],c=s[0],l=s[1],u=B(c,!0),d=u.prefix,p=u.local,h=""===d?"":n.ns[d]||"",f={name:c,value:l,prefix:d,local:p,uri:h};d&&"xmlns"!==d&&!h&&(N(e,"Unbound namespace prefix: "+JSON.stringify(d)),f.uri=d),e.tag.attributes[c]=f,w(e,"onattribute",f)}e.attribList.length=0}e.tag.isSelfClosing=!!t,e.sawRoot=!0,e.tags.push(e.tag),w(e,"onopentag",e.tag),t||(e.noscript||"script"!==e.tagName.toLowerCase()?e.state=T.TEXT:e.state=T.SCRIPT,e.tag=null,e.tagName=""),e.attribName=e.attribValue="",e.attribList.length=0}function F(e){if(!e.tagName)return N(e,"Weird empty close tag."),e.textNode+="</>",void(e.state=T.TEXT);if(e.script){if("script"!==e.tagName)return e.script+="</"+e.tagName+">",e.tagName="",void(e.state=T.SCRIPT);w(e,"onscript",e.script),e.script=""}var t=e.tags.length,n=e.tagName;e.strict||(n=n[e.looseCase]());for(var r=n;t--&&e.tags[t].name!==r;)N(e,"Unexpected close tag");if(t<0)return N(e,"Unmatched closing tag: "+e.tagName),e.textNode+="</"+e.tagName+">",void(e.state=T.TEXT);e.tagName=n;for(var i=e.tags.length;i-- >t;){var a=e.tag=e.tags.pop();e.tagName=e.tag.name,w(e,"onclosetag",e.tagName);var o={};for(var s in a.ns)o[s]=a.ns[s];var c=e.tags[e.tags.length-1]||e;e.opt.xmlns&&a.ns!==c.ns&&Object.keys(a.ns).forEach(function(t){var n=a.ns[t];w(e,"onclosenamespace",{prefix:t,uri:n})})}0===t&&(e.closedRoot=!0),e.tagName=e.attribValue=e.attribName="",e.attribList.length=0,e.state=T.TEXT}function k(e){var t,n=e.entity,r=n.toLowerCase(),i="";return e.ENTITIES[n]?e.ENTITIES[n]:e.ENTITIES[r]?e.ENTITIES[r]:("#"===(n=r).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(t=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(t=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(t)||i.toLowerCase()!==n?(N(e,"Invalid character entity"),"&"+e.entity+";"):String.fromCodePoint(t))}function G(e,t){"<"===t?(e.state=T.OPEN_WAKA,e.startTagPosition=e.position):m(t)||(N(e,"Non-whitespace before first tag."),e.textNode=t,e.state=T.TEXT)}function H(e,t){var n="";return t<e.length&&(n=e.charAt(t)),n}T=e.STATE,String.fromCodePoint||(A=String.fromCharCode,S=Math.floor,b=function(){var e,t,n=[],r=-1,i=arguments.length;if(!i)return"";for(var a="";++r<i;){var o=Number(arguments[r]);if(!isFinite(o)||o<0||o>1114111||S(o)!==o)throw RangeError("Invalid code point: "+o);o<=65535?n.push(o):(e=55296+((o-=65536)>>10),t=o%1024+56320,n.push(e,t)),(r+1===i||n.length>16384)&&(a+=A.apply(null,n),n.length=0)}return a},Object.defineProperty?Object.defineProperty(String,"fromCodePoint",{value:b,configurable:!0,writable:!0}):String.fromCodePoint=b)}();var PN=class extends SN{static lc_name(){return"JsonOutputToolsParser"}returnId=!1;lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;constructor(e){super(e),this.returnId=e?.returnId??this.returnId}_diff(){throw new Error("Not supported.")}async parse(){throw new Error("Not implemented.")}async parseResult(e){return await this.parsePartialResult(e,!1)}async parsePartialResult(e,t=!0){const n=e[0].message;let r;if(ob(n)&&n.tool_calls?.length?r=n.tool_calls.map(e=>{const{id:t,...n}=e;return this.returnId?{id:t,...n}:n}):void 0!==n.additional_kwargs.tool_calls&&(r=JSON.parse(JSON.stringify(n.additional_kwargs.tool_calls)).map(e=>_N(e,{returnId:this.returnId,partial:t}))),!r)return[];const i=[];for(const a of r)if(void 0!==a){const e={type:a.name,args:a.args,id:a.id};i.push(e)}return i}},RN=class extends PN{static lc_name(){return"JsonOutputKeyToolsParser"}lc_namespace=["langchain","output_parsers","openai_tools"];lc_serializable=!0;returnId=!1;keyName;returnSingle=!1;zodSchema;serializableSchema;constructor(e){super(e),this.keyName=e.keyName,this.returnSingle=e.returnSingle??this.returnSingle,"zodSchema"in e&&(this.zodSchema=e.zodSchema),"serializableSchema"in e&&(this.serializableSchema=e.serializableSchema)}async _validateResult(e){if(void 0!==this.serializableSchema){const t=await this.serializableSchema["~standard"].validate(e);if(t.issues)throw new CN(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.issues)}`,JSON.stringify(e,null,2));return t.value}if(void 0===this.zodSchema)return e;const t=await async function(e,t){if(wy(e))try{return{success:!0,data:await py(e,t)}}catch(n){return{success:!1,error:n}}if(Ey(e))return await e.safeParseAsync(t);throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType")}(this.zodSchema,e);if(t.success)return t.data;throw new CN(`Failed to parse. Text: "${JSON.stringify(e,null,2)}". Error: ${JSON.stringify(t.error?.issues)}`,JSON.stringify(e,null,2))}async parsePartialResult(e){const t=(await super.parsePartialResult(e)).filter(e=>e.type===this.keyName);let n=t;if(t.length)return this.returnId||(n=t.map(e=>e.args)),this.returnSingle?n[0]:n}async parseResult(e){const t=(await super.parsePartialResult(e,!1)).filter(e=>e.type===this.keyName);let n=t;if(t.length)return this.returnId||(n=t.map(e=>e.args)),this.returnSingle?this._validateResult(n[0]):await Promise.all(n.map(e=>this._validateResult(e)))}};function LN(e){return Py(e)?vN.fromZodSchema(e):eA(e)?TN.fromSerializableSchema(e):new bN}function NN(e,t,n,r){if(!n){const n=e.pipe(t);return r?n.withConfig({runName:r}):n}const i=gN.assign({parsed:(e,n)=>t.invoke(e.raw,n)}),a=gN.assign({parsed:()=>null}),o=i.withFallbacks({fallbacks:[a]}),s=kL.from([{raw:e},o]);return r?s.withConfig({runName:r}):s}var ON=class{events=[];finished=!1;waiters=[];error=null;push(e){this.events.push(e);const t=this.waiters.splice(0);for(const n of t)n()}finish(){this.finished=!0;const e=this.waiters.splice(0);for(const t of e)t()}setError(e){this.error=e,this.finished=!0;const t=this.waiters.splice(0);for(const n of t)n()}async*iterate(){if(this.finished){if(this.error)throw this.error;return void(yield*this.events)}let e=0;for(;;){for(;e<this.events.length;)yield this.events[e],e++;if(this.finished){if(this.error)throw this.error;return}await new Promise(t=>{e<this.events.length||this.finished?t():this.waiters.push(t)})}}};function BN(e,t){switch(t.type){case"text-delta":return"text"===e.type?{...e,text:(e.text??"")+t.text}:e;case"reasoning-delta":return"thinking"===e.type?{...e,thinking:(e.thinking??"")+t.reasoning}:"reasoning"===e.type?{...e,reasoning:(e.reasoning??"")+t.reasoning}:e;case"data-delta":return{...e,data:(e.data??"")+t.data};case"block-delta":return{...e,...t.fields};default:throw new Error(`Unknown delta type: ${JSON.stringify(t)}`)}}function MN(e){if("content-block-delta"!==e.event)return;if("delta"in e&&e.delta)return e.delta;const t=e.content;if(null==t||"object"!=typeof t)return;const n=t;return"text"===n.type&&"string"==typeof n.text?{type:"text-delta",text:n.text}:"reasoning"===n.type&&"string"==typeof n.reasoning?{type:"reasoning-delta",reasoning:n.reasoning}:"thinking"===n.type&&"string"==typeof n.thinking?{type:"reasoning-delta",reasoning:n.thinking}:"string"==typeof n.data?{type:"data-delta",data:n.data,encoding:"base64"}:"string"==typeof n.type?{type:"block-delta",fields:{...n,type:n.type}}:void 0}function DN(e){if(null==e||"object"!=typeof e)return;const t=e;return"reasoning"===t.type&&"string"==typeof t.reasoning?t.reasoning:"thinking"===t.type&&"string"==typeof t.thinking?t.thinking:void 0}function FN(e){if(null==e||"object"!=typeof e)return!1;const t=e.type;return"reasoning"===t||"thinking"===t}function kN(e){if(e)return{...e,input_tokens:e.input_tokens??0,output_tokens:e.output_tokens??0,total_tokens:e.total_tokens??0}}function GN(e){if(null!=e&&"object"==typeof e&&!Array.isArray(e))return e;if("string"!=typeof e||0===e.length)return{};try{const t=JSON.parse(e);return null==t||"object"!=typeof t||Array.isArray(t)?{}:t}catch{return{}}}function HN(e){const t=e;if("tool_call"===e.type)return e;if("tool_call_chunk"!==e.type&&"tool_use"!==e.type&&"input_json_delta"!==e.type)return e;const n="string"==typeof t.name?t.name:void 0;if(null==n)return e;const r=t.args??t.input;return{...t,type:"tool_call",name:n,args:GN(r)}}var xN=class{_buffer;constructor(e){this._buffer=e}get full(){const e=this._buffer;return{async*[Symbol.asyncIterator](){let t="";for await(const n of e.iterate()){const e=MN(n);"text-delta"===e?.type&&(t+=e.text,yield t)}}}}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){for await(const t of e.iterate()){const e=MN(t);"text-delta"===e?.type&&(yield e.text)}}()}then(e,t){return(async()=>{let e="";for await(const t of this)e+=t;return e})().then(e,t)}},UN=class{_buffer;constructor(e){this._buffer=e}get full(){const e=this._buffer;return{async*[Symbol.asyncIterator](){const t=[];for await(const n of e.iterate())"content-block-finish"===n.event&&"tool_call"===n.content.type&&(t.push(n.content),yield[...t])}}}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){for await(const t of e.iterate())"content-block-finish"===t.event&&"tool_call"===t.content.type&&(yield t.content)}()}then(e,t){return(async()=>{const e=[];for await(const t of this)e.push(t);return e})().then(e,t)}},VN=class{_buffer;constructor(e){this._buffer=e}get full(){const e=this._buffer;return{async*[Symbol.asyncIterator](){let t="",n=!1;for await(const r of e.iterate())if("content-block-start"===r.event){if(!FN(r.content)){if(n)return;continue}n=!0;const e=DN(r.content);if(null==e||0===e.length)continue;t+=e,yield t}else if("content-block-delta"===r.event){const e=MN(r);if("reasoning-delta"!==e?.type)continue;n=!0;const i=e.reasoning;if(null==i||0===i.length)continue;t+=i,yield t}else{if("content-block-finish"===r.event&&FN(r.content))return;if("message-finish"===r.event)return}}}}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){let t=!1;for await(const n of e.iterate())if("content-block-start"===n.event){if(!FN(n.content)){if(t)return;continue}t=!0;const e=DN(n.content);null!=e&&e.length>0&&(yield e)}else if("content-block-delta"===n.event){const e=MN(n);if("reasoning-delta"!==e?.type)continue;t=!0;const r=e.reasoning;null!=r&&r.length>0&&(yield r)}else{if("content-block-finish"===n.event&&FN(n.content))return;if("message-finish"===n.event)return}}()}then(e,t){return(async()=>{let e="";for await(const t of this)e+=t;return e})().then(e,t)}},$N=class{_buffer;constructor(e){this._buffer=e}[Symbol.asyncIterator](){const e=this._buffer;return async function*(){for await(const t of e.iterate())if("usage"===t.event){const e=kN(t.usage);e&&(yield e)}else if("message-start"===t.event&&t.usage){const e=kN(t.usage);e&&(yield e)}else if("message-finish"===t.event&&t.usage){const e=kN(t.usage);e&&(yield e)}}()}then(e,t){return(async()=>{let e;for await(const t of this)e=t;return e})().then(e,t)}},jN=class{_buffer;constructor(e){this._buffer=new ON,this._consume(e)}async _consume(e){try{for await(const t of e)this._buffer.push(t);this._buffer.finish()}catch(t){this._buffer.setError(t instanceof Error?t:new Error(String(t)))}}[Symbol.asyncIterator](){return this._buffer.iterate()}get text(){return new xN(this._buffer)}get toolCalls(){return new UN(this._buffer)}get reasoning(){return new VN(this._buffer)}get usage(){return new $N(this._buffer)}get output(){return this._assembleMessage()}then(e,t){return this._assembleMessage().then(e,t)}async _assembleMessage(){const e=[];let t,n,r,i={};for await(const o of this._buffer.iterate())switch(o.event){case"message-start":t=o.id??t,o.usage&&(n=kN(o.usage));break;case"content-block-start":case"content-block-finish":e[o.index]=o.content;break;case"content-block-delta":{const t=e[o.index],n=MN(o);t&&n&&(e[o.index]=BN(t,n));break}case"usage":n=kN(o.usage);break;case"message-finish":r=o.reason,o.usage&&(n=kN(o.usage)),o.responseMetadata&&(i={...i,...o.responseMetadata})}const a=e.filter(e=>null!=e).map(HN);return new ab({id:t,content:a,usage_metadata:n,response_metadata:{...i,...r?{finish_reason:r}:{},output_version:"v1"}})}};function WN(e){const t=[];for(const n of e){let e=n;if(Array.isArray(n.content))for(let t=0;t<n.content.length;t++){const r=n.content[t];(fA(r)||mA(r))&&e===n&&(e=new n.constructor({...e,content:[...n.content.slice(0,t),gA(r),...n.content.slice(t+1)]}))}t.push(e)}return t}var XN=class e extends fN{lc_namespace=["langchain","chat_models",this._llmType()];disableStreaming=!1;outputVersion;get callKeys(){return[...super.callKeys,"outputVersion"]}constructor(e){super(e),this.outputVersion=(()=>{const t=e.outputVersion??wb("LC_OUTPUT_VERSION");return t&&["v0","v1"].includes(t)?t:"v0"})()}_separateRunnableConfigFromCallOptionsCompat(e){const[t,n]=super._separateRunnableConfigFromCallOptions(e);return n.signal=t.signal,[t,n]}async invoke(t,n){const r=e._convertInputToPromptValue(t);return(await this.generatePrompt([r],n,n?.callbacks)).generations[0][0].message}async*_streamResponseChunks(e,t,n){throw new Error("Not implemented.")}async*_streamChatModelEvents(e,t,n){const r=this._streamResponseChunks(e,t,n);yield*async function*(e,t){const n=/* @__PURE__ */new Map;let r,i,a=!1;const o=/* @__PURE__ */new Set;for await(const s of e){t?.signal?.throwIfAborted();const e=s.message;let c=!1;if(!a){a=!0;const t={event:"message-start",id:e.id??void 0};cb.isInstance(e)&&e.usage_metadata&&(t.usage=e.usage_metadata,r={...e.usage_metadata},c=!0),yield t}const l=e.content;if("string"==typeof l){if(""!==l){const e=0;if(!n.has(e)){const t={type:"text",text:""};n.set(e,{type:"text",accumulated:t}),yield{event:"content-block-start",index:e,content:t}}const t=n.get(e);t.accumulated={...t.accumulated,text:(t.accumulated.text??"")+l},yield{event:"content-block-delta",index:e,delta:{type:"text-delta",text:l}}}}else if(Array.isArray(l))for(const t of l){const e="number"==typeof t.index?t.index:n.size;if(n.has(e)){const r=n.get(e),i=gb(t);r.accumulated=mb(r.accumulated,i),yield{event:"content-block-delta",index:e,delta:i}}else n.set(e,{type:t.type,accumulated:{...t}}),yield{event:"content-block-start",index:e,content:{...t}}}if(cb.isInstance(e)&&e.tool_call_chunks&&e.tool_call_chunks.length>0)for(const t of e.tool_call_chunks){const e="number"==typeof t.index?t.index:n.size;if(!n.has(e)){const r={type:"tool_call_chunk",id:t.id,name:t.name,args:"",index:e};n.set(e,{type:"tool_call_chunk",accumulated:r}),yield{event:"content-block-start",index:e,content:r}}const r=n.get(e).accumulated;null!=t.id&&(r.id=t.id),null!=t.name&&(r.name=t.name),r.args=(r.args??"")+(t.args??""),yield{event:"content-block-delta",index:e,delta:{type:"block-delta",fields:{type:"tool_call_chunk",..."id"in r&&null!=r.id?{id:r.id}:{},..."name"in r&&null!=r.name?{name:r.name}:{},args:r.args}}}}const u=fb(e);if(null!=u){if(null==i){const e=db(n);i={index:e,id:u.id,mimeType:u.mimeType,transcript:""};const t={type:"audio",...null!=u.id?{id:u.id}:{},...null!=u.url?{url:u.url}:{},data:"",mimeType:u.mimeType};n.set(e,{type:"audio",accumulated:t}),yield{event:"content-block-start",index:e,content:t}}const e=n.get(i.index);if(null!=e){const t=e.accumulated;null!=u.id&&null==i.id&&(i.id=u.id,t.id=u.id),null!=u.transcript&&(i.transcript+=u.transcript,t.transcript=i.transcript,yield{event:"content-block-delta",index:i.index,delta:{type:"block-delta",fields:{type:"audio",transcript:i.transcript}}}),null!=u.data&&u.data.length>0&&(t.data=(t.data??"")+u.data,yield{event:"content-block-delta",index:i.index,delta:{type:"data-delta",data:u.data,encoding:"base64"}})}}for(const t of hb(e)){const e=t,r=e.id??e.url??(null!=e.data?`${e.data.length}:${e.data.slice(0,32)}`:void 0);if(null!=r&&o.has(r))continue;null!=r&&o.add(r);const i=db(n);n.set(i,{type:"image",accumulated:t}),yield{event:"content-block-start",index:i,content:t}}if(!c&&cb.isInstance(e)&&e.usage_metadata){const t=e.usage_metadata;r=r?{input_tokens:r.input_tokens+t.input_tokens,output_tokens:r.output_tokens+t.output_tokens,total_tokens:r.total_tokens+t.total_tokens}:{...t},yield{event:"usage",usage:{...r}}}}for(const[s,c]of n)yield{event:"content-block-finish",index:s,content:yb(c.accumulated)};yield{event:"message-finish",reason:"stop",...r?{usage:r}:{}}}(r,{signal:t.signal})}streamEvents(t,n,r){if("v1"===n?.version||"v2"===n?.version)return super.streamEvents(t,n,r);const i=e._convertInputToPromptValue(t).toChatMessages(),[,a]=this._separateRunnableConfigFromCallOptionsCompat(n),o=this._streamChatModelEvents(i,a);return new jN(o)}streamV2(e,t){return this.streamEvents(e,t)}async*_streamIterator(t,n){if(this._streamResponseChunks===e.prototype._streamResponseChunks||this.disableStreaming)yield this.invoke(t,n);else{const i=e._convertInputToPromptValue(t).toChatMessages(),[a,o]=this._separateRunnableConfigFromCallOptionsCompat(n),s={...a.metadata,...this.getLsParamsWithDefaults(o)},c=this._getInvocationParamsForTracing(o),l=await ZP.configure(a.callbacks,this.callbacks,a.tags,this.tags,s,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(c)}),u={options:this._getCallOptionsForTracing(o,c),invocation_params:c,batch_size:1},d=o.outputVersion??this.outputVersion,p=await(l?.handleChatModelStart(this.toJSON(),[WN(i)],a.runId,void 0,u,void 0,void 0,a.runName));let h,f;try{for await(const e of this._streamResponseChunks(i,o,p?.[0])){if(o.signal?.throwIfAborted(),null==e.message.id){const t=p?.at(0)?.runId;null!=t&&e.message._updateId(`run-${t}`)}e.message.response_metadata={...e.generationInfo,...e.message.response_metadata},"v1"===d?yield mN(e.message):yield e.message,h=h?h.concat(e):e,sb(e.message)&&void 0!==e.message.usage_metadata&&(f={tokenUsage:{promptTokens:e.message.usage_metadata.input_tokens,completionTokens:e.message.usage_metadata.output_tokens,totalTokens:e.message.usage_metadata.total_tokens}})}o.signal?.throwIfAborted()}catch(r){throw await Promise.all((p??[]).map(e=>e?.handleLLMError(r))),r}await Promise.all((p??[]).map(e=>e?.handleLLMEnd({generations:[[h]],llmOutput:f})))}}getLsParams(e){const t=this.getName().startsWith("Chat")?this.getName().replace("Chat",""):this.getName();return{ls_model_type:"chat",ls_stop:e.stop,ls_provider:t}}getLsParamsWithDefaults(e){return{...this.getLsParams(e),ls_integration:"langchain_chat_model"}}async _generateUncached(t,n,r,i){const a=t.map(e=>e.map(eb));let o;if(void 0!==i&&i.length===a.length)o=i;else{const e={...r.metadata,...this.getLsParamsWithDefaults(n)},t=this._getInvocationParamsForTracing(n),i=await ZP.configure(r.callbacks,this.callbacks,r.tags,this.tags,e,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(t)}),s={options:this._getCallOptionsForTracing(n,t),invocation_params:t,batch_size:1};o=await(i?.handleChatModelStart(this.toJSON(),a.map(WN),r.runId,void 0,s,void 0,void 0,r.runName))}const s=n.outputVersion??this.outputVersion,c=[],l=[],u=!!o?.[0].handlers.find(Hb),d=!!o?.[0].handlers.find(Gb);if(!u||this.disableStreaming||1!==a.length||this._streamChatModelEvents===e.prototype._streamChatModelEvents&&this._streamResponseChunks===e.prototype._streamResponseChunks)if(d&&!this.disableStreaming&&1===a.length&&this._streamResponseChunks!==e.prototype._streamResponseChunks)try{const e=await this._streamResponseChunks(a[0],n,o?.[0]);let t,r;for await(const i of e){if(n.signal?.aborted){const e=t?.message;throw new kS("Model invocation was aborted.",e)}if(null==i.message.id){const e=o?.at(0)?.runId;null!=e&&i.message._updateId(`run-${e}`)}t=void 0===t?i:gR(t,i),sb(i.message)&&void 0!==i.message.usage_metadata&&(r={tokenUsage:{promptTokens:i.message.usage_metadata.input_tokens,completionTokens:i.message.usage_metadata.output_tokens,totalTokens:i.message.usage_metadata.total_tokens}})}if(n.signal?.aborted){const e=t?.message;throw new kS("Model invocation was aborted.",e)}if(void 0===t)throw new Error("Received empty response from chat model call.");"v1"===s&&(t.message=mN(t.message)),c.push([t]),await(o?.[0].handleLLMEnd({generations:c,llmOutput:r}))}catch(h){throw await(o?.[0].handleLLMError(h)),h}else{const e=await Promise.allSettled(a.map(async(e,t)=>{const r=await this._generate(e,{...n,promptIndex:t},o?.[t]);if("v1"===s)for(const n of r.generations)n.message=mN(n.message);return r}));await Promise.all(e.map(async(e,t)=>{if("fulfilled"===e.status){const n=e.value;for(const e of n.generations){if(null==e.message.id){const t=o?.at(0)?.runId;null!=t&&e.message._updateId(`run-${t}`)}e.message.response_metadata={...e.generationInfo,...e.message.response_metadata}}return 1===n.generations.length&&(n.generations[0].message.response_metadata={...n.llmOutput,...n.generations[0].message.response_metadata}),c[t]=n.generations,l[t]=n.llmOutput,o?.[t]?.handleLLMEnd({generations:[n.generations],llmOutput:n.llmOutput})}return await(o?.[t]?.handleLLMError(e.reason)),Promise.reject(e.reason)}))}else try{let e=!1;const t=o?.[0],r=this._streamChatModelEvents(a[0],n),i=await new jN({async*[Symbol.asyncIterator](){for await(const i of r){n.signal?.throwIfAborted(),e=!0;const r="message-start"===i.event&&null==i.id&&null!=t?.runId?{...i,id:`run-${t.runId}`}:i;await(t?.handleChatModelStreamEvent(r)),yield r}}});if(n.signal?.throwIfAborted(),!e)throw new Error("Received empty response from chat model call.");if(null==i.id){const e=o?.at(0)?.runId;null!=e&&i._updateId(`run-${e}`)}const s={text:i.text,message:i};c.push([s]);const l=void 0!==i.usage_metadata?{tokenUsage:{promptTokens:i.usage_metadata.input_tokens,completionTokens:i.usage_metadata.output_tokens,totalTokens:i.usage_metadata.total_tokens}}:void 0;await(o?.[0].handleLLMEnd({generations:c,llmOutput:l}))}catch(h){throw await(o?.[0].handleLLMError(h)),h}const p={generations:c,llmOutput:l.length?this._combineLLMOutput?.(...l):void 0};return Object.defineProperty(p,IR,{value:o?{runIds:o?.map(e=>e.runId)}:void 0,configurable:!0}),p}async _generateCached({messages:t,cache:n,llmStringKey:r,parsedOptions:i,handledOptions:a}){const o=t.map(e=>e.map(eb)),s={...a.metadata,...this.getLsParamsWithDefaults(i)},c=this._getInvocationParamsForTracing(i),l=await ZP.configure(a.callbacks,this.callbacks,a.tags,this.tags,s,this.metadata,{verbose:this.verbose,tracerInheritableMetadata:this._filterInvocationParamsForTracing(c)}),u={options:this._getCallOptionsForTracing(i,c),invocation_params:c,batch_size:1},d=await(l?.handleChatModelStart(this.toJSON(),o.map(WN),a.runId,void 0,u,void 0,void 0,a.runName)),p=[],h=(await Promise.allSettled(o.map(async(t,i)=>{const a=e._convertInputToPromptValue(t).toString(),o=await n.lookup(a,r);return null==o&&p.push(i),o}))).map((e,t)=>({result:e,runManager:d?.[t]})).filter(({result:e})=>"fulfilled"===e.status&&null!=e.value||"rejected"===e.status),f=i.outputVersion??this.outputVersion,m=[];await Promise.all(h.map(async({result:e,runManager:t},n)=>{if("fulfilled"===e.status){const r=e.value;return m[n]=r.map(e=>("message"in e&&eS(e.message)&&ob(e.message)&&(e.message.usage_metadata={input_tokens:0,output_tokens:0,total_tokens:0},"v1"===f&&(e.message=mN(e.message))),e.generationInfo={...e.generationInfo,tokenUsage:{}},e)),r.length&&await(t?.handleLLMNewToken(r[0].text)),t?.handleLLMEnd({generations:[r]},void 0,void 0,void 0,{cached:!0})}return await(t?.handleLLMError(e.reason,void 0,void 0,void 0,{cached:!0})),Promise.reject(e.reason)}));const g={generations:m,missingPromptIndices:p,startedRunManagers:d};return Object.defineProperty(g,IR,{value:d?{runIds:d?.map(e=>e.runId)}:void 0,configurable:!0}),g}async generate(t,n,r){let i;i=Array.isArray(n)?{stop:n}:n;const a=t.map(e=>e.map(eb)),[o,s]=this._separateRunnableConfigFromCallOptionsCompat(i);if(o.callbacks=o.callbacks??r,!this.cache)return this._generateUncached(a,s,o);const{cache:c}=this,l=this._getSerializedCacheKeyParametersForCall(s),{generations:u,missingPromptIndices:d,startedRunManagers:p}=await this._generateCached({messages:a,cache:c,llmStringKey:l,parsedOptions:s,handledOptions:o});let h={};if(d.length>0){const t=await this._generateUncached(d.map(e=>a[e]),s,o,void 0!==p?d.map(e=>p?.[e]):void 0);await Promise.all(t.generations.map(async(t,n)=>{const r=d[n];u[r]=t;const i=e._convertInputToPromptValue(a[r]).toString();return c.update(i,l,t)})),h=t.llmOutput??{}}return{generations:u,llmOutput:h}}_getInvocationParamsForTracing(e){return this.invocationParams(e)}_getCallOptionsForTracing(e,t){return e}invocationParams(e){return{}}_modelType(){return"base_chat_model"}async generatePrompt(e,t,n){const r=e.map(e=>e.toChatMessages());return this.generate(r,t,n)}withStructuredOutput(e,t){if("function"!=typeof this.bindTools)throw new Error('Chat model must implement ".bindTools()" to use withStructuredOutput.');if(t?.strict)throw new Error('"strict" mode is not supported for this model by default.');const n=e,r=t?.name,i=Ly(n)??"A function available to call.",a=t?.method,o=t?.includeRaw;if("jsonMode"===a)throw new Error('Base withStructuredOutput implementation only supports "functionCalling" as a method.');let s=r??"extract";Py(n)||eA(n)||!("name"in n)||(s=n.name);const c=Py(n)||eA(n)?rA(n):n,l=[{type:"function",function:{name:s,description:i,parameters:c}}];return NN(this.bindTools(l),xL.from(e=>{if(!cb.isInstance(e))throw new Error("Input is not an AIMessageChunk.");if(!e.tool_calls||0===e.tool_calls.length)throw new Error("No tool calls found in the response.");const t=e.tool_calls.find(e=>e.name===s);if(!t)throw new Error(`No tool call found with name ${s}.`);return t.args}),o,o?"StructuredOutputRunnable":"StructuredOutput")}};function KN(e,t,n,r,i){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}function YN(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}let qN=function(){const{crypto:e}=globalThis;if(e?.randomUUID)return qN=e.randomUUID.bind(e),e.randomUUID();const t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>255*Math.random()&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e=>(+e^n()&15>>+e/4).toString(16))};function QN(e){return"object"==typeof e&&null!==e&&("name"in e&&"AbortError"===e.name||"message"in e&&String(e.message).includes("FetchRequestCanceledException"))}const JN=e=>{if(e instanceof Error)return e;if("object"==typeof e&&null!==e){try{if("[object Error]"===Object.prototype.toString.call(e)){const t=new Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return new Error(JSON.stringify(e))}catch{}}return new Error(e)};class zN extends Error{}class ZN extends zN{constructor(e,t,n,r){super(`${ZN.makeMessage(e,t,n)}`),this.status=e,this.headers=r,this.error=t}static makeMessage(e,t,n){const r=t?.message?"string"==typeof t.message?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||"(no status code or body)"}static generate(e,t,n,r){if(!e||!r)return new tO({message:n,cause:JN(t)});const i=t;return 400===e?new rO(e,i,n,r):401===e?new iO(e,i,n,r):403===e?new aO(e,i,n,r):404===e?new oO(e,i,n,r):409===e?new sO(e,i,n,r):422===e?new cO(e,i,n,r):429===e?new lO(e,i,n,r):e>=500?new uO(e,i,n,r):new ZN(e,i,n,r)}}class eO extends ZN{constructor({message:e}={}){super(void 0,void 0,e||"Request was aborted.",void 0)}}class tO extends ZN{constructor({message:e,cause:t}){super(void 0,void 0,e||"Connection error.",void 0),t&&(this.cause=t)}}class nO extends tO{constructor({message:e}={}){super({message:e??"Request timed out."})}}class rO extends ZN{}class iO extends ZN{}class aO extends ZN{}class oO extends ZN{}class sO extends ZN{}class cO extends ZN{}class lO extends ZN{}class uO extends ZN{}const dO=/^[a-z][a-z0-9+.-]*:/i;let pO=e=>(pO=Array.isArray,pO(e)),hO=pO;function fO(e){if(!e)return!0;for(const t in e)return!1;return!0}const mO="1.6.0";const gO=()=>{const e="undefined"!=typeof Deno&&null!=Deno.build?"deno":"undefined"!=typeof EdgeRuntime?"edge":"[object process]"===Object.prototype.toString.call(void 0!==globalThis.process?globalThis.process:0)?"node":"unknown";if("deno"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mO,"X-Stainless-OS":IO(Deno.build.os),"X-Stainless-Arch":yO(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":"string"==typeof Deno.version?Deno.version:Deno.version?.deno??"unknown"};if("undefined"!=typeof EdgeRuntime)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mO,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if("node"===e)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mO,"X-Stainless-OS":IO(globalThis.process.platform??"unknown"),"X-Stainless-Arch":yO(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};const t=function(){if("undefined"==typeof navigator||!navigator)return null;const e=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(const{key:t,pattern:n}of e){const e=n.exec(navigator.userAgent);if(e){return{browser:t,version:`${e[1]||0}.${e[2]||0}.${e[3]||0}`}}}return null}();return t?{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mO,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":"js","X-Stainless-Package-Version":mO,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};const yO=e=>"x32"===e?"x32":"x86_64"===e||"x64"===e?"x64":"arm"===e?"arm":"aarch64"===e||"arm64"===e?"arm64":e?`other:${e}`:"unknown",IO=e=>(e=e.toLowerCase()).includes("ios")?"iOS":"android"===e?"Android":"darwin"===e?"MacOS":"win32"===e?"Windows":"freebsd"===e?"FreeBSD":"openbsd"===e?"OpenBSD":"linux"===e?"Linux":e?`Other:${e}`:"Unknown";let CO;function AO(...e){const t=globalThis.ReadableStream;if(void 0===t)throw new Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function SO(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return AO({start(){},async pull(e){const{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await(t.return?.())}})}function bO(e){if(e[Symbol.asyncIterator])return e;const t=e.getReader();return{async next(){try{const e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){const e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}const TO=({headers:e,body:t})=>({bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(t)});const vO=()=>{if("undefined"==typeof File){const{process:e}=globalThis,t="string"==typeof e?.versions?.node&&parseInt(e.versions.node.split("."))<20;throw new Error("`File` is not defined as a global, which is required for file uploads."+(t?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}};function _O(e,t,n){return vO(),new File(e,t??"unknown_file",n)}function wO(e){return("object"==typeof e&&null!==e&&("name"in e&&e.name&&String(e.name)||"url"in e&&e.url&&String(e.url)||"filename"in e&&e.filename&&String(e.filename)||"path"in e&&e.path&&String(e.path))||"").split(/[\\/]/).pop()||void 0}const EO=e=>null!=e&&"object"==typeof e&&"function"==typeof e[Symbol.asyncIterator],PO=async(e,t)=>({...e,body:await LO(e.body,t)}),RO=/* @__PURE__ */new WeakMap;const LO=async(e,t)=>{if(!(await function(e){const t="function"==typeof e?e:e.fetch,n=RO.get(t);if(n)return n;const r=(async()=>{try{const e="Response"in t?t.Response:(await t("data:,")).constructor,n=new FormData;return n.toString()!==await new e(n).text()}catch{return!0}})();return RO.set(t,r),r}(t)))throw new TypeError("The provided fetch function does not support file uploads with the current global FormData class.");const n=new FormData;return await Promise.all(Object.entries(e||{}).map(([e,t])=>NO(n,e,t))),n},NO=async(e,t,n)=>{if(void 0!==n){if(null==n)throw new TypeError(`Received null for "${t}"; to pass null in FormData, you must use the string 'null'`);if("string"==typeof n||"number"==typeof n||"boolean"==typeof n)e.append(t,String(n));else if(n instanceof Response)e.append(t,_O([await n.blob()],wO(n)));else if(EO(n))e.append(t,_O([await new Response(SO(n)).blob()],wO(n)));else if((e=>e instanceof Blob&&"name"in e)(n))e.append(t,n,wO(n));else if(Array.isArray(n))await Promise.all(n.map(n=>NO(e,t+"[]",n)));else{if("object"!=typeof n)throw new TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${n} instead`);await Promise.all(Object.entries(n).map(([n,r])=>NO(e,`${t}[${n}]`,r)))}}},OO=e=>null!=e&&"object"==typeof e&&"number"==typeof e.size&&"string"==typeof e.type&&"function"==typeof e.text&&"function"==typeof e.slice&&"function"==typeof e.arrayBuffer;async function BO(e){let t=[];if("string"==typeof e||ArrayBuffer.isView(e)||e instanceof ArrayBuffer)t.push(e);else if(OO(e))t.push(e instanceof Blob?e:await e.arrayBuffer());else{if(!EO(e)){const t=e?.constructor?.name;throw new Error(`Unexpected data type: ${typeof e}${t?`; constructor: ${t}`:""}${function(e){if("object"!=typeof e||null===e)return"";const t=Object.getOwnPropertyNames(e);return`; props: [${t.map(e=>`"${e}"`).join(", ")}]`}(e)}`)}for await(const n of e)t.push(...await BO(n))}return t}class MO{constructor(e){this._client=e}}const DO=/* @__PURE__ */Symbol("brand.privateNullableHeaders");function*FO(e){if(!e)return;if(DO in e){const{values:t,nulls:n}=e;yield*t.entries();for(const e of n)yield[e,null];return}let t,n=!1;e instanceof Headers?t=e.entries():hO(e)?t=e:(n=!0,t=Object.entries(e??{}));for(let r of t){const e=r[0];if("string"!=typeof e)throw new TypeError("expected header name to be a string");const t=hO(r[1])?r[1]:[r[1]];let i=!1;for(const r of t)void 0!==r&&(n&&!i&&(i=!0,yield[e,null]),yield[e,r])}}const kO=e=>{const t=new Headers,n=/* @__PURE__ */new Set;for(const r of e){const e=/* @__PURE__ */new Set;for(const[i,a]of FO(r)){const r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),null===a?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[DO]:!0,values:t,nulls:n}};class GO extends MO{create(e,t){return this._client.post("/openai/v1/audio/speech",{body:e,...t,headers:kO([{Accept:"audio/wav"},t?.headers]),__binaryResponse:!0})}}class HO extends MO{create(e,t){return this._client.post("/openai/v1/audio/transcriptions",PO({body:e,...t},this._client))}}class xO extends MO{create(e,t){return this._client.post("/openai/v1/audio/translations",PO({body:e,...t},this._client))}}class UO extends MO{constructor(){super(...arguments),this.speech=new GO(this._client),this.transcriptions=new HO(this._client),this.translations=new xO(this._client)}}function VO(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}UO.Speech=GO,UO.Transcriptions=HO,UO.Translations=xO;const $O=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.create(null)),jO=(e=VO)=>function(t,...n){if(1===t.length)return t[0];let r=!1;const i=[],a=t.reduce((t,a,o)=>{/[?#]/.test(a)&&(r=!0);const s=n[o];let c=(r?encodeURIComponent:e)(""+s);return o!==n.length&&(null==s||"object"==typeof s&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??$O)??$O)?.toString)&&(c=s+"",i.push({start:t.length+a.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+a+(o===n.length?"":c)},""),o=a.split(/[?#]/,1)[0],s=new RegExp("(?<=^|\\/)(?:\\.|%2e){1,2}(?=\\/|$)","gi");let c;for(;null!==(c=s.exec(o));)i.push({start:c.index,length:c[0].length,error:`Value "${c[0]}" can't be safely passed as a path parameter`});if(i.sort((e,t)=>e.start-t.start),i.length>0){let e=0;const t=i.reduce((t,n)=>{const r=" ".repeat(n.start-e),i="^".repeat(n.length);return e=n.start+n.length,t+r+i},"");throw new zN(`Path parameters result in path with invalid segments:\n${i.map(e=>e.error).join("\n")}\n${a}\n${t}`)}return a},WO=/* @__PURE__ */jO(VO);class XO extends MO{create(e,t){return this._client.post("/openai/v1/batches",{body:e,...t})}retrieve(e,t){return this._client.get(WO`/openai/v1/batches/${e}`,t)}list(e){return this._client.get("/openai/v1/batches",e)}cancel(e,t){return this._client.post(WO`/openai/v1/batches/${e}/cancel`,t)}}let KO,YO,qO=class extends MO{create(e,t){return this._client.post("/openai/v1/chat/completions",{body:e,...t,stream:e.stream??!1})}};class QO extends MO{constructor(){super(...arguments),this.completions=new qO(this._client)}}QO.Completions=qO;class JO extends MO{}class zO extends MO{create(e,t){return this._client.post("/openai/v1/embeddings",{body:e,...t})}}class ZO extends MO{create(e,t){return this._client.post("/openai/v1/files",PO({body:e,...t},this._client))}list(e){return this._client.get("/openai/v1/files",e)}delete(e,t){return this._client.delete(WO`/openai/v1/files/${e}`,t)}content(e,t){return this._client.get(WO`/openai/v1/files/${e}/content`,{...t,headers:kO([{Accept:"application/octet-stream"},t?.headers]),__binaryResponse:!0})}info(e,t){return this._client.get(WO`/openai/v1/files/${e}`,t)}}class eB extends MO{retrieve(e,t){return this._client.get(WO`/openai/v1/models/${e}`,t)}list(e){return this._client.get("/openai/v1/models",e)}delete(e,t){return this._client.delete(WO`/openai/v1/models/${e}`,t)}}function tB(e){let t;return(KO??(t=new globalThis.TextEncoder,KO=t.encode.bind(t)))(e)}function nB(e){let t;return(YO??(t=new globalThis.TextDecoder,YO=t.decode.bind(t)))(e)}var rB,iB;class aB{constructor(){rB.set(this,void 0),iB.set(this,void 0),KN(this,rB,new Uint8Array),KN(this,iB,null)}decode(e){if(null==e)return[];const t=e instanceof ArrayBuffer?new Uint8Array(e):"string"==typeof e?tB(e):e;KN(this,rB,function(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}([YN(this,rB,"f"),t]));const n=[];let r;for(;null!=(r=oB(YN(this,rB,"f"),YN(this,iB,"f")));){if(r.carriage&&null==YN(this,iB,"f")){KN(this,iB,r.index);continue}if(null!=YN(this,iB,"f")&&(r.index!==YN(this,iB,"f")+1||r.carriage)){n.push(nB(YN(this,rB,"f").subarray(0,YN(this,iB,"f")-1))),KN(this,rB,YN(this,rB,"f").subarray(YN(this,iB,"f"))),KN(this,iB,null);continue}const e=null!==YN(this,iB,"f")?r.preceding-1:r.preceding,t=nB(YN(this,rB,"f").subarray(0,e));n.push(t),KN(this,rB,YN(this,rB,"f").subarray(r.index)),KN(this,iB,null)}return n}flush(){return YN(this,rB,"f").length?this.decode("\n"):[]}}function oB(e,t){for(let n=t??0;n<e.length;n++){if(10===e[n])return{preceding:n,index:n+1,carriage:!1};if(13===e[n])return{preceding:n,index:n+1,carriage:!0}}return null}function sB(e){for(let t=0;t<e.length-1;t++){if(10===e[t]&&10===e[t+1])return t+2;if(13===e[t]&&13===e[t+1])return t+2;if(13===e[t]&&10===e[t+1]&&t+3<e.length&&13===e[t+2]&&10===e[t+3])return t+4}return-1}rB=/* @__PURE__ */new WeakMap,iB=/* @__PURE__ */new WeakMap,aB.NEWLINE_CHARS=/* @__PURE__ */new Set(["\n","\r"]),aB.NEWLINE_REGEXP=/\r\n|[\n\r]/g;const cB={off:0,error:200,warn:300,info:400,debug:500},lB=(e,t,n)=>{if(e)return function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(cB,e)?e:void fB(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(cB))}`)};function uB(){}function dB(e,t,n){return!t||cB[e]>cB[n]?uB:t[e].bind(t)}const pB={error:uB,warn:uB,info:uB,debug:uB};let hB=/* @__PURE__ */new WeakMap;function fB(e){const t=e.logger,n=e.logLevel??"off";if(!t)return pB;const r=hB.get(t);if(r&&r[0]===n)return r[1];const i={error:dB("error",t,n),warn:dB("warn",t,n),info:dB("info",t,n),debug:dB("debug",t,n)};return hB.set(t,[n,i]),i}const mB=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,"authorization"===e.toLowerCase()||"api-key"===e.toLowerCase()||"x-api-key"===e.toLowerCase()||"cookie"===e.toLowerCase()||"set-cookie"===e.toLowerCase()?"***":t]))),"retryOfRequestLogID"in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e);var gB,yB;class IB{constructor(e,t,n){this.iterator=e,gB.set(this,void 0),this.controller=t,KN(this,gB,n)}static fromSSEResponse(e,t,n){let r=!1;const i=n?fB(n):console;return new IB(async function*(){if(r)throw new zN("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let n=!1;try{for await(const r of async function*(e,t){if(!e.body){if(t.abort(),void 0!==globalThis.navigator&&"ReactNative"===globalThis.navigator.product)throw new zN("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new zN("Attempted to iterate over a response with no body")}const n=new CB,r=new aB,i=bO(e.body);for await(const a of async function*(e){let t=new Uint8Array;for await(const n of e){if(null==n)continue;const e=n instanceof ArrayBuffer?new Uint8Array(n):"string"==typeof n?tB(n):n;let r,i=new Uint8Array(t.length+e.length);for(i.set(t),i.set(e,t.length),t=i;-1!==(r=sB(t));)yield t.slice(0,r),t=t.slice(r)}t.length>0&&(yield t)}(i))for(const e of r.decode(a)){const t=n.decode(e);t&&(yield t)}for(const a of r.flush()){const e=n.decode(a);e&&(yield e)}}(e,t))if(!n)if(r.data.startsWith("[DONE]"))n=!0;else if(null!==r.event&&r.event.startsWith("thread.")){let e;try{e=JSON.parse(r.data)}catch(a){throw console.error("Could not parse message into JSON:",r.data),console.error("From chunk:",r.raw),a}if("error"==r.event)throw new ZN(void 0,e.error,e.message,void 0);yield{event:r.event,data:e}}else{let t;try{t=JSON.parse(r.data)}catch(a){throw i.error("Could not parse message into JSON:",r.data),i.error("From chunk:",r.raw),a}if(t&&t.error)throw new ZN(void 0,t.error,void 0,e.headers);yield t}n=!0}catch(a){if(QN(a))return;throw a}finally{n||t.abort()}},t,n)}static fromReadableStream(e,t,n){let r=!1;return new IB(async function*(){if(r)throw new zN("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");r=!0;let n=!1;try{for await(const t of async function*(){const t=new aB,n=bO(e);for await(const e of n)for(const n of t.decode(e))yield n;for(const e of t.flush())yield e}())n||t&&(yield JSON.parse(t));n=!0}catch(i){if(QN(i))return;throw i}finally{n||t.abort()}},t,n)}[(gB=/* @__PURE__ */new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){const e=[],t=[],n=this.iterator(),r=r=>({next:()=>{if(0===r.length){const r=n.next();e.push(r),t.push(r)}return r.shift()}});return[new IB(()=>r(e),this.controller,YN(this,gB,"f")),new IB(()=>r(t),this.controller,YN(this,gB,"f"))]}toReadableStream(){const e=this;let t;return AO({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{const{value:n,done:r}=await t.next();if(r)return e.close();const i=tB(JSON.stringify(n)+"\n");e.enqueue(i)}catch(n){e.error(n)}},async cancel(){await(t.return?.())}})}}class CB{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith("\r")&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;const e={event:this.event,data:this.data.join("\n"),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],e}if(this.chunks.push(e),e.startsWith(":"))return null;let[t,n,r]=function(e,t){const n=e.indexOf(t);if(-1!==n)return[e.substring(0,n),t,e.substring(n+t.length)];return[e,"",""]}(e,":");return r.startsWith(" ")&&(r=r.substring(1)),"event"===t?this.event=r:"data"===t&&this.data.push(r),null}}async function AB(e,t){const{response:n,requestLogID:r,retryOfRequestLogID:i,startTime:a}=t,o=await(async()=>{if(204===n.status)return null;if(t.options.__binaryResponse)return n;if(t.options.stream)return IB.fromSSEResponse(n,t.controller,e);const r=n.headers.get("content-type"),i=r?.split(";")[0]?.trim();if(i?.includes("application/json")||i?.endsWith("+json")){if("0"===n.headers.get("content-length"))return;return await n.json()}return await n.text()})();return fB(e).debug(`[${r}] response parsed`,mB({retryOfRequestLogID:i,url:n.url,status:n.status,body:o,durationMs:Date.now()-a})),o}class SB extends Promise{constructor(e,t,n=AB){super(e=>{e(null)}),this.responsePromise=t,this.parseResponse=n,yB.set(this,void 0),KN(this,yB,e)}_thenUnwrap(e){return new SB(YN(this,yB,"f"),this.responsePromise,async(t,n)=>e(await this.parseResponse(t,n),n))}asResponse(){return this.responsePromise.then(e=>e.response)}async withResponse(){const[e,t]=await Promise.all([this.parse(),this.asResponse()]);return{data:e,response:t}}parse(){return this.parsedPromise||(this.parsedPromise=this.responsePromise.then(e=>this.parseResponse(YN(this,yB,"f"),e))),this.parsedPromise}then(e,t){return this.parse().then(e,t)}catch(e){return this.parse().catch(e)}finally(e){return this.parse().finally(e)}}yB=/* @__PURE__ */new WeakMap;const bB=e=>void 0!==globalThis.process?globalThis.process.env?.[e]?.trim()||void 0:void 0!==globalThis.Deno&&globalThis.Deno.env?.get?.(e)?.trim()||void 0;var TB,vB,_B,wB;class EB{constructor({baseURL:e=bB("GROQ_BASE_URL"),apiKey:t=bB("GROQ_API_KEY"),...n}={}){if(TB.add(this),_B.set(this,void 0),this.completions=new JO(this),this.chat=new QO(this),this.embeddings=new zO(this),this.audio=new UO(this),this.models=new eB(this),this.batches=new XO(this),this.files=new ZO(this),void 0===t)throw new zN("The GROQ_API_KEY environment variable is missing or empty; either provide it, or instantiate the Groq client with an apiKey option, like new Groq({ apiKey: 'My API Key' }).");const r={apiKey:t,...n,baseURL:e||"https://api.groq.com"};if(!r.dangerouslyAllowBrowser&&"undefined"!=typeof window&&void 0!==window.document&&"undefined"!=typeof navigator)throw new zN("It looks like you're running in a browser-like environment.\n\nThis is disabled by default, as it risks exposing your secret API credentials to attackers.\nIf you understand the risks and have appropriate mitigations in place,\nyou can set the `dangerouslyAllowBrowser` option to `true`, e.g.,\n\nnew Groq({ apiKey, dangerouslyAllowBrowser: true })");this.baseURL=r.baseURL,this.timeout=r.timeout??vB.DEFAULT_TIMEOUT,this.logger=r.logger??console;const i="warn";this.logLevel=i,this.logLevel=lB(r.logLevel,"ClientOptions.logLevel",this)??lB(bB("GROQ_LOG"),"process.env['GROQ_LOG']",this)??i,this.fetchOptions=r.fetchOptions,this.maxRetries=r.maxRetries??2,this.fetch=r.fetch??function(){if("undefined"!=typeof fetch)return fetch;throw new Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Groq({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}(),KN(this,_B,TO);const a=bB("GROQ_CUSTOM_HEADERS");if(a){const e={};for(const t of a.split("\n")){const n=t.indexOf(":");n>=0&&(e[t.substring(0,n).trim()]=t.substring(n+1).trim())}r.defaultHeaders={...e,...r.defaultHeaders}}this._options=r,this.apiKey=t}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){}async authHeaders(e){return kO([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(e){return function(e){return Object.entries(e).filter(([e,t])=>void 0!==t).map(([e,t])=>{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(null===t)return`${encodeURIComponent(e)}=`;throw new zN(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join("&")}(e)}getUserAgent(){return`${this.constructor.name}/JS ${mO}`}defaultIdempotencyKey(){return`stainless-node-retry-${qN()}`}makeStatusError(e,t,n,r){return ZN.generate(e,t,n,r)}buildURL(e,t,n){const r=!YN(this,TB,"m",wB).call(this)&&n||this.baseURL,i=(e=>dO.test(e))(e)?new URL(e):new URL(r+(r.endsWith("/")&&e.startsWith("/")?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return fO(a)&&fO(o)||(t={...o,...a,...t}),"object"==typeof t&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest("get",e,t)}post(e,t){return this.methodRequest("post",e,t)}patch(e,t){return this.methodRequest("patch",e,t)}put(e,t){return this.methodRequest("put",e,t)}delete(e,t){return this.methodRequest("delete",e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new SB(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){const r=await e,i=r.maxRetries??this.maxRetries;null==t&&(t=i),await this.prepareOptions(r);const{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});const c="log_"+(Math.random()*(1<<24)|0).toString(16).padStart(6,"0"),l=void 0===n?"":`, retryOf: ${n}`,u=Date.now();if(fB(this).debug(`[${c}] sending request`,mB({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new eO;const d=new AbortController,p=await this.fetchWithTimeout(o,a,s,d).catch(JN),h=Date.now();if(p instanceof globalThis.Error){const e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new eO;const i=QN(p)||/timed? ?out/i.test(String(p)+("cause"in p?String(p.cause):""));if(t)return fB(this).info(`[${c}] connection ${i?"timed out":"failed"} - ${e}`),fB(this).debug(`[${c}] connection ${i?"timed out":"failed"} (${e})`,mB({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),this.retryRequest(r,t,n??c);if(fB(this).info(`[${c}] connection ${i?"timed out":"failed"} - error; no more retries left`),fB(this).debug(`[${c}] connection ${i?"timed out":"failed"} (error; no more retries left)`,mB({retryOfRequestLogID:n,url:o,durationMs:h-u,message:p.message})),i)throw new nO;throw new tO({cause:p})}const f=`[${c}${l}] ${a.method} ${o} ${p.ok?"succeeded":"failed"} with status ${p.status} in ${h-u}ms`;if(!p.ok){const e=await this.shouldRetry(p);if(t&&e){const e=`retrying, ${t} attempts remaining`;return await async function(e){if(null===e||"object"!=typeof e)return;if(e[Symbol.asyncIterator])return void(await(e[Symbol.asyncIterator]().return?.()));const t=e.getReader(),n=t.cancel();t.releaseLock(),await n}(p.body),fB(this).info(`${f} - ${e}`),fB(this).debug(`[${c}] response error (${e})`,mB({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),this.retryRequest(r,t,n??c,p.headers)}const i=e?"error; no more retries left":"error; not retryable";fB(this).info(`${f} - ${i}`);const a=await p.text().catch(e=>JN(e).message),o=(e=>{try{return JSON.parse(e)}catch(t){return}})(a),s=o?void 0:a;fB(this).debug(`[${c}] response error (${i})`,mB({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,message:s,durationMs:Date.now()-u}));throw this.makeStatusError(p.status,o,s,p.headers)}return fB(this).info(f),fB(this).debug(`[${c}] response start`,mB({retryOfRequestLogID:n,url:p.url,status:p.status,headers:p.headers,durationMs:h-u})),{response:p,options:r,controller:d,requestLogID:c,retryOfRequestLogID:n,startTime:u}}async fetchWithTimeout(e,t,n,r){const{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener("abort",s,{once:!0});const c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||"object"==typeof o.body&&null!==o.body&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:"half"}:{},method:"GET",...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){const t=e.headers.get("x-should-retry");return"true"===t||"false"!==t&&(408===e.status||(409===e.status||(429===e.status||e.status>=500)))}async retryRequest(e,t,n,r){let i;const a=r?.get("retry-after-ms");if(a){const e=parseFloat(a);Number.isNaN(e)||(i=e)}const o=r?.get("retry-after");if(o&&!i){const e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():1e3*e}if(void 0===i){const n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}var s;return await(s=i,new Promise(e=>setTimeout(e,s))),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){const n=t-e;return Math.min(.5*Math.pow(2,n),8)*(1-.25*Math.random())*1e3}async buildRequest(e,{retryCount:t=0}={}){const n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);"timeout"in n&&((e,t)=>{if("number"!=typeof t||!Number.isInteger(t))throw new zN(`${e} must be an integer`);if(t<0)throw new zN(`${e} must be a positive integer`)})("timeout",n.timeout),n.timeout=n.timeout??this.timeout;const{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:"half"},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&"get"!==t&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);const a=kO([i,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...CO??(CO=gO())},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:e}){const{body:t,headers:n}=e;if(!t)return null==t&&"body"in e?YN(this,_B,"f").call(this,{body:t,headers:kO([n])}):{bodyHeaders:void 0,body:void 0};const r=kO([n]);return ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof DataView||"string"==typeof t&&r.values.has("content-type")||globalThis.Blob&&t instanceof globalThis.Blob||t instanceof FormData||t instanceof URLSearchParams||globalThis.ReadableStream&&t instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:t}:"object"==typeof t&&(Symbol.asyncIterator in t||Symbol.iterator in t&&"next"in t&&"function"==typeof t.next)?{bodyHeaders:void 0,body:SO(t)}:"object"==typeof t&&"application/x-www-form-urlencoded"===r.values.get("content-type")?{bodyHeaders:{"content-type":"application/x-www-form-urlencoded"},body:this.stringifyQuery(t)}:YN(this,_B,"f").call(this,{body:t,headers:r})}}function PB(e){return function(e){return!!e&&"object"==typeof e&&"name"in e&&"schema"in e&&(Py(e.schema)||null!=e.schema&&"object"==typeof e.schema&&"type"in e.schema&&"string"==typeof e.schema.type&&["null","boolean","object","array","number","string"].includes(e.schema.type))}(e)||function(e){return void 0!==e&&ML.isRunnable(e)&&"lc_name"in e.constructor&&"function"==typeof e.constructor.lc_name&&"RunnableToolLike"===e.constructor.lc_name()}(e)||function(e){return void 0!==e&&Array.isArray(e.lc_namespace)}(e)}function RB(e,t){return{name:e.name,description:e.description,parameters:rA(e.schema)}}function LB(e,t){let n;return n=PB(e)?{type:"function",function:RB(e)}:e,n}vB=EB,_B=/* @__PURE__ */new WeakMap,TB=/* @__PURE__ */new WeakSet,wB=function(){return"https://api.groq.com"!==this.baseURL},EB.Groq=vB,EB.DEFAULT_TIMEOUT=6e4,EB.GroqError=zN,EB.APIError=ZN,EB.APIConnectionError=tO,EB.APIConnectionTimeoutError=nO,EB.APIUserAbortError=eO,EB.NotFoundError=oO,EB.ConflictError=sO,EB.RateLimitError=lO,EB.BadRequestError=rO,EB.AuthenticationError=iO,EB.InternalServerError=uO,EB.PermissionDeniedError=aO,EB.UnprocessableEntityError=cO,EB.toFile=async function(e,t,n){if(vO(),(e=>null!=e&&"object"==typeof e&&"string"==typeof e.name&&"number"==typeof e.lastModified&&OO(e))(e=await e))return e instanceof File?e:_O([await e.arrayBuffer()],e.name);if((e=>null!=e&&"object"==typeof e&&"string"==typeof e.url&&"function"==typeof e.blob)(e)){const r=await e.blob();return t||(t=new URL(e.url).pathname.split(/[\\/]/).pop()),_O(await BO(r),t,n)}const r=await BO(e);if(t||(t=wO(e)),!n?.type){const e=r.find(e=>"object"==typeof e&&"type"in e&&e.type);"string"==typeof e&&(n={...n,type:e})}return _O(r,t,n)},EB.Completions=JO,EB.Chat=QO,EB.Embeddings=zO,EB.Audio=UO,EB.Models=eB,EB.Batches=XO,EB.Files=ZO;const NB=["frequency_penalty","function_call","functions","logit_bias","logprobs","max_completion_tokens","max_tokens","n","parallel_tool_calls","presence_penalty","reasoning_effort","reasoning_format","response_format","seed","service_tier","stop","temperature","tool_choice","top_logprobs","top_p","headers","promptIndex","stream_options","tools"];function OB(e){switch(e.type){case"system":return"system";case"ai":return"assistant";case"human":return"user";case"function":return"function";case"tool":return"tool";case"generic":if(!$S.isInstance(e))throw new Error("Invalid generic chat message");return function(e){if("system"!==e.role&&"assistant"!==e.role&&"user"!==e.role&&"function"!==e.role)throw new Error(`Unsupported message role: ${e.role}. Expected "system", "assistant", "user", or "function"`);return e.role}(e);default:throw new Error(`Unknown message type: ${e.type}`)}}function BB(e){return e.map(e=>{const t={role:OB(e),content:e.content,name:e.name,function_call:e.additional_kwargs.function_call,tool_calls:e.additional_kwargs.tool_calls,tool_call_id:e.tool_call_id};return ob(e)&&e.tool_calls?.length?t.tool_calls=e.tool_calls.map(wN):(null!=e.additional_kwargs.tool_calls&&(t.tool_calls=e.additional_kwargs.tool_calls),null!=e.tool_call_id&&(t.tool_call_id=e.tool_call_id)),t})}function MB(e,t,n){const r=e.tool_calls,i={...n,model_provider:"groq"};if("assistant"===e.role){const n=[],o=[];for(const e of r??[])try{n.push(_N(e,{returnId:!0}))}catch(a){o.push(EN(e,a.message))}return new ab({content:e.content||"",additional_kwargs:{tool_calls:r},tool_calls:n,invalid_tool_calls:o,usage_metadata:t,response_metadata:i})}return new $S(e.content||"",e.role??"unknown")}function DB(e,t,n,r){const i=e.role??t,a=e.content??"";let o,s;o=e.function_call?{function_call:e.function_call}:e.tool_calls?{tool_calls:e.tool_calls}:{},e.audio&&(o.audio={...e.audio,index:n.choices[0].index});let c,l=r;const u=n.x_groq;u?.usage&&(s={input_tokens:u.usage.prompt_tokens,output_tokens:u.usage.completion_tokens,total_tokens:u.usage.total_tokens},c={completion_time:u.usage.completion_time,prompt_time:u.usage.prompt_time,queue_time:u.usage.queue_time,total_time:u.usage.total_time}),u?.id&&(l=u.id);const d={usage:s,timing:c,model_provider:"groq"};if("user"===i)return new KS({content:a,response_metadata:d});if("assistant"===i){const t=[];if(Array.isArray(e.tool_calls))for(const n of e.tool_calls)t.push({name:n.function?.name,args:n.function?.arguments,id:n.id,index:n.index,type:"tool_call_chunk"});return new cb({content:a,tool_call_chunks:t,additional_kwargs:o,id:l,response_metadata:d})}return"system"===i?new QS({content:a,response_metadata:d}):"developer"===i?new QS({content:a,response_metadata:d,additional_kwargs:{__openai_role__:"developer"}}):"function"===i?new WS({content:a,additional_kwargs:o,name:e.name,response_metadata:d}):"tool"===i?new LS({content:a,additional_kwargs:o,tool_call_id:e.tool_call_id,response_metadata:d}):new jS({content:a,role:i,response_metadata:d})}var FB=class extends XN{lc_namespace=["langchain","chat_models","groq"];client;model;temperature=.7;stop;stopSequences;maxTokens;streaming=!1;apiKey;streamUsage=!0;topP;frequencyPenalty;presencePenalty;logprobs;n;logitBias;user;reasoningEffort;reasoningFormat;serviceTier;topLogprobs;lc_serializable=!0;get lc_serialized_keys(){return["client","model","temperature","stop","stopSequences","maxTokens","streaming","apiKey","streamUsage","topP","frequencyPenalty","presencePenalty","logprobs","n","logitBias","user","reasoningEffort","reasoningFormat","serviceTier","topLogprobs"]}static lc_name(){return"ChatGroq"}_llmType(){return"groq"}get lc_secrets(){return{apiKey:"GROQ_API_KEY"}}get callKeys(){return[...super.callKeys,...NB]}constructor(e,t){const n="string"==typeof e?{...t??{},model:e}:e??{};super(n),this._addVersion("@langchain/groq","1.3.1");const r=n.apiKey||wb("GROQ_API_KEY");if(!r)throw new Error('Groq API key not found. Please set the GROQ_API_KEY environment variable or provide the key into "apiKey"');const i={"User-Agent":"langchainjs",...n.defaultHeaders??{}};this.client=new EB({apiKey:r,dangerouslyAllowBrowser:!0,baseURL:n.baseUrl,timeout:n.timeout,httpAgent:n.httpAgent,fetch:n.fetch,maxRetries:0,defaultHeaders:i,defaultQuery:n.defaultQuery}),this.apiKey=r,this.temperature=n.temperature??this.temperature,this.model=n.model,this.streaming=n.streaming??this.streaming,this.stop=n.stopSequences??("string"==typeof n.stop?[n.stop]:n.stop)??[],this.stopSequences=this.stop,this.maxTokens=n.maxTokens,this.topP=n.topP,this.frequencyPenalty=n.frequencyPenalty,this.presencePenalty=n.presencePenalty,this.logprobs=n.logprobs,this.n=n.n,this.logitBias=n.logitBias,this.user=n.user,this.reasoningEffort=n.reasoningEffort}getLsParams(e){const t=this.invocationParams(e);return{ls_provider:"groq",ls_model_name:this.model,ls_model_type:"chat",ls_temperature:t.temperature??this.temperature,ls_max_tokens:t.max_tokens??this.maxTokens,ls_stop:e.stop}}async completionWithRetry(e,t){return this.caller.call(async()=>this.client.chat.completions.create(e,t))}invocationParams(e,t){const n=super.invocationParams(e);let r={};void 0!==e?.stream_options?r={stream_options:e.stream_options}:(this.streamUsage&&this.streaming||t?.streaming)&&(r={stream_options:{include_usage:!0}});const i={model:this.model,frequency_penalty:this.frequencyPenalty,function_call:e?.function_call,functions:e?.functions,logit_bias:this.logitBias,logprobs:this.logprobs,n:this.n,parallel_tool_calls:e?.parallel_tool_calls,presence_penalty:this.presencePenalty,reasoning_effort:e?.reasoning_effort??this.reasoningEffort,reasoning_format:this.reasoningFormat,response_format:e?.response_format,seed:e?.seed,service_tier:this.serviceTier,stop:e?.stop??this.stopSequences,temperature:e?.temperature??this.temperature,tool_choice:kB(e?.tool_choice),tools:e?.tools?.length?e.tools.map(e=>LB(e)):void 0,top_logprobs:this.topLogprobs,top_p:this.topP,user:this.user,stream:this.streaming,...n,...r};return i.max_completion_tokens=e?.max_completion_tokens??e?.max_tokens??this.maxTokens,-1===i.max_completion_tokens&&delete i.max_completion_tokens,i}bindTools(e,t){return this.withConfig({tools:e.map(e=>LB(e)),...t})}async*_streamChatModelEvents(e,t,n){const r=this.invocationParams(t,{streaming:!0}),i=BB(e),a=await this.completionWithRetry({...r,messages:i,stream:!0},{signal:t?.signal,headers:t?.headers});yield*async function*(e,t={}){const n=t.streamUsage??!0,r=t.provider??"openai",i=t.mapChunk,a=/* @__PURE__ */new Map,o=/* @__PURE__ */new Map;let s,c,l,u=0,d=!1,p=!1;const h=(e,t)=>{const n=o.get(e);if(void 0!==n)return{index:n,isNew:!1};const r=u++;return o.set(e,r),a.set(r,{...t}),{index:r,isNew:!0}};for await(let f of e){i&&(f=i(f)),d||(d=!0,yield{event:"message-start",id:f.id}),p||!f.model&&!f.service_tier||(p=!0,yield{event:"provider",provider:r,name:"stream_metadata",payload:{model:f.model,service_tier:f.service_tier}}),f.usage&&n&&(s=Sb(f.usage),yield{event:"usage",usage:s});const e=f.x_groq?.usage;e&&n&&(s=Cb(e),yield{event:"usage",usage:s});const t=f.choices?.[0];if(!t)continue;null!=t.finish_reason&&(c=Ab(t.finish_reason),l=bb(f,t));const{delta:o}=t;if(!o)continue;const u=Ib(o);if(u){const{index:e,isNew:t}=h("reasoning",{type:"reasoning",reasoning:""});t&&(yield{event:"content-block-start",index:e,content:{type:"reasoning",reasoning:""}});const n=a.get(e);n.reasoning=(n.reasoning??"")+u,yield{event:"content-block-delta",index:e,delta:{type:"reasoning-delta",reasoning:u}}}if(o.content){const{index:e,isNew:t}=h("text",{type:"text",text:""});t&&(yield{event:"content-block-start",index:e,content:{type:"text",text:""}});const n=a.get(e);n.text=(n.text??"")+o.content,yield{event:"content-block-delta",index:e,delta:{type:"text-delta",text:o.content}}}if(Array.isArray(o.tool_calls))for(const n of o.tool_calls){const e=n.index??0,{index:t,isNew:r}=h(`tool:${e}`,{type:"tool_call_chunk",id:n.id,name:n.function?.name,args:"",index:e});r&&(yield{event:"content-block-start",index:t,content:{type:"tool_call_chunk",id:n.id,name:n.function?.name,args:"",index:e}});const i=a.get(t);null!=n.id&&(i.id=n.id),null!=n.function?.name&&(i.name=n.function.name);const o=n.function?.arguments??"";i.args=(i.args??"")+o,yield{event:"content-block-delta",index:t,delta:{type:"block-delta",fields:{type:"tool_call_chunk",...null!=i.id?{id:i.id}:{},...null!=i.name?{name:i.name}:{},args:i.args}}}}if(o.audio){const{index:e,isNew:t}=h("audio",{type:"audio",id:o.audio.id,data:"",mimeType:"audio/pcm",transcript:o.audio.transcript??""});t&&(yield{event:"content-block-start",index:e,content:{type:"audio",id:o.audio.id,data:"",mimeType:"audio/pcm",transcript:o.audio.transcript??""}});const n=a.get(e);o.audio.transcript&&(n.transcript=(n.transcript??"")+o.audio.transcript,yield{event:"content-block-delta",index:e,delta:{type:"block-delta",fields:{type:"audio",transcript:n.transcript}}}),o.audio.data&&(n.data=(n.data??"")+o.audio.data,yield{event:"content-block-delta",index:e,delta:{type:"data-delta",data:o.audio.data,encoding:"base64"}})}o.function_call&&(yield{event:"provider",provider:r,name:"function_call",payload:o.function_call}),t.logprobs&&(yield{event:"provider",provider:r,name:"logprobs",payload:t.logprobs})}for(const[f,m]of a)yield{event:"content-block-finish",index:f,content:yb(m)};yield{event:"message-finish",reason:c,...s?{usage:s}:{},...l?{responseMetadata:l}:{}}}(async function*(e,t){for await(const n of e){if(t?.aborted)return;yield n}}(a,t.signal),{streamUsage:!0,provider:"groq"})}async*_streamResponseChunks(e,t,n){const r=this.invocationParams(t,{streaming:!0}),i=BB(e),a=await this.completionWithRetry({...r,messages:i,stream:!0},{signal:t?.signal,headers:t?.headers});let o,s;for await(const c of a){if(t.signal?.aborted)return;s=c;const e=c?.choices[0];if(!e)continue;e.delta?.role&&(o=e.delta.role);const r=DB(e.delta,o,c,void 0),i={prompt:t.promptIndex??0,completion:e.index??0};if("string"!=typeof r.content){console.log("[WARNING]: Received non-string content from OpenAI. This is currently not supported.");continue}const a={...i};null!=e.finish_reason&&(a.finish_reason=e.finish_reason,a.system_fingerprint=c.system_fingerprint,a.model_name=c.model);const l=new AR({message:r,text:r.content,generationInfo:a});yield l,await(n?.handleLLMNewToken(l.text??"",i,void 0,void 0,void 0,{chunk:l}))}if(s&&("choices"in s&&delete s.choices,yield new AR({message:new cb({content:"",response_metadata:s}),text:""})),t.signal?.aborted)throw new Error("AbortError")}async _generate(e,t,n){if(t.signal?.throwIfAborted(),this.streaming){const r={},i=this._streamResponseChunks(e,t,n),a={};for await(const e of i){const t=e.generationInfo?.completion??0;void 0===a[t]?a[t]=e:a[t]=a[t].concat(e)}return{generations:Object.entries(a).sort(([e],[t])=>parseInt(e,10)-parseInt(t,10)).map(([e,t])=>t),llmOutput:{estimatedTokenUsage:r}}}return this._generateNonStreaming(e,t,n)}async _generateNonStreaming(e,t,n){const r={},i=this.invocationParams(t),a=BB(e),o=await this.completionWithRetry({...i,stream:!1,messages:a},{signal:t?.signal,headers:t?.headers});if("usage"in o&&o.usage){const{completion_tokens:e,prompt_tokens:t,total_tokens:n}=o.usage;e&&(r.completionTokens=(r.completionTokens??0)+e),t&&(r.promptTokens=(r.promptTokens??0)+t),n&&(r.totalTokens=(r.totalTokens??0)+n)}const s=[];if("choices"in o&&o.choices)for(const c of o.choices){const e=c.message?.content??"";let t;void 0!==r.totalTokens&&(t={input_tokens:r.promptTokens??0,output_tokens:r.completionTokens??0,total_tokens:r.totalTokens});const{choices:n,...i}=o,a={text:e,message:MB(c.message??{role:"assistant"},t,i)};a.generationInfo={...c.finish_reason?{finish_reason:c.finish_reason}:{},...c.logprobs?{logprobs:c.logprobs}:{}},s.push(a)}return{generations:s,llmOutput:{tokenUsage:r}}}get profile(){return Yg[this.model]??{}}withStructuredOutput(e,t){const n=e,r=t?.name,i=t?.includeRaw,a=function(e,t){if(void 0!==t&&!Jg.includes(t))throw new Error(`Invalid structured output method: ${t}. Supported methods are: ${Jg.join(", ")}`);const n=function(e){return e.startsWith("openai/gpt-oss")}(e);if(n&&!t)return"jsonSchema";if(!n&&"jsonSchema"===t)throw new Error(`Native JSON Schema structured output is not supported for model "${e}". Only models with the "openai/gpt-oss" prefix are supported. Use "functionCalling" or "jsonMode" instead.`);return t??"functionCalling"}(this.model,t?.method);let o,s,c=r??"extract";if("jsonSchema"===a){const e=r??"structured_output",t=Ly(n),i=Py(n)||eA(n)?rA(n):n,a=Qg(i);s=this.withConfig({response_format:{type:"json_schema",json_schema:{name:e,description:t,strict:!0,schema:a}},ls_structured_output_format:{kwargs:{method:"jsonSchema"},schema:{title:e,description:t,...i}}}),o=LN(n)}else if("jsonMode"===a){o=LN(n);const e=Py(n)||eA(n)?rA(n):n;s=this.withConfig({response_format:{type:"json_object"},ls_structured_output_format:{kwargs:{method:"jsonMode"},schema:e}})}else{let e;if(Py(n)||eA(n)){const t=rA(n);e={name:c,description:t.description,parameters:t}}else"string"==typeof n.name&&"object"==typeof n.parameters&&null!=n.parameters?(e=n,c=n.name):(c=n.title??c,e={name:c,description:n.description??"",parameters:n});s=this.bindTools([{type:"function",function:e}]).withConfig({tool_choice:{type:"function",function:{name:c}},ls_structured_output_format:{kwargs:{method:"functionCalling"},schema:e.parameters}}),o=function(e,t){const n=RN;return Py(e)?new n({returnSingle:!0,keyName:t,zodSchema:e}):eA(e)?new n({returnSingle:!0,keyName:t,serializableSchema:e}):new n({returnSingle:!0,keyName:t})}(n,c)}return NN(s,o,i,"ChatGroqStructuredOutput")}};function kB(e){return e?"any"===e||"required"===e?"required":"auto"===e?"auto":"none"===e?"none":"string"==typeof e?{type:"function",function:{name:e}}:e:void 0}let GB=null;async function HB(e){try{const t=(GB||(GB=new Kg({apiKey:process.env.TAVILY_API_KEY||""})),GB);if(!process.env.TAVILY_API_KEY)return console.warn("TAVILY_API_KEY not set, skipping web research"),"Web research unavailable: API key not configured";const n=await t.search({query:e,search_depth:"advanced",max_results:5,include_raw_content:!0}),r=[];if(n?.answer&&r.push(`High-level answer: ${n.answer}`),n?.results?.length)for(const e of n.results.slice(0,3)){const t=(e.content??"").slice(0,800);r.push(`Source: ${e.url}\nRelevance: ${e.score}\nSnippet:\n${t}`)}return r.join("\n\n")}catch(t){return console.error("Error researching with Tavily:",t.message),`Web research failed: ${t.message}. Analysis will proceed with limited context.`}}function xB(e,t,n){const r=`You are an expert analyst tasked with providing a balanced debate analysis for a prediction market question.\n\nMarket Question: ${e.question}\n${e.description?`Description: ${e.description}`:""}\n\nCurrent Polymarket displayed odds:\n- YES: ${e.currentYesPrice}\n- NO: ${e.currentNoPrice}\n\nNote: These displayed odds are a UI placeholder and do NOT necessarily reflect true market probabilities. Use them only as a reference for comparison, not as ground truth. [web:89][web:92][web:96]\n\n${e.volume24hr?`24h Volume: $${e.volume24hr.toLocaleString()}`:""}\n${e.volumeTotal?`Total Volume: $${e.volumeTotal.toLocaleString()}`:""}\n\nYou have the following external research about this question from web search (via Tavily). Use it heavily for factual grounding:\n\n${t}\n\nYour tasks:\n1. Infer your own best-estimate probability for YES and NO based on the research, expressed as numbers between 0 and 1 that sum to 1.0.\n2. Provide a full debate analysis (arguments, summaries, key factors, uncertainties).\n3. Explain how and why your inferred probabilities differ from the displayed 50/50 odds.\n\nRespond with valid JSON in this format:\n\n{\n "yesArguments": ["argument 1", "argument 2", "argument 3"],\n "noArguments": ["argument 1", "argument 2", "argument 3"],\n "yesSummary": "2-3 sentence summary of the strongest case for YES",\n "noSummary": "2-3 sentence summary of the strongest case for NO",\n "keyFactors": ["factor 1", "factor 2", "factor 3"],\n "uncertainties": ["uncertainty 1", "uncertainty 2"],\n "modelYesProbability": 0.63,\n "modelNoProbability": 0.37,\n "commentaryOnDiscrepancy": "2-4 sentences explaining why your inferred odds differ from the 50/50 displayed odds."\n}\n\nGuidelines:\n1. Be intellectually honest and balanced - present the strongest arguments for BOTH sides.\n2. Base arguments primarily on the provided research, plus relevant facts, data, historical precedent, and logical reasoning. [web:85][web:87][web:90]\n3. Explicitly justify your probability estimates using the research (e.g., base rates, polls, fundamentals, historical analogies).\n4. Highlight structural reasons the displayed 50/50 odds might deviate from “true odds” (e.g., low liquidity, retail bias, information lags). [web:89][web:92][web:94][web:99]\n5. Each argument should be specific and substantive (2-3 sentences).\n6. Key factors should be concrete, measurable events or conditions.\n7. Focus on factors that are actually relevant to the prediction timeframe.\n8. Avoid simply repeating the 50/50 odds; your probabilities should reflect your best judgment based on the research, even if far from 50/50.\n\n`;return n?r+"\nReturn ONLY the JSON object, with no additional text or explanation.":r}async function UB(e,t,{model:n="llama-3.3-70b-versatile",temperature:r=.7}={}){try{const a=t||process.env.GROQ_API_KEY;if(!a)throw new Error("GROQ_API_KEY not configured");const o=new FB({apiKey:a,model:n,temperature:r});console.log(`Calling Groq API with model ${n}...`);const s=await o.invoke([{role:"system",content:"You are an expert analyst who provides balanced, fact-based debate analysis. Always respond with valid JSON matching the requested schema."},{role:"user",content:e}],{response_format:{type:"json_object"}});let c,l=("string"==typeof s.content?s.content:Array.isArray(s.content)?s.content.map(e=>e?.text??"").join(""):String(s.content)).trim();try{c=JSON.parse(l)}catch(i){throw console.error("Failed to parse Groq response as JSON:",l.substring(0,200)),new Error(`Invalid JSON response from Groq: ${i.message}`)}const u=["yesArguments","noArguments","yesSummary","noSummary","keyFactors","uncertainties"].filter(e=>!c[e]);if(u.length>0)throw console.error("Missing fields in Groq response:",u),new Error(`Missing required fields in analysis: ${u.join(", ")}`);return c}catch(a){throw console.error("Error calling Groq API:",a.message),a}}async function VB(e,t){try{console.log(`Generating debate analysis for: ${e.question}`);const n=xB(e,await HB(e.question),!0),r=await UB(n,t);return console.log("Successfully generated debate analysis"),r}catch(n){throw console.error("Error generating debate analysis:",n.message),new Error(`Failed to generate debate analysis: ${n.message}`)}}async function $B(e,t){return UB(xB(e,await HB(e.question),!1),t)}const jB={sp500Top:["AAPL","MSFT","NVDA","GOOGL","AMZN","META","TSLA","BRK.B","LLY","V"],tech:["AAPL","MSFT","NVDA","GOOGL","META","TSLA","ORCL","CRM","ADBE","NFLX"],faang:["META","AAPL","AMZN","NFLX","GOOGL"],mag7:["AAPL","MSFT","NVDA","GOOGL","AMZN","META","TSLA"],mostActive:["TSLA","NVDA","AAPL","AMD","PLTR","SOFI","F","NIO","LCID","RIVN"]};class WB{baseURL;constructor(e="/api"){this.baseURL=e}async fetchAPI(e,t={}){const n=`${this.baseURL}${e}`,r=await fetch(n,{...t,headers:{"Content-Type":"application/json",...t.headers}});if(!r.ok){const e=await r.json().catch(()=>({detail:"Unknown error"}));throw new Error(e.detail||`API error: ${r.statusText}`)}return r.json()}async getHealth(){const e=await this.fetchAPI("/trading-agents");return{status:"online",timestamp:/* @__PURE__ */(new Date).toISOString(),services:{news_researcher:"online",debate_analyst:"online"},...e}}async getAgentLogs(e=50){return this.fetchAPI(`/trading-agents?action=history&limit=${e}`)}async analyzeWithNewsResearcher(e){const t=e.symbols[0],n=await this.fetchAPI("/trading-agents",{method:"POST",body:JSON.stringify({symbol:t,date:e.date,analysts:["news","fundamentals","market"]})});return{success:n.success,symbols:[n.symbol],date:n.date,timestamp:/* @__PURE__ */(new Date).toISOString(),result:{portfolio_manager_results:{decision:n.signal.action,confidence:n.signal.confidence,reasoning:n.signal.reasoning},news_intelligence_results:{summary:n.analysis.newsReport},technical_analysis_results:{summary:n.analysis.marketReport},data_collection_results:{summary:n.analysis.fundamentalsReport}}}}async batchAnalyzeWithNewsResearcher(e){throw new Error("Batch analysis not supported in this version")}async analyzeWithDebateAnalyst(e){const t=await this.fetchAPI("/trading-agents",{method:"POST",body:JSON.stringify({symbol:e.symbol,date:e.date,config:{deepThinkLLM:e.deep_think_llm,quickThinkLLM:e.quick_think_llm}})});return{success:t.success,symbol:t.symbol,date:t.date,timestamp:/* @__PURE__ */(new Date).toISOString(),decision:{action:t.signal.action,confidence:t.signal.confidence,position_size:1,reasoning:t.signal.reasoning,debate_summary:t.analysis.investmentDebate?{bull_arguments:[t.analysis.investmentDebate.bullArguments],bear_arguments:[t.analysis.investmentDebate.bearArguments],risk_assessment:"See full analysis for risk details"}:void 0}}}async reflectOnTrade(e){return{success:!0}}async getDebateAnalystConfig(){return{success:!0}}async runBacktest(e){const t=await this.fetchAPI("/backtest",{method:"POST",body:JSON.stringify({symbol:e.symbol,startDate:"2023-01-01",endDate:/* @__PURE__ */(new Date).toISOString().split("T")[0],strategy:"momentum"})});return{success:t.success,symbol:t.symbol,timestamp:/* @__PURE__ */(new Date).toISOString(),primo_results:{"Starting Portfolio Value [$]":t.initialCapital,"Final Portfolio Value [$]":t.finalValue,"Cumulative Return [%]":t.totalReturnPercent,"Annual Return [%]":0,"Annual Volatility [%]":0,"Sharpe Ratio":t.metrics.sharpeRatio||0,"Max Drawdown [%]":t.metrics.maxDrawdown,"Total Trades":t.metrics.totalTrades,"Win Rate [%]":t.metrics.winRate},buyhold_results:{"Cumulative Return [%]":0,"Annual Return [%]":0,"Sharpe Ratio":0,"Max Drawdown [%]":0},comparison:{relative_return:0,outperformed:t.totalReturn>0,metrics:{cumulative_return_diff:0,volatility_diff:0,max_drawdown_diff:0,sharpe_diff:0}}}}async getAvailableStocks(e="./output/csv"){return{success:!0,files:[]}}async analyzeTopStocks(e="mag7",t="news-researcher"){const n=jB[e];if("news-researcher"===t){return await Promise.allSettled(n.map(e=>this.analyzeWithNewsResearcher({symbols:[e]})))}return await Promise.allSettled(n.map(e=>this.analyzeWithDebateAnalyst({symbol:e})))}async batchBacktest(e){return await Promise.allSettled(e.map(e=>this.runBacktest({symbol:e})))}}const XB=new WB;async function KB(e,t="debate-analyst"){return"news-researcher"===t?XB.analyzeWithNewsResearcher({symbols:[e]}):XB.analyzeWithDebateAnalyst({symbol:e})}async function YB(e="mag7",t="news-researcher"){return XB.analyzeTopStocks(e,t)}async function qB(e){return XB.runBacktest({symbol:e})}async function QB(){return XB.getHealth()}const JB={health:["health"],newsResearcher:e=>["news-researcher",...e],debateAnalyst:e=>["debate-analyst",e],backtest:e=>["backtest",e],availableStocks:["available-stocks"],topStocks:(e,t)=>["top-stocks",e,t]};class zB{BASE_URL="https://wikimedia.org/api/rest_v1";userAgent;constructor(e){this.userAgent=e||"wiki-pageviews-ts/1.0.0"}formatDate(e,t=!1){const n="string"==typeof e?new Date(e):e;if("string"==typeof e&&/^\d{8}(\d{2})?$/.test(e))return e;const r=e=>e.toString().padStart(2,"0"),i=`${n.getUTCFullYear()}${r(n.getUTCMonth()+1)}${r(n.getUTCDate())}`;return t?`${i}${r(n.getUTCHours())}`:i}async request(e){const t=await fetch(e,{headers:{"User-Agent":this.userAgent}});if(!t.ok){const e=await t.text();let n=`HTTP ${t.status}`;try{const t=JSON.parse(e);n=t.detail||t.title||n}catch{}throw new Error(n)}return t.json()}validateProject(e){if(e&&"all-projects"!==e&&"wikidata"!==e&&!e.includes("."))throw new Error('Invalid project name. Must be a valid wiki domain (e.g., "en.wikipedia.org")')}async getPerArticlePageviews(e){const t=e.project||"en.wikipedia.org";if(this.validateProject(t),e.articles){const t=e.articles.map(t=>this.getPerArticlePageviews({...e,article:t,articles:void 0}));return Promise.all(t)}if(!e.article)throw new Error('Required parameter "article" missing');const n=encodeURIComponent(e.article.replace(/\s/g,"_")),r=this.formatDate(e.start),i=this.formatDate(e.end),a=e.access||"all-access",o=e.agent||"all-agents",s=e.granularity||"daily",c=`${this.BASE_URL}/metrics/pageviews/per-article/${t}/${a}/${o}/${n}/${s}/${r}/${i}`;return this.request(c)}async getAggregatedPageviews(e){if(e.projects&&"all-projects"!==e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getAggregatedPageviews({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||e.projects||"en.wikipedia.org";this.validateProject(t);const n=this.formatDate(e.start,!0),r=this.formatDate(e.end,!0),i=e.access||"all-access",a=e.agent||"all-agents",o=e.granularity||"daily",s=`${this.BASE_URL}/metrics/pageviews/aggregate/${t}/${i}/${a}/${o}/${n}/${r}`;return this.request(s)}async getAggregatedLegacyPagecounts(e){if(e.projects&&"all-projects"!==e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getAggregatedLegacyPagecounts({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||e.projects||"en.wikipedia.org";this.validateProject(t);const n=this.formatDate(e.start,!0),r=this.formatDate(e.end,!0),i=e.accessSite||"all-sites",a=e.granularity||"hourly",o=`${this.BASE_URL}/metrics/legacy/pagecounts/aggregate/${t}/${i}/${a}/${n}/${r}`;return this.request(o)}async getTopPageviews(e){if(e.date){const t="string"==typeof e.date?new Date(e.date):e.date;e.year=t.getUTCFullYear(),e.month=t.getUTCMonth()+1,e.day=t.getUTCDate()}if(!e.year||!e.month||!e.day)throw new Error('Required parameters "year", "month", and "day" missing');if(e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getTopPageviews({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||"en.wikipedia.org";this.validateProject(t);const n=e.year.toString(),r=e.month.toString().padStart(2,"0"),i=e.day.toString().padStart(2,"0"),a=e.access||"all-access",o=`${this.BASE_URL}/metrics/pageviews/top/${t}/${a}/${n}/${r}/${i}`,s=await this.request(o);return e.limit&&s.items[0]?.articles&&(s.items[0].articles=s.items[0].articles.slice(0,e.limit)),s}async getTopPageviewsByCountry(e){if(!e.year||!e.month)throw new Error('Required parameters "year" and "month" missing');if(e.projects){const t=(Array.isArray(e.projects)?e.projects:[e.projects]).map(t=>this.getTopPageviewsByCountry({...e,project:t,projects:void 0}));return Promise.all(t)}const t=e.project||"en.wikipedia.org";this.validateProject(t);const n=e.year.toString(),r=e.month.toString().padStart(2,"0"),i=e.access||"all-access",a=`${this.BASE_URL}/metrics/pageviews/top-by-country/${t}/${i}/${n}/${r}`;return this.request(a)}async getUniqueDevices(e){if(!e.project)throw new Error('Required parameter "project" missing');this.validateProject(e.project);const t=e.project,n=this.formatDate(e.start),r=this.formatDate(e.end),i=e.accessSite||"all-sites",a=e.granularity||"daily",o=`${this.BASE_URL}/metrics/unique-devices/${t}/${i}/${a}/${n}/${r}`;return this.request(o)}async getPageviewsDimensions(){const e=`${this.BASE_URL}/metrics/pageviews/`;return this.request(e)}}const ZB=new zB;export{Af as $,Uh as A,hi as B,Ch as C,Lr as D,Cm as E,Kr as F,_f as G,of as H,fi as I,ff as J,Nm as K,lf as L,di as M,wf as N,yf as O,tf as P,mf as Q,Ih as R,WB as S,jB as T,Wr as U,gf as V,zB as W,If as X,Jr as Y,af as Z,Cf as _,pi as a,ig as a$,uf as a0,hf as a1,df as a2,pf as a3,ng as a4,tg as a5,Hh as a6,bm as a7,VB as a8,$B as a9,rm as aA,im as aB,nm as aC,sg as aD,og as aE,ag as aF,ym as aG,vf as aH,$r as aI,Zm as aJ,Qr as aK,ZB as aL,Xh as aM,Ur as aN,JB as aO,Mm as aP,cm as aQ,qf as aR,Wf as aS,Uf as aT,xf as aU,jf as aV,Ff as aW,Vr as aX,$f as aY,Jf as aZ,Zf as a_,Wh as aa,$h as ab,nf as ac,lm as ad,Nr as ae,ni as af,ef as ag,ti as ah,am as ai,Vf as aj,rf as ak,Qf as al,Yf as am,Kf as an,kf as ao,Hf as ap,ri as aq,zf as ar,Zh as as,zh as at,QB as au,ei as av,om as aw,Dm as ax,tm as ay,Xf as az,yh as b,rg as b0,sf as b1,Gf as b2,cf as b3,cg as b4,xr as b5,XB as b6,dh as b7,Lm as b8,_m as b9,eg as ba,Em as bb,Pm as bc,Rm as bd,vm as be,wm as bf,Tm as bg,Bm as bh,Om as bi,ug as bj,lg as bk,Hr as bl,Jh as bm,em as bn,Zr as bo,zr as bp,fh as bq,Hi as c,Gh as d,mi as e,Gi as f,xi as g,Qh as h,jh as i,um as j,KB as k,YB as l,qB as m,gm as n,sm as o,Gr as p,kr as q,jr as r,Kh as s,Ef as t,Am as u,hh as v,uh as w,lh as x,Xr as y,Fr as z};