From e37525f33d5e25bc2bb9d6b0bf3baf19c83ed5d2 Mon Sep 17 00:00:00 2001 From: skmishraoracle Date: Thu, 11 Jul 2024 08:57:48 -0700 Subject: [PATCH 01/33] refresh to current version --- docs/api_refs/package.json | 1 - docs/core_docs/package.json | 1 - examples/package.json | 3 - langchain-core/package.json | 1 - langchain/package.json | 3 - libs/langchain-anthropic/package.json | 1 - libs/langchain-azure-openai/package.json | 1 - libs/langchain-cloudflare/package.json | 3 - libs/langchain-cohere/package.json | 3 - libs/langchain-community/package.json | 8 + .../src/vectorstores/oraclevs.ts | 694 +++++++++++++ .../src/vectorstores/tests/oraclevs.test.ts | 227 +++++ libs/langchain-exa/package.json | 3 - libs/langchain-google-common/package.json | 3 - libs/langchain-google-gauth/package.json | 3 - libs/langchain-google-genai/package.json | 3 - .../package.json | 3 - libs/langchain-google-vertexai/package.json | 3 - libs/langchain-google-webauth/package.json | 3 - libs/langchain-groq/package.json | 3 - libs/langchain-mistralai/package.json | 3 - libs/langchain-mongodb/package.json | 3 - libs/langchain-nomic/package.json | 3 - libs/langchain-openai/package.json | 1 - libs/langchain-pinecone/package.json | 3 - libs/langchain-redis/package.json | 3 - libs/langchain-scripts/package.json | 3 - libs/langchain-weaviate/package.json | 3 - libs/langchain-yandex/package.json | 3 - package.json | 11 + yarn.lock | 912 +++--------------- 31 files changed, 1059 insertions(+), 859 deletions(-) create mode 100644 libs/langchain-community/src/vectorstores/oraclevs.ts create mode 100644 libs/langchain-community/src/vectorstores/tests/oraclevs.test.ts diff --git a/docs/api_refs/package.json b/docs/api_refs/package.json index 55f5f0428936..3b301844a477 100644 --- a/docs/api_refs/package.json +++ b/docs/api_refs/package.json @@ -24,7 +24,6 @@ "@types/react": "^18", "@types/react-dom": "^18", "autoprefixer": "^10.0.1", - "eslint": "^8", "eslint-config-next": "14.0.1", "postcss": "^8", "prettier": "^2.8.3", diff --git a/docs/core_docs/package.json b/docs/core_docs/package.json index a356cacd1ebe..bc16894c7117 100644 --- a/docs/core_docs/package.json +++ b/docs/core_docs/package.json @@ -56,7 +56,6 @@ "@types/cookie": "^0", "docusaurus-plugin-typedoc": "1.0.0-next.5", "dotenv": "^16.4.5", - "eslint": "^8.19.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-prettier": "^8.5.0", "eslint-plugin-header": "^3.1.1", diff --git a/examples/package.json b/examples/package.json index 56fb064ed456..e0ea9607ea11 100644 --- a/examples/package.json +++ b/examples/package.json @@ -110,10 +110,7 @@ "@tsconfig/recommended": "^1.0.2", "@types/js-yaml": "^4", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^5.51.0", - "@typescript-eslint/parser": "^5.51.0", "dotenv": "^16.0.3", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/langchain-core/package.json b/langchain-core/package.json index ed1fce530149..c7be06172500 100644 --- a/langchain-core/package.json +++ b/langchain-core/package.json @@ -61,7 +61,6 @@ "@swc/jest": "^0.2.29", "@types/mustache": "^4", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/langchain/package.json b/langchain/package.json index d55995535975..2b5634f9c517 100644 --- a/langchain/package.json +++ b/langchain/package.json @@ -627,8 +627,6 @@ "@types/pdf-parse": "^1.1.1", "@types/uuid": "^9", "@types/ws": "^8", - "@typescript-eslint/eslint-plugin": "^5.58.0", - "@typescript-eslint/parser": "^5.58.0", "@vercel/kv": "^0.2.3", "@xata.io/client": "^0.28.0", "apify-client": "^2.7.1", @@ -642,7 +640,6 @@ "dotenv": "^16.0.3", "dpdm": "^3.12.0", "epub2": "^3.0.1", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-anthropic/package.json b/libs/langchain-anthropic/package.json index b94ca016e8a3..94efaab0f3c0 100644 --- a/libs/langchain-anthropic/package.json +++ b/libs/langchain-anthropic/package.json @@ -49,7 +49,6 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-azure-openai/package.json b/libs/langchain-azure-openai/package.json index 99ec548694f3..2086cf1944b2 100644 --- a/libs/langchain-azure-openai/package.json +++ b/libs/langchain-azure-openai/package.json @@ -46,7 +46,6 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-cloudflare/package.json b/libs/langchain-cloudflare/package.json index 24669f14f9d1..3c2f9495b88f 100644 --- a/libs/langchain-cloudflare/package.json +++ b/libs/langchain-cloudflare/package.json @@ -48,11 +48,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-cohere/package.json b/libs/langchain-cohere/package.json index 8400572decd3..f080d7fc1d24 100644 --- a/libs/langchain-cohere/package.json +++ b/libs/langchain-cohere/package.json @@ -48,11 +48,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-community/package.json b/libs/langchain-community/package.json index 8f8e1cc832aa..133833f95785 100644 --- a/libs/langchain-community/package.json +++ b/libs/langchain-community/package.json @@ -121,11 +121,16 @@ "@types/pg-copy-streams": "^1.2.2", "@types/uuid": "^9", "@types/ws": "^8", +<<<<<<< HEAD "@typescript-eslint/eslint-plugin": "^5.58.0", "@typescript-eslint/parser": "^5.58.0", "@upstash/ratelimit": "^1.2.1", "@upstash/redis": "^1.32.0", "@upstash/vector": "^1.1.1", +======= + "@upstash/redis": "^1.20.6", + "@upstash/vector": "^1.0.2", +>>>>>>> 19ef85a6 (modification to oraclevs.ts) "@vercel/kv": "^0.2.3", "@vercel/postgres": "^0.5.0", "@writerai/writer-sdk": "^0.40.2", @@ -153,8 +158,11 @@ "dpdm": "^3.12.0", "dria": "^0.0.3", "duck-duck-scrape": "^2.2.5", +<<<<<<< HEAD "epub2": "^3.0.1", "eslint": "^8.33.0", +======= +>>>>>>> 19ef85a6 (modification to oraclevs.ts) "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-community/src/vectorstores/oraclevs.ts b/libs/langchain-community/src/vectorstores/oraclevs.ts new file mode 100644 index 000000000000..2d11066530ce --- /dev/null +++ b/libs/langchain-community/src/vectorstores/oraclevs.ts @@ -0,0 +1,694 @@ +import * as oracledb from "oracledb"; +import { v4 as uuidv4 } from 'uuid'; +import {MaxMarginalRelevanceSearchOptions, VectorStore,} from "@langchain/core/vectorstores"; +import {Document, DocumentInterface} from "@langchain/core/documents"; +import {Embeddings} from "@langchain/core/embeddings"; +import {Callbacks} from "@langchain/core/callbacks/manager"; +import {createLogger, format, transports, Logform} from 'winston' +import { maximalMarginalRelevance } from "@langchain/core/utils/math"; + +export enum DistanceStrategy { + COSINE, + DOT_PRODUCT, + EUCLIDEAN_DISTANCE, + MANHATTAN_DISTANCE, + HAMMING_DISTANCE, + EUCLIDEAN_SQUARED +} + +type AddDocumentOptions = Record; + +interface CustomLogInfo extends Logform.TransformableInfo { + level: string; + message: string; + timestamp?: string; +} + +// eslint-disable-next-line no-process-env +const logLevel = process.env.LOG_LEVEL?.toLowerCase() || 'error'; + +const logger = createLogger({ + level: logLevel, + format: format.combine( + format.timestamp(), + format.printf((info: Logform.TransformableInfo) => { + // Now 'info' is typed, which includes 'level', 'message', and 'timestamp' + const { level, message, timestamp } = info as CustomLogInfo; + return `${timestamp} - ${level.toUpperCase()} - ${message}`; + }) + ), + transports: [ + new transports.Console(), + ] +}); + +function handleError(error: unknown): never { + // Type guard to check if the error is an object and has 'name' and 'message' properties + if (typeof error === "object" && error !== null && "name" in error && "message" in error) { + const err = error as { name: string, message: string }; // Type assertion based on guarded checks + + // Log the error message with appropriate details + logger.error(`Error occurred: ${err.message}`); + + // Handle specific error types based on the name property + switch (err.name) { + case "RuntimeError": + // Specific log for RuntimeError + logger.error(`Runtime error during operation: ${err.message}`); + throw new Error("Database operation failed due to a runtime error."); + case "ValidationError": + // Specific log for ValidationError + logger.error(`Validation error during operation: ${err.message}`); + throw new Error("Operation failed due to a validation error."); + default: + // Log and throw for any other type of error + logger.error(`Unexpected error during operation: ${err.message}`); + throw new Error("An unexpected error occurred during the operation."); + } + } else { + // This block handles cases where the error might not be an object or missing expected properties + logger.error("A non-standard error or non-object was thrown."); + throw new Error("An unknown and unexpected error occurred."); + } +} + +async function tableExists(connection: oracledb.Connection, tableName: string): Promise { + try { + await connection.execute(`SELECT COUNT(*) FROM ${tableName}`); + return true; // If query executes successfully, table exists + } catch (ex) { + if (ex instanceof Error && 'errorNum' in ex) { + const error = ex as oracledb.DBError; // Type casting to use DBError specific fields + if (error.errorNum === 942) { + return false; // Table does not exist + } + } + throw ex; // Rethrow the error if it's not the specific 'table does not exist' error + } +} + +async function indexExists(connection: oracledb.Connection, indexName: string): Promise { + try { + const query = `SELECT index_name + FROM all_indexes + WHERE upper(index_name) = upper(:idx_name)`; + const result = await connection.execute(query, {idx_name: indexName.toUpperCase()}, {outFormat: oracledb.OUT_FORMAT_OBJECT}); + + // Check if `rows` is defined and has at least one entry + return !!(result.rows && result.rows.length > 0); + } catch (error: unknown) { + handleError(error); + } +} + +function getDistanceFunction(distanceStrategy: DistanceStrategy): string { + const distanceStrategy2Function: { [key in DistanceStrategy]?: string } = { + [DistanceStrategy.COSINE]: 'COSINE', + [DistanceStrategy.EUCLIDEAN_DISTANCE]: 'EUCLIDEAN', + [DistanceStrategy.DOT_PRODUCT]: 'DOT', + [DistanceStrategy.MANHATTAN_DISTANCE]: 'MANHATTAN', + [DistanceStrategy.HAMMING_DISTANCE]: 'HAMMING', + [DistanceStrategy.EUCLIDEAN_SQUARED]: 'EUCLIDEAN_SQUARED' + }; + + const result = distanceStrategy2Function[distanceStrategy]; + if (result === undefined) { + throw new Error(`Unsupported distance strategy: ${distanceStrategy}`); + } + + return result; +} + +async function getEmbeddingDimension(embeddings: Embeddings, query: string): Promise { + if (embeddings instanceof Embeddings) { + // Assuming embedQuery returns a Promise that resolves to an array + const embeddingVector = await embeddings.embedQuery(query); + // Return the length of the embedding vector + return embeddingVector.length; + } + // Handle the case where the input is not an instance of Embeddings or any other appropriate action + throw new Error('Input is not an instance of Embeddings'); +} + +export async function createTable(connection: oracledb.Connection, tableName: string, embeddingDim: number): Promise { + const colsDict = { + id: 'RAW(16) DEFAULT SYS_GUID() PRIMARY KEY', + text: 'CLOB', + metadata: 'CLOB', + embedding: `vector(${embeddingDim}, FLOAT32)` + }; + + try { + const tableExistsResult = await tableExists(connection, tableName); + if (!tableExistsResult) { + const ddlBody = Object.entries(colsDict).map(([colName, colType]) => `${colName} ${colType}`).join(', '); + const ddl = `CREATE TABLE ${tableName} + ( + ${ddlBody} + )`; + await connection.execute(ddl); + console.log("Table created successfully..."); + } else { + console.log("Table already exists..."); + } + } catch (error: unknown) { + handleError(error); + } +} + +function getIndexName(baseName: string): string { + const uniqueId = uuidv4().replace(/-/g, ''); + return `${baseName}_${uniqueId}`; +} + +export async function createIndex(client: oracledb.Connection, + vectorStore: OracleVS, + params?: { [key: string]: any }) : Promise { + if (params) { + switch (params.idxType) { + case 'HNSW': + await createHNSWIndex(client, vectorStore, params); + break; + case 'IVF': + await createIVFIndex(client, vectorStore, params); + break; + default: + await createHNSWIndex(client, vectorStore, params); + } + } else { + await createHNSWIndex(client, vectorStore, params); + } +} + +async function createHNSWIndex( connection: oracledb.Connection, oraclevs: OracleVS, + params?: { [key: string]: any } +): Promise { + try { + const defaults : { [key: string]: any } = { + idx_name: "HNSW", + idx_type: "HNSW", + neighbors: 32, + efConstruction: 200, + accuracy: 90, + parallel: 8 + }; + + // if params then copy params to config + let config: { [key: string]: any } = params ? {...params} : {...defaults}; + + // Ensure compulsory parts are included + const compulsoryKeys = ["idx_name", "parallel"]; + compulsoryKeys.forEach(key => { + if (!(key in config)) { + if (key === "idx_name") { + config[key] = getIndexName(defaults[key] as string); + } else { + config[key] = defaults[key] as number; + } + } + }); + + // Validate keys in config against defaults + Object.keys(config).forEach(key => { + if (!(key in defaults)) { + throw new Error(`Invalid parameter: ${key}`); + } + }); + + const idxName = config['idx_name']; + const baseSql = `CREATE VECTOR INDEX ${idxName} ON ${oraclevs.tableName}(embedding) ORGANIZATION INMEMORY NEIGHBOR GRAPH`; + const accuracyPart = config.accuracy ? ` WITH TARGET ACCURACY ${config.accuracy}` : ""; + const distancePart = ` DISTANCE ${getDistanceFunction(oraclevs.distanceStrategy)}`; + + let parametersPart = ""; + if ("neighbors" in config && "efConstruction" in config) { + parametersPart = ` parameters (type ${config.idx_type}, neighbors ${config.neighbors}, efConstruction ${config.efConstruction})`; + } else if ("neighbors" in config && !("efConstruction" in config)) { + config.efConstruction = defaults.efConstruction; + parametersPart = ` parameters (type ${config.idx_type}, neighbors ${config.neighbors}, efConstruction ${config.efConstruction})`; + } else if (!("neighbors" in config) && "efConstruction" in config) { + config.neighbors = defaults.neighbors; + parametersPart = ` parameters (type ${config.idx_type}, neighbors ${config.neighbors}, efConstruction ${config.efConstruction})`; + } + + const parallelPart = ` PARALLEL ${config.parallel}`; + + const ddl = baseSql + accuracyPart + distancePart + parametersPart + parallelPart; + + const idxExists = await indexExists(connection, config['idx_name']); + if (!idxExists) { + await connection.execute(ddl); + console.log("Index created successfully..."); + } else { + console.log("Index already exists"); + } + } catch (error: unknown) { + handleError(error); + } +} + +async function createIVFIndex( connection: oracledb.Connection, oraclevs: OracleVS, + params?: { [key: string]: any } +): Promise { + try { + const defaults : { [key: string]: any } = { + idx_name: "IVF", + idx_type: "IVF", + neighbor_part: 32, + accuracy: 90, + parallel: 8 + }; + + // Combine defaults with any provided params. Note: params could contain keys not explicitly declared in IndexConfig + let config : { [key: string]: any } = params ? {...params} : {...defaults}; + + // Ensure compulsory parts are included + const compulsoryKeys = ["idx_name", "parallel"]; + compulsoryKeys.forEach(key => { + if (!(key in config)) { + if (key === "idx_name") { + config[key] = getIndexName(defaults[key] as string); + } else { + config[key] = defaults[key] as any; + } + } + }); + + // Validate keys in config against defaults + Object.keys(config).forEach(key => { + if (!(key in defaults)) { + throw new Error(`Invalid parameter: ${key}`); + } + }); + + // Base SQL statement + const idxName = config.idx_name; // Directly accessing since idx_name must exist as ensured by ensureCompulsoryFields + const baseSql = `CREATE VECTOR INDEX ${idxName} ON ${oraclevs.tableName}(embedding) ORGANIZATION NEIGHBOR PARTITIONS`; + + // Optional parts depending on parameters + const accuracyPart = config.accuracy ? ` WITH TARGET ACCURACY ${config.accuracy}` : ""; + const distancePart = ` DISTANCE ${getDistanceFunction(oraclevs.distanceStrategy)}`; + + let parametersPart = ""; + if ("idx_type" in config && "neighbor_part" in config) { + parametersPart = ` PARAMETERS (type ${config.idx_type}, neighbor partitions ${config.neighbor_part})`; + } + + // Always included part for parallel - assuming parallel is compulsory and always included + const parallelPart = ` PARALLEL ${config.parallel}`; + + // Combine all parts + const ddl = baseSql + accuracyPart + distancePart + parametersPart + parallelPart; + + const idxExists = await indexExists(connection, config['idx_name']); + if (!idxExists) { + await connection.execute(ddl); + console.log("Index created successfully..."); + } else { + console.log("Index already exists"); + } + } catch (error: unknown) { + handleError(error); + } +} +export async function dropTablePurge(connection: oracledb.Connection, tableName: string): Promise { + try { + const exists = await tableExists(connection, tableName); + if (exists) { + const ddl = `DROP TABLE ${tableName} PURGE`; + await connection.execute(ddl); + console.log("Table dropped successfully..."); + } else { + console.log("Table not found..."); + } + } catch (error: unknown) { + handleError(error); + } +} + +export async function dropIndexIfExists(connection: oracledb.Connection, indexName: string): Promise { + try { + const exists = await indexExists(connection, indexName); + if (exists) { + const dropQuery = `DROP INDEX ${indexName}`; + await connection.execute(dropQuery); + console.log(`Index ${indexName} has been dropped.`); + } else { + console.log(`Index ${indexName} does not exist.`); + } + } catch (error: unknown) { + handleError(error); + } +} + +export class OracleVS extends VectorStore { + + readonly client: oracledb.Pool; + readonly embeddings: Embeddings; + embeddingDimension: number | undefined; + readonly tableName: string; + readonly distanceStrategy: DistanceStrategy; + readonly query: string; + + _vectorstoreType(): string { + return "oraclevs"; + } + + constructor(embeddings: Embeddings, dbConfig: Record) { + try { + super(embeddings, dbConfig) + this.client = dbConfig.client; + this.tableName = dbConfig.tableName; + this.distanceStrategy = dbConfig.distanceStrategy; + this.query = dbConfig.query; + + // Check if embeddings is an instance of Embeddings + if (!(dbConfig.embeddings instanceof Embeddings)) { + console.warn( + "`embeddings is expected to be an Embeddings object, support " + + "for passing in a function will soon be removed." ); + } + this.embeddings = dbConfig.embeddings; + + } catch (error: unknown) { + handleError(error); + } + } + + async initialize(): Promise { + let connection: oracledb.Connection | null = null; + try { + this.embeddingDimension = await getEmbeddingDimension(this.embeddings, this.query); + connection = await this.client.getConnection() + await createTable(connection, this.tableName, this.embeddingDimension); + } catch (error: unknown) { + handleError(error); + } finally { + if(connection) + await connection.close() + } + } + + public async getConnection(): Promise { + try { + return await this.client.getConnection() + } catch (error: unknown) { + handleError(error); + } + + } + + /** + * Method to add vectors to the Oracle database. + * @param vectors The vectors to add. + * @param documents The documents associated with the vectors. + * @param options + * @returns Promise that resolves when the vectors have been added. + */ + public async addVectors( + vectors: number[][], + documents: DocumentInterface[], + options?: AddDocumentOptions + ): Promise { + if (vectors.length === 0) { + throw new Error("Vectors input null. Nothing to add..."); + } + + let ids: string[] = options?.ids || []; + let connection: oracledb.Connection | null = null; + + try { + // Ensure there are IDs for all documents + if (ids.length === 0) { + documents.forEach((doc, index) => { + if (!doc.metadata?.id) { + throw new Error(`Missing ID in document metadata at index ${index}.`); + } + ids.push(doc.metadata.id); + }); + } + + const binds = documents.map((doc, index) => ({ + id: { val: doc.metadata.id }, + text: { val: doc.pageContent }, // Assuming 'text' should come from 'pageContent' + metadata: { val: JSON.stringify(doc.metadata) }, // Assuming you want to store metadata as a string + embedding: { val: vectors[index] } // Make sure vectors align with documents by index + })); + + connection = await this.client.getConnection(); + + await connection.executeMany( + `INSERT INTO ${this.tableName} (id, text, metadata, embedding) + VALUES (:id, :text, :metadata, :embedding)`, binds + ); + + await connection.commit(); + + return ids; + } catch (error: unknown) { + handleError(error); + } finally { + if (connection) { + await connection.close(); + } + } + } + + public async addDocuments( + documents: DocumentInterface[], + options?: AddDocumentOptions + ): Promise { + const texts = documents.map(({ pageContent }) => pageContent); + + return this.addVectors( + await this.embeddings.embedDocuments(texts), documents, options ); + } + + /** + * Method to search for vectors that are similar to a given query vector. + * @param query The query vector. + * @param k The number of similar vectors to return. + * @param filter Optional filter for the search results. + * @returns Promise that resolves with an array of tuples, each containing a Document and a score. + */ + public async similaritySearchByVectorReturningEmbeddings( + query: number[], + k: number = 4, + filter?: this["FilterType"] + ): Promise<[Document, number, Float32Array | number[]][]> { + const docsScoresAndEmbeddings : Array<[Document, number, Float32Array | number[]]> = []; + + interface QueryResultRow { + id: string; // Assuming 'id' is a string, adjust the type as necessary + text: string; + metadata: string; // JSON string + distance: number; // Assuming distance is a number + embedding: Float32Array | number[]; // Based on how embedding is stored and returned + } + + let connection: oracledb.Connection | null = null; + try { + const convertedEmbedding = new Float32Array(query); + + const sqlQuery = ` + SELECT id, + text, + metadata, + vector_distance(embedding, $1, ${getDistanceFunction(this.distanceStrategy)}) as distance, + embedding + FROM ${this.tableName} + ORDER BY vector_distance(embedding, $1, ${getDistanceFunction(this.distanceStrategy)}) + FETCH APPROX FIRST $2 ROWS ONLY `; + + // Execute the query + connection = await this.client.getConnection() + const resultSet = await connection.execute(sqlQuery, [convertedEmbedding, k]); + + if (resultSet.rows && resultSet.rows.length > 0) { + // Assert the type of results.rows for TypeScript + const results: QueryResultRow[] = resultSet.rows as QueryResultRow[]; + // Filter results if filter is provided + for (const result of results) { + const metadata = JSON.parse(result.metadata || '{}'); + + if (filter && Object.entries(filter).every(([key, value]) => metadata[key] === value)) { + const document = new Document({ + pageContent: result.text || '', + metadata: metadata, + }); + // @ts-ignore + const distance = result.distance; + // @ts-ignore + const embedding = result.embedding; + docsScoresAndEmbeddings.push([document, distance, embedding]); + } else if (!filter) { + const document = new Document({ + pageContent: result.text || '', + metadata: metadata, + }); + // @ts-ignore + const distance = result.distance; + // @ts-ignore + const embedding = result.embedding; + docsScoresAndEmbeddings.push([document, distance, embedding]); + } + } + } else { + // Throw an exception if no rows are found + throw new Error("No rows found."); + } + return docsScoresAndEmbeddings; + } finally { + if (connection) + await connection.close() + } + } + + public async similaritySearchVectorWithScore(query: number[], + k: number, + filter?: this["FilterType"]): + Promise<[DocumentInterface, number][]> { + const docsScoresAndEmbeddings = await this.similaritySearchByVectorReturningEmbeddings( query, k, filter) + return docsScoresAndEmbeddings.map(([document, score]) => [document, score]); + } + + /** + * Return documents selected using the maximal marginal relevance. + * Maximal marginal relevance optimizes for similarity to the query AND diversity + * among selected documents. + * + * @param {string} query - Text to look up documents similar to. + * @param options + * @param {number} options.k - Number of documents to return. + * @param {number} options.fetchK - Number of documents to fetch before passing to the MMR algorithm. + * @param {number} options.lambda - Number between 0 and 1 that determines the degree of diversity among the results, + * where 0 corresponds to maximum diversity and 1 to minimum diversity. + * @param {this["FilterType"]} options.filter - Optional filter + * @param _callbacks + * + * @returns {Promise} - List of documents selected by maximal marginal relevance. + */ + public async maxMarginalRelevanceSearch?( + query: string, + options: MaxMarginalRelevanceSearchOptions | undefined, + _callbacks: Callbacks | undefined + ): Promise { + if (!options) { + options = { k: 10, fetchK: 20 }; // Default values for the options + } + const embedding = await this.embeddings.embedQuery(query); + return await this.maxMarginalRelevanceSearchByVector(embedding, options, _callbacks); + } + + public async maxMarginalRelevanceSearchByVector( + embedding: number[], + options: MaxMarginalRelevanceSearchOptions | undefined, + _callbacks: Callbacks | undefined // implement passing to embedQuery later + ): Promise { + if (!options) { + options = { k: 10, fetchK: 20 }; // Default values for the options + } + // Fetch documents and their scores. This calls the previously adapted function. + const docsAndScores = await this.maxMarginalRelevanceSearchWithScoreByVector(embedding, options, _callbacks); + + // Extract and return only the documents from the results + return docsAndScores.map(ds => ds.document); + } + + public async maxMarginalRelevanceSearchWithScoreByVector( + embedding: number[], + options: MaxMarginalRelevanceSearchOptions, + _callbacks: Callbacks | undefined // implement passing to embedQuery later + ): Promise> { + if (!options) { + options = { k: 10, fetchK: 20 }; // Default values for the options + } + + // Fetch documents and their scores. + const docsScoresEmbeddings = await this.similaritySearchByVectorReturningEmbeddings(embedding, options.fetchK, options.filter); + + if (!docsScoresEmbeddings.length) { + return []; + } + + // Split documents, scores, and embeddings + const documents: Document[] = docsScoresEmbeddings.map(([document]) => document); + const scores: number[] = docsScoresEmbeddings.map(([, score]) => score); + const embeddings: (Float32Array | number[])[] = docsScoresEmbeddings.map(([,, embedding])=> new Float32Array( + embedding)); + + // Convert all embeddings to Float32Array for consistency + const consistentEmbeddings: number[][] = embeddings.map(embedding => Array.from(embedding)); + const queryEmbedding: number[] = Array.from(embedding); + + // Ensure lambdaMult has a default value if not provided + const lambdaMult = 0.5; + const mmrSelectedIndices: number[] = maximalMarginalRelevance(queryEmbedding, + consistentEmbeddings, + lambdaMult, + options.k); + + // Filter documents based on MMR-selected indices and map scores + return mmrSelectedIndices.map(index => ({ + document: documents[index], + score: scores[index] + })); + } + + public async delete(params: { ids?: string[], deleteAll?: boolean }): Promise { + let connection: oracledb.Connection | null = null; + try { + connection = await this.client.getConnection() + if (params.ids && params.ids.length > 0) { + // Dynamically create placeholders + const placeholders = params.ids.map((_, index) => `:${index + 1}`).join(','); + // Prepare the query + const query = `DELETE FROM ${this.tableName} WHERE id IN (${placeholders})`; + // Execute the query with the IDs as bind parameters + await connection.execute(query, [...params.ids]); + await connection.commit(); + } else if (params.deleteAll) { + await connection.execute(`TRUNCATE TABLE ${this.tableName}`) + } + } catch (error: unknown) { + handleError(error); + } finally { + if (connection) + await connection.close() + } + + } + + static async fromDocuments(documents: DocumentInterface>[], + embeddings: Embeddings, + dbConfig: Record): Promise { + let connection: oracledb.Connection | null = null; + const client = dbConfig.client + if (!client) { + throw new Error('client parameter is required...'); + } + + try { + connection = await client.getConnection() + if (connection) + await dropTablePurge(connection, dbConfig.tableName); + else + throw new Error(`Invalid connection pool, pass a valid pool `); + + const vss = new OracleVS(embeddings, dbConfig); + + // Use Promise.all to wait for all embedQuery promises to resolve + const vectors = await Promise.all(documents.map(document => + embeddings.embedQuery(document.pageContent) + )); + + // Assuming a method exists to handle adding texts and metadatas appropriately + await vss.addVectors(vectors, documents); + + return vss; + } finally { + if (connection) + await connection.close() + } + } +} diff --git a/libs/langchain-community/src/vectorstores/tests/oraclevs.test.ts b/libs/langchain-community/src/vectorstores/tests/oraclevs.test.ts new file mode 100644 index 000000000000..88cb4cd8fe94 --- /dev/null +++ b/libs/langchain-community/src/vectorstores/tests/oraclevs.test.ts @@ -0,0 +1,227 @@ +import * as oracledb from 'oracledb'; +import * as dotenv from 'dotenv'; +import {createIndex, OracleVS} from "./oravsjs"; +import {Document, DocumentInterface} from "@langchain/core/documents"; +import {Embeddings} from "@langchain/core/embeddings"; +import {promises as fs} from "fs"; +import {MaxMarginalRelevanceSearchOptions} from "@langchain/core/vectorstores"; +import {Callbacks} from "@langchain/core/callbacks/manager"; + +interface DBConfig { + user: string; + password: string; + connectString: string; + poolMin?: number; + poolMax?: number; + poolIncrement?: number; +} + +interface DataRow { + id: string; + link: string; + text: string; +} + +dotenv.config(); + +async function dbConnect(): Promise { + // Create a connection pool + const pool = await oracledb.createPool({ + user: 'vector', + password: 'vector', + connectString: '152.67.235.198:1521/orclpdb1' + }); + + console.log('Connection pool started') + return pool +} + +function getEmbeddingFunction(device: string): EmbeddingFunction | Embeddings | null { + let embeddingFunction: EmbeddingFunction | Embeddings | null = null; + try { + const modelName: string = "sentence-transformers/all-mpnet-base-v2"; + const modelKwargs = { device }; + embeddingFunction = new HuggingFaceEmbeddings(modelName, modelKwargs); + } catch (ex) { + console.error("An exception occurred ::", ex); + // Assuming you have some way to log or handle the traceback. TypeScript/JavaScript does not have a direct equivalent to Python's traceback.print_exc() + } + return embeddingFunction; +} + +class TestsOracleVS { + private client: oracledb.Pool | null = null; + private docsDir: string = "./resources/downloads/oradocs/"; + private filename: string; + private oraclevs: OracleVS; + + constructor(filename: string, embeddingFunction: Embeddings, dbConfig: Record) { + this.filename = filename; + try { + this.oraclevs = new OracleVS(embeddingFunction, dbConfig) + this.filename = filename; + } catch (error) { + console.error("An exception occurred ::", error); + // Handle error + } + } + + async init(): Promise { + this.client = await dbConnect() + } + + private createDocument(row: DataRow): Document { + const metadata = { + id: row.id, + link: row.link, + }; + + // Assuming Document accepts metadata and pageContent in its constructor or has a method to set these + return new Document({pageContent: row.text, metadata: metadata}); + } + + public async testIngestJson(): Promise { + try { + const filePath = `${this.docsDir}${this.filename}`; + const fileContent = await fs.readFile(filePath, {encoding: 'utf8'}); + const jsonData: DataRow[] = JSON.parse(fileContent); + return jsonData.map((row) => this.createDocument(row)); + } catch (error) { + console.error('An error occurred while ingesting JSON:', error); + throw error; // Rethrow the error if you want the calling function to handle it + } + } + + public async testCreateIndex(): Promise { + try { + const connection = await this.oraclevs.getConnection() + + await createIndex(connection, this.oraclevs, { + idx_name: "IVF", + idx_type: "IVF", + neighbor_part: 64, + accuracy: 90 + }); + + console.log("Index created successfully"); + } catch (ex) { + console.error("Exception occurred while index creation", ex); + // TypeScript/JavaScript does not have a direct equivalent to Python's traceback.print_exc(), + // so we log the error object directly, which includes the stack trace. + } + } + + public async testSimilaritySearchByVector( + embedding: number[], + k: number, + filter?: OracleVS["FilterType"], + ): Promise<[DocumentInterface, number][]> { + return this.oraclevs.similaritySearchVectorWithScore( + embedding, + k, + filter, + ); + } + + public async testSimilaritySearchByVectorReturningEmbeddings( + embedding: number[], + k: number = 4, + filter: OracleVS["FilterType"] = null, + ): Promise<[Document, number, Float32Array | number[]][]> { + return await this.oraclevs.similaritySearchByVectorReturningEmbeddings( embedding, k, filter); + } + + public async testMaxMarginalRelevanceSearch( + query: string, + options?: MaxMarginalRelevanceSearchOptions, + _callbacks?: Callbacks | undefined + ): Promise { + return this.oraclevs.maxMarginalRelevanceSearch(query, options, _callbacks); + } + + public async testMaxMarginalRelevanceSearchByVector( + query: number[], + options?: MaxMarginalRelevanceSearchOptions, + _callbacks?: Callbacks | undefined + ): Promise { + return this.oraclevs.maxMarginalRelevanceSearchByVector(query, options, _callbacks); + } + public async testMaxMarginalRelevanceSearchWithScoreByVector( + embedding: number[], + options?: MaxMarginalRelevanceSearchOptions, + _callbacks?: Callbacks | undefined // implement passing to embedQuery later + ): Promise> { + return this.oraclevs.maxMarginalRelevanceSearchWithScoreByVector(embedding, options, _callbacks) + } + + testDelete( params: { ids?: string[], deleteAll?: boolean } ): Promise { + return this.oraclevs.delete(params); + } +} + +async function runTestsOracleVS() { + // Initialize dotenv to load environment variables + dotenv.config(); + const query = "What is the language used by Oracle database"; + // Setup DB config - assuming these values are stored in your .env file + const dbConfig: DBConfig = { + user: process.env.DB_USER || 'vector', + password: process.env.DB_PASSWORD || 'vector', + connectString: process.env.DB_CONNECT_STRING || '152.67.235.198:1521/orclpdb1', + poolMin: parseInt(process.env.DB_POOL_MIN || '4'), + poolMax: parseInt(process.env.DB_POOL_MAX || '10'), + poolIncrement: parseInt(process.env.DB_POOL_INCREMENT || '2') + }; + + // Set up the embedding function + const device: string = "cpu"; // Assuming CPU usage, adjust as necessary + const embeddingFunction: Embeddings | null = getEmbeddingFunction(device); + + if (!embeddingFunction) { + console.error("Failed to initialize the embedding function."); + return; + } + + // Initialize the TestsOracleVS class + const testsOracleVS = new TestsOracleVS("concepts23c_small.json", + embeddingFunction, dbConfig); + + // Initialize connection and other setup + await testsOracleVS.init(); + + // Ingest JSON data to create documents + const documents = await testsOracleVS.testIngestJson(); + console.log("Ingested Documents:", documents); + + // Create an index + await testsOracleVS.testCreateIndex(); + + // Assume some dummy embedding vector for demonstration + // const embedding: number[] = [0.1, 0.2, 0.3, 0.4]; // Example embedding + + // Perform a similarity search by vector + const embedding = await this.embeddings.embedQuery(query); + const similaritySearchByVector = await testsOracleVS.testSimilaritySearchByVector(embedding, 5); + console.log("Similarity Search Results:", similaritySearchByVector); + + // Perform a similarity search by vector + const similaritySearchByEmbeddings = + await testsOracleVS.testSimilaritySearchByVectorReturningEmbeddings(embedding, 5) + console.log("Similarity Search Results:", similaritySearchByEmbeddings); + + const maxMarginalRelevanceSearch = + await testsOracleVS.testMaxMarginalRelevanceSearch(query) + console.log("Max Marginal Relevance Search:", maxMarginalRelevanceSearch); + + const maxMarginalRelevanceSearchByVector = + testsOracleVS.testMaxMarginalRelevanceSearchByVector(embedding) + console.log("Max Marginal Relevance Search By Vector:", maxMarginalRelevanceSearchByVector); + + const maxMarginalRelevanceSearchWithScoreByVector = + testsOracleVS.testMaxMarginalRelevanceSearchWithScoreByVector(embedding) + console.log("Max Marginal Relevance Search By Vector:", maxMarginalRelevanceSearchWithScoreByVector); + +} + +// Run the demonstration +runTestsOracleVS().catch(console.error); \ No newline at end of file diff --git a/libs/langchain-exa/package.json b/libs/langchain-exa/package.json index d4cc7a84c435..6340ad531425 100644 --- a/libs/langchain-exa/package.json +++ b/libs/langchain-exa/package.json @@ -50,11 +50,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-google-common/package.json b/libs/langchain-google-common/package.json index 55996d06b1ac..99e3522169dd 100644 --- a/libs/langchain-google-common/package.json +++ b/libs/langchain-google-common/package.json @@ -50,11 +50,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-google-gauth/package.json b/libs/langchain-google-gauth/package.json index a41e893065d6..88a70d1f81fb 100644 --- a/libs/langchain-google-gauth/package.json +++ b/libs/langchain-google-gauth/package.json @@ -45,11 +45,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-google-genai/package.json b/libs/langchain-google-genai/package.json index a5410bc40619..99fcf3653f02 100644 --- a/libs/langchain-google-genai/package.json +++ b/libs/langchain-google-genai/package.json @@ -46,11 +46,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-google-vertexai-web/package.json b/libs/langchain-google-vertexai-web/package.json index 3e1ee7ce9463..51b189521865 100644 --- a/libs/langchain-google-vertexai-web/package.json +++ b/libs/langchain-google-vertexai-web/package.json @@ -49,11 +49,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-google-vertexai/package.json b/libs/langchain-google-vertexai/package.json index 6b71a1566de4..4d0b7c3ca1ef 100644 --- a/libs/langchain-google-vertexai/package.json +++ b/libs/langchain-google-vertexai/package.json @@ -54,11 +54,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-google-webauth/package.json b/libs/langchain-google-webauth/package.json index 8e95d85ce11f..3d974cb72700 100644 --- a/libs/langchain-google-webauth/package.json +++ b/libs/langchain-google-webauth/package.json @@ -50,11 +50,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-groq/package.json b/libs/langchain-groq/package.json index 50efc3f9ba07..dc3d67daff84 100644 --- a/libs/langchain-groq/package.json +++ b/libs/langchain-groq/package.json @@ -50,11 +50,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-mistralai/package.json b/libs/langchain-mistralai/package.json index 0cc8edf42372..dcad82871dd1 100644 --- a/libs/langchain-mistralai/package.json +++ b/libs/langchain-mistralai/package.json @@ -48,11 +48,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-mongodb/package.json b/libs/langchain-mongodb/package.json index 01b385097794..9e7b650d2c47 100644 --- a/libs/langchain-mongodb/package.json +++ b/libs/langchain-mongodb/package.json @@ -51,11 +51,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-nomic/package.json b/libs/langchain-nomic/package.json index 2de4973cbc01..f336780f5ba6 100644 --- a/libs/langchain-nomic/package.json +++ b/libs/langchain-nomic/package.json @@ -51,11 +51,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-openai/package.json b/libs/langchain-openai/package.json index 7a1010529da2..4675f585b27a 100644 --- a/libs/langchain-openai/package.json +++ b/libs/langchain-openai/package.json @@ -49,7 +49,6 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-pinecone/package.json b/libs/langchain-pinecone/package.json index 767ef6fd32cf..6f86d35913b7 100644 --- a/libs/langchain-pinecone/package.json +++ b/libs/langchain-pinecone/package.json @@ -52,11 +52,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-redis/package.json b/libs/langchain-redis/package.json index d8ff3deb8cc0..b9120e2fbd43 100644 --- a/libs/langchain-redis/package.json +++ b/libs/langchain-redis/package.json @@ -50,11 +50,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-scripts/package.json b/libs/langchain-scripts/package.json index a03989e91cf6..a58e812e95c2 100644 --- a/libs/langchain-scripts/package.json +++ b/libs/langchain-scripts/package.json @@ -51,11 +51,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-weaviate/package.json b/libs/langchain-weaviate/package.json index 6ddb76e23060..2049fbedf295 100644 --- a/libs/langchain-weaviate/package.json +++ b/libs/langchain-weaviate/package.json @@ -52,11 +52,8 @@ "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", "@types/uuid": "^9", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/libs/langchain-yandex/package.json b/libs/langchain-yandex/package.json index 8fa657ae97e5..0261112dc1c8 100644 --- a/libs/langchain-yandex/package.json +++ b/libs/langchain-yandex/package.json @@ -48,11 +48,8 @@ "@swc/core": "^1.3.90", "@swc/jest": "^0.2.29", "@tsconfig/recommended": "^1.0.3", - "@typescript-eslint/eslint-plugin": "^6.12.0", - "@typescript-eslint/parser": "^6.12.0", "dotenv": "^16.3.1", "dpdm": "^3.12.0", - "eslint": "^8.33.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.6.0", "eslint-plugin-import": "^2.27.5", diff --git a/package.json b/package.json index e1cb30cdcbf0..8013ababcdda 100644 --- a/package.json +++ b/package.json @@ -47,15 +47,26 @@ "devDependencies": { "@tsconfig/recommended": "^1.0.2", "@types/jest": "^29.5.3", + "@types/oracledb": "^6", "@types/semver": "^7", + "@types/winston": "^2.4.4", "commander": "^11.1.0", "dotenv": "^16.0.3", + "eslint-plugin-import": "^2.29.1", "lint-staged": "^13.1.1", "prettier": "^2.8.3", "semver": "^7.5.4", "turbo": "^1.13.3", "typescript": "~5.1.6" }, +<<<<<<< HEAD +======= + "dependencies": { + "oracledb": "latest", + "turbo": "latest", + "winston": "^3.13.0" + }, +>>>>>>> 19ef85a6 (modification to oraclevs.ts) "resolutions": { "dpdm@^3.12.0": "patch:dpdm@npm%3A3.12.0#./.yarn/patches/dpdm-npm-3.12.0-0dfdd8e3b8.patch", "typedoc-plugin-markdown@next": "patch:typedoc-plugin-markdown@npm%3A4.0.0-next.6#./.yarn/patches/typedoc-plugin-markdown-npm-4.0.0-next.6-96b4b47746.patch", diff --git a/yarn.lock b/yarn.lock index fed5231ea68f..2c03668abdb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5,13 +5,6 @@ __metadata: version: 6 cacheKey: 8 -"@aashutoshrathi/word-wrap@npm:^1.2.3": - version: 1.2.6 - resolution: "@aashutoshrathi/word-wrap@npm:1.2.6" - checksum: ada901b9e7c680d190f1d012c84217ce0063d8f5c5a7725bb91ec3c5ed99bb7572680eb2d2938a531ccbaec39a95422fcd8a6b4a13110c7d98dd75402f66a0cd - languageName: node - linkType: hard - "@algolia/autocomplete-core@npm:1.9.3": version: 1.9.3 resolution: "@algolia/autocomplete-core@npm:1.9.3" @@ -7988,6 +7981,13 @@ __metadata: languageName: node linkType: hard +"@colors/colors@npm:^1.6.0": + version: 1.6.0 + resolution: "@colors/colors@npm:1.6.0" + checksum: aa209963e0c3218e80a4a20553ba8c0fbb6fa13140540b4e5f97923790be06801fc90172c1114fc8b7e888b3d012b67298cde6b9e81521361becfaee400c662f + languageName: node + linkType: hard + "@couchbase/couchbase-darwin-arm64-napi@npm:4.3.0": version: 4.3.0 resolution: "@couchbase/couchbase-darwin-arm64-napi@npm:4.3.0" @@ -9109,7 +9109,7 @@ __metadata: languageName: node linkType: hard -"@eslint-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0": +"@eslint-community/eslint-utils@npm:^4.2.0": version: 4.4.0 resolution: "@eslint-community/eslint-utils@npm:4.4.0" dependencies: @@ -9120,99 +9120,6 @@ __metadata: languageName: node linkType: hard -"@eslint-community/regexpp@npm:^4.4.0": - version: 4.5.0 - resolution: "@eslint-community/regexpp@npm:4.5.0" - checksum: 99c01335947dbd7f2129e954413067e217ccaa4e219fe0917b7d2bd96135789384b8fedbfb8eb09584d5130b27a7b876a7150ab7376f51b3a0c377d5ce026a10 - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.5.1": - version: 4.10.0 - resolution: "@eslint-community/regexpp@npm:4.10.0" - checksum: 2a6e345429ea8382aaaf3a61f865cae16ed44d31ca917910033c02dc00d505d939f10b81e079fa14d43b51499c640138e153b7e40743c4c094d9df97d4e56f7b - languageName: node - linkType: hard - -"@eslint-community/regexpp@npm:^4.6.1": - version: 4.9.1 - resolution: "@eslint-community/regexpp@npm:4.9.1" - checksum: 06fb839e9c756f6375cc545c2f2e05a0a64576bd6370e8e3c07983fd29a3d6e164ef4aa48a361f7d27e6713ab79c83053ff6a2ccb78748bc955e344279c4a3b6 - languageName: node - linkType: hard - -"@eslint/eslintrc@npm:^2.0.0": - version: 2.0.0 - resolution: "@eslint/eslintrc@npm:2.0.0" - dependencies: - ajv: ^6.12.4 - debug: ^4.3.2 - espree: ^9.4.0 - globals: ^13.19.0 - ignore: ^5.2.0 - import-fresh: ^3.2.1 - js-yaml: ^4.1.0 - minimatch: ^3.1.2 - strip-json-comments: ^3.1.1 - checksum: 31119c8ca06723d80384f18f5c78e0530d8e6306ad36379868650131a8b10dd7cffd7aff79a5deb3a2e9933660823052623d268532bae9538ded53d5b19a69a6 - languageName: node - linkType: hard - -"@eslint/eslintrc@npm:^2.1.2": - version: 2.1.2 - resolution: "@eslint/eslintrc@npm:2.1.2" - dependencies: - ajv: ^6.12.4 - debug: ^4.3.2 - espree: ^9.6.0 - globals: ^13.19.0 - ignore: ^5.2.0 - import-fresh: ^3.2.1 - js-yaml: ^4.1.0 - minimatch: ^3.1.2 - strip-json-comments: ^3.1.1 - checksum: bc742a1e3b361f06fedb4afb6bf32cbd27171292ef7924f61c62f2aed73048367bcc7ac68f98c06d4245cd3fabc43270f844e3c1699936d4734b3ac5398814a7 - languageName: node - linkType: hard - -"@eslint/eslintrc@npm:^2.1.3": - version: 2.1.3 - resolution: "@eslint/eslintrc@npm:2.1.3" - dependencies: - ajv: ^6.12.4 - debug: ^4.3.2 - espree: ^9.6.0 - globals: ^13.19.0 - ignore: ^5.2.0 - import-fresh: ^3.2.1 - js-yaml: ^4.1.0 - minimatch: ^3.1.2 - strip-json-comments: ^3.1.1 - checksum: 5c6c3878192fe0ddffa9aff08b4e2f3bcc8f1c10d6449b7295a5f58b662019896deabfc19890455ffd7e60a5bd28d25d0eaefb2f78b2d230aae3879af92b89e5 - languageName: node - linkType: hard - -"@eslint/js@npm:8.35.0": - version: 8.35.0 - resolution: "@eslint/js@npm:8.35.0" - checksum: 6687ceff659a6d617e37823f809dc9c4b096535961a81acead27d26b1a51a4cf608a5e59d831ddd57f24f6f8bb99340a4a0e19f9c99b390fbb4b275f51ed5f5e - languageName: node - linkType: hard - -"@eslint/js@npm:8.51.0": - version: 8.51.0 - resolution: "@eslint/js@npm:8.51.0" - checksum: 0228bf1e1e0414843e56d9ff362a2a72d579c078f93174666f29315690e9e30a8633ad72c923297f7fd7182381b5a476805ff04dac8debe638953eb1ded3ac73 - languageName: node - linkType: hard - -"@eslint/js@npm:8.53.0": - version: 8.53.0 - resolution: "@eslint/js@npm:8.53.0" - checksum: e0d5cfb0000aaee237c8e6d6d6e366faa60b1ef7f928ce17778373aa44d3b886368f6d5e1f97f913f0f16801aad016db8b8df78418c9d18825c15590328028af - languageName: node - linkType: hard - "@faker-js/faker@npm:^7.6.0": version: 7.6.0 resolution: "@faker-js/faker@npm:7.6.0" @@ -9620,60 +9527,6 @@ __metadata: languageName: node linkType: hard -"@humanwhocodes/config-array@npm:^0.11.11": - version: 0.11.11 - resolution: "@humanwhocodes/config-array@npm:0.11.11" - dependencies: - "@humanwhocodes/object-schema": ^1.2.1 - debug: ^4.1.1 - minimatch: ^3.0.5 - checksum: db84507375ab77b8ffdd24f498a5b49ad6b64391d30dd2ac56885501d03964d29637e05b1ed5aefa09d57ac667e28028bc22d2da872bfcd619652fbdb5f4ca19 - languageName: node - linkType: hard - -"@humanwhocodes/config-array@npm:^0.11.13": - version: 0.11.13 - resolution: "@humanwhocodes/config-array@npm:0.11.13" - dependencies: - "@humanwhocodes/object-schema": ^2.0.1 - debug: ^4.1.1 - minimatch: ^3.0.5 - checksum: f8ea57b0d7ed7f2d64cd3944654976829d9da91c04d9c860e18804729a33f7681f78166ef4c761850b8c324d362f7d53f14c5c44907a6b38b32c703ff85e4805 - languageName: node - linkType: hard - -"@humanwhocodes/config-array@npm:^0.11.8": - version: 0.11.8 - resolution: "@humanwhocodes/config-array@npm:0.11.8" - dependencies: - "@humanwhocodes/object-schema": ^1.2.1 - debug: ^4.1.1 - minimatch: ^3.0.5 - checksum: 0fd6b3c54f1674ce0a224df09b9c2f9846d20b9e54fabae1281ecfc04f2e6ad69bf19e1d6af6a28f88e8aa3990168b6cb9e1ef755868c3256a630605ec2cb1d3 - languageName: node - linkType: hard - -"@humanwhocodes/module-importer@npm:^1.0.1": - version: 1.0.1 - resolution: "@humanwhocodes/module-importer@npm:1.0.1" - checksum: 0fd22007db8034a2cdf2c764b140d37d9020bbfce8a49d3ec5c05290e77d4b0263b1b972b752df8c89e5eaa94073408f2b7d977aed131faf6cf396ebb5d7fb61 - languageName: node - linkType: hard - -"@humanwhocodes/object-schema@npm:^1.2.1": - version: 1.2.1 - resolution: "@humanwhocodes/object-schema@npm:1.2.1" - checksum: a824a1ec31591231e4bad5787641f59e9633827d0a2eaae131a288d33c9ef0290bd16fda8da6f7c0fcb014147865d12118df10db57f27f41e20da92369fcb3f1 - languageName: node - linkType: hard - -"@humanwhocodes/object-schema@npm:^2.0.1": - version: 2.0.1 - resolution: "@humanwhocodes/object-schema@npm:2.0.1" - checksum: 24929487b1ed48795d2f08346a0116cc5ee4634848bce64161fb947109352c562310fd159fc64dda0e8b853307f5794605191a9547f7341158559ca3c8262a45 - languageName: node - linkType: hard - "@iarna/toml@npm:2.2.5": version: 2.2.5 resolution: "@iarna/toml@npm:2.2.5" @@ -10213,7 +10066,6 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -10317,7 +10169,6 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -10386,11 +10237,8 @@ __metadata: "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 "@types/uuid": ^9 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -10433,7 +10281,6 @@ __metadata: cohere-ai: ^7.10.5 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11013,7 +10860,6 @@ __metadata: camelcase: 6 decamelize: 1.2.0 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11051,11 +10897,8 @@ __metadata: "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 "@types/uuid": ^9 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11093,11 +10936,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11127,11 +10967,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11161,11 +10998,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11195,11 +11029,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11229,11 +11060,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11260,11 +11088,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11294,11 +11119,8 @@ __metadata: "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 "@types/uuid": ^9 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11360,11 +11182,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11429,11 +11248,8 @@ __metadata: "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 "@types/uuid": ^9 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11464,11 +11280,8 @@ __metadata: "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 "@types/uuid": ^9 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11496,7 +11309,6 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11556,11 +11368,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11625,11 +11434,8 @@ __metadata: "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 "@types/uuid": ^9 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11655,13 +11461,10 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 axios: ^1.6.7 commander: ^11.1.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11697,7 +11500,6 @@ __metadata: "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -11791,11 +11593,8 @@ __metadata: "@swc/core": ^1.3.90 "@swc/jest": ^0.2.29 "@tsconfig/recommended": ^1.0.3 - "@typescript-eslint/eslint-plugin": ^6.12.0 - "@typescript-eslint/parser": ^6.12.0 dotenv: ^16.3.1 dpdm: ^3.12.0 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -12146,7 +11945,7 @@ __metadata: languageName: node linkType: hard -"@nodelib/fs.walk@npm:^1.2.3, @nodelib/fs.walk@npm:^1.2.8": +"@nodelib/fs.walk@npm:^1.2.3": version: 1.2.8 resolution: "@nodelib/fs.walk@npm:1.2.8" dependencies: @@ -17417,6 +17216,15 @@ __metadata: languageName: node linkType: hard +"@types/oracledb@npm:^6": + version: 6.3.2 + resolution: "@types/oracledb@npm:6.3.2" + dependencies: + "@types/node": "*" + checksum: 787d7822affb5fe724a598f56905b2242027b926abc3185e434ad2c82fe72fe8d269b3e99a6f815953be70c130690e5d40c8a31f3c697489184a51ea281f028b + languageName: node + linkType: hard + "@types/pad-left@npm:2.1.1": version: 2.1.1 resolution: "@types/pad-left@npm:2.1.1" @@ -17665,7 +17473,7 @@ __metadata: languageName: node linkType: hard -"@types/semver@npm:^7, @types/semver@npm:^7.5.0": +"@types/semver@npm:^7": version: 7.5.6 resolution: "@types/semver@npm:7.5.6" checksum: 563a0120ec0efcc326567db2ed920d5d98346f3638b6324ea6b50222b96f02a8add3c51a916b6897b51523aad8ac227d21d3dcf8913559f1bfc6c15b14d23037 @@ -17834,6 +17642,15 @@ __metadata: languageName: node linkType: hard +"@types/winston@npm:^2.4.4": + version: 2.4.4 + resolution: "@types/winston@npm:2.4.4" + dependencies: + winston: "*" + checksum: 69b2be354ee8f2685cd1ce4f0c22e5a8edbd5f3fb6cf400bf0b07299daf5cdbdfb3e4f602aa318e6b21a108164aa921958cd09324088604a7affb92e99282087 + languageName: node + linkType: hard + "@types/ws@npm:8.5.9": version: 8.5.9 resolution: "@types/ws@npm:8.5.9" @@ -17904,79 +17721,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.51.0": - version: 5.54.1 - resolution: "@typescript-eslint/eslint-plugin@npm:5.54.1" - dependencies: - "@typescript-eslint/scope-manager": 5.54.1 - "@typescript-eslint/type-utils": 5.54.1 - "@typescript-eslint/utils": 5.54.1 - debug: ^4.3.4 - grapheme-splitter: ^1.0.4 - ignore: ^5.2.0 - natural-compare-lite: ^1.4.0 - regexpp: ^3.2.0 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependencies: - "@typescript-eslint/parser": ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 76476c08ca0142a9bf6e2381f5cd1c037d86fbafa9c0dded4a97bd3b23b5962dd2c3943bade11b21d674195674f0e36dbf80faa15a1906f5a2ca1f699baf1dd5 - languageName: node - linkType: hard - -"@typescript-eslint/eslint-plugin@npm:^5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.58.0" - dependencies: - "@eslint-community/regexpp": ^4.4.0 - "@typescript-eslint/scope-manager": 5.58.0 - "@typescript-eslint/type-utils": 5.58.0 - "@typescript-eslint/utils": 5.58.0 - debug: ^4.3.4 - grapheme-splitter: ^1.0.4 - ignore: ^5.2.0 - natural-compare-lite: ^1.4.0 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependencies: - "@typescript-eslint/parser": ^5.0.0 - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: e5d76d43c466ebd4b552e3307eff72ab5ae8a0c09a1d35fa13b62769ac3336df94d9281728ab5aafd2c14a0a644133583edcd708fce60a9a82df1db3ca3b8e14 - languageName: node - linkType: hard - -"@typescript-eslint/eslint-plugin@npm:^6.12.0": - version: 6.14.0 - resolution: "@typescript-eslint/eslint-plugin@npm:6.14.0" - dependencies: - "@eslint-community/regexpp": ^4.5.1 - "@typescript-eslint/scope-manager": 6.14.0 - "@typescript-eslint/type-utils": 6.14.0 - "@typescript-eslint/utils": 6.14.0 - "@typescript-eslint/visitor-keys": 6.14.0 - debug: ^4.3.4 - graphemer: ^1.4.0 - ignore: ^5.2.4 - natural-compare: ^1.4.0 - semver: ^7.5.4 - ts-api-utils: ^1.0.1 - peerDependencies: - "@typescript-eslint/parser": ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: ec688fd71b21576bfe0e4176889fddf3c13d8b07792461b84017d689ed11a9bffbf4d2ab61e9bdb254e43d2c1e159d5c2fc21bdfa6a6c2d64f9e1956a668fbe8 - languageName: node - linkType: hard - "@typescript-eslint/parser@npm:^5.4.2 || ^6.0.0": version: 6.9.1 resolution: "@typescript-eslint/parser@npm:6.9.1" @@ -17995,78 +17739,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.51.0": - version: 5.54.1 - resolution: "@typescript-eslint/parser@npm:5.54.1" - dependencies: - "@typescript-eslint/scope-manager": 5.54.1 - "@typescript-eslint/types": 5.54.1 - "@typescript-eslint/typescript-estree": 5.54.1 - debug: ^4.3.4 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: f466513d306ca926b97c2cec1eebaf2cd15d45bd5633a4358f23ba9a4de1b0ec4630b1c20abc395943934ed1d2ef65f545fd6737c317a7abe579612101e8a83f - languageName: node - linkType: hard - -"@typescript-eslint/parser@npm:^5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/parser@npm:5.58.0" - dependencies: - "@typescript-eslint/scope-manager": 5.58.0 - "@typescript-eslint/types": 5.58.0 - "@typescript-eslint/typescript-estree": 5.58.0 - debug: ^4.3.4 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 38681da48a40132c0538579c818ceef9ba2793ab8f79236c3f64980ba1649bb87cb367cd79d37bf2982b8bfbc28f91846b8676f9bd333e8b691c9befffd8874a - languageName: node - linkType: hard - -"@typescript-eslint/parser@npm:^6.12.0": - version: 6.14.0 - resolution: "@typescript-eslint/parser@npm:6.14.0" - dependencies: - "@typescript-eslint/scope-manager": 6.14.0 - "@typescript-eslint/types": 6.14.0 - "@typescript-eslint/typescript-estree": 6.14.0 - "@typescript-eslint/visitor-keys": 6.14.0 - debug: ^4.3.4 - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 5fbe8d7431654c14ba6c9782d3728026ad5c90e02c9c4319f45df972e653cf5c15ba320dce70cdffa9fb7ce4c4263c37585e7bc1c909d1252d0a599880963063 - languageName: node - linkType: hard - -"@typescript-eslint/scope-manager@npm:5.54.1": - version: 5.54.1 - resolution: "@typescript-eslint/scope-manager@npm:5.54.1" - dependencies: - "@typescript-eslint/types": 5.54.1 - "@typescript-eslint/visitor-keys": 5.54.1 - checksum: 9add24cf3a7852634ad0680a827646860ac4698a6ac8aae31e8b781e29f59e84b51f0cdaacffd0747811012647f01b51969d988da9b302ead374ceebffbe204b - languageName: node - linkType: hard - -"@typescript-eslint/scope-manager@npm:5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/scope-manager@npm:5.58.0" - dependencies: - "@typescript-eslint/types": 5.58.0 - "@typescript-eslint/visitor-keys": 5.58.0 - checksum: f0d3df5cc3c461fe63ef89ad886b53c239cc7c1d9061d83d8a9d9c8e087e5501eac84bebff8a954728c17ccea191f235686373d54d2b8b6370af2bcf2b18e062 - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/scope-manager@npm:5.62.0" @@ -18077,16 +17749,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.14.0": - version: 6.14.0 - resolution: "@typescript-eslint/scope-manager@npm:6.14.0" - dependencies: - "@typescript-eslint/types": 6.14.0 - "@typescript-eslint/visitor-keys": 6.14.0 - checksum: 0b577d42db925426a9838fe61703c226e18b697374fbe20cf9b93ba30fe58bf4a7f7f42491a4d24b7f3cc12d9a189fe3524c0e9b7708727e710d95b908250a14 - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/scope-manager@npm:6.9.1" @@ -18097,71 +17759,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.54.1": - version: 5.54.1 - resolution: "@typescript-eslint/type-utils@npm:5.54.1" - dependencies: - "@typescript-eslint/typescript-estree": 5.54.1 - "@typescript-eslint/utils": 5.54.1 - debug: ^4.3.4 - tsutils: ^3.21.0 - peerDependencies: - eslint: "*" - peerDependenciesMeta: - typescript: - optional: true - checksum: 0073838b782b7f4619775be124ca6643fec43a2d56043eaf3ceb100960a5193f14ac747b28ce17a5c9ac643fdee8abda82a7d905c81521358de7b27a2dcbc9af - languageName: node - linkType: hard - -"@typescript-eslint/type-utils@npm:5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/type-utils@npm:5.58.0" - dependencies: - "@typescript-eslint/typescript-estree": 5.58.0 - "@typescript-eslint/utils": 5.58.0 - debug: ^4.3.4 - tsutils: ^3.21.0 - peerDependencies: - eslint: "*" - peerDependenciesMeta: - typescript: - optional: true - checksum: 803f24daed185152bf86952d4acebb5ea18ff03db5f28750368edf76fdea46b4b0f8803ae0b61c0282b47181c9977113457b16e33d5d2cb33b13855f55c5e5b2 - languageName: node - linkType: hard - -"@typescript-eslint/type-utils@npm:6.14.0": - version: 6.14.0 - resolution: "@typescript-eslint/type-utils@npm:6.14.0" - dependencies: - "@typescript-eslint/typescript-estree": 6.14.0 - "@typescript-eslint/utils": 6.14.0 - debug: ^4.3.4 - ts-api-utils: ^1.0.1 - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 09988f25279598840673c41ba44b03756f2dfb31284ab72af97c170711a0f31e5c53d6b120aa83f31438565e82aae1a1ca4d1ed0de4890654dd6a6a33d88202c - languageName: node - linkType: hard - -"@typescript-eslint/types@npm:5.54.1": - version: 5.54.1 - resolution: "@typescript-eslint/types@npm:5.54.1" - checksum: 84a8f725cfa10646af389659e09c510c38d82c65960c7b613f844a264acc0e197471cba03f3e8f4b6411bc35dca28922c8352a7bd44621411c73fd6dd4096da2 - languageName: node - linkType: hard - -"@typescript-eslint/types@npm:5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/types@npm:5.58.0" - checksum: 8622a73d73220c4a7111537825f488c0271272032a1d4e129dc722bc6e8b3ec84f64469b2ca3b8dae7da3a9c18953ce1449af51f5f757dad60835eb579ad1d2c - languageName: node - linkType: hard - "@typescript-eslint/types@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/types@npm:5.62.0" @@ -18169,13 +17766,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:6.14.0": - version: 6.14.0 - resolution: "@typescript-eslint/types@npm:6.14.0" - checksum: 624e6c5227f596dcc9757348d09c5a09b846a62938b8b4409614cf8108013b64ed8b270c32e87ea8890dd09ed896b82e92872c3574dbf07dcda11a168d69dd1f - languageName: node - linkType: hard - "@typescript-eslint/types@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/types@npm:6.9.1" @@ -18183,42 +17773,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.54.1": - version: 5.54.1 - resolution: "@typescript-eslint/typescript-estree@npm:5.54.1" - dependencies: - "@typescript-eslint/types": 5.54.1 - "@typescript-eslint/visitor-keys": 5.54.1 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: ea42bdb4832fa96fa1121237c9b664ac4506e2836646651e08a8542c8601d78af6c288779707f893ca4c884221829bb7d7b4b43c4a9c3ed959519266d03a139b - languageName: node - linkType: hard - -"@typescript-eslint/typescript-estree@npm:5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.58.0" - dependencies: - "@typescript-eslint/types": 5.58.0 - "@typescript-eslint/visitor-keys": 5.58.0 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 51b668ec858db0c040a71dff526273945cee4ba5a9b240528d503d02526685882d900cf071c6636a4d9061ed3fd4a7274f7f1a23fba55c4b48b143344b4009c7 - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/typescript-estree@npm:5.62.0" @@ -18237,24 +17791,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.14.0": - version: 6.14.0 - resolution: "@typescript-eslint/typescript-estree@npm:6.14.0" - dependencies: - "@typescript-eslint/types": 6.14.0 - "@typescript-eslint/visitor-keys": 6.14.0 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - semver: ^7.5.4 - ts-api-utils: ^1.0.1 - peerDependenciesMeta: - typescript: - optional: true - checksum: 495d7616463685bfd8138ffa9fbc0a7f9130ff8a3f6f85775960b4f0a3fdc259ae53b104cdfe562b60310860b5a6c8387307790734555084aa087e3bb9c28a69 - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/typescript-estree@npm:6.9.1" @@ -18273,59 +17809,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.54.1": - version: 5.54.1 - resolution: "@typescript-eslint/utils@npm:5.54.1" - dependencies: - "@types/json-schema": ^7.0.9 - "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.54.1 - "@typescript-eslint/types": 5.54.1 - "@typescript-eslint/typescript-estree": 5.54.1 - eslint-scope: ^5.1.1 - eslint-utils: ^3.0.0 - semver: ^7.3.7 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 8f428ea4d338ce85d55fd0c9ae2b217b323f29f51b7c9f8077fef7001ca21d28b032c5e5165b67ae6057aef69edb0e7a164c3c483703be6f3e4e574248bbc399 - languageName: node - linkType: hard - -"@typescript-eslint/utils@npm:5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/utils@npm:5.58.0" - dependencies: - "@eslint-community/eslint-utils": ^4.2.0 - "@types/json-schema": ^7.0.9 - "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.58.0 - "@typescript-eslint/types": 5.58.0 - "@typescript-eslint/typescript-estree": 5.58.0 - eslint-scope: ^5.1.1 - semver: ^7.3.7 - peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: c618ae67963ecf96b1492c09afaeb363f542f0d6780bcac4af3c26034e3b20034666b2d523aa94821df813aafb57a0b150a7d5c2224fe8257452ad1de2237a58 - languageName: node - linkType: hard - -"@typescript-eslint/utils@npm:6.14.0": - version: 6.14.0 - resolution: "@typescript-eslint/utils@npm:6.14.0" - dependencies: - "@eslint-community/eslint-utils": ^4.4.0 - "@types/json-schema": ^7.0.12 - "@types/semver": ^7.5.0 - "@typescript-eslint/scope-manager": 6.14.0 - "@typescript-eslint/types": 6.14.0 - "@typescript-eslint/typescript-estree": 6.14.0 - semver: ^7.5.4 - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - checksum: 36e8501cb85647947189f31017c36d6f6ac7ef0399fa0e18eb64f1b83e00f1e8ace1d9ac5015ef4d9c1b820179f1def8d61d7ea9e5d61433eb848cf5c49dc8b0 - languageName: node - linkType: hard - "@typescript-eslint/utils@npm:^5.10.0": version: 5.62.0 resolution: "@typescript-eslint/utils@npm:5.62.0" @@ -18344,26 +17827,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:5.54.1": - version: 5.54.1 - resolution: "@typescript-eslint/visitor-keys@npm:5.54.1" - dependencies: - "@typescript-eslint/types": 5.54.1 - eslint-visitor-keys: ^3.3.0 - checksum: 3a691abd2a43b86a0c41526d14a2afcc93a2e0512b5f8b9ec43f6029c493870808036eae5ee4fc655d26e1999017c4a4dffb241f47c36c2a1238ec9fbd08719c - languageName: node - linkType: hard - -"@typescript-eslint/visitor-keys@npm:5.58.0": - version: 5.58.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.58.0" - dependencies: - "@typescript-eslint/types": 5.58.0 - eslint-visitor-keys: ^3.3.0 - checksum: ab2d1f37660559954c840429ef78bbf71834063557e3e68e435005b4987970b9356fdf217ead53f7a57f66f5488dc478062c5c44bf17053a8bf041733539b98f - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:5.62.0": version: 5.62.0 resolution: "@typescript-eslint/visitor-keys@npm:5.62.0" @@ -18374,16 +17837,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.14.0": - version: 6.14.0 - resolution: "@typescript-eslint/visitor-keys@npm:6.14.0" - dependencies: - "@typescript-eslint/types": 6.14.0 - eslint-visitor-keys: ^3.4.1 - checksum: fc593c4e94d5739be7bd88e42313a301bc9806fad758b6a0a1bafd296ff41522be602caf4976beec84e363b0f56585bb98df3c157f70de984de721798501fd8a - languageName: node - linkType: hard - "@typescript-eslint/visitor-keys@npm:6.9.1": version: 6.9.1 resolution: "@typescript-eslint/visitor-keys@npm:6.9.1" @@ -18911,7 +18364,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.10.0, ajv@npm:^6.12.2, ajv@npm:^6.12.4, ajv@npm:^6.12.5": +"ajv@npm:^6.12.2, ajv@npm:^6.12.4, ajv@npm:^6.12.5": version: 6.12.6 resolution: "ajv@npm:6.12.6" dependencies: @@ -19136,7 +18589,6 @@ __metadata: "@types/react": ^18 "@types/react-dom": ^18 autoprefixer: ^10.0.1 - eslint: ^8 eslint-config-next: 14.0.1 next: 14.0.1 postcss: ^8 @@ -21667,7 +21119,6 @@ __metadata: cookie: ^0.6.0 docusaurus-plugin-typedoc: 1.0.0-next.5 dotenv: ^16.4.5 - eslint: ^8.19.0 eslint-config-airbnb: ^19.0.4 eslint-config-prettier: ^8.5.0 eslint-plugin-header: ^3.1.1 @@ -21876,7 +21327,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.1, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.1, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" dependencies: @@ -22635,7 +22086,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:4.3.4, debug@npm:^4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.3, debug@npm:^4.3.4": +"debug@npm:4, debug@npm:4.3.4, debug@npm:^4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.3, debug@npm:^4.3.4": version: 4.3.4 resolution: "debug@npm:4.3.4" dependencies: @@ -22774,7 +22225,7 @@ __metadata: languageName: node linkType: hard -"deep-is@npm:^0.1.3, deep-is@npm:~0.1.3": +"deep-is@npm:~0.1.3": version: 0.1.4 resolution: "deep-is@npm:0.1.4" checksum: edb65dd0d7d1b9c40b2f50219aef30e116cedd6fc79290e740972c132c09106d2e80aa0bc8826673dd5a00222d4179c84b36a790eef63a4c4bca75a37ef90804 @@ -23170,15 +22621,6 @@ __metadata: languageName: node linkType: hard -"doctrine@npm:^3.0.0": - version: 3.0.0 - resolution: "doctrine@npm:3.0.0" - dependencies: - esutils: ^2.0.2 - checksum: fd7673ca77fe26cd5cba38d816bc72d641f500f1f9b25b83e8ce28827fe2da7ad583a8da26ab6af85f834138cf8dae9f69b0cd6ab925f52ddab1754db44d99ce - languageName: node - linkType: hard - "docusaurus-plugin-typedoc@npm:1.0.0-next.5": version: 1.0.0-next.5 resolution: "docusaurus-plugin-typedoc@npm:1.0.0-next.5" @@ -24347,6 +23789,33 @@ __metadata: languageName: node linkType: hard +"eslint-plugin-import@npm:^2.29.1": + version: 2.29.1 + resolution: "eslint-plugin-import@npm:2.29.1" + dependencies: + array-includes: ^3.1.7 + array.prototype.findlastindex: ^1.2.3 + array.prototype.flat: ^1.3.2 + array.prototype.flatmap: ^1.3.2 + debug: ^3.2.7 + doctrine: ^2.1.0 + eslint-import-resolver-node: ^0.3.9 + eslint-module-utils: ^2.8.0 + hasown: ^2.0.0 + is-core-module: ^2.13.1 + is-glob: ^4.0.3 + minimatch: ^3.1.2 + object.fromentries: ^2.0.7 + object.groupby: ^1.0.1 + object.values: ^1.1.7 + semver: ^6.3.1 + tsconfig-paths: ^3.15.0 + peerDependencies: + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + checksum: e65159aef808136d26d029b71c8c6e4cb5c628e65e5de77f1eb4c13a379315ae55c9c3afa847f43f4ff9df7e54515c77ffc6489c6a6f81f7dd7359267577468c + languageName: node + linkType: hard + "eslint-plugin-jest@npm:^27.6.0": version: 27.6.0 resolution: "eslint-plugin-jest@npm:27.6.0" @@ -24515,38 +23984,7 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^7.1.1": - version: 7.1.1 - resolution: "eslint-scope@npm:7.1.1" - dependencies: - esrecurse: ^4.3.0 - estraverse: ^5.2.0 - checksum: 9f6e974ab2db641ca8ab13508c405b7b859e72afe9f254e8131ff154d2f40c99ad4545ce326fd9fde3212ff29707102562a4834f1c48617b35d98c71a97fbf3e - languageName: node - linkType: hard - -"eslint-scope@npm:^7.2.2": - version: 7.2.2 - resolution: "eslint-scope@npm:7.2.2" - dependencies: - esrecurse: ^4.3.0 - estraverse: ^5.2.0 - checksum: ec97dbf5fb04b94e8f4c5a91a7f0a6dd3c55e46bfc7bbcd0e3138c3a76977570e02ed89a1810c778dcd72072ff0e9621ba1379b4babe53921d71e2e4486fda3e - languageName: node - linkType: hard - -"eslint-utils@npm:^3.0.0": - version: 3.0.0 - resolution: "eslint-utils@npm:3.0.0" - dependencies: - eslint-visitor-keys: ^2.0.0 - peerDependencies: - eslint: ">=5" - checksum: 0668fe02f5adab2e5a367eee5089f4c39033af20499df88fe4e6aba2015c20720404d8c3d6349b6f716b08fdf91b9da4e5d5481f265049278099c4c836ccb619 - languageName: node - linkType: hard - -"eslint-visitor-keys@npm:^2.0.0, eslint-visitor-keys@npm:^2.1.0": +"eslint-visitor-keys@npm:^2.1.0": version: 2.1.0 resolution: "eslint-visitor-keys@npm:2.1.0" checksum: e3081d7dd2611a35f0388bbdc2f5da60b3a3c5b8b6e928daffff7391146b434d691577aa95064c8b7faad0b8a680266bcda0a42439c18c717b80e6718d7e267d @@ -24731,28 +24169,6 @@ __metadata: languageName: node linkType: hard -"espree@npm:^9.4.0": - version: 9.4.1 - resolution: "espree@npm:9.4.1" - dependencies: - acorn: ^8.8.0 - acorn-jsx: ^5.3.2 - eslint-visitor-keys: ^3.3.0 - checksum: 4d266b0cf81c7dfe69e542c7df0f246e78d29f5b04dda36e514eb4c7af117ee6cfbd3280e560571ed82ff6c9c3f0003c05b82583fc7a94006db7497c4fe4270e - languageName: node - linkType: hard - -"espree@npm:^9.6.0, espree@npm:^9.6.1": - version: 9.6.1 - resolution: "espree@npm:9.6.1" - dependencies: - acorn: ^8.9.0 - acorn-jsx: ^5.3.2 - eslint-visitor-keys: ^3.4.1 - checksum: eb8c149c7a2a77b3f33a5af80c10875c3abd65450f60b8af6db1bfcfa8f101e21c1e56a561c6dc13b848e18148d43469e7cd208506238554fb5395a9ea5a1ab9 - languageName: node - linkType: hard - "esprima@npm:1.2.2": version: 1.2.2 resolution: "esprima@npm:1.2.2" @@ -24773,15 +24189,6 @@ __metadata: languageName: node linkType: hard -"esquery@npm:^1.4.2": - version: 1.5.0 - resolution: "esquery@npm:1.5.0" - dependencies: - estraverse: ^5.1.0 - checksum: aefb0d2596c230118656cd4ec7532d447333a410a48834d80ea648b1e7b5c9bc9ed8b5e33a89cb04e487b60d622f44cf5713bf4abed7c97343edefdc84a35900 - languageName: node - linkType: hard - "esrecurse@npm:^4.3.0": version: 4.3.0 resolution: "esrecurse@npm:4.3.0" @@ -24965,7 +24372,6 @@ __metadata: date-fns: ^3.3.1 dotenv: ^16.0.3 duck-duck-scrape: ^2.2.5 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -25286,7 +24692,7 @@ __metadata: languageName: node linkType: hard -"fast-levenshtein@npm:^2.0.6, fast-levenshtein@npm:~2.0.6": +"fast-levenshtein@npm:~2.0.6": version: 2.0.6 resolution: "fast-levenshtein@npm:2.0.6" checksum: 92cfec0a8dfafd9c7a15fba8f2cc29cd0b62b85f056d99ce448bbcd9f708e18ab2764bda4dd5158364f4145a7c72788538994f0d1787b956ef0d1062b0f7c24c @@ -25491,15 +24897,6 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^6.0.1": - version: 6.0.1 - resolution: "file-entry-cache@npm:6.0.1" - dependencies: - flat-cache: ^3.0.4 - checksum: f49701feaa6314c8127c3c2f6173cfefff17612f5ed2daaafc6da13b5c91fd43e3b2a58fd0d63f9f94478a501b167615931e7200e31485e320f74a33885a9c74 - languageName: node - linkType: hard - "file-loader@npm:^6.2.0": version: 6.2.0 resolution: "file-loader@npm:6.2.0" @@ -25661,16 +25058,6 @@ __metadata: languageName: node linkType: hard -"flat-cache@npm:^3.0.4": - version: 3.0.4 - resolution: "flat-cache@npm:3.0.4" - dependencies: - flatted: ^3.1.0 - rimraf: ^3.0.2 - checksum: 4fdd10ecbcbf7d520f9040dd1340eb5dfe951e6f0ecf2252edeec03ee68d989ec8b9a20f4434270e71bcfd57800dc09b3344fca3966b2eb8f613072c7d9a2365 - languageName: node - linkType: hard - "flat@npm:^5.0.2": version: 5.0.2 resolution: "flat@npm:5.0.2" @@ -25694,13 +25081,6 @@ __metadata: languageName: node linkType: hard -"flatted@npm:^3.1.0": - version: 3.2.7 - resolution: "flatted@npm:3.2.7" - checksum: 427633049d55bdb80201c68f7eb1cbd533e03eac541f97d3aecab8c5526f12a20ccecaeede08b57503e772c769e7f8680b37e8d482d1e5f8d7e2194687f9ea35 - languageName: node - linkType: hard - "flux@npm:^4.0.1": version: 4.0.4 resolution: "flux@npm:4.0.4" @@ -26566,15 +25946,6 @@ __metadata: languageName: node linkType: hard -"globals@npm:^13.19.0": - version: 13.20.0 - resolution: "globals@npm:13.20.0" - dependencies: - type-fest: ^0.20.2 - checksum: ad1ecf914bd051325faad281d02ea2c0b1df5d01bd94d368dcc5513340eac41d14b3c61af325768e3c7f8d44576e72780ec0b6f2d366121f8eec6e03c3a3b97a - languageName: node - linkType: hard - "globalthis@npm:^1.0.3": version: 1.0.3 resolution: "globalthis@npm:1.0.3" @@ -26813,20 +26184,6 @@ __metadata: languageName: node linkType: hard -"grapheme-splitter@npm:^1.0.4": - version: 1.0.4 - resolution: "grapheme-splitter@npm:1.0.4" - checksum: 0c22ec54dee1b05cd480f78cf14f732cb5b108edc073572c4ec205df4cd63f30f8db8025afc5debc8835a8ddeacf648a1c7992fe3dcd6ad38f9a476d84906620 - languageName: node - linkType: hard - -"graphemer@npm:^1.4.0": - version: 1.4.0 - resolution: "graphemer@npm:1.4.0" - checksum: bab8f0be9b568857c7bec9fda95a89f87b783546d02951c40c33f84d05bb7da3fd10f863a9beb901463669b6583173a8c8cc6d6b306ea2b9b9d5d3d943c3a673 - languageName: node - linkType: hard - "graphql-request@npm:^5.1.0, graphql-request@npm:^5.2.0": version: 5.2.0 resolution: "graphql-request@npm:5.2.0" @@ -27603,7 +26960,7 @@ __metadata: languageName: node linkType: hard -"import-fresh@npm:^3.0.0, import-fresh@npm:^3.1.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": +"import-fresh@npm:^3.1.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" dependencies: @@ -28100,7 +27457,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -28237,7 +27594,7 @@ __metadata: languageName: node linkType: hard -"is-path-inside@npm:^3.0.2, is-path-inside@npm:^3.0.3": +"is-path-inside@npm:^3.0.2": version: 3.0.3 resolution: "is-path-inside@npm:3.0.3" checksum: abd50f06186a052b349c15e55b182326f1936c89a78bf6c8f2b707412517c097ce04bc49a0ca221787bc44e1049f51f09a2ffb63d22899051988d3a618ba13e9 @@ -29652,13 +29009,6 @@ __metadata: languageName: node linkType: hard -"json-stable-stringify-without-jsonify@npm:^1.0.1": - version: 1.0.1 - resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" - checksum: cff44156ddce9c67c44386ad5cddf91925fe06b1d217f2da9c4910d01f358c6e3989c4d5a02683c7a5667f9727ff05831f7aa8ae66c8ff691c556f0884d49215 - languageName: node - linkType: hard - "json5@npm:^1.0.2": version: 1.0.2 resolution: "json5@npm:1.0.2" @@ -30279,8 +29629,6 @@ __metadata: "@types/pdf-parse": ^1.1.1 "@types/uuid": ^9 "@types/ws": ^8 - "@typescript-eslint/eslint-plugin": ^5.58.0 - "@typescript-eslint/parser": ^5.58.0 "@vercel/kv": ^0.2.3 "@xata.io/client": ^0.28.0 apify-client: ^2.7.1 @@ -30295,7 +29643,6 @@ __metadata: dotenv: ^16.0.3 dpdm: ^3.12.0 epub2: ^3.0.1 - eslint: ^8.33.0 eslint-config-airbnb-base: ^15.0.0 eslint-config-prettier: ^8.6.0 eslint-plugin-import: ^2.27.5 @@ -30515,14 +29862,19 @@ __metadata: dependencies: "@tsconfig/recommended": ^1.0.2 "@types/jest": ^29.5.3 + "@types/oracledb": ^6 "@types/semver": ^7 + "@types/winston": ^2.4.4 commander: ^11.1.0 dotenv: ^16.0.3 + eslint-plugin-import: ^2.29.1 lint-staged: ^13.1.1 + oracledb: latest prettier: ^2.8.3 semver: ^7.5.4 turbo: ^1.13.3 typescript: ~5.1.6 + winston: ^3.13.0 languageName: unknown linkType: soft @@ -30631,16 +29983,6 @@ __metadata: languageName: node linkType: hard -"levn@npm:^0.4.1": - version: 0.4.1 - resolution: "levn@npm:0.4.1" - dependencies: - prelude-ls: ^1.2.1 - type-check: ~0.4.0 - checksum: 12c5021c859bd0f5248561bf139121f0358285ec545ebf48bb3d346820d5c61a4309535c7f387ed7d84361cf821e124ce346c6b7cef8ee09a67c1473b46d0fc4 - languageName: node - linkType: hard - "levn@npm:~0.3.0": version: 0.3.0 resolution: "levn@npm:0.3.0" @@ -30952,13 +30294,6 @@ __metadata: languageName: node linkType: hard -"lodash.merge@npm:^4.6.2": - version: 4.6.2 - resolution: "lodash.merge@npm:4.6.2" - checksum: ad580b4bdbb7ca1f7abf7e1bce63a9a0b98e370cf40194b03380a46b4ed799c9573029599caebc1b14e3f24b111aef72b96674a56cfa105e0f5ac70546cdc005 - languageName: node - linkType: hard - "lodash.once@npm:^4.0.0": version: 4.1.1 resolution: "lodash.once@npm:4.1.1" @@ -32236,13 +31571,6 @@ __metadata: languageName: node linkType: hard -"natural-compare-lite@npm:^1.4.0": - version: 1.4.0 - resolution: "natural-compare-lite@npm:1.4.0" - checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 - languageName: node - linkType: hard - "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -33212,34 +32540,6 @@ __metadata: languageName: node linkType: hard -"optionator@npm:^0.9.1": - version: 0.9.1 - resolution: "optionator@npm:0.9.1" - dependencies: - deep-is: ^0.1.3 - fast-levenshtein: ^2.0.6 - levn: ^0.4.1 - prelude-ls: ^1.2.1 - type-check: ^0.4.0 - word-wrap: ^1.2.3 - checksum: dbc6fa065604b24ea57d734261914e697bd73b69eff7f18e967e8912aa2a40a19a9f599a507fa805be6c13c24c4eae8c71306c239d517d42d4c041c942f508a0 - languageName: node - linkType: hard - -"optionator@npm:^0.9.3": - version: 0.9.3 - resolution: "optionator@npm:0.9.3" - dependencies: - "@aashutoshrathi/word-wrap": ^1.2.3 - deep-is: ^0.1.3 - fast-levenshtein: ^2.0.6 - levn: ^0.4.1 - prelude-ls: ^1.2.1 - type-check: ^0.4.0 - checksum: 09281999441f2fe9c33a5eeab76700795365a061563d66b098923eb719251a42bdbe432790d35064d0816ead9296dbeb1ad51a733edf4167c96bd5d0882e428a - languageName: node - linkType: hard - "ora@npm:6.3.0, ora@npm:^6.1.2": version: 6.3.0 resolution: "ora@npm:6.3.0" @@ -33291,6 +32591,13 @@ __metadata: languageName: node linkType: hard +"oracledb@npm:latest": + version: 6.4.0 + resolution: "oracledb@npm:6.4.0" + checksum: a4835d418f509e3fcc2ba588f9a1cfa78e78e50d2861ca309f29bf1bccb94261585fc502a82a64f8d254f2c911f8140293428d59147ea83d847905401b97003b + languageName: node + linkType: hard + "os-name@npm:5.1.0": version: 5.1.0 resolution: "os-name@npm:5.1.0" @@ -34712,13 +34019,6 @@ __metadata: languageName: node linkType: hard -"prelude-ls@npm:^1.2.1": - version: 1.2.1 - resolution: "prelude-ls@npm:1.2.1" - checksum: cd192ec0d0a8e4c6da3bb80e4f62afe336df3f76271ac6deb0e6a36187133b6073a19e9727a1ff108cd8b9982e4768850d413baa71214dd80c7979617dca827a - languageName: node - linkType: hard - "prelude-ls@npm:~1.1.2": version: 1.1.2 resolution: "prelude-ls@npm:1.1.2" @@ -35878,13 +35178,6 @@ __metadata: languageName: node linkType: hard -"regexpp@npm:^3.2.0": - version: 3.2.0 - resolution: "regexpp@npm:3.2.0" - checksum: a78dc5c7158ad9ddcfe01aa9144f46e192ddbfa7b263895a70a5c6c73edd9ce85faf7c0430e59ac38839e1734e275b9c3de5c57ee3ab6edc0e0b1bdebefccef8 - languageName: node - linkType: hard - "regexpu-core@npm:^5.3.1": version: 5.3.2 resolution: "regexpu-core@npm:5.3.2" @@ -38594,6 +37887,18 @@ __metadata: languageName: node linkType: hard +"tsconfig-paths@npm:^3.15.0": + version: 3.15.0 + resolution: "tsconfig-paths@npm:3.15.0" + dependencies: + "@types/json5": ^0.0.29 + json5: ^1.0.2 + minimist: ^1.2.6 + strip-bom: ^3.0.0 + checksum: 59f35407a390d9482b320451f52a411a256a130ff0e7543d18c6f20afab29ac19fbe55c360a93d6476213cc335a4d76ce90f67df54c4e9037f7d240920832201 + languageName: node + linkType: hard + "tslib@npm:2.6.2, tslib@npm:^2.0.3, tslib@npm:^2.6.2": version: 2.6.2 resolution: "tslib@npm:2.6.2" @@ -38737,15 +38042,6 @@ __metadata: languageName: node linkType: hard -"type-check@npm:^0.4.0, type-check@npm:~0.4.0": - version: 0.4.0 - resolution: "type-check@npm:0.4.0" - dependencies: - prelude-ls: ^1.2.1 - checksum: ec688ebfc9c45d0c30412e41ca9c0cdbd704580eb3a9ccf07b9b576094d7b86a012baebc95681999dd38f4f444afd28504cb3a89f2ef16b31d4ab61a0739025a - languageName: node - linkType: hard - "type-check@npm:~0.3.2": version: 0.3.2 resolution: "type-check@npm:0.3.2" @@ -40620,6 +39916,36 @@ __metadata: languageName: node linkType: hard +"winston-transport@npm:^4.7.0": + version: 4.7.0 + resolution: "winston-transport@npm:4.7.0" + dependencies: + logform: ^2.3.2 + readable-stream: ^3.6.0 + triple-beam: ^1.3.0 + checksum: ce074b5c76a99bee5236cf2b4d30fadfaf1e551d566f654f1eba303dc5b5f77169c21545ff5c5e4fdad9f8e815fc6d91b989f1db34161ecca6e860e62fd3a862 + languageName: node + linkType: hard + +"winston@npm:*, winston@npm:^3.13.0": + version: 3.13.0 + resolution: "winston@npm:3.13.0" + dependencies: + "@colors/colors": ^1.6.0 + "@dabh/diagnostics": ^2.0.2 + async: ^3.2.3 + is-stream: ^2.0.0 + logform: ^2.4.0 + one-time: ^1.0.0 + readable-stream: ^3.4.0 + safe-stable-stringify: ^2.3.1 + stack-trace: 0.0.x + triple-beam: ^1.3.0 + winston-transport: ^4.7.0 + checksum: 66f9fbbadb58e1632701e9c89391f217310c9455462148e163e060dcd25aed21351b0413bdbbf90e5c5fe9bc945fc5de6f53875ac7c7ef3061133a354fc678c0 + languageName: node + linkType: hard + "winston@npm:^3.9.0": version: 3.10.0 resolution: "winston@npm:3.10.0" @@ -40639,7 +39965,7 @@ __metadata: languageName: node linkType: hard -"word-wrap@npm:^1.2.3, word-wrap@npm:~1.2.3": +"word-wrap@npm:~1.2.3": version: 1.2.3 resolution: "word-wrap@npm:1.2.3" checksum: 30b48f91fcf12106ed3186ae4fa86a6a1842416df425be7b60485de14bec665a54a68e4b5156647dec3a70f25e84d270ca8bc8cd23182ed095f5c7206a938c1f From b722003a8f633096f131f22eb1b50074c1ab0d28 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Thu, 19 Sep 2024 16:28:59 -0400 Subject: [PATCH 02/33] Add doc loader files --- .../src/document_loaders/fs/oracle.ts | 191 ++++++++++++++++++ .../document_loaders/tests/oracle.int.test.ts | 30 +++ .../src/embeddings/oracle.ts | 150 ++++++++++++++ .../src/embeddings/tests/oracle.int.test.ts | 47 +++++ .../src/oracle_text_splitter.ts | 56 +++++ .../tests/oracle_text_splitter.int.test.ts | 38 ++++ libs/langchain-community/src/utils/oracle.ts | 56 +++++ .../src/utils/tests/oracle.int.test.ts | 22 ++ 8 files changed, 590 insertions(+) create mode 100644 libs/langchain-community/src/document_loaders/fs/oracle.ts create mode 100644 libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts create mode 100644 libs/langchain-community/src/embeddings/oracle.ts create mode 100644 libs/langchain-community/src/embeddings/tests/oracle.int.test.ts create mode 100644 libs/langchain-community/src/oracle_text_splitter.ts create mode 100644 libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts create mode 100644 libs/langchain-community/src/utils/oracle.ts create mode 100644 libs/langchain-community/src/utils/tests/oracle.int.test.ts diff --git a/libs/langchain-community/src/document_loaders/fs/oracle.ts b/libs/langchain-community/src/document_loaders/fs/oracle.ts new file mode 100644 index 000000000000..9b19db06b49c --- /dev/null +++ b/libs/langchain-community/src/document_loaders/fs/oracle.ts @@ -0,0 +1,191 @@ +import { Document } from "@langchain/core/documents"; +import fs from "node:fs"; +import path from "node:path"; +import oracledb from "oracledb"; +import * as htmlparser2 from "htmlparser2"; +import { BaseDocumentLoader } from "@langchain/core/document_loaders/base"; + +function* listDir(dir: string): Generator { + const files = fs.readdirSync(dir, { withFileTypes: true }); + + for (const file of files) { + if (file.isDirectory()) { + yield* listDir(path.join(dir, file.name)); + } else { + yield path.join(dir, file.name); + } + } +} + +/** + * Load documents from a file, a directory, or a table + * If the document isn't a plain text file such as a PDF, + * a plain text version will be extracted using utl_to_text + * @example + * ```typescript + * const loader = new OracleDocLoader(conn, params); + * const docs = await loader.load(); + * ``` + */ +export class OracleDocLoader extends BaseDocumentLoader { + protected conn: oracledb.Connection; + + protected pref: Record; + + constructor(conn: oracledb.Connection, pref: Record) { + super(); + this.conn = conn; + this.pref = pref; + } + + /** + * A method that loads the text file or blob and returns a promise that + * resolves to an array of `Document` instances. It reads the text from + * the file or blob using the `readFile` function from the + * `node:fs/promises` module or the `text()` method of the blob. It then + * parses the text using the `parse()` method and creates a `Document` + * instance for each parsed page. The metadata includes the source of the + * text (file path or blob) and, if there are multiple pages, the line + * number of each page. + * @returns A promise that resolves to an array of `Document` instances. + */ + async load() { + const docs = []; + + if ("file" in this.pref) { + // don't specify an encoding to use binary + const data = fs.readFileSync(this.pref.file); + + const result = await this.conn.execute( + ( + `select dbms_vector_chain.utl_to_text(:content, json(:pref)) text, dbms_vector_chain.utl_to_text(:content, json('{"plaintext": "false"}')) metadata from dual` + ), + { + content: { val: data, dir: oracledb.BIND_IN, type: oracledb.BLOB }, + pref: JSON.stringify(this.pref), + }, + ({ + resultSet: true, // return a ResultSet (default is false) + fetchInfo: { + TEXT: { type: oracledb.STRING }, + METADATA: { type: oracledb.STRING }, + }, + }) + ); + + const rs = result.resultSet; + let row; + if (rs != null) { + while ((row = await rs.getRow())) { + const [plain_text, metadata] = await this._extract(row); + docs.push( + new Document({ + pageContent: plain_text, + metadata: >metadata, + }) + ); + } + await rs.close(); + } + } else if ("dir" in this.pref) { + for (const file of listDir(this.pref.dir)) { + // don't specify an encoding to use binary + const data = fs.readFileSync(file); + + const result = await this.conn.execute( + ( + `select dbms_vector_chain.utl_to_text(:content, json(:pref)) text, dbms_vector_chain.utl_to_text(:content, json('{"plaintext": "false"}')) metadata from dual` + ), + { + content: { val: data, dir: oracledb.BIND_IN, type: oracledb.BLOB }, + pref: JSON.stringify(this.pref), + }, + ({ + resultSet: true, // return a ResultSet (default is false) + fetchInfo: { + TEXT: { type: oracledb.STRING }, + METADATA: { type: oracledb.STRING }, + }, + }) + ); + + const rs = result.resultSet; + let row; + if (rs != null) { + while ((row = await rs.getRow())) { + const [plain_text, metadata] = await this._extract(row); + docs.push( + new Document({ + pageContent: plain_text, + metadata: >metadata, + }) + ); + } + await rs.close(); + } + } + } else if ("tablename" in this.pref) { + if (!("owner" in this.pref) || !("colname" in this.pref)) { + throw new Error(`Invalid preferences: missing owner or colname`); + } + const result = await this.conn.execute( + ( + `select dbms_vector_chain.utl_to_text(t.${this.pref.colname}, json(:pref)) text, dbms_vector_chain.utl_to_text(t.${this.pref.colname}, json('{"plaintext": "false"}')) metadata from ${this.pref.owner}.${this.pref.tablename} t` + ), + { + pref: JSON.stringify(this.pref), + }, + ({ + resultSet: true, // return a ResultSet (default is false) + fetchInfo: { + TEXT: { type: oracledb.STRING }, + METADATA: { type: oracledb.STRING }, + }, + }) + ); + + const rs = result.resultSet; + let row; + if (rs != null) { + while ((row = await rs.getRow())) { + const [plain_text, metadata] = await this._extract(row); + docs.push( + new Document({ + pageContent: plain_text, + metadata: >metadata, + }) + ); + } + await rs.close(); + } + } else { + throw new Error(`Invalid preferences: missing file or tablename`); + } + + return docs; + } + + // extract plain text and metadata from a row + async _extract(row: any) { + let plain_text = ""; + let metadata: Record = {}; + + if (row != null) { + [plain_text] = row; + const [, html_metadata] = row; + + const parser = new htmlparser2.Parser({ + onopentag(name, attributes) { + if (name === "meta" && attributes.name !== undefined) { + metadata[attributes.name] = attributes.content; + } + }, + }); + parser.write(html_metadata); + parser.end(); + } + + return [plain_text, metadata]; + } +} + diff --git a/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts b/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts new file mode 100644 index 000000000000..1c4751427dee --- /dev/null +++ b/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts @@ -0,0 +1,30 @@ +import { test, expect } from "@jest/globals"; +import * as url from "node:url"; +import * as path from "node:path"; +import { getEnvironmentVariable } from "@langchain/core/utils/env"; +import oracledb from "oracledb"; +import { OracleDocLoader } from "../fs/oracle.js"; + +test("Test loading PDF from file", async () => { + const filePath = path.resolve( + path.dirname(url.fileURLToPath(import.meta.url)), + "./example_data/1706.03762.pdf" + ); + const pref = { file: filePath }; + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const loader = new OracleDocLoader(connection, pref); + const docs = await loader.load(); + await connection.close(); + + expect(docs.length).toBe(1); + expect(docs[0].pageContent).toContain("Attention"); + expect(docs[0].pageContent).toContain("Is"); + expect(docs[0].pageContent).toContain("All"); + expect(docs[0].pageContent).toContain("You"); + expect(docs[0].pageContent).toContain("Need"); +}); + diff --git a/libs/langchain-community/src/embeddings/oracle.ts b/libs/langchain-community/src/embeddings/oracle.ts new file mode 100644 index 000000000000..64932e63d05b --- /dev/null +++ b/libs/langchain-community/src/embeddings/oracle.ts @@ -0,0 +1,150 @@ +import { Embeddings, EmbeddingsParams } from "@langchain/core/embeddings"; +import oracledb from "oracledb"; + +/** + * Generate embeddings using models through Oracle + * @example + * ```typescript + * const embedder = new OracleDocLoader(conn, params, proxy); + * const embed = await embedder.embedQuery(chunk); + * ``` + */ +export class OracleEmbeddings extends Embeddings { + protected conn: oracledb.Connection; + + protected pref: Record; + + protected proxy: string; + + constructor( + conn: oracledb.Connection, + pref: Record, + proxy = "", + fields: EmbeddingsParams = {} + ) { + super(fields ?? {}); + this.conn = conn; + this.pref = pref; + this.proxy = proxy; + } + + static async loadOnnxModel( + conn: oracledb.Connection, + dir: string, + onnx_file: string, + model_name: string + ) { + await conn.execute( + `begin + dbms_data_mining.drop_model(model_name => :model, force => true); + dbms_vector.load_onnx_model(:path, :filename, :model, + json('{"function" : "embedding", "embeddingOutput" : "embedding" , "input": {"input": ["DATA"]}}')); +end;`, + { path: dir, filename: onnx_file, model: model_name } + ); + } + + async _embed(texts: string[]) { + // replace newlines, which can negatively affect performance. + const clean_texts = texts.map((text) => text.replace(/\n/g, " ")); + + if (this.proxy) { + await this.conn.execute("begin utl_http.set_proxy(:proxy); end;", { + proxy: this.proxy, + }); + } + + const embeddings = []; + + if (oracledb.thin) { + // thin mode, can't use batching + + for (const clean_text of clean_texts) { + const result = await this.conn.execute( + ( + `select t.column_value as data from dbms_vector_chain.utl_to_embeddings(:content, json(:pref)) t` + ), + { + content: clean_text, + pref: JSON.stringify(this.pref), + }, + ( + ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) + ) + ); + const rows: any = result.rows; + if (Symbol.iterator in Object(rows)) { + for (const row of rows) { + const [chunk_str] = row; + const chunk = JSON.parse(chunk_str); + const vec = JSON.parse(chunk.embed_vector); + embeddings.push(vec); + } + } + } + } else { + // thick mode, can use batching + + const chunks: string[] = []; + for (const [i, clean_text] of clean_texts.entries()) { + const chunk = { + chunk_id: i, + chunk_data: clean_text, + }; + chunks.push(JSON.stringify(chunk)); + } + + const VectorArrayT = await this.conn.getDbObjectClass( + "SYS.VECTOR_ARRAY_T" + ); + const inputs = new VectorArrayT(chunks); + + const result = await this.conn.execute( + ( + `select t.column_value as data from dbms_vector_chain.utl_to_embeddings(:content, json(:pref)) t` + ), + { + content: inputs, + pref: JSON.stringify(this.pref), + }, + ( + ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) + ) + ); + const rows: any = result.rows; + if (Symbol.iterator in Object(rows)) { + for (const row of rows) { + const [chunk_str] = row; + const chunk = JSON.parse(chunk_str); + const vec = JSON.parse(chunk.embed_vector); + embeddings.push(vec); + } + } + } + + return embeddings; + } + + /** + * Method that takes a document as input and returns a promise that + * resolves to an embedding for the document. It calls the _embed method + * with the document as the input and returns the first embedding in the + * resulting array. + * @param document Document to generate an embedding for. + * @returns Promise that resolves to an embedding for the document. + */ + embedQuery(document: string) { + return this._embed([document]).then((embeddings) => embeddings[0]); + } + + /** + * Method that takes an array of documents as input and returns a promise + * that resolves to a 2D array of embeddings for each document. It calls + * the _embed method with the documents as the input. + * @param documents Array of documents to generate embeddings for. + * @returns Promise that resolves to a 2D array of embeddings for each document. + */ + embedDocuments(documents: string[]) { + return this._embed(documents); + } +} diff --git a/libs/langchain-community/src/embeddings/tests/oracle.int.test.ts b/libs/langchain-community/src/embeddings/tests/oracle.int.test.ts new file mode 100644 index 000000000000..d72682828d4d --- /dev/null +++ b/libs/langchain-community/src/embeddings/tests/oracle.int.test.ts @@ -0,0 +1,47 @@ +import { test, expect } from "@jest/globals"; +import { getEnvironmentVariable } from "@langchain/core/utils/env"; +import oracledb from "oracledb"; +import { OracleEmbeddings } from "../oracle.js"; + +test("Test embedQuery", async () => { + const pref = { + provider: "database", + model: getEnvironmentVariable("ORACLE_MODEL"), + }; + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const embeddings = new OracleEmbeddings(connection, pref); + const queryEmbedding = await embeddings.embedQuery("Hello world!"); + await connection.close(); + + expect(queryEmbedding.length).toBeGreaterThan(1); +}); + +test("Test embedDocuments", async () => { + const texts = [ + "Hello world!", + "Hello bad world!", + "Hello nice world!", + "Hello good world!", + "1 + 1 = 2", + "1 + 1 = 3", + ]; + + const pref = { + provider: "database", + model: getEnvironmentVariable("ORACLE_MODEL"), + }; + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const embeddings = new OracleEmbeddings(connection, pref); + const docEmbeddings = await embeddings.embedDocuments(texts); + await connection.close(); + + expect(docEmbeddings.length).toBe(6); +}); diff --git a/libs/langchain-community/src/oracle_text_splitter.ts b/libs/langchain-community/src/oracle_text_splitter.ts new file mode 100644 index 000000000000..05d38caad2bb --- /dev/null +++ b/libs/langchain-community/src/oracle_text_splitter.ts @@ -0,0 +1,56 @@ +import oracledb from "oracledb"; +import { TextSplitter, TextSplitterParams } from "@langchain/textsplitters"; + +/** + * Split text into smaller pieces + * @example + * ```typescript + * const splitter = new OracleTextSplitter(conn, params); + * let chunks = await splitter.splitText(doc.pageContent); + * ``` + */ +export class OracleTextSplitter extends TextSplitter { + protected conn: oracledb.Connection; + + protected pref: Record; + + static lc_name() { + return "OracleTextSplitter"; + } + + constructor( + conn: oracledb.Connection, + pref: Record, + fields?: TextSplitterParams + ) { + super(fields); + this.conn = conn; + this.pref = pref; + } + + async splitText(text: string) { + const chunks: string[] = []; + + const result = await this.conn.execute( + ( + `select t.column_value as data from dbms_vector_chain.utl_to_chunks(:content, json(:pref)) t` + ), + { + content: { val: text, dir: oracledb.BIND_IN, type: oracledb.CLOB }, + pref: JSON.stringify(this.pref), + }, + ( + ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) + ) + ); + const rows: any = result.rows; + if (Symbol.iterator in Object(rows)) { + for (const row of rows) { + const [chunk_str] = row; + const chunk = JSON.parse(chunk_str); + chunks.push(chunk.chunk_data); + } + } + return chunks; + } +} diff --git a/libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts b/libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts new file mode 100644 index 000000000000..83ee1735d849 --- /dev/null +++ b/libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts @@ -0,0 +1,38 @@ +import { expect, test } from "@jest/globals"; +import { getEnvironmentVariable } from "@langchain/core/utils/env"; +import oracledb from "oracledb"; +import { OracleTextSplitter } from "../oracle_text_splitter.js"; + +test("Test splitting by character count.", async () => { + const text = + "The tower is 324 meters (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 meters (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 meters. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 meters (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."; + const pref = { by: "chars", max: 500 }; + + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const splitter = new OracleTextSplitter(connection, pref); + const output = await splitter.splitText(text); + await connection.close(); + + expect(output.length).toEqual(2); +}); + +test("Test splitting by words.", async () => { + const text = + "The tower is 324 meters (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 meters (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 meters. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 meters (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."; + const pref = { by: "words", max: 100 }; + + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const splitter = new OracleTextSplitter(connection, pref); + const output = await splitter.splitText(text); + await connection.close(); + + expect(output.length).toEqual(2); +}); diff --git a/libs/langchain-community/src/utils/oracle.ts b/libs/langchain-community/src/utils/oracle.ts new file mode 100644 index 000000000000..358e7f7a6a96 --- /dev/null +++ b/libs/langchain-community/src/utils/oracle.ts @@ -0,0 +1,56 @@ +import oracledb from "oracledb"; + +/** + * Generate a summary using models through Oracle + * @example + * ```typescript + * const model = new OracleSummary(conn, params); + * let summary = await model.getSummary(doc.pageContent); + * ``` + */ +export class OracleSummary { + protected conn: oracledb.Connection; + + protected pref: Record; + + protected proxy: string; + + constructor( + conn: oracledb.Connection, + pref: Record, + proxy = "" + ) { + this.conn = conn; + this.pref = pref; + this.proxy = proxy; + } + + async getSummary(text: string) { + if (this.proxy) { + await this.conn.execute("begin utl_http.set_proxy(:proxy); end;", { + proxy: this.proxy, + }); + } + + let summary = ""; + const result = await this.conn.execute( + ( + `select dbms_vector_chain.utl_to_summary(:content, json(:pref)) data from dual` + ), + { + content: { val: text, dir: oracledb.BIND_IN, type: oracledb.CLOB }, + pref: JSON.stringify(this.pref), + }, + ( + ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) + ) + ); + const rows: any = result.rows; + if (Symbol.iterator in Object(rows)) { + for (const row of rows) { + [summary] = row; + } + } + return summary; + } +} diff --git a/libs/langchain-community/src/utils/tests/oracle.int.test.ts b/libs/langchain-community/src/utils/tests/oracle.int.test.ts new file mode 100644 index 000000000000..8b87dd1c0303 --- /dev/null +++ b/libs/langchain-community/src/utils/tests/oracle.int.test.ts @@ -0,0 +1,22 @@ +import { expect, test } from "@jest/globals"; +import { getEnvironmentVariable } from "@langchain/core/utils/env"; +import oracledb from "oracledb"; +import { OracleSummary } from "../oracle.js"; + +test("Test summary.", async () => { + const text = + "The tower is 324 meters (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 meters (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 meters. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 meters (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."; + const pref = { provider: "database", gLevel: "S" }; + + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const model = new OracleSummary(connection, pref); + const output = await model.getSummary(text); + await connection.close(); + + expect(output.length).toBeGreaterThan(1); + expect(output).toContain("tower"); +}); From d93610cef73f0c6856180a712e2b8c348ed66395 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Thu, 19 Sep 2024 16:36:29 -0400 Subject: [PATCH 03/33] Add docs --- cookbook/oracleai.mdx | 532 ++++++++++++++++++ .../file_loaders/oracleai.mdx | 79 +++ .../docs/integrations/platforms/oracleai.mdx | 77 +++ .../integrations/text_embedding/oracleai.mdx | 52 ++ .../docs/integrations/tools/oracleai.mdx | 60 ++ 5 files changed, 800 insertions(+) create mode 100644 cookbook/oracleai.mdx create mode 100644 docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx create mode 100644 docs/core_docs/docs/integrations/platforms/oracleai.mdx create mode 100644 docs/core_docs/docs/integrations/text_embedding/oracleai.mdx create mode 100644 docs/core_docs/docs/integrations/tools/oracleai.mdx diff --git a/cookbook/oracleai.mdx b/cookbook/oracleai.mdx new file mode 100644 index 000000000000..50f96449ae2a --- /dev/null +++ b/cookbook/oracleai.mdx @@ -0,0 +1,532 @@ +# Oracle AI Vector Search with Document Processing + +Oracle AI Vector Search is designed for Artificial Intelligence (AI) workloads that allows you to query data based on semantics, rather than keywords. One of the biggest benefits of Oracle AI Vector Search is that semantic search on unstructured data can be combined with relational search on business data in one single system. This is not only powerful but also significantly more effective because you don't need to add a specialized vector database, eliminating the pain of data fragmentation between multiple systems. + +In addition, your vectors can benefit from all of Oracle Database’s most powerful features, like the following: + +* [Partitioning Support](https://www.oracle.com/database/technologies/partitioning.html) +* [Real Application Clusters scalability](https://www.oracle.com/database/real-application-clusters/) +* [Exadata smart scans](https://www.oracle.com/database/technologies/exadata/software/smartscan/) +* [Shard processing across geographically distributed databases](https://www.oracle.com/database/distributed-database/) +* [Transactions](https://docs.oracle.com/en/database/oracle/oracle-database/23/cncpt/transactions.html) +* [Parallel SQL](https://docs.oracle.com/en/database/oracle/oracle-database/21/vldbg/parallel-exec-intro.html#GUID-D28717E4-0F77-44F5-BB4E-234C31D4E4BA) +* [Disaster recovery](https://www.oracle.com/database/data-guard/) +* [Security](https://www.oracle.com/security/database-security/) +* [Oracle Machine Learning](https://www.oracle.com/artificial-intelligence/database-machine-learning/) +* [Oracle Graph Database](https://www.oracle.com/database/integrated-graph-database/) +* [Oracle Spatial and Graph](https://www.oracle.com/database/spatial/) +* [Oracle Blockchain](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_blockchain_table.html#GUID-B469E277-978E-4378-A8C1-26D3FF96C9A6) +* [JSON](https://docs.oracle.com/en/database/oracle/oracle-database/23/adjsn/json-in-oracle-database.html) + +This guide demonstrates how Oracle AI Vector Search can be used with Langchain to serve an end-to-end RAG pipeline. This guide goes through examples of: + +* Loading the documents from various sources using OracleDocLoader +* Summarizing them within/outside the database using OracleSummary +* Generating embeddings for them within/outside the database using OracleEmbeddings +* Chunking them according to different requirements using Advanced Oracle Capabilities from OracleTextSplitter +* Storing and Indexing them in a Vector Store and querying them for queries in OracleVS + +If you are just starting with Oracle Database, consider exploring the [free Oracle 23 AI](https://www.oracle.com/database/free/#resources) which provides a great introduction to setting up your database environment. While working with the database, it is often advisable to avoid using the system user by default; instead, you can create your own user for enhanced security and customization. For detailed steps on user creation, refer to our [end-to-end guide](https://github.com/langchain-ai/langchain/blob/master/cookbook/oracleai_demo.ipynb) which also shows how to set up a user in Oracle. Additionally, understanding user privileges is crucial for managing database security effectively. You can learn more about this topic in the official [Oracle guide](https://docs.oracle.com/en/database/oracle/oracle-database/19/admqs/administering-user-accounts-and-security.html#GUID-36B21D72-1BBB-46C9-A0C9-F0D2A8591B8D) on administering user accounts and security. + +## Prerequisites + +Please install the Oracle Javascript Client driver node-oracledb to use Langchain with Oracle AI Vector Search. + +```bash npm2yarn +npm install oracledb +``` + +## Create Demo User + +First, create a demo user with all the required privileges. + +```sql +-- Drop user +begin + execute immediate 'drop user testuser cascade'; +exception + when others then + dbms_output.put_line('Error dropping user: ' || SQLERRM); +end; +/ + +-- Create user and grant privileges +create user testuser identified by testuser; +grant connect, unlimited tablespace, create credential, create procedure, create any index to testuser; +create or replace directory MODEL_DIR as '/path/to/models'; +grant read, write on directory MODEL_DIR to public; +grant create mining model to testuser; + +-- Network access +begin + DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE( + host => '*', + ace => xs$ace_type(privilege_list => xs$name_list('connect'), + principal_name => 'testuser', + principal_type => xs_acl.ptype_db) + ); +end; +/ +``` + +## Process Documents using Oracle AI + +Consider the following scenario: users possess documents stored either in an Oracle Database or a file system and intend to utilize this data with Oracle AI Vector Search powered by Langchain. + +To prepare the documents for analysis, a comprehensive preprocessing workflow is necessary. Initially, the documents must be retrieved, summarized (if required), and chunked as needed. Subsequent steps involve generating embeddings for these chunks and integrating them into the Oracle AI Vector Store. Users can then conduct semantic searches on this data. + +The Oracle AI Vector Search Langchain library encompasses a suite of document processing tools that facilitate document loading, chunking, summary generation, and embedding creation. + +In the sections that follow, we will detail the utilization of Oracle AI Langchain APIs to effectively implement each of these processes. + +## Connect to Demo User + +The following sample code will show how to connect to Oracle Database. By default, node-oracledb runs in a ‘Thin’ mode which connects directly to Oracle Database. This mode does not need Oracle Client libraries. However, some additional functionality is available when node-oracledb uses them. node-oracledb is said to be in ‘Thick’ mode when Oracle Client libraries are used. Both modes have comprehensive functionality supporting Oracle Database. See the following guide that talks about features supported in each mode. You might want to switch to thick-mode if you are unable to use thin-mode. + +```typescript +import oracledb from "oracledb"; + +const username = "testuser"; +const password = "testuser"; +const dsn = ""; + +let conn; +try { + try { + conn = await oracledb.getConnection({ + user: username, + password: password, + connectionString: dsn + }); + console.log("Connection successful"); + } catch (err) { + console.log("Connection failed") + throw err; + } +} catch (err) { + console.error(err); +} +finally { +  if (conn) + { + try { +    await conn.close(); + } catch (err) { +     console.error(err); + } + } +} +``` +``` +Connection successful +``` + +## Populate a Demo Table + +Create a demo table and insert some sample documents. + +```typescript +try { + const drop_table_sql: string = "begin execute immediate 'drop table demo_tab'; exception when others then null; end;"; + await conn.execute(drop_table_sql); + + const create_table_sql: string = "create table demo_tab (id number, data clob)"; + await conn.execute(create_table_sql); + + const insert_row_sql: string = "insert into demo_tab values (:id, :data)"; + const rows_to_insert = [{ + id: 1, + data: "If the answer to any preceding questions is yes, then the database stops the search and allocates space from the specified tablespace; otherwise, space is allocated from the database default shared temporary tablespace.", + }, { + id: 2, + data: "A tablespace can be online (accessible) or offline (not accessible) whenever the database is open.\nA tablespace is usually online so that its data is available to users. The SYSTEM tablespace and temporary tablespaces cannot be taken offline.", + }, { + id: 3, + data: "The database stores LOBs differently from other data types. Creating a LOB column implicitly creates a LOB segment and a LOB index. The tablespace containing the LOB segment and LOB index, which are always stored together, may be different from the tablespace containing the table.\nSometimes the database can store small amounts of LOB data in the table itself rather than in a separate LOB segment.", + }, + ]; + const result = await conn.executeMany(insert_row_sql, rows_to_insert); + + await conn.commit(); + + console.log("Table created and populated") +} catch (err) { + console.log("Table creation failed"); + throw err; +} +``` +``` +Connection successful +Table created and populated +``` + +With the inclusion of a demo user and a populated sample table, the remaining configuration involves setting up embedding and summary functionalities. Users are presented with multiple provider options, including local database solutions and third-party services such as Ocigenai, Hugging Face, and OpenAI. Should users opt for a third-party provider, they are required to establish credentials containing the necessary authentication details. Conversely, if selecting a database as the provider for embeddings, it is necessary to upload an ONNX model to the Oracle Database. No additional setup is required for summary functionalities when using the database option. + +## Load ONNX Model + +Oracle accommodates a variety of embedding providers, enabling users to choose between proprietary database solutions and third-party services such as OCIGENAI and HuggingFace. This selection dictates the methodology for generating and managing embeddings. + +**Important** : Should users opt for the database option, they must upload an ONNX model into the Oracle Database. Conversely, if a third-party provider is selected for embedding generation, uploading an ONNX model to Oracle Database is not required. + +A significant advantage of utilizing an ONNX model directly within Oracle is the enhanced security and performance it offers by eliminating the need to transmit data to external parties. Additionally, this method avoids the latency typically associated with network or REST API calls. + +Below is the example code to upload an ONNX model into Oracle Database: + +```typescript +import {OracleEmbeddings} from "./oracleds.js"; + +// please update with your related information +// make sure that you have onnx file in the system +const onnx_dir = "MODEL_DIR"; +const onnx_file = "ALL-MINILM-L12-V2.onnx"; +const model_name = "demo_model"; + +try { + await OracleEmbeddings.loadOnnxModel(conn, onnx_dir, onnx_file, model_name); + console.log("ONNX model loaded"); +} catch (err) { + console.log("ONNX model loading failed"); + throw err; +} +``` +``` +Connection successful +ONNX model loaded +``` + +## Create Credential + +When selecting third-party providers for generating embeddings, users are required to establish credentials to securely access the provider's endpoints. + +**Important**: No credentials are necessary when opting for the 'database' provider to generate embeddings. However, should users decide to utilize a third-party provider, they must create credentials specific to the chosen provider. + +Below is an illustrative example: + +```typescript +try { + await conn.execute(` + declare + jo json_object_t; + begin + -- HuggingFace + + begin + dbms_vector_chain.drop_credential(credential_name => 'HF_CRED'); + exception + when others then null; + end; + + jo := json_object_t(); + jo.put('access_token', ''); + dbms_vector_chain.create_credential( + credential_name => 'HF_CRED', + params => json(jo.to_string)); + + -- OCIGenAI + + begin + dbms_vector_chain.drop_credential(credential_name => 'OCI_CRED'); + exception + when others then null; + end; + + jo := json_object_t(); + jo.put('user_ocid',''); + jo.put('tenancy_ocid',''); + jo.put('compartment_ocid',''); + jo.put('private_key',''); + jo.put('fingerprint',''); + dbms_vector_chain.create_credential( + credential_name => 'OCI_CRED', + params => json(jo.to_string)); + end;`); + console.log("Credentials created") +} catch (err) { + console.log("Credentials creation failed"); + throw err; +} +``` +``` +Connection successful +Credentials created +``` + +## Load Documents + +Users have the flexibility to load documents from either the Oracle Database, a file system, or both, by appropriately configuring the loader parameters. For comprehensive details on these parameters, please consult the Oracle AI Vector Search Guide. + +A significant advantage of utilizing OracleDocLoader is its capability to process over 150 distinct file formats, eliminating the need for multiple loaders for different document types. For a complete list of the supported formats, please refer to the Oracle Text Supported Document Formats. + +Below is a sample code snippet that demonstrates how to use OracleDocLoader + +```typescript +import {OracleDocLoader} from "./oracleds.js"; + +// loading from Oracle Database table +// make sure you have the table with this specification +const loader_params = { + "owner": "testuser", + "tablename": "demo_tab", + "colname": "data", +}; + +// load the docs +const loader = new OracleDocLoader(conn, loader_params); +const docs = await loader.load(); + +// verify +console.log(`Number of docs loaded: ${docs.length}`); +//console.log(`Document-0: ${docs[0].pageContent}`); +``` +``` +Connection successful +Number of docs loaded: 3 +``` + +Oracle accommodates a variety of embedding providers, enabling users to choose between proprietary database solutions and third-party services such as OCIGENAI and HuggingFace. This selection dictates the methodology for generating and managing embeddings. + +**Important** : Should users opt for the database option, they must upload an ONNX model into the Oracle Database. Conversely, if a third-party provider is selected for embedding generation, uploading an ONNX model to Oracle Database is not required. + +A significant advantage of utilizing an ONNX model directly within Oracle is the enhanced security and performance it offers by eliminating the need to transmit data to external parties. Additionally, this method avoids the latency typically associated with network or REST API calls. + +Below is the example code to upload an ONNX model into Oracle Database: + +## Generate Summary + +Now that the user loaded the documents, they may want to generate a summary for each document. The Oracle AI Vector Search Langchain library offers a suite of APIs designed for document summarization. It supports multiple summarization providers such as Database, OCIGENAI, HuggingFace, among others, allowing users to select the provider that best meets their needs. To utilize these capabilities, users must configure the summary parameters as specified. For detailed information on these parameters, please consult the Oracle AI Vector Search Guide book. + +**Note**: The users may need to set proxy if they want to use some 3rd party summary generation providers other than Oracle's in-house and default provider: 'database'. If you don't have proxy, please remove the proxy parameter when you instantiate the OracleSummary. + +The following sample code will show how to generate summary: + +```typescript +import {OracleDocLoader, OracleSummary} from "./oracleds.js"; + +// proxy to be used when we instantiate summary and embedder object +const proxy = ""; + +// using 'database' provider +const summary_params = { + "provider": "database", + "glevel": "S", + "numParagraphs": 1, + "language": "english", +}; + +// get the summary instance +// Remove proxy if not required +const model = new OracleSummary(conn, summary_params, proxy); + +let list_summary = []; +for (let[, doc]of docs.entries()) { + const summary = await model.getSummary(doc.pageContent); + list_summary.push(summary); +} + +// verify +console.log(`Number of Summaries: ${list_summary.length}`); +//console.log(`Summary-0: ${list_summary[0]}`) // content +``` +``` +Connection successful +Number of Summaries: 3 +``` + +## Split Documents + +The documents may vary in size, ranging from small to very large. Users often prefer to chunk their documents into smaller sections to facilitate the generation of embeddings. A wide array of customization options is available for this splitting process. For comprehensive details regarding these parameters, please consult the Oracle AI Vector Search Guide. + +Below is a sample code illustrating how to implement this: + +```typescript +import {OracleDocLoader, OracleTextSplitter} from "./oracleds.js"; + +// split by default parameters +const splitter_params = {"normalize": "all"}; + +// get the splitter instance +const splitter = new OracleTextSplitter(conn, splitter_params); + +let list_chunks = []; +for (let[, doc]of docs.entries()) { + let chunks = await splitter.splitText(doc.pageContent); + list_chunks.push(chunks); +} + +// verify +console.log(`Number of Chunks: ${list_chunks.length}`); +//console.log(`Chunk-0: ${list_chunks[0]}`); // content +``` +``` +Connection successful +Number of Chunks: 3 +``` + +## Generate Embeddings + +Now that the documents are chunked as per requirements, the users may want to generate embeddings for these chunks. Oracle AI Vector Search provides multiple methods for generating embeddings, utilizing either locally hosted ONNX models or third-party APIs. For comprehensive instructions on configuring these alternatives, please refer to the Oracle AI Vector Search Guide. + +**Note**: Users may need to configure a proxy to utilize third-party embedding generation providers, excluding the 'database' provider that utilizes an ONNX model. + +The following sample code will show how to generate embeddings: + +```typescript +import {OracleDocLoader, OracleTextSplitter, OracleEmbeddings} from "./oracleds.js"; + +// proxy to be used when we instantiate summary and embedder object +const proxy = ""; + +// using ONNX model loaded to Oracle Database +const embedder_params = { + "provider": "database", + "model": "demo_model" +}; + +// get the embedding instance +// Remove proxy if not required +const embedder = new OracleEmbeddings(conn, embedder_params, proxy); + +let embeddings = []; +for (let[, doc]of docs.entries()) { + let chunks = await splitter.splitText(doc.pageContent); + for (let[, chunk]of chunks.entries()) { + const embed = await embedder.embedQuery(chunk); + embeddings.push(embed); + } +} + +// verify +console.log(`Number of embeddings: ${embeddings.length}`); +//console.log(`Embedding-0: ${embeddings[0]}`); // content +``` +``` +Connection successful +Number of embeddings: 3 +``` + +## Create Oracle AI Vector Store + +Now that you know how to use Oracle AI Langchain library APIs individually to process the documents, let us show how to integrate with Oracle AI Vector Store to facilitate the semantic searches. + +Let's combine all document processing stages together. Here is the sample code below: + +```typescript +/* +In this sample example, we will use 'database' provider for both summary and embeddings. +So, we don't need to do the followings: +- set proxy for 3rd party providers +- create credential for 3rd party providers + +If you choose to use 3rd party provider, +please follow the necessary steps for proxy and credential. +*/ + +import {OracleDocLoader, OracleTextSplitter, OracleEmbeddings, OracleSummary} from "./oracleds.js"; +import {Document} from "langchain/document"; +import oracledb from "oracledb"; + +// oracle connection +// please update with your username, password, hostname, and service_name +const username = "testuser"; +const password = "testuser"; +const dsn = ""; + +let conn; +try { + try { + conn = await oracledb.getConnection({ + user: username, + password: password, + connectionString: dsn + }); + console.log("Connection successful"); + } catch (err) { + console.log("Connection failed") + throw err; + } + + // load onnx model + // please update with your related information + const onnx_dir = "MODEL_DIR"; + const onnx_file = "ALL-MINILM-L12-V2.onnx"; + const model_name = "demo_model"; + + try { + await OracleEmbeddings.loadOnnxModel(conn, onnx_dir, onnx_file, model_name); + console.log("ONNX model loaded"); + } catch (err) { + console.log("ONNX model loading failed"); + throw err; + } + + // params + // please update necessary fields with related information + const loader_params = { + "owner": "testuser", + "tablename": "demo_tab", + "colname": "data", + }; + const summary_params = { + "provider": "database", + "glevel": "S", + "numParagraphs": 1, + "language": "english", + }; + const splitter_params = { + "normalize": "all" + }; + const embedder_params = { + "provider": "database", + "model": "database" + }; + + // instantiate loader, summary, splitter, and embedder + const loader = new OracleDocLoader(conn, loader_params); + const model = new OracleSummary(conn, summary_params); + const splitter = new OracleTextSplitter(conn, splitter_params); + const embedder = new OracleEmbeddings(conn, embedder_params); + + const docs = await loader.load(); + + // process the documents + let chunks_with_mdata = []; + for (let[doc_id, doc]of docs.entries()) { + let summary = await model.getSummary(doc.pageContent); + let chunks = await splitter.splitText(doc.pageContent); + for (let[chunk_id, chunk]of chunks.entries()) { + let chunk_metadata = doc.metadata; + chunk_metadata["id"] = doc_id + "$" + chunk_id; + chunk_metadata["document_id"] = doc_id; + chunk_metadata["document_summary"] = summary; + chunks_with_mdata.push( + new Document({ + pageContent: chunk, + metadata: chunk_metadata + })); + } + } + + // verify + console.log(`Number of total chunks with metadata: ${chunks_with_mdata.length}`); + //console.log(chunks_with_mdata); +} catch (err) { + console.error(err); +} +finally { +  if (conn) + { + try { +    await conn.close(); + } catch (err) { +     console.error(err); + } + } +} +``` +``` +Connection successful +ONNX model loaded +Number of total chunks with metadata: 3 +``` + +At this point, we have processed the documents and generated chunks with metadata. Next, we will create Oracle AI Vector Store with those chunks. diff --git a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx new file mode 100644 index 000000000000..432d709e690a --- /dev/null +++ b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx @@ -0,0 +1,79 @@ +# Oracle AI Vector Search: Document Processing + +## Load Documents + +Users have the flexibility to load documents from either the Oracle Database, a file system, or both, by appropriately configuring the loader parameters. For comprehensive details on these parameters, please consult the [Oracle AI Vector Search Guide](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_vector_chain1.html#GUID-73397E89-92FB-48ED-94BB-1AD960C4EA1F). + +A significant advantage of utilizing OracleDocLoader is its capability to process over 150 distinct file formats, eliminating the need for multiple loaders for different document types. For a complete list of the supported formats, please refer to the [Oracle Text Supported Document Formats](https://docs.oracle.com/en/database/oracle/oracle-database/23/ccref/oracle-text-supported-document-formats.html). + +Below is a sample code snippet that demonstrates how to use OracleDocLoader + +```typescript +import {OracleDocLoader} from "./oracleds.js"; + +/* +// loading a local file +loader_params = {"file": ""}; + +// loading from a local directory +loader_params = {"dir": ""}; +*/ + +// loading from Oracle Database table +// make sure you have the table with this specification +const loader_params = { + "owner": "testuser", + "tablename": "demo_tab", + "colname": "data", +}; + +// load the docs +const loader = new OracleDocLoader(conn, loader_params); +const docs = await loader.load(); + +// verify +console.log(`Number of docs loaded: ${docs.length}`); +//console.log(`Document-0: ${docs[0].pageContent}`); +``` + +## Split Documents + +The documents may vary in size, ranging from small to very large. Users often prefer to chunk their documents into smaller sections to facilitate the generation of embeddings. A wide array of customization options is available for this splitting process. For comprehensive details regarding these parameters, please consult the [Oracle AI Vector Search Guide](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_vector_chain1.html#GUID-4E145629-7098-4C7C-804F-FC85D1F24240). + +Below is a sample code illustrating how to implement this: + +```typescript +import {OracleTextSplitter} from "./oracleds.js"; + +/* +// Some examples +// split by chars, max 500 chars +splitter_params = {"split": "chars", "max": 500, "normalize": "all"}; + +// split by words, max 100 words +splitter_params = {"split": "words", "max": 100, "normalize": "all"}; + +// split by sentence, max 20 sentences +splitter_params = {"split": "sentence", "max": 20, "normalize": "all"}; +*/ + +// split by default parameters +const splitter_params = {"normalize": "all"}; + +// get the splitter instance +const splitter = new OracleTextSplitter(conn, splitter_params); + +let list_chunks = []; +for (let[, doc]of docs.entries()) { + let chunks = await splitter.splitText(doc.pageContent); + list_chunks.push(chunks); +} + +// verify +console.log(`Number of Chunks: ${list_chunks.length}`); +//console.log(`Chunk-0: ${list_chunks[0]}`); // content +``` + +## End to End Demo + +Please refer to our complete demo guide [Oracle AI Vector Search End-to-End Demo Guide](https://github.com/langchain-ai/langchainjs/tree/main/cookbook/oracleai.mdx) to build an end to end RAG pipeline with the help of Oracle AI Vector Search. diff --git a/docs/core_docs/docs/integrations/platforms/oracleai.mdx b/docs/core_docs/docs/integrations/platforms/oracleai.mdx new file mode 100644 index 000000000000..5d653a633264 --- /dev/null +++ b/docs/core_docs/docs/integrations/platforms/oracleai.mdx @@ -0,0 +1,77 @@ +# OracleAI Vector Search + +Oracle AI Vector Search is designed for Artificial Intelligence (AI) workloads that allows you to query data based on semantics, rather than keywords. +One of the biggest benefits of Oracle AI Vector Search is that semantic search on unstructured data can be combined with relational search on business data in one single system. +This is not only powerful but also significantly more effective because you don't need to add a specialized vector database, eliminating the pain of data fragmentation between multiple systems. + +In addition, your vectors can benefit from all of Oracle Database’s most powerful features, like the following: + + * [Partitioning Support](https://www.oracle.com/database/technologies/partitioning.html) + * [Real Application Clusters scalability](https://www.oracle.com/database/real-application-clusters/) + * [Exadata smart scans](https://www.oracle.com/database/technologies/exadata/software/smartscan/) + * [Shard processing across geographically distributed databases](https://www.oracle.com/database/distributed-database/) + * [Transactions](https://docs.oracle.com/en/database/oracle/oracle-database/23/cncpt/transactions.html) + * [Parallel SQL](https://docs.oracle.com/en/database/oracle/oracle-database/21/vldbg/parallel-exec-intro.html#GUID-D28717E4-0F77-44F5-BB4E-234C31D4E4BA) + * [Disaster recovery](https://www.oracle.com/database/data-guard/) + * [Security](https://www.oracle.com/security/database-security/) + * [Oracle Machine Learning](https://www.oracle.com/artificial-intelligence/database-machine-learning/) + * [Oracle Graph Database](https://www.oracle.com/database/integrated-graph-database/) + * [Oracle Spatial and Graph](https://www.oracle.com/database/spatial/) + * [Oracle Blockchain](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_blockchain_table.html#GUID-B469E277-978E-4378-A8C1-26D3FF96C9A6) + * [JSON](https://docs.oracle.com/en/database/oracle/oracle-database/23/adjsn/json-in-oracle-database.html) + + +## Document Loaders + +Please check the [usage example](/docs/integrations/document_loaders/file_loaders/oracleai). + +```typescript +import {OracleDocLoader} from "./oracleds.js"; + +const loader = new OracleDocLoader(conn, loader_params); +const docs = await loader.load(); +``` + +## Text Splitter + +Please check the [usage example](/docs/integrations/document_loaders/file_loaders/oracleai). + +```typescript +import {OracleTextSplitter} from "./oracleds.js"; + +const splitter = new OracleTextSplitter(conn, splitter_params); +let chunks = await splitter.splitText(doc.pageContent); +``` + +## Embeddings + +Please check the [usage example](/docs/integrations/text_embedding/oracleai). + +```typescript +import {OracleEmbeddings} from "./oracleds.js"; + +const embedder = new OracleEmbeddings(conn, embedder_params, proxy); +const embed = await embedder.embedQuery(chunk); +``` + +## Summary + +Please check the [usage example](/docs/integrations/tools/oracleai). + +```typescript +import {OracleSummary} from "./oracleds.js"; + +const model = new OracleSummary(conn, summary_params, proxy); +const summary = await model.getSummary(doc.pageContent); +``` + +## Vector Store + +Please check the [usage example](/docs/integrations/vectorstores/oracle). + +```typescript +``` + +## End to End Demo + +Please check the [Oracle AI Vector Search End-to-End Demo Guide](https://github.com/langchain-ai/langchainjs/tree/main/cookbook/oracleai.mdx). \ No newline at end of file diff --git a/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx b/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx new file mode 100644 index 000000000000..70b8409325cf --- /dev/null +++ b/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx @@ -0,0 +1,52 @@ +# Oracle AI Vector Search: Generate Embeddings + +## Generate Embeddings + +Oracle AI Vector Search provides multiple methods for generating embeddings, utilizing either locally hosted ONNX models or third-party APIs. For comprehensive instructions on configuring these alternatives, please refer to the [Oracle AI Vector Search Guide](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_vector_chain1.html#GUID-C6439E94-4E86-4ECD-954E-4B73D53579DE). + +***Note***: Users may need to configure a proxy to utilize third-party embedding generation providers, excluding the 'database' provider that utilizes an ONNX model. + +The following sample code will show how to generate embeddings: + +```typescript +import {OracleEmbeddings} from "./oracleds.js"; + +// proxy to be used when we instantiate summary and embedder object +const proxy = ""; + +/* +// using ocigenai +const embedder_params = { + "provider": "ocigenai", + "credential_name": "OCI_CRED", + "url": "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/embedText", + "model": "cohere.embed-english-light-v3.0", +}; + +// using huggingface +const embedder_params = { + "provider": "huggingface", + "credential_name": "HF_CRED", + "url": "https://api-inference.huggingface.co/pipeline/feature-extraction/", + "model": "sentence-transformers/all-MiniLM-L6-v2" +}; +*/ + +// using ONNX model loaded to Oracle Database +const embedder_params = { + "provider": "database", + "model": "demo_model" +}; + +// get the embedding instance +// Remove proxy if not required +const embedder = new OracleEmbeddings(conn, embedder_params, proxy); +const embed = await embedder.embedQuery(chunk); + +// verify +console.log(`Embedding generated by OracleEmbeddings: ${embed}`); +``` + +## End to End Demo + +Please refer to our complete demo guide [Oracle AI Vector Search End-to-End Demo Guide](https://github.com/langchain-ai/langchainjs/tree/main/cookbook/oracleai.mdx) to build an end to end RAG pipeline with the help of Oracle AI Vector Search. diff --git a/docs/core_docs/docs/integrations/tools/oracleai.mdx b/docs/core_docs/docs/integrations/tools/oracleai.mdx new file mode 100644 index 000000000000..b330f9304d15 --- /dev/null +++ b/docs/core_docs/docs/integrations/tools/oracleai.mdx @@ -0,0 +1,60 @@ +# Oracle AI Vector Search: Generate Summary + +## Generate Summary + +The Oracle AI Vector Search Langchain library offers a suite of APIs designed for document summarization. It supports multiple summarization providers such as Database, OCIGENAI, HuggingFace, among others, allowing users to select the provider that best meets their needs. To utilize these capabilities, users must configure the summary parameters as specified. For detailed information on these parameters, please consult the [Oracle AI Vector Search Guide book](https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/dbms_vector_chain1.html#GUID-EC9DDB58-6A15-4B36-BA66-ECBA20D2CE57). + +Note: The users may need to set proxy if they want to use some 3rd party summary generation providers other than Oracle's in-house and default provider: 'database'. If you don't have proxy, please remove the proxy parameter when you instantiate the OracleSummary. + +The following sample code will show how to generate summary: + +```typescript +import {OracleSummary} from "./oracleds.js"; + +// proxy to be used when we instantiate summary and embedder object +const proxy = ""; + +/* +// using 'ocigenai' provider +const summary_params = { + "provider": "ocigenai", + "credential_name": "OCI_CRED", + "url": "https://inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/summarizeText", + "model": "cohere.command", +}; + +// using 'huggingface' provider +const summary_params = { + "provider": "huggingface", + "credential_name": "HF_CRED", + "url": "https://api-inference.huggingface.co/models/", + "model": "facebook/bart-large-cnn", + "wait_for_model": "true" +}; +*/ + +// using 'database' provider +const summary_params = { + "provider": "database", + "glevel": "S", + "numParagraphs": 1, + "language": "english", +}; + +// get the summary instance +// Remove proxy if not required +const model = new OracleSummary(conn, summary_params, proxy); +const summary = await model.getSummary( + "In the heart of the forest, " + + "a lone fox ventured out at dusk, seeking a lost treasure. " + + "With each step, memories flooded back, guiding its path. " + + "As the moon rose high, illuminating the night, the fox unearthed " + + "not gold, but a forgotten friendship, worth more than any riches."); + +// verify +console.log(`Summary generated by OracleSummary: ${summary}`); +``` + +## End to End Demo + +Please refer to our complete demo guide [Oracle AI Vector Search End-to-End Demo Guide](https://github.com/langchain-ai/langchainjs/tree/main/cookbook/oracleai.mdx) to build an end to end RAG pipeline with the help of Oracle AI Vector Search. From c6485185aac23c557b19346825a02f3e13374218 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Thu, 19 Sep 2024 18:12:41 -0400 Subject: [PATCH 04/33] Update dependencies --- libs/langchain-community/package.json | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libs/langchain-community/package.json b/libs/langchain-community/package.json index 133833f95785..6553919abc97 100644 --- a/libs/langchain-community/package.json +++ b/libs/langchain-community/package.json @@ -219,7 +219,12 @@ "weaviate-ts-client": "^1.4.0", "web-auth-library": "^1.0.3", "youtube-transcript": "^1.0.6", - "youtubei.js": "^9.1.0" + "youtubei.js": "^9.1.0", + "@types/oracledb": "^6.4.0", + "htmlparser2": "^9.1.0", + "oracledb": "^6.4.0", + "uuid": "^9.0.1", + "winston": "^3.13.0" }, "peerDependencies": { "@aws-crypto/sha256-js": "^5.0.0", From 00abea4682f2fd5cc619a0c499a83dd033c961b8 Mon Sep 17 00:00:00 2001 From: skmishraoracle Date: Sun, 22 Sep 2024 00:55:17 -0700 Subject: [PATCH 05/33] change metadata column type to JSON & add support for connection pool --- .../src/vectorstores/oraclevs.ts | 441 ++++++++++++------ 1 file changed, 290 insertions(+), 151 deletions(-) diff --git a/libs/langchain-community/src/vectorstores/oraclevs.ts b/libs/langchain-community/src/vectorstores/oraclevs.ts index 2d11066530ce..95e9246f02e4 100644 --- a/libs/langchain-community/src/vectorstores/oraclevs.ts +++ b/libs/langchain-community/src/vectorstores/oraclevs.ts @@ -1,11 +1,14 @@ import * as oracledb from "oracledb"; +// oracledb.fetchAsString = [oracledb.CLOB]; +import { createHash } from "crypto"; import { v4 as uuidv4 } from 'uuid'; -import {MaxMarginalRelevanceSearchOptions, VectorStore,} from "@langchain/core/vectorstores"; -import {Document, DocumentInterface} from "@langchain/core/documents"; -import {Embeddings} from "@langchain/core/embeddings"; -import {Callbacks} from "@langchain/core/callbacks/manager"; +import {MaxMarginalRelevanceSearchOptions, VectorStore,} from '@langchain/core/vectorstores'; +import {Document, DocumentInterface} from '@langchain/core/documents'; +import {Embeddings} from '@langchain/core/embeddings'; +import {Callbacks} from '@langchain/core/callbacks/manager'; import {createLogger, format, transports, Logform} from 'winston' -import { maximalMarginalRelevance } from "@langchain/core/utils/math"; +import { maximalMarginalRelevance } from '@langchain/core/utils/math'; + export enum DistanceStrategy { COSINE, @@ -16,6 +19,7 @@ export enum DistanceStrategy { EUCLIDEAN_SQUARED } + type AddDocumentOptions = Record; interface CustomLogInfo extends Logform.TransformableInfo { @@ -24,6 +28,7 @@ interface CustomLogInfo extends Logform.TransformableInfo { timestamp?: string; } + // eslint-disable-next-line no-process-env const logLevel = process.env.LOG_LEVEL?.toLowerCase() || 'error'; @@ -42,6 +47,7 @@ const logger = createLogger({ ] }); + function handleError(error: unknown): never { // Type guard to check if the error is an object and has 'name' and 'message' properties if (typeof error === "object" && error !== null && "name" in error && "message" in error) { @@ -72,7 +78,19 @@ function handleError(error: unknown): never { } } -async function tableExists(connection: oracledb.Connection, tableName: string): Promise { + +// Type guard to check if the client is an oracledb.Pool +function isConnectionOrPool( + client: oracledb.Connection | oracledb.Pool +): client is oracledb.Pool { + return (client as oracledb.Pool).getConnection !== undefined; +} + + +async function tableExists( + connection: oracledb.Connection, + tableName: string +): Promise { try { await connection.execute(`SELECT COUNT(*) FROM ${tableName}`); return true; // If query executes successfully, table exists @@ -87,12 +105,20 @@ async function tableExists(connection: oracledb.Connection, tableName: string): } } -async function indexExists(connection: oracledb.Connection, indexName: string): Promise { + +async function indexExists( + connection: oracledb.Connection, + indexName: string +): Promise { try { const query = `SELECT index_name FROM all_indexes WHERE upper(index_name) = upper(:idx_name)`; - const result = await connection.execute(query, {idx_name: indexName.toUpperCase()}, {outFormat: oracledb.OUT_FORMAT_OBJECT}); + const result = await connection.execute( + query, + {idx_name: indexName.toUpperCase()}, + {outFormat: oracledb.OUT_FORMAT_OBJECT} + ); // Check if `rows` is defined and has at least one entry return !!(result.rows && result.rows.length > 0); @@ -101,6 +127,7 @@ async function indexExists(connection: oracledb.Connection, indexName: string): } } + function getDistanceFunction(distanceStrategy: DistanceStrategy): string { const distanceStrategy2Function: { [key in DistanceStrategy]?: string } = { [DistanceStrategy.COSINE]: 'COSINE', @@ -119,7 +146,11 @@ function getDistanceFunction(distanceStrategy: DistanceStrategy): string { return result; } -async function getEmbeddingDimension(embeddings: Embeddings, query: string): Promise { + +async function getEmbeddingDimension( + embeddings: Embeddings, + query: string +): Promise { if (embeddings instanceof Embeddings) { // Assuming embedQuery returns a Promise that resolves to an array const embeddingVector = await embeddings.embedQuery(query); @@ -130,12 +161,17 @@ async function getEmbeddingDimension(embeddings: Embeddings, query: string): Pro throw new Error('Input is not an instance of Embeddings'); } -export async function createTable(connection: oracledb.Connection, tableName: string, embeddingDim: number): Promise { + +export async function createTable( + connection: oracledb.Connection, + tableName: string, + embeddingDim: number +): Promise { const colsDict = { id: 'RAW(16) DEFAULT SYS_GUID() PRIMARY KEY', + embedding: `vector(${embeddingDim}, FLOAT32)`, text: 'CLOB', - metadata: 'CLOB', - embedding: `vector(${embeddingDim}, FLOAT32)` + metadata: 'JSON', }; try { @@ -156,14 +192,18 @@ export async function createTable(connection: oracledb.Connection, tableName: st } } + function getIndexName(baseName: string): string { const uniqueId = uuidv4().replace(/-/g, ''); return `${baseName}_${uniqueId}`; } -export async function createIndex(client: oracledb.Connection, - vectorStore: OracleVS, - params?: { [key: string]: any }) : Promise { + +export async function createIndex( + client: oracledb.Connection, + vectorStore: OracleVS, + params?: { [key: string]: any } +) : Promise { if (params) { switch (params.idxType) { case 'HNSW': @@ -180,27 +220,32 @@ export async function createIndex(client: oracledb.Connection, } } -async function createHNSWIndex( connection: oracledb.Connection, oraclevs: OracleVS, + +async function createHNSWIndex( + connection: oracledb.Connection, + oraclevs: OracleVS, params?: { [key: string]: any } ): Promise { try { - const defaults : { [key: string]: any } = { - idx_name: "HNSW", - idx_type: "HNSW", + const defaults: { [key: string]: any } = { + idxName: "HNSW", + idxType: "HNSW", neighbors: 32, efConstruction: 200, accuracy: 90, - parallel: 8 + parallel: 8, }; // if params then copy params to config - let config: { [key: string]: any } = params ? {...params} : {...defaults}; + let config: { [key: string]: any } = params + ? { ...params } + : { ...defaults }; // Ensure compulsory parts are included - const compulsoryKeys = ["idx_name", "parallel"]; - compulsoryKeys.forEach(key => { + const compulsoryKeys = ["idxName", "parallel"]; + compulsoryKeys.forEach((key) => { if (!(key in config)) { - if (key === "idx_name") { + if (key === "idxName") { config[key] = getIndexName(defaults[key] as string); } else { config[key] = defaults[key] as number; @@ -209,33 +254,46 @@ async function createHNSWIndex( connection: oracledb.Connection, oraclevs: Oracl }); // Validate keys in config against defaults - Object.keys(config).forEach(key => { + Object.keys(config).forEach((key) => { if (!(key in defaults)) { throw new Error(`Invalid parameter: ${key}`); } }); - const idxName = config['idx_name']; - const baseSql = `CREATE VECTOR INDEX ${idxName} ON ${oraclevs.tableName}(embedding) ORGANIZATION INMEMORY NEIGHBOR GRAPH`; - const accuracyPart = config.accuracy ? ` WITH TARGET ACCURACY ${config.accuracy}` : ""; - const distancePart = ` DISTANCE ${getDistanceFunction(oraclevs.distanceStrategy)}`; + const idxName = config["idxName"]; + const baseSql = `CREATE VECTOR INDEX ${idxName} + ON ${oraclevs.tableName}(embedding) + ORGANIZATION INMEMORY NEIGHBOR GRAPH`; + const accuracyPart = config.accuracy + ? ` WITH TARGET ACCURACY ${config.accuracy}` + : ""; + const distancePart = ` DISTANCE ${getDistanceFunction( + oraclevs.distanceStrategy + )}`; let parametersPart = ""; if ("neighbors" in config && "efConstruction" in config) { - parametersPart = ` parameters (type ${config.idx_type}, neighbors ${config.neighbors}, efConstruction ${config.efConstruction})`; + parametersPart = ` parameters (type ${config.idxType}, + neighbors ${config.neighbors}, + efConstruction ${config.efConstruction})`; } else if ("neighbors" in config && !("efConstruction" in config)) { config.efConstruction = defaults.efConstruction; - parametersPart = ` parameters (type ${config.idx_type}, neighbors ${config.neighbors}, efConstruction ${config.efConstruction})`; + parametersPart = ` parameters (type ${config.idxType}, + neighbors ${config.neighbors}, + efConstruction ${config.efConstruction})`; } else if (!("neighbors" in config) && "efConstruction" in config) { config.neighbors = defaults.neighbors; - parametersPart = ` parameters (type ${config.idx_type}, neighbors ${config.neighbors}, efConstruction ${config.efConstruction})`; + parametersPart = ` parameters (type ${config.idxType}, + neighbors ${config.neighbors}, + efConstruction ${config.efConstruction})`; } const parallelPart = ` PARALLEL ${config.parallel}`; - const ddl = baseSql + accuracyPart + distancePart + parametersPart + parallelPart; + const ddl = + baseSql + accuracyPart + distancePart + parametersPart + parallelPart; - const idxExists = await indexExists(connection, config['idx_name']); + const idxExists = await indexExists(connection, config["idxName"]); if (!idxExists) { await connection.execute(ddl); console.log("Index created successfully..."); @@ -247,60 +305,72 @@ async function createHNSWIndex( connection: oracledb.Connection, oraclevs: Oracl } } -async function createIVFIndex( connection: oracledb.Connection, oraclevs: OracleVS, - params?: { [key: string]: any } +async function createIVFIndex( + connection: oracledb.Connection, + oraclevs: OracleVS, + params?: { [key: string]: any } ): Promise { try { - const defaults : { [key: string]: any } = { - idx_name: "IVF", - idx_type: "IVF", - neighbor_part: 32, + const defaults: { [key: string]: any } = { + idxName: "IVF", + idxType: "IVF", + neighborPart: 32, accuracy: 90, - parallel: 8 + parallel: 8, }; // Combine defaults with any provided params. Note: params could contain keys not explicitly declared in IndexConfig - let config : { [key: string]: any } = params ? {...params} : {...defaults}; + let config: { [key: string]: any } = params + ? { ...params } + : { ...defaults }; // Ensure compulsory parts are included - const compulsoryKeys = ["idx_name", "parallel"]; - compulsoryKeys.forEach(key => { + const compulsoryKeys = ["idxName", "parallel"]; + compulsoryKeys.forEach((key) => { if (!(key in config)) { - if (key === "idx_name") { + if (key === "idxName") { config[key] = getIndexName(defaults[key] as string); } else { - config[key] = defaults[key] as any; + config[key] = defaults[key] as number; } } }); // Validate keys in config against defaults - Object.keys(config).forEach(key => { + Object.keys(config).forEach((key) => { if (!(key in defaults)) { throw new Error(`Invalid parameter: ${key}`); } }); // Base SQL statement - const idxName = config.idx_name; // Directly accessing since idx_name must exist as ensured by ensureCompulsoryFields - const baseSql = `CREATE VECTOR INDEX ${idxName} ON ${oraclevs.tableName}(embedding) ORGANIZATION NEIGHBOR PARTITIONS`; + const idxName = config.idxName; + const baseSql = `CREATE VECTOR INDEX ${idxName} + ON ${oraclevs.tableName}(embedding) + ORGANIZATION NEIGHBOR PARTITIONS`; // Optional parts depending on parameters - const accuracyPart = config.accuracy ? ` WITH TARGET ACCURACY ${config.accuracy}` : ""; - const distancePart = ` DISTANCE ${getDistanceFunction(oraclevs.distanceStrategy)}`; + const accuracyPart = config.accuracy + ? ` WITH TARGET ACCURACY ${config.accuracy}` + : ""; + const distancePart = ` DISTANCE ${getDistanceFunction( + oraclevs.distanceStrategy + )}`; let parametersPart = ""; - if ("idx_type" in config && "neighbor_part" in config) { - parametersPart = ` PARAMETERS (type ${config.idx_type}, neighbor partitions ${config.neighbor_part})`; + if ("idxType" in config && "neighborPart" in config) { + parametersPart = ` PARAMETERS (type ${config.idxType}, + neighbor partitions ${config.neighborPart})`; } // Always included part for parallel - assuming parallel is compulsory and always included const parallelPart = ` PARALLEL ${config.parallel}`; // Combine all parts - const ddl = baseSql + accuracyPart + distancePart + parametersPart + parallelPart; + const ddl = + baseSql + accuracyPart + distancePart + parametersPart + parallelPart; - const idxExists = await indexExists(connection, config['idx_name']); + const idxExists = await indexExists(connection, config["idxName"]); if (!idxExists) { await connection.execute(ddl); console.log("Index created successfully..."); @@ -311,7 +381,12 @@ async function createIVFIndex( connection: oracledb.Connection, oraclevs: Oracle handleError(error); } } -export async function dropTablePurge(connection: oracledb.Connection, tableName: string): Promise { + + +export async function dropTablePurge( + connection: oracledb.Connection, + tableName: string +): Promise { try { const exists = await tableExists(connection, tableName); if (exists) { @@ -326,7 +401,11 @@ export async function dropTablePurge(connection: oracledb.Connection, tableName: } } -export async function dropIndexIfExists(connection: oracledb.Connection, indexName: string): Promise { + +export async function dropIndexIfExists( + connection: oracledb.Connection, + indexName: string +): Promise { try { const exists = await indexExists(connection, indexName); if (exists) { @@ -342,8 +421,7 @@ export async function dropIndexIfExists(connection: oracledb.Connection, indexNa } export class OracleVS extends VectorStore { - - readonly client: oracledb.Pool; + readonly client: oracledb.Pool | oracledb.Connection; readonly embeddings: Embeddings; embeddingDimension: number | undefined; readonly tableName: string; @@ -361,43 +439,61 @@ export class OracleVS extends VectorStore { this.tableName = dbConfig.tableName; this.distanceStrategy = dbConfig.distanceStrategy; this.query = dbConfig.query; - - // Check if embeddings is an instance of Embeddings - if (!(dbConfig.embeddings instanceof Embeddings)) { - console.warn( - "`embeddings is expected to be an Embeddings object, support " - + "for passing in a function will soon be removed." ); - } - this.embeddings = dbConfig.embeddings; + this.embeddings = embeddings; } catch (error: unknown) { handleError(error); } } + async initialize(): Promise { let connection: oracledb.Connection | null = null; try { this.embeddingDimension = await getEmbeddingDimension(this.embeddings, this.query); - connection = await this.client.getConnection() + connection = await this.getConnection() await createTable(connection, this.tableName, this.embeddingDimension); } catch (error: unknown) { handleError(error); } finally { if(connection) - await connection.close() + await this.retConnection(connection) } } + public async getConnection(): Promise { try { - return await this.client.getConnection() + if (isConnectionOrPool(this.client)) { + return await (this.client as oracledb.Pool).getConnection(); + } else { + return this.client as oracledb.Connection; // Cast to Connection and return + } } catch (error: unknown) { handleError(error); } + } + + + // Close connection or return it to the pool + public async retConnection(connection: oracledb.Connection): Promise { + try { + // If the client is a pool, close the connection (return it to the pool) + if (isConnectionOrPool(this.client)) { + console.log("Returning connection to the pool."); + await connection.close(); + } else { + // If it's a connection, do nothing + console.log("Client is an individual connection. No action taken."); + } + } catch (error) { + console.error("Error in retConnection:", error); + throw error; + } } + /** * Method to add vectors to the Oracle database. * @param vectors The vectors to add. @@ -428,32 +524,58 @@ export class OracleVS extends VectorStore { }); } - const binds = documents.map((doc, index) => ({ - id: { val: doc.metadata.id }, - text: { val: doc.pageContent }, // Assuming 'text' should come from 'pageContent' - metadata: { val: JSON.stringify(doc.metadata) }, // Assuming you want to store metadata as a string - embedding: { val: vectors[index] } // Make sure vectors align with documents by index - })); - - connection = await this.client.getConnection(); - - await connection.executeMany( - `INSERT INTO ${this.tableName} (id, text, metadata, embedding) - VALUES (:id, :text, :metadata, :embedding)`, binds - ); - + connection = await this.getConnection(); + + documents.forEach((doc, index) => { + const sourceId = doc.metadata.id ?? uuidv4(); + const processedId = createHash("sha256") + .update(sourceId) + .digest("hex") + .substring(0, 16) + .toUpperCase(); + const idBuffer = Buffer.from(processedId, "hex"); + const lobSz = 64 * 1024; + const bind = { + id: idBuffer, + text: { + val: doc.pageContent.toString(), + type: oracledb.STRING, + maxSize: lobSz, + }, + metadata: { + val: JSON.stringify(doc.metadata), + type: oracledb.DB_TYPE_JSON, + }, + embedding: { val: new Float32Array(vectors[index]) }, + }; + + const sql = `INSERT INTO ${this.tableName} (id, text, metadata, embedding) + VALUES (:id, :text, :metadata, :embedding)`; + + // @ts-ignore + connection + .execute(sql, bind) + .then(() => console.log("Inserted document with ID:", processedId)) + .catch((err) => + console.error("Error inserting document ID:", processedId, err) + ); + }); + + // Commit once all inserts are queued up await connection.commit(); + console.log("All documents have been inserted and committed."); return ids; - } catch (error: unknown) { + } catch (error: any) { handleError(error); } finally { if (connection) { - await connection.close(); + await this.retConnection(connection); } } } + public async addDocuments( documents: DocumentInterface[], options?: AddDocumentOptions @@ -464,6 +586,7 @@ export class OracleVS extends VectorStore { await this.embeddings.embedDocuments(texts), documents, options ); } + /** * Method to search for vectors that are similar to a given query vector. * @param query The query vector. @@ -478,15 +601,8 @@ export class OracleVS extends VectorStore { ): Promise<[Document, number, Float32Array | number[]][]> { const docsScoresAndEmbeddings : Array<[Document, number, Float32Array | number[]]> = []; - interface QueryResultRow { - id: string; // Assuming 'id' is a string, adjust the type as necessary - text: string; - metadata: string; // JSON string - distance: number; // Assuming distance is a number - embedding: Float32Array | number[]; // Based on how embedding is stored and returned - } - let connection: oracledb.Connection | null = null; + try { const convertedEmbedding = new Float32Array(query); @@ -494,42 +610,47 @@ export class OracleVS extends VectorStore { SELECT id, text, metadata, - vector_distance(embedding, $1, ${getDistanceFunction(this.distanceStrategy)}) as distance, + vector_distance(embedding, :embedding, ${getDistanceFunction( + this.distanceStrategy + )}) as distance, embedding FROM ${this.tableName} - ORDER BY vector_distance(embedding, $1, ${getDistanceFunction(this.distanceStrategy)}) - FETCH APPROX FIRST $2 ROWS ONLY `; + ORDER BY distance + FETCH APPROX FIRST ${k} ROWS ONLY `; // Execute the query - connection = await this.client.getConnection() - const resultSet = await connection.execute(sqlQuery, [convertedEmbedding, k]); + connection = await this.getConnection() + // @ts-ignore + const resultSet = await connection.execute(sqlQuery, [ + convertedEmbedding, + ]); if (resultSet.rows && resultSet.rows.length > 0) { // Assert the type of results.rows for TypeScript - const results: QueryResultRow[] = resultSet.rows as QueryResultRow[]; // Filter results if filter is provided - for (const result of results) { - const metadata = JSON.parse(result.metadata || '{}'); - - if (filter && Object.entries(filter).every(([key, value]) => metadata[key] === value)) { + for (let idx = 0; idx < resultSet.rows.length; idx++) { + // @ts-ignore + const text = resultSet.rows[idx][1]; + // @ts-ignore + // const metadata = JSON.parse(resultSet.rows[idx][2]) || "{}"; + const metadata = resultSet.rows[idx][2]; + // @ts-ignore + const distance = resultSet.rows[idx][3]; + // @ts-ignore + const embedding = resultSet.rows[idx][4]; + if ( filter && Object.entries(filter).every( + ([key, value]) => metadata[key] === value ) + ) { const document = new Document({ - pageContent: result.text || '', - metadata: metadata, + pageContent: text || "", + metadata: metadata || "", }); - // @ts-ignore - const distance = result.distance; - // @ts-ignore - const embedding = result.embedding; docsScoresAndEmbeddings.push([document, distance, embedding]); } else if (!filter) { const document = new Document({ - pageContent: result.text || '', - metadata: metadata, + pageContent: text || "", + metadata: metadata || {}, }); - // @ts-ignore - const distance = result.distance; - // @ts-ignore - const embedding = result.embedding; docsScoresAndEmbeddings.push([document, distance, embedding]); } } @@ -539,19 +660,21 @@ export class OracleVS extends VectorStore { } return docsScoresAndEmbeddings; } finally { - if (connection) - await connection.close() + if (connection) await connection.close(); } } - public async similaritySearchVectorWithScore(query: number[], - k: number, - filter?: this["FilterType"]): - Promise<[DocumentInterface, number][]> { + + public async similaritySearchVectorWithScore( + query: number[], + k: number, + filter?: this["FilterType"] + ): Promise<[DocumentInterface, number][]> { const docsScoresAndEmbeddings = await this.similaritySearchByVectorReturningEmbeddings( query, k, filter) return docsScoresAndEmbeddings.map(([document, score]) => [document, score]); } + /** * Return documents selected using the maximal marginal relevance. * Maximal marginal relevance optimizes for similarity to the query AND diversity @@ -580,6 +703,7 @@ export class OracleVS extends VectorStore { return await this.maxMarginalRelevanceSearchByVector(embedding, options, _callbacks); } + public async maxMarginalRelevanceSearchByVector( embedding: number[], options: MaxMarginalRelevanceSearchOptions | undefined, @@ -595,6 +719,7 @@ export class OracleVS extends VectorStore { return docsAndScores.map(ds => ds.document); } + public async maxMarginalRelevanceSearchWithScoreByVector( embedding: number[], options: MaxMarginalRelevanceSearchOptions, @@ -605,17 +730,25 @@ export class OracleVS extends VectorStore { } // Fetch documents and their scores. - const docsScoresEmbeddings = await this.similaritySearchByVectorReturningEmbeddings(embedding, options.fetchK, options.filter); + const docsScoresEmbeddings = + await this.similaritySearchByVectorReturningEmbeddings( + embedding, + options.fetchK, + options.filter + ); if (!docsScoresEmbeddings.length) { return []; } // Split documents, scores, and embeddings - const documents: Document[] = docsScoresEmbeddings.map(([document]) => document); + const documents: Document[] = docsScoresEmbeddings.map( + ([document]) => document + ); const scores: number[] = docsScoresEmbeddings.map(([, score]) => score); - const embeddings: (Float32Array | number[])[] = docsScoresEmbeddings.map(([,, embedding])=> new Float32Array( - embedding)); + const embeddings: (Float32Array | number[])[] = docsScoresEmbeddings.map( + ([,, embedding])=> new Float32Array( embedding) + ); // Convert all embeddings to Float32Array for consistency const consistentEmbeddings: number[][] = embeddings.map(embedding => Array.from(embedding)); @@ -623,59 +756,66 @@ export class OracleVS extends VectorStore { // Ensure lambdaMult has a default value if not provided const lambdaMult = 0.5; - const mmrSelectedIndices: number[] = maximalMarginalRelevance(queryEmbedding, + const mmrSelectedIndices: number[] = maximalMarginalRelevance( + queryEmbedding, consistentEmbeddings, lambdaMult, - options.k); + options.k + ); // Filter documents based on MMR-selected indices and map scores - return mmrSelectedIndices.map(index => ({ + return mmrSelectedIndices.map( (index) => ({ document: documents[index], - score: scores[index] + score: scores[index], })); } - public async delete(params: { ids?: string[], deleteAll?: boolean }): Promise { + + public async delete( + params: { ids?: string[], + deleteAll?: boolean } + ): Promise { let connection: oracledb.Connection | null = null; try { - connection = await this.client.getConnection() + connection = await this.getConnection() if (params.ids && params.ids.length > 0) { // Dynamically create placeholders - const placeholders = params.ids.map((_, index) => `:${index + 1}`).join(','); + const placeholders = params.ids + .map((_, index) => `:${index + 1}`) + .join(","); // Prepare the query const query = `DELETE FROM ${this.tableName} WHERE id IN (${placeholders})`; // Execute the query with the IDs as bind parameters await connection.execute(query, [...params.ids]); await connection.commit(); } else if (params.deleteAll) { - await connection.execute(`TRUNCATE TABLE ${this.tableName}`) + await connection.execute(`TRUNCATE TABLE ${this.tableName}`); } } catch (error: unknown) { handleError(error); } finally { - if (connection) - await connection.close() + if (connection) await connection.close(); } - } - static async fromDocuments(documents: DocumentInterface>[], - embeddings: Embeddings, - dbConfig: Record): Promise { + + static async fromDocuments( + documents: DocumentInterface>[], + embeddings: Embeddings, + dbConfig: Record + ): Promise { let connection: oracledb.Connection | null = null; const client = dbConfig.client - if (!client) { + if (!client) throw new Error('client parameter is required...'); - } try { - connection = await client.getConnection() - if (connection) - await dropTablePurge(connection, dbConfig.tableName); - else - throw new Error(`Invalid connection pool, pass a valid pool `); - const vss = new OracleVS(embeddings, dbConfig); + connection = await vss.getConnection() + await dropTablePurge(connection, dbConfig.tableName); + if (connection) + await vss.retConnection(connection) + await vss.initialize(); // Use Promise.all to wait for all embedQuery promises to resolve const vectors = await Promise.all(documents.map(document => @@ -686,9 +826,8 @@ export class OracleVS extends VectorStore { await vss.addVectors(vectors, documents); return vss; - } finally { - if (connection) - await connection.close() + } catch (error: unknown) { + handleError(error); } } } From 2f2f6b3656572a28c994eb94fdbc1f032aae78aa Mon Sep 17 00:00:00 2001 From: skmishraoracle Date: Mon, 23 Sep 2024 13:15:37 -0700 Subject: [PATCH 06/33] documentation in cookbook - oraclevs.md --- cookbook/oraclevs.md | 273 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 cookbook/oraclevs.md diff --git a/cookbook/oraclevs.md b/cookbook/oraclevs.md new file mode 100644 index 000000000000..7308c04f25fd --- /dev/null +++ b/cookbook/oraclevs.md @@ -0,0 +1,273 @@ +Oracle AI Vector Search with LangchainJS Integration +Introduction +Oracle AI Vector Search enables semantic search on unstructured data while simultaneously providing relational search capabilities on business data, all within a unified system. This approach eliminates the need for a separate vector database, reducing data fragmentation and improving efficiency. + +By integrating Oracle AI Vector Search with Langchain, you can build a powerful pipeline for Retrieval Augmented Generation (RAG), leveraging Oracle's robust database features. + +Key Advantages of Oracle Database +Oracle AI Vector Search is built on top of the Oracle Database, providing several key features: + +Partitioning Support +Real Application Clusters (RAC) Scalability +Exadata Smart Scans +Geographically Distributed Shard Processing +Transactional Capabilities +Parallel SQL +Disaster Recovery +Advanced Security +Oracle Machine Learning +Oracle Graph Database +Oracle Spatial and Graph +Oracle Blockchain +JSON Support +Guide Overview +This guide demonstrates how to integrate Oracle AI Vector Search with Langchain to create an end-to-end RAG pipeline. You'll learn how to: + +Load documents from different sources using OracleDocLoader. +Summarize documents inside or outside the database using OracleSummary. +Generate embeddings either inside or outside the database using OracleEmbeddings. +Chunk documents based on specific needs using OracleTextSplitter. +Store, index, and query data using OracleVS. +Getting Started +If you're new to Oracle Database, consider using the free Oracle 23 AI Database to get started. + +Best Practices +User Management: Create dedicated users for your Oracle Database projects instead of using the system user for security and control purposes. See the end-to-end guide for more details. +User Privileges: Be sure to manage user privileges effectively to maintain database security. You can find more information in the official Oracle documentation. +Prerequisites +To get started, install the Oracle JavaScript client driver: + +``` typescript +npm install oracledb +``` + +Document Preparation +Assuming you have documents stored in a file system that you want to use with Oracle AI Vector Search and Langchain, these documents need to be instances of langchain/core/documents. + +Example: Ingesting JSON Documents +In the following TypeScript example, we demonstrate how to ingest documents from JSON files: + +```typescript +private createDocument(row: DataRow): Document { + const metadata = { + id: row.id, + link: row.link, + }; + return new Document({ pageContent: row.text, metadata: metadata }); +} + +public async ingestJson(): Promise { + try { + const filePath = `${this.docsDir}${this.filename}`; + const fileContent = await fs.readFile(filePath, {encoding: 'utf8'}); + const jsonData: DataRow[] = JSON.parse(fileContent); + return jsonData.map((row) => this.createDocument(row)); + } catch (error) { + console.error('An error occurred while ingesting JSON:', error); + throw error; // Rethrow for the calling function to handle + } +} +``` + +Langchain and Oracle Integration +The Oracle AI Vector Search Langchain library offers a rich set of APIs for document processing, which includes loading, chunking, summarizing, and embedding generation. Here's how to set up a connection and integrate Oracle with Langchain. + +Connecting to Oracle Database +Below is an example of how to connect to an Oracle Database using both a direct connection and a connection pool: + +```typescript +async function dbConnect(): Promise { + const connection = await oracledb.getConnection({ + user: '****', + password: '****', + connectString: '***.**.***.**:1521/****' + }); + console.log('Connection created...'); + return connection; +} + +async function dbPool(): Promise { + const pool = await oracledb.createPool({ + user: '****', + password: '****', + connectString: '***.**.***.**:1521/****' + }); + console.log('Connection pool started...'); + return pool; +} +``` + +Testing the Integration +Here, we demonstrate how to create a test class TestsOracleVS to explore various features of Oracle Vector Store and its integration with Langchain. + +Example Test Class +Testing the Integration +Here, we demonstrate how to create a test class TestsOracleVS to explore various features of Oracle Vector Store and its integration with Langchain. + +Example Test Class + +``` typescript +class TestsOracleVS { + client: any | null = null; + embeddingFunction: HuggingFaceTransformersEmbeddings; + dbConfig: Record = {}; + oraclevs!: OracleVS; + + constructor(embeddingFunction: HuggingFaceTransformersEmbeddings) { + this.embeddingFunction = embeddingFunction; + } + + async init(): Promise { + this.client = await dbPool(); + this.dbConfig = { + "client": this.client, + "tableName": "some_tablenm", + "distanceStrategy": DistanceStrategy.DOT_PRODUCT, + "query": "What are the salient features of OracleDB?" + }; + this.oraclevs = new OracleVS(this.embeddingFunction, this.dbConfig); + } + + public async testCreateIndex(): Promise { + const connection: oracledb.Connection = await dbConnect(); + await createIndex(connection, this.oraclevs, { + idxName: "IVF", + idxType: "IVF", + neighborPart: 64, + accuracy: 90 + }); + console.log("Index created successfully"); + await connection.close(); + } + + // We are ready to test SimilaritySearchByVector - To this one passes an embedding which is a number array. a k value and a filter. This call returns documents ordered by distance. + public async testSimilaritySearchByVector( + embedding: number[], + k: number, + filter?: OracleVS["FilterType"], + ): Promise<[DocumentInterface, number][]> { + return this.oraclevs.similaritySearchVectorWithScore( + embedding, + k, + filter, + ); + } + + // This call does the same except that it returns Documents and embeddings. + public async testSimilaritySearchByVectorReturningEmbeddings( + embedding: number[], + k: number = 4, + filter?: OracleVS["FilterType"], + ): Promise<[Document, number, Float32Array | number[]][]> { + return await this.oraclevs.similaritySearchByVectorReturningEmbeddings( embedding, k, filter); + } + + // This call tests out the MaxMarginalRelevanceSearch the parameters are self explanatory. The Callback is reserved for future use. + public async testMaxMarginalRelevanceSearch( + query: string, + options?: MaxMarginalRelevanceSearchOptions, + _callbacks?: Callbacks + ): Promise { + if (!options) { + options = { k: 10, fetchK: 20 }; // Default values for the options + } + // @ts-ignore + return this.oraclevs.maxMarginalRelevanceSearch(query, options, _callbacks); + } + + // This call is the same as above except that it takes a vector instead of a query as an argument. + public async testMaxMarginalRelevanceSearchByVector( + query: number[], + options?: MaxMarginalRelevanceSearchOptions, + _callbacks?: Callbacks | undefined + ): Promise { + if (!options) { + options = { k: 10, fetchK: 20 }; // Default values for the options + } + return this.oraclevs!.maxMarginalRelevanceSearchByVector(query, options, _callbacks); + } + + // This too is the same as above except that it returns document and the score. + public async testMaxMarginalRelevanceSearchWithScoreByVector( + embedding: number[], + options?: MaxMarginalRelevanceSearchOptions, + _callbacks?: Callbacks | undefined + ): Promise> { + if (!options) { + options = { k: 10, fetchK: 20 }; // Default values for the options + } + return this.oraclevs.maxMarginalRelevanceSearchWithScoreByVector(embedding, options, _callbacks) + } + + // This call tests out the delete feature. + testDelete( params: { ids?: string[], deleteAll?: boolean } ): Promise { + return this.oraclevs.delete(params); + } +} + +// The runTestOracleVS is the driver to test out each of the calls. +async function runTestsOracleVS() { + // Initialize dotenv to load environment variables + dotenv.config(); + const query = "What is the language used by Oracle database"; + + // Set up the embedding function model: "Xenova/all-MiniLM-L6-v2" + const embeddingFunction = new HuggingFaceTransformersEmbeddings(); + if (!embeddingFunction) { + console.error("Failed to initialize the embedding function."); + return; + } + + if (!(embeddingFunction instanceof Embeddings)) { + console.error("Embedding function is not an instance of Embeddings."); + return; + } + + console.log("Embedding function initialized successfully"); + + // Initialize the TestsOracleVS class + const testsOracleVS = new TestsOracleVS("concepts23c_small.json", + embeddingFunction); + + // Initialize connection and other setup + await testsOracleVS.init(); + + // Ingest JSON data to create documents + const documents = await testsOracleVS.testIngestJson(); + await OracleVS.fromDocuments( + documents, + testsOracleVS.embeddingFunction, + testsOracleVS.dbConfig + ) + + // Create an index + await testsOracleVS.testCreateIndex(); + + // Assume some dummy embedding vector for demonstration + // const embedding: number[] = [0.1, 0.2, 0.3, 0.4]; // Example embedding + + // Perform a similarity search by vector + const embedding = await embeddingFunction.embedQuery(query); + const similaritySearchByVector = await testsOracleVS.testSimilaritySearchByVector(embedding, 5); + console.log("Similarity Search Results:", similaritySearchByVector); + + // Perform a similarity search by vector + const similaritySearchByEmbeddings = + await testsOracleVS.testSimilaritySearchByVectorReturningEmbeddings(embedding, 5) + console.log("Similarity Search Results:", similaritySearchByEmbeddings); + + const maxMarginalRelevanceSearch = + await testsOracleVS.testMaxMarginalRelevanceSearch(query) + console.log("Max Marginal Relevance Search:", maxMarginalRelevanceSearch); + + const maxMarginalRelevanceSearchByVector = + await testsOracleVS.testMaxMarginalRelevanceSearchByVector(embedding) + console.log("Max Marginal Relevance Search By Vector:", maxMarginalRelevanceSearchByVector); + + const maxMarginalRelevanceSearchWithScoreByVector = + await testsOracleVS.testMaxMarginalRelevanceSearchWithScoreByVector(embedding) + console.log("Max Marginal Relevance Search By Vector:", maxMarginalRelevanceSearchWithScoreByVector); + +} +``` +That is all for now. \ No newline at end of file From afc56fe393e75caa01f165e226903945d96c54d0 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Mon, 23 Sep 2024 20:40:25 -0400 Subject: [PATCH 07/33] Add entry points --- libs/langchain-community/langchain.config.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/langchain-community/langchain.config.js b/libs/langchain-community/langchain.config.js index 17edcc49ebf6..9a50237f70a4 100644 --- a/libs/langchain-community/langchain.config.js +++ b/libs/langchain-community/langchain.config.js @@ -80,6 +80,7 @@ export const config = { "embeddings/llama_cpp": "embeddings/llama_cpp", "embeddings/minimax": "embeddings/minimax", "embeddings/ollama": "embeddings/ollama", + "embeddings/oracleai": "embeddings/oracle", "embeddings/premai": "embeddings/premai", "embeddings/tensorflow": "embeddings/tensorflow", "embeddings/tencent_hunyuan": "embeddings/tencent_hunyuan/index", @@ -139,6 +140,7 @@ export const config = { "vectorstores/neo4j_vector": "vectorstores/neo4j_vector", "vectorstores/neon": "vectorstores/neon", "vectorstores/opensearch": "vectorstores/opensearch", + "vectorstores/oraclevs": "vectorstores/oraclevs", "vectorstores/pgvector": "vectorstores/pgvector", "vectorstores/pinecone": "vectorstores/pinecone", "vectorstores/prisma": "vectorstores/prisma", @@ -303,11 +305,13 @@ export const config = { "document_loaders/fs/unstructured": "document_loaders/fs/unstructured", "document_loaders/fs/openai_whisper_audio": "document_loaders/fs/openai_whisper_audio", + "document_loaders/fs/oracleai": "document_loaders/fs/oracle", "document_loaders/fs/pptx": "document_loaders/fs/pptx", // utils "utils/convex": "utils/convex", "utils/event_source_parse": "utils/event_source_parse", "utils/cassandra": "utils/cassandra", + "utils/oracleai": "utils/oracle", // experimental "experimental/callbacks/handlers/datadog": "experimental/callbacks/handlers/datadog", "experimental/graph_transformers/llm": From d649ca882923c7f9e4341813a141d2cba900246f Mon Sep 17 00:00:00 2001 From: David Jiang Date: Mon, 23 Sep 2024 20:41:04 -0400 Subject: [PATCH 08/33] Update import paths in doc --- .../document_loaders/file_loaders/oracleai.mdx | 4 ++-- .../core_docs/docs/integrations/platforms/oracleai.mdx | 10 +++++----- .../docs/integrations/text_embedding/oracleai.mdx | 2 +- docs/core_docs/docs/integrations/tools/oracleai.mdx | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx index 432d709e690a..e565349c3a47 100644 --- a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx +++ b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx @@ -9,7 +9,7 @@ A significant advantage of utilizing OracleDocLoader is its capability to proces Below is a sample code snippet that demonstrates how to use OracleDocLoader ```typescript -import {OracleDocLoader} from "./oracleds.js"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; /* // loading a local file @@ -43,7 +43,7 @@ The documents may vary in size, ranging from small to very large. Users often pr Below is a sample code illustrating how to implement this: ```typescript -import {OracleTextSplitter} from "./oracleds.js"; +import {OracleTextSplitter} from "@langchain/community/document_loaders/fs/oracleai"; /* // Some examples diff --git a/docs/core_docs/docs/integrations/platforms/oracleai.mdx b/docs/core_docs/docs/integrations/platforms/oracleai.mdx index 5d653a633264..a4baf50a43ca 100644 --- a/docs/core_docs/docs/integrations/platforms/oracleai.mdx +++ b/docs/core_docs/docs/integrations/platforms/oracleai.mdx @@ -26,7 +26,7 @@ In addition, your vectors can benefit from all of Oracle Database’s most power Please check the [usage example](/docs/integrations/document_loaders/file_loaders/oracleai). ```typescript -import {OracleDocLoader} from "./oracleds.js"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; const loader = new OracleDocLoader(conn, loader_params); const docs = await loader.load(); @@ -37,7 +37,7 @@ const docs = await loader.load(); Please check the [usage example](/docs/integrations/document_loaders/file_loaders/oracleai). ```typescript -import {OracleTextSplitter} from "./oracleds.js"; +import {OracleTextSplitter} from "@langchain/community/document_loaders/fs/oracleai"; const splitter = new OracleTextSplitter(conn, splitter_params); let chunks = await splitter.splitText(doc.pageContent); @@ -48,7 +48,7 @@ let chunks = await splitter.splitText(doc.pageContent); Please check the [usage example](/docs/integrations/text_embedding/oracleai). ```typescript -import {OracleEmbeddings} from "./oracleds.js"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; const embedder = new OracleEmbeddings(conn, embedder_params, proxy); const embed = await embedder.embedQuery(chunk); @@ -59,7 +59,7 @@ const embed = await embedder.embedQuery(chunk); Please check the [usage example](/docs/integrations/tools/oracleai). ```typescript -import {OracleSummary} from "./oracleds.js"; +import {OracleSummary} from "@langchain/community/utils/oracleai"; const model = new OracleSummary(conn, summary_params, proxy); const summary = await model.getSummary(doc.pageContent); @@ -74,4 +74,4 @@ Please check the [usage example](/docs/integrations/vectorstores/oracle). ## End to End Demo -Please check the [Oracle AI Vector Search End-to-End Demo Guide](https://github.com/langchain-ai/langchainjs/tree/main/cookbook/oracleai.mdx). \ No newline at end of file +Please check the [Oracle AI Vector Search End-to-End Demo Guide](https://github.com/langchain-ai/langchainjs/tree/main/cookbook/oracleai.mdx). diff --git a/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx b/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx index 70b8409325cf..367e17a8c54b 100644 --- a/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx +++ b/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx @@ -9,7 +9,7 @@ Oracle AI Vector Search provides multiple methods for generating embeddings, uti The following sample code will show how to generate embeddings: ```typescript -import {OracleEmbeddings} from "./oracleds.js"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; diff --git a/docs/core_docs/docs/integrations/tools/oracleai.mdx b/docs/core_docs/docs/integrations/tools/oracleai.mdx index b330f9304d15..6cd4ca4cf1c9 100644 --- a/docs/core_docs/docs/integrations/tools/oracleai.mdx +++ b/docs/core_docs/docs/integrations/tools/oracleai.mdx @@ -9,7 +9,7 @@ Note: The users may need to set proxy if they want to use some 3rd party summary The following sample code will show how to generate summary: ```typescript -import {OracleSummary} from "./oracleds.js"; +import {OracleSummary} from "@langchain/community/utils/oracleai"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; From c72d99c859788c58001e8ab467cde1d4c20bfaef Mon Sep 17 00:00:00 2001 From: David Jiang Date: Tue, 24 Sep 2024 10:52:54 -0400 Subject: [PATCH 09/33] Combine doc loader and text splitter files --- .../src/document_loaders/fs/oracle.ts | 62 +++++++++++++++++-- .../document_loaders/tests/oracle.int.test.ts | 1 - .../tests/oracle_text_splitter.int.test.ts | 2 +- .../src/oracle_text_splitter.ts | 56 ----------------- 4 files changed, 59 insertions(+), 62 deletions(-) rename libs/langchain-community/src/{ => document_loaders}/tests/oracle_text_splitter.int.test.ts (97%) delete mode 100644 libs/langchain-community/src/oracle_text_splitter.ts diff --git a/libs/langchain-community/src/document_loaders/fs/oracle.ts b/libs/langchain-community/src/document_loaders/fs/oracle.ts index 9b19db06b49c..80383cb9e8a3 100644 --- a/libs/langchain-community/src/document_loaders/fs/oracle.ts +++ b/libs/langchain-community/src/document_loaders/fs/oracle.ts @@ -4,6 +4,7 @@ import path from "node:path"; import oracledb from "oracledb"; import * as htmlparser2 from "htmlparser2"; import { BaseDocumentLoader } from "@langchain/core/document_loaders/base"; +import { TextSplitter, TextSplitterParams } from "@langchain/textsplitters"; function* listDir(dir: string): Generator { const files = fs.readdirSync(dir, { withFileTypes: true }); @@ -72,7 +73,7 @@ export class OracleDocLoader extends BaseDocumentLoader { }, }) ); - + const rs = result.resultSet; let row; if (rs != null) { @@ -143,7 +144,7 @@ export class OracleDocLoader extends BaseDocumentLoader { }, }) ); - + const rs = result.resultSet; let row; if (rs != null) { @@ -164,7 +165,7 @@ export class OracleDocLoader extends BaseDocumentLoader { return docs; } - + // extract plain text and metadata from a row async _extract(row: any) { let plain_text = ""; @@ -173,7 +174,7 @@ export class OracleDocLoader extends BaseDocumentLoader { if (row != null) { [plain_text] = row; const [, html_metadata] = row; - + const parser = new htmlparser2.Parser({ onopentag(name, attributes) { if (name === "meta" && attributes.name !== undefined) { @@ -189,3 +190,56 @@ export class OracleDocLoader extends BaseDocumentLoader { } } +/** + * Split text into smaller pieces + * @example + * ```typescript + * const splitter = new OracleTextSplitter(conn, params); + * let chunks = await splitter.splitText(doc.pageContent); + * ``` + */ +export class OracleTextSplitter extends TextSplitter { + protected conn: oracledb.Connection; + + protected pref: Record; + + static lc_name() { + return "OracleTextSplitter"; + } + + constructor( + conn: oracledb.Connection, + pref: Record, + fields?: TextSplitterParams + ) { + super(fields); + this.conn = conn; + this.pref = pref; + } + + async splitText(text: string) { + const chunks: string[] = []; + + const result = await this.conn.execute( + ( + `select t.column_value as data from dbms_vector_chain.utl_to_chunks(:content, json(:pref)) t` + ), + { + content: { val: text, dir: oracledb.BIND_IN, type: oracledb.CLOB }, + pref: JSON.stringify(this.pref), + }, + ( + ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) + ) + ); + const rows: any = result.rows; + if (Symbol.iterator in Object(rows)) { + for (const row of rows) { + const [chunk_str] = row; + const chunk = JSON.parse(chunk_str); + chunks.push(chunk.chunk_data); + } + } + return chunks; + } +} diff --git a/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts b/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts index 1c4751427dee..b7d67c799462 100644 --- a/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts +++ b/libs/langchain-community/src/document_loaders/tests/oracle.int.test.ts @@ -27,4 +27,3 @@ test("Test loading PDF from file", async () => { expect(docs[0].pageContent).toContain("You"); expect(docs[0].pageContent).toContain("Need"); }); - diff --git a/libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts b/libs/langchain-community/src/document_loaders/tests/oracle_text_splitter.int.test.ts similarity index 97% rename from libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts rename to libs/langchain-community/src/document_loaders/tests/oracle_text_splitter.int.test.ts index 83ee1735d849..852c44e3e416 100644 --- a/libs/langchain-community/src/tests/oracle_text_splitter.int.test.ts +++ b/libs/langchain-community/src/document_loaders/tests/oracle_text_splitter.int.test.ts @@ -1,7 +1,7 @@ import { expect, test } from "@jest/globals"; import { getEnvironmentVariable } from "@langchain/core/utils/env"; import oracledb from "oracledb"; -import { OracleTextSplitter } from "../oracle_text_splitter.js"; +import { OracleTextSplitter } from "../fs/oracle.js"; test("Test splitting by character count.", async () => { const text = diff --git a/libs/langchain-community/src/oracle_text_splitter.ts b/libs/langchain-community/src/oracle_text_splitter.ts deleted file mode 100644 index 05d38caad2bb..000000000000 --- a/libs/langchain-community/src/oracle_text_splitter.ts +++ /dev/null @@ -1,56 +0,0 @@ -import oracledb from "oracledb"; -import { TextSplitter, TextSplitterParams } from "@langchain/textsplitters"; - -/** - * Split text into smaller pieces - * @example - * ```typescript - * const splitter = new OracleTextSplitter(conn, params); - * let chunks = await splitter.splitText(doc.pageContent); - * ``` - */ -export class OracleTextSplitter extends TextSplitter { - protected conn: oracledb.Connection; - - protected pref: Record; - - static lc_name() { - return "OracleTextSplitter"; - } - - constructor( - conn: oracledb.Connection, - pref: Record, - fields?: TextSplitterParams - ) { - super(fields); - this.conn = conn; - this.pref = pref; - } - - async splitText(text: string) { - const chunks: string[] = []; - - const result = await this.conn.execute( - ( - `select t.column_value as data from dbms_vector_chain.utl_to_chunks(:content, json(:pref)) t` - ), - { - content: { val: text, dir: oracledb.BIND_IN, type: oracledb.CLOB }, - pref: JSON.stringify(this.pref), - }, - ( - ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) - ) - ); - const rows: any = result.rows; - if (Symbol.iterator in Object(rows)) { - for (const row of rows) { - const [chunk_str] = row; - const chunk = JSON.parse(chunk_str); - chunks.push(chunk.chunk_data); - } - } - return chunks; - } -} From 7fe39a0c359b599d192742fa2cff8cd1ed1d3d6d Mon Sep 17 00:00:00 2001 From: David Jiang Date: Sat, 28 Sep 2024 20:39:21 -0400 Subject: [PATCH 10/33] Move oracle text splitter to langchain-textsplitters --- .../src/document_loaders/fs/oracle.ts | 54 ------------------ .../src/oracle_text_splitter.ts | 56 +++++++++++++++++++ .../tests/oracle_text_splitter.int.test.ts | 38 +++++++++++++ 3 files changed, 94 insertions(+), 54 deletions(-) create mode 100644 libs/langchain-textsplitters/src/oracle_text_splitter.ts create mode 100644 libs/langchain-textsplitters/src/tests/oracle_text_splitter.int.test.ts diff --git a/libs/langchain-community/src/document_loaders/fs/oracle.ts b/libs/langchain-community/src/document_loaders/fs/oracle.ts index 80383cb9e8a3..4fd439370738 100644 --- a/libs/langchain-community/src/document_loaders/fs/oracle.ts +++ b/libs/langchain-community/src/document_loaders/fs/oracle.ts @@ -4,7 +4,6 @@ import path from "node:path"; import oracledb from "oracledb"; import * as htmlparser2 from "htmlparser2"; import { BaseDocumentLoader } from "@langchain/core/document_loaders/base"; -import { TextSplitter, TextSplitterParams } from "@langchain/textsplitters"; function* listDir(dir: string): Generator { const files = fs.readdirSync(dir, { withFileTypes: true }); @@ -190,56 +189,3 @@ export class OracleDocLoader extends BaseDocumentLoader { } } -/** - * Split text into smaller pieces - * @example - * ```typescript - * const splitter = new OracleTextSplitter(conn, params); - * let chunks = await splitter.splitText(doc.pageContent); - * ``` - */ -export class OracleTextSplitter extends TextSplitter { - protected conn: oracledb.Connection; - - protected pref: Record; - - static lc_name() { - return "OracleTextSplitter"; - } - - constructor( - conn: oracledb.Connection, - pref: Record, - fields?: TextSplitterParams - ) { - super(fields); - this.conn = conn; - this.pref = pref; - } - - async splitText(text: string) { - const chunks: string[] = []; - - const result = await this.conn.execute( - ( - `select t.column_value as data from dbms_vector_chain.utl_to_chunks(:content, json(:pref)) t` - ), - { - content: { val: text, dir: oracledb.BIND_IN, type: oracledb.CLOB }, - pref: JSON.stringify(this.pref), - }, - ( - ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) - ) - ); - const rows: any = result.rows; - if (Symbol.iterator in Object(rows)) { - for (const row of rows) { - const [chunk_str] = row; - const chunk = JSON.parse(chunk_str); - chunks.push(chunk.chunk_data); - } - } - return chunks; - } -} diff --git a/libs/langchain-textsplitters/src/oracle_text_splitter.ts b/libs/langchain-textsplitters/src/oracle_text_splitter.ts new file mode 100644 index 000000000000..8766971b1aa2 --- /dev/null +++ b/libs/langchain-textsplitters/src/oracle_text_splitter.ts @@ -0,0 +1,56 @@ +import oracledb from "oracledb"; +import { TextSplitter, TextSplitterParams } from "./text_splitter.js"; + +/** + * Split text into smaller pieces + * @example + * ```typescript + * const splitter = new OracleTextSplitter(conn, params); + * let chunks = await splitter.splitText(doc.pageContent); + * ``` + */ +export class OracleTextSplitter extends TextSplitter { + protected conn: oracledb.Connection; + + protected pref: Record; + + static lc_name() { + return "OracleTextSplitter"; + } + + constructor( + conn: oracledb.Connection, + pref: Record, + fields?: TextSplitterParams + ) { + super(fields); + this.conn = conn; + this.pref = pref; + } + + async splitText(text: string) { + const chunks: string[] = []; + + const result = await this.conn.execute( + ( + `select t.column_value as data from dbms_vector_chain.utl_to_chunks(:content, json(:pref)) t` + ), + { + content: { val: text, dir: oracledb.BIND_IN, type: oracledb.CLOB }, + pref: JSON.stringify(this.pref), + }, + ( + ({ fetchInfo: { DATA: { type: oracledb.STRING } } }) + ) + ); + const rows: any = result.rows; + if (Symbol.iterator in Object(rows)) { + for (const row of rows) { + const [chunk_str] = row; + const chunk = JSON.parse(chunk_str); + chunks.push(chunk.chunk_data); + } + } + return chunks; + } +} diff --git a/libs/langchain-textsplitters/src/tests/oracle_text_splitter.int.test.ts b/libs/langchain-textsplitters/src/tests/oracle_text_splitter.int.test.ts new file mode 100644 index 000000000000..83ee1735d849 --- /dev/null +++ b/libs/langchain-textsplitters/src/tests/oracle_text_splitter.int.test.ts @@ -0,0 +1,38 @@ +import { expect, test } from "@jest/globals"; +import { getEnvironmentVariable } from "@langchain/core/utils/env"; +import oracledb from "oracledb"; +import { OracleTextSplitter } from "../oracle_text_splitter.js"; + +test("Test splitting by character count.", async () => { + const text = + "The tower is 324 meters (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 meters (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 meters. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 meters (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."; + const pref = { by: "chars", max: 500 }; + + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const splitter = new OracleTextSplitter(connection, pref); + const output = await splitter.splitText(text); + await connection.close(); + + expect(output.length).toEqual(2); +}); + +test("Test splitting by words.", async () => { + const text = + "The tower is 324 meters (1,063 ft) tall, about the same height as an 81-storey building, and the tallest structure in Paris. Its base is square, measuring 125 meters (410 ft) on each side. During its construction, the Eiffel Tower surpassed the Washington Monument to become the tallest man-made structure in the world, a title it held for 41 years until the Chrysler Building in New York City was finished in 1930. It was the first structure to reach a height of 300 meters. Due to the addition of a broadcasting aerial at the top of the tower in 1957, it is now taller than the Chrysler Building by 5.2 meters (17 ft). Excluding transmitters, the Eiffel Tower is the second tallest free-standing structure in France after the Millau Viaduct."; + const pref = { by: "words", max: 100 }; + + const connection = await oracledb.getConnection({ + user: getEnvironmentVariable("ORACLE_USERNAME"), + password: getEnvironmentVariable("ORACLE_PASSWORD"), + connectString: getEnvironmentVariable("ORACLE_DSN"), + }); + const splitter = new OracleTextSplitter(connection, pref); + const output = await splitter.splitText(text); + await connection.close(); + + expect(output.length).toEqual(2); +}); From 9b2778c24608f97a37f4dca4913a27c95929b066 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Sat, 28 Sep 2024 20:40:00 -0400 Subject: [PATCH 11/33] Update docs for oracle text splitter --- .../integrations/document_loaders/file_loaders/oracleai.mdx | 2 +- docs/core_docs/docs/integrations/platforms/oracleai.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx index e565349c3a47..069686f684c3 100644 --- a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx +++ b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx @@ -43,7 +43,7 @@ The documents may vary in size, ranging from small to very large. Users often pr Below is a sample code illustrating how to implement this: ```typescript -import {OracleTextSplitter} from "@langchain/community/document_loaders/fs/oracleai"; +import {OracleTextSplitter} from "@langchain/textsplitters/oracle"; /* // Some examples diff --git a/docs/core_docs/docs/integrations/platforms/oracleai.mdx b/docs/core_docs/docs/integrations/platforms/oracleai.mdx index a4baf50a43ca..0ad31e7ab174 100644 --- a/docs/core_docs/docs/integrations/platforms/oracleai.mdx +++ b/docs/core_docs/docs/integrations/platforms/oracleai.mdx @@ -37,7 +37,7 @@ const docs = await loader.load(); Please check the [usage example](/docs/integrations/document_loaders/file_loaders/oracleai). ```typescript -import {OracleTextSplitter} from "@langchain/community/document_loaders/fs/oracleai"; +import {OracleTextSplitter} from "@langchain/textsplitters/oracle"; const splitter = new OracleTextSplitter(conn, splitter_params); let chunks = await splitter.splitText(doc.pageContent); From 147873199d753c439c089f47e7e6184816215ca1 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Sat, 28 Sep 2024 21:42:08 -0400 Subject: [PATCH 12/33] Update import paths --- cookbook/oracleai.mdx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/cookbook/oracleai.mdx b/cookbook/oracleai.mdx index 50f96449ae2a..9e2b66a42e51 100644 --- a/cookbook/oracleai.mdx +++ b/cookbook/oracleai.mdx @@ -173,7 +173,7 @@ A significant advantage of utilizing an ONNX model directly within Oracle is the Below is the example code to upload an ONNX model into Oracle Database: ```typescript -import {OracleEmbeddings} from "./oracleds.js"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; // please update with your related information // make sure that you have onnx file in the system @@ -260,7 +260,7 @@ A significant advantage of utilizing OracleDocLoader is its capability to proces Below is a sample code snippet that demonstrates how to use OracleDocLoader ```typescript -import {OracleDocLoader} from "./oracleds.js"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; // loading from Oracle Database table // make sure you have the table with this specification @@ -300,7 +300,7 @@ Now that the user loaded the documents, they may want to generate a summary for The following sample code will show how to generate summary: ```typescript -import {OracleDocLoader, OracleSummary} from "./oracleds.js"; +import {OracleSummary} from "@langchain/community/utils/oracleai"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; @@ -339,7 +339,7 @@ The documents may vary in size, ranging from small to very large. Users often pr Below is a sample code illustrating how to implement this: ```typescript -import {OracleDocLoader, OracleTextSplitter} from "./oracleds.js"; +import {OracleTextSplitter} from "@langchain/textsplitters/oracle"; // split by default parameters const splitter_params = {"normalize": "all"}; @@ -371,7 +371,7 @@ Now that the documents are chunked as per requirements, the users may want to ge The following sample code will show how to generate embeddings: ```typescript -import {OracleDocLoader, OracleTextSplitter, OracleEmbeddings} from "./oracleds.js"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; @@ -421,7 +421,10 @@ If you choose to use 3rd party provider, please follow the necessary steps for proxy and credential. */ -import {OracleDocLoader, OracleTextSplitter, OracleEmbeddings, OracleSummary} from "./oracleds.js"; +import {OracleTextSplitter} from "@langchain/textsplitters/oracle"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; +import {OracleSummary} from "@langchain/community/utils/oracleai"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; import {Document} from "langchain/document"; import oracledb from "oracledb"; From b84f98ea2c973b9ec6d931c65529add6ca126c5c Mon Sep 17 00:00:00 2001 From: David Jiang Date: Sat, 28 Sep 2024 22:36:17 -0400 Subject: [PATCH 13/33] Change imports oracleai to oracle --- cookbook/oracleai.mdx | 14 +++++++------- .../document_loaders/file_loaders/oracleai.mdx | 2 +- .../docs/integrations/platforms/oracleai.mdx | 6 +++--- .../docs/integrations/text_embedding/oracleai.mdx | 2 +- .../core_docs/docs/integrations/tools/oracleai.mdx | 2 +- libs/langchain-community/langchain.config.js | 6 +++--- libs/langchain-textsplitters/langchain.config.js | 1 + 7 files changed, 17 insertions(+), 16 deletions(-) diff --git a/cookbook/oracleai.mdx b/cookbook/oracleai.mdx index 9e2b66a42e51..f250c6dd9ee0 100644 --- a/cookbook/oracleai.mdx +++ b/cookbook/oracleai.mdx @@ -173,7 +173,7 @@ A significant advantage of utilizing an ONNX model directly within Oracle is the Below is the example code to upload an ONNX model into Oracle Database: ```typescript -import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracle"; // please update with your related information // make sure that you have onnx file in the system @@ -260,7 +260,7 @@ A significant advantage of utilizing OracleDocLoader is its capability to proces Below is a sample code snippet that demonstrates how to use OracleDocLoader ```typescript -import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracle"; // loading from Oracle Database table // make sure you have the table with this specification @@ -300,7 +300,7 @@ Now that the user loaded the documents, they may want to generate a summary for The following sample code will show how to generate summary: ```typescript -import {OracleSummary} from "@langchain/community/utils/oracleai"; +import {OracleSummary} from "@langchain/community/utils/oracle"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; @@ -371,7 +371,7 @@ Now that the documents are chunked as per requirements, the users may want to ge The following sample code will show how to generate embeddings: ```typescript -import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracle"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; @@ -422,9 +422,9 @@ please follow the necessary steps for proxy and credential. */ import {OracleTextSplitter} from "@langchain/textsplitters/oracle"; -import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; -import {OracleSummary} from "@langchain/community/utils/oracleai"; -import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracle"; +import {OracleSummary} from "@langchain/community/utils/oracle"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracle"; import {Document} from "langchain/document"; import oracledb from "oracledb"; diff --git a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx index 069686f684c3..5b4dfef26dc1 100644 --- a/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx +++ b/docs/core_docs/docs/integrations/document_loaders/file_loaders/oracleai.mdx @@ -9,7 +9,7 @@ A significant advantage of utilizing OracleDocLoader is its capability to proces Below is a sample code snippet that demonstrates how to use OracleDocLoader ```typescript -import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracle"; /* // loading a local file diff --git a/docs/core_docs/docs/integrations/platforms/oracleai.mdx b/docs/core_docs/docs/integrations/platforms/oracleai.mdx index 0ad31e7ab174..6c5fd1d75dc2 100644 --- a/docs/core_docs/docs/integrations/platforms/oracleai.mdx +++ b/docs/core_docs/docs/integrations/platforms/oracleai.mdx @@ -26,7 +26,7 @@ In addition, your vectors can benefit from all of Oracle Database’s most power Please check the [usage example](/docs/integrations/document_loaders/file_loaders/oracleai). ```typescript -import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracleai"; +import {OracleDocLoader} from "@langchain/community/document_loaders/fs/oracle"; const loader = new OracleDocLoader(conn, loader_params); const docs = await loader.load(); @@ -48,7 +48,7 @@ let chunks = await splitter.splitText(doc.pageContent); Please check the [usage example](/docs/integrations/text_embedding/oracleai). ```typescript -import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracle"; const embedder = new OracleEmbeddings(conn, embedder_params, proxy); const embed = await embedder.embedQuery(chunk); @@ -59,7 +59,7 @@ const embed = await embedder.embedQuery(chunk); Please check the [usage example](/docs/integrations/tools/oracleai). ```typescript -import {OracleSummary} from "@langchain/community/utils/oracleai"; +import {OracleSummary} from "@langchain/community/utils/oracle"; const model = new OracleSummary(conn, summary_params, proxy); const summary = await model.getSummary(doc.pageContent); diff --git a/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx b/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx index 367e17a8c54b..d2ea468a5ede 100644 --- a/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx +++ b/docs/core_docs/docs/integrations/text_embedding/oracleai.mdx @@ -9,7 +9,7 @@ Oracle AI Vector Search provides multiple methods for generating embeddings, uti The following sample code will show how to generate embeddings: ```typescript -import {OracleEmbeddings} from "@langchain/community/embeddings/oracleai"; +import {OracleEmbeddings} from "@langchain/community/embeddings/oracle"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; diff --git a/docs/core_docs/docs/integrations/tools/oracleai.mdx b/docs/core_docs/docs/integrations/tools/oracleai.mdx index 6cd4ca4cf1c9..43d2a1f68d9f 100644 --- a/docs/core_docs/docs/integrations/tools/oracleai.mdx +++ b/docs/core_docs/docs/integrations/tools/oracleai.mdx @@ -9,7 +9,7 @@ Note: The users may need to set proxy if they want to use some 3rd party summary The following sample code will show how to generate summary: ```typescript -import {OracleSummary} from "@langchain/community/utils/oracleai"; +import {OracleSummary} from "@langchain/community/utils/oracle"; // proxy to be used when we instantiate summary and embedder object const proxy = ""; diff --git a/libs/langchain-community/langchain.config.js b/libs/langchain-community/langchain.config.js index 9a50237f70a4..381812fede99 100644 --- a/libs/langchain-community/langchain.config.js +++ b/libs/langchain-community/langchain.config.js @@ -80,7 +80,7 @@ export const config = { "embeddings/llama_cpp": "embeddings/llama_cpp", "embeddings/minimax": "embeddings/minimax", "embeddings/ollama": "embeddings/ollama", - "embeddings/oracleai": "embeddings/oracle", + "embeddings/oracle": "embeddings/oracle", "embeddings/premai": "embeddings/premai", "embeddings/tensorflow": "embeddings/tensorflow", "embeddings/tencent_hunyuan": "embeddings/tencent_hunyuan/index", @@ -305,13 +305,13 @@ export const config = { "document_loaders/fs/unstructured": "document_loaders/fs/unstructured", "document_loaders/fs/openai_whisper_audio": "document_loaders/fs/openai_whisper_audio", - "document_loaders/fs/oracleai": "document_loaders/fs/oracle", + "document_loaders/fs/oracle": "document_loaders/fs/oracle", "document_loaders/fs/pptx": "document_loaders/fs/pptx", // utils "utils/convex": "utils/convex", "utils/event_source_parse": "utils/event_source_parse", "utils/cassandra": "utils/cassandra", - "utils/oracleai": "utils/oracle", + "utils/oracle": "utils/oracle", // experimental "experimental/callbacks/handlers/datadog": "experimental/callbacks/handlers/datadog", "experimental/graph_transformers/llm": diff --git a/libs/langchain-textsplitters/langchain.config.js b/libs/langchain-textsplitters/langchain.config.js index 46b1a2b31264..d9e1dc8e3ae8 100644 --- a/libs/langchain-textsplitters/langchain.config.js +++ b/libs/langchain-textsplitters/langchain.config.js @@ -13,6 +13,7 @@ export const config = { internals: [/node\:/, /@langchain\/core\//], entrypoints: { index: "index", + "oracle": "oracle_text_splitter" }, requiresOptionalDependency: [], tsConfigPath: resolve("./tsconfig.json"), From 6cdd334dc32edf549811511066f3088d58d17780 Mon Sep 17 00:00:00 2001 From: David Jiang Date: Mon, 21 Oct 2024 10:38:12 -0400 Subject: [PATCH 14/33] Handle escaped double quotes --- .../langchain-community/src/document_loaders/fs/oracle.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libs/langchain-community/src/document_loaders/fs/oracle.ts b/libs/langchain-community/src/document_loaders/fs/oracle.ts index 4fd439370738..f66838469be9 100644 --- a/libs/langchain-community/src/document_loaders/fs/oracle.ts +++ b/libs/langchain-community/src/document_loaders/fs/oracle.ts @@ -128,6 +128,13 @@ export class OracleDocLoader extends BaseDocumentLoader { if (!("owner" in this.pref) || !("colname" in this.pref)) { throw new Error(`Invalid preferences: missing owner or colname`); } + // SQL doesn't accept backslash to escape a double quote (\"). If string contains \" change to " + if ( + this.pref.tablename.startsWith('\\"') && + this.pref.tablename.endsWith('\\"') + ) { + this.pref.tablename = this.pref.tablename.replaceAll("\\", ""); + } const result = await this.conn.execute( ( `select dbms_vector_chain.utl_to_text(t.${this.pref.colname}, json(:pref)) text, dbms_vector_chain.utl_to_text(t.${this.pref.colname}, json('{"plaintext": "false"}')) metadata from ${this.pref.owner}.${this.pref.tablename} t` @@ -188,4 +195,3 @@ export class OracleDocLoader extends BaseDocumentLoader { return [plain_text, metadata]; } } - From c2dd804e04b38761ffcb0a24bce151f2ced70f12 Mon Sep 17 00:00:00 2001 From: skmishraoracle Date: Thu, 7 Nov 2024 20:01:26 -0800 Subject: [PATCH 15/33] config changes changes to imports --- .yarn/releases/yarn-3.4.1.cjs | 873 ----- .yarnrc.yml | 10 +- libs/langchain-community/package.json | 337 +- .../src/vectorstores/oraclevs.ts | 8 +- .../{oraclevs.test.ts => oraclevs_test.ts} | 165 +- package.json | 21 +- yarn.lock | 3184 +++++++++++++---- 7 files changed, 2795 insertions(+), 1803 deletions(-) delete mode 100755 .yarn/releases/yarn-3.4.1.cjs rename libs/langchain-community/src/vectorstores/tests/{oraclevs.test.ts => oraclevs_test.ts} (61%) diff --git a/.yarn/releases/yarn-3.4.1.cjs b/.yarn/releases/yarn-3.4.1.cjs deleted file mode 100755 index 2bdb752d8609..000000000000 --- a/.yarn/releases/yarn-3.4.1.cjs +++ /dev/null @@ -1,873 +0,0 @@ -#!/usr/bin/env node -/* eslint-disable */ -//prettier-ignore -(()=>{var Mue=Object.create;var Wb=Object.defineProperty;var Kue=Object.getOwnPropertyDescriptor;var Uue=Object.getOwnPropertyNames;var Hue=Object.getPrototypeOf,Gue=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var Yue=(r,e)=>()=>(r&&(e=r(r=0)),e);var w=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ut=(r,e)=>{for(var t in e)Wb(r,t,{get:e[t],enumerable:!0})},jue=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Uue(e))!Gue.call(r,n)&&n!==t&&Wb(r,n,{get:()=>e[n],enumerable:!(i=Kue(e,n))||i.enumerable});return r};var Pe=(r,e,t)=>(t=r!=null?Mue(Hue(r)):{},jue(e||!r||!r.__esModule?Wb(t,"default",{value:r,enumerable:!0}):t,r));var _1=w((O7e,X1)=>{X1.exports=V1;V1.sync=uge;var W1=J("fs");function cge(r,e){var t=e.pathExt!==void 0?e.pathExt:process.env.PATHEXT;if(!t||(t=t.split(";"),t.indexOf("")!==-1))return!0;for(var i=0;i{tK.exports=$1;$1.sync=gge;var Z1=J("fs");function $1(r,e,t){Z1.stat(r,function(i,n){t(i,i?!1:eK(n,e))})}function gge(r,e){return eK(Z1.statSync(r),e)}function eK(r,e){return r.isFile()&&fge(r,e)}function fge(r,e){var t=r.mode,i=r.uid,n=r.gid,s=e.uid!==void 0?e.uid:process.getuid&&process.getuid(),o=e.gid!==void 0?e.gid:process.getgid&&process.getgid(),a=parseInt("100",8),l=parseInt("010",8),c=parseInt("001",8),u=a|l,g=t&c||t&l&&n===o||t&a&&i===s||t&u&&s===0;return g}});var nK=w((U7e,iK)=>{var K7e=J("fs"),_E;process.platform==="win32"||global.TESTING_WINDOWS?_E=_1():_E=rK();iK.exports=uS;uS.sync=hge;function uS(r,e,t){if(typeof e=="function"&&(t=e,e={}),!t){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(i,n){uS(r,e||{},function(s,o){s?n(s):i(o)})})}_E(r,e||{},function(i,n){i&&(i.code==="EACCES"||e&&e.ignoreErrors)&&(i=null,n=!1),t(i,n)})}function hge(r,e){try{return _E.sync(r,e||{})}catch(t){if(e&&e.ignoreErrors||t.code==="EACCES")return!1;throw t}}});var uK=w((H7e,cK)=>{var Ig=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",sK=J("path"),pge=Ig?";":":",oK=nK(),aK=r=>Object.assign(new Error(`not found: ${r}`),{code:"ENOENT"}),AK=(r,e)=>{let t=e.colon||pge,i=r.match(/\//)||Ig&&r.match(/\\/)?[""]:[...Ig?[process.cwd()]:[],...(e.path||process.env.PATH||"").split(t)],n=Ig?e.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",s=Ig?n.split(t):[""];return Ig&&r.indexOf(".")!==-1&&s[0]!==""&&s.unshift(""),{pathEnv:i,pathExt:s,pathExtExe:n}},lK=(r,e,t)=>{typeof e=="function"&&(t=e,e={}),e||(e={});let{pathEnv:i,pathExt:n,pathExtExe:s}=AK(r,e),o=[],a=c=>new Promise((u,g)=>{if(c===i.length)return e.all&&o.length?u(o):g(aK(r));let f=i[c],h=/^".*"$/.test(f)?f.slice(1,-1):f,p=sK.join(h,r),C=!h&&/^\.[\\\/]/.test(r)?r.slice(0,2)+p:p;u(l(C,c,0))}),l=(c,u,g)=>new Promise((f,h)=>{if(g===n.length)return f(a(u+1));let p=n[g];oK(c+p,{pathExt:s},(C,y)=>{if(!C&&y)if(e.all)o.push(c+p);else return f(c+p);return f(l(c,u,g+1))})});return t?a(0).then(c=>t(null,c),t):a(0)},dge=(r,e)=>{e=e||{};let{pathEnv:t,pathExt:i,pathExtExe:n}=AK(r,e),s=[];for(let o=0;o{"use strict";var gK=(r={})=>{let e=r.env||process.env;return(r.platform||process.platform)!=="win32"?"PATH":Object.keys(e).reverse().find(i=>i.toUpperCase()==="PATH")||"Path"};gS.exports=gK;gS.exports.default=gK});var CK=w((Y7e,dK)=>{"use strict";var hK=J("path"),Cge=uK(),mge=fK();function pK(r,e){let t=r.options.env||process.env,i=process.cwd(),n=r.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(r.options.cwd)}catch{}let o;try{o=Cge.sync(r.command,{path:t[mge({env:t})],pathExt:e?hK.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return o&&(o=hK.resolve(n?r.options.cwd:"",o)),o}function Ege(r){return pK(r)||pK(r,!0)}dK.exports=Ege});var mK=w((j7e,hS)=>{"use strict";var fS=/([()\][%!^"`<>&|;, *?])/g;function Ige(r){return r=r.replace(fS,"^$1"),r}function yge(r,e){return r=`${r}`,r=r.replace(/(\\*)"/g,'$1$1\\"'),r=r.replace(/(\\*)$/,"$1$1"),r=`"${r}"`,r=r.replace(fS,"^$1"),e&&(r=r.replace(fS,"^$1")),r}hS.exports.command=Ige;hS.exports.argument=yge});var IK=w((q7e,EK)=>{"use strict";EK.exports=/^#!(.*)/});var wK=w((J7e,yK)=>{"use strict";var wge=IK();yK.exports=(r="")=>{let e=r.match(wge);if(!e)return null;let[t,i]=e[0].replace(/#! ?/,"").split(" "),n=t.split("/").pop();return n==="env"?i:i?`${n} ${i}`:n}});var QK=w((W7e,BK)=>{"use strict";var pS=J("fs"),Bge=wK();function Qge(r){let t=Buffer.alloc(150),i;try{i=pS.openSync(r,"r"),pS.readSync(i,t,0,150,0),pS.closeSync(i)}catch{}return Bge(t.toString())}BK.exports=Qge});var xK=w((z7e,vK)=>{"use strict";var bge=J("path"),bK=CK(),SK=mK(),Sge=QK(),vge=process.platform==="win32",xge=/\.(?:com|exe)$/i,Pge=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Dge(r){r.file=bK(r);let e=r.file&&Sge(r.file);return e?(r.args.unshift(r.file),r.command=e,bK(r)):r.file}function kge(r){if(!vge)return r;let e=Dge(r),t=!xge.test(e);if(r.options.forceShell||t){let i=Pge.test(e);r.command=bge.normalize(r.command),r.command=SK.command(r.command),r.args=r.args.map(s=>SK.argument(s,i));let n=[r.command].concat(r.args).join(" ");r.args=["/d","/s","/c",`"${n}"`],r.command=process.env.comspec||"cmd.exe",r.options.windowsVerbatimArguments=!0}return r}function Rge(r,e,t){e&&!Array.isArray(e)&&(t=e,e=null),e=e?e.slice(0):[],t=Object.assign({},t);let i={command:r,args:e,options:t,file:void 0,original:{command:r,args:e}};return t.shell?i:kge(i)}vK.exports=Rge});var kK=w((V7e,DK)=>{"use strict";var dS=process.platform==="win32";function CS(r,e){return Object.assign(new Error(`${e} ${r.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${e} ${r.command}`,path:r.command,spawnargs:r.args})}function Fge(r,e){if(!dS)return;let t=r.emit;r.emit=function(i,n){if(i==="exit"){let s=PK(n,e,"spawn");if(s)return t.call(r,"error",s)}return t.apply(r,arguments)}}function PK(r,e){return dS&&r===1&&!e.file?CS(e.original,"spawn"):null}function Nge(r,e){return dS&&r===1&&!e.file?CS(e.original,"spawnSync"):null}DK.exports={hookChildProcess:Fge,verifyENOENT:PK,verifyENOENTSync:Nge,notFoundError:CS}});var IS=w((X7e,yg)=>{"use strict";var RK=J("child_process"),mS=xK(),ES=kK();function FK(r,e,t){let i=mS(r,e,t),n=RK.spawn(i.command,i.args,i.options);return ES.hookChildProcess(n,i),n}function Lge(r,e,t){let i=mS(r,e,t),n=RK.spawnSync(i.command,i.args,i.options);return n.error=n.error||ES.verifyENOENTSync(n.status,i),n}yg.exports=FK;yg.exports.spawn=FK;yg.exports.sync=Lge;yg.exports._parse=mS;yg.exports._enoent=ES});var LK=w((_7e,NK)=>{"use strict";function Tge(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function Ml(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ml)}Tge(Ml,Error);Ml.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;g>",ie=me(">>",!1),de=">&",tt=me(">&",!1),Pt=">",It=me(">",!1),Or="<<<",ii=me("<<<",!1),gi="<&",hr=me("<&",!1),fi="<",ni=me("<",!1),Ls=function(m){return{type:"argument",segments:[].concat(...m)}},pr=function(m){return m},Ei="$'",_n=me("$'",!1),oa="'",aA=me("'",!1),eg=function(m){return[{type:"text",text:m}]},Zn='""',AA=me('""',!1),aa=function(){return{type:"text",text:""}},up='"',lA=me('"',!1),cA=function(m){return m},wr=function(m){return{type:"arithmetic",arithmetic:m,quoted:!0}},wl=function(m){return{type:"shell",shell:m,quoted:!0}},tg=function(m){return{type:"variable",...m,quoted:!0}},po=function(m){return{type:"text",text:m}},rg=function(m){return{type:"arithmetic",arithmetic:m,quoted:!1}},gp=function(m){return{type:"shell",shell:m,quoted:!1}},fp=function(m){return{type:"variable",...m,quoted:!1}},vr=function(m){return{type:"glob",pattern:m}},se=/^[^']/,Co=Je(["'"],!0,!1),Dn=function(m){return m.join("")},ig=/^[^$"]/,Qt=Je(["$",'"'],!0,!1),Bl=`\\ -`,kn=me(`\\ -`,!1),$n=function(){return""},es="\\",gt=me("\\",!1),mo=/^[\\$"`]/,At=Je(["\\","$",'"',"`"],!1,!1),an=function(m){return m},S="\\a",Tt=me("\\a",!1),ng=function(){return"a"},Ql="\\b",hp=me("\\b",!1),pp=function(){return"\b"},dp=/^[Ee]/,Cp=Je(["E","e"],!1,!1),mp=function(){return"\x1B"},G="\\f",yt=me("\\f",!1),uA=function(){return"\f"},ji="\\n",bl=me("\\n",!1),Xe=function(){return` -`},Aa="\\r",sg=me("\\r",!1),bE=function(){return"\r"},Ep="\\t",SE=me("\\t",!1),ar=function(){return" "},Rn="\\v",Sl=me("\\v",!1),Ip=function(){return"\v"},Ts=/^[\\'"?]/,la=Je(["\\","'",'"',"?"],!1,!1),An=function(m){return String.fromCharCode(parseInt(m,16))},Te="\\x",og=me("\\x",!1),vl="\\u",Os=me("\\u",!1),xl="\\U",gA=me("\\U",!1),ag=function(m){return String.fromCodePoint(parseInt(m,16))},Ag=/^[0-7]/,ca=Je([["0","7"]],!1,!1),ua=/^[0-9a-fA-f]/,rt=Je([["0","9"],["a","f"],["A","f"]],!1,!1),Eo=nt(),fA="-",Pl=me("-",!1),Ms="+",Dl=me("+",!1),vE=".",yp=me(".",!1),lg=function(m,b,N){return{type:"number",value:(m==="-"?-1:1)*parseFloat(b.join("")+"."+N.join(""))}},wp=function(m,b){return{type:"number",value:(m==="-"?-1:1)*parseInt(b.join(""))}},xE=function(m){return{type:"variable",...m}},kl=function(m){return{type:"variable",name:m}},PE=function(m){return m},cg="*",hA=me("*",!1),Rr="/",DE=me("/",!1),Ks=function(m,b,N){return{type:b==="*"?"multiplication":"division",right:N}},Us=function(m,b){return b.reduce((N,U)=>({left:N,...U}),m)},ug=function(m,b,N){return{type:b==="+"?"addition":"subtraction",right:N}},pA="$((",R=me("$((",!1),q="))",Ce=me("))",!1),Ke=function(m){return m},Re="$(",ze=me("$(",!1),dt=function(m){return m},Ft="${",Fn=me("${",!1),Db=":-",$M=me(":-",!1),e1=function(m,b){return{name:m,defaultValue:b}},kb=":-}",t1=me(":-}",!1),r1=function(m){return{name:m,defaultValue:[]}},Rb=":+",i1=me(":+",!1),n1=function(m,b){return{name:m,alternativeValue:b}},Fb=":+}",s1=me(":+}",!1),o1=function(m){return{name:m,alternativeValue:[]}},Nb=function(m){return{name:m}},a1="$",A1=me("$",!1),l1=function(m){return e.isGlobPattern(m)},c1=function(m){return m},Lb=/^[a-zA-Z0-9_]/,Tb=Je([["a","z"],["A","Z"],["0","9"],"_"],!1,!1),Ob=function(){return T()},Mb=/^[$@*?#a-zA-Z0-9_\-]/,Kb=Je(["$","@","*","?","#",["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),u1=/^[(){}<>$|&; \t"']/,gg=Je(["(",")","{","}","<",">","$","|","&",";"," "," ",'"',"'"],!1,!1),Ub=/^[<>&; \t"']/,Hb=Je(["<",">","&",";"," "," ",'"',"'"],!1,!1),kE=/^[ \t]/,RE=Je([" "," "],!1,!1),Q=0,Me=0,dA=[{line:1,column:1}],d=0,E=[],I=0,k;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function T(){return r.substring(Me,Q)}function _(){return Et(Me,Q)}function te(m,b){throw b=b!==void 0?b:Et(Me,Q),ki([lt(m)],r.substring(Me,Q),b)}function Be(m,b){throw b=b!==void 0?b:Et(Me,Q),Nn(m,b)}function me(m,b){return{type:"literal",text:m,ignoreCase:b}}function Je(m,b,N){return{type:"class",parts:m,inverted:b,ignoreCase:N}}function nt(){return{type:"any"}}function wt(){return{type:"end"}}function lt(m){return{type:"other",description:m}}function it(m){var b=dA[m],N;if(b)return b;for(N=m-1;!dA[N];)N--;for(b=dA[N],b={line:b.line,column:b.column};Nd&&(d=Q,E=[]),E.push(m))}function Nn(m,b){return new Ml(m,null,null,b)}function ki(m,b,N){return new Ml(Ml.buildMessage(m,b),m,b,N)}function CA(){var m,b;return m=Q,b=Mr(),b===t&&(b=null),b!==t&&(Me=m,b=s(b)),m=b,m}function Mr(){var m,b,N,U,ce;if(m=Q,b=Kr(),b!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();N!==t?(U=ga(),U!==t?(ce=ts(),ce===t&&(ce=null),ce!==t?(Me=m,b=o(b,U,ce),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;if(m===t)if(m=Q,b=Kr(),b!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();N!==t?(U=ga(),U===t&&(U=null),U!==t?(Me=m,b=a(b,U),m=b):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;return m}function ts(){var m,b,N,U,ce;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(N=Mr(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Me=m,b=l(N),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t;return m}function ga(){var m;return r.charCodeAt(Q)===59?(m=c,Q++):(m=t,I===0&&Qe(u)),m===t&&(r.charCodeAt(Q)===38?(m=g,Q++):(m=t,I===0&&Qe(f))),m}function Kr(){var m,b,N;return m=Q,b=g1(),b!==t?(N=yue(),N===t&&(N=null),N!==t?(Me=m,b=h(b,N),m=b):(Q=m,m=t)):(Q=m,m=t),m}function yue(){var m,b,N,U,ce,Se,ht;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(N=wue(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Kr(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Me=m,b=p(N,ce),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t;return m}function wue(){var m;return r.substr(Q,2)===C?(m=C,Q+=2):(m=t,I===0&&Qe(y)),m===t&&(r.substr(Q,2)===B?(m=B,Q+=2):(m=t,I===0&&Qe(v))),m}function g1(){var m,b,N;return m=Q,b=bue(),b!==t?(N=Bue(),N===t&&(N=null),N!==t?(Me=m,b=D(b,N),m=b):(Q=m,m=t)):(Q=m,m=t),m}function Bue(){var m,b,N,U,ce,Se,ht;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(N=Que(),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=g1(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Me=m,b=L(N,ce),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t;return m}function Que(){var m;return r.substr(Q,2)===H?(m=H,Q+=2):(m=t,I===0&&Qe(j)),m===t&&(r.charCodeAt(Q)===124?(m=$,Q++):(m=t,I===0&&Qe(V))),m}function FE(){var m,b,N,U,ce,Se;if(m=Q,b=Q1(),b!==t)if(r.charCodeAt(Q)===61?(N=W,Q++):(N=t,I===0&&Qe(Z)),N!==t)if(U=p1(),U!==t){for(ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();ce!==t?(Me=m,b=A(b,U),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t;else Q=m,m=t;if(m===t)if(m=Q,b=Q1(),b!==t)if(r.charCodeAt(Q)===61?(N=W,Q++):(N=t,I===0&&Qe(Z)),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Me=m,b=ae(b),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t;return m}function bue(){var m,b,N,U,ce,Se,ht,Bt,Jr,hi,rs;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(r.charCodeAt(Q)===40?(N=ge,Q++):(N=t,I===0&&Qe(re)),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Mr(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();if(Se!==t)if(r.charCodeAt(Q)===41?(ht=O,Q++):(ht=t,I===0&&Qe(F)),ht!==t){for(Bt=[],Jr=He();Jr!==t;)Bt.push(Jr),Jr=He();if(Bt!==t){for(Jr=[],hi=Bp();hi!==t;)Jr.push(hi),hi=Bp();if(Jr!==t){for(hi=[],rs=He();rs!==t;)hi.push(rs),rs=He();hi!==t?(Me=m,b=ue(ce,Jr),m=b):(Q=m,m=t)}else Q=m,m=t}else Q=m,m=t}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t;if(m===t){for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t)if(r.charCodeAt(Q)===123?(N=he,Q++):(N=t,I===0&&Qe(ke)),N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t)if(ce=Mr(),ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();if(Se!==t)if(r.charCodeAt(Q)===125?(ht=Fe,Q++):(ht=t,I===0&&Qe(Ne)),ht!==t){for(Bt=[],Jr=He();Jr!==t;)Bt.push(Jr),Jr=He();if(Bt!==t){for(Jr=[],hi=Bp();hi!==t;)Jr.push(hi),hi=Bp();if(Jr!==t){for(hi=[],rs=He();rs!==t;)hi.push(rs),rs=He();hi!==t?(Me=m,b=oe(ce,Jr),m=b):(Q=m,m=t)}else Q=m,m=t}else Q=m,m=t}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;else Q=m,m=t;if(m===t){for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t){for(N=[],U=FE();U!==t;)N.push(U),U=FE();if(N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();if(U!==t){if(ce=[],Se=h1(),Se!==t)for(;Se!==t;)ce.push(Se),Se=h1();else ce=t;if(ce!==t){for(Se=[],ht=He();ht!==t;)Se.push(ht),ht=He();Se!==t?(Me=m,b=le(N,ce),m=b):(Q=m,m=t)}else Q=m,m=t}else Q=m,m=t}else Q=m,m=t}else Q=m,m=t;if(m===t){for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t){if(N=[],U=FE(),U!==t)for(;U!==t;)N.push(U),U=FE();else N=t;if(N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Me=m,b=we(N),m=b):(Q=m,m=t)}else Q=m,m=t}else Q=m,m=t}}}return m}function f1(){var m,b,N,U,ce;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t){if(N=[],U=NE(),U!==t)for(;U!==t;)N.push(U),U=NE();else N=t;if(N!==t){for(U=[],ce=He();ce!==t;)U.push(ce),ce=He();U!==t?(Me=m,b=fe(N),m=b):(Q=m,m=t)}else Q=m,m=t}else Q=m,m=t;return m}function h1(){var m,b,N;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();if(b!==t?(N=Bp(),N!==t?(Me=m,b=Ae(N),m=b):(Q=m,m=t)):(Q=m,m=t),m===t){for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();b!==t?(N=NE(),N!==t?(Me=m,b=Ae(N),m=b):(Q=m,m=t)):(Q=m,m=t)}return m}function Bp(){var m,b,N,U,ce;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();return b!==t?(qe.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(ne)),N===t&&(N=null),N!==t?(U=Sue(),U!==t?(ce=NE(),ce!==t?(Me=m,b=Y(N,U,ce),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m}function Sue(){var m;return r.substr(Q,2)===pe?(m=pe,Q+=2):(m=t,I===0&&Qe(ie)),m===t&&(r.substr(Q,2)===de?(m=de,Q+=2):(m=t,I===0&&Qe(tt)),m===t&&(r.charCodeAt(Q)===62?(m=Pt,Q++):(m=t,I===0&&Qe(It)),m===t&&(r.substr(Q,3)===Or?(m=Or,Q+=3):(m=t,I===0&&Qe(ii)),m===t&&(r.substr(Q,2)===gi?(m=gi,Q+=2):(m=t,I===0&&Qe(hr)),m===t&&(r.charCodeAt(Q)===60?(m=fi,Q++):(m=t,I===0&&Qe(ni))))))),m}function NE(){var m,b,N;for(m=Q,b=[],N=He();N!==t;)b.push(N),N=He();return b!==t?(N=p1(),N!==t?(Me=m,b=Ae(N),m=b):(Q=m,m=t)):(Q=m,m=t),m}function p1(){var m,b,N;if(m=Q,b=[],N=d1(),N!==t)for(;N!==t;)b.push(N),N=d1();else b=t;return b!==t&&(Me=m,b=Ls(b)),m=b,m}function d1(){var m,b;return m=Q,b=vue(),b!==t&&(Me=m,b=pr(b)),m=b,m===t&&(m=Q,b=xue(),b!==t&&(Me=m,b=pr(b)),m=b,m===t&&(m=Q,b=Pue(),b!==t&&(Me=m,b=pr(b)),m=b,m===t&&(m=Q,b=Due(),b!==t&&(Me=m,b=pr(b)),m=b))),m}function vue(){var m,b,N,U;return m=Q,r.substr(Q,2)===Ei?(b=Ei,Q+=2):(b=t,I===0&&Qe(_n)),b!==t?(N=Fue(),N!==t?(r.charCodeAt(Q)===39?(U=oa,Q++):(U=t,I===0&&Qe(aA)),U!==t?(Me=m,b=eg(N),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m}function xue(){var m,b,N,U;return m=Q,r.charCodeAt(Q)===39?(b=oa,Q++):(b=t,I===0&&Qe(aA)),b!==t?(N=kue(),N!==t?(r.charCodeAt(Q)===39?(U=oa,Q++):(U=t,I===0&&Qe(aA)),U!==t?(Me=m,b=eg(N),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m}function Pue(){var m,b,N,U;if(m=Q,r.substr(Q,2)===Zn?(b=Zn,Q+=2):(b=t,I===0&&Qe(AA)),b!==t&&(Me=m,b=aa()),m=b,m===t)if(m=Q,r.charCodeAt(Q)===34?(b=up,Q++):(b=t,I===0&&Qe(lA)),b!==t){for(N=[],U=C1();U!==t;)N.push(U),U=C1();N!==t?(r.charCodeAt(Q)===34?(U=up,Q++):(U=t,I===0&&Qe(lA)),U!==t?(Me=m,b=cA(N),m=b):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;return m}function Due(){var m,b,N;if(m=Q,b=[],N=m1(),N!==t)for(;N!==t;)b.push(N),N=m1();else b=t;return b!==t&&(Me=m,b=cA(b)),m=b,m}function C1(){var m,b;return m=Q,b=w1(),b!==t&&(Me=m,b=wr(b)),m=b,m===t&&(m=Q,b=B1(),b!==t&&(Me=m,b=wl(b)),m=b,m===t&&(m=Q,b=qb(),b!==t&&(Me=m,b=tg(b)),m=b,m===t&&(m=Q,b=Rue(),b!==t&&(Me=m,b=po(b)),m=b))),m}function m1(){var m,b;return m=Q,b=w1(),b!==t&&(Me=m,b=rg(b)),m=b,m===t&&(m=Q,b=B1(),b!==t&&(Me=m,b=gp(b)),m=b,m===t&&(m=Q,b=qb(),b!==t&&(Me=m,b=fp(b)),m=b,m===t&&(m=Q,b=Tue(),b!==t&&(Me=m,b=vr(b)),m=b,m===t&&(m=Q,b=Lue(),b!==t&&(Me=m,b=po(b)),m=b)))),m}function kue(){var m,b,N;for(m=Q,b=[],se.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Co));N!==t;)b.push(N),se.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Co));return b!==t&&(Me=m,b=Dn(b)),m=b,m}function Rue(){var m,b,N;if(m=Q,b=[],N=E1(),N===t&&(ig.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Qt))),N!==t)for(;N!==t;)b.push(N),N=E1(),N===t&&(ig.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Qt)));else b=t;return b!==t&&(Me=m,b=Dn(b)),m=b,m}function E1(){var m,b,N;return m=Q,r.substr(Q,2)===Bl?(b=Bl,Q+=2):(b=t,I===0&&Qe(kn)),b!==t&&(Me=m,b=$n()),m=b,m===t&&(m=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Qe(gt)),b!==t?(mo.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(At)),N!==t?(Me=m,b=an(N),m=b):(Q=m,m=t)):(Q=m,m=t)),m}function Fue(){var m,b,N;for(m=Q,b=[],N=I1(),N===t&&(se.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Co)));N!==t;)b.push(N),N=I1(),N===t&&(se.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Co)));return b!==t&&(Me=m,b=Dn(b)),m=b,m}function I1(){var m,b,N;return m=Q,r.substr(Q,2)===S?(b=S,Q+=2):(b=t,I===0&&Qe(Tt)),b!==t&&(Me=m,b=ng()),m=b,m===t&&(m=Q,r.substr(Q,2)===Ql?(b=Ql,Q+=2):(b=t,I===0&&Qe(hp)),b!==t&&(Me=m,b=pp()),m=b,m===t&&(m=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Qe(gt)),b!==t?(dp.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Cp)),N!==t?(Me=m,b=mp(),m=b):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===G?(b=G,Q+=2):(b=t,I===0&&Qe(yt)),b!==t&&(Me=m,b=uA()),m=b,m===t&&(m=Q,r.substr(Q,2)===ji?(b=ji,Q+=2):(b=t,I===0&&Qe(bl)),b!==t&&(Me=m,b=Xe()),m=b,m===t&&(m=Q,r.substr(Q,2)===Aa?(b=Aa,Q+=2):(b=t,I===0&&Qe(sg)),b!==t&&(Me=m,b=bE()),m=b,m===t&&(m=Q,r.substr(Q,2)===Ep?(b=Ep,Q+=2):(b=t,I===0&&Qe(SE)),b!==t&&(Me=m,b=ar()),m=b,m===t&&(m=Q,r.substr(Q,2)===Rn?(b=Rn,Q+=2):(b=t,I===0&&Qe(Sl)),b!==t&&(Me=m,b=Ip()),m=b,m===t&&(m=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Qe(gt)),b!==t?(Ts.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(la)),N!==t?(Me=m,b=an(N),m=b):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Nue()))))))))),m}function Nue(){var m,b,N,U,ce,Se,ht,Bt,Jr,hi,rs,Jb;return m=Q,r.charCodeAt(Q)===92?(b=es,Q++):(b=t,I===0&&Qe(gt)),b!==t?(N=Gb(),N!==t?(Me=m,b=An(N),m=b):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===Te?(b=Te,Q+=2):(b=t,I===0&&Qe(og)),b!==t?(N=Q,U=Q,ce=Gb(),ce!==t?(Se=Ln(),Se!==t?(ce=[ce,Se],U=ce):(Q=U,U=t)):(Q=U,U=t),U===t&&(U=Gb()),U!==t?N=r.substring(N,Q):N=U,N!==t?(Me=m,b=An(N),m=b):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===vl?(b=vl,Q+=2):(b=t,I===0&&Qe(Os)),b!==t?(N=Q,U=Q,ce=Ln(),ce!==t?(Se=Ln(),Se!==t?(ht=Ln(),ht!==t?(Bt=Ln(),Bt!==t?(ce=[ce,Se,ht,Bt],U=ce):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t),U!==t?N=r.substring(N,Q):N=U,N!==t?(Me=m,b=An(N),m=b):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===xl?(b=xl,Q+=2):(b=t,I===0&&Qe(gA)),b!==t?(N=Q,U=Q,ce=Ln(),ce!==t?(Se=Ln(),Se!==t?(ht=Ln(),ht!==t?(Bt=Ln(),Bt!==t?(Jr=Ln(),Jr!==t?(hi=Ln(),hi!==t?(rs=Ln(),rs!==t?(Jb=Ln(),Jb!==t?(ce=[ce,Se,ht,Bt,Jr,hi,rs,Jb],U=ce):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t)):(Q=U,U=t),U!==t?N=r.substring(N,Q):N=U,N!==t?(Me=m,b=ag(N),m=b):(Q=m,m=t)):(Q=m,m=t)))),m}function Gb(){var m;return Ag.test(r.charAt(Q))?(m=r.charAt(Q),Q++):(m=t,I===0&&Qe(ca)),m}function Ln(){var m;return ua.test(r.charAt(Q))?(m=r.charAt(Q),Q++):(m=t,I===0&&Qe(rt)),m}function Lue(){var m,b,N,U,ce;if(m=Q,b=[],N=Q,r.charCodeAt(Q)===92?(U=es,Q++):(U=t,I===0&&Qe(gt)),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Qe(Eo)),ce!==t?(Me=N,U=an(ce),N=U):(Q=N,N=t)):(Q=N,N=t),N===t&&(N=Q,U=Q,I++,ce=b1(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Qe(Eo)),ce!==t?(Me=N,U=an(ce),N=U):(Q=N,N=t)):(Q=N,N=t)),N!==t)for(;N!==t;)b.push(N),N=Q,r.charCodeAt(Q)===92?(U=es,Q++):(U=t,I===0&&Qe(gt)),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Qe(Eo)),ce!==t?(Me=N,U=an(ce),N=U):(Q=N,N=t)):(Q=N,N=t),N===t&&(N=Q,U=Q,I++,ce=b1(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Qe(Eo)),ce!==t?(Me=N,U=an(ce),N=U):(Q=N,N=t)):(Q=N,N=t));else b=t;return b!==t&&(Me=m,b=Dn(b)),m=b,m}function Yb(){var m,b,N,U,ce,Se;if(m=Q,r.charCodeAt(Q)===45?(b=fA,Q++):(b=t,I===0&&Qe(Pl)),b===t&&(r.charCodeAt(Q)===43?(b=Ms,Q++):(b=t,I===0&&Qe(Dl))),b===t&&(b=null),b!==t){if(N=[],qe.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Qe(ne)),U!==t)for(;U!==t;)N.push(U),qe.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Qe(ne));else N=t;if(N!==t)if(r.charCodeAt(Q)===46?(U=vE,Q++):(U=t,I===0&&Qe(yp)),U!==t){if(ce=[],qe.test(r.charAt(Q))?(Se=r.charAt(Q),Q++):(Se=t,I===0&&Qe(ne)),Se!==t)for(;Se!==t;)ce.push(Se),qe.test(r.charAt(Q))?(Se=r.charAt(Q),Q++):(Se=t,I===0&&Qe(ne));else ce=t;ce!==t?(Me=m,b=lg(b,N,ce),m=b):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;if(m===t){if(m=Q,r.charCodeAt(Q)===45?(b=fA,Q++):(b=t,I===0&&Qe(Pl)),b===t&&(r.charCodeAt(Q)===43?(b=Ms,Q++):(b=t,I===0&&Qe(Dl))),b===t&&(b=null),b!==t){if(N=[],qe.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Qe(ne)),U!==t)for(;U!==t;)N.push(U),qe.test(r.charAt(Q))?(U=r.charAt(Q),Q++):(U=t,I===0&&Qe(ne));else N=t;N!==t?(Me=m,b=wp(b,N),m=b):(Q=m,m=t)}else Q=m,m=t;if(m===t&&(m=Q,b=qb(),b!==t&&(Me=m,b=xE(b)),m=b,m===t&&(m=Q,b=Rl(),b!==t&&(Me=m,b=kl(b)),m=b,m===t)))if(m=Q,r.charCodeAt(Q)===40?(b=ge,Q++):(b=t,I===0&&Qe(re)),b!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();if(N!==t)if(U=y1(),U!==t){for(ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();ce!==t?(r.charCodeAt(Q)===41?(Se=O,Q++):(Se=t,I===0&&Qe(F)),Se!==t?(Me=m,b=PE(U),m=b):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t}return m}function jb(){var m,b,N,U,ce,Se,ht,Bt;if(m=Q,b=Yb(),b!==t){for(N=[],U=Q,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(Q)===42?(Se=cg,Q++):(Se=t,I===0&&Qe(hA)),Se===t&&(r.charCodeAt(Q)===47?(Se=Rr,Q++):(Se=t,I===0&&Qe(DE))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=Yb(),Bt!==t?(Me=U,ce=Ks(b,Se,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t;for(;U!==t;){for(N.push(U),U=Q,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(Q)===42?(Se=cg,Q++):(Se=t,I===0&&Qe(hA)),Se===t&&(r.charCodeAt(Q)===47?(Se=Rr,Q++):(Se=t,I===0&&Qe(DE))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=Yb(),Bt!==t?(Me=U,ce=Ks(b,Se,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t}N!==t?(Me=m,b=Us(b,N),m=b):(Q=m,m=t)}else Q=m,m=t;return m}function y1(){var m,b,N,U,ce,Se,ht,Bt;if(m=Q,b=jb(),b!==t){for(N=[],U=Q,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(Q)===43?(Se=Ms,Q++):(Se=t,I===0&&Qe(Dl)),Se===t&&(r.charCodeAt(Q)===45?(Se=fA,Q++):(Se=t,I===0&&Qe(Pl))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=jb(),Bt!==t?(Me=U,ce=ug(b,Se,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t;for(;U!==t;){for(N.push(U),U=Q,ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();if(ce!==t)if(r.charCodeAt(Q)===43?(Se=Ms,Q++):(Se=t,I===0&&Qe(Dl)),Se===t&&(r.charCodeAt(Q)===45?(Se=fA,Q++):(Se=t,I===0&&Qe(Pl))),Se!==t){for(ht=[],Bt=He();Bt!==t;)ht.push(Bt),Bt=He();ht!==t?(Bt=jb(),Bt!==t?(Me=U,ce=ug(b,Se,Bt),U=ce):(Q=U,U=t)):(Q=U,U=t)}else Q=U,U=t;else Q=U,U=t}N!==t?(Me=m,b=Us(b,N),m=b):(Q=m,m=t)}else Q=m,m=t;return m}function w1(){var m,b,N,U,ce,Se;if(m=Q,r.substr(Q,3)===pA?(b=pA,Q+=3):(b=t,I===0&&Qe(R)),b!==t){for(N=[],U=He();U!==t;)N.push(U),U=He();if(N!==t)if(U=y1(),U!==t){for(ce=[],Se=He();Se!==t;)ce.push(Se),Se=He();ce!==t?(r.substr(Q,2)===q?(Se=q,Q+=2):(Se=t,I===0&&Qe(Ce)),Se!==t?(Me=m,b=Ke(U),m=b):(Q=m,m=t)):(Q=m,m=t)}else Q=m,m=t;else Q=m,m=t}else Q=m,m=t;return m}function B1(){var m,b,N,U;return m=Q,r.substr(Q,2)===Re?(b=Re,Q+=2):(b=t,I===0&&Qe(ze)),b!==t?(N=Mr(),N!==t?(r.charCodeAt(Q)===41?(U=O,Q++):(U=t,I===0&&Qe(F)),U!==t?(Me=m,b=dt(N),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m}function qb(){var m,b,N,U,ce,Se;return m=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Qe(Fn)),b!==t?(N=Rl(),N!==t?(r.substr(Q,2)===Db?(U=Db,Q+=2):(U=t,I===0&&Qe($M)),U!==t?(ce=f1(),ce!==t?(r.charCodeAt(Q)===125?(Se=Fe,Q++):(Se=t,I===0&&Qe(Ne)),Se!==t?(Me=m,b=e1(N,ce),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Qe(Fn)),b!==t?(N=Rl(),N!==t?(r.substr(Q,3)===kb?(U=kb,Q+=3):(U=t,I===0&&Qe(t1)),U!==t?(Me=m,b=r1(N),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Qe(Fn)),b!==t?(N=Rl(),N!==t?(r.substr(Q,2)===Rb?(U=Rb,Q+=2):(U=t,I===0&&Qe(i1)),U!==t?(ce=f1(),ce!==t?(r.charCodeAt(Q)===125?(Se=Fe,Q++):(Se=t,I===0&&Qe(Ne)),Se!==t?(Me=m,b=n1(N,ce),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Qe(Fn)),b!==t?(N=Rl(),N!==t?(r.substr(Q,3)===Fb?(U=Fb,Q+=3):(U=t,I===0&&Qe(s1)),U!==t?(Me=m,b=o1(N),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.substr(Q,2)===Ft?(b=Ft,Q+=2):(b=t,I===0&&Qe(Fn)),b!==t?(N=Rl(),N!==t?(r.charCodeAt(Q)===125?(U=Fe,Q++):(U=t,I===0&&Qe(Ne)),U!==t?(Me=m,b=Nb(N),m=b):(Q=m,m=t)):(Q=m,m=t)):(Q=m,m=t),m===t&&(m=Q,r.charCodeAt(Q)===36?(b=a1,Q++):(b=t,I===0&&Qe(A1)),b!==t?(N=Rl(),N!==t?(Me=m,b=Nb(N),m=b):(Q=m,m=t)):(Q=m,m=t)))))),m}function Tue(){var m,b,N;return m=Q,b=Oue(),b!==t?(Me=Q,N=l1(b),N?N=void 0:N=t,N!==t?(Me=m,b=c1(b),m=b):(Q=m,m=t)):(Q=m,m=t),m}function Oue(){var m,b,N,U,ce;if(m=Q,b=[],N=Q,U=Q,I++,ce=S1(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Qe(Eo)),ce!==t?(Me=N,U=an(ce),N=U):(Q=N,N=t)):(Q=N,N=t),N!==t)for(;N!==t;)b.push(N),N=Q,U=Q,I++,ce=S1(),I--,ce===t?U=void 0:(Q=U,U=t),U!==t?(r.length>Q?(ce=r.charAt(Q),Q++):(ce=t,I===0&&Qe(Eo)),ce!==t?(Me=N,U=an(ce),N=U):(Q=N,N=t)):(Q=N,N=t);else b=t;return b!==t&&(Me=m,b=Dn(b)),m=b,m}function Q1(){var m,b,N;if(m=Q,b=[],Lb.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Tb)),N!==t)for(;N!==t;)b.push(N),Lb.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Tb));else b=t;return b!==t&&(Me=m,b=Ob()),m=b,m}function Rl(){var m,b,N;if(m=Q,b=[],Mb.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Kb)),N!==t)for(;N!==t;)b.push(N),Mb.test(r.charAt(Q))?(N=r.charAt(Q),Q++):(N=t,I===0&&Qe(Kb));else b=t;return b!==t&&(Me=m,b=Ob()),m=b,m}function b1(){var m;return u1.test(r.charAt(Q))?(m=r.charAt(Q),Q++):(m=t,I===0&&Qe(gg)),m}function S1(){var m;return Ub.test(r.charAt(Q))?(m=r.charAt(Q),Q++):(m=t,I===0&&Qe(Hb)),m}function He(){var m,b;if(m=[],kE.test(r.charAt(Q))?(b=r.charAt(Q),Q++):(b=t,I===0&&Qe(RE)),b!==t)for(;b!==t;)m.push(b),kE.test(r.charAt(Q))?(b=r.charAt(Q),Q++):(b=t,I===0&&Qe(RE));else m=t;return m}if(k=n(),k!==t&&Q===r.length)return k;throw k!==t&&Q{"use strict";function Mge(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function Ul(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,Ul)}Mge(Ul,Error);Ul.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;gH&&(H=v,j=[]),j.push(ne))}function Ne(ne,Y){return new Ul(ne,null,null,Y)}function oe(ne,Y,pe){return new Ul(Ul.buildMessage(ne,Y),ne,Y,pe)}function le(){var ne,Y,pe,ie;return ne=v,Y=we(),Y!==t?(r.charCodeAt(v)===47?(pe=s,v++):(pe=t,$===0&&Fe(o)),pe!==t?(ie=we(),ie!==t?(D=ne,Y=a(Y,ie),ne=Y):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t),ne===t&&(ne=v,Y=we(),Y!==t&&(D=ne,Y=l(Y)),ne=Y),ne}function we(){var ne,Y,pe,ie;return ne=v,Y=fe(),Y!==t?(r.charCodeAt(v)===64?(pe=c,v++):(pe=t,$===0&&Fe(u)),pe!==t?(ie=qe(),ie!==t?(D=ne,Y=g(Y,ie),ne=Y):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t),ne===t&&(ne=v,Y=fe(),Y!==t&&(D=ne,Y=f(Y)),ne=Y),ne}function fe(){var ne,Y,pe,ie,de;return ne=v,r.charCodeAt(v)===64?(Y=c,v++):(Y=t,$===0&&Fe(u)),Y!==t?(pe=Ae(),pe!==t?(r.charCodeAt(v)===47?(ie=s,v++):(ie=t,$===0&&Fe(o)),ie!==t?(de=Ae(),de!==t?(D=ne,Y=h(),ne=Y):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t)):(v=ne,ne=t),ne===t&&(ne=v,Y=Ae(),Y!==t&&(D=ne,Y=h()),ne=Y),ne}function Ae(){var ne,Y,pe;if(ne=v,Y=[],p.test(r.charAt(v))?(pe=r.charAt(v),v++):(pe=t,$===0&&Fe(C)),pe!==t)for(;pe!==t;)Y.push(pe),p.test(r.charAt(v))?(pe=r.charAt(v),v++):(pe=t,$===0&&Fe(C));else Y=t;return Y!==t&&(D=ne,Y=h()),ne=Y,ne}function qe(){var ne,Y,pe;if(ne=v,Y=[],y.test(r.charAt(v))?(pe=r.charAt(v),v++):(pe=t,$===0&&Fe(B)),pe!==t)for(;pe!==t;)Y.push(pe),y.test(r.charAt(v))?(pe=r.charAt(v),v++):(pe=t,$===0&&Fe(B));else Y=t;return Y!==t&&(D=ne,Y=h()),ne=Y,ne}if(V=n(),V!==t&&v===r.length)return V;throw V!==t&&v{"use strict";function UK(r){return typeof r>"u"||r===null}function Uge(r){return typeof r=="object"&&r!==null}function Hge(r){return Array.isArray(r)?r:UK(r)?[]:[r]}function Gge(r,e){var t,i,n,s;if(e)for(s=Object.keys(e),t=0,i=s.length;t{"use strict";function Op(r,e){Error.call(this),this.name="YAMLException",this.reason=r,this.mark=e,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Op.prototype=Object.create(Error.prototype);Op.prototype.constructor=Op;Op.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t};HK.exports=Op});var jK=w((pXe,YK)=>{"use strict";var GK=Gl();function SS(r,e,t,i,n){this.name=r,this.buffer=e,this.position=t,this.line=i,this.column=n}SS.prototype.getSnippet=function(e,t){var i,n,s,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,i="",n=this.position;n>0&&`\0\r -\x85\u2028\u2029`.indexOf(this.buffer.charAt(n-1))===-1;)if(n-=1,this.position-n>t/2-1){i=" ... ",n+=5;break}for(s="",o=this.position;ot/2-1){s=" ... ",o-=5;break}return a=this.buffer.slice(n,o),GK.repeat(" ",e)+i+a+s+` -`+GK.repeat(" ",e+this.position-n+i.length)+"^"};SS.prototype.toString=function(e){var t,i="";return this.name&&(i+='in "'+this.name+'" '),i+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet(),t&&(i+=`: -`+t)),i};YK.exports=SS});var si=w((dXe,JK)=>{"use strict";var qK=Qg(),qge=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],Jge=["scalar","sequence","mapping"];function Wge(r){var e={};return r!==null&&Object.keys(r).forEach(function(t){r[t].forEach(function(i){e[String(i)]=t})}),e}function zge(r,e){if(e=e||{},Object.keys(e).forEach(function(t){if(qge.indexOf(t)===-1)throw new qK('Unknown option "'+t+'" is met in definition of "'+r+'" YAML type.')}),this.tag=r,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(t){return t},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=Wge(e.styleAliases||null),Jge.indexOf(this.kind)===-1)throw new qK('Unknown kind "'+this.kind+'" is specified for "'+r+'" YAML type.')}JK.exports=zge});var Yl=w((CXe,zK)=>{"use strict";var WK=Gl(),nI=Qg(),Vge=si();function vS(r,e,t){var i=[];return r.include.forEach(function(n){t=vS(n,e,t)}),r[e].forEach(function(n){t.forEach(function(s,o){s.tag===n.tag&&s.kind===n.kind&&i.push(o)}),t.push(n)}),t.filter(function(n,s){return i.indexOf(s)===-1})}function Xge(){var r={scalar:{},sequence:{},mapping:{},fallback:{}},e,t;function i(n){r[n.kind][n.tag]=r.fallback[n.tag]=n}for(e=0,t=arguments.length;e{"use strict";var _ge=si();VK.exports=new _ge("tag:yaml.org,2002:str",{kind:"scalar",construct:function(r){return r!==null?r:""}})});var ZK=w((EXe,_K)=>{"use strict";var Zge=si();_K.exports=new Zge("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(r){return r!==null?r:[]}})});var eU=w((IXe,$K)=>{"use strict";var $ge=si();$K.exports=new $ge("tag:yaml.org,2002:map",{kind:"mapping",construct:function(r){return r!==null?r:{}}})});var sI=w((yXe,tU)=>{"use strict";var efe=Yl();tU.exports=new efe({explicit:[XK(),ZK(),eU()]})});var iU=w((wXe,rU)=>{"use strict";var tfe=si();function rfe(r){if(r===null)return!0;var e=r.length;return e===1&&r==="~"||e===4&&(r==="null"||r==="Null"||r==="NULL")}function ife(){return null}function nfe(r){return r===null}rU.exports=new tfe("tag:yaml.org,2002:null",{kind:"scalar",resolve:rfe,construct:ife,predicate:nfe,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})});var sU=w((BXe,nU)=>{"use strict";var sfe=si();function ofe(r){if(r===null)return!1;var e=r.length;return e===4&&(r==="true"||r==="True"||r==="TRUE")||e===5&&(r==="false"||r==="False"||r==="FALSE")}function afe(r){return r==="true"||r==="True"||r==="TRUE"}function Afe(r){return Object.prototype.toString.call(r)==="[object Boolean]"}nU.exports=new sfe("tag:yaml.org,2002:bool",{kind:"scalar",resolve:ofe,construct:afe,predicate:Afe,represent:{lowercase:function(r){return r?"true":"false"},uppercase:function(r){return r?"TRUE":"FALSE"},camelcase:function(r){return r?"True":"False"}},defaultStyle:"lowercase"})});var aU=w((QXe,oU)=>{"use strict";var lfe=Gl(),cfe=si();function ufe(r){return 48<=r&&r<=57||65<=r&&r<=70||97<=r&&r<=102}function gfe(r){return 48<=r&&r<=55}function ffe(r){return 48<=r&&r<=57}function hfe(r){if(r===null)return!1;var e=r.length,t=0,i=!1,n;if(!e)return!1;if(n=r[t],(n==="-"||n==="+")&&(n=r[++t]),n==="0"){if(t+1===e)return!0;if(n=r[++t],n==="b"){for(t++;t=0?"0b"+r.toString(2):"-0b"+r.toString(2).slice(1)},octal:function(r){return r>=0?"0"+r.toString(8):"-0"+r.toString(8).slice(1)},decimal:function(r){return r.toString(10)},hexadecimal:function(r){return r>=0?"0x"+r.toString(16).toUpperCase():"-0x"+r.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})});var cU=w((bXe,lU)=>{"use strict";var AU=Gl(),Cfe=si(),mfe=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function Efe(r){return!(r===null||!mfe.test(r)||r[r.length-1]==="_")}function Ife(r){var e,t,i,n;return e=r.replace(/_/g,"").toLowerCase(),t=e[0]==="-"?-1:1,n=[],"+-".indexOf(e[0])>=0&&(e=e.slice(1)),e===".inf"?t===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:e===".nan"?NaN:e.indexOf(":")>=0?(e.split(":").forEach(function(s){n.unshift(parseFloat(s,10))}),e=0,i=1,n.forEach(function(s){e+=s*i,i*=60}),t*e):t*parseFloat(e,10)}var yfe=/^[-+]?[0-9]+e/;function wfe(r,e){var t;if(isNaN(r))switch(e){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===r)switch(e){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===r)switch(e){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(AU.isNegativeZero(r))return"-0.0";return t=r.toString(10),yfe.test(t)?t.replace("e",".e"):t}function Bfe(r){return Object.prototype.toString.call(r)==="[object Number]"&&(r%1!==0||AU.isNegativeZero(r))}lU.exports=new Cfe("tag:yaml.org,2002:float",{kind:"scalar",resolve:Efe,construct:Ife,predicate:Bfe,represent:wfe,defaultStyle:"lowercase"})});var xS=w((SXe,uU)=>{"use strict";var Qfe=Yl();uU.exports=new Qfe({include:[sI()],implicit:[iU(),sU(),aU(),cU()]})});var PS=w((vXe,gU)=>{"use strict";var bfe=Yl();gU.exports=new bfe({include:[xS()]})});var dU=w((xXe,pU)=>{"use strict";var Sfe=si(),fU=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),hU=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function vfe(r){return r===null?!1:fU.exec(r)!==null||hU.exec(r)!==null}function xfe(r){var e,t,i,n,s,o,a,l=0,c=null,u,g,f;if(e=fU.exec(r),e===null&&(e=hU.exec(r)),e===null)throw new Error("Date resolve error");if(t=+e[1],i=+e[2]-1,n=+e[3],!e[4])return new Date(Date.UTC(t,i,n));if(s=+e[4],o=+e[5],a=+e[6],e[7]){for(l=e[7].slice(0,3);l.length<3;)l+="0";l=+l}return e[9]&&(u=+e[10],g=+(e[11]||0),c=(u*60+g)*6e4,e[9]==="-"&&(c=-c)),f=new Date(Date.UTC(t,i,n,s,o,a,l)),c&&f.setTime(f.getTime()-c),f}function Pfe(r){return r.toISOString()}pU.exports=new Sfe("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:vfe,construct:xfe,instanceOf:Date,represent:Pfe})});var mU=w((PXe,CU)=>{"use strict";var Dfe=si();function kfe(r){return r==="<<"||r===null}CU.exports=new Dfe("tag:yaml.org,2002:merge",{kind:"scalar",resolve:kfe})});var yU=w((DXe,IU)=>{"use strict";var jl;try{EU=J,jl=EU("buffer").Buffer}catch{}var EU,Rfe=si(),DS=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= -\r`;function Ffe(r){if(r===null)return!1;var e,t,i=0,n=r.length,s=DS;for(t=0;t64)){if(e<0)return!1;i+=6}return i%8===0}function Nfe(r){var e,t,i=r.replace(/[\r\n=]/g,""),n=i.length,s=DS,o=0,a=[];for(e=0;e>16&255),a.push(o>>8&255),a.push(o&255)),o=o<<6|s.indexOf(i.charAt(e));return t=n%4*6,t===0?(a.push(o>>16&255),a.push(o>>8&255),a.push(o&255)):t===18?(a.push(o>>10&255),a.push(o>>2&255)):t===12&&a.push(o>>4&255),jl?jl.from?jl.from(a):new jl(a):a}function Lfe(r){var e="",t=0,i,n,s=r.length,o=DS;for(i=0;i>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]),t=(t<<8)+r[i];return n=s%3,n===0?(e+=o[t>>18&63],e+=o[t>>12&63],e+=o[t>>6&63],e+=o[t&63]):n===2?(e+=o[t>>10&63],e+=o[t>>4&63],e+=o[t<<2&63],e+=o[64]):n===1&&(e+=o[t>>2&63],e+=o[t<<4&63],e+=o[64],e+=o[64]),e}function Tfe(r){return jl&&jl.isBuffer(r)}IU.exports=new Rfe("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Ffe,construct:Nfe,predicate:Tfe,represent:Lfe})});var BU=w((kXe,wU)=>{"use strict";var Ofe=si(),Mfe=Object.prototype.hasOwnProperty,Kfe=Object.prototype.toString;function Ufe(r){if(r===null)return!0;var e=[],t,i,n,s,o,a=r;for(t=0,i=a.length;t{"use strict";var Gfe=si(),Yfe=Object.prototype.toString;function jfe(r){if(r===null)return!0;var e,t,i,n,s,o=r;for(s=new Array(o.length),e=0,t=o.length;e{"use strict";var Jfe=si(),Wfe=Object.prototype.hasOwnProperty;function zfe(r){if(r===null)return!0;var e,t=r;for(e in t)if(Wfe.call(t,e)&&t[e]!==null)return!1;return!0}function Vfe(r){return r!==null?r:{}}SU.exports=new Jfe("tag:yaml.org,2002:set",{kind:"mapping",resolve:zfe,construct:Vfe})});var Sg=w((NXe,xU)=>{"use strict";var Xfe=Yl();xU.exports=new Xfe({include:[PS()],implicit:[dU(),mU()],explicit:[yU(),BU(),bU(),vU()]})});var DU=w((LXe,PU)=>{"use strict";var _fe=si();function Zfe(){return!0}function $fe(){}function ehe(){return""}function the(r){return typeof r>"u"}PU.exports=new _fe("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:Zfe,construct:$fe,predicate:the,represent:ehe})});var RU=w((TXe,kU)=>{"use strict";var rhe=si();function ihe(r){if(r===null||r.length===0)return!1;var e=r,t=/\/([gim]*)$/.exec(r),i="";return!(e[0]==="/"&&(t&&(i=t[1]),i.length>3||e[e.length-i.length-1]!=="/"))}function nhe(r){var e=r,t=/\/([gim]*)$/.exec(r),i="";return e[0]==="/"&&(t&&(i=t[1]),e=e.slice(1,e.length-i.length-1)),new RegExp(e,i)}function she(r){var e="/"+r.source+"/";return r.global&&(e+="g"),r.multiline&&(e+="m"),r.ignoreCase&&(e+="i"),e}function ohe(r){return Object.prototype.toString.call(r)==="[object RegExp]"}kU.exports=new rhe("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:ihe,construct:nhe,predicate:ohe,represent:she})});var LU=w((OXe,NU)=>{"use strict";var oI;try{FU=J,oI=FU("esprima")}catch{typeof window<"u"&&(oI=window.esprima)}var FU,ahe=si();function Ahe(r){if(r===null)return!1;try{var e="("+r+")",t=oI.parse(e,{range:!0});return!(t.type!=="Program"||t.body.length!==1||t.body[0].type!=="ExpressionStatement"||t.body[0].expression.type!=="ArrowFunctionExpression"&&t.body[0].expression.type!=="FunctionExpression")}catch{return!1}}function lhe(r){var e="("+r+")",t=oI.parse(e,{range:!0}),i=[],n;if(t.type!=="Program"||t.body.length!==1||t.body[0].type!=="ExpressionStatement"||t.body[0].expression.type!=="ArrowFunctionExpression"&&t.body[0].expression.type!=="FunctionExpression")throw new Error("Failed to resolve function");return t.body[0].expression.params.forEach(function(s){i.push(s.name)}),n=t.body[0].expression.body.range,t.body[0].expression.body.type==="BlockStatement"?new Function(i,e.slice(n[0]+1,n[1]-1)):new Function(i,"return "+e.slice(n[0],n[1]))}function che(r){return r.toString()}function uhe(r){return Object.prototype.toString.call(r)==="[object Function]"}NU.exports=new ahe("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:Ahe,construct:lhe,predicate:uhe,represent:che})});var Mp=w((MXe,OU)=>{"use strict";var TU=Yl();OU.exports=TU.DEFAULT=new TU({include:[Sg()],explicit:[DU(),RU(),LU()]})});var r2=w((KXe,Kp)=>{"use strict";var da=Gl(),jU=Qg(),ghe=jK(),qU=Sg(),fhe=Mp(),wA=Object.prototype.hasOwnProperty,aI=1,JU=2,WU=3,AI=4,kS=1,hhe=2,MU=3,phe=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,dhe=/[\x85\u2028\u2029]/,Che=/[,\[\]\{\}]/,zU=/^(?:!|!!|![a-z\-]+!)$/i,VU=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function KU(r){return Object.prototype.toString.call(r)}function Bo(r){return r===10||r===13}function Jl(r){return r===9||r===32}function un(r){return r===9||r===32||r===10||r===13}function vg(r){return r===44||r===91||r===93||r===123||r===125}function mhe(r){var e;return 48<=r&&r<=57?r-48:(e=r|32,97<=e&&e<=102?e-97+10:-1)}function Ehe(r){return r===120?2:r===117?4:r===85?8:0}function Ihe(r){return 48<=r&&r<=57?r-48:-1}function UU(r){return r===48?"\0":r===97?"\x07":r===98?"\b":r===116||r===9?" ":r===110?` -`:r===118?"\v":r===102?"\f":r===114?"\r":r===101?"\x1B":r===32?" ":r===34?'"':r===47?"/":r===92?"\\":r===78?"\x85":r===95?"\xA0":r===76?"\u2028":r===80?"\u2029":""}function yhe(r){return r<=65535?String.fromCharCode(r):String.fromCharCode((r-65536>>10)+55296,(r-65536&1023)+56320)}var XU=new Array(256),_U=new Array(256);for(ql=0;ql<256;ql++)XU[ql]=UU(ql)?1:0,_U[ql]=UU(ql);var ql;function whe(r,e){this.input=r,this.filename=e.filename||null,this.schema=e.schema||fhe,this.onWarning=e.onWarning||null,this.legacy=e.legacy||!1,this.json=e.json||!1,this.listener=e.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=r.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function ZU(r,e){return new jU(e,new ghe(r.filename,r.input,r.position,r.line,r.position-r.lineStart))}function ft(r,e){throw ZU(r,e)}function lI(r,e){r.onWarning&&r.onWarning.call(null,ZU(r,e))}var HU={YAML:function(e,t,i){var n,s,o;e.version!==null&&ft(e,"duplication of %YAML directive"),i.length!==1&&ft(e,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(i[0]),n===null&&ft(e,"ill-formed argument of the YAML directive"),s=parseInt(n[1],10),o=parseInt(n[2],10),s!==1&&ft(e,"unacceptable YAML version of the document"),e.version=i[0],e.checkLineBreaks=o<2,o!==1&&o!==2&&lI(e,"unsupported YAML version of the document")},TAG:function(e,t,i){var n,s;i.length!==2&&ft(e,"TAG directive accepts exactly two arguments"),n=i[0],s=i[1],zU.test(n)||ft(e,"ill-formed tag handle (first argument) of the TAG directive"),wA.call(e.tagMap,n)&&ft(e,'there is a previously declared suffix for "'+n+'" tag handle'),VU.test(s)||ft(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=s}};function yA(r,e,t,i){var n,s,o,a;if(e1&&(r.result+=da.repeat(` -`,e-1))}function Bhe(r,e,t){var i,n,s,o,a,l,c,u,g=r.kind,f=r.result,h;if(h=r.input.charCodeAt(r.position),un(h)||vg(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(n=r.input.charCodeAt(r.position+1),un(n)||t&&vg(n)))return!1;for(r.kind="scalar",r.result="",s=o=r.position,a=!1;h!==0;){if(h===58){if(n=r.input.charCodeAt(r.position+1),un(n)||t&&vg(n))break}else if(h===35){if(i=r.input.charCodeAt(r.position-1),un(i))break}else{if(r.position===r.lineStart&&cI(r)||t&&vg(h))break;if(Bo(h))if(l=r.line,c=r.lineStart,u=r.lineIndent,zr(r,!1,-1),r.lineIndent>=e){a=!0,h=r.input.charCodeAt(r.position);continue}else{r.position=o,r.line=l,r.lineStart=c,r.lineIndent=u;break}}a&&(yA(r,s,o,!1),FS(r,r.line-l),s=o=r.position,a=!1),Jl(h)||(o=r.position+1),h=r.input.charCodeAt(++r.position)}return yA(r,s,o,!1),r.result?!0:(r.kind=g,r.result=f,!1)}function Qhe(r,e){var t,i,n;if(t=r.input.charCodeAt(r.position),t!==39)return!1;for(r.kind="scalar",r.result="",r.position++,i=n=r.position;(t=r.input.charCodeAt(r.position))!==0;)if(t===39)if(yA(r,i,r.position,!0),t=r.input.charCodeAt(++r.position),t===39)i=r.position,r.position++,n=r.position;else return!0;else Bo(t)?(yA(r,i,n,!0),FS(r,zr(r,!1,e)),i=n=r.position):r.position===r.lineStart&&cI(r)?ft(r,"unexpected end of the document within a single quoted scalar"):(r.position++,n=r.position);ft(r,"unexpected end of the stream within a single quoted scalar")}function bhe(r,e){var t,i,n,s,o,a;if(a=r.input.charCodeAt(r.position),a!==34)return!1;for(r.kind="scalar",r.result="",r.position++,t=i=r.position;(a=r.input.charCodeAt(r.position))!==0;){if(a===34)return yA(r,t,r.position,!0),r.position++,!0;if(a===92){if(yA(r,t,r.position,!0),a=r.input.charCodeAt(++r.position),Bo(a))zr(r,!1,e);else if(a<256&&XU[a])r.result+=_U[a],r.position++;else if((o=Ehe(a))>0){for(n=o,s=0;n>0;n--)a=r.input.charCodeAt(++r.position),(o=mhe(a))>=0?s=(s<<4)+o:ft(r,"expected hexadecimal character");r.result+=yhe(s),r.position++}else ft(r,"unknown escape sequence");t=i=r.position}else Bo(a)?(yA(r,t,i,!0),FS(r,zr(r,!1,e)),t=i=r.position):r.position===r.lineStart&&cI(r)?ft(r,"unexpected end of the document within a double quoted scalar"):(r.position++,i=r.position)}ft(r,"unexpected end of the stream within a double quoted scalar")}function She(r,e){var t=!0,i,n=r.tag,s,o=r.anchor,a,l,c,u,g,f={},h,p,C,y;if(y=r.input.charCodeAt(r.position),y===91)l=93,g=!1,s=[];else if(y===123)l=125,g=!0,s={};else return!1;for(r.anchor!==null&&(r.anchorMap[r.anchor]=s),y=r.input.charCodeAt(++r.position);y!==0;){if(zr(r,!0,e),y=r.input.charCodeAt(r.position),y===l)return r.position++,r.tag=n,r.anchor=o,r.kind=g?"mapping":"sequence",r.result=s,!0;t||ft(r,"missed comma between flow collection entries"),p=h=C=null,c=u=!1,y===63&&(a=r.input.charCodeAt(r.position+1),un(a)&&(c=u=!0,r.position++,zr(r,!0,e))),i=r.line,Pg(r,e,aI,!1,!0),p=r.tag,h=r.result,zr(r,!0,e),y=r.input.charCodeAt(r.position),(u||r.line===i)&&y===58&&(c=!0,y=r.input.charCodeAt(++r.position),zr(r,!0,e),Pg(r,e,aI,!1,!0),C=r.result),g?xg(r,s,f,p,h,C):c?s.push(xg(r,null,f,p,h,C)):s.push(h),zr(r,!0,e),y=r.input.charCodeAt(r.position),y===44?(t=!0,y=r.input.charCodeAt(++r.position)):t=!1}ft(r,"unexpected end of the stream within a flow collection")}function vhe(r,e){var t,i,n=kS,s=!1,o=!1,a=e,l=0,c=!1,u,g;if(g=r.input.charCodeAt(r.position),g===124)i=!1;else if(g===62)i=!0;else return!1;for(r.kind="scalar",r.result="";g!==0;)if(g=r.input.charCodeAt(++r.position),g===43||g===45)kS===n?n=g===43?MU:hhe:ft(r,"repeat of a chomping mode identifier");else if((u=Ihe(g))>=0)u===0?ft(r,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?ft(r,"repeat of an indentation width identifier"):(a=e+u-1,o=!0);else break;if(Jl(g)){do g=r.input.charCodeAt(++r.position);while(Jl(g));if(g===35)do g=r.input.charCodeAt(++r.position);while(!Bo(g)&&g!==0)}for(;g!==0;){for(RS(r),r.lineIndent=0,g=r.input.charCodeAt(r.position);(!o||r.lineIndenta&&(a=r.lineIndent),Bo(g)){l++;continue}if(r.lineIndente)&&l!==0)ft(r,"bad indentation of a sequence entry");else if(r.lineIndente)&&(Pg(r,e,AI,!0,n)&&(p?f=r.result:h=r.result),p||(xg(r,c,u,g,f,h,s,o),g=f=h=null),zr(r,!0,-1),y=r.input.charCodeAt(r.position)),r.lineIndent>e&&y!==0)ft(r,"bad indentation of a mapping entry");else if(r.lineIndente?l=1:r.lineIndent===e?l=0:r.lineIndente?l=1:r.lineIndent===e?l=0:r.lineIndent tag; it should be "scalar", not "'+r.kind+'"'),g=0,f=r.implicitTypes.length;g tag; it should be "'+h.kind+'", not "'+r.kind+'"'),h.resolve(r.result)?(r.result=h.construct(r.result),r.anchor!==null&&(r.anchorMap[r.anchor]=r.result)):ft(r,"cannot resolve a node with !<"+r.tag+"> explicit tag")):ft(r,"unknown tag !<"+r.tag+">");return r.listener!==null&&r.listener("close",r),r.tag!==null||r.anchor!==null||u}function Rhe(r){var e=r.position,t,i,n,s=!1,o;for(r.version=null,r.checkLineBreaks=r.legacy,r.tagMap={},r.anchorMap={};(o=r.input.charCodeAt(r.position))!==0&&(zr(r,!0,-1),o=r.input.charCodeAt(r.position),!(r.lineIndent>0||o!==37));){for(s=!0,o=r.input.charCodeAt(++r.position),t=r.position;o!==0&&!un(o);)o=r.input.charCodeAt(++r.position);for(i=r.input.slice(t,r.position),n=[],i.length<1&&ft(r,"directive name must not be less than one character in length");o!==0;){for(;Jl(o);)o=r.input.charCodeAt(++r.position);if(o===35){do o=r.input.charCodeAt(++r.position);while(o!==0&&!Bo(o));break}if(Bo(o))break;for(t=r.position;o!==0&&!un(o);)o=r.input.charCodeAt(++r.position);n.push(r.input.slice(t,r.position))}o!==0&&RS(r),wA.call(HU,i)?HU[i](r,i,n):lI(r,'unknown document directive "'+i+'"')}if(zr(r,!0,-1),r.lineIndent===0&&r.input.charCodeAt(r.position)===45&&r.input.charCodeAt(r.position+1)===45&&r.input.charCodeAt(r.position+2)===45?(r.position+=3,zr(r,!0,-1)):s&&ft(r,"directives end mark is expected"),Pg(r,r.lineIndent-1,AI,!1,!0),zr(r,!0,-1),r.checkLineBreaks&&dhe.test(r.input.slice(e,r.position))&&lI(r,"non-ASCII line breaks are interpreted as content"),r.documents.push(r.result),r.position===r.lineStart&&cI(r)){r.input.charCodeAt(r.position)===46&&(r.position+=3,zr(r,!0,-1));return}if(r.position"u"&&(t=e,e=null);var i=$U(r,t);if(typeof e!="function")return i;for(var n=0,s=i.length;n"u"&&(t=e,e=null),e2(r,e,da.extend({schema:qU},t))}function Nhe(r,e){return t2(r,da.extend({schema:qU},e))}Kp.exports.loadAll=e2;Kp.exports.load=t2;Kp.exports.safeLoadAll=Fhe;Kp.exports.safeLoad=Nhe});var b2=w((UXe,OS)=>{"use strict";var Hp=Gl(),Gp=Qg(),Lhe=Mp(),The=Sg(),c2=Object.prototype.toString,u2=Object.prototype.hasOwnProperty,Ohe=9,Up=10,Mhe=13,Khe=32,Uhe=33,Hhe=34,g2=35,Ghe=37,Yhe=38,jhe=39,qhe=42,f2=44,Jhe=45,h2=58,Whe=61,zhe=62,Vhe=63,Xhe=64,p2=91,d2=93,_he=96,C2=123,Zhe=124,m2=125,Fi={};Fi[0]="\\0";Fi[7]="\\a";Fi[8]="\\b";Fi[9]="\\t";Fi[10]="\\n";Fi[11]="\\v";Fi[12]="\\f";Fi[13]="\\r";Fi[27]="\\e";Fi[34]='\\"';Fi[92]="\\\\";Fi[133]="\\N";Fi[160]="\\_";Fi[8232]="\\L";Fi[8233]="\\P";var $he=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function epe(r,e){var t,i,n,s,o,a,l;if(e===null)return{};for(t={},i=Object.keys(e),n=0,s=i.length;n0?r.charCodeAt(s-1):null,f=f&&s2(o,a)}else{for(s=0;si&&r[g+1]!==" ",g=s);else if(!Dg(o))return uI;a=s>0?r.charCodeAt(s-1):null,f=f&&s2(o,a)}c=c||u&&s-g-1>i&&r[g+1]!==" "}return!l&&!c?f&&!n(r)?I2:y2:t>9&&E2(r)?uI:c?B2:w2}function ope(r,e,t,i){r.dump=function(){if(e.length===0)return"''";if(!r.noCompatMode&&$he.indexOf(e)!==-1)return"'"+e+"'";var n=r.indent*Math.max(1,t),s=r.lineWidth===-1?-1:Math.max(Math.min(r.lineWidth,40),r.lineWidth-n),o=i||r.flowLevel>-1&&t>=r.flowLevel;function a(l){return rpe(r,l)}switch(spe(e,o,r.indent,s,a)){case I2:return e;case y2:return"'"+e.replace(/'/g,"''")+"'";case w2:return"|"+o2(e,r.indent)+a2(n2(e,n));case B2:return">"+o2(e,r.indent)+a2(n2(ape(e,s),n));case uI:return'"'+Ape(e,s)+'"';default:throw new Gp("impossible error: invalid scalar style")}}()}function o2(r,e){var t=E2(r)?String(e):"",i=r[r.length-1]===` -`,n=i&&(r[r.length-2]===` -`||r===` -`),s=n?"+":i?"":"-";return t+s+` -`}function a2(r){return r[r.length-1]===` -`?r.slice(0,-1):r}function ape(r,e){for(var t=/(\n+)([^\n]*)/g,i=function(){var c=r.indexOf(` -`);return c=c!==-1?c:r.length,t.lastIndex=c,A2(r.slice(0,c),e)}(),n=r[0]===` -`||r[0]===" ",s,o;o=t.exec(r);){var a=o[1],l=o[2];s=l[0]===" ",i+=a+(!n&&!s&&l!==""?` -`:"")+A2(l,e),n=s}return i}function A2(r,e){if(r===""||r[0]===" ")return r;for(var t=/ [^ ]/g,i,n=0,s,o=0,a=0,l="";i=t.exec(r);)a=i.index,a-n>e&&(s=o>n?o:a,l+=` -`+r.slice(n,s),n=s+1),o=a;return l+=` -`,r.length-n>e&&o>n?l+=r.slice(n,o)+` -`+r.slice(o+1):l+=r.slice(n),l.slice(1)}function Ape(r){for(var e="",t,i,n,s=0;s=55296&&t<=56319&&(i=r.charCodeAt(s+1),i>=56320&&i<=57343)){e+=i2((t-55296)*1024+i-56320+65536),s++;continue}n=Fi[t],e+=!n&&Dg(t)?r[s]:n||i2(t)}return e}function lpe(r,e,t){var i="",n=r.tag,s,o;for(s=0,o=t.length;s1024&&(u+="? "),u+=r.dump+(r.condenseFlow?'"':"")+":"+(r.condenseFlow?"":" "),Wl(r,e,c,!1,!1)&&(u+=r.dump,i+=u));r.tag=n,r.dump="{"+i+"}"}function gpe(r,e,t,i){var n="",s=r.tag,o=Object.keys(t),a,l,c,u,g,f;if(r.sortKeys===!0)o.sort();else if(typeof r.sortKeys=="function")o.sort(r.sortKeys);else if(r.sortKeys)throw new Gp("sortKeys must be a boolean or a function");for(a=0,l=o.length;a1024,g&&(r.dump&&Up===r.dump.charCodeAt(0)?f+="?":f+="? "),f+=r.dump,g&&(f+=NS(r,e)),Wl(r,e+1,u,!0,g)&&(r.dump&&Up===r.dump.charCodeAt(0)?f+=":":f+=": ",f+=r.dump,n+=f));r.tag=s,r.dump=n||"{}"}function l2(r,e,t){var i,n,s,o,a,l;for(n=t?r.explicitTypes:r.implicitTypes,s=0,o=n.length;s tag resolver accepts not "'+l+'" style');r.dump=i}return!0}return!1}function Wl(r,e,t,i,n,s){r.tag=null,r.dump=t,l2(r,t,!1)||l2(r,t,!0);var o=c2.call(r.dump);i&&(i=r.flowLevel<0||r.flowLevel>e);var a=o==="[object Object]"||o==="[object Array]",l,c;if(a&&(l=r.duplicates.indexOf(t),c=l!==-1),(r.tag!==null&&r.tag!=="?"||c||r.indent!==2&&e>0)&&(n=!1),c&&r.usedDuplicates[l])r.dump="*ref_"+l;else{if(a&&c&&!r.usedDuplicates[l]&&(r.usedDuplicates[l]=!0),o==="[object Object]")i&&Object.keys(r.dump).length!==0?(gpe(r,e,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(upe(r,e,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump));else if(o==="[object Array]"){var u=r.noArrayIndent&&e>0?e-1:e;i&&r.dump.length!==0?(cpe(r,u,r.dump,n),c&&(r.dump="&ref_"+l+r.dump)):(lpe(r,u,r.dump),c&&(r.dump="&ref_"+l+" "+r.dump))}else if(o==="[object String]")r.tag!=="?"&&ope(r,r.dump,e,s);else{if(r.skipInvalid)return!1;throw new Gp("unacceptable kind of an object to dump "+o)}r.tag!==null&&r.tag!=="?"&&(r.dump="!<"+r.tag+"> "+r.dump)}return!0}function fpe(r,e){var t=[],i=[],n,s;for(LS(r,t,i),n=0,s=i.length;n{"use strict";var gI=r2(),S2=b2();function fI(r){return function(){throw new Error("Function "+r+" is deprecated and cannot be used.")}}Fr.exports.Type=si();Fr.exports.Schema=Yl();Fr.exports.FAILSAFE_SCHEMA=sI();Fr.exports.JSON_SCHEMA=xS();Fr.exports.CORE_SCHEMA=PS();Fr.exports.DEFAULT_SAFE_SCHEMA=Sg();Fr.exports.DEFAULT_FULL_SCHEMA=Mp();Fr.exports.load=gI.load;Fr.exports.loadAll=gI.loadAll;Fr.exports.safeLoad=gI.safeLoad;Fr.exports.safeLoadAll=gI.safeLoadAll;Fr.exports.dump=S2.dump;Fr.exports.safeDump=S2.safeDump;Fr.exports.YAMLException=Qg();Fr.exports.MINIMAL_SCHEMA=sI();Fr.exports.SAFE_SCHEMA=Sg();Fr.exports.DEFAULT_SCHEMA=Mp();Fr.exports.scan=fI("scan");Fr.exports.parse=fI("parse");Fr.exports.compose=fI("compose");Fr.exports.addConstructor=fI("addConstructor")});var P2=w((GXe,x2)=>{"use strict";var ppe=v2();x2.exports=ppe});var k2=w((YXe,D2)=>{"use strict";function dpe(r,e){function t(){this.constructor=r}t.prototype=e.prototype,r.prototype=new t}function zl(r,e,t,i){this.message=r,this.expected=e,this.found=t,this.location=i,this.name="SyntaxError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,zl)}dpe(zl,Error);zl.buildMessage=function(r,e){var t={literal:function(c){return'"'+n(c.text)+'"'},class:function(c){var u="",g;for(g=0;g0){for(g=1,f=1;g({[Ke]:Ce})))},H=function(R){return R},j=function(R){return R},$=Ts("correct indentation"),V=" ",W=ar(" ",!1),Z=function(R){return R.length===pA*ug},A=function(R){return R.length===(pA+1)*ug},ae=function(){return pA++,!0},ge=function(){return pA--,!0},re=function(){return sg()},O=Ts("pseudostring"),F=/^[^\r\n\t ?:,\][{}#&*!|>'"%@`\-]/,ue=Rn(["\r",` -`," "," ","?",":",",","]","[","{","}","#","&","*","!","|",">","'",'"',"%","@","`","-"],!0,!1),he=/^[^\r\n\t ,\][{}:#"']/,ke=Rn(["\r",` -`," "," ",",","]","[","{","}",":","#",'"',"'"],!0,!1),Fe=function(){return sg().replace(/^ *| *$/g,"")},Ne="--",oe=ar("--",!1),le=/^[a-zA-Z\/0-9]/,we=Rn([["a","z"],["A","Z"],"/",["0","9"]],!1,!1),fe=/^[^\r\n\t :,]/,Ae=Rn(["\r",` -`," "," ",":",","],!0,!1),qe="null",ne=ar("null",!1),Y=function(){return null},pe="true",ie=ar("true",!1),de=function(){return!0},tt="false",Pt=ar("false",!1),It=function(){return!1},Or=Ts("string"),ii='"',gi=ar('"',!1),hr=function(){return""},fi=function(R){return R},ni=function(R){return R.join("")},Ls=/^[^"\\\0-\x1F\x7F]/,pr=Rn(['"',"\\",["\0",""],"\x7F"],!0,!1),Ei='\\"',_n=ar('\\"',!1),oa=function(){return'"'},aA="\\\\",eg=ar("\\\\",!1),Zn=function(){return"\\"},AA="\\/",aa=ar("\\/",!1),up=function(){return"/"},lA="\\b",cA=ar("\\b",!1),wr=function(){return"\b"},wl="\\f",tg=ar("\\f",!1),po=function(){return"\f"},rg="\\n",gp=ar("\\n",!1),fp=function(){return` -`},vr="\\r",se=ar("\\r",!1),Co=function(){return"\r"},Dn="\\t",ig=ar("\\t",!1),Qt=function(){return" "},Bl="\\u",kn=ar("\\u",!1),$n=function(R,q,Ce,Ke){return String.fromCharCode(parseInt(`0x${R}${q}${Ce}${Ke}`))},es=/^[0-9a-fA-F]/,gt=Rn([["0","9"],["a","f"],["A","F"]],!1,!1),mo=Ts("blank space"),At=/^[ \t]/,an=Rn([" "," "],!1,!1),S=Ts("white space"),Tt=/^[ \t\n\r]/,ng=Rn([" "," ",` -`,"\r"],!1,!1),Ql=`\r -`,hp=ar(`\r -`,!1),pp=` -`,dp=ar(` -`,!1),Cp="\r",mp=ar("\r",!1),G=0,yt=0,uA=[{line:1,column:1}],ji=0,bl=[],Xe=0,Aa;if("startRule"in e){if(!(e.startRule in i))throw new Error(`Can't start parsing from rule "`+e.startRule+'".');n=i[e.startRule]}function sg(){return r.substring(yt,G)}function bE(){return An(yt,G)}function Ep(R,q){throw q=q!==void 0?q:An(yt,G),vl([Ts(R)],r.substring(yt,G),q)}function SE(R,q){throw q=q!==void 0?q:An(yt,G),og(R,q)}function ar(R,q){return{type:"literal",text:R,ignoreCase:q}}function Rn(R,q,Ce){return{type:"class",parts:R,inverted:q,ignoreCase:Ce}}function Sl(){return{type:"any"}}function Ip(){return{type:"end"}}function Ts(R){return{type:"other",description:R}}function la(R){var q=uA[R],Ce;if(q)return q;for(Ce=R-1;!uA[Ce];)Ce--;for(q=uA[Ce],q={line:q.line,column:q.column};Ceji&&(ji=G,bl=[]),bl.push(R))}function og(R,q){return new zl(R,null,null,q)}function vl(R,q,Ce){return new zl(zl.buildMessage(R,q),R,q,Ce)}function Os(){var R;return R=ag(),R}function xl(){var R,q,Ce;for(R=G,q=[],Ce=gA();Ce!==t;)q.push(Ce),Ce=gA();return q!==t&&(yt=R,q=s(q)),R=q,R}function gA(){var R,q,Ce,Ke,Re;return R=G,q=ua(),q!==t?(r.charCodeAt(G)===45?(Ce=o,G++):(Ce=t,Xe===0&&Te(a)),Ce!==t?(Ke=Rr(),Ke!==t?(Re=ca(),Re!==t?(yt=R,q=l(Re),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R}function ag(){var R,q,Ce;for(R=G,q=[],Ce=Ag();Ce!==t;)q.push(Ce),Ce=Ag();return q!==t&&(yt=R,q=c(q)),R=q,R}function Ag(){var R,q,Ce,Ke,Re,ze,dt,Ft,Fn;if(R=G,q=Rr(),q===t&&(q=null),q!==t){if(Ce=G,r.charCodeAt(G)===35?(Ke=u,G++):(Ke=t,Xe===0&&Te(g)),Ke!==t){if(Re=[],ze=G,dt=G,Xe++,Ft=Us(),Xe--,Ft===t?dt=void 0:(G=dt,dt=t),dt!==t?(r.length>G?(Ft=r.charAt(G),G++):(Ft=t,Xe===0&&Te(f)),Ft!==t?(dt=[dt,Ft],ze=dt):(G=ze,ze=t)):(G=ze,ze=t),ze!==t)for(;ze!==t;)Re.push(ze),ze=G,dt=G,Xe++,Ft=Us(),Xe--,Ft===t?dt=void 0:(G=dt,dt=t),dt!==t?(r.length>G?(Ft=r.charAt(G),G++):(Ft=t,Xe===0&&Te(f)),Ft!==t?(dt=[dt,Ft],ze=dt):(G=ze,ze=t)):(G=ze,ze=t);else Re=t;Re!==t?(Ke=[Ke,Re],Ce=Ke):(G=Ce,Ce=t)}else G=Ce,Ce=t;if(Ce===t&&(Ce=null),Ce!==t){if(Ke=[],Re=Ks(),Re!==t)for(;Re!==t;)Ke.push(Re),Re=Ks();else Ke=t;Ke!==t?(yt=R,q=h(),R=q):(G=R,R=t)}else G=R,R=t}else G=R,R=t;if(R===t&&(R=G,q=ua(),q!==t?(Ce=Pl(),Ce!==t?(Ke=Rr(),Ke===t&&(Ke=null),Ke!==t?(r.charCodeAt(G)===58?(Re=p,G++):(Re=t,Xe===0&&Te(C)),Re!==t?(ze=Rr(),ze===t&&(ze=null),ze!==t?(dt=ca(),dt!==t?(yt=R,q=y(Ce,dt),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,q=ua(),q!==t?(Ce=Ms(),Ce!==t?(Ke=Rr(),Ke===t&&(Ke=null),Ke!==t?(r.charCodeAt(G)===58?(Re=p,G++):(Re=t,Xe===0&&Te(C)),Re!==t?(ze=Rr(),ze===t&&(ze=null),ze!==t?(dt=ca(),dt!==t?(yt=R,q=y(Ce,dt),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t))){if(R=G,q=ua(),q!==t)if(Ce=Ms(),Ce!==t)if(Ke=Rr(),Ke!==t)if(Re=vE(),Re!==t){if(ze=[],dt=Ks(),dt!==t)for(;dt!==t;)ze.push(dt),dt=Ks();else ze=t;ze!==t?(yt=R,q=y(Ce,Re),R=q):(G=R,R=t)}else G=R,R=t;else G=R,R=t;else G=R,R=t;else G=R,R=t;if(R===t)if(R=G,q=ua(),q!==t)if(Ce=Ms(),Ce!==t){if(Ke=[],Re=G,ze=Rr(),ze===t&&(ze=null),ze!==t?(r.charCodeAt(G)===44?(dt=B,G++):(dt=t,Xe===0&&Te(v)),dt!==t?(Ft=Rr(),Ft===t&&(Ft=null),Ft!==t?(Fn=Ms(),Fn!==t?(yt=Re,ze=D(Ce,Fn),Re=ze):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t),Re!==t)for(;Re!==t;)Ke.push(Re),Re=G,ze=Rr(),ze===t&&(ze=null),ze!==t?(r.charCodeAt(G)===44?(dt=B,G++):(dt=t,Xe===0&&Te(v)),dt!==t?(Ft=Rr(),Ft===t&&(Ft=null),Ft!==t?(Fn=Ms(),Fn!==t?(yt=Re,ze=D(Ce,Fn),Re=ze):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t)):(G=Re,Re=t);else Ke=t;Ke!==t?(Re=Rr(),Re===t&&(Re=null),Re!==t?(r.charCodeAt(G)===58?(ze=p,G++):(ze=t,Xe===0&&Te(C)),ze!==t?(dt=Rr(),dt===t&&(dt=null),dt!==t?(Ft=ca(),Ft!==t?(yt=R,q=L(Ce,Ke,Ft),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)}else G=R,R=t;else G=R,R=t}return R}function ca(){var R,q,Ce,Ke,Re,ze,dt;if(R=G,q=G,Xe++,Ce=G,Ke=Us(),Ke!==t?(Re=rt(),Re!==t?(r.charCodeAt(G)===45?(ze=o,G++):(ze=t,Xe===0&&Te(a)),ze!==t?(dt=Rr(),dt!==t?(Ke=[Ke,Re,ze,dt],Ce=Ke):(G=Ce,Ce=t)):(G=Ce,Ce=t)):(G=Ce,Ce=t)):(G=Ce,Ce=t),Xe--,Ce!==t?(G=q,q=void 0):q=t,q!==t?(Ce=Ks(),Ce!==t?(Ke=Eo(),Ke!==t?(Re=xl(),Re!==t?(ze=fA(),ze!==t?(yt=R,q=H(Re),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,q=Us(),q!==t?(Ce=Eo(),Ce!==t?(Ke=ag(),Ke!==t?(Re=fA(),Re!==t?(yt=R,q=H(Ke),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t),R===t))if(R=G,q=Dl(),q!==t){if(Ce=[],Ke=Ks(),Ke!==t)for(;Ke!==t;)Ce.push(Ke),Ke=Ks();else Ce=t;Ce!==t?(yt=R,q=j(q),R=q):(G=R,R=t)}else G=R,R=t;return R}function ua(){var R,q,Ce;for(Xe++,R=G,q=[],r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Te(W));Ce!==t;)q.push(Ce),r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Te(W));return q!==t?(yt=G,Ce=Z(q),Ce?Ce=void 0:Ce=t,Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)):(G=R,R=t),Xe--,R===t&&(q=t,Xe===0&&Te($)),R}function rt(){var R,q,Ce;for(R=G,q=[],r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Te(W));Ce!==t;)q.push(Ce),r.charCodeAt(G)===32?(Ce=V,G++):(Ce=t,Xe===0&&Te(W));return q!==t?(yt=G,Ce=A(q),Ce?Ce=void 0:Ce=t,Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)):(G=R,R=t),R}function Eo(){var R;return yt=G,R=ae(),R?R=void 0:R=t,R}function fA(){var R;return yt=G,R=ge(),R?R=void 0:R=t,R}function Pl(){var R;return R=kl(),R===t&&(R=yp()),R}function Ms(){var R,q,Ce;if(R=kl(),R===t){if(R=G,q=[],Ce=lg(),Ce!==t)for(;Ce!==t;)q.push(Ce),Ce=lg();else q=t;q!==t&&(yt=R,q=re()),R=q}return R}function Dl(){var R;return R=wp(),R===t&&(R=xE(),R===t&&(R=kl(),R===t&&(R=yp()))),R}function vE(){var R;return R=wp(),R===t&&(R=kl(),R===t&&(R=lg())),R}function yp(){var R,q,Ce,Ke,Re,ze;if(Xe++,R=G,F.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Te(ue)),q!==t){for(Ce=[],Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(he.test(r.charAt(G))?(ze=r.charAt(G),G++):(ze=t,Xe===0&&Te(ke)),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ke!==t;)Ce.push(Ke),Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(he.test(r.charAt(G))?(ze=r.charAt(G),G++):(ze=t,Xe===0&&Te(ke)),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ce!==t?(yt=R,q=Fe(),R=q):(G=R,R=t)}else G=R,R=t;return Xe--,R===t&&(q=t,Xe===0&&Te(O)),R}function lg(){var R,q,Ce,Ke,Re;if(R=G,r.substr(G,2)===Ne?(q=Ne,G+=2):(q=t,Xe===0&&Te(oe)),q===t&&(q=null),q!==t)if(le.test(r.charAt(G))?(Ce=r.charAt(G),G++):(Ce=t,Xe===0&&Te(we)),Ce!==t){for(Ke=[],fe.test(r.charAt(G))?(Re=r.charAt(G),G++):(Re=t,Xe===0&&Te(Ae));Re!==t;)Ke.push(Re),fe.test(r.charAt(G))?(Re=r.charAt(G),G++):(Re=t,Xe===0&&Te(Ae));Ke!==t?(yt=R,q=Fe(),R=q):(G=R,R=t)}else G=R,R=t;else G=R,R=t;return R}function wp(){var R,q;return R=G,r.substr(G,4)===qe?(q=qe,G+=4):(q=t,Xe===0&&Te(ne)),q!==t&&(yt=R,q=Y()),R=q,R}function xE(){var R,q;return R=G,r.substr(G,4)===pe?(q=pe,G+=4):(q=t,Xe===0&&Te(ie)),q!==t&&(yt=R,q=de()),R=q,R===t&&(R=G,r.substr(G,5)===tt?(q=tt,G+=5):(q=t,Xe===0&&Te(Pt)),q!==t&&(yt=R,q=It()),R=q),R}function kl(){var R,q,Ce,Ke;return Xe++,R=G,r.charCodeAt(G)===34?(q=ii,G++):(q=t,Xe===0&&Te(gi)),q!==t?(r.charCodeAt(G)===34?(Ce=ii,G++):(Ce=t,Xe===0&&Te(gi)),Ce!==t?(yt=R,q=hr(),R=q):(G=R,R=t)):(G=R,R=t),R===t&&(R=G,r.charCodeAt(G)===34?(q=ii,G++):(q=t,Xe===0&&Te(gi)),q!==t?(Ce=PE(),Ce!==t?(r.charCodeAt(G)===34?(Ke=ii,G++):(Ke=t,Xe===0&&Te(gi)),Ke!==t?(yt=R,q=fi(Ce),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)),Xe--,R===t&&(q=t,Xe===0&&Te(Or)),R}function PE(){var R,q,Ce;if(R=G,q=[],Ce=cg(),Ce!==t)for(;Ce!==t;)q.push(Ce),Ce=cg();else q=t;return q!==t&&(yt=R,q=ni(q)),R=q,R}function cg(){var R,q,Ce,Ke,Re,ze;return Ls.test(r.charAt(G))?(R=r.charAt(G),G++):(R=t,Xe===0&&Te(pr)),R===t&&(R=G,r.substr(G,2)===Ei?(q=Ei,G+=2):(q=t,Xe===0&&Te(_n)),q!==t&&(yt=R,q=oa()),R=q,R===t&&(R=G,r.substr(G,2)===aA?(q=aA,G+=2):(q=t,Xe===0&&Te(eg)),q!==t&&(yt=R,q=Zn()),R=q,R===t&&(R=G,r.substr(G,2)===AA?(q=AA,G+=2):(q=t,Xe===0&&Te(aa)),q!==t&&(yt=R,q=up()),R=q,R===t&&(R=G,r.substr(G,2)===lA?(q=lA,G+=2):(q=t,Xe===0&&Te(cA)),q!==t&&(yt=R,q=wr()),R=q,R===t&&(R=G,r.substr(G,2)===wl?(q=wl,G+=2):(q=t,Xe===0&&Te(tg)),q!==t&&(yt=R,q=po()),R=q,R===t&&(R=G,r.substr(G,2)===rg?(q=rg,G+=2):(q=t,Xe===0&&Te(gp)),q!==t&&(yt=R,q=fp()),R=q,R===t&&(R=G,r.substr(G,2)===vr?(q=vr,G+=2):(q=t,Xe===0&&Te(se)),q!==t&&(yt=R,q=Co()),R=q,R===t&&(R=G,r.substr(G,2)===Dn?(q=Dn,G+=2):(q=t,Xe===0&&Te(ig)),q!==t&&(yt=R,q=Qt()),R=q,R===t&&(R=G,r.substr(G,2)===Bl?(q=Bl,G+=2):(q=t,Xe===0&&Te(kn)),q!==t?(Ce=hA(),Ce!==t?(Ke=hA(),Ke!==t?(Re=hA(),Re!==t?(ze=hA(),ze!==t?(yt=R,q=$n(Ce,Ke,Re,ze),R=q):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)):(G=R,R=t)))))))))),R}function hA(){var R;return es.test(r.charAt(G))?(R=r.charAt(G),G++):(R=t,Xe===0&&Te(gt)),R}function Rr(){var R,q;if(Xe++,R=[],At.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Te(an)),q!==t)for(;q!==t;)R.push(q),At.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Te(an));else R=t;return Xe--,R===t&&(q=t,Xe===0&&Te(mo)),R}function DE(){var R,q;if(Xe++,R=[],Tt.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Te(ng)),q!==t)for(;q!==t;)R.push(q),Tt.test(r.charAt(G))?(q=r.charAt(G),G++):(q=t,Xe===0&&Te(ng));else R=t;return Xe--,R===t&&(q=t,Xe===0&&Te(S)),R}function Ks(){var R,q,Ce,Ke,Re,ze;if(R=G,q=Us(),q!==t){for(Ce=[],Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(ze=Us(),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ke!==t;)Ce.push(Ke),Ke=G,Re=Rr(),Re===t&&(Re=null),Re!==t?(ze=Us(),ze!==t?(Re=[Re,ze],Ke=Re):(G=Ke,Ke=t)):(G=Ke,Ke=t);Ce!==t?(q=[q,Ce],R=q):(G=R,R=t)}else G=R,R=t;return R}function Us(){var R;return r.substr(G,2)===Ql?(R=Ql,G+=2):(R=t,Xe===0&&Te(hp)),R===t&&(r.charCodeAt(G)===10?(R=pp,G++):(R=t,Xe===0&&Te(dp)),R===t&&(r.charCodeAt(G)===13?(R=Cp,G++):(R=t,Xe===0&&Te(mp)))),R}let ug=2,pA=0;if(Aa=n(),Aa!==t&&G===r.length)return Aa;throw Aa!==t&&G{"use strict";var wpe=r=>{let e=!1,t=!1,i=!1;for(let n=0;n{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");e=Object.assign({pascalCase:!1},e);let t=n=>e.pascalCase?n.charAt(0).toUpperCase()+n.slice(1):n;return Array.isArray(r)?r=r.map(n=>n.trim()).filter(n=>n.length).join("-"):r=r.trim(),r.length===0?"":r.length===1?e.pascalCase?r.toUpperCase():r.toLowerCase():(r!==r.toLowerCase()&&(r=wpe(r)),r=r.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,(n,s)=>s.toUpperCase()).replace(/\d+(\w|$)/g,n=>n.toUpperCase()),t(r))};KS.exports=T2;KS.exports.default=T2});var M2=w((VXe,Bpe)=>{Bpe.exports=[{name:"AppVeyor",constant:"APPVEYOR",env:"APPVEYOR",pr:"APPVEYOR_PULL_REQUEST_NUMBER"},{name:"Azure Pipelines",constant:"AZURE_PIPELINES",env:"SYSTEM_TEAMFOUNDATIONCOLLECTIONURI",pr:"SYSTEM_PULLREQUEST_PULLREQUESTID"},{name:"Appcircle",constant:"APPCIRCLE",env:"AC_APPCIRCLE"},{name:"Bamboo",constant:"BAMBOO",env:"bamboo_planKey"},{name:"Bitbucket Pipelines",constant:"BITBUCKET",env:"BITBUCKET_COMMIT",pr:"BITBUCKET_PR_ID"},{name:"Bitrise",constant:"BITRISE",env:"BITRISE_IO",pr:"BITRISE_PULL_REQUEST"},{name:"Buddy",constant:"BUDDY",env:"BUDDY_WORKSPACE_ID",pr:"BUDDY_EXECUTION_PULL_REQUEST_ID"},{name:"Buildkite",constant:"BUILDKITE",env:"BUILDKITE",pr:{env:"BUILDKITE_PULL_REQUEST",ne:"false"}},{name:"CircleCI",constant:"CIRCLE",env:"CIRCLECI",pr:"CIRCLE_PULL_REQUEST"},{name:"Cirrus CI",constant:"CIRRUS",env:"CIRRUS_CI",pr:"CIRRUS_PR"},{name:"AWS CodeBuild",constant:"CODEBUILD",env:"CODEBUILD_BUILD_ARN"},{name:"Codefresh",constant:"CODEFRESH",env:"CF_BUILD_ID",pr:{any:["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{name:"Codeship",constant:"CODESHIP",env:{CI_NAME:"codeship"}},{name:"Drone",constant:"DRONE",env:"DRONE",pr:{DRONE_BUILD_EVENT:"pull_request"}},{name:"dsari",constant:"DSARI",env:"DSARI"},{name:"GitHub Actions",constant:"GITHUB_ACTIONS",env:"GITHUB_ACTIONS",pr:{GITHUB_EVENT_NAME:"pull_request"}},{name:"GitLab CI",constant:"GITLAB",env:"GITLAB_CI",pr:"CI_MERGE_REQUEST_ID"},{name:"GoCD",constant:"GOCD",env:"GO_PIPELINE_LABEL"},{name:"LayerCI",constant:"LAYERCI",env:"LAYERCI",pr:"LAYERCI_PULL_REQUEST"},{name:"Hudson",constant:"HUDSON",env:"HUDSON_URL"},{name:"Jenkins",constant:"JENKINS",env:["JENKINS_URL","BUILD_ID"],pr:{any:["ghprbPullId","CHANGE_ID"]}},{name:"Magnum CI",constant:"MAGNUM",env:"MAGNUM"},{name:"Netlify CI",constant:"NETLIFY",env:"NETLIFY",pr:{env:"PULL_REQUEST",ne:"false"}},{name:"Nevercode",constant:"NEVERCODE",env:"NEVERCODE",pr:{env:"NEVERCODE_PULL_REQUEST",ne:"false"}},{name:"Render",constant:"RENDER",env:"RENDER",pr:{IS_PULL_REQUEST:"true"}},{name:"Sail CI",constant:"SAIL",env:"SAILCI",pr:"SAIL_PULL_REQUEST_NUMBER"},{name:"Semaphore",constant:"SEMAPHORE",env:"SEMAPHORE",pr:"PULL_REQUEST_NUMBER"},{name:"Screwdriver",constant:"SCREWDRIVER",env:"SCREWDRIVER",pr:{env:"SD_PULL_REQUEST",ne:"false"}},{name:"Shippable",constant:"SHIPPABLE",env:"SHIPPABLE",pr:{IS_PULL_REQUEST:"true"}},{name:"Solano CI",constant:"SOLANO",env:"TDDIUM",pr:"TDDIUM_PR_ID"},{name:"Strider CD",constant:"STRIDER",env:"STRIDER"},{name:"TaskCluster",constant:"TASKCLUSTER",env:["TASK_ID","RUN_ID"]},{name:"TeamCity",constant:"TEAMCITY",env:"TEAMCITY_VERSION"},{name:"Travis CI",constant:"TRAVIS",env:"TRAVIS",pr:{env:"TRAVIS_PULL_REQUEST",ne:"false"}},{name:"Vercel",constant:"VERCEL",env:"NOW_BUILDER"},{name:"Visual Studio App Center",constant:"APPCENTER",env:"APPCENTER_BUILD_ID"}]});var Vl=w(On=>{"use strict";var U2=M2(),Qo=process.env;Object.defineProperty(On,"_vendors",{value:U2.map(function(r){return r.constant})});On.name=null;On.isPR=null;U2.forEach(function(r){let t=(Array.isArray(r.env)?r.env:[r.env]).every(function(i){return K2(i)});if(On[r.constant]=t,t)switch(On.name=r.name,typeof r.pr){case"string":On.isPR=!!Qo[r.pr];break;case"object":"env"in r.pr?On.isPR=r.pr.env in Qo&&Qo[r.pr.env]!==r.pr.ne:"any"in r.pr?On.isPR=r.pr.any.some(function(i){return!!Qo[i]}):On.isPR=K2(r.pr);break;default:On.isPR=null}});On.isCI=!!(Qo.CI||Qo.CONTINUOUS_INTEGRATION||Qo.BUILD_NUMBER||Qo.RUN_ID||On.name);function K2(r){return typeof r=="string"?!!Qo[r]:Object.keys(r).every(function(e){return Qo[e]===r[e]})}});var gn={};ut(gn,{KeyRelationship:()=>Xl,applyCascade:()=>zp,base64RegExp:()=>q2,colorStringAlphaRegExp:()=>j2,colorStringRegExp:()=>Y2,computeKey:()=>BA,getPrintable:()=>Vr,hasExactLength:()=>X2,hasForbiddenKeys:()=>tde,hasKeyRelationship:()=>JS,hasMaxLength:()=>Mpe,hasMinLength:()=>Ope,hasMutuallyExclusiveKeys:()=>rde,hasRequiredKeys:()=>ede,hasUniqueItems:()=>Kpe,isArray:()=>Ppe,isAtLeast:()=>Gpe,isAtMost:()=>Ype,isBase64:()=>Zpe,isBoolean:()=>Spe,isDate:()=>xpe,isDict:()=>kpe,isEnum:()=>Wi,isHexColor:()=>_pe,isISO8601:()=>Xpe,isInExclusiveRange:()=>qpe,isInInclusiveRange:()=>jpe,isInstanceOf:()=>Fpe,isInteger:()=>Jpe,isJSON:()=>$pe,isLiteral:()=>Qpe,isLowerCase:()=>Wpe,isNegative:()=>Upe,isNullable:()=>Tpe,isNumber:()=>vpe,isObject:()=>Rpe,isOneOf:()=>Npe,isOptional:()=>Lpe,isPositive:()=>Hpe,isString:()=>Wp,isTuple:()=>Dpe,isUUID4:()=>Vpe,isUnknown:()=>V2,isUpperCase:()=>zpe,iso8601RegExp:()=>qS,makeCoercionFn:()=>_l,makeSetter:()=>z2,makeTrait:()=>W2,makeValidator:()=>bt,matchesRegExp:()=>Vp,plural:()=>EI,pushError:()=>pt,simpleKeyRegExp:()=>G2,uuid4RegExp:()=>J2});function bt({test:r}){return W2(r)()}function Vr(r){return r===null?"null":r===void 0?"undefined":r===""?"an empty string":JSON.stringify(r)}function BA(r,e){var t,i,n;return typeof e=="number"?`${(t=r==null?void 0:r.p)!==null&&t!==void 0?t:"."}[${e}]`:G2.test(e)?`${(i=r==null?void 0:r.p)!==null&&i!==void 0?i:""}.${e}`:`${(n=r==null?void 0:r.p)!==null&&n!==void 0?n:"."}[${JSON.stringify(e)}]`}function _l(r,e){return t=>{let i=r[e];return r[e]=t,_l(r,e).bind(null,i)}}function z2(r,e){return t=>{r[e]=t}}function EI(r,e,t){return r===1?e:t}function pt({errors:r,p:e}={},t){return r==null||r.push(`${e!=null?e:"."}: ${t}`),!1}function Qpe(r){return bt({test:(e,t)=>e!==r?pt(t,`Expected a literal (got ${Vr(r)})`):!0})}function Wi(r){let e=Array.isArray(r)?r:Object.values(r),t=new Set(e);return bt({test:(i,n)=>t.has(i)?!0:pt(n,`Expected a valid enumeration value (got ${Vr(i)})`)})}var G2,Y2,j2,q2,J2,qS,W2,V2,Wp,bpe,Spe,vpe,xpe,Ppe,Dpe,kpe,Rpe,Fpe,Npe,zp,Lpe,Tpe,Ope,Mpe,X2,Kpe,Upe,Hpe,Gpe,Ype,jpe,qpe,Jpe,Vp,Wpe,zpe,Vpe,Xpe,_pe,Zpe,$pe,ede,tde,rde,Xl,ide,JS,ns=Yue(()=>{G2=/^[a-zA-Z_][a-zA-Z0-9_]*$/,Y2=/^#[0-9a-f]{6}$/i,j2=/^#[0-9a-f]{6}([0-9a-f]{2})?$/i,q2=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/,J2=/^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}$/i,qS=/^(?:[1-9]\d{3}(-?)(?:(?:0[1-9]|1[0-2])\1(?:0[1-9]|1\d|2[0-8])|(?:0[13-9]|1[0-2])\1(?:29|30)|(?:0[13578]|1[02])(?:\1)31|00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[0-5]))|(?:[1-9]\d(?:0[48]|[2468][048]|[13579][26])|(?:[2468][048]|[13579][26])00)(?:(-?)02(?:\2)29|-?366))T(?:[01]\d|2[0-3])(:?)[0-5]\d(?:\3[0-5]\d)?(?:Z|[+-][01]\d(?:\3[0-5]\d)?)$/,W2=r=>()=>r;V2=()=>bt({test:(r,e)=>!0});Wp=()=>bt({test:(r,e)=>typeof r!="string"?pt(e,`Expected a string (got ${Vr(r)})`):!0});bpe=new Map([["true",!0],["True",!0],["1",!0],[1,!0],["false",!1],["False",!1],["0",!1],[0,!1]]),Spe=()=>bt({test:(r,e)=>{var t;if(typeof r!="boolean"){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return pt(e,"Unbound coercion result");let i=bpe.get(r);if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return pt(e,`Expected a boolean (got ${Vr(r)})`)}return!0}}),vpe=()=>bt({test:(r,e)=>{var t;if(typeof r!="number"){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return pt(e,"Unbound coercion result");let i;if(typeof r=="string"){let n;try{n=JSON.parse(r)}catch{}if(typeof n=="number")if(JSON.stringify(n)===r)i=n;else return pt(e,`Received a number that can't be safely represented by the runtime (${r})`)}if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return pt(e,`Expected a number (got ${Vr(r)})`)}return!0}}),xpe=()=>bt({test:(r,e)=>{var t;if(!(r instanceof Date)){if(typeof(e==null?void 0:e.coercions)<"u"){if(typeof(e==null?void 0:e.coercion)>"u")return pt(e,"Unbound coercion result");let i;if(typeof r=="string"&&qS.test(r))i=new Date(r);else{let n;if(typeof r=="string"){let s;try{s=JSON.parse(r)}catch{}typeof s=="number"&&(n=s)}else typeof r=="number"&&(n=r);if(typeof n<"u")if(Number.isSafeInteger(n)||!Number.isSafeInteger(n*1e3))i=new Date(n*1e3);else return pt(e,`Received a timestamp that can't be safely represented by the runtime (${r})`)}if(typeof i<"u")return e.coercions.push([(t=e.p)!==null&&t!==void 0?t:".",e.coercion.bind(null,i)]),!0}return pt(e,`Expected a date (got ${Vr(r)})`)}return!0}}),Ppe=(r,{delimiter:e}={})=>bt({test:(t,i)=>{var n;if(typeof t=="string"&&typeof e<"u"&&typeof(i==null?void 0:i.coercions)<"u"){if(typeof(i==null?void 0:i.coercion)>"u")return pt(i,"Unbound coercion result");t=t.split(e),i.coercions.push([(n=i.p)!==null&&n!==void 0?n:".",i.coercion.bind(null,t)])}if(!Array.isArray(t))return pt(i,`Expected an array (got ${Vr(t)})`);let s=!0;for(let o=0,a=t.length;o{let t=X2(r.length);return bt({test:(i,n)=>{var s;if(typeof i=="string"&&typeof e<"u"&&typeof(n==null?void 0:n.coercions)<"u"){if(typeof(n==null?void 0:n.coercion)>"u")return pt(n,"Unbound coercion result");i=i.split(e),n.coercions.push([(s=n.p)!==null&&s!==void 0?s:".",n.coercion.bind(null,i)])}if(!Array.isArray(i))return pt(n,`Expected a tuple (got ${Vr(i)})`);let o=t(i,Object.assign({},n));for(let a=0,l=i.length;abt({test:(t,i)=>{if(typeof t!="object"||t===null)return pt(i,`Expected an object (got ${Vr(t)})`);let n=Object.keys(t),s=!0;for(let o=0,a=n.length;o{let t=Object.keys(r);return bt({test:(i,n)=>{if(typeof i!="object"||i===null)return pt(n,`Expected an object (got ${Vr(i)})`);let s=new Set([...t,...Object.keys(i)]),o={},a=!0;for(let l of s){if(l==="constructor"||l==="__proto__")a=pt(Object.assign(Object.assign({},n),{p:BA(n,l)}),"Unsafe property name");else{let c=Object.prototype.hasOwnProperty.call(r,l)?r[l]:void 0,u=Object.prototype.hasOwnProperty.call(i,l)?i[l]:void 0;typeof c<"u"?a=c(u,Object.assign(Object.assign({},n),{p:BA(n,l),coercion:_l(i,l)}))&&a:e===null?a=pt(Object.assign(Object.assign({},n),{p:BA(n,l)}),`Extraneous property (got ${Vr(u)})`):Object.defineProperty(o,l,{enumerable:!0,get:()=>u,set:z2(i,l)})}if(!a&&(n==null?void 0:n.errors)==null)break}return e!==null&&(a||(n==null?void 0:n.errors)!=null)&&(a=e(o,n)&&a),a}})},Fpe=r=>bt({test:(e,t)=>e instanceof r?!0:pt(t,`Expected an instance of ${r.name} (got ${Vr(e)})`)}),Npe=(r,{exclusive:e=!1}={})=>bt({test:(t,i)=>{var n,s,o;let a=[],l=typeof(i==null?void 0:i.errors)<"u"?[]:void 0;for(let c=0,u=r.length;c1?pt(i,`Expected to match exactly a single predicate (matched ${a.join(", ")})`):(o=i==null?void 0:i.errors)===null||o===void 0||o.push(...l),!1}}),zp=(r,e)=>bt({test:(t,i)=>{var n,s;let o={value:t},a=typeof(i==null?void 0:i.coercions)<"u"?_l(o,"value"):void 0,l=typeof(i==null?void 0:i.coercions)<"u"?[]:void 0;if(!r(t,Object.assign(Object.assign({},i),{coercion:a,coercions:l})))return!1;let c=[];if(typeof l<"u")for(let[,u]of l)c.push(u());try{if(typeof(i==null?void 0:i.coercions)<"u"){if(o.value!==t){if(typeof(i==null?void 0:i.coercion)>"u")return pt(i,"Unbound coercion result");i.coercions.push([(n=i.p)!==null&&n!==void 0?n:".",i.coercion.bind(null,o.value)])}(s=i==null?void 0:i.coercions)===null||s===void 0||s.push(...l)}return e.every(u=>u(o.value,i))}finally{for(let u of c)u()}}}),Lpe=r=>bt({test:(e,t)=>typeof e>"u"?!0:r(e,t)}),Tpe=r=>bt({test:(e,t)=>e===null?!0:r(e,t)}),Ope=r=>bt({test:(e,t)=>e.length>=r?!0:pt(t,`Expected to have a length of at least ${r} elements (got ${e.length})`)}),Mpe=r=>bt({test:(e,t)=>e.length<=r?!0:pt(t,`Expected to have a length of at most ${r} elements (got ${e.length})`)}),X2=r=>bt({test:(e,t)=>e.length!==r?pt(t,`Expected to have a length of exactly ${r} elements (got ${e.length})`):!0}),Kpe=({map:r}={})=>bt({test:(e,t)=>{let i=new Set,n=new Set;for(let s=0,o=e.length;sbt({test:(r,e)=>r<=0?!0:pt(e,`Expected to be negative (got ${r})`)}),Hpe=()=>bt({test:(r,e)=>r>=0?!0:pt(e,`Expected to be positive (got ${r})`)}),Gpe=r=>bt({test:(e,t)=>e>=r?!0:pt(t,`Expected to be at least ${r} (got ${e})`)}),Ype=r=>bt({test:(e,t)=>e<=r?!0:pt(t,`Expected to be at most ${r} (got ${e})`)}),jpe=(r,e)=>bt({test:(t,i)=>t>=r&&t<=e?!0:pt(i,`Expected to be in the [${r}; ${e}] range (got ${t})`)}),qpe=(r,e)=>bt({test:(t,i)=>t>=r&&tbt({test:(e,t)=>e!==Math.round(e)?pt(t,`Expected to be an integer (got ${e})`):Number.isSafeInteger(e)?!0:pt(t,`Expected to be a safe integer (got ${e})`)}),Vp=r=>bt({test:(e,t)=>r.test(e)?!0:pt(t,`Expected to match the pattern ${r.toString()} (got ${Vr(e)})`)}),Wpe=()=>bt({test:(r,e)=>r!==r.toLowerCase()?pt(e,`Expected to be all-lowercase (got ${r})`):!0}),zpe=()=>bt({test:(r,e)=>r!==r.toUpperCase()?pt(e,`Expected to be all-uppercase (got ${r})`):!0}),Vpe=()=>bt({test:(r,e)=>J2.test(r)?!0:pt(e,`Expected to be a valid UUID v4 (got ${Vr(r)})`)}),Xpe=()=>bt({test:(r,e)=>qS.test(r)?!1:pt(e,`Expected to be a valid ISO 8601 date string (got ${Vr(r)})`)}),_pe=({alpha:r=!1})=>bt({test:(e,t)=>(r?Y2.test(e):j2.test(e))?!0:pt(t,`Expected to be a valid hexadecimal color string (got ${Vr(e)})`)}),Zpe=()=>bt({test:(r,e)=>q2.test(r)?!0:pt(e,`Expected to be a valid base 64 string (got ${Vr(r)})`)}),$pe=(r=V2())=>bt({test:(e,t)=>{let i;try{i=JSON.parse(e)}catch{return pt(t,`Expected to be a valid JSON string (got ${Vr(e)})`)}return r(i,t)}}),ede=r=>{let e=new Set(r);return bt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)||s.push(o);return s.length>0?pt(i,`Missing required ${EI(s.length,"property","properties")} ${s.map(o=>`"${o}"`).join(", ")}`):!0}})},tde=r=>{let e=new Set(r);return bt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)&&s.push(o);return s.length>0?pt(i,`Forbidden ${EI(s.length,"property","properties")} ${s.map(o=>`"${o}"`).join(", ")}`):!0}})},rde=r=>{let e=new Set(r);return bt({test:(t,i)=>{let n=new Set(Object.keys(t)),s=[];for(let o of e)n.has(o)&&s.push(o);return s.length>1?pt(i,`Mutually exclusive properties ${s.map(o=>`"${o}"`).join(", ")}`):!0}})};(function(r){r.Forbids="Forbids",r.Requires="Requires"})(Xl||(Xl={}));ide={[Xl.Forbids]:{expect:!1,message:"forbids using"},[Xl.Requires]:{expect:!0,message:"requires using"}},JS=(r,e,t,{ignore:i=[]}={})=>{let n=new Set(i),s=new Set(t),o=ide[e];return bt({test:(a,l)=>{let c=new Set(Object.keys(a));if(!c.has(r)||n.has(a[r]))return!0;let u=[];for(let g of s)(c.has(g)&&!n.has(a[g]))!==o.expect&&u.push(g);return u.length>=1?pt(l,`Property "${r}" ${o.message} ${EI(u.length,"property","properties")} ${u.map(g=>`"${g}"`).join(", ")}`):!0}})}});var fH=w((V_e,gH)=>{"use strict";gH.exports=(r,...e)=>new Promise(t=>{t(r(...e))})});var Tg=w((X_e,ev)=>{"use strict";var Ide=fH(),hH=r=>{if(r<1)throw new TypeError("Expected `concurrency` to be a number from 1 and up");let e=[],t=0,i=()=>{t--,e.length>0&&e.shift()()},n=(a,l,...c)=>{t++;let u=Ide(a,...c);l(u),u.then(i,i)},s=(a,l,...c)=>{tnew Promise(c=>s(a,c,...l));return Object.defineProperties(o,{activeCount:{get:()=>t},pendingCount:{get:()=>e.length}}),o};ev.exports=hH;ev.exports.default=hH});var ed=w((Z_e,pH)=>{var yde="2.0.0",wde=Number.MAX_SAFE_INTEGER||9007199254740991,Bde=16;pH.exports={SEMVER_SPEC_VERSION:yde,MAX_LENGTH:256,MAX_SAFE_INTEGER:wde,MAX_SAFE_COMPONENT_LENGTH:Bde}});var td=w(($_e,dH)=>{var Qde=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{};dH.exports=Qde});var Zl=w((bA,CH)=>{var{MAX_SAFE_COMPONENT_LENGTH:tv}=ed(),bde=td();bA=CH.exports={};var Sde=bA.re=[],$e=bA.src=[],et=bA.t={},vde=0,St=(r,e,t)=>{let i=vde++;bde(i,e),et[r]=i,$e[i]=e,Sde[i]=new RegExp(e,t?"g":void 0)};St("NUMERICIDENTIFIER","0|[1-9]\\d*");St("NUMERICIDENTIFIERLOOSE","[0-9]+");St("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*");St("MAINVERSION",`(${$e[et.NUMERICIDENTIFIER]})\\.(${$e[et.NUMERICIDENTIFIER]})\\.(${$e[et.NUMERICIDENTIFIER]})`);St("MAINVERSIONLOOSE",`(${$e[et.NUMERICIDENTIFIERLOOSE]})\\.(${$e[et.NUMERICIDENTIFIERLOOSE]})\\.(${$e[et.NUMERICIDENTIFIERLOOSE]})`);St("PRERELEASEIDENTIFIER",`(?:${$e[et.NUMERICIDENTIFIER]}|${$e[et.NONNUMERICIDENTIFIER]})`);St("PRERELEASEIDENTIFIERLOOSE",`(?:${$e[et.NUMERICIDENTIFIERLOOSE]}|${$e[et.NONNUMERICIDENTIFIER]})`);St("PRERELEASE",`(?:-(${$e[et.PRERELEASEIDENTIFIER]}(?:\\.${$e[et.PRERELEASEIDENTIFIER]})*))`);St("PRERELEASELOOSE",`(?:-?(${$e[et.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${$e[et.PRERELEASEIDENTIFIERLOOSE]})*))`);St("BUILDIDENTIFIER","[0-9A-Za-z-]+");St("BUILD",`(?:\\+(${$e[et.BUILDIDENTIFIER]}(?:\\.${$e[et.BUILDIDENTIFIER]})*))`);St("FULLPLAIN",`v?${$e[et.MAINVERSION]}${$e[et.PRERELEASE]}?${$e[et.BUILD]}?`);St("FULL",`^${$e[et.FULLPLAIN]}$`);St("LOOSEPLAIN",`[v=\\s]*${$e[et.MAINVERSIONLOOSE]}${$e[et.PRERELEASELOOSE]}?${$e[et.BUILD]}?`);St("LOOSE",`^${$e[et.LOOSEPLAIN]}$`);St("GTLT","((?:<|>)?=?)");St("XRANGEIDENTIFIERLOOSE",`${$e[et.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);St("XRANGEIDENTIFIER",`${$e[et.NUMERICIDENTIFIER]}|x|X|\\*`);St("XRANGEPLAIN",`[v=\\s]*(${$e[et.XRANGEIDENTIFIER]})(?:\\.(${$e[et.XRANGEIDENTIFIER]})(?:\\.(${$e[et.XRANGEIDENTIFIER]})(?:${$e[et.PRERELEASE]})?${$e[et.BUILD]}?)?)?`);St("XRANGEPLAINLOOSE",`[v=\\s]*(${$e[et.XRANGEIDENTIFIERLOOSE]})(?:\\.(${$e[et.XRANGEIDENTIFIERLOOSE]})(?:\\.(${$e[et.XRANGEIDENTIFIERLOOSE]})(?:${$e[et.PRERELEASELOOSE]})?${$e[et.BUILD]}?)?)?`);St("XRANGE",`^${$e[et.GTLT]}\\s*${$e[et.XRANGEPLAIN]}$`);St("XRANGELOOSE",`^${$e[et.GTLT]}\\s*${$e[et.XRANGEPLAINLOOSE]}$`);St("COERCE",`(^|[^\\d])(\\d{1,${tv}})(?:\\.(\\d{1,${tv}}))?(?:\\.(\\d{1,${tv}}))?(?:$|[^\\d])`);St("COERCERTL",$e[et.COERCE],!0);St("LONETILDE","(?:~>?)");St("TILDETRIM",`(\\s*)${$e[et.LONETILDE]}\\s+`,!0);bA.tildeTrimReplace="$1~";St("TILDE",`^${$e[et.LONETILDE]}${$e[et.XRANGEPLAIN]}$`);St("TILDELOOSE",`^${$e[et.LONETILDE]}${$e[et.XRANGEPLAINLOOSE]}$`);St("LONECARET","(?:\\^)");St("CARETTRIM",`(\\s*)${$e[et.LONECARET]}\\s+`,!0);bA.caretTrimReplace="$1^";St("CARET",`^${$e[et.LONECARET]}${$e[et.XRANGEPLAIN]}$`);St("CARETLOOSE",`^${$e[et.LONECARET]}${$e[et.XRANGEPLAINLOOSE]}$`);St("COMPARATORLOOSE",`^${$e[et.GTLT]}\\s*(${$e[et.LOOSEPLAIN]})$|^$`);St("COMPARATOR",`^${$e[et.GTLT]}\\s*(${$e[et.FULLPLAIN]})$|^$`);St("COMPARATORTRIM",`(\\s*)${$e[et.GTLT]}\\s*(${$e[et.LOOSEPLAIN]}|${$e[et.XRANGEPLAIN]})`,!0);bA.comparatorTrimReplace="$1$2$3";St("HYPHENRANGE",`^\\s*(${$e[et.XRANGEPLAIN]})\\s+-\\s+(${$e[et.XRANGEPLAIN]})\\s*$`);St("HYPHENRANGELOOSE",`^\\s*(${$e[et.XRANGEPLAINLOOSE]})\\s+-\\s+(${$e[et.XRANGEPLAINLOOSE]})\\s*$`);St("STAR","(<|>)?=?\\s*\\*");St("GTE0","^\\s*>=\\s*0.0.0\\s*$");St("GTE0PRE","^\\s*>=\\s*0.0.0-0\\s*$")});var rd=w((eZe,mH)=>{var xde=["includePrerelease","loose","rtl"],Pde=r=>r?typeof r!="object"?{loose:!0}:xde.filter(e=>r[e]).reduce((e,t)=>(e[t]=!0,e),{}):{};mH.exports=Pde});var bI=w((tZe,yH)=>{var EH=/^[0-9]+$/,IH=(r,e)=>{let t=EH.test(r),i=EH.test(e);return t&&i&&(r=+r,e=+e),r===e?0:t&&!i?-1:i&&!t?1:rIH(e,r);yH.exports={compareIdentifiers:IH,rcompareIdentifiers:Dde}});var Li=w((rZe,bH)=>{var SI=td(),{MAX_LENGTH:wH,MAX_SAFE_INTEGER:vI}=ed(),{re:BH,t:QH}=Zl(),kde=rd(),{compareIdentifiers:id}=bI(),Un=class{constructor(e,t){if(t=kde(t),e instanceof Un){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid Version: ${e}`);if(e.length>wH)throw new TypeError(`version is longer than ${wH} characters`);SI("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let i=e.trim().match(t.loose?BH[QH.LOOSE]:BH[QH.FULL]);if(!i)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+i[1],this.minor=+i[2],this.patch=+i[3],this.major>vI||this.major<0)throw new TypeError("Invalid major version");if(this.minor>vI||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>vI||this.patch<0)throw new TypeError("Invalid patch version");i[4]?this.prerelease=i[4].split(".").map(n=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);i===-1&&this.prerelease.push(0)}t&&(this.prerelease[0]===t?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}};bH.exports=Un});var $l=w((iZe,PH)=>{var{MAX_LENGTH:Rde}=ed(),{re:SH,t:vH}=Zl(),xH=Li(),Fde=rd(),Nde=(r,e)=>{if(e=Fde(e),r instanceof xH)return r;if(typeof r!="string"||r.length>Rde||!(e.loose?SH[vH.LOOSE]:SH[vH.FULL]).test(r))return null;try{return new xH(r,e)}catch{return null}};PH.exports=Nde});var kH=w((nZe,DH)=>{var Lde=$l(),Tde=(r,e)=>{let t=Lde(r,e);return t?t.version:null};DH.exports=Tde});var FH=w((sZe,RH)=>{var Ode=$l(),Mde=(r,e)=>{let t=Ode(r.trim().replace(/^[=v]+/,""),e);return t?t.version:null};RH.exports=Mde});var LH=w((oZe,NH)=>{var Kde=Li(),Ude=(r,e,t,i)=>{typeof t=="string"&&(i=t,t=void 0);try{return new Kde(r,t).inc(e,i).version}catch{return null}};NH.exports=Ude});var ss=w((aZe,OH)=>{var TH=Li(),Hde=(r,e,t)=>new TH(r,t).compare(new TH(e,t));OH.exports=Hde});var xI=w((AZe,MH)=>{var Gde=ss(),Yde=(r,e,t)=>Gde(r,e,t)===0;MH.exports=Yde});var HH=w((lZe,UH)=>{var KH=$l(),jde=xI(),qde=(r,e)=>{if(jde(r,e))return null;{let t=KH(r),i=KH(e),n=t.prerelease.length||i.prerelease.length,s=n?"pre":"",o=n?"prerelease":"";for(let a in t)if((a==="major"||a==="minor"||a==="patch")&&t[a]!==i[a])return s+a;return o}};UH.exports=qde});var YH=w((cZe,GH)=>{var Jde=Li(),Wde=(r,e)=>new Jde(r,e).major;GH.exports=Wde});var qH=w((uZe,jH)=>{var zde=Li(),Vde=(r,e)=>new zde(r,e).minor;jH.exports=Vde});var WH=w((gZe,JH)=>{var Xde=Li(),_de=(r,e)=>new Xde(r,e).patch;JH.exports=_de});var VH=w((fZe,zH)=>{var Zde=$l(),$de=(r,e)=>{let t=Zde(r,e);return t&&t.prerelease.length?t.prerelease:null};zH.exports=$de});var _H=w((hZe,XH)=>{var eCe=ss(),tCe=(r,e,t)=>eCe(e,r,t);XH.exports=tCe});var $H=w((pZe,ZH)=>{var rCe=ss(),iCe=(r,e)=>rCe(r,e,!0);ZH.exports=iCe});var PI=w((dZe,tG)=>{var eG=Li(),nCe=(r,e,t)=>{let i=new eG(r,t),n=new eG(e,t);return i.compare(n)||i.compareBuild(n)};tG.exports=nCe});var iG=w((CZe,rG)=>{var sCe=PI(),oCe=(r,e)=>r.sort((t,i)=>sCe(t,i,e));rG.exports=oCe});var sG=w((mZe,nG)=>{var aCe=PI(),ACe=(r,e)=>r.sort((t,i)=>aCe(i,t,e));nG.exports=ACe});var nd=w((EZe,oG)=>{var lCe=ss(),cCe=(r,e,t)=>lCe(r,e,t)>0;oG.exports=cCe});var DI=w((IZe,aG)=>{var uCe=ss(),gCe=(r,e,t)=>uCe(r,e,t)<0;aG.exports=gCe});var rv=w((yZe,AG)=>{var fCe=ss(),hCe=(r,e,t)=>fCe(r,e,t)!==0;AG.exports=hCe});var kI=w((wZe,lG)=>{var pCe=ss(),dCe=(r,e,t)=>pCe(r,e,t)>=0;lG.exports=dCe});var RI=w((BZe,cG)=>{var CCe=ss(),mCe=(r,e,t)=>CCe(r,e,t)<=0;cG.exports=mCe});var iv=w((QZe,uG)=>{var ECe=xI(),ICe=rv(),yCe=nd(),wCe=kI(),BCe=DI(),QCe=RI(),bCe=(r,e,t,i)=>{switch(e){case"===":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r===t;case"!==":return typeof r=="object"&&(r=r.version),typeof t=="object"&&(t=t.version),r!==t;case"":case"=":case"==":return ECe(r,t,i);case"!=":return ICe(r,t,i);case">":return yCe(r,t,i);case">=":return wCe(r,t,i);case"<":return BCe(r,t,i);case"<=":return QCe(r,t,i);default:throw new TypeError(`Invalid operator: ${e}`)}};uG.exports=bCe});var fG=w((bZe,gG)=>{var SCe=Li(),vCe=$l(),{re:FI,t:NI}=Zl(),xCe=(r,e)=>{if(r instanceof SCe)return r;if(typeof r=="number"&&(r=String(r)),typeof r!="string")return null;e=e||{};let t=null;if(!e.rtl)t=r.match(FI[NI.COERCE]);else{let i;for(;(i=FI[NI.COERCERTL].exec(r))&&(!t||t.index+t[0].length!==r.length);)(!t||i.index+i[0].length!==t.index+t[0].length)&&(t=i),FI[NI.COERCERTL].lastIndex=i.index+i[1].length+i[2].length;FI[NI.COERCERTL].lastIndex=-1}return t===null?null:vCe(`${t[2]}.${t[3]||"0"}.${t[4]||"0"}`,e)};gG.exports=xCe});var pG=w((SZe,hG)=>{"use strict";hG.exports=function(r){r.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}});var sd=w((vZe,dG)=>{"use strict";dG.exports=Ht;Ht.Node=ec;Ht.create=Ht;function Ht(r){var e=this;if(e instanceof Ht||(e=new Ht),e.tail=null,e.head=null,e.length=0,r&&typeof r.forEach=="function")r.forEach(function(n){e.push(n)});else if(arguments.length>0)for(var t=0,i=arguments.length;t1)t=e;else if(this.head)i=this.head.next,t=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=0;i!==null;n++)t=r(t,i.value,n),i=i.next;return t};Ht.prototype.reduceReverse=function(r,e){var t,i=this.tail;if(arguments.length>1)t=e;else if(this.tail)i=this.tail.prev,t=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var n=this.length-1;i!==null;n--)t=r(t,i.value,n),i=i.prev;return t};Ht.prototype.toArray=function(){for(var r=new Array(this.length),e=0,t=this.head;t!==null;e++)r[e]=t.value,t=t.next;return r};Ht.prototype.toArrayReverse=function(){for(var r=new Array(this.length),e=0,t=this.tail;t!==null;e++)r[e]=t.value,t=t.prev;return r};Ht.prototype.slice=function(r,e){e=e||this.length,e<0&&(e+=this.length),r=r||0,r<0&&(r+=this.length);var t=new Ht;if(ethis.length&&(e=this.length);for(var i=0,n=this.head;n!==null&&ithis.length&&(e=this.length);for(var i=this.length,n=this.tail;n!==null&&i>e;i--)n=n.prev;for(;n!==null&&i>r;i--,n=n.prev)t.push(n.value);return t};Ht.prototype.splice=function(r,e,...t){r>this.length&&(r=this.length-1),r<0&&(r=this.length+r);for(var i=0,n=this.head;n!==null&&i{"use strict";var RCe=sd(),tc=Symbol("max"),Ia=Symbol("length"),Og=Symbol("lengthCalculator"),ad=Symbol("allowStale"),rc=Symbol("maxAge"),Ea=Symbol("dispose"),CG=Symbol("noDisposeOnSet"),di=Symbol("lruList"),Ws=Symbol("cache"),EG=Symbol("updateAgeOnGet"),nv=()=>1,ov=class{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");let t=this[tc]=e.max||1/0,i=e.length||nv;if(this[Og]=typeof i!="function"?nv:i,this[ad]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[rc]=e.maxAge||0,this[Ea]=e.dispose,this[CG]=e.noDisposeOnSet||!1,this[EG]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[tc]=e||1/0,od(this)}get max(){return this[tc]}set allowStale(e){this[ad]=!!e}get allowStale(){return this[ad]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[rc]=e,od(this)}get maxAge(){return this[rc]}set lengthCalculator(e){typeof e!="function"&&(e=nv),e!==this[Og]&&(this[Og]=e,this[Ia]=0,this[di].forEach(t=>{t.length=this[Og](t.value,t.key),this[Ia]+=t.length})),od(this)}get lengthCalculator(){return this[Og]}get length(){return this[Ia]}get itemCount(){return this[di].length}rforEach(e,t){t=t||this;for(let i=this[di].tail;i!==null;){let n=i.prev;mG(this,e,i,t),i=n}}forEach(e,t){t=t||this;for(let i=this[di].head;i!==null;){let n=i.next;mG(this,e,i,t),i=n}}keys(){return this[di].toArray().map(e=>e.key)}values(){return this[di].toArray().map(e=>e.value)}reset(){this[Ea]&&this[di]&&this[di].length&&this[di].forEach(e=>this[Ea](e.key,e.value)),this[Ws]=new Map,this[di]=new RCe,this[Ia]=0}dump(){return this[di].map(e=>LI(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[di]}set(e,t,i){if(i=i||this[rc],i&&typeof i!="number")throw new TypeError("maxAge must be a number");let n=i?Date.now():0,s=this[Og](t,e);if(this[Ws].has(e)){if(s>this[tc])return Mg(this,this[Ws].get(e)),!1;let l=this[Ws].get(e).value;return this[Ea]&&(this[CG]||this[Ea](e,l.value)),l.now=n,l.maxAge=i,l.value=t,this[Ia]+=s-l.length,l.length=s,this.get(e),od(this),!0}let o=new av(e,t,s,n,i);return o.length>this[tc]?(this[Ea]&&this[Ea](e,t),!1):(this[Ia]+=o.length,this[di].unshift(o),this[Ws].set(e,this[di].head),od(this),!0)}has(e){if(!this[Ws].has(e))return!1;let t=this[Ws].get(e).value;return!LI(this,t)}get(e){return sv(this,e,!0)}peek(e){return sv(this,e,!1)}pop(){let e=this[di].tail;return e?(Mg(this,e),e.value):null}del(e){Mg(this,this[Ws].get(e))}load(e){this.reset();let t=Date.now();for(let i=e.length-1;i>=0;i--){let n=e[i],s=n.e||0;if(s===0)this.set(n.k,n.v);else{let o=s-t;o>0&&this.set(n.k,n.v,o)}}}prune(){this[Ws].forEach((e,t)=>sv(this,t,!1))}},sv=(r,e,t)=>{let i=r[Ws].get(e);if(i){let n=i.value;if(LI(r,n)){if(Mg(r,i),!r[ad])return}else t&&(r[EG]&&(i.value.now=Date.now()),r[di].unshiftNode(i));return n.value}},LI=(r,e)=>{if(!e||!e.maxAge&&!r[rc])return!1;let t=Date.now()-e.now;return e.maxAge?t>e.maxAge:r[rc]&&t>r[rc]},od=r=>{if(r[Ia]>r[tc])for(let e=r[di].tail;r[Ia]>r[tc]&&e!==null;){let t=e.prev;Mg(r,e),e=t}},Mg=(r,e)=>{if(e){let t=e.value;r[Ea]&&r[Ea](t.key,t.value),r[Ia]-=t.length,r[Ws].delete(t.key),r[di].removeNode(e)}},av=class{constructor(e,t,i,n,s){this.key=e,this.value=t,this.length=i,this.now=n,this.maxAge=s||0}},mG=(r,e,t,i)=>{let n=t.value;LI(r,n)&&(Mg(r,t),r[ad]||(n=void 0)),n&&e.call(i,n.value,n.key,r)};IG.exports=ov});var os=w((PZe,bG)=>{var ic=class{constructor(e,t){if(t=NCe(t),e instanceof ic)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new ic(e.raw,t);if(e instanceof Av)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split(/\s*\|\|\s*/).map(i=>this.parseRange(i.trim())).filter(i=>i.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){let i=this.set[0];if(this.set=this.set.filter(n=>!BG(n[0])),this.set.length===0)this.set=[i];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&KCe(n[0])){this.set=[n];break}}}this.format()}format(){return this.range=this.set.map(e=>e.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();let i=`parseRange:${Object.keys(this.options).join(",")}:${e}`,n=wG.get(i);if(n)return n;let s=this.options.loose,o=s?Ti[Bi.HYPHENRANGELOOSE]:Ti[Bi.HYPHENRANGE];e=e.replace(o,VCe(this.options.includePrerelease)),Gr("hyphen replace",e),e=e.replace(Ti[Bi.COMPARATORTRIM],TCe),Gr("comparator trim",e,Ti[Bi.COMPARATORTRIM]),e=e.replace(Ti[Bi.TILDETRIM],OCe),e=e.replace(Ti[Bi.CARETTRIM],MCe),e=e.split(/\s+/).join(" ");let a=s?Ti[Bi.COMPARATORLOOSE]:Ti[Bi.COMPARATOR],l=e.split(" ").map(f=>UCe(f,this.options)).join(" ").split(/\s+/).map(f=>zCe(f,this.options)).filter(this.options.loose?f=>!!f.match(a):()=>!0).map(f=>new Av(f,this.options)),c=l.length,u=new Map;for(let f of l){if(BG(f))return[f];u.set(f.value,f)}u.size>1&&u.has("")&&u.delete("");let g=[...u.values()];return wG.set(i,g),g}intersects(e,t){if(!(e instanceof ic))throw new TypeError("a Range is required");return this.set.some(i=>QG(i,t)&&e.set.some(n=>QG(n,t)&&i.every(s=>n.every(o=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new LCe(e,this.options)}catch{return!1}for(let t=0;tr.value==="<0.0.0-0",KCe=r=>r.value==="",QG=(r,e)=>{let t=!0,i=r.slice(),n=i.pop();for(;t&&i.length;)t=i.every(s=>n.intersects(s,e)),n=i.pop();return t},UCe=(r,e)=>(Gr("comp",r,e),r=YCe(r,e),Gr("caret",r),r=HCe(r,e),Gr("tildes",r),r=qCe(r,e),Gr("xrange",r),r=WCe(r,e),Gr("stars",r),r),Vi=r=>!r||r.toLowerCase()==="x"||r==="*",HCe=(r,e)=>r.trim().split(/\s+/).map(t=>GCe(t,e)).join(" "),GCe=(r,e)=>{let t=e.loose?Ti[Bi.TILDELOOSE]:Ti[Bi.TILDE];return r.replace(t,(i,n,s,o,a)=>{Gr("tilde",r,i,n,s,o,a);let l;return Vi(n)?l="":Vi(s)?l=`>=${n}.0.0 <${+n+1}.0.0-0`:Vi(o)?l=`>=${n}.${s}.0 <${n}.${+s+1}.0-0`:a?(Gr("replaceTilde pr",a),l=`>=${n}.${s}.${o}-${a} <${n}.${+s+1}.0-0`):l=`>=${n}.${s}.${o} <${n}.${+s+1}.0-0`,Gr("tilde return",l),l})},YCe=(r,e)=>r.trim().split(/\s+/).map(t=>jCe(t,e)).join(" "),jCe=(r,e)=>{Gr("caret",r,e);let t=e.loose?Ti[Bi.CARETLOOSE]:Ti[Bi.CARET],i=e.includePrerelease?"-0":"";return r.replace(t,(n,s,o,a,l)=>{Gr("caret",r,n,s,o,a,l);let c;return Vi(s)?c="":Vi(o)?c=`>=${s}.0.0${i} <${+s+1}.0.0-0`:Vi(a)?s==="0"?c=`>=${s}.${o}.0${i} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.0${i} <${+s+1}.0.0-0`:l?(Gr("replaceCaret pr",l),s==="0"?o==="0"?c=`>=${s}.${o}.${a}-${l} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}-${l} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a}-${l} <${+s+1}.0.0-0`):(Gr("no pr"),s==="0"?o==="0"?c=`>=${s}.${o}.${a}${i} <${s}.${o}.${+a+1}-0`:c=`>=${s}.${o}.${a}${i} <${s}.${+o+1}.0-0`:c=`>=${s}.${o}.${a} <${+s+1}.0.0-0`),Gr("caret return",c),c})},qCe=(r,e)=>(Gr("replaceXRanges",r,e),r.split(/\s+/).map(t=>JCe(t,e)).join(" ")),JCe=(r,e)=>{r=r.trim();let t=e.loose?Ti[Bi.XRANGELOOSE]:Ti[Bi.XRANGE];return r.replace(t,(i,n,s,o,a,l)=>{Gr("xRange",r,i,n,s,o,a,l);let c=Vi(s),u=c||Vi(o),g=u||Vi(a),f=g;return n==="="&&f&&(n=""),l=e.includePrerelease?"-0":"",c?n===">"||n==="<"?i="<0.0.0-0":i="*":n&&f?(u&&(o=0),a=0,n===">"?(n=">=",u?(s=+s+1,o=0,a=0):(o=+o+1,a=0)):n==="<="&&(n="<",u?s=+s+1:o=+o+1),n==="<"&&(l="-0"),i=`${n+s}.${o}.${a}${l}`):u?i=`>=${s}.0.0${l} <${+s+1}.0.0-0`:g&&(i=`>=${s}.${o}.0${l} <${s}.${+o+1}.0-0`),Gr("xRange return",i),i})},WCe=(r,e)=>(Gr("replaceStars",r,e),r.trim().replace(Ti[Bi.STAR],"")),zCe=(r,e)=>(Gr("replaceGTE0",r,e),r.trim().replace(Ti[e.includePrerelease?Bi.GTE0PRE:Bi.GTE0],"")),VCe=r=>(e,t,i,n,s,o,a,l,c,u,g,f,h)=>(Vi(i)?t="":Vi(n)?t=`>=${i}.0.0${r?"-0":""}`:Vi(s)?t=`>=${i}.${n}.0${r?"-0":""}`:o?t=`>=${t}`:t=`>=${t}${r?"-0":""}`,Vi(c)?l="":Vi(u)?l=`<${+c+1}.0.0-0`:Vi(g)?l=`<${c}.${+u+1}.0-0`:f?l=`<=${c}.${u}.${g}-${f}`:r?l=`<${c}.${u}.${+g+1}-0`:l=`<=${l}`,`${t} ${l}`.trim()),XCe=(r,e,t)=>{for(let i=0;i0){let n=r[i].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}return!1}return!0}});var Ad=w((DZe,DG)=>{var ld=Symbol("SemVer ANY"),Kg=class{static get ANY(){return ld}constructor(e,t){if(t=_Ce(t),e instanceof Kg){if(e.loose===!!t.loose)return e;e=e.value}cv("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===ld?this.value="":this.value=this.operator+this.semver.version,cv("comp",this)}parse(e){let t=this.options.loose?SG[vG.COMPARATORLOOSE]:SG[vG.COMPARATOR],i=e.match(t);if(!i)throw new TypeError(`Invalid comparator: ${e}`);this.operator=i[1]!==void 0?i[1]:"",this.operator==="="&&(this.operator=""),i[2]?this.semver=new xG(i[2],this.options.loose):this.semver=ld}toString(){return this.value}test(e){if(cv("Comparator.test",e,this.options.loose),this.semver===ld||e===ld)return!0;if(typeof e=="string")try{e=new xG(e,this.options)}catch{return!1}return lv(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof Kg))throw new TypeError("a Comparator is required");if((!t||typeof t!="object")&&(t={loose:!!t,includePrerelease:!1}),this.operator==="")return this.value===""?!0:new PG(e.value,t).test(this.value);if(e.operator==="")return e.value===""?!0:new PG(this.value,t).test(e.semver);let i=(this.operator===">="||this.operator===">")&&(e.operator===">="||e.operator===">"),n=(this.operator==="<="||this.operator==="<")&&(e.operator==="<="||e.operator==="<"),s=this.semver.version===e.semver.version,o=(this.operator===">="||this.operator==="<=")&&(e.operator===">="||e.operator==="<="),a=lv(this.semver,"<",e.semver,t)&&(this.operator===">="||this.operator===">")&&(e.operator==="<="||e.operator==="<"),l=lv(this.semver,">",e.semver,t)&&(this.operator==="<="||this.operator==="<")&&(e.operator===">="||e.operator===">");return i||n||s&&o||a||l}};DG.exports=Kg;var _Ce=rd(),{re:SG,t:vG}=Zl(),lv=iv(),cv=td(),xG=Li(),PG=os()});var cd=w((kZe,kG)=>{var ZCe=os(),$Ce=(r,e,t)=>{try{e=new ZCe(e,t)}catch{return!1}return e.test(r)};kG.exports=$Ce});var FG=w((RZe,RG)=>{var eme=os(),tme=(r,e)=>new eme(r,e).set.map(t=>t.map(i=>i.value).join(" ").trim().split(" "));RG.exports=tme});var LG=w((FZe,NG)=>{var rme=Li(),ime=os(),nme=(r,e,t)=>{let i=null,n=null,s=null;try{s=new ime(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!i||n.compare(o)===-1)&&(i=o,n=new rme(i,t))}),i};NG.exports=nme});var OG=w((NZe,TG)=>{var sme=Li(),ome=os(),ame=(r,e,t)=>{let i=null,n=null,s=null;try{s=new ome(e,t)}catch{return null}return r.forEach(o=>{s.test(o)&&(!i||n.compare(o)===1)&&(i=o,n=new sme(i,t))}),i};TG.exports=ame});var UG=w((LZe,KG)=>{var uv=Li(),Ame=os(),MG=nd(),lme=(r,e)=>{r=new Ame(r,e);let t=new uv("0.0.0");if(r.test(t)||(t=new uv("0.0.0-0"),r.test(t)))return t;t=null;for(let i=0;i{let a=new uv(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||MG(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!t||MG(t,s))&&(t=s)}return t&&r.test(t)?t:null};KG.exports=lme});var GG=w((TZe,HG)=>{var cme=os(),ume=(r,e)=>{try{return new cme(r,e).range||"*"}catch{return null}};HG.exports=ume});var TI=w((OZe,JG)=>{var gme=Li(),qG=Ad(),{ANY:fme}=qG,hme=os(),pme=cd(),YG=nd(),jG=DI(),dme=RI(),Cme=kI(),mme=(r,e,t,i)=>{r=new gme(r,i),e=new hme(e,i);let n,s,o,a,l;switch(t){case">":n=YG,s=dme,o=jG,a=">",l=">=";break;case"<":n=jG,s=Cme,o=YG,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(pme(r,e,i))return!1;for(let c=0;c{h.semver===fme&&(h=new qG(">=0.0.0")),g=g||h,f=f||h,n(h.semver,g.semver,i)?g=h:o(h.semver,f.semver,i)&&(f=h)}),g.operator===a||g.operator===l||(!f.operator||f.operator===a)&&s(r,f.semver))return!1;if(f.operator===l&&o(r,f.semver))return!1}return!0};JG.exports=mme});var zG=w((MZe,WG)=>{var Eme=TI(),Ime=(r,e,t)=>Eme(r,e,">",t);WG.exports=Ime});var XG=w((KZe,VG)=>{var yme=TI(),wme=(r,e,t)=>yme(r,e,"<",t);VG.exports=wme});var $G=w((UZe,ZG)=>{var _G=os(),Bme=(r,e,t)=>(r=new _G(r,t),e=new _G(e,t),r.intersects(e));ZG.exports=Bme});var tY=w((HZe,eY)=>{var Qme=cd(),bme=ss();eY.exports=(r,e,t)=>{let i=[],n=null,s=null,o=r.sort((u,g)=>bme(u,g,t));for(let u of o)Qme(u,e,t)?(s=u,n||(n=u)):(s&&i.push([n,s]),s=null,n=null);n&&i.push([n,null]);let a=[];for(let[u,g]of i)u===g?a.push(u):!g&&u===o[0]?a.push("*"):g?u===o[0]?a.push(`<=${g}`):a.push(`${u} - ${g}`):a.push(`>=${u}`);let l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length{var rY=os(),OI=Ad(),{ANY:gv}=OI,ud=cd(),fv=ss(),Sme=(r,e,t={})=>{if(r===e)return!0;r=new rY(r,t),e=new rY(e,t);let i=!1;e:for(let n of r.set){for(let s of e.set){let o=vme(n,s,t);if(i=i||o!==null,o)continue e}if(i)return!1}return!0},vme=(r,e,t)=>{if(r===e)return!0;if(r.length===1&&r[0].semver===gv){if(e.length===1&&e[0].semver===gv)return!0;t.includePrerelease?r=[new OI(">=0.0.0-0")]:r=[new OI(">=0.0.0")]}if(e.length===1&&e[0].semver===gv){if(t.includePrerelease)return!0;e=[new OI(">=0.0.0")]}let i=new Set,n,s;for(let h of r)h.operator===">"||h.operator===">="?n=iY(n,h,t):h.operator==="<"||h.operator==="<="?s=nY(s,h,t):i.add(h.semver);if(i.size>1)return null;let o;if(n&&s){if(o=fv(n.semver,s.semver,t),o>0)return null;if(o===0&&(n.operator!==">="||s.operator!=="<="))return null}for(let h of i){if(n&&!ud(h,String(n),t)||s&&!ud(h,String(s),t))return null;for(let p of e)if(!ud(h,String(p),t))return!1;return!0}let a,l,c,u,g=s&&!t.includePrerelease&&s.semver.prerelease.length?s.semver:!1,f=n&&!t.includePrerelease&&n.semver.prerelease.length?n.semver:!1;g&&g.prerelease.length===1&&s.operator==="<"&&g.prerelease[0]===0&&(g=!1);for(let h of e){if(u=u||h.operator===">"||h.operator===">=",c=c||h.operator==="<"||h.operator==="<=",n){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator===">"||h.operator===">="){if(a=iY(n,h,t),a===h&&a!==n)return!1}else if(n.operator===">="&&!ud(n.semver,String(h),t))return!1}if(s){if(g&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===g.major&&h.semver.minor===g.minor&&h.semver.patch===g.patch&&(g=!1),h.operator==="<"||h.operator==="<="){if(l=nY(s,h,t),l===h&&l!==s)return!1}else if(s.operator==="<="&&!ud(s.semver,String(h),t))return!1}if(!h.operator&&(s||n)&&o!==0)return!1}return!(n&&c&&!s&&o!==0||s&&u&&!n&&o!==0||f||g)},iY=(r,e,t)=>{if(!r)return e;let i=fv(r.semver,e.semver,t);return i>0?r:i<0||e.operator===">"&&r.operator===">="?e:r},nY=(r,e,t)=>{if(!r)return e;let i=fv(r.semver,e.semver,t);return i<0?r:i>0||e.operator==="<"&&r.operator==="<="?e:r};sY.exports=Sme});var Xr=w((YZe,aY)=>{var hv=Zl();aY.exports={re:hv.re,src:hv.src,tokens:hv.t,SEMVER_SPEC_VERSION:ed().SEMVER_SPEC_VERSION,SemVer:Li(),compareIdentifiers:bI().compareIdentifiers,rcompareIdentifiers:bI().rcompareIdentifiers,parse:$l(),valid:kH(),clean:FH(),inc:LH(),diff:HH(),major:YH(),minor:qH(),patch:WH(),prerelease:VH(),compare:ss(),rcompare:_H(),compareLoose:$H(),compareBuild:PI(),sort:iG(),rsort:sG(),gt:nd(),lt:DI(),eq:xI(),neq:rv(),gte:kI(),lte:RI(),cmp:iv(),coerce:fG(),Comparator:Ad(),Range:os(),satisfies:cd(),toComparators:FG(),maxSatisfying:LG(),minSatisfying:OG(),minVersion:UG(),validRange:GG(),outside:TI(),gtr:zG(),ltr:XG(),intersects:$G(),simplifyRange:tY(),subset:oY()}});var pv=w(MI=>{"use strict";Object.defineProperty(MI,"__esModule",{value:!0});MI.VERSION=void 0;MI.VERSION="9.1.0"});var Gt=w((exports,module)=>{"use strict";var __spreadArray=exports&&exports.__spreadArray||function(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,s;i{(function(r,e){typeof define=="function"&&define.amd?define([],e):typeof KI=="object"&&KI.exports?KI.exports=e():r.regexpToAst=e()})(typeof self<"u"?self:AY,function(){function r(){}r.prototype.saveState=function(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}},r.prototype.restoreState=function(p){this.idx=p.idx,this.input=p.input,this.groupIdx=p.groupIdx},r.prototype.pattern=function(p){this.idx=0,this.input=p,this.groupIdx=0,this.consumeChar("/");var C=this.disjunction();this.consumeChar("/");for(var y={type:"Flags",loc:{begin:this.idx,end:p.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};this.isRegExpFlag();)switch(this.popChar()){case"g":o(y,"global");break;case"i":o(y,"ignoreCase");break;case"m":o(y,"multiLine");break;case"u":o(y,"unicode");break;case"y":o(y,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:y,value:C,loc:this.loc(0)}},r.prototype.disjunction=function(){var p=[],C=this.idx;for(p.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),p.push(this.alternative());return{type:"Disjunction",value:p,loc:this.loc(C)}},r.prototype.alternative=function(){for(var p=[],C=this.idx;this.isTerm();)p.push(this.term());return{type:"Alternative",value:p,loc:this.loc(C)}},r.prototype.term=function(){return this.isAssertion()?this.assertion():this.atom()},r.prototype.assertion=function(){var p=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(p)};case"$":return{type:"EndAnchor",loc:this.loc(p)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(p)};case"B":return{type:"NonWordBoundary",loc:this.loc(p)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");var C;switch(this.popChar()){case"=":C="Lookahead";break;case"!":C="NegativeLookahead";break}a(C);var y=this.disjunction();return this.consumeChar(")"),{type:C,value:y,loc:this.loc(p)}}l()},r.prototype.quantifier=function(p){var C,y=this.idx;switch(this.popChar()){case"*":C={atLeast:0,atMost:1/0};break;case"+":C={atLeast:1,atMost:1/0};break;case"?":C={atLeast:0,atMost:1};break;case"{":var B=this.integerIncludingZero();switch(this.popChar()){case"}":C={atLeast:B,atMost:B};break;case",":var v;this.isDigit()?(v=this.integerIncludingZero(),C={atLeast:B,atMost:v}):C={atLeast:B,atMost:1/0},this.consumeChar("}");break}if(p===!0&&C===void 0)return;a(C);break}if(!(p===!0&&C===void 0))return a(C),this.peekChar(0)==="?"?(this.consumeChar("?"),C.greedy=!1):C.greedy=!0,C.type="Quantifier",C.loc=this.loc(y),C},r.prototype.atom=function(){var p,C=this.idx;switch(this.peekChar()){case".":p=this.dotAll();break;case"\\":p=this.atomEscape();break;case"[":p=this.characterClass();break;case"(":p=this.group();break}return p===void 0&&this.isPatternCharacter()&&(p=this.patternCharacter()),a(p),p.loc=this.loc(C),this.isQuantifier()&&(p.quantifier=this.quantifier()),p},r.prototype.dotAll=function(){return this.consumeChar("."),{type:"Set",complement:!0,value:[n(` -`),n("\r"),n("\u2028"),n("\u2029")]}},r.prototype.atomEscape=function(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}},r.prototype.decimalEscapeAtom=function(){var p=this.positiveInteger();return{type:"GroupBackReference",value:p}},r.prototype.characterClassEscape=function(){var p,C=!1;switch(this.popChar()){case"d":p=u;break;case"D":p=u,C=!0;break;case"s":p=f;break;case"S":p=f,C=!0;break;case"w":p=g;break;case"W":p=g,C=!0;break}return a(p),{type:"Set",value:p,complement:C}},r.prototype.controlEscapeAtom=function(){var p;switch(this.popChar()){case"f":p=n("\f");break;case"n":p=n(` -`);break;case"r":p=n("\r");break;case"t":p=n(" ");break;case"v":p=n("\v");break}return a(p),{type:"Character",value:p}},r.prototype.controlLetterEscapeAtom=function(){this.consumeChar("c");var p=this.popChar();if(/[a-zA-Z]/.test(p)===!1)throw Error("Invalid ");var C=p.toUpperCase().charCodeAt(0)-64;return{type:"Character",value:C}},r.prototype.nulCharacterAtom=function(){return this.consumeChar("0"),{type:"Character",value:n("\0")}},r.prototype.hexEscapeSequenceAtom=function(){return this.consumeChar("x"),this.parseHexDigits(2)},r.prototype.regExpUnicodeEscapeSequenceAtom=function(){return this.consumeChar("u"),this.parseHexDigits(4)},r.prototype.identityEscapeAtom=function(){var p=this.popChar();return{type:"Character",value:n(p)}},r.prototype.classPatternCharacterAtom=function(){switch(this.peekChar()){case` -`:case"\r":case"\u2028":case"\u2029":case"\\":case"]":throw Error("TBD");default:var p=this.popChar();return{type:"Character",value:n(p)}}},r.prototype.characterClass=function(){var p=[],C=!1;for(this.consumeChar("["),this.peekChar(0)==="^"&&(this.consumeChar("^"),C=!0);this.isClassAtom();){var y=this.classAtom(),B=y.type==="Character";if(B&&this.isRangeDash()){this.consumeChar("-");var v=this.classAtom(),D=v.type==="Character";if(D){if(v.value=this.input.length)throw Error("Unexpected end of input");this.idx++},r.prototype.loc=function(p){return{begin:p,end:this.idx}};var e=/[0-9a-fA-F]/,t=/[0-9]/,i=/[1-9]/;function n(p){return p.charCodeAt(0)}function s(p,C){p.length!==void 0?p.forEach(function(y){C.push(y)}):C.push(p)}function o(p,C){if(p[C]===!0)throw"duplicate flag "+C;p[C]=!0}function a(p){if(p===void 0)throw Error("Internal Error - Should never get here!")}function l(){throw Error("Internal Error - Should never get here!")}var c,u=[];for(c=n("0");c<=n("9");c++)u.push(c);var g=[n("_")].concat(u);for(c=n("a");c<=n("z");c++)g.push(c);for(c=n("A");c<=n("Z");c++)g.push(c);var f=[n(" "),n("\f"),n(` -`),n("\r"),n(" "),n("\v"),n(" "),n("\xA0"),n("\u1680"),n("\u2000"),n("\u2001"),n("\u2002"),n("\u2003"),n("\u2004"),n("\u2005"),n("\u2006"),n("\u2007"),n("\u2008"),n("\u2009"),n("\u200A"),n("\u2028"),n("\u2029"),n("\u202F"),n("\u205F"),n("\u3000"),n("\uFEFF")];function h(){}return h.prototype.visitChildren=function(p){for(var C in p){var y=p[C];p.hasOwnProperty(C)&&(y.type!==void 0?this.visit(y):Array.isArray(y)&&y.forEach(function(B){this.visit(B)},this))}},h.prototype.visit=function(p){switch(p.type){case"Pattern":this.visitPattern(p);break;case"Flags":this.visitFlags(p);break;case"Disjunction":this.visitDisjunction(p);break;case"Alternative":this.visitAlternative(p);break;case"StartAnchor":this.visitStartAnchor(p);break;case"EndAnchor":this.visitEndAnchor(p);break;case"WordBoundary":this.visitWordBoundary(p);break;case"NonWordBoundary":this.visitNonWordBoundary(p);break;case"Lookahead":this.visitLookahead(p);break;case"NegativeLookahead":this.visitNegativeLookahead(p);break;case"Character":this.visitCharacter(p);break;case"Set":this.visitSet(p);break;case"Group":this.visitGroup(p);break;case"GroupBackReference":this.visitGroupBackReference(p);break;case"Quantifier":this.visitQuantifier(p);break}this.visitChildren(p)},h.prototype.visitPattern=function(p){},h.prototype.visitFlags=function(p){},h.prototype.visitDisjunction=function(p){},h.prototype.visitAlternative=function(p){},h.prototype.visitStartAnchor=function(p){},h.prototype.visitEndAnchor=function(p){},h.prototype.visitWordBoundary=function(p){},h.prototype.visitNonWordBoundary=function(p){},h.prototype.visitLookahead=function(p){},h.prototype.visitNegativeLookahead=function(p){},h.prototype.visitCharacter=function(p){},h.prototype.visitSet=function(p){},h.prototype.visitGroup=function(p){},h.prototype.visitGroupBackReference=function(p){},h.prototype.visitQuantifier=function(p){},{RegExpParser:r,BaseRegExpVisitor:h,VERSION:"0.5.0"}})});var GI=w(Ug=>{"use strict";Object.defineProperty(Ug,"__esModule",{value:!0});Ug.clearRegExpParserCache=Ug.getRegExpAst=void 0;var xme=UI(),HI={},Pme=new xme.RegExpParser;function Dme(r){var e=r.toString();if(HI.hasOwnProperty(e))return HI[e];var t=Pme.pattern(e);return HI[e]=t,t}Ug.getRegExpAst=Dme;function kme(){HI={}}Ug.clearRegExpParserCache=kme});var fY=w(pn=>{"use strict";var Rme=pn&&pn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(pn,"__esModule",{value:!0});pn.canMatchCharCode=pn.firstCharOptimizedIndices=pn.getOptimizedStartCodesIndices=pn.failedOptimizationPrefixMsg=void 0;var cY=UI(),as=Gt(),uY=GI(),ya=Cv(),gY="Complement Sets are not supported for first char optimization";pn.failedOptimizationPrefixMsg=`Unable to use "first char" lexer optimizations: -`;function Fme(r,e){e===void 0&&(e=!1);try{var t=(0,uY.getRegExpAst)(r),i=jI(t.value,{},t.flags.ignoreCase);return i}catch(s){if(s.message===gY)e&&(0,as.PRINT_WARNING)(""+pn.failedOptimizationPrefixMsg+(" Unable to optimize: < "+r.toString()+` > -`)+` Complement Sets cannot be automatically optimized. - This will disable the lexer's first char optimizations. - See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#COMPLEMENT for details.`);else{var n="";e&&(n=` - This will disable the lexer's first char optimizations. - See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#REGEXP_PARSING for details.`),(0,as.PRINT_ERROR)(pn.failedOptimizationPrefixMsg+` -`+(" Failed parsing: < "+r.toString()+` > -`)+(" Using the regexp-to-ast library version: "+cY.VERSION+` -`)+" Please open an issue at: https://github.com/bd82/regexp-to-ast/issues"+n)}}return[]}pn.getOptimizedStartCodesIndices=Fme;function jI(r,e,t){switch(r.type){case"Disjunction":for(var i=0;i=ya.minOptimizationVal)for(var f=u.from>=ya.minOptimizationVal?u.from:ya.minOptimizationVal,h=u.to,p=(0,ya.charCodeToOptimizedIndex)(f),C=(0,ya.charCodeToOptimizedIndex)(h),y=p;y<=C;y++)e[y]=y}}});break;case"Group":jI(o.value,e,t);break;default:throw Error("Non Exhaustive Match")}var a=o.quantifier!==void 0&&o.quantifier.atLeast===0;if(o.type==="Group"&&dv(o)===!1||o.type!=="Group"&&a===!1)break}break;default:throw Error("non exhaustive match!")}return(0,as.values)(e)}pn.firstCharOptimizedIndices=jI;function YI(r,e,t){var i=(0,ya.charCodeToOptimizedIndex)(r);e[i]=i,t===!0&&Nme(r,e)}function Nme(r,e){var t=String.fromCharCode(r),i=t.toUpperCase();if(i!==t){var n=(0,ya.charCodeToOptimizedIndex)(i.charCodeAt(0));e[n]=n}else{var s=t.toLowerCase();if(s!==t){var n=(0,ya.charCodeToOptimizedIndex)(s.charCodeAt(0));e[n]=n}}}function lY(r,e){return(0,as.find)(r.value,function(t){if(typeof t=="number")return(0,as.contains)(e,t);var i=t;return(0,as.find)(e,function(n){return i.from<=n&&n<=i.to})!==void 0})}function dv(r){return r.quantifier&&r.quantifier.atLeast===0?!0:r.value?(0,as.isArray)(r.value)?(0,as.every)(r.value,dv):dv(r.value):!1}var Lme=function(r){Rme(e,r);function e(t){var i=r.call(this)||this;return i.targetCharCodes=t,i.found=!1,i}return e.prototype.visitChildren=function(t){if(this.found!==!0){switch(t.type){case"Lookahead":this.visitLookahead(t);return;case"NegativeLookahead":this.visitNegativeLookahead(t);return}r.prototype.visitChildren.call(this,t)}},e.prototype.visitCharacter=function(t){(0,as.contains)(this.targetCharCodes,t.value)&&(this.found=!0)},e.prototype.visitSet=function(t){t.complement?lY(t,this.targetCharCodes)===void 0&&(this.found=!0):lY(t,this.targetCharCodes)!==void 0&&(this.found=!0)},e}(cY.BaseRegExpVisitor);function Tme(r,e){if(e instanceof RegExp){var t=(0,uY.getRegExpAst)(e),i=new Lme(r);return i.visit(t),i.found}else return(0,as.find)(e,function(n){return(0,as.contains)(r,n.charCodeAt(0))})!==void 0}pn.canMatchCharCode=Tme});var Cv=w(Ve=>{"use strict";var hY=Ve&&Ve.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Ve,"__esModule",{value:!0});Ve.charCodeToOptimizedIndex=Ve.minOptimizationVal=Ve.buildLineBreakIssueMessage=Ve.LineTerminatorOptimizedTester=Ve.isShortPattern=Ve.isCustomPattern=Ve.cloneEmptyGroups=Ve.performWarningRuntimeChecks=Ve.performRuntimeChecks=Ve.addStickyFlag=Ve.addStartOfInput=Ve.findUnreachablePatterns=Ve.findModesThatDoNotExist=Ve.findInvalidGroupType=Ve.findDuplicatePatterns=Ve.findUnsupportedFlags=Ve.findStartOfInputAnchor=Ve.findEmptyMatchRegExps=Ve.findEndOfInputAnchor=Ve.findInvalidPatterns=Ve.findMissingPatterns=Ve.validatePatterns=Ve.analyzeTokenTypes=Ve.enableSticky=Ve.disableSticky=Ve.SUPPORT_STICKY=Ve.MODES=Ve.DEFAULT_MODE=void 0;var pY=UI(),ir=gd(),xe=Gt(),Hg=fY(),dY=GI(),So="PATTERN";Ve.DEFAULT_MODE="defaultMode";Ve.MODES="modes";Ve.SUPPORT_STICKY=typeof new RegExp("(?:)").sticky=="boolean";function Ome(){Ve.SUPPORT_STICKY=!1}Ve.disableSticky=Ome;function Mme(){Ve.SUPPORT_STICKY=!0}Ve.enableSticky=Mme;function Kme(r,e){e=(0,xe.defaults)(e,{useSticky:Ve.SUPPORT_STICKY,debug:!1,safeMode:!1,positionTracking:"full",lineTerminatorCharacters:["\r",` -`],tracer:function(v,D){return D()}});var t=e.tracer;t("initCharCodeToOptimizedIndexMap",function(){Vme()});var i;t("Reject Lexer.NA",function(){i=(0,xe.reject)(r,function(v){return v[So]===ir.Lexer.NA})});var n=!1,s;t("Transform Patterns",function(){n=!1,s=(0,xe.map)(i,function(v){var D=v[So];if((0,xe.isRegExp)(D)){var L=D.source;return L.length===1&&L!=="^"&&L!=="$"&&L!=="."&&!D.ignoreCase?L:L.length===2&&L[0]==="\\"&&!(0,xe.contains)(["d","D","s","S","t","r","n","t","0","c","b","B","f","v","w","W"],L[1])?L[1]:e.useSticky?Iv(D):Ev(D)}else{if((0,xe.isFunction)(D))return n=!0,{exec:D};if((0,xe.has)(D,"exec"))return n=!0,D;if(typeof D=="string"){if(D.length===1)return D;var H=D.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),j=new RegExp(H);return e.useSticky?Iv(j):Ev(j)}else throw Error("non exhaustive match")}})});var o,a,l,c,u;t("misc mapping",function(){o=(0,xe.map)(i,function(v){return v.tokenTypeIdx}),a=(0,xe.map)(i,function(v){var D=v.GROUP;if(D!==ir.Lexer.SKIPPED){if((0,xe.isString)(D))return D;if((0,xe.isUndefined)(D))return!1;throw Error("non exhaustive match")}}),l=(0,xe.map)(i,function(v){var D=v.LONGER_ALT;if(D){var L=(0,xe.isArray)(D)?(0,xe.map)(D,function(H){return(0,xe.indexOf)(i,H)}):[(0,xe.indexOf)(i,D)];return L}}),c=(0,xe.map)(i,function(v){return v.PUSH_MODE}),u=(0,xe.map)(i,function(v){return(0,xe.has)(v,"POP_MODE")})});var g;t("Line Terminator Handling",function(){var v=DY(e.lineTerminatorCharacters);g=(0,xe.map)(i,function(D){return!1}),e.positionTracking!=="onlyOffset"&&(g=(0,xe.map)(i,function(D){if((0,xe.has)(D,"LINE_BREAKS"))return D.LINE_BREAKS;if(xY(D,v)===!1)return(0,Hg.canMatchCharCode)(v,D.PATTERN)}))});var f,h,p,C;t("Misc Mapping #2",function(){f=(0,xe.map)(i,wv),h=(0,xe.map)(s,vY),p=(0,xe.reduce)(i,function(v,D){var L=D.GROUP;return(0,xe.isString)(L)&&L!==ir.Lexer.SKIPPED&&(v[L]=[]),v},{}),C=(0,xe.map)(s,function(v,D){return{pattern:s[D],longerAlt:l[D],canLineTerminator:g[D],isCustom:f[D],short:h[D],group:a[D],push:c[D],pop:u[D],tokenTypeIdx:o[D],tokenType:i[D]}})});var y=!0,B=[];return e.safeMode||t("First Char Optimization",function(){B=(0,xe.reduce)(i,function(v,D,L){if(typeof D.PATTERN=="string"){var H=D.PATTERN.charCodeAt(0),j=yv(H);mv(v,j,C[L])}else if((0,xe.isArray)(D.START_CHARS_HINT)){var $;(0,xe.forEach)(D.START_CHARS_HINT,function(W){var Z=typeof W=="string"?W.charCodeAt(0):W,A=yv(Z);$!==A&&($=A,mv(v,A,C[L]))})}else if((0,xe.isRegExp)(D.PATTERN))if(D.PATTERN.unicode)y=!1,e.ensureOptimizations&&(0,xe.PRINT_ERROR)(""+Hg.failedOptimizationPrefixMsg+(" Unable to analyze < "+D.PATTERN.toString()+` > pattern. -`)+` The regexp unicode flag is not currently supported by the regexp-to-ast library. - This will disable the lexer's first char optimizations. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNICODE_OPTIMIZE`);else{var V=(0,Hg.getOptimizedStartCodesIndices)(D.PATTERN,e.ensureOptimizations);(0,xe.isEmpty)(V)&&(y=!1),(0,xe.forEach)(V,function(W){mv(v,W,C[L])})}else e.ensureOptimizations&&(0,xe.PRINT_ERROR)(""+Hg.failedOptimizationPrefixMsg+(" TokenType: <"+D.name+`> is using a custom token pattern without providing parameter. -`)+` This will disable the lexer's first char optimizations. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_OPTIMIZE`),y=!1;return v},[])}),t("ArrayPacking",function(){B=(0,xe.packArray)(B)}),{emptyGroups:p,patternIdxToConfig:C,charCodeToPatternIdxToConfig:B,hasCustom:n,canBeOptimized:y}}Ve.analyzeTokenTypes=Kme;function Ume(r,e){var t=[],i=CY(r);t=t.concat(i.errors);var n=mY(i.valid),s=n.valid;return t=t.concat(n.errors),t=t.concat(Hme(s)),t=t.concat(QY(s)),t=t.concat(bY(s,e)),t=t.concat(SY(s)),t}Ve.validatePatterns=Ume;function Hme(r){var e=[],t=(0,xe.filter)(r,function(i){return(0,xe.isRegExp)(i[So])});return e=e.concat(EY(t)),e=e.concat(yY(t)),e=e.concat(wY(t)),e=e.concat(BY(t)),e=e.concat(IY(t)),e}function CY(r){var e=(0,xe.filter)(r,function(n){return!(0,xe.has)(n,So)}),t=(0,xe.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- missing static 'PATTERN' property",type:ir.LexerDefinitionErrorType.MISSING_PATTERN,tokenTypes:[n]}}),i=(0,xe.difference)(r,e);return{errors:t,valid:i}}Ve.findMissingPatterns=CY;function mY(r){var e=(0,xe.filter)(r,function(n){var s=n[So];return!(0,xe.isRegExp)(s)&&!(0,xe.isFunction)(s)&&!(0,xe.has)(s,"exec")&&!(0,xe.isString)(s)}),t=(0,xe.map)(e,function(n){return{message:"Token Type: ->"+n.name+"<- static 'PATTERN' can only be a RegExp, a Function matching the {CustomPatternMatcherFunc} type or an Object matching the {ICustomPattern} interface.",type:ir.LexerDefinitionErrorType.INVALID_PATTERN,tokenTypes:[n]}}),i=(0,xe.difference)(r,e);return{errors:t,valid:i}}Ve.findInvalidPatterns=mY;var Gme=/[^\\][\$]/;function EY(r){var e=function(n){hY(s,n);function s(){var o=n!==null&&n.apply(this,arguments)||this;return o.found=!1,o}return s.prototype.visitEndAnchor=function(o){this.found=!0},s}(pY.BaseRegExpVisitor),t=(0,xe.filter)(r,function(n){var s=n[So];try{var o=(0,dY.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return Gme.test(s.source)}}),i=(0,xe.map)(t,function(n){return{message:`Unexpected RegExp Anchor Error: - Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain end of input anchor '$' - See chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ir.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}Ve.findEndOfInputAnchor=EY;function IY(r){var e=(0,xe.filter)(r,function(i){var n=i[So];return n.test("")}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' must not match an empty string",type:ir.LexerDefinitionErrorType.EMPTY_MATCH_PATTERN,tokenTypes:[i]}});return t}Ve.findEmptyMatchRegExps=IY;var Yme=/[^\\[][\^]|^\^/;function yY(r){var e=function(n){hY(s,n);function s(){var o=n!==null&&n.apply(this,arguments)||this;return o.found=!1,o}return s.prototype.visitStartAnchor=function(o){this.found=!0},s}(pY.BaseRegExpVisitor),t=(0,xe.filter)(r,function(n){var s=n[So];try{var o=(0,dY.getRegExpAst)(s),a=new e;return a.visit(o),a.found}catch{return Yme.test(s.source)}}),i=(0,xe.map)(t,function(n){return{message:`Unexpected RegExp Anchor Error: - Token Type: ->`+n.name+`<- static 'PATTERN' cannot contain start of input anchor '^' - See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#ANCHORS for details.`,type:ir.LexerDefinitionErrorType.SOI_ANCHOR_FOUND,tokenTypes:[n]}});return i}Ve.findStartOfInputAnchor=yY;function wY(r){var e=(0,xe.filter)(r,function(i){var n=i[So];return n instanceof RegExp&&(n.multiline||n.global)}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:ir.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenTypes:[i]}});return t}Ve.findUnsupportedFlags=wY;function BY(r){var e=[],t=(0,xe.map)(r,function(s){return(0,xe.reduce)(r,function(o,a){return s.PATTERN.source===a.PATTERN.source&&!(0,xe.contains)(e,a)&&a.PATTERN!==ir.Lexer.NA&&(e.push(a),o.push(a)),o},[])});t=(0,xe.compact)(t);var i=(0,xe.filter)(t,function(s){return s.length>1}),n=(0,xe.map)(i,function(s){var o=(0,xe.map)(s,function(l){return l.name}),a=(0,xe.first)(s).PATTERN;return{message:"The same RegExp pattern ->"+a+"<-"+("has been used in all of the following Token Types: "+o.join(", ")+" <-"),type:ir.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenTypes:s}});return n}Ve.findDuplicatePatterns=BY;function QY(r){var e=(0,xe.filter)(r,function(i){if(!(0,xe.has)(i,"GROUP"))return!1;var n=i.GROUP;return n!==ir.Lexer.SKIPPED&&n!==ir.Lexer.NA&&!(0,xe.isString)(n)}),t=(0,xe.map)(e,function(i){return{message:"Token Type: ->"+i.name+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:ir.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenTypes:[i]}});return t}Ve.findInvalidGroupType=QY;function bY(r,e){var t=(0,xe.filter)(r,function(n){return n.PUSH_MODE!==void 0&&!(0,xe.contains)(e,n.PUSH_MODE)}),i=(0,xe.map)(t,function(n){var s="Token Type: ->"+n.name+"<- static 'PUSH_MODE' value cannot refer to a Lexer Mode ->"+n.PUSH_MODE+"<-which does not exist";return{message:s,type:ir.LexerDefinitionErrorType.PUSH_MODE_DOES_NOT_EXIST,tokenTypes:[n]}});return i}Ve.findModesThatDoNotExist=bY;function SY(r){var e=[],t=(0,xe.reduce)(r,function(i,n,s){var o=n.PATTERN;return o===ir.Lexer.NA||((0,xe.isString)(o)?i.push({str:o,idx:s,tokenType:n}):(0,xe.isRegExp)(o)&&qme(o)&&i.push({str:o.source,idx:s,tokenType:n})),i},[]);return(0,xe.forEach)(r,function(i,n){(0,xe.forEach)(t,function(s){var o=s.str,a=s.idx,l=s.tokenType;if(n"+i.name+"<-")+`in the lexer's definition. -See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#UNREACHABLE`;e.push({message:c,type:ir.LexerDefinitionErrorType.UNREACHABLE_PATTERN,tokenTypes:[i,l]})}})}),e}Ve.findUnreachablePatterns=SY;function jme(r,e){if((0,xe.isRegExp)(e)){var t=e.exec(r);return t!==null&&t.index===0}else{if((0,xe.isFunction)(e))return e(r,0,[],{});if((0,xe.has)(e,"exec"))return e.exec(r,0,[],{});if(typeof e=="string")return e===r;throw Error("non exhaustive match")}}function qme(r){var e=[".","\\","[","]","|","^","$","(",")","?","*","+","{"];return(0,xe.find)(e,function(t){return r.source.indexOf(t)!==-1})===void 0}function Ev(r){var e=r.ignoreCase?"i":"";return new RegExp("^(?:"+r.source+")",e)}Ve.addStartOfInput=Ev;function Iv(r){var e=r.ignoreCase?"iy":"y";return new RegExp(""+r.source,e)}Ve.addStickyFlag=Iv;function Jme(r,e,t){var i=[];return(0,xe.has)(r,Ve.DEFAULT_MODE)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ve.DEFAULT_MODE+`> property in its definition -`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE}),(0,xe.has)(r,Ve.MODES)||i.push({message:"A MultiMode Lexer cannot be initialized without a <"+Ve.MODES+`> property in its definition -`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY}),(0,xe.has)(r,Ve.MODES)&&(0,xe.has)(r,Ve.DEFAULT_MODE)&&!(0,xe.has)(r.modes,r.defaultMode)&&i.push({message:"A MultiMode Lexer cannot be initialized with a "+Ve.DEFAULT_MODE+": <"+r.defaultMode+`>which does not exist -`,type:ir.LexerDefinitionErrorType.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST}),(0,xe.has)(r,Ve.MODES)&&(0,xe.forEach)(r.modes,function(n,s){(0,xe.forEach)(n,function(o,a){(0,xe.isUndefined)(o)&&i.push({message:"A Lexer cannot be initialized using an undefined Token Type. Mode:"+("<"+s+"> at index: <"+a+`> -`),type:ir.LexerDefinitionErrorType.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED})})}),i}Ve.performRuntimeChecks=Jme;function Wme(r,e,t){var i=[],n=!1,s=(0,xe.compact)((0,xe.flatten)((0,xe.mapValues)(r.modes,function(l){return l}))),o=(0,xe.reject)(s,function(l){return l[So]===ir.Lexer.NA}),a=DY(t);return e&&(0,xe.forEach)(o,function(l){var c=xY(l,a);if(c!==!1){var u=PY(l,c),g={message:u,type:c.issue,tokenType:l};i.push(g)}else(0,xe.has)(l,"LINE_BREAKS")?l.LINE_BREAKS===!0&&(n=!0):(0,Hg.canMatchCharCode)(a,l.PATTERN)&&(n=!0)}),e&&!n&&i.push({message:`Warning: No LINE_BREAKS Found. - This Lexer has been defined to track line and column information, - But none of the Token Types can be identified as matching a line terminator. - See https://chevrotain.io/docs/guide/resolving_lexer_errors.html#LINE_BREAKS - for details.`,type:ir.LexerDefinitionErrorType.NO_LINE_BREAKS_FLAGS}),i}Ve.performWarningRuntimeChecks=Wme;function zme(r){var e={},t=(0,xe.keys)(r);return(0,xe.forEach)(t,function(i){var n=r[i];if((0,xe.isArray)(n))e[i]=[];else throw Error("non exhaustive match")}),e}Ve.cloneEmptyGroups=zme;function wv(r){var e=r.PATTERN;if((0,xe.isRegExp)(e))return!1;if((0,xe.isFunction)(e))return!0;if((0,xe.has)(e,"exec"))return!0;if((0,xe.isString)(e))return!1;throw Error("non exhaustive match")}Ve.isCustomPattern=wv;function vY(r){return(0,xe.isString)(r)&&r.length===1?r.charCodeAt(0):!1}Ve.isShortPattern=vY;Ve.LineTerminatorOptimizedTester={test:function(r){for(var e=r.length,t=this.lastIndex;t Token Type -`)+(" Root cause: "+e.errMsg+`. -`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#IDENTIFY_TERMINATOR";if(e.issue===ir.LexerDefinitionErrorType.CUSTOM_LINE_BREAK)return`Warning: A Custom Token Pattern should specify the option. -`+(" The problem is in the <"+r.name+`> Token Type -`)+" For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#CUSTOM_LINE_BREAK";throw Error("non exhaustive match")}Ve.buildLineBreakIssueMessage=PY;function DY(r){var e=(0,xe.map)(r,function(t){return(0,xe.isString)(t)&&t.length>0?t.charCodeAt(0):t});return e}function mv(r,e,t){r[e]===void 0?r[e]=[t]:r[e].push(t)}Ve.minOptimizationVal=256;var qI=[];function yv(r){return r255?255+~~(r/255):r}}});var Gg=w(Nt=>{"use strict";Object.defineProperty(Nt,"__esModule",{value:!0});Nt.isTokenType=Nt.hasExtendingTokensTypesMapProperty=Nt.hasExtendingTokensTypesProperty=Nt.hasCategoriesProperty=Nt.hasShortKeyProperty=Nt.singleAssignCategoriesToksMap=Nt.assignCategoriesMapProp=Nt.assignCategoriesTokensProp=Nt.assignTokenDefaultProps=Nt.expandCategories=Nt.augmentTokenTypes=Nt.tokenIdxToClass=Nt.tokenShortNameIdx=Nt.tokenStructuredMatcherNoCategories=Nt.tokenStructuredMatcher=void 0;var _r=Gt();function Xme(r,e){var t=r.tokenTypeIdx;return t===e.tokenTypeIdx?!0:e.isParent===!0&&e.categoryMatchesMap[t]===!0}Nt.tokenStructuredMatcher=Xme;function _me(r,e){return r.tokenTypeIdx===e.tokenTypeIdx}Nt.tokenStructuredMatcherNoCategories=_me;Nt.tokenShortNameIdx=1;Nt.tokenIdxToClass={};function Zme(r){var e=kY(r);RY(e),NY(e),FY(e),(0,_r.forEach)(e,function(t){t.isParent=t.categoryMatches.length>0})}Nt.augmentTokenTypes=Zme;function kY(r){for(var e=(0,_r.cloneArr)(r),t=r,i=!0;i;){t=(0,_r.compact)((0,_r.flatten)((0,_r.map)(t,function(s){return s.CATEGORIES})));var n=(0,_r.difference)(t,e);e=e.concat(n),(0,_r.isEmpty)(n)?i=!1:t=n}return e}Nt.expandCategories=kY;function RY(r){(0,_r.forEach)(r,function(e){LY(e)||(Nt.tokenIdxToClass[Nt.tokenShortNameIdx]=e,e.tokenTypeIdx=Nt.tokenShortNameIdx++),Bv(e)&&!(0,_r.isArray)(e.CATEGORIES)&&(e.CATEGORIES=[e.CATEGORIES]),Bv(e)||(e.CATEGORIES=[]),TY(e)||(e.categoryMatches=[]),OY(e)||(e.categoryMatchesMap={})})}Nt.assignTokenDefaultProps=RY;function FY(r){(0,_r.forEach)(r,function(e){e.categoryMatches=[],(0,_r.forEach)(e.categoryMatchesMap,function(t,i){e.categoryMatches.push(Nt.tokenIdxToClass[i].tokenTypeIdx)})})}Nt.assignCategoriesTokensProp=FY;function NY(r){(0,_r.forEach)(r,function(e){Qv([],e)})}Nt.assignCategoriesMapProp=NY;function Qv(r,e){(0,_r.forEach)(r,function(t){e.categoryMatchesMap[t.tokenTypeIdx]=!0}),(0,_r.forEach)(e.CATEGORIES,function(t){var i=r.concat(e);(0,_r.contains)(i,t)||Qv(i,t)})}Nt.singleAssignCategoriesToksMap=Qv;function LY(r){return(0,_r.has)(r,"tokenTypeIdx")}Nt.hasShortKeyProperty=LY;function Bv(r){return(0,_r.has)(r,"CATEGORIES")}Nt.hasCategoriesProperty=Bv;function TY(r){return(0,_r.has)(r,"categoryMatches")}Nt.hasExtendingTokensTypesProperty=TY;function OY(r){return(0,_r.has)(r,"categoryMatchesMap")}Nt.hasExtendingTokensTypesMapProperty=OY;function $me(r){return(0,_r.has)(r,"tokenTypeIdx")}Nt.isTokenType=$me});var bv=w(JI=>{"use strict";Object.defineProperty(JI,"__esModule",{value:!0});JI.defaultLexerErrorProvider=void 0;JI.defaultLexerErrorProvider={buildUnableToPopLexerModeMessage:function(r){return"Unable to pop Lexer Mode after encountering Token ->"+r.image+"<- The Mode Stack is empty"},buildUnexpectedCharactersMessage:function(r,e,t,i,n){return"unexpected character: ->"+r.charAt(e)+"<- at offset: "+e+","+(" skipped "+t+" characters.")}}});var gd=w(nc=>{"use strict";Object.defineProperty(nc,"__esModule",{value:!0});nc.Lexer=nc.LexerDefinitionErrorType=void 0;var zs=Cv(),nr=Gt(),eEe=Gg(),tEe=bv(),rEe=GI(),iEe;(function(r){r[r.MISSING_PATTERN=0]="MISSING_PATTERN",r[r.INVALID_PATTERN=1]="INVALID_PATTERN",r[r.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",r[r.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",r[r.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",r[r.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND",r[r.PUSH_MODE_DOES_NOT_EXIST=6]="PUSH_MODE_DOES_NOT_EXIST",r[r.MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE=7]="MULTI_MODE_LEXER_WITHOUT_DEFAULT_MODE",r[r.MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY=8]="MULTI_MODE_LEXER_WITHOUT_MODES_PROPERTY",r[r.MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST=9]="MULTI_MODE_LEXER_DEFAULT_MODE_VALUE_DOES_NOT_EXIST",r[r.LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED=10]="LEXER_DEFINITION_CANNOT_CONTAIN_UNDEFINED",r[r.SOI_ANCHOR_FOUND=11]="SOI_ANCHOR_FOUND",r[r.EMPTY_MATCH_PATTERN=12]="EMPTY_MATCH_PATTERN",r[r.NO_LINE_BREAKS_FLAGS=13]="NO_LINE_BREAKS_FLAGS",r[r.UNREACHABLE_PATTERN=14]="UNREACHABLE_PATTERN",r[r.IDENTIFY_TERMINATOR=15]="IDENTIFY_TERMINATOR",r[r.CUSTOM_LINE_BREAK=16]="CUSTOM_LINE_BREAK"})(iEe=nc.LexerDefinitionErrorType||(nc.LexerDefinitionErrorType={}));var fd={deferDefinitionErrorsHandling:!1,positionTracking:"full",lineTerminatorsPattern:/\n|\r\n?/g,lineTerminatorCharacters:[` -`,"\r"],ensureOptimizations:!1,safeMode:!1,errorMessageProvider:tEe.defaultLexerErrorProvider,traceInitPerf:!1,skipValidations:!1};Object.freeze(fd);var nEe=function(){function r(e,t){var i=this;if(t===void 0&&(t=fd),this.lexerDefinition=e,this.lexerDefinitionErrors=[],this.lexerDefinitionWarning=[],this.patternIdxToConfig={},this.charCodeToPatternIdxToConfig={},this.modes=[],this.emptyGroups={},this.config=void 0,this.trackStartLines=!0,this.trackEndLines=!0,this.hasCustom=!1,this.canModeBeOptimized={},typeof t=="boolean")throw Error(`The second argument to the Lexer constructor is now an ILexerConfig Object. -a boolean 2nd argument is no longer supported`);this.config=(0,nr.merge)(fd,t);var n=this.config.traceInitPerf;n===!0?(this.traceInitMaxIdent=1/0,this.traceInitPerf=!0):typeof n=="number"&&(this.traceInitMaxIdent=n,this.traceInitPerf=!0),this.traceInitIndent=-1,this.TRACE_INIT("Lexer Constructor",function(){var s,o=!0;i.TRACE_INIT("Lexer Config handling",function(){if(i.config.lineTerminatorsPattern===fd.lineTerminatorsPattern)i.config.lineTerminatorsPattern=zs.LineTerminatorOptimizedTester;else if(i.config.lineTerminatorCharacters===fd.lineTerminatorCharacters)throw Error(`Error: Missing property on the Lexer config. - For details See: https://chevrotain.io/docs/guide/resolving_lexer_errors.html#MISSING_LINE_TERM_CHARS`);if(t.safeMode&&t.ensureOptimizations)throw Error('"safeMode" and "ensureOptimizations" flags are mutually exclusive.');i.trackStartLines=/full|onlyStart/i.test(i.config.positionTracking),i.trackEndLines=/full/i.test(i.config.positionTracking),(0,nr.isArray)(e)?(s={modes:{}},s.modes[zs.DEFAULT_MODE]=(0,nr.cloneArr)(e),s[zs.DEFAULT_MODE]=zs.DEFAULT_MODE):(o=!1,s=(0,nr.cloneObj)(e))}),i.config.skipValidations===!1&&(i.TRACE_INIT("performRuntimeChecks",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,zs.performRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))}),i.TRACE_INIT("performWarningRuntimeChecks",function(){i.lexerDefinitionWarning=i.lexerDefinitionWarning.concat((0,zs.performWarningRuntimeChecks)(s,i.trackStartLines,i.config.lineTerminatorCharacters))})),s.modes=s.modes?s.modes:{},(0,nr.forEach)(s.modes,function(u,g){s.modes[g]=(0,nr.reject)(u,function(f){return(0,nr.isUndefined)(f)})});var a=(0,nr.keys)(s.modes);if((0,nr.forEach)(s.modes,function(u,g){i.TRACE_INIT("Mode: <"+g+"> processing",function(){if(i.modes.push(g),i.config.skipValidations===!1&&i.TRACE_INIT("validatePatterns",function(){i.lexerDefinitionErrors=i.lexerDefinitionErrors.concat((0,zs.validatePatterns)(u,a))}),(0,nr.isEmpty)(i.lexerDefinitionErrors)){(0,eEe.augmentTokenTypes)(u);var f;i.TRACE_INIT("analyzeTokenTypes",function(){f=(0,zs.analyzeTokenTypes)(u,{lineTerminatorCharacters:i.config.lineTerminatorCharacters,positionTracking:t.positionTracking,ensureOptimizations:t.ensureOptimizations,safeMode:t.safeMode,tracer:i.TRACE_INIT.bind(i)})}),i.patternIdxToConfig[g]=f.patternIdxToConfig,i.charCodeToPatternIdxToConfig[g]=f.charCodeToPatternIdxToConfig,i.emptyGroups=(0,nr.merge)(i.emptyGroups,f.emptyGroups),i.hasCustom=f.hasCustom||i.hasCustom,i.canModeBeOptimized[g]=f.canBeOptimized}})}),i.defaultMode=s.defaultMode,!(0,nr.isEmpty)(i.lexerDefinitionErrors)&&!i.config.deferDefinitionErrorsHandling){var l=(0,nr.map)(i.lexerDefinitionErrors,function(u){return u.message}),c=l.join(`----------------------- -`);throw new Error(`Errors detected in definition of Lexer: -`+c)}(0,nr.forEach)(i.lexerDefinitionWarning,function(u){(0,nr.PRINT_WARNING)(u.message)}),i.TRACE_INIT("Choosing sub-methods implementations",function(){if(zs.SUPPORT_STICKY?(i.chopInput=nr.IDENTITY,i.match=i.matchWithTest):(i.updateLastIndex=nr.NOOP,i.match=i.matchWithExec),o&&(i.handleModes=nr.NOOP),i.trackStartLines===!1&&(i.computeNewColumn=nr.IDENTITY),i.trackEndLines===!1&&(i.updateTokenEndLineColumnLocation=nr.NOOP),/full/i.test(i.config.positionTracking))i.createTokenInstance=i.createFullToken;else if(/onlyStart/i.test(i.config.positionTracking))i.createTokenInstance=i.createStartOnlyToken;else if(/onlyOffset/i.test(i.config.positionTracking))i.createTokenInstance=i.createOffsetOnlyToken;else throw Error('Invalid config option: "'+i.config.positionTracking+'"');i.hasCustom?(i.addToken=i.addTokenUsingPush,i.handlePayload=i.handlePayloadWithCustom):(i.addToken=i.addTokenUsingMemberAccess,i.handlePayload=i.handlePayloadNoCustom)}),i.TRACE_INIT("Failed Optimization Warnings",function(){var u=(0,nr.reduce)(i.canModeBeOptimized,function(g,f,h){return f===!1&&g.push(h),g},[]);if(t.ensureOptimizations&&!(0,nr.isEmpty)(u))throw Error("Lexer Modes: < "+u.join(", ")+` > cannot be optimized. - Disable the "ensureOptimizations" lexer config flag to silently ignore this and run the lexer in an un-optimized mode. - Or inspect the console log for details on how to resolve these issues.`)}),i.TRACE_INIT("clearRegExpParserCache",function(){(0,rEe.clearRegExpParserCache)()}),i.TRACE_INIT("toFastProperties",function(){(0,nr.toFastProperties)(i)})})}return r.prototype.tokenize=function(e,t){if(t===void 0&&(t=this.defaultMode),!(0,nr.isEmpty)(this.lexerDefinitionErrors)){var i=(0,nr.map)(this.lexerDefinitionErrors,function(o){return o.message}),n=i.join(`----------------------- -`);throw new Error(`Unable to Tokenize because Errors detected in definition of Lexer: -`+n)}var s=this.tokenizeInternal(e,t);return s},r.prototype.tokenizeInternal=function(e,t){var i=this,n,s,o,a,l,c,u,g,f,h,p,C,y,B,v,D,L=e,H=L.length,j=0,$=0,V=this.hasCustom?0:Math.floor(e.length/10),W=new Array(V),Z=[],A=this.trackStartLines?1:void 0,ae=this.trackStartLines?1:void 0,ge=(0,zs.cloneEmptyGroups)(this.emptyGroups),re=this.trackStartLines,O=this.config.lineTerminatorsPattern,F=0,ue=[],he=[],ke=[],Fe=[];Object.freeze(Fe);var Ne=void 0;function oe(){return ue}function le(pr){var Ei=(0,zs.charCodeToOptimizedIndex)(pr),_n=he[Ei];return _n===void 0?Fe:_n}var we=function(pr){if(ke.length===1&&pr.tokenType.PUSH_MODE===void 0){var Ei=i.config.errorMessageProvider.buildUnableToPopLexerModeMessage(pr);Z.push({offset:pr.startOffset,line:pr.startLine!==void 0?pr.startLine:void 0,column:pr.startColumn!==void 0?pr.startColumn:void 0,length:pr.image.length,message:Ei})}else{ke.pop();var _n=(0,nr.last)(ke);ue=i.patternIdxToConfig[_n],he=i.charCodeToPatternIdxToConfig[_n],F=ue.length;var oa=i.canModeBeOptimized[_n]&&i.config.safeMode===!1;he&&oa?Ne=le:Ne=oe}};function fe(pr){ke.push(pr),he=this.charCodeToPatternIdxToConfig[pr],ue=this.patternIdxToConfig[pr],F=ue.length,F=ue.length;var Ei=this.canModeBeOptimized[pr]&&this.config.safeMode===!1;he&&Ei?Ne=le:Ne=oe}fe.call(this,t);for(var Ae;jc.length){c=a,u=g,Ae=tt;break}}}break}}if(c!==null){if(f=c.length,h=Ae.group,h!==void 0&&(p=Ae.tokenTypeIdx,C=this.createTokenInstance(c,j,p,Ae.tokenType,A,ae,f),this.handlePayload(C,u),h===!1?$=this.addToken(W,$,C):ge[h].push(C)),e=this.chopInput(e,f),j=j+f,ae=this.computeNewColumn(ae,f),re===!0&&Ae.canLineTerminator===!0){var It=0,Or=void 0,ii=void 0;O.lastIndex=0;do Or=O.test(c),Or===!0&&(ii=O.lastIndex-1,It++);while(Or===!0);It!==0&&(A=A+It,ae=f-ii,this.updateTokenEndLineColumnLocation(C,h,ii,It,A,ae,f))}this.handleModes(Ae,we,fe,C)}else{for(var gi=j,hr=A,fi=ae,ni=!1;!ni&&j <"+e+">");var n=(0,nr.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r.SKIPPED="This marks a skipped Token pattern, this means each token identified by it willbe consumed and then thrown into oblivion, this can be used to for example to completely ignore whitespace.",r.NA=/NOT_APPLICABLE/,r}();nc.Lexer=nEe});var SA=w(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.tokenMatcher=Qi.createTokenInstance=Qi.EOF=Qi.createToken=Qi.hasTokenLabel=Qi.tokenName=Qi.tokenLabel=void 0;var Vs=Gt(),sEe=gd(),Sv=Gg();function oEe(r){return JY(r)?r.LABEL:r.name}Qi.tokenLabel=oEe;function aEe(r){return r.name}Qi.tokenName=aEe;function JY(r){return(0,Vs.isString)(r.LABEL)&&r.LABEL!==""}Qi.hasTokenLabel=JY;var AEe="parent",MY="categories",KY="label",UY="group",HY="push_mode",GY="pop_mode",YY="longer_alt",jY="line_breaks",qY="start_chars_hint";function WY(r){return lEe(r)}Qi.createToken=WY;function lEe(r){var e=r.pattern,t={};if(t.name=r.name,(0,Vs.isUndefined)(e)||(t.PATTERN=e),(0,Vs.has)(r,AEe))throw`The parent property is no longer supported. -See: https://github.com/chevrotain/chevrotain/issues/564#issuecomment-349062346 for details.`;return(0,Vs.has)(r,MY)&&(t.CATEGORIES=r[MY]),(0,Sv.augmentTokenTypes)([t]),(0,Vs.has)(r,KY)&&(t.LABEL=r[KY]),(0,Vs.has)(r,UY)&&(t.GROUP=r[UY]),(0,Vs.has)(r,GY)&&(t.POP_MODE=r[GY]),(0,Vs.has)(r,HY)&&(t.PUSH_MODE=r[HY]),(0,Vs.has)(r,YY)&&(t.LONGER_ALT=r[YY]),(0,Vs.has)(r,jY)&&(t.LINE_BREAKS=r[jY]),(0,Vs.has)(r,qY)&&(t.START_CHARS_HINT=r[qY]),t}Qi.EOF=WY({name:"EOF",pattern:sEe.Lexer.NA});(0,Sv.augmentTokenTypes)([Qi.EOF]);function cEe(r,e,t,i,n,s,o,a){return{image:e,startOffset:t,endOffset:i,startLine:n,endLine:s,startColumn:o,endColumn:a,tokenTypeIdx:r.tokenTypeIdx,tokenType:r}}Qi.createTokenInstance=cEe;function uEe(r,e){return(0,Sv.tokenStructuredMatcher)(r,e)}Qi.tokenMatcher=uEe});var dn=w(Wt=>{"use strict";var wa=Wt&&Wt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Wt,"__esModule",{value:!0});Wt.serializeProduction=Wt.serializeGrammar=Wt.Terminal=Wt.Alternation=Wt.RepetitionWithSeparator=Wt.Repetition=Wt.RepetitionMandatoryWithSeparator=Wt.RepetitionMandatory=Wt.Option=Wt.Alternative=Wt.Rule=Wt.NonTerminal=Wt.AbstractProduction=void 0;var Ar=Gt(),gEe=SA(),vo=function(){function r(e){this._definition=e}return Object.defineProperty(r.prototype,"definition",{get:function(){return this._definition},set:function(e){this._definition=e},enumerable:!1,configurable:!0}),r.prototype.accept=function(e){e.visit(this),(0,Ar.forEach)(this.definition,function(t){t.accept(e)})},r}();Wt.AbstractProduction=vo;var zY=function(r){wa(e,r);function e(t){var i=r.call(this,[])||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return Object.defineProperty(e.prototype,"definition",{get:function(){return this.referencedRule!==void 0?this.referencedRule.definition:[]},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.accept=function(t){t.visit(this)},e}(vo);Wt.NonTerminal=zY;var VY=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.orgText="",(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.Rule=VY;var XY=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.ignoreAmbiguities=!1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.Alternative=XY;var _Y=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.Option=_Y;var ZY=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.RepetitionMandatory=ZY;var $Y=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.RepetitionMandatoryWithSeparator=$Y;var ej=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.Repetition=ej;var tj=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return e}(vo);Wt.RepetitionWithSeparator=tj;var rj=function(r){wa(e,r);function e(t){var i=r.call(this,t.definition)||this;return i.idx=1,i.ignoreAmbiguities=!1,i.hasPredicates=!1,(0,Ar.assign)(i,(0,Ar.pick)(t,function(n){return n!==void 0})),i}return Object.defineProperty(e.prototype,"definition",{get:function(){return this._definition},set:function(t){this._definition=t},enumerable:!1,configurable:!0}),e}(vo);Wt.Alternation=rj;var WI=function(){function r(e){this.idx=1,(0,Ar.assign)(this,(0,Ar.pick)(e,function(t){return t!==void 0}))}return r.prototype.accept=function(e){e.visit(this)},r}();Wt.Terminal=WI;function fEe(r){return(0,Ar.map)(r,hd)}Wt.serializeGrammar=fEe;function hd(r){function e(s){return(0,Ar.map)(s,hd)}if(r instanceof zY){var t={type:"NonTerminal",name:r.nonTerminalName,idx:r.idx};return(0,Ar.isString)(r.label)&&(t.label=r.label),t}else{if(r instanceof XY)return{type:"Alternative",definition:e(r.definition)};if(r instanceof _Y)return{type:"Option",idx:r.idx,definition:e(r.definition)};if(r instanceof ZY)return{type:"RepetitionMandatory",idx:r.idx,definition:e(r.definition)};if(r instanceof $Y)return{type:"RepetitionMandatoryWithSeparator",idx:r.idx,separator:hd(new WI({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof tj)return{type:"RepetitionWithSeparator",idx:r.idx,separator:hd(new WI({terminalType:r.separator})),definition:e(r.definition)};if(r instanceof ej)return{type:"Repetition",idx:r.idx,definition:e(r.definition)};if(r instanceof rj)return{type:"Alternation",idx:r.idx,definition:e(r.definition)};if(r instanceof WI){var i={type:"Terminal",name:r.terminalType.name,label:(0,gEe.tokenLabel)(r.terminalType),idx:r.idx};(0,Ar.isString)(r.label)&&(i.terminalLabel=r.label);var n=r.terminalType.PATTERN;return r.terminalType.PATTERN&&(i.pattern=(0,Ar.isRegExp)(n)?n.source:n),i}else{if(r instanceof VY)return{type:"Rule",name:r.name,orgText:r.orgText,definition:e(r.definition)};throw Error("non exhaustive match")}}}Wt.serializeProduction=hd});var VI=w(zI=>{"use strict";Object.defineProperty(zI,"__esModule",{value:!0});zI.RestWalker=void 0;var vv=Gt(),Cn=dn(),hEe=function(){function r(){}return r.prototype.walk=function(e,t){var i=this;t===void 0&&(t=[]),(0,vv.forEach)(e.definition,function(n,s){var o=(0,vv.drop)(e.definition,s+1);if(n instanceof Cn.NonTerminal)i.walkProdRef(n,o,t);else if(n instanceof Cn.Terminal)i.walkTerminal(n,o,t);else if(n instanceof Cn.Alternative)i.walkFlat(n,o,t);else if(n instanceof Cn.Option)i.walkOption(n,o,t);else if(n instanceof Cn.RepetitionMandatory)i.walkAtLeastOne(n,o,t);else if(n instanceof Cn.RepetitionMandatoryWithSeparator)i.walkAtLeastOneSep(n,o,t);else if(n instanceof Cn.RepetitionWithSeparator)i.walkManySep(n,o,t);else if(n instanceof Cn.Repetition)i.walkMany(n,o,t);else if(n instanceof Cn.Alternation)i.walkOr(n,o,t);else throw Error("non exhaustive match")})},r.prototype.walkTerminal=function(e,t,i){},r.prototype.walkProdRef=function(e,t,i){},r.prototype.walkFlat=function(e,t,i){var n=t.concat(i);this.walk(e,n)},r.prototype.walkOption=function(e,t,i){var n=t.concat(i);this.walk(e,n)},r.prototype.walkAtLeastOne=function(e,t,i){var n=[new Cn.Option({definition:e.definition})].concat(t,i);this.walk(e,n)},r.prototype.walkAtLeastOneSep=function(e,t,i){var n=ij(e,t,i);this.walk(e,n)},r.prototype.walkMany=function(e,t,i){var n=[new Cn.Option({definition:e.definition})].concat(t,i);this.walk(e,n)},r.prototype.walkManySep=function(e,t,i){var n=ij(e,t,i);this.walk(e,n)},r.prototype.walkOr=function(e,t,i){var n=this,s=t.concat(i);(0,vv.forEach)(e.definition,function(o){var a=new Cn.Alternative({definition:[o]});n.walk(a,s)})},r}();zI.RestWalker=hEe;function ij(r,e,t){var i=[new Cn.Option({definition:[new Cn.Terminal({terminalType:r.separator})].concat(r.definition)})],n=i.concat(e,t);return n}});var Yg=w(XI=>{"use strict";Object.defineProperty(XI,"__esModule",{value:!0});XI.GAstVisitor=void 0;var xo=dn(),pEe=function(){function r(){}return r.prototype.visit=function(e){var t=e;switch(t.constructor){case xo.NonTerminal:return this.visitNonTerminal(t);case xo.Alternative:return this.visitAlternative(t);case xo.Option:return this.visitOption(t);case xo.RepetitionMandatory:return this.visitRepetitionMandatory(t);case xo.RepetitionMandatoryWithSeparator:return this.visitRepetitionMandatoryWithSeparator(t);case xo.RepetitionWithSeparator:return this.visitRepetitionWithSeparator(t);case xo.Repetition:return this.visitRepetition(t);case xo.Alternation:return this.visitAlternation(t);case xo.Terminal:return this.visitTerminal(t);case xo.Rule:return this.visitRule(t);default:throw Error("non exhaustive match")}},r.prototype.visitNonTerminal=function(e){},r.prototype.visitAlternative=function(e){},r.prototype.visitOption=function(e){},r.prototype.visitRepetition=function(e){},r.prototype.visitRepetitionMandatory=function(e){},r.prototype.visitRepetitionMandatoryWithSeparator=function(e){},r.prototype.visitRepetitionWithSeparator=function(e){},r.prototype.visitAlternation=function(e){},r.prototype.visitTerminal=function(e){},r.prototype.visitRule=function(e){},r}();XI.GAstVisitor=pEe});var dd=w(Oi=>{"use strict";var dEe=Oi&&Oi.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Oi,"__esModule",{value:!0});Oi.collectMethods=Oi.DslMethodsCollectorVisitor=Oi.getProductionDslName=Oi.isBranchingProd=Oi.isOptionalProd=Oi.isSequenceProd=void 0;var pd=Gt(),Qr=dn(),CEe=Yg();function mEe(r){return r instanceof Qr.Alternative||r instanceof Qr.Option||r instanceof Qr.Repetition||r instanceof Qr.RepetitionMandatory||r instanceof Qr.RepetitionMandatoryWithSeparator||r instanceof Qr.RepetitionWithSeparator||r instanceof Qr.Terminal||r instanceof Qr.Rule}Oi.isSequenceProd=mEe;function xv(r,e){e===void 0&&(e=[]);var t=r instanceof Qr.Option||r instanceof Qr.Repetition||r instanceof Qr.RepetitionWithSeparator;return t?!0:r instanceof Qr.Alternation?(0,pd.some)(r.definition,function(i){return xv(i,e)}):r instanceof Qr.NonTerminal&&(0,pd.contains)(e,r)?!1:r instanceof Qr.AbstractProduction?(r instanceof Qr.NonTerminal&&e.push(r),(0,pd.every)(r.definition,function(i){return xv(i,e)})):!1}Oi.isOptionalProd=xv;function EEe(r){return r instanceof Qr.Alternation}Oi.isBranchingProd=EEe;function IEe(r){if(r instanceof Qr.NonTerminal)return"SUBRULE";if(r instanceof Qr.Option)return"OPTION";if(r instanceof Qr.Alternation)return"OR";if(r instanceof Qr.RepetitionMandatory)return"AT_LEAST_ONE";if(r instanceof Qr.RepetitionMandatoryWithSeparator)return"AT_LEAST_ONE_SEP";if(r instanceof Qr.RepetitionWithSeparator)return"MANY_SEP";if(r instanceof Qr.Repetition)return"MANY";if(r instanceof Qr.Terminal)return"CONSUME";throw Error("non exhaustive match")}Oi.getProductionDslName=IEe;var nj=function(r){dEe(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.separator="-",t.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]},t}return e.prototype.reset=function(){this.dslMethods={option:[],alternation:[],repetition:[],repetitionWithSeparator:[],repetitionMandatory:[],repetitionMandatoryWithSeparator:[]}},e.prototype.visitTerminal=function(t){var i=t.terminalType.name+this.separator+"Terminal";(0,pd.has)(this.dslMethods,i)||(this.dslMethods[i]=[]),this.dslMethods[i].push(t)},e.prototype.visitNonTerminal=function(t){var i=t.nonTerminalName+this.separator+"Terminal";(0,pd.has)(this.dslMethods,i)||(this.dslMethods[i]=[]),this.dslMethods[i].push(t)},e.prototype.visitOption=function(t){this.dslMethods.option.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.dslMethods.repetitionWithSeparator.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.dslMethods.repetitionMandatory.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.dslMethods.repetitionMandatoryWithSeparator.push(t)},e.prototype.visitRepetition=function(t){this.dslMethods.repetition.push(t)},e.prototype.visitAlternation=function(t){this.dslMethods.alternation.push(t)},e}(CEe.GAstVisitor);Oi.DslMethodsCollectorVisitor=nj;var _I=new nj;function yEe(r){_I.reset(),r.accept(_I);var e=_I.dslMethods;return _I.reset(),e}Oi.collectMethods=yEe});var Dv=w(Po=>{"use strict";Object.defineProperty(Po,"__esModule",{value:!0});Po.firstForTerminal=Po.firstForBranching=Po.firstForSequence=Po.first=void 0;var ZI=Gt(),sj=dn(),Pv=dd();function $I(r){if(r instanceof sj.NonTerminal)return $I(r.referencedRule);if(r instanceof sj.Terminal)return Aj(r);if((0,Pv.isSequenceProd)(r))return oj(r);if((0,Pv.isBranchingProd)(r))return aj(r);throw Error("non exhaustive match")}Po.first=$I;function oj(r){for(var e=[],t=r.definition,i=0,n=t.length>i,s,o=!0;n&&o;)s=t[i],o=(0,Pv.isOptionalProd)(s),e=e.concat($I(s)),i=i+1,n=t.length>i;return(0,ZI.uniq)(e)}Po.firstForSequence=oj;function aj(r){var e=(0,ZI.map)(r.definition,function(t){return $I(t)});return(0,ZI.uniq)((0,ZI.flatten)(e))}Po.firstForBranching=aj;function Aj(r){return[r.terminalType]}Po.firstForTerminal=Aj});var kv=w(ey=>{"use strict";Object.defineProperty(ey,"__esModule",{value:!0});ey.IN=void 0;ey.IN="_~IN~_"});var fj=w(As=>{"use strict";var wEe=As&&As.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(As,"__esModule",{value:!0});As.buildInProdFollowPrefix=As.buildBetweenProdsFollowPrefix=As.computeAllProdsFollows=As.ResyncFollowsWalker=void 0;var BEe=VI(),QEe=Dv(),lj=Gt(),cj=kv(),bEe=dn(),uj=function(r){wEe(e,r);function e(t){var i=r.call(this)||this;return i.topProd=t,i.follows={},i}return e.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},e.prototype.walkTerminal=function(t,i,n){},e.prototype.walkProdRef=function(t,i,n){var s=gj(t.referencedRule,t.idx)+this.topProd.name,o=i.concat(n),a=new bEe.Alternative({definition:o}),l=(0,QEe.first)(a);this.follows[s]=l},e}(BEe.RestWalker);As.ResyncFollowsWalker=uj;function SEe(r){var e={};return(0,lj.forEach)(r,function(t){var i=new uj(t).startWalking();(0,lj.assign)(e,i)}),e}As.computeAllProdsFollows=SEe;function gj(r,e){return r.name+e+cj.IN}As.buildBetweenProdsFollowPrefix=gj;function vEe(r){var e=r.terminalType.name;return e+r.idx+cj.IN}As.buildInProdFollowPrefix=vEe});var Cd=w(Ba=>{"use strict";Object.defineProperty(Ba,"__esModule",{value:!0});Ba.defaultGrammarValidatorErrorProvider=Ba.defaultGrammarResolverErrorProvider=Ba.defaultParserErrorProvider=void 0;var jg=SA(),xEe=Gt(),Xs=Gt(),Rv=dn(),hj=dd();Ba.defaultParserErrorProvider={buildMismatchTokenMessage:function(r){var e=r.expected,t=r.actual,i=r.previous,n=r.ruleName,s=(0,jg.hasTokenLabel)(e),o=s?"--> "+(0,jg.tokenLabel)(e)+" <--":"token of type --> "+e.name+" <--",a="Expecting "+o+" but found --> '"+t.image+"' <--";return a},buildNotAllInputParsedMessage:function(r){var e=r.firstRedundant,t=r.ruleName;return"Redundant input, expecting EOF but found: "+e.image},buildNoViableAltMessage:function(r){var e=r.expectedPathsPerAlt,t=r.actual,i=r.previous,n=r.customUserDescription,s=r.ruleName,o="Expecting: ",a=(0,Xs.first)(t).image,l=` -but found: '`+a+"'";if(n)return o+n+l;var c=(0,Xs.reduce)(e,function(h,p){return h.concat(p)},[]),u=(0,Xs.map)(c,function(h){return"["+(0,Xs.map)(h,function(p){return(0,jg.tokenLabel)(p)}).join(", ")+"]"}),g=(0,Xs.map)(u,function(h,p){return" "+(p+1)+". "+h}),f=`one of these possible Token sequences: -`+g.join(` -`);return o+f+l},buildEarlyExitMessage:function(r){var e=r.expectedIterationPaths,t=r.actual,i=r.customUserDescription,n=r.ruleName,s="Expecting: ",o=(0,Xs.first)(t).image,a=` -but found: '`+o+"'";if(i)return s+i+a;var l=(0,Xs.map)(e,function(u){return"["+(0,Xs.map)(u,function(g){return(0,jg.tokenLabel)(g)}).join(",")+"]"}),c=`expecting at least one iteration which starts with one of these possible Token sequences:: - `+("<"+l.join(" ,")+">");return s+c+a}};Object.freeze(Ba.defaultParserErrorProvider);Ba.defaultGrammarResolverErrorProvider={buildRuleNotFoundError:function(r,e){var t="Invalid grammar, reference to a rule which is not defined: ->"+e.nonTerminalName+`<- -inside top level rule: ->`+r.name+"<-";return t}};Ba.defaultGrammarValidatorErrorProvider={buildDuplicateFoundError:function(r,e){function t(u){return u instanceof Rv.Terminal?u.terminalType.name:u instanceof Rv.NonTerminal?u.nonTerminalName:""}var i=r.name,n=(0,Xs.first)(e),s=n.idx,o=(0,hj.getProductionDslName)(n),a=t(n),l=s>0,c="->"+o+(l?s:"")+"<- "+(a?"with argument: ->"+a+"<-":"")+` - appears more than once (`+e.length+" times) in the top level rule: ->"+i+`<-. - For further details see: https://chevrotain.io/docs/FAQ.html#NUMERICAL_SUFFIXES - `;return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,` -`),c},buildNamespaceConflictError:function(r){var e=`Namespace conflict found in grammar. -`+("The grammar has both a Terminal(Token) and a Non-Terminal(Rule) named: <"+r.name+`>. -`)+`To resolve this make sure each Terminal and Non-Terminal names are unique -This is easy to accomplish by using the convention that Terminal names start with an uppercase letter -and Non-Terminal names start with a lower case letter.`;return e},buildAlternationPrefixAmbiguityError:function(r){var e=(0,Xs.map)(r.prefixPath,function(n){return(0,jg.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous alternatives: <"+r.ambiguityIndices.join(" ,")+`> due to common lookahead prefix -`+("in inside <"+r.topLevelRule.name+`> Rule, -`)+("<"+e+`> may appears as a prefix path in all these alternatives. -`)+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#COMMON_PREFIX -For Further details.`;return i},buildAlternationAmbiguityError:function(r){var e=(0,Xs.map)(r.prefixPath,function(n){return(0,jg.tokenLabel)(n)}).join(", "),t=r.alternation.idx===0?"":r.alternation.idx,i="Ambiguous Alternatives Detected: <"+r.ambiguityIndices.join(" ,")+"> in "+(" inside <"+r.topLevelRule.name+`> Rule, -`)+("<"+e+`> may appears as a prefix path in all these alternatives. -`);return i=i+`See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#AMBIGUOUS_ALTERNATIVES -For Further details.`,i},buildEmptyRepetitionError:function(r){var e=(0,hj.getProductionDslName)(r.repetition);r.repetition.idx!==0&&(e+=r.repetition.idx);var t="The repetition <"+e+"> within Rule <"+r.topLevelRule.name+`> can never consume any tokens. -This could lead to an infinite loop.`;return t},buildTokenNameError:function(r){return"deprecated"},buildEmptyAlternationError:function(r){var e="Ambiguous empty alternative: <"+(r.emptyChoiceIdx+1)+">"+(" in inside <"+r.topLevelRule.name+`> Rule. -`)+"Only the last alternative may be an empty alternative.";return e},buildTooManyAlternativesError:function(r){var e=`An Alternation cannot have more than 256 alternatives: -`+(" inside <"+r.topLevelRule.name+`> Rule. - has `+(r.alternation.definition.length+1)+" alternatives.");return e},buildLeftRecursionError:function(r){var e=r.topLevelRule.name,t=xEe.map(r.leftRecursionPath,function(s){return s.name}),i=e+" --> "+t.concat([e]).join(" --> "),n=`Left Recursion found in grammar. -`+("rule: <"+e+`> can be invoked from itself (directly or indirectly) -`)+(`without consuming any Tokens. The grammar path that causes this is: - `+i+` -`)+` To fix this refactor your grammar to remove the left recursion. -see: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.`;return n},buildInvalidRuleNameError:function(r){return"deprecated"},buildDuplicateRuleNameError:function(r){var e;r.topLevelRule instanceof Rv.Rule?e=r.topLevelRule.name:e=r.topLevelRule;var t="Duplicate definition, rule: ->"+e+"<- is already defined in the grammar: ->"+r.grammarName+"<-";return t}}});var Cj=w(vA=>{"use strict";var PEe=vA&&vA.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(vA,"__esModule",{value:!0});vA.GastRefResolverVisitor=vA.resolveGrammar=void 0;var DEe=Hn(),pj=Gt(),kEe=Yg();function REe(r,e){var t=new dj(r,e);return t.resolveRefs(),t.errors}vA.resolveGrammar=REe;var dj=function(r){PEe(e,r);function e(t,i){var n=r.call(this)||this;return n.nameToTopRule=t,n.errMsgProvider=i,n.errors=[],n}return e.prototype.resolveRefs=function(){var t=this;(0,pj.forEach)((0,pj.values)(this.nameToTopRule),function(i){t.currTopLevel=i,i.accept(t)})},e.prototype.visitNonTerminal=function(t){var i=this.nameToTopRule[t.nonTerminalName];if(i)t.referencedRule=i;else{var n=this.errMsgProvider.buildRuleNotFoundError(this.currTopLevel,t);this.errors.push({message:n,type:DEe.ParserDefinitionErrorType.UNRESOLVED_SUBRULE_REF,ruleName:this.currTopLevel.name,unresolvedRefName:t.nonTerminalName})}},e}(kEe.GAstVisitor);vA.GastRefResolverVisitor=dj});var Ed=w(Nr=>{"use strict";var sc=Nr&&Nr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(Nr,"__esModule",{value:!0});Nr.nextPossibleTokensAfter=Nr.possiblePathsFrom=Nr.NextTerminalAfterAtLeastOneSepWalker=Nr.NextTerminalAfterAtLeastOneWalker=Nr.NextTerminalAfterManySepWalker=Nr.NextTerminalAfterManyWalker=Nr.AbstractNextTerminalAfterProductionWalker=Nr.NextAfterTokenWalker=Nr.AbstractNextPossibleTokensWalker=void 0;var mj=VI(),Kt=Gt(),FEe=Dv(),kt=dn(),Ej=function(r){sc(e,r);function e(t,i){var n=r.call(this)||this;return n.topProd=t,n.path=i,n.possibleTokTypes=[],n.nextProductionName="",n.nextProductionOccurrence=0,n.found=!1,n.isAtEndOfPath=!1,n}return e.prototype.startWalking=function(){if(this.found=!1,this.path.ruleStack[0]!==this.topProd.name)throw Error("The path does not start with the walker's top Rule!");return this.ruleStack=(0,Kt.cloneArr)(this.path.ruleStack).reverse(),this.occurrenceStack=(0,Kt.cloneArr)(this.path.occurrenceStack).reverse(),this.ruleStack.pop(),this.occurrenceStack.pop(),this.updateExpectedNext(),this.walk(this.topProd),this.possibleTokTypes},e.prototype.walk=function(t,i){i===void 0&&(i=[]),this.found||r.prototype.walk.call(this,t,i)},e.prototype.walkProdRef=function(t,i,n){if(t.referencedRule.name===this.nextProductionName&&t.idx===this.nextProductionOccurrence){var s=i.concat(n);this.updateExpectedNext(),this.walk(t.referencedRule,s)}},e.prototype.updateExpectedNext=function(){(0,Kt.isEmpty)(this.ruleStack)?(this.nextProductionName="",this.nextProductionOccurrence=0,this.isAtEndOfPath=!0):(this.nextProductionName=this.ruleStack.pop(),this.nextProductionOccurrence=this.occurrenceStack.pop())},e}(mj.RestWalker);Nr.AbstractNextPossibleTokensWalker=Ej;var NEe=function(r){sc(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.path=i,n.nextTerminalName="",n.nextTerminalOccurrence=0,n.nextTerminalName=n.path.lastTok.name,n.nextTerminalOccurrence=n.path.lastTokOccurrence,n}return e.prototype.walkTerminal=function(t,i,n){if(this.isAtEndOfPath&&t.terminalType.name===this.nextTerminalName&&t.idx===this.nextTerminalOccurrence&&!this.found){var s=i.concat(n),o=new kt.Alternative({definition:s});this.possibleTokTypes=(0,FEe.first)(o),this.found=!0}},e}(Ej);Nr.NextAfterTokenWalker=NEe;var md=function(r){sc(e,r);function e(t,i){var n=r.call(this)||this;return n.topRule=t,n.occurrence=i,n.result={token:void 0,occurrence:void 0,isEndOfRule:void 0},n}return e.prototype.startWalking=function(){return this.walk(this.topRule),this.result},e}(mj.RestWalker);Nr.AbstractNextTerminalAfterProductionWalker=md;var LEe=function(r){sc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkMany=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkMany.call(this,t,i,n)},e}(md);Nr.NextTerminalAfterManyWalker=LEe;var TEe=function(r){sc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkManySep=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkManySep.call(this,t,i,n)},e}(md);Nr.NextTerminalAfterManySepWalker=TEe;var OEe=function(r){sc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOne=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkAtLeastOne.call(this,t,i,n)},e}(md);Nr.NextTerminalAfterAtLeastOneWalker=OEe;var MEe=function(r){sc(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.walkAtLeastOneSep=function(t,i,n){if(t.idx===this.occurrence){var s=(0,Kt.first)(i.concat(n));this.result.isEndOfRule=s===void 0,s instanceof kt.Terminal&&(this.result.token=s.terminalType,this.result.occurrence=s.idx)}else r.prototype.walkAtLeastOneSep.call(this,t,i,n)},e}(md);Nr.NextTerminalAfterAtLeastOneSepWalker=MEe;function Ij(r,e,t){t===void 0&&(t=[]),t=(0,Kt.cloneArr)(t);var i=[],n=0;function s(c){return c.concat((0,Kt.drop)(r,n+1))}function o(c){var u=Ij(s(c),e,t);return i.concat(u)}for(;t.length=0;ge--){var re=B.definition[ge],O={idx:p,def:re.definition.concat((0,Kt.drop)(h)),ruleStack:C,occurrenceStack:y};g.push(O),g.push(o)}else if(B instanceof kt.Alternative)g.push({idx:p,def:B.definition.concat((0,Kt.drop)(h)),ruleStack:C,occurrenceStack:y});else if(B instanceof kt.Rule)g.push(UEe(B,p,C,y));else throw Error("non exhaustive match")}}return u}Nr.nextPossibleTokensAfter=KEe;function UEe(r,e,t,i){var n=(0,Kt.cloneArr)(t);n.push(r.name);var s=(0,Kt.cloneArr)(i);return s.push(1),{idx:e,def:r.definition,ruleStack:n,occurrenceStack:s}}});var Id=w(_t=>{"use strict";var Bj=_t&&_t.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(_t,"__esModule",{value:!0});_t.areTokenCategoriesNotUsed=_t.isStrictPrefixOfPath=_t.containsPath=_t.getLookaheadPathsForOptionalProd=_t.getLookaheadPathsForOr=_t.lookAheadSequenceFromAlternatives=_t.buildSingleAlternativeLookaheadFunction=_t.buildAlternativesLookAheadFunc=_t.buildLookaheadFuncForOptionalProd=_t.buildLookaheadFuncForOr=_t.getProdType=_t.PROD_TYPE=void 0;var sr=Gt(),yj=Ed(),HEe=VI(),ty=Gg(),xA=dn(),GEe=Yg(),oi;(function(r){r[r.OPTION=0]="OPTION",r[r.REPETITION=1]="REPETITION",r[r.REPETITION_MANDATORY=2]="REPETITION_MANDATORY",r[r.REPETITION_MANDATORY_WITH_SEPARATOR=3]="REPETITION_MANDATORY_WITH_SEPARATOR",r[r.REPETITION_WITH_SEPARATOR=4]="REPETITION_WITH_SEPARATOR",r[r.ALTERNATION=5]="ALTERNATION"})(oi=_t.PROD_TYPE||(_t.PROD_TYPE={}));function YEe(r){if(r instanceof xA.Option)return oi.OPTION;if(r instanceof xA.Repetition)return oi.REPETITION;if(r instanceof xA.RepetitionMandatory)return oi.REPETITION_MANDATORY;if(r instanceof xA.RepetitionMandatoryWithSeparator)return oi.REPETITION_MANDATORY_WITH_SEPARATOR;if(r instanceof xA.RepetitionWithSeparator)return oi.REPETITION_WITH_SEPARATOR;if(r instanceof xA.Alternation)return oi.ALTERNATION;throw Error("non exhaustive match")}_t.getProdType=YEe;function jEe(r,e,t,i,n,s){var o=bj(r,e,t),a=Lv(o)?ty.tokenStructuredMatcherNoCategories:ty.tokenStructuredMatcher;return s(o,i,a,n)}_t.buildLookaheadFuncForOr=jEe;function qEe(r,e,t,i,n,s){var o=Sj(r,e,n,t),a=Lv(o)?ty.tokenStructuredMatcherNoCategories:ty.tokenStructuredMatcher;return s(o[0],a,i)}_t.buildLookaheadFuncForOptionalProd=qEe;function JEe(r,e,t,i){var n=r.length,s=(0,sr.every)(r,function(l){return(0,sr.every)(l,function(c){return c.length===1})});if(e)return function(l){for(var c=(0,sr.map)(l,function(D){return D.GATE}),u=0;u{"use strict";var Tv=zt&&zt.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(zt,"__esModule",{value:!0});zt.checkPrefixAlternativesAmbiguities=zt.validateSomeNonEmptyLookaheadPath=zt.validateTooManyAlts=zt.RepetionCollector=zt.validateAmbiguousAlternationAlternatives=zt.validateEmptyOrAlternative=zt.getFirstNoneTerminal=zt.validateNoLeftRecursion=zt.validateRuleIsOverridden=zt.validateRuleDoesNotAlreadyExist=zt.OccurrenceValidationCollector=zt.identifyProductionForDuplicates=zt.validateGrammar=void 0;var er=Gt(),br=Gt(),Do=Hn(),Ov=dd(),qg=Id(),_Ee=Ed(),_s=dn(),Mv=Yg();function ZEe(r,e,t,i,n){var s=er.map(r,function(h){return $Ee(h,i)}),o=er.map(r,function(h){return Kv(h,h,i)}),a=[],l=[],c=[];(0,br.every)(o,br.isEmpty)&&(a=(0,br.map)(r,function(h){return Rj(h,i)}),l=(0,br.map)(r,function(h){return Fj(h,e,i)}),c=Tj(r,e,i));var u=rIe(r,t,i),g=(0,br.map)(r,function(h){return Lj(h,i)}),f=(0,br.map)(r,function(h){return kj(h,r,n,i)});return er.flatten(s.concat(c,o,a,l,u,g,f))}zt.validateGrammar=ZEe;function $Ee(r,e){var t=new Dj;r.accept(t);var i=t.allProductions,n=er.groupBy(i,xj),s=er.pick(n,function(a){return a.length>1}),o=er.map(er.values(s),function(a){var l=er.first(a),c=e.buildDuplicateFoundError(r,a),u=(0,Ov.getProductionDslName)(l),g={message:c,type:Do.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:r.name,dslName:u,occurrence:l.idx},f=Pj(l);return f&&(g.parameter=f),g});return o}function xj(r){return(0,Ov.getProductionDslName)(r)+"_#_"+r.idx+"_#_"+Pj(r)}zt.identifyProductionForDuplicates=xj;function Pj(r){return r instanceof _s.Terminal?r.terminalType.name:r instanceof _s.NonTerminal?r.nonTerminalName:""}var Dj=function(r){Tv(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},e.prototype.visitOption=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e.prototype.visitAlternation=function(t){this.allProductions.push(t)},e.prototype.visitTerminal=function(t){this.allProductions.push(t)},e}(Mv.GAstVisitor);zt.OccurrenceValidationCollector=Dj;function kj(r,e,t,i){var n=[],s=(0,br.reduce)(e,function(a,l){return l.name===r.name?a+1:a},0);if(s>1){var o=i.buildDuplicateRuleNameError({topLevelRule:r,grammarName:t});n.push({message:o,type:Do.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:r.name})}return n}zt.validateRuleDoesNotAlreadyExist=kj;function eIe(r,e,t){var i=[],n;return er.contains(e,r)||(n="Invalid rule override, rule: ->"+r+"<- cannot be overridden in the grammar: ->"+t+"<-as it is not defined in any of the super grammars ",i.push({message:n,type:Do.ParserDefinitionErrorType.INVALID_RULE_OVERRIDE,ruleName:r})),i}zt.validateRuleIsOverridden=eIe;function Kv(r,e,t,i){i===void 0&&(i=[]);var n=[],s=yd(e.definition);if(er.isEmpty(s))return[];var o=r.name,a=er.contains(s,r);a&&n.push({message:t.buildLeftRecursionError({topLevelRule:r,leftRecursionPath:i}),type:Do.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:o});var l=er.difference(s,i.concat([r])),c=er.map(l,function(u){var g=er.cloneArr(i);return g.push(u),Kv(r,u,t,g)});return n.concat(er.flatten(c))}zt.validateNoLeftRecursion=Kv;function yd(r){var e=[];if(er.isEmpty(r))return e;var t=er.first(r);if(t instanceof _s.NonTerminal)e.push(t.referencedRule);else if(t instanceof _s.Alternative||t instanceof _s.Option||t instanceof _s.RepetitionMandatory||t instanceof _s.RepetitionMandatoryWithSeparator||t instanceof _s.RepetitionWithSeparator||t instanceof _s.Repetition)e=e.concat(yd(t.definition));else if(t instanceof _s.Alternation)e=er.flatten(er.map(t.definition,function(o){return yd(o.definition)}));else if(!(t instanceof _s.Terminal))throw Error("non exhaustive match");var i=(0,Ov.isOptionalProd)(t),n=r.length>1;if(i&&n){var s=er.drop(r);return e.concat(yd(s))}else return e}zt.getFirstNoneTerminal=yd;var Uv=function(r){Tv(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.alternations=[],t}return e.prototype.visitAlternation=function(t){this.alternations.push(t)},e}(Mv.GAstVisitor);function Rj(r,e){var t=new Uv;r.accept(t);var i=t.alternations,n=er.reduce(i,function(s,o){var a=er.dropRight(o.definition),l=er.map(a,function(c,u){var g=(0,_Ee.nextPossibleTokensAfter)([c],[],null,1);return er.isEmpty(g)?{message:e.buildEmptyAlternationError({topLevelRule:r,alternation:o,emptyChoiceIdx:u}),type:Do.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:r.name,occurrence:o.idx,alternative:u+1}:null});return s.concat(er.compact(l))},[]);return n}zt.validateEmptyOrAlternative=Rj;function Fj(r,e,t){var i=new Uv;r.accept(i);var n=i.alternations;n=(0,br.reject)(n,function(o){return o.ignoreAmbiguities===!0});var s=er.reduce(n,function(o,a){var l=a.idx,c=a.maxLookahead||e,u=(0,qg.getLookaheadPathsForOr)(l,r,c,a),g=tIe(u,a,r,t),f=Oj(u,a,r,t);return o.concat(g,f)},[]);return s}zt.validateAmbiguousAlternationAlternatives=Fj;var Nj=function(r){Tv(e,r);function e(){var t=r!==null&&r.apply(this,arguments)||this;return t.allProductions=[],t}return e.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},e.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},e.prototype.visitRepetition=function(t){this.allProductions.push(t)},e}(Mv.GAstVisitor);zt.RepetionCollector=Nj;function Lj(r,e){var t=new Uv;r.accept(t);var i=t.alternations,n=er.reduce(i,function(s,o){return o.definition.length>255&&s.push({message:e.buildTooManyAlternativesError({topLevelRule:r,alternation:o}),type:Do.ParserDefinitionErrorType.TOO_MANY_ALTS,ruleName:r.name,occurrence:o.idx}),s},[]);return n}zt.validateTooManyAlts=Lj;function Tj(r,e,t){var i=[];return(0,br.forEach)(r,function(n){var s=new Nj;n.accept(s);var o=s.allProductions;(0,br.forEach)(o,function(a){var l=(0,qg.getProdType)(a),c=a.maxLookahead||e,u=a.idx,g=(0,qg.getLookaheadPathsForOptionalProd)(u,n,l,c),f=g[0];if((0,br.isEmpty)((0,br.flatten)(f))){var h=t.buildEmptyRepetitionError({topLevelRule:n,repetition:a});i.push({message:h,type:Do.ParserDefinitionErrorType.NO_NON_EMPTY_LOOKAHEAD,ruleName:n.name})}})}),i}zt.validateSomeNonEmptyLookaheadPath=Tj;function tIe(r,e,t,i){var n=[],s=(0,br.reduce)(r,function(a,l,c){return e.definition[c].ignoreAmbiguities===!0||(0,br.forEach)(l,function(u){var g=[c];(0,br.forEach)(r,function(f,h){c!==h&&(0,qg.containsPath)(f,u)&&e.definition[h].ignoreAmbiguities!==!0&&g.push(h)}),g.length>1&&!(0,qg.containsPath)(n,u)&&(n.push(u),a.push({alts:g,path:u}))}),a},[]),o=er.map(s,function(a){var l=(0,br.map)(a.alts,function(u){return u+1}),c=i.buildAlternationAmbiguityError({topLevelRule:t,alternation:e,ambiguityIndices:l,prefixPath:a.path});return{message:c,type:Do.ParserDefinitionErrorType.AMBIGUOUS_ALTS,ruleName:t.name,occurrence:e.idx,alternatives:[a.alts]}});return o}function Oj(r,e,t,i){var n=[],s=(0,br.reduce)(r,function(o,a,l){var c=(0,br.map)(a,function(u){return{idx:l,path:u}});return o.concat(c)},[]);return(0,br.forEach)(s,function(o){var a=e.definition[o.idx];if(a.ignoreAmbiguities!==!0){var l=o.idx,c=o.path,u=(0,br.findAll)(s,function(f){return e.definition[f.idx].ignoreAmbiguities!==!0&&f.idx{"use strict";Object.defineProperty(Jg,"__esModule",{value:!0});Jg.validateGrammar=Jg.resolveGrammar=void 0;var Gv=Gt(),iIe=Cj(),nIe=Hv(),Mj=Cd();function sIe(r){r=(0,Gv.defaults)(r,{errMsgProvider:Mj.defaultGrammarResolverErrorProvider});var e={};return(0,Gv.forEach)(r.rules,function(t){e[t.name]=t}),(0,iIe.resolveGrammar)(e,r.errMsgProvider)}Jg.resolveGrammar=sIe;function oIe(r){return r=(0,Gv.defaults)(r,{errMsgProvider:Mj.defaultGrammarValidatorErrorProvider}),(0,nIe.validateGrammar)(r.rules,r.maxLookahead,r.tokenTypes,r.errMsgProvider,r.grammarName)}Jg.validateGrammar=oIe});var Wg=w(mn=>{"use strict";var wd=mn&&mn.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(mn,"__esModule",{value:!0});mn.EarlyExitException=mn.NotAllInputParsedException=mn.NoViableAltException=mn.MismatchedTokenException=mn.isRecognitionException=void 0;var aIe=Gt(),Uj="MismatchedTokenException",Hj="NoViableAltException",Gj="EarlyExitException",Yj="NotAllInputParsedException",jj=[Uj,Hj,Gj,Yj];Object.freeze(jj);function AIe(r){return(0,aIe.contains)(jj,r.name)}mn.isRecognitionException=AIe;var ry=function(r){wd(e,r);function e(t,i){var n=this.constructor,s=r.call(this,t)||this;return s.token=i,s.resyncedTokens=[],Object.setPrototypeOf(s,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(s,s.constructor),s}return e}(Error),lIe=function(r){wd(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Uj,s}return e}(ry);mn.MismatchedTokenException=lIe;var cIe=function(r){wd(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Hj,s}return e}(ry);mn.NoViableAltException=cIe;var uIe=function(r){wd(e,r);function e(t,i){var n=r.call(this,t,i)||this;return n.name=Yj,n}return e}(ry);mn.NotAllInputParsedException=uIe;var gIe=function(r){wd(e,r);function e(t,i,n){var s=r.call(this,t,i)||this;return s.previousToken=n,s.name=Gj,s}return e}(ry);mn.EarlyExitException=gIe});var jv=w(Mi=>{"use strict";Object.defineProperty(Mi,"__esModule",{value:!0});Mi.attemptInRepetitionRecovery=Mi.Recoverable=Mi.InRuleRecoveryException=Mi.IN_RULE_RECOVERY_EXCEPTION=Mi.EOF_FOLLOW_KEY=void 0;var iy=SA(),ls=Gt(),fIe=Wg(),hIe=kv(),pIe=Hn();Mi.EOF_FOLLOW_KEY={};Mi.IN_RULE_RECOVERY_EXCEPTION="InRuleRecoveryException";function Yv(r){this.name=Mi.IN_RULE_RECOVERY_EXCEPTION,this.message=r}Mi.InRuleRecoveryException=Yv;Yv.prototype=Error.prototype;var dIe=function(){function r(){}return r.prototype.initRecoverable=function(e){this.firstAfterRepMap={},this.resyncFollows={},this.recoveryEnabled=(0,ls.has)(e,"recoveryEnabled")?e.recoveryEnabled:pIe.DEFAULT_PARSER_CONFIG.recoveryEnabled,this.recoveryEnabled&&(this.attemptInRepetitionRecovery=qj)},r.prototype.getTokenToInsert=function(e){var t=(0,iy.createTokenInstance)(e,"",NaN,NaN,NaN,NaN,NaN,NaN);return t.isInsertedInRecovery=!0,t},r.prototype.canTokenTypeBeInsertedInRecovery=function(e){return!0},r.prototype.tryInRepetitionRecovery=function(e,t,i,n){for(var s=this,o=this.findReSyncTokenType(),a=this.exportLexerState(),l=[],c=!1,u=this.LA(1),g=this.LA(1),f=function(){var h=s.LA(0),p=s.errorMessageProvider.buildMismatchTokenMessage({expected:n,actual:u,previous:h,ruleName:s.getCurrRuleFullName()}),C=new fIe.MismatchedTokenException(p,u,s.LA(0));C.resyncedTokens=(0,ls.dropRight)(l),s.SAVE_ERROR(C)};!c;)if(this.tokenMatcher(g,n)){f();return}else if(i.call(this)){f(),e.apply(this,t);return}else this.tokenMatcher(g,o)?c=!0:(g=this.SKIP_TOKEN(),this.addToResyncTokens(g,l));this.importLexerState(a)},r.prototype.shouldInRepetitionRecoveryBeTried=function(e,t,i){return!(i===!1||e===void 0||t===void 0||this.tokenMatcher(this.LA(1),e)||this.isBackTracking()||this.canPerformInRuleRecovery(e,this.getFollowsForInRuleRecovery(e,t)))},r.prototype.getFollowsForInRuleRecovery=function(e,t){var i=this.getCurrentGrammarPath(e,t),n=this.getNextPossibleTokenTypes(i);return n},r.prototype.tryInRuleRecovery=function(e,t){if(this.canRecoverWithSingleTokenInsertion(e,t)){var i=this.getTokenToInsert(e);return i}if(this.canRecoverWithSingleTokenDeletion(e)){var n=this.SKIP_TOKEN();return this.consumeToken(),n}throw new Yv("sad sad panda")},r.prototype.canPerformInRuleRecovery=function(e,t){return this.canRecoverWithSingleTokenInsertion(e,t)||this.canRecoverWithSingleTokenDeletion(e)},r.prototype.canRecoverWithSingleTokenInsertion=function(e,t){var i=this;if(!this.canTokenTypeBeInsertedInRecovery(e)||(0,ls.isEmpty)(t))return!1;var n=this.LA(1),s=(0,ls.find)(t,function(o){return i.tokenMatcher(n,o)})!==void 0;return s},r.prototype.canRecoverWithSingleTokenDeletion=function(e){var t=this.tokenMatcher(this.LA(2),e);return t},r.prototype.isInCurrentRuleReSyncSet=function(e){var t=this.getCurrFollowKey(),i=this.getFollowSetFromFollowKey(t);return(0,ls.contains)(i,e)},r.prototype.findReSyncTokenType=function(){for(var e=this.flattenFollowSet(),t=this.LA(1),i=2;;){var n=t.tokenType;if((0,ls.contains)(e,n))return n;t=this.LA(i),i++}},r.prototype.getCurrFollowKey=function(){if(this.RULE_STACK.length===1)return Mi.EOF_FOLLOW_KEY;var e=this.getLastExplicitRuleShortName(),t=this.getLastExplicitRuleOccurrenceIndex(),i=this.getPreviousExplicitRuleShortName();return{ruleName:this.shortRuleNameToFullName(e),idxInCallingRule:t,inRule:this.shortRuleNameToFullName(i)}},r.prototype.buildFullFollowKeyStack=function(){var e=this,t=this.RULE_STACK,i=this.RULE_OCCURRENCE_STACK;return(0,ls.map)(t,function(n,s){return s===0?Mi.EOF_FOLLOW_KEY:{ruleName:e.shortRuleNameToFullName(n),idxInCallingRule:i[s],inRule:e.shortRuleNameToFullName(t[s-1])}})},r.prototype.flattenFollowSet=function(){var e=this,t=(0,ls.map)(this.buildFullFollowKeyStack(),function(i){return e.getFollowSetFromFollowKey(i)});return(0,ls.flatten)(t)},r.prototype.getFollowSetFromFollowKey=function(e){if(e===Mi.EOF_FOLLOW_KEY)return[iy.EOF];var t=e.ruleName+e.idxInCallingRule+hIe.IN+e.inRule;return this.resyncFollows[t]},r.prototype.addToResyncTokens=function(e,t){return this.tokenMatcher(e,iy.EOF)||t.push(e),t},r.prototype.reSyncTo=function(e){for(var t=[],i=this.LA(1);this.tokenMatcher(i,e)===!1;)i=this.SKIP_TOKEN(),this.addToResyncTokens(i,t);return(0,ls.dropRight)(t)},r.prototype.attemptInRepetitionRecovery=function(e,t,i,n,s,o,a){},r.prototype.getCurrentGrammarPath=function(e,t){var i=this.getHumanReadableRuleStack(),n=(0,ls.cloneArr)(this.RULE_OCCURRENCE_STACK),s={ruleStack:i,occurrenceStack:n,lastTok:e,lastTokOccurrence:t};return s},r.prototype.getHumanReadableRuleStack=function(){var e=this;return(0,ls.map)(this.RULE_STACK,function(t){return e.shortRuleNameToFullName(t)})},r}();Mi.Recoverable=dIe;function qj(r,e,t,i,n,s,o){var a=this.getKeyForAutomaticLookahead(i,n),l=this.firstAfterRepMap[a];if(l===void 0){var c=this.getCurrRuleFullName(),u=this.getGAstProductions()[c],g=new s(u,n);l=g.startWalking(),this.firstAfterRepMap[a]=l}var f=l.token,h=l.occurrence,p=l.isEndOfRule;this.RULE_STACK.length===1&&p&&f===void 0&&(f=iy.EOF,h=1),this.shouldInRepetitionRecoveryBeTried(f,h,o)&&this.tryInRepetitionRecovery(r,e,t,f)}Mi.attemptInRepetitionRecovery=qj});var ny=w(qt=>{"use strict";Object.defineProperty(qt,"__esModule",{value:!0});qt.getKeyForAutomaticLookahead=qt.AT_LEAST_ONE_SEP_IDX=qt.MANY_SEP_IDX=qt.AT_LEAST_ONE_IDX=qt.MANY_IDX=qt.OPTION_IDX=qt.OR_IDX=qt.BITS_FOR_ALT_IDX=qt.BITS_FOR_RULE_IDX=qt.BITS_FOR_OCCURRENCE_IDX=qt.BITS_FOR_METHOD_TYPE=void 0;qt.BITS_FOR_METHOD_TYPE=4;qt.BITS_FOR_OCCURRENCE_IDX=8;qt.BITS_FOR_RULE_IDX=12;qt.BITS_FOR_ALT_IDX=8;qt.OR_IDX=1<{"use strict";Object.defineProperty(sy,"__esModule",{value:!0});sy.LooksAhead=void 0;var Qa=Id(),Zs=Gt(),Jj=Hn(),ba=ny(),oc=dd(),mIe=function(){function r(){}return r.prototype.initLooksAhead=function(e){this.dynamicTokensEnabled=(0,Zs.has)(e,"dynamicTokensEnabled")?e.dynamicTokensEnabled:Jj.DEFAULT_PARSER_CONFIG.dynamicTokensEnabled,this.maxLookahead=(0,Zs.has)(e,"maxLookahead")?e.maxLookahead:Jj.DEFAULT_PARSER_CONFIG.maxLookahead,this.lookAheadFuncsCache=(0,Zs.isES2015MapSupported)()?new Map:[],(0,Zs.isES2015MapSupported)()?(this.getLaFuncFromCache=this.getLaFuncFromMap,this.setLaFuncCache=this.setLaFuncCacheUsingMap):(this.getLaFuncFromCache=this.getLaFuncFromObj,this.setLaFuncCache=this.setLaFuncUsingObj)},r.prototype.preComputeLookaheadFunctions=function(e){var t=this;(0,Zs.forEach)(e,function(i){t.TRACE_INIT(i.name+" Rule Lookahead",function(){var n=(0,oc.collectMethods)(i),s=n.alternation,o=n.repetition,a=n.option,l=n.repetitionMandatory,c=n.repetitionMandatoryWithSeparator,u=n.repetitionWithSeparator;(0,Zs.forEach)(s,function(g){var f=g.idx===0?"":g.idx;t.TRACE_INIT(""+(0,oc.getProductionDslName)(g)+f,function(){var h=(0,Qa.buildLookaheadFuncForOr)(g.idx,i,g.maxLookahead||t.maxLookahead,g.hasPredicates,t.dynamicTokensEnabled,t.lookAheadBuilderForAlternatives),p=(0,ba.getKeyForAutomaticLookahead)(t.fullRuleNameToShort[i.name],ba.OR_IDX,g.idx);t.setLaFuncCache(p,h)})}),(0,Zs.forEach)(o,function(g){t.computeLookaheadFunc(i,g.idx,ba.MANY_IDX,Qa.PROD_TYPE.REPETITION,g.maxLookahead,(0,oc.getProductionDslName)(g))}),(0,Zs.forEach)(a,function(g){t.computeLookaheadFunc(i,g.idx,ba.OPTION_IDX,Qa.PROD_TYPE.OPTION,g.maxLookahead,(0,oc.getProductionDslName)(g))}),(0,Zs.forEach)(l,function(g){t.computeLookaheadFunc(i,g.idx,ba.AT_LEAST_ONE_IDX,Qa.PROD_TYPE.REPETITION_MANDATORY,g.maxLookahead,(0,oc.getProductionDslName)(g))}),(0,Zs.forEach)(c,function(g){t.computeLookaheadFunc(i,g.idx,ba.AT_LEAST_ONE_SEP_IDX,Qa.PROD_TYPE.REPETITION_MANDATORY_WITH_SEPARATOR,g.maxLookahead,(0,oc.getProductionDslName)(g))}),(0,Zs.forEach)(u,function(g){t.computeLookaheadFunc(i,g.idx,ba.MANY_SEP_IDX,Qa.PROD_TYPE.REPETITION_WITH_SEPARATOR,g.maxLookahead,(0,oc.getProductionDslName)(g))})})})},r.prototype.computeLookaheadFunc=function(e,t,i,n,s,o){var a=this;this.TRACE_INIT(""+o+(t===0?"":t),function(){var l=(0,Qa.buildLookaheadFuncForOptionalProd)(t,e,s||a.maxLookahead,a.dynamicTokensEnabled,n,a.lookAheadBuilderForOptional),c=(0,ba.getKeyForAutomaticLookahead)(a.fullRuleNameToShort[e.name],i,t);a.setLaFuncCache(c,l)})},r.prototype.lookAheadBuilderForOptional=function(e,t,i){return(0,Qa.buildSingleAlternativeLookaheadFunction)(e,t,i)},r.prototype.lookAheadBuilderForAlternatives=function(e,t,i,n){return(0,Qa.buildAlternativesLookAheadFunc)(e,t,i,n)},r.prototype.getKeyForAutomaticLookahead=function(e,t){var i=this.getLastExplicitRuleShortName();return(0,ba.getKeyForAutomaticLookahead)(i,e,t)},r.prototype.getLaFuncFromCache=function(e){},r.prototype.getLaFuncFromMap=function(e){return this.lookAheadFuncsCache.get(e)},r.prototype.getLaFuncFromObj=function(e){return this.lookAheadFuncsCache[e]},r.prototype.setLaFuncCache=function(e,t){},r.prototype.setLaFuncCacheUsingMap=function(e,t){this.lookAheadFuncsCache.set(e,t)},r.prototype.setLaFuncUsingObj=function(e,t){this.lookAheadFuncsCache[e]=t},r}();sy.LooksAhead=mIe});var zj=w(ko=>{"use strict";Object.defineProperty(ko,"__esModule",{value:!0});ko.addNoneTerminalToCst=ko.addTerminalToCst=ko.setNodeLocationFull=ko.setNodeLocationOnlyOffset=void 0;function EIe(r,e){isNaN(r.startOffset)===!0?(r.startOffset=e.startOffset,r.endOffset=e.endOffset):r.endOffset{"use strict";Object.defineProperty(PA,"__esModule",{value:!0});PA.defineNameProp=PA.functionName=PA.classNameFromInstance=void 0;var BIe=Gt();function QIe(r){return Xj(r.constructor)}PA.classNameFromInstance=QIe;var Vj="name";function Xj(r){var e=r.name;return e||"anonymous"}PA.functionName=Xj;function bIe(r,e){var t=Object.getOwnPropertyDescriptor(r,Vj);return(0,BIe.isUndefined)(t)||t.configurable?(Object.defineProperty(r,Vj,{enumerable:!1,configurable:!0,writable:!1,value:e}),!0):!1}PA.defineNameProp=bIe});var tq=w(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.validateRedundantMethods=bi.validateMissingCstMethods=bi.validateVisitor=bi.CstVisitorDefinitionError=bi.createBaseVisitorConstructorWithDefaults=bi.createBaseSemanticVisitorConstructor=bi.defaultVisit=void 0;var cs=Gt(),Bd=qv();function _j(r,e){for(var t=(0,cs.keys)(r),i=t.length,n=0;n: - `+(""+s.join(` - -`).replace(/\n/g,` - `)))}}};return t.prototype=i,t.prototype.constructor=t,t._RULE_NAMES=e,t}bi.createBaseSemanticVisitorConstructor=SIe;function vIe(r,e,t){var i=function(){};(0,Bd.defineNameProp)(i,r+"BaseSemanticsWithDefaults");var n=Object.create(t.prototype);return(0,cs.forEach)(e,function(s){n[s]=_j}),i.prototype=n,i.prototype.constructor=i,i}bi.createBaseVisitorConstructorWithDefaults=vIe;var Jv;(function(r){r[r.REDUNDANT_METHOD=0]="REDUNDANT_METHOD",r[r.MISSING_METHOD=1]="MISSING_METHOD"})(Jv=bi.CstVisitorDefinitionError||(bi.CstVisitorDefinitionError={}));function Zj(r,e){var t=$j(r,e),i=eq(r,e);return t.concat(i)}bi.validateVisitor=Zj;function $j(r,e){var t=(0,cs.map)(e,function(i){if(!(0,cs.isFunction)(r[i]))return{msg:"Missing visitor method: <"+i+"> on "+(0,Bd.functionName)(r.constructor)+" CST Visitor.",type:Jv.MISSING_METHOD,methodName:i}});return(0,cs.compact)(t)}bi.validateMissingCstMethods=$j;var xIe=["constructor","visit","validateVisitor"];function eq(r,e){var t=[];for(var i in r)(0,cs.isFunction)(r[i])&&!(0,cs.contains)(xIe,i)&&!(0,cs.contains)(e,i)&&t.push({msg:"Redundant visitor method: <"+i+"> on "+(0,Bd.functionName)(r.constructor)+` CST Visitor -There is no Grammar Rule corresponding to this method's name. -`,type:Jv.REDUNDANT_METHOD,methodName:i});return t}bi.validateRedundantMethods=eq});var iq=w(oy=>{"use strict";Object.defineProperty(oy,"__esModule",{value:!0});oy.TreeBuilder=void 0;var zg=zj(),Zr=Gt(),rq=tq(),PIe=Hn(),DIe=function(){function r(){}return r.prototype.initTreeBuilder=function(e){if(this.CST_STACK=[],this.outputCst=e.outputCst,this.nodeLocationTracking=(0,Zr.has)(e,"nodeLocationTracking")?e.nodeLocationTracking:PIe.DEFAULT_PARSER_CONFIG.nodeLocationTracking,!this.outputCst)this.cstInvocationStateUpdate=Zr.NOOP,this.cstFinallyStateUpdate=Zr.NOOP,this.cstPostTerminal=Zr.NOOP,this.cstPostNonTerminal=Zr.NOOP,this.cstPostRule=Zr.NOOP;else if(/full/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zg.setNodeLocationFull,this.setNodeLocationFromNode=zg.setNodeLocationFull,this.cstPostRule=Zr.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationFullRecovery):(this.setNodeLocationFromToken=Zr.NOOP,this.setNodeLocationFromNode=Zr.NOOP,this.cstPostRule=this.cstPostRuleFull,this.setInitialNodeLocation=this.setInitialNodeLocationFullRegular);else if(/onlyOffset/i.test(this.nodeLocationTracking))this.recoveryEnabled?(this.setNodeLocationFromToken=zg.setNodeLocationOnlyOffset,this.setNodeLocationFromNode=zg.setNodeLocationOnlyOffset,this.cstPostRule=Zr.NOOP,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRecovery):(this.setNodeLocationFromToken=Zr.NOOP,this.setNodeLocationFromNode=Zr.NOOP,this.cstPostRule=this.cstPostRuleOnlyOffset,this.setInitialNodeLocation=this.setInitialNodeLocationOnlyOffsetRegular);else if(/none/i.test(this.nodeLocationTracking))this.setNodeLocationFromToken=Zr.NOOP,this.setNodeLocationFromNode=Zr.NOOP,this.cstPostRule=Zr.NOOP,this.setInitialNodeLocation=Zr.NOOP;else throw Error('Invalid config option: "'+e.nodeLocationTracking+'"')},r.prototype.setInitialNodeLocationOnlyOffsetRecovery=function(e){e.location={startOffset:NaN,endOffset:NaN}},r.prototype.setInitialNodeLocationOnlyOffsetRegular=function(e){e.location={startOffset:this.LA(1).startOffset,endOffset:NaN}},r.prototype.setInitialNodeLocationFullRecovery=function(e){e.location={startOffset:NaN,startLine:NaN,startColumn:NaN,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.setInitialNodeLocationFullRegular=function(e){var t=this.LA(1);e.location={startOffset:t.startOffset,startLine:t.startLine,startColumn:t.startColumn,endOffset:NaN,endLine:NaN,endColumn:NaN}},r.prototype.cstInvocationStateUpdate=function(e,t){var i={name:e,children:{}};this.setInitialNodeLocation(i),this.CST_STACK.push(i)},r.prototype.cstFinallyStateUpdate=function(){this.CST_STACK.pop()},r.prototype.cstPostRuleFull=function(e){var t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?(i.endOffset=t.endOffset,i.endLine=t.endLine,i.endColumn=t.endColumn):(i.startOffset=NaN,i.startLine=NaN,i.startColumn=NaN)},r.prototype.cstPostRuleOnlyOffset=function(e){var t=this.LA(0),i=e.location;i.startOffset<=t.startOffset?i.endOffset=t.endOffset:i.startOffset=NaN},r.prototype.cstPostTerminal=function(e,t){var i=this.CST_STACK[this.CST_STACK.length-1];(0,zg.addTerminalToCst)(i,t,e),this.setNodeLocationFromToken(i.location,t)},r.prototype.cstPostNonTerminal=function(e,t){var i=this.CST_STACK[this.CST_STACK.length-1];(0,zg.addNoneTerminalToCst)(i,t,e),this.setNodeLocationFromNode(i.location,e.location)},r.prototype.getBaseCstVisitorConstructor=function(){if((0,Zr.isUndefined)(this.baseCstVisitorConstructor)){var e=(0,rq.createBaseSemanticVisitorConstructor)(this.className,(0,Zr.keys)(this.gastProductionsCache));return this.baseCstVisitorConstructor=e,e}return this.baseCstVisitorConstructor},r.prototype.getBaseCstVisitorConstructorWithDefaults=function(){if((0,Zr.isUndefined)(this.baseCstVisitorWithDefaultsConstructor)){var e=(0,rq.createBaseVisitorConstructorWithDefaults)(this.className,(0,Zr.keys)(this.gastProductionsCache),this.getBaseCstVisitorConstructor());return this.baseCstVisitorWithDefaultsConstructor=e,e}return this.baseCstVisitorWithDefaultsConstructor},r.prototype.getLastExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-1]},r.prototype.getPreviousExplicitRuleShortName=function(){var e=this.RULE_STACK;return e[e.length-2]},r.prototype.getLastExplicitRuleOccurrenceIndex=function(){var e=this.RULE_OCCURRENCE_STACK;return e[e.length-1]},r}();oy.TreeBuilder=DIe});var sq=w(ay=>{"use strict";Object.defineProperty(ay,"__esModule",{value:!0});ay.LexerAdapter=void 0;var nq=Hn(),kIe=function(){function r(){}return r.prototype.initLexerAdapter=function(){this.tokVector=[],this.tokVectorLength=0,this.currIdx=-1},Object.defineProperty(r.prototype,"input",{get:function(){return this.tokVector},set:function(e){if(this.selfAnalysisDone!==!0)throw Error("Missing invocation at the end of the Parser's constructor.");this.reset(),this.tokVector=e,this.tokVectorLength=e.length},enumerable:!1,configurable:!0}),r.prototype.SKIP_TOKEN=function(){return this.currIdx<=this.tokVector.length-2?(this.consumeToken(),this.LA(1)):nq.END_OF_FILE},r.prototype.LA=function(e){var t=this.currIdx+e;return t<0||this.tokVectorLength<=t?nq.END_OF_FILE:this.tokVector[t]},r.prototype.consumeToken=function(){this.currIdx++},r.prototype.exportLexerState=function(){return this.currIdx},r.prototype.importLexerState=function(e){this.currIdx=e},r.prototype.resetLexerState=function(){this.currIdx=-1},r.prototype.moveToTerminatedState=function(){this.currIdx=this.tokVector.length-1},r.prototype.getLexerPosition=function(){return this.exportLexerState()},r}();ay.LexerAdapter=kIe});var aq=w(Ay=>{"use strict";Object.defineProperty(Ay,"__esModule",{value:!0});Ay.RecognizerApi=void 0;var oq=Gt(),RIe=Wg(),Wv=Hn(),FIe=Cd(),NIe=Hv(),LIe=dn(),TIe=function(){function r(){}return r.prototype.ACTION=function(e){return e.call(this)},r.prototype.consume=function(e,t,i){return this.consumeInternal(t,e,i)},r.prototype.subrule=function(e,t,i){return this.subruleInternal(t,e,i)},r.prototype.option=function(e,t){return this.optionInternal(t,e)},r.prototype.or=function(e,t){return this.orInternal(t,e)},r.prototype.many=function(e,t){return this.manyInternal(e,t)},r.prototype.atLeastOne=function(e,t){return this.atLeastOneInternal(e,t)},r.prototype.CONSUME=function(e,t){return this.consumeInternal(e,0,t)},r.prototype.CONSUME1=function(e,t){return this.consumeInternal(e,1,t)},r.prototype.CONSUME2=function(e,t){return this.consumeInternal(e,2,t)},r.prototype.CONSUME3=function(e,t){return this.consumeInternal(e,3,t)},r.prototype.CONSUME4=function(e,t){return this.consumeInternal(e,4,t)},r.prototype.CONSUME5=function(e,t){return this.consumeInternal(e,5,t)},r.prototype.CONSUME6=function(e,t){return this.consumeInternal(e,6,t)},r.prototype.CONSUME7=function(e,t){return this.consumeInternal(e,7,t)},r.prototype.CONSUME8=function(e,t){return this.consumeInternal(e,8,t)},r.prototype.CONSUME9=function(e,t){return this.consumeInternal(e,9,t)},r.prototype.SUBRULE=function(e,t){return this.subruleInternal(e,0,t)},r.prototype.SUBRULE1=function(e,t){return this.subruleInternal(e,1,t)},r.prototype.SUBRULE2=function(e,t){return this.subruleInternal(e,2,t)},r.prototype.SUBRULE3=function(e,t){return this.subruleInternal(e,3,t)},r.prototype.SUBRULE4=function(e,t){return this.subruleInternal(e,4,t)},r.prototype.SUBRULE5=function(e,t){return this.subruleInternal(e,5,t)},r.prototype.SUBRULE6=function(e,t){return this.subruleInternal(e,6,t)},r.prototype.SUBRULE7=function(e,t){return this.subruleInternal(e,7,t)},r.prototype.SUBRULE8=function(e,t){return this.subruleInternal(e,8,t)},r.prototype.SUBRULE9=function(e,t){return this.subruleInternal(e,9,t)},r.prototype.OPTION=function(e){return this.optionInternal(e,0)},r.prototype.OPTION1=function(e){return this.optionInternal(e,1)},r.prototype.OPTION2=function(e){return this.optionInternal(e,2)},r.prototype.OPTION3=function(e){return this.optionInternal(e,3)},r.prototype.OPTION4=function(e){return this.optionInternal(e,4)},r.prototype.OPTION5=function(e){return this.optionInternal(e,5)},r.prototype.OPTION6=function(e){return this.optionInternal(e,6)},r.prototype.OPTION7=function(e){return this.optionInternal(e,7)},r.prototype.OPTION8=function(e){return this.optionInternal(e,8)},r.prototype.OPTION9=function(e){return this.optionInternal(e,9)},r.prototype.OR=function(e){return this.orInternal(e,0)},r.prototype.OR1=function(e){return this.orInternal(e,1)},r.prototype.OR2=function(e){return this.orInternal(e,2)},r.prototype.OR3=function(e){return this.orInternal(e,3)},r.prototype.OR4=function(e){return this.orInternal(e,4)},r.prototype.OR5=function(e){return this.orInternal(e,5)},r.prototype.OR6=function(e){return this.orInternal(e,6)},r.prototype.OR7=function(e){return this.orInternal(e,7)},r.prototype.OR8=function(e){return this.orInternal(e,8)},r.prototype.OR9=function(e){return this.orInternal(e,9)},r.prototype.MANY=function(e){this.manyInternal(0,e)},r.prototype.MANY1=function(e){this.manyInternal(1,e)},r.prototype.MANY2=function(e){this.manyInternal(2,e)},r.prototype.MANY3=function(e){this.manyInternal(3,e)},r.prototype.MANY4=function(e){this.manyInternal(4,e)},r.prototype.MANY5=function(e){this.manyInternal(5,e)},r.prototype.MANY6=function(e){this.manyInternal(6,e)},r.prototype.MANY7=function(e){this.manyInternal(7,e)},r.prototype.MANY8=function(e){this.manyInternal(8,e)},r.prototype.MANY9=function(e){this.manyInternal(9,e)},r.prototype.MANY_SEP=function(e){this.manySepFirstInternal(0,e)},r.prototype.MANY_SEP1=function(e){this.manySepFirstInternal(1,e)},r.prototype.MANY_SEP2=function(e){this.manySepFirstInternal(2,e)},r.prototype.MANY_SEP3=function(e){this.manySepFirstInternal(3,e)},r.prototype.MANY_SEP4=function(e){this.manySepFirstInternal(4,e)},r.prototype.MANY_SEP5=function(e){this.manySepFirstInternal(5,e)},r.prototype.MANY_SEP6=function(e){this.manySepFirstInternal(6,e)},r.prototype.MANY_SEP7=function(e){this.manySepFirstInternal(7,e)},r.prototype.MANY_SEP8=function(e){this.manySepFirstInternal(8,e)},r.prototype.MANY_SEP9=function(e){this.manySepFirstInternal(9,e)},r.prototype.AT_LEAST_ONE=function(e){this.atLeastOneInternal(0,e)},r.prototype.AT_LEAST_ONE1=function(e){return this.atLeastOneInternal(1,e)},r.prototype.AT_LEAST_ONE2=function(e){this.atLeastOneInternal(2,e)},r.prototype.AT_LEAST_ONE3=function(e){this.atLeastOneInternal(3,e)},r.prototype.AT_LEAST_ONE4=function(e){this.atLeastOneInternal(4,e)},r.prototype.AT_LEAST_ONE5=function(e){this.atLeastOneInternal(5,e)},r.prototype.AT_LEAST_ONE6=function(e){this.atLeastOneInternal(6,e)},r.prototype.AT_LEAST_ONE7=function(e){this.atLeastOneInternal(7,e)},r.prototype.AT_LEAST_ONE8=function(e){this.atLeastOneInternal(8,e)},r.prototype.AT_LEAST_ONE9=function(e){this.atLeastOneInternal(9,e)},r.prototype.AT_LEAST_ONE_SEP=function(e){this.atLeastOneSepFirstInternal(0,e)},r.prototype.AT_LEAST_ONE_SEP1=function(e){this.atLeastOneSepFirstInternal(1,e)},r.prototype.AT_LEAST_ONE_SEP2=function(e){this.atLeastOneSepFirstInternal(2,e)},r.prototype.AT_LEAST_ONE_SEP3=function(e){this.atLeastOneSepFirstInternal(3,e)},r.prototype.AT_LEAST_ONE_SEP4=function(e){this.atLeastOneSepFirstInternal(4,e)},r.prototype.AT_LEAST_ONE_SEP5=function(e){this.atLeastOneSepFirstInternal(5,e)},r.prototype.AT_LEAST_ONE_SEP6=function(e){this.atLeastOneSepFirstInternal(6,e)},r.prototype.AT_LEAST_ONE_SEP7=function(e){this.atLeastOneSepFirstInternal(7,e)},r.prototype.AT_LEAST_ONE_SEP8=function(e){this.atLeastOneSepFirstInternal(8,e)},r.prototype.AT_LEAST_ONE_SEP9=function(e){this.atLeastOneSepFirstInternal(9,e)},r.prototype.RULE=function(e,t,i){if(i===void 0&&(i=Wv.DEFAULT_RULE_CONFIG),(0,oq.contains)(this.definedRulesNames,e)){var n=FIe.defaultGrammarValidatorErrorProvider.buildDuplicateRuleNameError({topLevelRule:e,grammarName:this.className}),s={message:n,type:Wv.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:e};this.definitionErrors.push(s)}this.definedRulesNames.push(e);var o=this.defineRule(e,t,i);return this[e]=o,o},r.prototype.OVERRIDE_RULE=function(e,t,i){i===void 0&&(i=Wv.DEFAULT_RULE_CONFIG);var n=[];n=n.concat((0,NIe.validateRuleIsOverridden)(e,this.definedRulesNames,this.className)),this.definitionErrors=this.definitionErrors.concat(n);var s=this.defineRule(e,t,i);return this[e]=s,s},r.prototype.BACKTRACK=function(e,t){return function(){this.isBackTrackingStack.push(1);var i=this.saveRecogState();try{return e.apply(this,t),!0}catch(n){if((0,RIe.isRecognitionException)(n))return!1;throw n}finally{this.reloadRecogState(i),this.isBackTrackingStack.pop()}}},r.prototype.getGAstProductions=function(){return this.gastProductionsCache},r.prototype.getSerializedGastProductions=function(){return(0,LIe.serializeGrammar)((0,oq.values)(this.gastProductionsCache))},r}();Ay.RecognizerApi=TIe});var uq=w(cy=>{"use strict";Object.defineProperty(cy,"__esModule",{value:!0});cy.RecognizerEngine=void 0;var Pr=Gt(),Gn=ny(),ly=Wg(),Aq=Id(),Vg=Ed(),lq=Hn(),OIe=jv(),cq=SA(),Qd=Gg(),MIe=qv(),KIe=function(){function r(){}return r.prototype.initRecognizerEngine=function(e,t){if(this.className=(0,MIe.classNameFromInstance)(this),this.shortRuleNameToFull={},this.fullRuleNameToShort={},this.ruleShortNameIdx=256,this.tokenMatcher=Qd.tokenStructuredMatcherNoCategories,this.definedRulesNames=[],this.tokensMap={},this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.gastProductionsCache={},(0,Pr.has)(t,"serializedGrammar"))throw Error(`The Parser's configuration can no longer contain a property. - See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_6-0-0 - For Further details.`);if((0,Pr.isArray)(e)){if((0,Pr.isEmpty)(e))throw Error(`A Token Vocabulary cannot be empty. - Note that the first argument for the parser constructor - is no longer a Token vector (since v4.0).`);if(typeof e[0].startOffset=="number")throw Error(`The Parser constructor no longer accepts a token vector as the first argument. - See: https://chevrotain.io/docs/changes/BREAKING_CHANGES.html#_4-0-0 - For Further details.`)}if((0,Pr.isArray)(e))this.tokensMap=(0,Pr.reduce)(e,function(o,a){return o[a.name]=a,o},{});else if((0,Pr.has)(e,"modes")&&(0,Pr.every)((0,Pr.flatten)((0,Pr.values)(e.modes)),Qd.isTokenType)){var i=(0,Pr.flatten)((0,Pr.values)(e.modes)),n=(0,Pr.uniq)(i);this.tokensMap=(0,Pr.reduce)(n,function(o,a){return o[a.name]=a,o},{})}else if((0,Pr.isObject)(e))this.tokensMap=(0,Pr.cloneObj)(e);else throw new Error(" argument must be An Array of Token constructors, A dictionary of Token constructors or an IMultiModeLexerDefinition");this.tokensMap.EOF=cq.EOF;var s=(0,Pr.every)((0,Pr.values)(e),function(o){return(0,Pr.isEmpty)(o.categoryMatches)});this.tokenMatcher=s?Qd.tokenStructuredMatcherNoCategories:Qd.tokenStructuredMatcher,(0,Qd.augmentTokenTypes)((0,Pr.values)(this.tokensMap))},r.prototype.defineRule=function(e,t,i){if(this.selfAnalysisDone)throw Error("Grammar rule <"+e+`> may not be defined after the 'performSelfAnalysis' method has been called' -Make sure that all grammar rule definitions are done before 'performSelfAnalysis' is called.`);var n=(0,Pr.has)(i,"resyncEnabled")?i.resyncEnabled:lq.DEFAULT_RULE_CONFIG.resyncEnabled,s=(0,Pr.has)(i,"recoveryValueFunc")?i.recoveryValueFunc:lq.DEFAULT_RULE_CONFIG.recoveryValueFunc,o=this.ruleShortNameIdx<t},r.prototype.orInternal=function(e,t){var i=this.getKeyForAutomaticLookahead(Gn.OR_IDX,t),n=(0,Pr.isArray)(e)?e:e.DEF,s=this.getLaFuncFromCache(i),o=s.call(this,n);if(o!==void 0){var a=n[o];return a.ALT.call(this)}this.raiseNoAltException(t,e.ERR_MSG)},r.prototype.ruleFinallyStateUpdate=function(){if(this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop(),this.cstFinallyStateUpdate(),this.RULE_STACK.length===0&&this.isAtEndOfInput()===!1){var e=this.LA(1),t=this.errorMessageProvider.buildNotAllInputParsedMessage({firstRedundant:e,ruleName:this.getCurrRuleFullName()});this.SAVE_ERROR(new ly.NotAllInputParsedException(t,e))}},r.prototype.subruleInternal=function(e,t,i){var n;try{var s=i!==void 0?i.ARGS:void 0;return n=e.call(this,t,s),this.cstPostNonTerminal(n,i!==void 0&&i.LABEL!==void 0?i.LABEL:e.ruleName),n}catch(o){this.subruleInternalError(o,i,e.ruleName)}},r.prototype.subruleInternalError=function(e,t,i){throw(0,ly.isRecognitionException)(e)&&e.partialCstResult!==void 0&&(this.cstPostNonTerminal(e.partialCstResult,t!==void 0&&t.LABEL!==void 0?t.LABEL:i),delete e.partialCstResult),e},r.prototype.consumeInternal=function(e,t,i){var n;try{var s=this.LA(1);this.tokenMatcher(s,e)===!0?(this.consumeToken(),n=s):this.consumeInternalError(e,s,i)}catch(o){n=this.consumeInternalRecovery(e,t,o)}return this.cstPostTerminal(i!==void 0&&i.LABEL!==void 0?i.LABEL:e.name,n),n},r.prototype.consumeInternalError=function(e,t,i){var n,s=this.LA(0);throw i!==void 0&&i.ERR_MSG?n=i.ERR_MSG:n=this.errorMessageProvider.buildMismatchTokenMessage({expected:e,actual:t,previous:s,ruleName:this.getCurrRuleFullName()}),this.SAVE_ERROR(new ly.MismatchedTokenException(n,t,s))},r.prototype.consumeInternalRecovery=function(e,t,i){if(this.recoveryEnabled&&i.name==="MismatchedTokenException"&&!this.isBackTracking()){var n=this.getFollowsForInRuleRecovery(e,t);try{return this.tryInRuleRecovery(e,n)}catch(s){throw s.name===OIe.IN_RULE_RECOVERY_EXCEPTION?i:s}}else throw i},r.prototype.saveRecogState=function(){var e=this.errors,t=(0,Pr.cloneArr)(this.RULE_STACK);return{errors:e,lexerState:this.exportLexerState(),RULE_STACK:t,CST_STACK:this.CST_STACK}},r.prototype.reloadRecogState=function(e){this.errors=e.errors,this.importLexerState(e.lexerState),this.RULE_STACK=e.RULE_STACK},r.prototype.ruleInvocationStateUpdate=function(e,t,i){this.RULE_OCCURRENCE_STACK.push(i),this.RULE_STACK.push(e),this.cstInvocationStateUpdate(t,e)},r.prototype.isBackTracking=function(){return this.isBackTrackingStack.length!==0},r.prototype.getCurrRuleFullName=function(){var e=this.getLastExplicitRuleShortName();return this.shortRuleNameToFull[e]},r.prototype.shortRuleNameToFullName=function(e){return this.shortRuleNameToFull[e]},r.prototype.isAtEndOfInput=function(){return this.tokenMatcher(this.LA(1),cq.EOF)},r.prototype.reset=function(){this.resetLexerState(),this.isBackTrackingStack=[],this.errors=[],this.RULE_STACK=[],this.CST_STACK=[],this.RULE_OCCURRENCE_STACK=[]},r}();cy.RecognizerEngine=KIe});var fq=w(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});uy.ErrorHandler=void 0;var zv=Wg(),Vv=Gt(),gq=Id(),UIe=Hn(),HIe=function(){function r(){}return r.prototype.initErrorHandler=function(e){this._errors=[],this.errorMessageProvider=(0,Vv.has)(e,"errorMessageProvider")?e.errorMessageProvider:UIe.DEFAULT_PARSER_CONFIG.errorMessageProvider},r.prototype.SAVE_ERROR=function(e){if((0,zv.isRecognitionException)(e))return e.context={ruleStack:this.getHumanReadableRuleStack(),ruleOccurrenceStack:(0,Vv.cloneArr)(this.RULE_OCCURRENCE_STACK)},this._errors.push(e),e;throw Error("Trying to save an Error which is not a RecognitionException")},Object.defineProperty(r.prototype,"errors",{get:function(){return(0,Vv.cloneArr)(this._errors)},set:function(e){this._errors=e},enumerable:!1,configurable:!0}),r.prototype.raiseEarlyExitException=function(e,t,i){for(var n=this.getCurrRuleFullName(),s=this.getGAstProductions()[n],o=(0,gq.getLookaheadPathsForOptionalProd)(e,s,t,this.maxLookahead),a=o[0],l=[],c=1;c<=this.maxLookahead;c++)l.push(this.LA(c));var u=this.errorMessageProvider.buildEarlyExitMessage({expectedIterationPaths:a,actual:l,previous:this.LA(0),customUserDescription:i,ruleName:n});throw this.SAVE_ERROR(new zv.EarlyExitException(u,this.LA(1),this.LA(0)))},r.prototype.raiseNoAltException=function(e,t){for(var i=this.getCurrRuleFullName(),n=this.getGAstProductions()[i],s=(0,gq.getLookaheadPathsForOr)(e,n,this.maxLookahead),o=[],a=1;a<=this.maxLookahead;a++)o.push(this.LA(a));var l=this.LA(0),c=this.errorMessageProvider.buildNoViableAltMessage({expectedPathsPerAlt:s,actual:o,previous:l,customUserDescription:t,ruleName:this.getCurrRuleFullName()});throw this.SAVE_ERROR(new zv.NoViableAltException(c,this.LA(1),l))},r}();uy.ErrorHandler=HIe});var dq=w(gy=>{"use strict";Object.defineProperty(gy,"__esModule",{value:!0});gy.ContentAssist=void 0;var hq=Ed(),pq=Gt(),GIe=function(){function r(){}return r.prototype.initContentAssist=function(){},r.prototype.computeContentAssist=function(e,t){var i=this.gastProductionsCache[e];if((0,pq.isUndefined)(i))throw Error("Rule ->"+e+"<- does not exist in this grammar.");return(0,hq.nextPossibleTokensAfter)([i],t,this.tokenMatcher,this.maxLookahead)},r.prototype.getNextPossibleTokenTypes=function(e){var t=(0,pq.first)(e.ruleStack),i=this.getGAstProductions(),n=i[t],s=new hq.NextAfterTokenWalker(n,e).startWalking();return s},r}();gy.ContentAssist=GIe});var Qq=w(py=>{"use strict";Object.defineProperty(py,"__esModule",{value:!0});py.GastRecorder=void 0;var En=Gt(),Ro=dn(),YIe=gd(),Iq=Gg(),yq=SA(),jIe=Hn(),qIe=ny(),hy={description:"This Object indicates the Parser is during Recording Phase"};Object.freeze(hy);var Cq=!0,mq=Math.pow(2,qIe.BITS_FOR_OCCURRENCE_IDX)-1,wq=(0,yq.createToken)({name:"RECORDING_PHASE_TOKEN",pattern:YIe.Lexer.NA});(0,Iq.augmentTokenTypes)([wq]);var Bq=(0,yq.createTokenInstance)(wq,`This IToken indicates the Parser is in Recording Phase - See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,-1,-1,-1,-1,-1,-1);Object.freeze(Bq);var JIe={name:`This CSTNode indicates the Parser is in Recording Phase - See: https://chevrotain.io/docs/guide/internals.html#grammar-recording for details`,children:{}},WIe=function(){function r(){}return r.prototype.initGastRecorder=function(e){this.recordingProdStack=[],this.RECORDING_PHASE=!1},r.prototype.enableRecording=function(){var e=this;this.RECORDING_PHASE=!0,this.TRACE_INIT("Enable Recording",function(){for(var t=function(n){var s=n>0?n:"";e["CONSUME"+s]=function(o,a){return this.consumeInternalRecord(o,n,a)},e["SUBRULE"+s]=function(o,a){return this.subruleInternalRecord(o,n,a)},e["OPTION"+s]=function(o){return this.optionInternalRecord(o,n)},e["OR"+s]=function(o){return this.orInternalRecord(o,n)},e["MANY"+s]=function(o){this.manyInternalRecord(n,o)},e["MANY_SEP"+s]=function(o){this.manySepFirstInternalRecord(n,o)},e["AT_LEAST_ONE"+s]=function(o){this.atLeastOneInternalRecord(n,o)},e["AT_LEAST_ONE_SEP"+s]=function(o){this.atLeastOneSepFirstInternalRecord(n,o)}},i=0;i<10;i++)t(i);e.consume=function(n,s,o){return this.consumeInternalRecord(s,n,o)},e.subrule=function(n,s,o){return this.subruleInternalRecord(s,n,o)},e.option=function(n,s){return this.optionInternalRecord(s,n)},e.or=function(n,s){return this.orInternalRecord(s,n)},e.many=function(n,s){this.manyInternalRecord(n,s)},e.atLeastOne=function(n,s){this.atLeastOneInternalRecord(n,s)},e.ACTION=e.ACTION_RECORD,e.BACKTRACK=e.BACKTRACK_RECORD,e.LA=e.LA_RECORD})},r.prototype.disableRecording=function(){var e=this;this.RECORDING_PHASE=!1,this.TRACE_INIT("Deleting Recording methods",function(){for(var t=0;t<10;t++){var i=t>0?t:"";delete e["CONSUME"+i],delete e["SUBRULE"+i],delete e["OPTION"+i],delete e["OR"+i],delete e["MANY"+i],delete e["MANY_SEP"+i],delete e["AT_LEAST_ONE"+i],delete e["AT_LEAST_ONE_SEP"+i]}delete e.consume,delete e.subrule,delete e.option,delete e.or,delete e.many,delete e.atLeastOne,delete e.ACTION,delete e.BACKTRACK,delete e.LA})},r.prototype.ACTION_RECORD=function(e){},r.prototype.BACKTRACK_RECORD=function(e,t){return function(){return!0}},r.prototype.LA_RECORD=function(e){return jIe.END_OF_FILE},r.prototype.topLevelRuleRecord=function(e,t){try{var i=new Ro.Rule({definition:[],name:e});return i.name=e,this.recordingProdStack.push(i),t.call(this),this.recordingProdStack.pop(),i}catch(n){if(n.KNOWN_RECORDER_ERROR!==!0)try{n.message=n.message+` - This error was thrown during the "grammar recording phase" For more info see: - https://chevrotain.io/docs/guide/internals.html#grammar-recording`}catch{throw n}throw n}},r.prototype.optionInternalRecord=function(e,t){return bd.call(this,Ro.Option,e,t)},r.prototype.atLeastOneInternalRecord=function(e,t){bd.call(this,Ro.RepetitionMandatory,t,e)},r.prototype.atLeastOneSepFirstInternalRecord=function(e,t){bd.call(this,Ro.RepetitionMandatoryWithSeparator,t,e,Cq)},r.prototype.manyInternalRecord=function(e,t){bd.call(this,Ro.Repetition,t,e)},r.prototype.manySepFirstInternalRecord=function(e,t){bd.call(this,Ro.RepetitionWithSeparator,t,e,Cq)},r.prototype.orInternalRecord=function(e,t){return zIe.call(this,e,t)},r.prototype.subruleInternalRecord=function(e,t,i){if(fy(t),!e||(0,En.has)(e,"ruleName")===!1){var n=new Error(" argument is invalid"+(" expecting a Parser method reference but got: <"+JSON.stringify(e)+">")+(` - inside top level rule: <`+this.recordingProdStack[0].name+">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var s=(0,En.peek)(this.recordingProdStack),o=e.ruleName,a=new Ro.NonTerminal({idx:t,nonTerminalName:o,label:i==null?void 0:i.LABEL,referencedRule:void 0});return s.definition.push(a),this.outputCst?JIe:hy},r.prototype.consumeInternalRecord=function(e,t,i){if(fy(t),!(0,Iq.hasShortKeyProperty)(e)){var n=new Error(" argument is invalid"+(" expecting a TokenType reference but got: <"+JSON.stringify(e)+">")+(` - inside top level rule: <`+this.recordingProdStack[0].name+">"));throw n.KNOWN_RECORDER_ERROR=!0,n}var s=(0,En.peek)(this.recordingProdStack),o=new Ro.Terminal({idx:t,terminalType:e,label:i==null?void 0:i.LABEL});return s.definition.push(o),Bq},r}();py.GastRecorder=WIe;function bd(r,e,t,i){i===void 0&&(i=!1),fy(t);var n=(0,En.peek)(this.recordingProdStack),s=(0,En.isFunction)(e)?e:e.DEF,o=new r({definition:[],idx:t});return i&&(o.separator=e.SEP),(0,En.has)(e,"MAX_LOOKAHEAD")&&(o.maxLookahead=e.MAX_LOOKAHEAD),this.recordingProdStack.push(o),s.call(this),n.definition.push(o),this.recordingProdStack.pop(),hy}function zIe(r,e){var t=this;fy(e);var i=(0,En.peek)(this.recordingProdStack),n=(0,En.isArray)(r)===!1,s=n===!1?r:r.DEF,o=new Ro.Alternation({definition:[],idx:e,ignoreAmbiguities:n&&r.IGNORE_AMBIGUITIES===!0});(0,En.has)(r,"MAX_LOOKAHEAD")&&(o.maxLookahead=r.MAX_LOOKAHEAD);var a=(0,En.some)(s,function(l){return(0,En.isFunction)(l.GATE)});return o.hasPredicates=a,i.definition.push(o),(0,En.forEach)(s,function(l){var c=new Ro.Alternative({definition:[]});o.definition.push(c),(0,En.has)(l,"IGNORE_AMBIGUITIES")?c.ignoreAmbiguities=l.IGNORE_AMBIGUITIES:(0,En.has)(l,"GATE")&&(c.ignoreAmbiguities=!0),t.recordingProdStack.push(c),l.ALT.call(t),t.recordingProdStack.pop()}),hy}function Eq(r){return r===0?"":""+r}function fy(r){if(r<0||r>mq){var e=new Error("Invalid DSL Method idx value: <"+r+`> - `+("Idx value must be a none negative value smaller than "+(mq+1)));throw e.KNOWN_RECORDER_ERROR=!0,e}}});var Sq=w(dy=>{"use strict";Object.defineProperty(dy,"__esModule",{value:!0});dy.PerformanceTracer=void 0;var bq=Gt(),VIe=Hn(),XIe=function(){function r(){}return r.prototype.initPerformanceTracer=function(e){if((0,bq.has)(e,"traceInitPerf")){var t=e.traceInitPerf,i=typeof t=="number";this.traceInitMaxIdent=i?t:1/0,this.traceInitPerf=i?t>0:t}else this.traceInitMaxIdent=0,this.traceInitPerf=VIe.DEFAULT_PARSER_CONFIG.traceInitPerf;this.traceInitIndent=-1},r.prototype.TRACE_INIT=function(e,t){if(this.traceInitPerf===!0){this.traceInitIndent++;var i=new Array(this.traceInitIndent+1).join(" ");this.traceInitIndent <"+e+">");var n=(0,bq.timer)(t),s=n.time,o=n.value,a=s>10?console.warn:console.log;return this.traceInitIndent time: "+s+"ms"),this.traceInitIndent--,o}else return t()},r}();dy.PerformanceTracer=XIe});var vq=w(Cy=>{"use strict";Object.defineProperty(Cy,"__esModule",{value:!0});Cy.applyMixins=void 0;function _Ie(r,e){e.forEach(function(t){var i=t.prototype;Object.getOwnPropertyNames(i).forEach(function(n){if(n!=="constructor"){var s=Object.getOwnPropertyDescriptor(i,n);s&&(s.get||s.set)?Object.defineProperty(r.prototype,n,s):r.prototype[n]=t.prototype[n]}})})}Cy.applyMixins=_Ie});var Hn=w(dr=>{"use strict";var Dq=dr&&dr.__extends||function(){var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(i[s]=n[s])},r(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");r(e,t);function i(){this.constructor=e}e.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}}();Object.defineProperty(dr,"__esModule",{value:!0});dr.EmbeddedActionsParser=dr.CstParser=dr.Parser=dr.EMPTY_ALT=dr.ParserDefinitionErrorType=dr.DEFAULT_RULE_CONFIG=dr.DEFAULT_PARSER_CONFIG=dr.END_OF_FILE=void 0;var Xi=Gt(),ZIe=fj(),xq=SA(),kq=Cd(),Pq=Kj(),$Ie=jv(),eye=Wj(),tye=iq(),rye=sq(),iye=aq(),nye=uq(),sye=fq(),oye=dq(),aye=Qq(),Aye=Sq(),lye=vq();dr.END_OF_FILE=(0,xq.createTokenInstance)(xq.EOF,"",NaN,NaN,NaN,NaN,NaN,NaN);Object.freeze(dr.END_OF_FILE);dr.DEFAULT_PARSER_CONFIG=Object.freeze({recoveryEnabled:!1,maxLookahead:3,dynamicTokensEnabled:!1,outputCst:!0,errorMessageProvider:kq.defaultParserErrorProvider,nodeLocationTracking:"none",traceInitPerf:!1,skipValidations:!1});dr.DEFAULT_RULE_CONFIG=Object.freeze({recoveryValueFunc:function(){},resyncEnabled:!0});var cye;(function(r){r[r.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",r[r.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",r[r.INVALID_RULE_OVERRIDE=2]="INVALID_RULE_OVERRIDE",r[r.DUPLICATE_PRODUCTIONS=3]="DUPLICATE_PRODUCTIONS",r[r.UNRESOLVED_SUBRULE_REF=4]="UNRESOLVED_SUBRULE_REF",r[r.LEFT_RECURSION=5]="LEFT_RECURSION",r[r.NONE_LAST_EMPTY_ALT=6]="NONE_LAST_EMPTY_ALT",r[r.AMBIGUOUS_ALTS=7]="AMBIGUOUS_ALTS",r[r.CONFLICT_TOKENS_RULES_NAMESPACE=8]="CONFLICT_TOKENS_RULES_NAMESPACE",r[r.INVALID_TOKEN_NAME=9]="INVALID_TOKEN_NAME",r[r.NO_NON_EMPTY_LOOKAHEAD=10]="NO_NON_EMPTY_LOOKAHEAD",r[r.AMBIGUOUS_PREFIX_ALTS=11]="AMBIGUOUS_PREFIX_ALTS",r[r.TOO_MANY_ALTS=12]="TOO_MANY_ALTS"})(cye=dr.ParserDefinitionErrorType||(dr.ParserDefinitionErrorType={}));function uye(r){return r===void 0&&(r=void 0),function(){return r}}dr.EMPTY_ALT=uye;var my=function(){function r(e,t){this.definitionErrors=[],this.selfAnalysisDone=!1;var i=this;if(i.initErrorHandler(t),i.initLexerAdapter(),i.initLooksAhead(t),i.initRecognizerEngine(e,t),i.initRecoverable(t),i.initTreeBuilder(t),i.initContentAssist(),i.initGastRecorder(t),i.initPerformanceTracer(t),(0,Xi.has)(t,"ignoredIssues"))throw new Error(`The IParserConfig property has been deprecated. - Please use the flag on the relevant DSL method instead. - See: https://chevrotain.io/docs/guide/resolving_grammar_errors.html#IGNORING_AMBIGUITIES - For further details.`);this.skipValidations=(0,Xi.has)(t,"skipValidations")?t.skipValidations:dr.DEFAULT_PARSER_CONFIG.skipValidations}return r.performSelfAnalysis=function(e){throw Error("The **static** `performSelfAnalysis` method has been deprecated. \nUse the **instance** method with the same name instead.")},r.prototype.performSelfAnalysis=function(){var e=this;this.TRACE_INIT("performSelfAnalysis",function(){var t;e.selfAnalysisDone=!0;var i=e.className;e.TRACE_INIT("toFastProps",function(){(0,Xi.toFastProperties)(e)}),e.TRACE_INIT("Grammar Recording",function(){try{e.enableRecording(),(0,Xi.forEach)(e.definedRulesNames,function(s){var o=e[s],a=o.originalGrammarAction,l=void 0;e.TRACE_INIT(s+" Rule",function(){l=e.topLevelRuleRecord(s,a)}),e.gastProductionsCache[s]=l})}finally{e.disableRecording()}});var n=[];if(e.TRACE_INIT("Grammar Resolving",function(){n=(0,Pq.resolveGrammar)({rules:(0,Xi.values)(e.gastProductionsCache)}),e.definitionErrors=e.definitionErrors.concat(n)}),e.TRACE_INIT("Grammar Validations",function(){if((0,Xi.isEmpty)(n)&&e.skipValidations===!1){var s=(0,Pq.validateGrammar)({rules:(0,Xi.values)(e.gastProductionsCache),maxLookahead:e.maxLookahead,tokenTypes:(0,Xi.values)(e.tokensMap),errMsgProvider:kq.defaultGrammarValidatorErrorProvider,grammarName:i});e.definitionErrors=e.definitionErrors.concat(s)}}),(0,Xi.isEmpty)(e.definitionErrors)&&(e.recoveryEnabled&&e.TRACE_INIT("computeAllProdsFollows",function(){var s=(0,ZIe.computeAllProdsFollows)((0,Xi.values)(e.gastProductionsCache));e.resyncFollows=s}),e.TRACE_INIT("ComputeLookaheadFunctions",function(){e.preComputeLookaheadFunctions((0,Xi.values)(e.gastProductionsCache))})),!r.DEFER_DEFINITION_ERRORS_HANDLING&&!(0,Xi.isEmpty)(e.definitionErrors))throw t=(0,Xi.map)(e.definitionErrors,function(s){return s.message}),new Error(`Parser Definition Errors detected: - `+t.join(` -------------------------------- -`))})},r.DEFER_DEFINITION_ERRORS_HANDLING=!1,r}();dr.Parser=my;(0,lye.applyMixins)(my,[$Ie.Recoverable,eye.LooksAhead,tye.TreeBuilder,rye.LexerAdapter,nye.RecognizerEngine,iye.RecognizerApi,sye.ErrorHandler,oye.ContentAssist,aye.GastRecorder,Aye.PerformanceTracer]);var gye=function(r){Dq(e,r);function e(t,i){i===void 0&&(i=dr.DEFAULT_PARSER_CONFIG);var n=this,s=(0,Xi.cloneObj)(i);return s.outputCst=!0,n=r.call(this,t,s)||this,n}return e}(my);dr.CstParser=gye;var fye=function(r){Dq(e,r);function e(t,i){i===void 0&&(i=dr.DEFAULT_PARSER_CONFIG);var n=this,s=(0,Xi.cloneObj)(i);return s.outputCst=!1,n=r.call(this,t,s)||this,n}return e}(my);dr.EmbeddedActionsParser=fye});var Fq=w(Ey=>{"use strict";Object.defineProperty(Ey,"__esModule",{value:!0});Ey.createSyntaxDiagramsCode=void 0;var Rq=pv();function hye(r,e){var t=e===void 0?{}:e,i=t.resourceBase,n=i===void 0?"https://unpkg.com/chevrotain@"+Rq.VERSION+"/diagrams/":i,s=t.css,o=s===void 0?"https://unpkg.com/chevrotain@"+Rq.VERSION+"/diagrams/diagrams.css":s,a=` - - - - - -`,l=` - -`,c=` -